mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
接口对接修改,超管分时间统计生产单
This commit is contained in:
+6
-18
@@ -340,31 +340,19 @@ public class OrderController {
|
||||
|
||||
@DeleteMapping("/delete-body")
|
||||
@Operation(summary = "删除柜体")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024"),
|
||||
@Parameter(name = "roomIds", description = "房间编号", example = "1"),
|
||||
@Parameter(name = "bodyId", description = "柜体编号", example = "1")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:deleteCabinet')")
|
||||
public CommonResult<Boolean> deleteBody(@RequestParam("orderId") Long orderId,
|
||||
@RequestParam(value = "roomIds", required = false, defaultValue = "0") Set<Long> roomIds,
|
||||
@RequestParam(value = "bodyId", required = false, defaultValue = "0") Long bodyId) {
|
||||
orderService.updateBodyDeletedByOrderId(orderId, roomIds, bodyId, OrderDeletedEnum.DELETED.getStatus());
|
||||
public CommonResult<Boolean> deleteBody(@Valid @RequestBody OrderModuleParameterRespVO orderModuleParameterRespVO) {
|
||||
orderService.updateBodyDeletedByOrderId(orderModuleParameterRespVO.getOrderId(), orderModuleParameterRespVO.getRoomIds(),
|
||||
orderModuleParameterRespVO.getBodyId(), OrderDeletedEnum.DELETED.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/restore-body")
|
||||
@Operation(summary = "还原柜体")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024"),
|
||||
@Parameter(name = "roomIds", description = "房间编号", example = "1"),
|
||||
@Parameter(name = "bodyId", description = "柜体编号", example = "1")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:restoreCabinet')")
|
||||
public CommonResult<Boolean> restoreBody(@RequestParam("orderId") Long orderId,
|
||||
@RequestParam(value = "roomIds", required = false, defaultValue = "0") Set<Long> roomIds,
|
||||
@RequestParam(value = "bodyId", required = false, defaultValue = "0") Long bodyId) {
|
||||
orderService.updateBodyDeletedByOrderId(orderId, roomIds, bodyId, OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||
public CommonResult<Boolean> restoreBody(@Valid @RequestBody OrderModuleParameterRespVO orderModuleParameterRespVO) {
|
||||
orderService.updateBodyDeletedByOrderId(orderModuleParameterRespVO.getOrderId(), orderModuleParameterRespVO.getRoomIds(),
|
||||
orderModuleParameterRespVO.getBodyId(), OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
+14
-5
@@ -4,6 +4,7 @@ import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsReqVO;
|
||||
import com.cf.imes.module.executor.service.order.OrderSupStatisticsService;
|
||||
import com.cf.imes.module.system.api.organ.OrganApi;
|
||||
import com.cf.imes.module.system.api.organ.dto.OrgStatisticsReqDTO;
|
||||
import com.cf.imes.module.system.api.user.AdminUserApi;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
@@ -66,19 +69,25 @@ public class OrderSupStatisticsController {
|
||||
|
||||
@GetMapping("/separate/order")
|
||||
@Operation(summary = "有效、无效生产单数量统计")
|
||||
public CommonResult<Map<String, Object>> getOrderSeparate(OrderStatisticsReqVO reqVO) {
|
||||
public CommonResult<Map<String, Object>> getOrderSeparate(@Valid OrderStatisticsReqVO reqVO) {
|
||||
return success(orderSupStatisticsService.orderSeparate(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/separate/org")
|
||||
@Operation(summary = "新增、注销组织数量统计")
|
||||
public CommonResult<Map<String, Object>> getOrgSeparate(OrderStatisticsReqVO reqVO) {
|
||||
return success(orderSupStatisticsService.orgSeparate(reqVO));
|
||||
public CommonResult<Map<String, Object>> getOrgSeparate(@Valid OrgStatisticsReqDTO reqVO) {
|
||||
return organApi.getOrgSeparate(reqVO);
|
||||
}
|
||||
|
||||
@GetMapping("/separate/plateArea")
|
||||
@Operation(summary = "有效、无效拆单板件数量统计")
|
||||
public CommonResult<Map<String, Object>> getPlateAreaSeparate(OrderStatisticsReqVO reqVO) {
|
||||
@Operation(summary = "有效、无效拆单板件平方统计")
|
||||
public CommonResult<Map<String, Object>> getPlateAreaSeparate(@Valid OrderStatisticsReqVO reqVO) {
|
||||
return success(orderSupStatisticsService.plateAreaSeparate(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/warn/org")
|
||||
@Operation(summary = "组织过期日期统计")
|
||||
public CommonResult<Map<String, List<Object>>> getWarnToOrg() {
|
||||
return organApi.getWarnToOrg();
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 柜体删除传参")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderModuleParameterRespVO {
|
||||
|
||||
@Schema(description = "生产单号", example = "1024")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "房间编号", example = "1024")
|
||||
private Set<Long> roomIds;
|
||||
|
||||
@Schema(description = "柜体编号", example = "1024")
|
||||
private Long bodyId;
|
||||
}
|
||||
+11
-1
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.order;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsAreaRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsIsLapseRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
@@ -16,7 +17,7 @@ public interface OrderSupStatisticsMapper extends BaseMapperX<OrderDO> {
|
||||
/**
|
||||
* 当日生产单板件平方数
|
||||
*/
|
||||
Integer selectOrderSquareProduceToday(LocalDateTime startTime, LocalDateTime endTime);
|
||||
Integer selectOrderSquareProduceToday(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
|
||||
|
||||
/**
|
||||
* 生产单按时间统计失效数量
|
||||
@@ -28,4 +29,13 @@ public interface OrderSupStatisticsMapper extends BaseMapperX<OrderDO> {
|
||||
*/
|
||||
List<OrderStatisticsIsLapseRespVO> selectOrderCountNotLapseByOrderDate(@Param("req") OrderStatisticsReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 生产单按时间统计无效板件平方数
|
||||
*/
|
||||
List<OrderStatisticsAreaRespVO> selectPlateAreaLapseByOrderDate(@Param("req") OrderStatisticsReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 生产单按时间分组统计有效板件平方数
|
||||
*/
|
||||
List<OrderStatisticsAreaRespVO> selectPlateAreaNotLapseByOrderDate(@Param("req") OrderStatisticsReqVO reqVO);
|
||||
}
|
||||
|
||||
+29
-28
@@ -150,7 +150,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
validateCustomOrderNoExists(updateReqVO.getCustomOrderNo(), updateReqVO.getId());
|
||||
// 更新
|
||||
OrderDO updateObj = BeanUtils.toBean(updateReqVO, OrderDO.class);
|
||||
if (updateReqVO.getCustomOrderNo() == null || updateReqVO.getCustomOrderNo().equals("")){
|
||||
if (updateReqVO.getCustomOrderNo() == null || updateReqVO.getCustomOrderNo().equals("")) {
|
||||
updateObj.setCustomOrderNo("");
|
||||
}
|
||||
orderMapper.updateById(updateObj);
|
||||
@@ -209,7 +209,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
public PageResult<OrderPartsRespVO> getPartsDetail(Long orderId, Set<Long> roomId, Set<Long> bodyId, Set<Long> groupId, String name, Integer pageNo, Integer pageSize, Integer deleted) {
|
||||
PageDTO<OrderRespVOCopy> page = new PageDTO<>(pageNo, pageSize);
|
||||
|
||||
IPage<OrderPartsRespVO> orderDetail = orderItemMapper.selectPartsDetailByOrderId(page, orderId, roomId, bodyId,groupId, name, getUserOrganId(), deleted);
|
||||
IPage<OrderPartsRespVO> orderDetail = orderItemMapper.selectPartsDetailByOrderId(page, orderId, roomId, bodyId, groupId, name, getUserOrganId(), deleted);
|
||||
|
||||
return new PageResult(orderDetail.getRecords(), orderDetail.getTotal());
|
||||
}
|
||||
@@ -244,33 +244,36 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderBodyMapper.updateDeletedById(id, status, getUserOrganId());// 柜体
|
||||
orderGroupMapper.updateDeletedById(id, status, getUserOrganId());// 加工组
|
||||
|
||||
// (删除小板) 小板变为删除状态
|
||||
plateMapper.updateDeletedById(plateDOList, status, getUserOrganId());
|
||||
// 删除大板
|
||||
List<PlateDO> goodsIdList = plateMapper.selectPlateNum(orderId, getUserOrganId());
|
||||
Map<Long, List<PlateDO>> goodsIdMap = goodsIdList.stream()
|
||||
.collect(Collectors.groupingBy(PlateDO::getGoodsId));
|
||||
if (CollectionUtils.isNotEmpty(plateDOList) ){
|
||||
// (删除小板) 小板变为删除状态
|
||||
plateMapper.updateDeletedById(plateDOList, status, getUserOrganId());
|
||||
// 删除大板
|
||||
List<PlateDO> goodsIdList = plateMapper.selectPlateNum(orderId, getUserOrganId());
|
||||
Map<Long, List<PlateDO>> goodsIdMap = goodsIdList.stream()
|
||||
.collect(Collectors.groupingBy(PlateDO::getGoodsId));
|
||||
|
||||
List<Long> goodsIdDeleted = new ArrayList<>();
|
||||
List<Long> goodsIdDeleted = new ArrayList<>();
|
||||
|
||||
if (status == 1) {
|
||||
goodsIdMap.forEach((k, v) -> {
|
||||
boolean allDeleted = true;
|
||||
for (PlateDO plateDO : v) {
|
||||
if (!plateDO.getDeleted()) {
|
||||
allDeleted = false;
|
||||
break;
|
||||
if (status == 1) {
|
||||
goodsIdMap.forEach((k, v) -> {
|
||||
boolean allDeleted = true;
|
||||
for (PlateDO plateDO : v) {
|
||||
if (!plateDO.getDeleted()) {
|
||||
allDeleted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allDeleted) {
|
||||
goodsIdDeleted.add(k);
|
||||
}
|
||||
});
|
||||
if (allDeleted) {
|
||||
goodsIdDeleted.add(k);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (goodsIdDeleted.size() > 0) {
|
||||
goodsMapper.updateDeletedById(goodsIdDeleted, status, getUserOrganId());
|
||||
}
|
||||
}
|
||||
|
||||
if (goodsIdDeleted.size() > 0) {
|
||||
goodsMapper.updateDeletedById(goodsIdDeleted, status, getUserOrganId());
|
||||
}
|
||||
List<Long> partsList = orderPartsMapper.selectPartsIdListByBodyId(id, getUserOrganId()); // 配件
|
||||
orderPartsMapper.updateDeletedById(partsList, status, getUserOrganId());
|
||||
});
|
||||
@@ -707,11 +710,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
if (orderDO == null)
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
// 状态排除
|
||||
if (Objects.equals(orderDO.getStatus(), OrderStatusEnum.EMPTY.getStatus())) {
|
||||
throw exception(ORDER_IS_EMPTY);
|
||||
}
|
||||
if (!Objects.equals(orderDO.getStatus(), OrderStatusEnum.NEW_ORDER.getStatus()) &&
|
||||
!Objects.equals(orderDO.getStatus(), OrderStatusEnum.SORTED.getStatus()))
|
||||
!Objects.equals(orderDO.getStatus(), OrderStatusEnum.SORTED.getStatus()) &&
|
||||
!Objects.equals(orderDO.getStatus(), OrderStatusEnum.EMPTY.getStatus()))
|
||||
throw exception(ORDER_NOT_CANCEL);
|
||||
}
|
||||
|
||||
|
||||
+1
-6
@@ -25,12 +25,7 @@ public interface OrderSupStatisticsService {
|
||||
Map<String, Object> orderSeparate(OrderStatisticsReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 新增、注销组织数量统计
|
||||
*/
|
||||
Map<String, Object> orgSeparate(OrderStatisticsReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 有效、无效拆单板件数量统计
|
||||
* 有效、无效拆单板件平方统计
|
||||
*/
|
||||
Map<String, Object> plateAreaSeparate(OrderStatisticsReqVO reqVO);
|
||||
}
|
||||
|
||||
+25
-24
@@ -3,16 +3,17 @@ package com.cf.imes.module.executor.service.order;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.OrderStatisticsUnit;
|
||||
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsAreaRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsIsLapseRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsStatusRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanStatisticsCountRespVO;
|
||||
import com.cf.imes.module.executor.dal.mysql.order.OrderStatisticsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.order.OrderSupStatisticsMapper;
|
||||
import com.cf.imes.module.system.api.organ.OrganApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
@@ -29,6 +30,10 @@ public class OrderSupStatisticsServiceImpl implements OrderSupStatisticsService{
|
||||
|
||||
@Resource
|
||||
private OrderSupStatisticsMapper orderSupStatisticsMapper;
|
||||
|
||||
@Resource
|
||||
private OrganApi organApi;
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Map<String, Integer> orderTotal() {
|
||||
@@ -62,6 +67,7 @@ public class OrderSupStatisticsServiceImpl implements OrderSupStatisticsService{
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Map<String, Object> orderSeparate(OrderStatisticsReqVO reqVO) {
|
||||
setOrderStatisticsReqVO(reqVO);
|
||||
|
||||
@@ -105,7 +111,8 @@ public class OrderSupStatisticsServiceImpl implements OrderSupStatisticsService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> orgSeparate(OrderStatisticsReqVO reqVO) {
|
||||
@OrganIgnore
|
||||
public Map<String, Object> plateAreaSeparate(OrderStatisticsReqVO reqVO) {
|
||||
setOrderStatisticsReqVO(reqVO);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
@@ -113,44 +120,38 @@ public class OrderSupStatisticsServiceImpl implements OrderSupStatisticsService{
|
||||
// 所有的日期集合
|
||||
List<String> dateList = getDateList(reqVO.getCreateTime(),reqVO.getUnit());
|
||||
|
||||
// 生产单有效数量
|
||||
Map<String, List<OrderStatisticsIsLapseRespVO>> orderLapseRespMap = orderSupStatisticsMapper.selectOrderCountLapseByOrderDate(reqVO).stream()
|
||||
// 生产单有效板件平方数量
|
||||
Map<String, List<OrderStatisticsAreaRespVO>> orderLapseRespMap = orderSupStatisticsMapper.selectPlateAreaNotLapseByOrderDate(reqVO).stream()
|
||||
.sorted(Comparator.naturalOrder())
|
||||
.collect(Collectors.groupingBy(OrderStatisticsIsLapseRespVO::getDate, LinkedHashMap::new, Collectors.toList()));
|
||||
.collect(Collectors.groupingBy(OrderStatisticsAreaRespVO::getDate, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
// 生产单无效数量
|
||||
Map<String, List<OrderStatisticsIsLapseRespVO>> orderNotLapseRespMap = orderSupStatisticsMapper.selectOrderCountNotLapseByOrderDate(reqVO).stream()
|
||||
// 生产单无效板件平方数量
|
||||
Map<String, List<OrderStatisticsAreaRespVO>> orderNotLapseRespMap = orderSupStatisticsMapper.selectPlateAreaLapseByOrderDate(reqVO).stream()
|
||||
.sorted(Comparator.naturalOrder())
|
||||
.collect(Collectors.groupingBy(OrderStatisticsIsLapseRespVO::getDate, LinkedHashMap::new, Collectors.toList()));
|
||||
.collect(Collectors.groupingBy(OrderStatisticsAreaRespVO::getDate, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
// 遍历时间跨度列表,匹配数量存入数组,没有补0存入数组
|
||||
for (String dateStr : dateList) {
|
||||
int[] countArr = new int[2];
|
||||
BigDecimal[] countArr = new BigDecimal[2];
|
||||
// 生产单有效数量
|
||||
Integer orderNotLapseCount = Optional.ofNullable(orderNotLapseRespMap.get(dateStr))
|
||||
.map(list -> list.stream().findFirst().orElse(new OrderStatisticsIsLapseRespVO()))
|
||||
.map(OrderStatisticsIsLapseRespVO::getOrderCount)
|
||||
.orElse(0);
|
||||
BigDecimal orderNotLapseCount = Optional.ofNullable(orderNotLapseRespMap.get(dateStr))
|
||||
.map(list -> list.stream().findFirst().orElse(new OrderStatisticsAreaRespVO()))
|
||||
.map(OrderStatisticsAreaRespVO::getAreaSum)
|
||||
.orElse(BigDecimal.valueOf(0));
|
||||
countArr[0] = orderNotLapseCount;
|
||||
|
||||
|
||||
// 生产单无效数量
|
||||
Integer orderLapseCount = Optional.ofNullable(orderLapseRespMap.get(dateStr))
|
||||
.map(list -> list.stream().findFirst().orElse(new OrderStatisticsIsLapseRespVO()))
|
||||
.map(OrderStatisticsIsLapseRespVO::getOrderCount)
|
||||
.orElse(0);
|
||||
BigDecimal orderLapseCount = Optional.ofNullable(orderLapseRespMap.get(dateStr))
|
||||
.map(list -> list.stream().findFirst().orElse(new OrderStatisticsAreaRespVO()))
|
||||
.map(OrderStatisticsAreaRespVO::getAreaSum)
|
||||
.orElse(BigDecimal.valueOf(0));
|
||||
countArr[1] = orderLapseCount;
|
||||
|
||||
resultMap.put(generateDateRangeAxis(dateStr, reqVO.getUnit()), countArr);
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> plateAreaSeparate(OrderStatisticsReqVO reqVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setOrderStatisticsReqVO(OrderStatisticsReqVO reqVO){
|
||||
|
||||
+22
@@ -44,4 +44,26 @@
|
||||
group by date;
|
||||
</select>
|
||||
|
||||
<select id="selectPlateAreaLapseByOrderDate"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsAreaRespVO">
|
||||
select sum(op.area) as areaSum
|
||||
<include refid="dateFormat"/>
|
||||
from orders o
|
||||
left join order_plate op on op.order_id = o.id and op.deleted = 0
|
||||
where o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
and (o.deleted = 1 or o.status = 0)
|
||||
group by date;
|
||||
</select>
|
||||
|
||||
<select id="selectPlateAreaNotLapseByOrderDate"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsAreaRespVO">
|
||||
select sum(op.area) as areaSum
|
||||
<include refid="dateFormat"/>
|
||||
from orders o
|
||||
left join order_plate op on op.order_id = o.id and op.deleted = 0
|
||||
where o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
and o.deleted = 0 and o.status != 0
|
||||
group by date;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user