mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
分析页统计:1、x轴长度缩短;2、小板统计返回name拼接板各种属性;3、小板统计限制返回前十条;
角色管理问题修复:排序字段sort改id,解决分页失效问题;
This commit is contained in:
-2
@@ -5,7 +5,6 @@ import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisti
|
||||
import com.cf.imes.module.executor.service.order.OrderStatisticsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -24,7 +23,6 @@ import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
@Tag(name = "管理后台 - 生产单统计管理")
|
||||
@RestController
|
||||
@RequestMapping("/executor/order/statistics")
|
||||
@Validated
|
||||
public class OrderStatisticsController {
|
||||
@Resource
|
||||
private OrderStatisticsService orderStatisticsService;
|
||||
|
||||
+28
-20
@@ -207,17 +207,17 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
.collect(Collectors.groupingBy(OrderGoodsPlateRespVO::getOrderDate, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
// 获取所有商品map
|
||||
Map<Long, String> goodsMap = orderGoodsPlateRespMap.values().stream()
|
||||
Map<Long, OrderGoodsPlateRespVO> goodsMap = orderGoodsPlateRespMap.values().stream()
|
||||
.flatMap(List::stream)
|
||||
.collect(Collectors.toMap(
|
||||
OrderGoodsPlateRespVO::getGoodsId,
|
||||
OrderGoodsPlateRespVO::getMaterial,
|
||||
(oldValue, newValue) -> newValue
|
||||
vo -> vo,
|
||||
(oldValue, newValue) -> oldValue
|
||||
));
|
||||
|
||||
// 遍历订单状态所有枚举值
|
||||
List<Map<String, Object>> series = new ArrayList<>();
|
||||
for (Map.Entry<Long, String> entry : goodsMap.entrySet()) {
|
||||
for (Map.Entry<Long, OrderGoodsPlateRespVO> entry : goodsMap.entrySet()) {
|
||||
Map<String, Object> seriesItem = new HashMap<>();
|
||||
int[] sumArr = new int[dateList.size()];
|
||||
|
||||
@@ -238,7 +238,11 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
|
||||
seriesItem.put("data", sumArr);
|
||||
seriesItem.put("id", entry.getKey());
|
||||
seriesItem.put("name", entry.getValue());
|
||||
// 材质-商品名称-颜色-纹理-宽-高-厚-品牌
|
||||
OrderGoodsPlateRespVO orderGoodsPlateRespVO = entry.getValue();
|
||||
seriesItem.put("name", orderGoodsPlateRespVO.getMaterial() + "-" + orderGoodsPlateRespVO.getGoodsName() +
|
||||
"-" + orderGoodsPlateRespVO.getColor() + "-" + orderGoodsPlateRespVO.getTexture() + "-" + orderGoodsPlateRespVO.getWidth() +
|
||||
"-" + orderGoodsPlateRespVO.getHeight() + "-" + orderGoodsPlateRespVO.getThickness() + "-" + orderGoodsPlateRespVO.getBrand());
|
||||
series.add(seriesItem);
|
||||
}
|
||||
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, reqVO.getUnit())).toList());
|
||||
@@ -260,17 +264,17 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
.collect(Collectors.groupingBy(OrderGoodsPlateRespVO::getOrderDate, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
// 获取所有商品map
|
||||
Map<Long, String> goodsMap = orderGoodsPlateRespMap.values().stream()
|
||||
Map<Long, OrderGoodsPlateRespVO> goodsMap = orderGoodsPlateRespMap.values().stream()
|
||||
.flatMap(List::stream)
|
||||
.collect(Collectors.toMap(
|
||||
OrderGoodsPlateRespVO::getGoodsId,
|
||||
OrderGoodsPlateRespVO::getMaterial,
|
||||
vo -> vo,
|
||||
(oldValue, newValue) -> newValue
|
||||
));
|
||||
|
||||
// 遍历订单状态所有枚举值
|
||||
List<Map<String, Object>> series = new ArrayList<>();
|
||||
for (Map.Entry<Long, String> entry : goodsMap.entrySet()) {
|
||||
for (Map.Entry<Long, OrderGoodsPlateRespVO> entry : goodsMap.entrySet()) {
|
||||
Map<String, Object> seriesItem = new HashMap<>();
|
||||
BigDecimal[] areaArr = new BigDecimal[dateList.size()];
|
||||
|
||||
@@ -291,7 +295,11 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
|
||||
seriesItem.put("data", areaArr);
|
||||
seriesItem.put("id", entry.getKey());
|
||||
seriesItem.put("name", entry.getValue());
|
||||
// 材质-商品名称-颜色-纹理-宽-高-厚-品牌
|
||||
OrderGoodsPlateRespVO orderGoodsPlateRespVO = entry.getValue();
|
||||
seriesItem.put("name", orderGoodsPlateRespVO.getMaterial() + "-" + orderGoodsPlateRespVO.getGoodsName() +
|
||||
"-" + orderGoodsPlateRespVO.getColor() + "-" + orderGoodsPlateRespVO.getTexture() + "-" + orderGoodsPlateRespVO.getWidth() +
|
||||
"-" + orderGoodsPlateRespVO.getHeight() + "-" + orderGoodsPlateRespVO.getThickness() + "-" + orderGoodsPlateRespVO.getBrand());
|
||||
series.add(seriesItem);
|
||||
}
|
||||
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, reqVO.getUnit())).toList());
|
||||
@@ -334,16 +342,16 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
startTime = now.minusYears(2);
|
||||
break;
|
||||
case MONTH:
|
||||
// 从now往前的12个月
|
||||
startTime = now.minusMonths(12);
|
||||
// 包含now往前的12个月
|
||||
startTime = now.minusMonths(11);
|
||||
break;
|
||||
case WEEK:
|
||||
// 从now往前的12周
|
||||
startTime = now.minusWeeks(12);
|
||||
// 包含now往前的12周
|
||||
startTime = now.minusWeeks(11);
|
||||
break;
|
||||
case DAY:
|
||||
// 从now往前的15天
|
||||
startTime = now.minusDays(15);
|
||||
// 包含now往前的15天
|
||||
startTime = now.minusDays(14);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -414,20 +422,20 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
*/
|
||||
private String generateDateRangeAxis(String date, Integer unit) {
|
||||
OrderStatisticsUnit orderStatisticsUnit = OrderStatisticsUnit.fromValue(unit);
|
||||
StringBuffer newDateStrBuffer = new StringBuffer();
|
||||
StringBuilder newDateStrBuffer = new StringBuilder();
|
||||
String[] dateSplit = date.split("-");
|
||||
switch (orderStatisticsUnit) {
|
||||
case QUARTER:
|
||||
newDateStrBuffer.append(dateSplit[0]).append("年第").append(dateSplit[1]).append("季度");
|
||||
newDateStrBuffer.append("第").append(dateSplit[1]).append("季度");
|
||||
break;
|
||||
case MONTH:
|
||||
newDateStrBuffer.append(dateSplit[0]).append("年").append(dateSplit[1]).append("月");
|
||||
newDateStrBuffer.append(dateSplit[1]).append("月");
|
||||
break;
|
||||
case WEEK:
|
||||
newDateStrBuffer.append(dateSplit[0]).append("年").append(dateSplit[1]).append("月").append("第").append(dateSplit[2]).append("周");
|
||||
newDateStrBuffer.append("第").append(dateSplit[2]).append("周");
|
||||
break;
|
||||
case DAY:
|
||||
newDateStrBuffer.append(dateSplit[0]).append("年").append(dateSplit[1]).append("月").append(dateSplit[2]).append("日");
|
||||
newDateStrBuffer.append(dateSplit[2]).append("日");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
+11
-30
@@ -7,10 +7,7 @@
|
||||
WHERE o.deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectOrderStatusCountGroupBy"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsStatusRespVO">
|
||||
select o.status as orderStatus,
|
||||
count(o.id) as orderCount
|
||||
<sql id="dateFormat">
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@QUARTER.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', QUARTER(o.order_date)) as date
|
||||
</if>
|
||||
@@ -18,12 +15,18 @@
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date)) as date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@WEEK.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', FLOOR((DayOfMonth(o.order_date)-1)/7)+1) AS
|
||||
date
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', FLOOR((DayOfMonth(o.order_date)-1)/7)+1) AS date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@DAY.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', DAY(o.order_date)) as date
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectOrderStatusCountGroupBy"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsStatusRespVO">
|
||||
select o.status as orderStatus,
|
||||
count(o.id) as orderCount
|
||||
<include refid="dateFormat"/>
|
||||
from orders o
|
||||
where o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
and o.deleted = 0
|
||||
@@ -33,18 +36,7 @@
|
||||
<select id="selectOrderCountGroupByOrderDate"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsStatusRespVO">
|
||||
select count(o.id) as orderCount
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@QUARTER.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', QUARTER(o.order_date)) as date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@MONTH.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date)) as date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@WEEK.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', FLOOR((DayOfMonth(o.order_date)-1)/7)+1) AS date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@DAY.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', DAY(o.order_date)) as date
|
||||
</if>
|
||||
<include refid="dateFormat"/>
|
||||
from orders o
|
||||
where o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
and o.deleted = 0
|
||||
@@ -54,18 +46,7 @@
|
||||
<select id="selectOrderAreaGroupByOrderDate"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsAreaRespVO">
|
||||
select sum(op.area) as areaSum
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@QUARTER.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', QUARTER(o.order_date)) as date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@MONTH.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date)) as date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@WEEK.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', FLOOR((DayOfMonth(o.order_date)-1)/7)+1) AS date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@DAY.getValue()">
|
||||
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', DAY(o.order_date)) as date
|
||||
</if>
|
||||
<include refid="dateFormat"/>
|
||||
from orders o
|
||||
join order_plate op on op.order_id = o.id
|
||||
where o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
|
||||
+8
-9
@@ -128,16 +128,16 @@
|
||||
select
|
||||
count(p.id) as count
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@QUARTER.getValue()">
|
||||
,CONCAT(YEAR(p.create_time), '-', QUARTER(p.create_time)) as date
|
||||
,QUARTER(p.create_time) as date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@MONTH.getValue()">
|
||||
,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time)) as date
|
||||
,MONTH(p.create_time) as date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@WEEK.getValue()">
|
||||
,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time), '-', FLOOR((DayOfMonth(p.create_time)-1)/7)+1) AS date
|
||||
,FLOOR((DayOfMonth(p.create_time)-1)/7)+1 AS date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@DAY.getValue()">
|
||||
,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time), '-', DAY(p.create_time)) as date
|
||||
,DAY(p.create_time) as date
|
||||
</if>
|
||||
from order_plan p
|
||||
where p.organ_id = #{req.organId}
|
||||
@@ -150,17 +150,16 @@
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanStatisticsAreaRespVO">
|
||||
select sum(op.area) areaSum
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@QUARTER.getValue()">
|
||||
,CONCAT(YEAR(p.create_time), '-', QUARTER(p.create_time)) as date
|
||||
,QUARTER(p.create_time) as date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@MONTH.getValue()">
|
||||
,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time)) as date
|
||||
,MONTH(p.create_time) as date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@WEEK.getValue()">
|
||||
,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time), '-', FLOOR((DayOfMonth(p.create_time)-1)/7)+1) AS
|
||||
date
|
||||
,FLOOR((DayOfMonth(p.create_time)-1)/7)+1 AS date
|
||||
</if>
|
||||
<if test="req.unit != null and req.unit == @com.cf.imes.module.executor.enums.OrderStatisticsUnit@DAY.getValue()">
|
||||
,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time), '-', DAY(p.create_time)) as date
|
||||
,DAY(p.create_time) as date
|
||||
</if>
|
||||
from order_plan p
|
||||
join order_plan_item opi on p.id = opi.plan_id and opi.organ_id = #{req.organId}
|
||||
|
||||
+6
-4
@@ -33,9 +33,10 @@
|
||||
GROUP BY
|
||||
g.goods_id,orderDate
|
||||
HAVING
|
||||
SUM (a.area) > 0
|
||||
orderCount > 0
|
||||
ORDER BY
|
||||
orderCount DESC;
|
||||
orderCount DESC
|
||||
LIMIT 10;
|
||||
</select>
|
||||
|
||||
<select id="selectPlateAnalysisListByArea"
|
||||
@@ -71,8 +72,9 @@
|
||||
GROUP BY
|
||||
g.goods_id,orderDate
|
||||
HAVING
|
||||
SUM (a.area) > 0
|
||||
orderArea > 0
|
||||
ORDER BY
|
||||
orderArea DESC;
|
||||
orderArea DESC
|
||||
LIMIT 10;
|
||||
</select>
|
||||
</mapper>
|
||||
+3
-6
@@ -18,14 +18,11 @@ import java.util.List;
|
||||
public interface RoleMapper extends BaseMapperX<RoleDO> {
|
||||
|
||||
default PageResult<RoleDO> selectPage(RolePageReqVO reqVO) {
|
||||
LambdaQueryWrapperX<RoleDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<RoleDO>();
|
||||
LambdaQueryWrapperX<RoleDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
assert loginUser != null;
|
||||
Boolean isSupAdmin = loginUser.getIsSupAdmin();
|
||||
/*if(isSupAdmin && Objects.isNull(reqVO.getOrganId())) {
|
||||
//如果是超级管理员并且未传organId,就查看自己的的
|
||||
lambdaQueryWrapperX.inIfPresent(RoleDO::getOrganId,0L,loginUser.getOrganId());
|
||||
}*/
|
||||
|
||||
if(isSupAdmin && ObjectUtil.isNotNull(reqVO.getOrganId())) {
|
||||
//如果是超级管理员并且传入organId,就查看组织id为0(内置角色)和传入的组织
|
||||
lambdaQueryWrapperX.inIfPresent(RoleDO::getOrganId, 0L, reqVO.getOrganId());
|
||||
@@ -39,7 +36,7 @@ public interface RoleMapper extends BaseMapperX<RoleDO> {
|
||||
.eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(RoleDO::getCreateTime, reqVO.getCreateTime())
|
||||
.ne(RoleDO::getId, 1)
|
||||
.orderByAsc(RoleDO::getSort);
|
||||
.orderByAsc(RoleDO::getId);
|
||||
|
||||
return selectPage(reqVO, lambdaQueryWrapperX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user