mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
+2
@@ -9,7 +9,9 @@ import lombok.Getter;
|
||||
public enum OrderPackageStatusEnum {
|
||||
|
||||
UNPACKED(0,"未封包/未打包"),
|
||||
PACKAGING(1, "封包中/打包中"),
|
||||
PACKAGED(1, "已封包/已打包");
|
||||
|
||||
private Integer status;
|
||||
private String description;
|
||||
|
||||
|
||||
+5
-3
@@ -22,9 +22,9 @@ public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 生产单 TODO 补充编号 ==========
|
||||
ErrorCode ORDER_NOT_EXISTS = new ErrorCode(1_001_109_000, "生产单不存在");
|
||||
ErrorCode ORDER_IS_EMPTY = new ErrorCode(1_001_109_000, "生产单为空单,清空无效");
|
||||
ErrorCode ORDER_IS_EMPTY = new ErrorCode(1_001_109_000, "生产单为空单,柜体操作无效");
|
||||
ErrorCode ORDER_NOT_NEW_ORDER = new ErrorCode(1_001_109_000, "生产单不为新单,清空无效");
|
||||
ErrorCode ORDER_NOT_CANCEL = new ErrorCode(1_001_109_000, "生产单已排单,作废无效");
|
||||
ErrorCode ORDER_NOT_CANCEL = new ErrorCode(1_001_109_000, "生产单已排单,小板操作无效");
|
||||
ErrorCode ORDER_CANCEL = new ErrorCode(1_001_109_000, "生产单未作废,还原无效");
|
||||
|
||||
// ========== 生产单 TODO 补充编号 ==========
|
||||
@@ -53,7 +53,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ORDER_PROCESS_NOT_EXISTS = new ErrorCode(1_001_119_001, "工序组不存在");
|
||||
ErrorCode ORDER_PROCESS_EXISTS = new ErrorCode(1_001_119_002, "该生产单工序组已经存在");
|
||||
ErrorCode PROCESS_GROUP_NOT_EXISTS = new ErrorCode(1_002_029_003, "工序组不存在");
|
||||
ErrorCode ORDER_BODY_NOT_EXISTS = new ErrorCode(1_002_029_004, "此生产单中柜体并不存在不存在");
|
||||
ErrorCode ORDER_BODY_NOT_EXISTS = new ErrorCode(1_002_029_004, "当前柜体不存在");
|
||||
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_029_005, "生产单中未用到此板材");
|
||||
ErrorCode ORDER_STATUS_ERROR = new ErrorCode(1_002_029_006, "生产单不允许删除");
|
||||
ErrorCode APP_TOKEN_ERROR = new ErrorCode(1_002_029_007, "token获取失败");
|
||||
@@ -73,4 +73,6 @@ public interface ErrorCodeConstants {
|
||||
|
||||
ErrorCode SOURCE_NOT_EXITS_ERROR = new ErrorCode(1_002_029_013, "源数据查询失败");
|
||||
ErrorCode ORDER_CAN_NOT_DELETE = new ErrorCode(1_002_029_013, "存在状态不符合强制删除的生产单,禁止删除");
|
||||
ErrorCode ORDER_DELETED_ERR = new ErrorCode(1_002_029_006, "生产单删除失败");
|
||||
ErrorCode ORDER_RESTORE_ERR = new ErrorCode(1_002_029_006, "生产单还原失败");
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,9 +7,9 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum OrderStatusEnum {
|
||||
|
||||
EMPTY(0, "默认"),
|
||||
EMPTY(0, "空单"),
|
||||
NEW_ORDER(1, "新单"),
|
||||
NO_SORT(2, "未排单"),
|
||||
SORTED(2, "已排单"),
|
||||
IN_PRODUCTION(3, "生产中"),
|
||||
FINISH_PRODUCTION(4, "生产完成");
|
||||
|
||||
|
||||
+2
@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
@@ -11,6 +12,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
@EnableAsync
|
||||
@EnableScheduling //开启定时任务
|
||||
public class ExecutorServerApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ExecutorServerApplication.class, args);
|
||||
|
||||
+283
-343
@@ -1,13 +1,17 @@
|
||||
package com.cf.imes.module.executor.controller.admin.order;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderRoomBodyRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderTypeEnum;
|
||||
import com.cf.imes.module.executor.service.order.intervalometer.OrderScheduledImpl;
|
||||
import com.cf.imes.module.executor.util.ExcelWriterUtil;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiDataAchieve;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiTypeRealize;
|
||||
@@ -39,8 +43,7 @@ import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_PLAN_DATA_ERROR;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_PLAN_DATA_NULL;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.service.order.OrderService;
|
||||
@@ -73,13 +76,8 @@ public class OrderController {
|
||||
@Resource
|
||||
private ApiTypeRealize apiTypeRealize;
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产单")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||
public CommonResult<Long> createOrder(@Valid @RequestBody OrderSaveReqVO createReqVO) {
|
||||
return success(orderService.createOrder(createReqVO));
|
||||
}
|
||||
@Resource
|
||||
private OrderScheduledImpl orderScheduledImpl;
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产单")
|
||||
@@ -89,17 +87,34 @@ public class OrderController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// 删除柜体
|
||||
@DeleteMapping("/delete-body")
|
||||
@Operation(summary = "删除柜体")
|
||||
// 做生产单是否作废判断
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得(单个)生产单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<OrderRespVO> getOrder(@RequestParam("id") Long id) {
|
||||
return success(BeanUtils.toBean(orderService.getOrder(id), OrderRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产单分页")
|
||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||
public CommonResult<PageResult<OrderRespVO>> getOrderPage(@Valid OrderPageReqVO pageReqVO) {
|
||||
return success(BeanUtils.toBean(orderService.getOrderPage(pageReqVO), OrderRespVO.class));
|
||||
}
|
||||
|
||||
// 不做生产单是否作废判断
|
||||
@GetMapping("/printing")
|
||||
@Operation(summary = "打印/导出 数据文件")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024"),
|
||||
@Parameter(name = "bodyIds", description = "柜体编号集合", required = true, example = "1,2")
|
||||
@Parameter(name = "type", description = "文件类型", required = true, example = "0"),
|
||||
@Parameter(name = "orderId", description = "生产单号", required = true, example = "1813119086461190144")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:deleteCabinet')")
|
||||
public CommonResult<Boolean> deleteBody(@RequestParam("orderId") Long orderId, @RequestParam("bodyIds") Set<Long> bodyIds) {
|
||||
orderService.deleteBodyByOrder(orderId, bodyIds);
|
||||
return success(true);
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public CommonResult<Map<String, Object>> getOrderPrintData(@RequestParam("orderId") Long orderId,
|
||||
@RequestParam("type") String type, HttpServletResponse response) {
|
||||
return success(orderService.getPrintDataMap(orderId, type, response));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@@ -107,7 +122,10 @@ public class OrderController {
|
||||
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:nullify')")
|
||||
public CommonResult<Boolean> deleteOrder(@RequestParam("orderId") Long orderId) {
|
||||
orderService.deleteOrder(orderId);
|
||||
Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.DELETED.getStatus());
|
||||
if (index == 0) {
|
||||
throw exception(ORDER_DELETED_ERR);
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -117,27 +135,13 @@ public class OrderController {
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:backOrder')")
|
||||
public CommonResult<Boolean> restoreOrder(@RequestBody JSONObject jsonObject) {
|
||||
Long orderId = jsonObject.getLong("orderId");
|
||||
orderService.restoreOrder(orderId);
|
||||
Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||
if (index == 0) {
|
||||
throw exception(ORDER_RESTORE_ERR);
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得(单个)生产单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<OrderRespVO> getOrder(@RequestParam("id") Long id) {
|
||||
OrderDO order = orderService.getOrder(id);
|
||||
return success(BeanUtils.toBean(order, OrderRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产单分页")
|
||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||
public CommonResult<PageResult<OrderRespVO>> getOrderPage(@Valid OrderPageReqVO pageReqVO) {
|
||||
PageResult<OrderDO> pageResult = orderService.getOrderPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OrderRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-import-template")
|
||||
@Operation(summary = "获得导入生产单模板")
|
||||
@Parameter(name = "value", description = "文件类型", required = true, example = "0")
|
||||
@@ -145,284 +149,8 @@ public class OrderController {
|
||||
orderService.exportTemplate(response, value);
|
||||
}
|
||||
|
||||
@GetMapping("/get-room")
|
||||
@Operation(summary = "生产单详情-房间和柜体id")
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<List<OrderBodyRespVO>> getRoom(@RequestParam("orderId") Long orderId) {
|
||||
List<OrderBodyRespVO> orderBodyMap = orderService.getOrderBody(orderId);
|
||||
return success(orderBodyMap);
|
||||
}
|
||||
|
||||
@GetMapping("/get-roomToString")
|
||||
@Operation(summary = "生产单详情-房间和柜体id(toString)")
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<String> getRoomToString(@RequestParam("orderId") Long orderId) {
|
||||
String orderBodyMap = orderService.getOrderBodyToString(orderId);
|
||||
return success(orderBodyMap);
|
||||
}
|
||||
|
||||
@GetMapping("/get-room-and-body")
|
||||
@Operation(summary = "获取柜体和房间信息")
|
||||
@Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<List<OrderRoomBodyRespVO>> getRoomAndBody(@RequestParam("planId") Long planId) {
|
||||
List<OrderRoomBodyRespVO> orderBodyMap = orderService.getRoomAndBody(planId);
|
||||
return success(orderBodyMap);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/get-module")
|
||||
@Operation(summary = "生产单详情-数量信息")
|
||||
@Parameter(name = "orderId", description = "生产单编号", example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<Map<String, List<?>>> getModule(@RequestParam("orderId") Long orderId) {
|
||||
Map<String, List<?>> moduleDOList = orderService.getModule(orderId);
|
||||
return success(moduleDOList);
|
||||
}
|
||||
|
||||
@GetMapping("/get-platesDetailsPage")
|
||||
@Operation(summary = "生产单详情-板材详细信息(分页)")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", example = "1024"),
|
||||
@Parameter(name = "roomId", description = "房间编号", example = "1024"),
|
||||
@Parameter(name = "bodyId", description = "柜体编号", example = "1024"),
|
||||
@Parameter(name = "groupId", description = "加工组编号", example = "1024"),
|
||||
@Parameter(name = "groupName", description = "加工组名称", example = "弧形"),
|
||||
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
||||
@Parameter(name = "pageSize", description = "条数", example = "10")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<PageResult<OrderPlatesDetailReqVO>> platesDetails(@RequestParam("orderId") Long orderId,
|
||||
@RequestParam(value = "roomId", required = false) Long roomId,
|
||||
@RequestParam(value = "bodyId", required = false) Long bodyId,
|
||||
@RequestParam(value = "groupId", required = false) Long groupId,
|
||||
@RequestParam(value = "groupName", required = false) String groupName,
|
||||
@RequestParam(value = "pageNo") Integer pageNo,
|
||||
@RequestParam(value = "pageSize") Integer pageSize) {
|
||||
PageResult<OrderPlatesDetailReqVO> moduleDOList = orderService.getPlatesDetail(orderId, roomId, bodyId, groupId, groupName, pageNo, pageSize);
|
||||
return success(moduleDOList);
|
||||
}
|
||||
|
||||
@GetMapping("/get-partsDetailsPage")
|
||||
@Operation(summary = "生产单详情-配件详细信息(分页)")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", example = "1024"),
|
||||
@Parameter(name = "roomId", description = "房间编号", example = "1024"),
|
||||
@Parameter(name = "bodyId", description = "柜体编号", example = "1024"),
|
||||
@Parameter(name = "name", description = "配件名称", example = "1024"),
|
||||
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
||||
@Parameter(name = "pageSize", description = "条数", example = "10")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<PageResult<OrderPartsRespVO>> partsDetails(@RequestParam("orderId") Long orderId,
|
||||
@RequestParam(value = "roomId", required = false) Long roomId,
|
||||
@RequestParam(value = "bodyId", required = false) Long bodyId,
|
||||
@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "pageNo") Integer pageNo,
|
||||
@RequestParam(value = "pageSize") Integer pageSize) {
|
||||
PageResult<OrderPartsRespVO> moduleDOList = orderService.getPartsDetail(orderId, roomId, bodyId, name, pageNo, pageSize);
|
||||
return success(moduleDOList);
|
||||
}
|
||||
|
||||
// 柜体数据获取,需要加上柜体的属性
|
||||
@GetMapping("/get-body")
|
||||
@Operation(summary = "生产单柜体数据获取")
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<List<OrderBodyRespVO>> getBody(@RequestParam("orderId") Long orderId) {
|
||||
return success(BeanUtils.toBean(orderService.getBody(orderId), OrderBodyRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("getApiData")
|
||||
@Operation(summary = "生产单api数据导入新增")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||
public CommonResult<Long> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo)
|
||||
throws InterruptedException, ExecutionException {
|
||||
|
||||
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
|
||||
String token = apiDataAchieve.getApiToken(organId).get().getJSONObject("info").getString("access_token");
|
||||
JSONObject dataPlates = apiDataAchieve.getApiPlateProData(token, orderNo).get();
|
||||
if (!dataPlates.getString("err_code").equals("0")) {
|
||||
throw exception(PLATE_PLAN_DATA_ERROR);
|
||||
}
|
||||
if (dataPlates.getJSONObject("value") == null) {
|
||||
throw exception(PLATE_PLAN_DATA_NULL);
|
||||
}
|
||||
JSONObject dataParts = apiDataAchieve.getApiPartsMessage(token, orderNo).get();
|
||||
JSONObject dataBody = apiDataAchieve.getApiBodyMessage(token, orderNo).get();
|
||||
JSONObject dataGoods = apiDataAchieve.getApiGoodsMessage(token, orderNo).get();
|
||||
JSONObject plate = apiDataAchieve.getApiPlateDetailMessage(token, orderNo).get();
|
||||
JSONObject dataModule = apiDataAchieve.getApiGroupMessage(token, orderNo).get();
|
||||
JSONObject block = apiDataAchieve.getApiBlocksMessage(token, orderNo).get();
|
||||
Map<String, List<?>> listMap = apiTypeRealize.apiPlateDataChange(
|
||||
dataPlates.getJSONObject("value"),//板件生产信息
|
||||
dataParts,// 配件信息
|
||||
dataBody, // 柜体信息
|
||||
dataGoods, // 商品信息
|
||||
plate, // 板件信息
|
||||
dataModule,// 加工组信息
|
||||
block,// 板材数据
|
||||
orderNo); // 原始板编号
|
||||
return success(orderService.importApiData(listMap));
|
||||
}
|
||||
|
||||
// @PostMapping("/importFile")
|
||||
// @Operation(summary = "生产单文件导入新增")
|
||||
// @Parameters({
|
||||
// @Parameter(name = "file", description = "文件", required = true),
|
||||
// @Parameter(name = "type", description = "文件类型", required = true)
|
||||
// })
|
||||
// @PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||
// @OperateLog(type = IMPORT)
|
||||
// public void exportTest(@RequestPart("file") MultipartFile file,
|
||||
// @RequestParam(value = "type", required = false, defaultValue = "true") Integer type,
|
||||
// HttpServletResponse response) throws IOException {
|
||||
// try {
|
||||
//
|
||||
// List<?> list = null;
|
||||
// OrderDO orderDO = new OrderDO();
|
||||
// if (type == 0) { //excel
|
||||
// // 读取文件
|
||||
// excelReadUtil.setErr(0);
|
||||
// Map<String, Object> map = excelReadUtil.read(file);
|
||||
// System.err.println(excelReadUtil.isErr());
|
||||
// // 判断是否读取有误
|
||||
// if (excelReadUtil.isErr() == -1) { // 文件为空
|
||||
// ExcelWriterUtil.writeErr(response, "生产单内容为空", orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||
// return;
|
||||
// } else if (excelReadUtil.isErr() > 0) {
|
||||
// // 返回文件
|
||||
// ExcelWriterUtil.write(response, (Map<Object, Object>) map.get("order"), (List<OrderPlateImportExcelVO>) map.get("plate"), orderService.getSavePath() + File.separator + "order_add_excel_err.xlsx");
|
||||
// return;
|
||||
// } else {
|
||||
// // 获取数据
|
||||
// list = (List<?>) map.get("plate");
|
||||
// Map<String, Object> mapOrder = excelReadUtil.changeOrderDO((Map<Object, Object>) map.get("order"));
|
||||
// if (list.size() == 0) {
|
||||
// orderDO.setStatus(0);
|
||||
// }
|
||||
// orderDO = ((OrderDO) mapOrder.get("order")).setOrderType(OrderTypeEnum.MAIN_ORDER.getStatus()).setStatus(1);
|
||||
// String err = ((String) mapOrder.get("error"));
|
||||
//
|
||||
// if (!orderService.customOrderNoIsExists(orderDO.getCustomOrderNo())) {
|
||||
// err += orderDO.getCustomOrderNo() + "-自定义生产单号已存在;";
|
||||
// }
|
||||
// if (!err.equals("")) {
|
||||
// ExcelWriterUtil.writeErr(response, err, orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// } else if (type == 1) { // json
|
||||
//
|
||||
// } else if (type == 2) { // xml
|
||||
//
|
||||
// }
|
||||
// orderService.importExcelData(orderDO, list, 0);
|
||||
// } catch (Exception e) {
|
||||
// ExcelWriterUtil.writeErr(response, "系统出现未知错误,请下载模板,按照模板重新上传文件", orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||
// }
|
||||
// }
|
||||
|
||||
@PostMapping("/importFile")
|
||||
@Operation(summary = "生产单文件导入新增/导入板材")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "文件", required = true),
|
||||
@Parameter(name = "type", description = "文件类型", required = true),
|
||||
@Parameter(name = "index", description = "导入范围 0:全部,1:板材,默认为全部", required = false),
|
||||
@Parameter(name = "id", description = "生产单id", required = false)
|
||||
})
|
||||
@OperateLog(type = IMPORT)
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||
public void exportTestTwo(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "type") Integer type,
|
||||
@RequestParam(value = "index", required = false, defaultValue = "0") Integer index,
|
||||
@RequestParam(value = "id", required = false, defaultValue = "0") Long orderId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
List<?> list = null;
|
||||
OrderDO orderDO = new OrderDO();
|
||||
|
||||
if (type == 0) { //excel
|
||||
// 读取文件
|
||||
excelReadUtil.setErr(0);
|
||||
Map<String, Object> map = excelReadUtil.read(file);
|
||||
System.out.println(" map + " + map);
|
||||
// 判断是否读取有误
|
||||
if (excelReadUtil.isErr() > 0) {
|
||||
// 板材数据格式错误
|
||||
ExcelWriterUtil.write(response, (Map<Object, Object>) map.get("order"), (List<OrderPlateImportExcelVO>) map.get("plate"),
|
||||
orderService.getSavePath() + File.separator + "order_add_excel_err.xlsx");
|
||||
return;
|
||||
}else {
|
||||
list = (List<?>) map.get("plate");
|
||||
|
||||
if (index == null || index == 0) { // 全部导入
|
||||
Map<String, Object> mapOrder = excelReadUtil.changeOrderDO((Map<Object, Object>) map.get("order"));
|
||||
|
||||
if (list.size() == 0) {
|
||||
orderDO.setStatus(0);
|
||||
}
|
||||
orderDO = ((OrderDO) mapOrder.get("order")).setOrderType(OrderTypeEnum.MAIN_ORDER.getStatus());
|
||||
String err = ((String) mapOrder.get("error"));
|
||||
|
||||
if (!orderService.customOrderNoIsExists(orderDO.getCustomOrderNo())) {
|
||||
err += orderDO.getCustomOrderNo() + "-自定义生产单号已存在;";
|
||||
}
|
||||
if (!err.equals("")) {
|
||||
ExcelWriterUtil.writeErr(response, err, orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||
}
|
||||
}else { // 板材导入
|
||||
orderDO.setId(orderId);
|
||||
}
|
||||
}
|
||||
} else if (type == 1) { // json
|
||||
|
||||
} else if (type == 2) { // xml
|
||||
|
||||
}
|
||||
orderService.importExcelData(orderDO, list, index);
|
||||
} catch (Exception e) {
|
||||
ExcelWriterUtil.writeErr(response, "系统出现未知错误,请下载模板,按照模板重新上传文件", orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/get-goodsList")
|
||||
@Operation(summary = "生产单所用板材商品信息")
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<List<GoodsDO>> getGoodsList(@RequestParam("orderId") Long orderId) {
|
||||
List<GoodsDO> goodsDOS = orderService.getGoodsList(orderId);
|
||||
return success(goodsDOS);
|
||||
}
|
||||
|
||||
@GetMapping("/uploadFiles")
|
||||
@Operation(summary = "导入生产数据文件模板")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "文件", required = true),
|
||||
@Parameter(name = "type", description = "是否强制上传", required = false)
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||
public CommonResult<String> uploadOrderType(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "type", required = false, defaultValue = "false") Boolean type) {
|
||||
return success(orderService.importTemplate(file, type));
|
||||
}
|
||||
|
||||
@GetMapping("/printing")
|
||||
@Operation(summary = "打印/导出 数据文件")
|
||||
@Parameter(name = "type", description = "文件类型", required = true, example = "0")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public CommonResult<Map<String, Object>> getOrderPrintData(
|
||||
@RequestParam("orderId") Long orderId,
|
||||
@RequestParam("type") String type,
|
||||
HttpServletResponse response) {
|
||||
|
||||
return success(orderService.getPrintDataMap(orderId, type, response));
|
||||
}
|
||||
|
||||
// 获取api订单接口
|
||||
// 获取api订单接口
|
||||
@GetMapping("/getApiOrder")
|
||||
@Operation(summary = "获取api订单接口")
|
||||
@Parameters({
|
||||
@@ -445,9 +173,240 @@ public class OrderController {
|
||||
return success(orderService.getApiOrderList(orderList));
|
||||
}
|
||||
|
||||
// api-生产单导入
|
||||
@GetMapping("getApiData")
|
||||
@Operation(summary = "生产单api数据导入新增")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||
public CommonResult<Long> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo)
|
||||
throws InterruptedException, ExecutionException {
|
||||
|
||||
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
|
||||
JSONObject oauth = apiDataAchieve.getApiToken(organId).get();
|
||||
String token = oauth.getJSONObject("info").getString("access_token");
|
||||
String shopId = oauth.getJSONObject("info").getString("shop_id");
|
||||
JSONObject order= apiDataAchieve.getApiOrder(token, shopId, orderNo).get();
|
||||
if (!order.getString("err_code").equals("0")) {
|
||||
throw exception(PLATE_PLAN_DATA_ERROR);
|
||||
}
|
||||
if (order.getJSONArray("data") == null) {
|
||||
throw exception(PLATE_PLAN_DATA_NULL);
|
||||
}
|
||||
JSONObject dataPlates = apiDataAchieve.getApiPlateProData(token, orderNo).get();
|
||||
JSONObject dataParts = apiDataAchieve.getApiPartsMessage(token, orderNo).get();
|
||||
JSONObject dataBody = apiDataAchieve.getApiBodyMessage(token, orderNo).get();
|
||||
JSONObject dataGoods = apiDataAchieve.getApiGoodsMessage(token, orderNo).get();
|
||||
JSONObject plate = apiDataAchieve.getApiPlateDetailMessage(token, orderNo).get();
|
||||
JSONObject dataModule = apiDataAchieve.getApiGroupMessage(token, orderNo).get();
|
||||
JSONObject block = apiDataAchieve.getApiBlocksMessage(token, orderNo).get();
|
||||
Map<String, List<?>> listMap = apiTypeRealize.apiPlateDataChange(
|
||||
order,
|
||||
dataPlates,//板件生产信息
|
||||
dataParts,// 配件信息
|
||||
dataBody, // 柜体信息
|
||||
dataGoods, // 商品信息
|
||||
plate, // 板件明细
|
||||
dataModule,// 加工组信息
|
||||
block,// 板材数据
|
||||
orderNo); // 原始板编号
|
||||
return success(orderService.importApiData(listMap));
|
||||
}
|
||||
|
||||
@PostMapping("/importFile")
|
||||
@Operation(summary = "生产单文件导入新增/导入板材")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "文件", required = true),
|
||||
@Parameter(name = "type", description = "文件类型", required = true),
|
||||
@Parameter(name = "index", description = "导入范围 0:全部,1:板材,默认为全部", required = false),
|
||||
@Parameter(name = "id", description = "生产单id", required = false)
|
||||
})
|
||||
@OperateLog(type = IMPORT)
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||
public void exportTestTwo(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "type") Integer type,
|
||||
@RequestParam(value = "index", required = false, defaultValue = "0") Integer index,
|
||||
@RequestParam(value = "id", required = false, defaultValue = "0") Long orderId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
List<?> list = null;
|
||||
OrderDO orderDO = new OrderDO();
|
||||
|
||||
if (type == 0) { //excel
|
||||
excelReadUtil.setErr(0);
|
||||
Map<String, Object> map = excelReadUtil.read(file);
|
||||
if (excelReadUtil.isErr() > 0) {
|
||||
ExcelWriterUtil.write(response, (Map<Object, Object>) map.get("order"), (List<OrderPlateImportExcelVO>) map.get("plate"),
|
||||
orderService.getSavePath() + File.separator + "order_add_excel_err.xlsx");
|
||||
return;
|
||||
} else {
|
||||
list = (List<?>) map.get("plate");
|
||||
|
||||
if (index == null || index == 0) { // 整单导入
|
||||
Map<String, Object> mapOrder = (Map<String, Object>) map.get("order");
|
||||
|
||||
orderDO = ((OrderDO) mapOrder.get("order")).setOrderType(OrderTypeEnum.MAIN_ORDER.getStatus());
|
||||
String err = ((String) mapOrder.get("error"));
|
||||
|
||||
if (!orderService.customOrderNoIsExists(orderDO.getCustomOrderNo())) {
|
||||
err += orderDO.getCustomOrderNo() + "-自定义生产单号已存在;";
|
||||
}
|
||||
if (!err.equals("")) {
|
||||
ExcelWriterUtil.writeErr(response, err, orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||
return;
|
||||
}
|
||||
if (list.size() == 0) {
|
||||
orderDO.setStatus(OrderStatusEnum.EMPTY.getStatus());
|
||||
}else {
|
||||
orderDO.setStatus(OrderStatusEnum.NEW_ORDER.getStatus());
|
||||
}
|
||||
} else { // 板材导入
|
||||
orderDO = orderService.getOrder(orderId);
|
||||
}
|
||||
}
|
||||
} else if (type == 1) { // json
|
||||
|
||||
} else if (type == 2) { // xml
|
||||
|
||||
}
|
||||
orderService.importExcelData(orderDO, list, index);
|
||||
} catch (Exception e) {
|
||||
ExcelWriterUtil.writeErr(response, "系统出现未知错误,请下载模板,按照模板重新上传文件", orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 生产单详情
|
||||
@GetMapping("/get-room")
|
||||
@Operation(summary = "生产单详情-房间和柜体id")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024"),
|
||||
@Parameter(name = "deleted", description = "是否删除", example = "false")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<List<OrderBodyRespVO>> getRoom(@RequestParam("orderId") Long orderId,
|
||||
@RequestParam(value ="deleted", required = false, defaultValue = "false") Boolean deleted) {
|
||||
if (deleted == null){
|
||||
deleted = false;
|
||||
}
|
||||
return success(orderService.getOrderBody(orderId, !deleted ? 0 : 1));
|
||||
}
|
||||
|
||||
@GetMapping("/get-room-and-body")
|
||||
@Operation(summary = "获取柜体和房间信息")
|
||||
@Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<List<OrderRoomBodyRespVO>> getRoomAndBody(@RequestParam("planId") Long planId) {
|
||||
return success(orderService.getRoomAndBody(planId));
|
||||
}
|
||||
|
||||
@GetMapping("/get-module")
|
||||
@Operation(summary = "生产单详情-数量信息")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024"),
|
||||
@Parameter(name = "deleted", description = "是否删除", example = "false")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<Map<String, List<?>>> getModule(@RequestParam("orderId") Long orderId,
|
||||
@RequestParam(value ="deleted", required = false, defaultValue = "false") Boolean deleted) {
|
||||
if (deleted == null){
|
||||
deleted = false;
|
||||
}
|
||||
return success(orderService.getModule(orderId, !deleted ? 0 : 1));
|
||||
}
|
||||
|
||||
@GetMapping("/get-platesDetailsPage")
|
||||
@Operation(summary = "生产单详情-板材详细信息(分页)")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", example = "1024"),
|
||||
@Parameter(name = "roomId", description = "房间编号", example = "1024"),
|
||||
@Parameter(name = "bodyId", description = "柜体编号", example = "1024"),
|
||||
@Parameter(name = "groupId", description = "加工组编号", example = "1024"),
|
||||
@Parameter(name = "groupName", description = "加工组名称", example = "弧形"),
|
||||
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
||||
@Parameter(name = "pageSize", description = "条数", example = "10"),
|
||||
@Parameter(name = "deleted", description = "是否删除", example = "false")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<PageResult<OrderPlatesDetailReqVO>> platesDetails(@RequestParam("orderId") Long orderId,
|
||||
@RequestParam(value = "roomId", required = false) Long roomId,
|
||||
@RequestParam(value = "bodyId", required = false) Long bodyId,
|
||||
@RequestParam(value = "groupId", required = false) Long groupId,
|
||||
@RequestParam(value = "groupName", required = false) String groupName,
|
||||
@RequestParam(value = "pageNo") Integer pageNo,
|
||||
@RequestParam(value = "pageSize") Integer pageSize,
|
||||
@RequestParam(value ="deleted", required = false, defaultValue = "false") Boolean deleted) {
|
||||
if (deleted == null){
|
||||
deleted = false;
|
||||
}
|
||||
return success(orderService.getPlatesDetail(orderId, roomId, bodyId, groupId, groupName, pageNo, pageSize, !deleted ? 0 : 1));
|
||||
}
|
||||
|
||||
@GetMapping("/get-partsDetailsPage")
|
||||
@Operation(summary = "生产单详情-配件详细信息(分页)")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", example = "1024"),
|
||||
@Parameter(name = "roomId", description = "房间编号", example = "1024"),
|
||||
@Parameter(name = "bodyId", description = "柜体编号", example = "1024"),
|
||||
@Parameter(name = "name", description = "配件名称", example = "1024"),
|
||||
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
||||
@Parameter(name = "pageSize", description = "条数", example = "10"),
|
||||
@Parameter(name = "deleted", description = "是否删除", example = "false")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<PageResult<OrderPartsRespVO>> partsDetails(@RequestParam("orderId") Long orderId,
|
||||
@RequestParam(value = "roomId", required = false) Long roomId,
|
||||
@RequestParam(value = "bodyId", required = false) Long bodyId,
|
||||
@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "pageNo") Integer pageNo,
|
||||
@RequestParam(value = "pageSize") Integer pageSize,
|
||||
@RequestParam(value ="deleted", required = false, defaultValue = "false") Boolean deleted) {
|
||||
if (deleted == null){
|
||||
deleted = false;
|
||||
}
|
||||
return success(orderService.getPartsDetail(orderId, roomId, bodyId, name, pageNo, pageSize, !deleted ? 0 : 1));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-body")
|
||||
@Operation(summary = "删除柜体")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024"),
|
||||
@Parameter(name = "roomId", 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 = "roomId", required = false, defaultValue = "0") Long roomId,
|
||||
@RequestParam(value = "bodyId", required = false, defaultValue = "0") Long bodyId) {
|
||||
orderService.updateBodyDeletedByOrderId(orderId, roomId, bodyId, OrderDeletedEnum.DELETED.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/restore-body")
|
||||
@Operation(summary = "还原柜体")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024"),
|
||||
@Parameter(name = "roomId", 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 = "roomId", required = false, defaultValue = "0") Long roomId,
|
||||
@RequestParam(value = "bodyId", required = false, defaultValue = "0") Long bodyId) {
|
||||
orderService.updateBodyDeletedByOrderId(orderId, roomId, bodyId, OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/realDeleted")
|
||||
@Operation(summary = "作废中删除")
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:nullify')")
|
||||
public CommonResult<Boolean> realDeleted(@RequestParam("orderId") Long orderId) {
|
||||
orderService.realDeletedOrder(orderId);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// 统计
|
||||
// 生产单超期/到期告警 (工作台)
|
||||
// 生产单超期/到期告警 (工作台)
|
||||
@GetMapping("/getOrderWarn")
|
||||
@Operation(summary = "生产单超期/到期告警 (工作台)")
|
||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||
@@ -455,37 +414,18 @@ public class OrderController {
|
||||
return success(orderService.getOrderWarn());
|
||||
}
|
||||
|
||||
// 小板数量 <集合>
|
||||
@GetMapping("/getPlateCount")
|
||||
@Operation(summary = "小板数量")
|
||||
// 生产单单量 还没有完成
|
||||
@GetMapping("/orderCountProducePeriod")
|
||||
@Operation(summary = "生产单单量")
|
||||
@Parameters({
|
||||
@Parameter(name = "startTime", description = "开始时间", example = "2024-07-15"),
|
||||
@Parameter(name = "endTime", description = "结束时间", example = "2024-07-16"),
|
||||
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
||||
@Parameter(name = "pageSize", description = "每页条数", example = "10")
|
||||
@Parameter(name = "endTime", description = "结束时间", example = "2024-07-16")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||
public CommonResult<PageResult<OrderGoodsPlateRespVO>> getPlateCount(@RequestParam(value = "startTime") String startTime,
|
||||
@RequestParam(value = "endTime") String endTime,
|
||||
@RequestParam(value = "pageNo") Integer pageNo,
|
||||
@RequestParam(value = "pageSize") Integer pageSize) {
|
||||
return success(orderService.plateCount(startTime + " 00:00:00", endTime + " 23:59:59", pageNo, pageSize));
|
||||
public CommonResult<Map<String, Integer>> getOrderCountProducePeriod(@RequestParam(value = "startTime") String startTime,
|
||||
@RequestParam(value = "endTime") String endTime) {
|
||||
return success(orderService.orderCountProducePeriod(startTime, endTime));
|
||||
}
|
||||
|
||||
// 小板面积 <集合>
|
||||
@GetMapping("/getPlateArea")
|
||||
@Operation(summary = "小板面积")
|
||||
@Parameters({
|
||||
@Parameter(name = "startTime", description = "开始时间", example = "2024-07-15"),
|
||||
@Parameter(name = "endTime", description = "结束时间", example = "2024-07-16"),
|
||||
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
||||
@Parameter(name = "pageSize", description = "每页条数", example = "10")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||
public CommonResult<PageResult<OrderGoodsPlateRespVO>> getPlateArea(@RequestParam(value = "startTime") String startTime,
|
||||
@RequestParam(value = "endTime") String endTime,
|
||||
@RequestParam(value = "pageNo") Integer pageNo,
|
||||
@RequestParam(value = "pageSize") Integer pageSize) {
|
||||
return success(orderService.plateArea(startTime + " 00:00:00", endTime + " 23:59:59", pageNo, pageSize));
|
||||
}
|
||||
|
||||
}
|
||||
+29
-12
@@ -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,39 +23,38 @@ 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;
|
||||
|
||||
@GetMapping("/total")
|
||||
@Operation(summary = "生产单总数")
|
||||
public CommonResult<Integer> getOrderCount(OrderStatisticsReqVO reqVO) {
|
||||
return success(orderStatisticsService.orderCount(reqVO));
|
||||
public CommonResult<Integer> getOrderCount() {
|
||||
return success(orderStatisticsService.orderCount());
|
||||
}
|
||||
|
||||
@GetMapping("/today/increase")
|
||||
@Operation(summary = "今日新增生产单总数")
|
||||
public CommonResult<Integer> getOrderCountToday(OrderStatisticsReqVO reqVO) {
|
||||
return success(orderStatisticsService.orderCountToday(reqVO));
|
||||
public CommonResult<Integer> getOrderCountToday() {
|
||||
return success(orderStatisticsService.orderCountToday());
|
||||
}
|
||||
|
||||
@GetMapping("/today/finish")
|
||||
@Operation(summary = "今日生产单完成总数")
|
||||
public CommonResult<Integer> getOrderCountTodayFinish(OrderStatisticsReqVO reqVO) {
|
||||
return success(orderStatisticsService.orderCountTodayFinish(reqVO));
|
||||
public CommonResult<Integer> getOrderCountTodayFinish() {
|
||||
return success(orderStatisticsService.orderCountTodayFinish());
|
||||
}
|
||||
|
||||
@GetMapping("/producing/total")
|
||||
@Operation(summary = "生产中生产单总数")
|
||||
public CommonResult<Integer> getOrderCountProduce(OrderStatisticsReqVO reqVO) {
|
||||
return success(orderStatisticsService.orderCountProduce(reqVO));
|
||||
public CommonResult<Integer> getOrderCountProduce() {
|
||||
return success(orderStatisticsService.orderCountProduce());
|
||||
}
|
||||
|
||||
@GetMapping("/producing/square")
|
||||
@Operation(summary = "生产中生产平方数")
|
||||
public CommonResult<Integer> getOrderSquareProduce(OrderStatisticsReqVO reqVO) {
|
||||
return success(orderStatisticsService.orderSquareProduce(reqVO));
|
||||
public CommonResult<Integer> getOrderSquareProduce() {
|
||||
return success(orderStatisticsService.orderSquareProduce());
|
||||
}
|
||||
|
||||
@GetMapping("/orderStatus/group")
|
||||
@@ -76,4 +74,23 @@ public class OrderStatisticsController {
|
||||
public CommonResult<Map<String, Object>> getOrderAndPlanAreaGroup(@Valid OrderStatisticsReqVO reqVO) {
|
||||
return success(orderStatisticsService.getOrderAndPlanAreaSumGroup(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/plateCount/group")
|
||||
@Operation(summary = "小板数量分组统计")
|
||||
public CommonResult<Map<String,Object>> getPlateCount(@Valid OrderStatisticsReqVO reqVO) {
|
||||
return success(orderStatisticsService.getOrderPlateCountGroup(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/plateArea/group")
|
||||
@Operation(summary = "小板面积分组统计")
|
||||
public CommonResult<Map<String,Object>> getPlateArea(@Valid OrderStatisticsReqVO reqVO) {
|
||||
return success(orderStatisticsService.getOrderPlateAreaGroup(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/bigPlateCount/group")
|
||||
@Operation(summary = "大板数量分组统计")
|
||||
public CommonResult<Map<String, Object>> getBigPlateCount(@Valid OrderStatisticsReqVO reqVO) {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "分析页 - 生产单单量")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString(callSuper = true)
|
||||
public class OrderCountProducePeriodRespVO {
|
||||
|
||||
@Schema(description = "生产单日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime orderDate;
|
||||
|
||||
@Schema(description = "订单数量")
|
||||
private Integer count;
|
||||
}
|
||||
+37
-1
@@ -2,6 +2,7 @@ package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -11,7 +12,7 @@ import java.math.BigDecimal;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString(callSuper = true)
|
||||
public class OrderGoodsPlateRespVO {
|
||||
public class OrderGoodsPlateRespVO implements Comparable<OrderGoodsPlateRespVO> {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
private Long goodsId;
|
||||
@@ -54,4 +55,39 @@ public class OrderGoodsPlateRespVO {
|
||||
|
||||
@Schema(description = "面积")
|
||||
private BigDecimal orderArea;
|
||||
|
||||
@Schema(description = "生产单日期")
|
||||
private String orderDate;
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull OrderGoodsPlateRespVO other) {
|
||||
if (orderDate != null && other.orderDate != null) {
|
||||
// 解析 date 字符串为年、月、周
|
||||
String[] partsThis = orderDate.split("-");
|
||||
String[] partsOther = other.orderDate.split("-");
|
||||
|
||||
// 比较年份
|
||||
int yearComparison = Integer.compare(Integer.parseInt(partsThis[0]), Integer.parseInt(partsOther[0]));
|
||||
if (yearComparison != 0) {
|
||||
return yearComparison;
|
||||
}
|
||||
|
||||
// 比较月份
|
||||
if (partsThis.length + partsOther.length > 2) {
|
||||
int monthComparison = Integer.compare(Integer.parseInt(partsThis[1]), Integer.parseInt(partsOther[1]));
|
||||
if (monthComparison != 0) {
|
||||
return monthComparison;
|
||||
}
|
||||
}
|
||||
|
||||
// 比较周/日
|
||||
if (partsThis.length + partsOther.length > 4) {
|
||||
int weekComparison = Integer.compare(Integer.parseInt(partsThis[2]), Integer.parseInt(partsOther[2]));
|
||||
if (weekComparison != 0) {
|
||||
return weekComparison;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -13,8 +13,8 @@ import com.alibaba.excel.annotation.*;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class OrderBodyRespVO {
|
||||
|
||||
@Schema(description = "模块 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30562")
|
||||
@ExcelProperty("模块 ID")
|
||||
@Schema(description = "柜体 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30562")
|
||||
@ExcelProperty("柜体 ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11075")
|
||||
@@ -29,24 +29,24 @@ public class OrderBodyRespVO {
|
||||
@ExcelProperty("房间名称")
|
||||
private String roomName;
|
||||
|
||||
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("模块名称")
|
||||
@Schema(description = "柜体名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("柜体名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "模块宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("模块宽度")
|
||||
@Schema(description = "柜体宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("柜体宽度")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "模块高度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("模块高度")
|
||||
@Schema(description = "柜体高度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("柜体高度")
|
||||
private Double height;
|
||||
|
||||
@Schema(description = "模块深度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("模块深度")
|
||||
@Schema(description = "柜体深度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("柜体深度")
|
||||
private Double depth;
|
||||
|
||||
@Schema(description = "模块复制数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("模块复制数量")
|
||||
@Schema(description = "柜体复制数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("柜体复制数量")
|
||||
private Short multiNum;
|
||||
|
||||
@Schema(description = "板材数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public class OrderPartsController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产单配件分页")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order-parts:query')")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||
public CommonResult<PageResult<OrderPartsRespVO>> getOrderPartsPage(@Valid OrderPartsPageReqVO pageReqVO) {
|
||||
PageResult<OrderPartsDO> pageResult = orderPartsService.getOrderPartsPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OrderPartsRespVO.class));
|
||||
|
||||
+4
-4
@@ -60,8 +60,8 @@ public class PartGoodsRespVO {
|
||||
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
private Double price;
|
||||
// @Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
// private Double price;
|
||||
|
||||
@Schema(description = "是否复合部件:0 否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean isComposite;
|
||||
@@ -75,6 +75,6 @@ public class PartGoodsRespVO {
|
||||
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
private Double num;
|
||||
|
||||
@Schema(description = "金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
private Double totalPrice;
|
||||
// @Schema(description = "金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
// private Double totalPrice;
|
||||
}
|
||||
|
||||
+2
-2
@@ -70,8 +70,8 @@ public class PlateGoodsRespVO {
|
||||
@Schema(description = "商品厚度", example = "14195")
|
||||
private BigDecimal goodsThickness;
|
||||
|
||||
@Schema(description = "商品价格", example = "14195")
|
||||
private BigDecimal price;
|
||||
// @Schema(description = "商品价格", example = "14195")
|
||||
// private BigDecimal price;
|
||||
|
||||
@Schema(description = "商品品牌", example = "柏柏")
|
||||
private String brand;
|
||||
|
||||
+4
@@ -69,6 +69,10 @@ public class OrderDO extends BaseDO {
|
||||
* 订单状态,订单状态,0空订单1新单2生产中3生产完成
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 打包状态:0未打包1打包中2已打包
|
||||
*/
|
||||
private Integer packaged;
|
||||
/**
|
||||
* 自定义单号
|
||||
*/
|
||||
|
||||
+17
-6
@@ -29,7 +29,7 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
default PageResult<GoodsDO> selectPage(GoodsPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId,getUserOrganId())
|
||||
.eq(GoodsDO::getOrganId, getUserOrganId())
|
||||
.eqIfPresent(GoodsDO::getOrderId, reqVO.getOrderId())
|
||||
.eqIfPresent(GoodsDO::getRawGoodsId, reqVO.getRawGoodsId())
|
||||
.eqIfPresent(GoodsDO::getGoodsId, reqVO.getGoodsId())
|
||||
@@ -48,7 +48,7 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
}
|
||||
|
||||
|
||||
List<GoodsReqVO> selectGoodsList(@Param("orderId") Long orderId,@Param("organId") Long organId);
|
||||
List<GoodsReqVO> selectGoodsList(@Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
|
||||
|
||||
List<GoodsReqVO> selectGoodsListByOrderIds(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
@@ -75,19 +75,30 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
// 删板材,批量
|
||||
void updateDeletedById(@Param("ids") List<Long> ids, @Param("deleted") Integer deleted, @Param("organId") Long organId);
|
||||
|
||||
void deletedById(@Param("ids") List<Long> ids, @Param("organId") Long organId);
|
||||
|
||||
|
||||
IPage<OrderGoodsResp> selectGoods(@Param("page") IPage page,@Param("goodsIds") List<Long> goodsIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
IPage<OrderGoodsResp> selectGoods(@Param("page") IPage page, @Param("goodsIds") List<Long> goodsIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
default GoodsDO selectId(Long orderId, Long goodsId, Long organId) {
|
||||
return selectOne(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getOrderId, orderId)
|
||||
.eq(GoodsDO::getGoodsId,goodsId)
|
||||
.eq(GoodsDO::getGoodsId, goodsId)
|
||||
.eq(GoodsDO::getDeleted, 0));
|
||||
}
|
||||
|
||||
// 根据生产单删除
|
||||
default int deleteByOrderId(Long orderId, Long organId) {
|
||||
return delete(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eqIfPresent(GoodsDO::getOrderId, orderId));
|
||||
}
|
||||
// 批量删除
|
||||
default int deleteBatch(Collection<?> orderId) {
|
||||
return delete(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.in(GoodsDO::getOrderId, orderId));
|
||||
}
|
||||
}
|
||||
+85
-10
@@ -8,18 +8,27 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCountProducePeriodRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import javax.annotation.sql.DataSourceDefinition;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 生产单表 order_{N} Mapper
|
||||
@@ -55,7 +64,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
if (reqVO.getOrder() == null) {
|
||||
query.orderByDesc(OrderDO::getId);
|
||||
}else {
|
||||
} else {
|
||||
if (reqVO.getOrder().equals("ascend")) {
|
||||
switch (reqVO.getField()) {
|
||||
case "id" -> query.orderByAsc(OrderDO::getId);
|
||||
@@ -64,7 +73,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
case "deliveryDate" -> query.orderByAsc(OrderDO::getDeliveryDate);
|
||||
case "apiOrderId" -> query.orderByAsc(OrderDO::getApiOrderId);
|
||||
}
|
||||
}else if (reqVO.getOrder().equals("descend")) {
|
||||
} else if (reqVO.getOrder().equals("descend")) {
|
||||
switch (reqVO.getField()) {
|
||||
case "id" -> query.orderByDesc(OrderDO::getId);
|
||||
case "customOrderNo" -> query.orderByDesc(OrderDO::getCustomOrderNo);
|
||||
@@ -86,34 +95,36 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
|
||||
// 查找生产单
|
||||
default List<OrderDO> selectOrder(Long id,Long organId) {
|
||||
default List<OrderDO> selectOrder(Long id, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getId, id)
|
||||
.eqIfPresent(OrderDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
// 修改生产单状态 单个
|
||||
default int updateOrderStatus(Long id, Integer status,Long organId) {
|
||||
default int updateOrderStatus(Long id, Integer status, Long organId) {
|
||||
return update(new LambdaUpdateWrapper<OrderDO>()
|
||||
.set(OrderDO::getStatus, status)
|
||||
.eq(OrderDO::getId, id)
|
||||
.eq(OrderDO::getDeleted, 0)
|
||||
.eq(OrderDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
// 查询单个生产单
|
||||
default OrderDO selectOrderOne(Long id,Long organId) {
|
||||
default OrderDO selectOrderOne(Long id, Long organId) {
|
||||
return selectOne(new LambdaQueryWrapper<OrderDO>()
|
||||
.eq(OrderDO::getId, id)
|
||||
.eq(OrderDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
// 删除状态为条件,查询生产单
|
||||
default OrderDO selectOrderOne(Long id,Long organId,Integer deleted) {
|
||||
default OrderDO selectOrderOne(Long id, Long organId, Integer deleted) {
|
||||
return selectOne(new LambdaQueryWrapper<OrderDO>()
|
||||
.eq(OrderDO::getId, id)
|
||||
.eq(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, deleted));
|
||||
}
|
||||
|
||||
// 批量查询生产单
|
||||
default List<OrderDO> selectOrderList(Collection<Long> ids, Long organId) {
|
||||
return selectList(new LambdaQueryWrapper<OrderDO>()
|
||||
@@ -122,7 +133,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
}
|
||||
|
||||
// 修改删除状态
|
||||
default int updateOrderDeleted(Long id, Integer deleted,Long organId) {
|
||||
default int updateOrderDeleted(Long id, Integer deleted, Long organId) {
|
||||
return update(new LambdaUpdateWrapper<OrderDO>()
|
||||
.set(OrderDO::getDeleted, deleted)
|
||||
.eq(OrderDO::getId, id)
|
||||
@@ -130,13 +141,77 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
}
|
||||
|
||||
|
||||
List<OrderRespVOCopy> selectOrderListByIds(@Param("orderIds") List<OrderIds> orderIds, @Param("organId")Long organId);
|
||||
List<OrderRespVOCopy> selectOrderListByIds(@Param("orderIds") List<OrderIds> orderIds, @Param("organId") Long organId);
|
||||
|
||||
List<Long> selectOrderIds(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
// 生产单预警统计
|
||||
// 生产单预警统计
|
||||
List<OrderOverdueRespVO> selectOrderNear(@Param("today") LocalDateTime today, @Param("orderDate") LocalDateTime orderDate, @Param("organId") Long organId);
|
||||
|
||||
// 生产单逾期统计
|
||||
// 生产单逾期统计
|
||||
List<OrderOverdueRespVO> selectOrderOverdue(@Param("today") LocalDateTime today, @Param("organId") Long organId);
|
||||
|
||||
/**
|
||||
* 生产单数量统计
|
||||
*/
|
||||
default Integer selectOrderCount(Long organId) {
|
||||
return Math.toIntExact(selectCount(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, 0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 今日新增生产单总数统计
|
||||
*/
|
||||
default Integer selectOrderCountToday(Long organId) {
|
||||
return Math.toIntExact(selectCount(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getOrderDate, LocalDate.now())));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 今日完成生产单总数统计
|
||||
*/
|
||||
default Integer selectOrderCountTodayFinish(Long organId) {
|
||||
return Math.toIntExact(selectCount(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.between(OrderDO::getFinishTime, LocalDateTime.of(LocalDate.now(), LocalTime.MIN), LocalDateTime.of(LocalDate.now(), LocalTime.MAX))));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产中生产单总数
|
||||
*/
|
||||
default Integer selectOrderCountProduce(Long organId) {
|
||||
return Math.toIntExact(selectCount(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getStatus, OrderStatusEnum.IN_PRODUCTION.getStatus())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产中生产平方数
|
||||
*
|
||||
* @param organId
|
||||
* @return
|
||||
*/
|
||||
Integer selectOrderSquareProduce(@Param("organId") Long organId);
|
||||
|
||||
// 生产单单量
|
||||
@OrganIgnore
|
||||
List<OrderCountProducePeriodRespVO> selectOrderCountProducePeriod(@Param("organId") Long organId,
|
||||
@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
// 物理删除生产单
|
||||
default int deleteOrder(Long id, Long organId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eq(OrderDO::getOrganId, organId)
|
||||
.eqIfPresent(OrderDO::getId, id));
|
||||
}
|
||||
|
||||
// 查询修改时间距离当天日期为30的生产单
|
||||
default List<Long> selectOrderListByUpdateTime() {
|
||||
return selectList(new LambdaQueryWrapper<OrderDO>()
|
||||
.eq(OrderDO::getDeleted, OrderDeletedEnum.DELETED.getStatus())
|
||||
.lt(OrderDO::getUpdateTime, LocalDateTime.now().minusDays(30))).stream().map(OrderDO::getId).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
+5
-9
@@ -25,9 +25,8 @@ public interface OrderStatisticsMapper extends BaseMapperX<OrderDO> {
|
||||
/**
|
||||
* 生产单数量统计
|
||||
*/
|
||||
default Integer selectOrderCount(Long organId) {
|
||||
default Integer selectOrderCount() {
|
||||
return Math.toIntExact(selectCount(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, 0)));
|
||||
}
|
||||
|
||||
@@ -35,9 +34,8 @@ public interface OrderStatisticsMapper extends BaseMapperX<OrderDO> {
|
||||
* 今日新增生产单总数统计
|
||||
*
|
||||
*/
|
||||
default Integer selectOrderCountToday(Long organId) {
|
||||
default Integer selectOrderCountToday() {
|
||||
return Math.toIntExact(selectCount(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getOrderDate, LocalDate.now())));
|
||||
|
||||
}
|
||||
@@ -46,9 +44,8 @@ public interface OrderStatisticsMapper extends BaseMapperX<OrderDO> {
|
||||
* 今日完成生产单总数统计
|
||||
*
|
||||
*/
|
||||
default Integer selectOrderCountTodayFinish(Long organId) {
|
||||
default Integer selectOrderCountTodayFinish() {
|
||||
return Math.toIntExact(selectCount(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.between(OrderDO::getFinishTime, LocalDateTime.of(LocalDate.now(), LocalTime.MIN), LocalDateTime.of(LocalDate.now(), LocalTime.MAX))));
|
||||
}
|
||||
|
||||
@@ -56,9 +53,8 @@ public interface OrderStatisticsMapper extends BaseMapperX<OrderDO> {
|
||||
* 生产中生产单总数
|
||||
*
|
||||
*/
|
||||
default Integer selectOrderCountProduce(Long organId) {
|
||||
default Integer selectOrderCountProduce() {
|
||||
return Math.toIntExact(selectCount(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getStatus, OrderStatusEnum.IN_PRODUCTION.getStatus())));
|
||||
}
|
||||
|
||||
@@ -68,7 +64,7 @@ public interface OrderStatisticsMapper extends BaseMapperX<OrderDO> {
|
||||
* @param organId
|
||||
* @return
|
||||
*/
|
||||
Integer selectOrderSquareProduce(@Param("organId") Long organId);
|
||||
Integer selectOrderSquareProduce();
|
||||
|
||||
/**
|
||||
* 生产单状态按时间分组统计数量
|
||||
|
||||
+40
-10
@@ -1,13 +1,16 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.orderBody;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderRoomBodyRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
@@ -15,6 +18,7 @@ import org.apache.ibatis.annotations.Update;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 生产单柜体 Mapper
|
||||
@@ -53,9 +57,10 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
|
||||
.eq(OrderBodyDO::getId, id)
|
||||
.eq(OrderBodyDO::getOrganId, organId));
|
||||
}
|
||||
default int deletedById(Long id, Long organId) {
|
||||
|
||||
default int deletedByOrderId(Long orderId, Long organId) {
|
||||
return delete(new LambdaUpdateWrapper<OrderBodyDO>()
|
||||
.eq(OrderBodyDO::getId, id)
|
||||
.eq(OrderBodyDO::getOrderId, orderId)
|
||||
.eq(OrderBodyDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
@@ -70,6 +75,7 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
|
||||
|
||||
|
||||
List<OrderRoomBodyRespVO> selectRoomAndBody(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
// 生产单柜体记录数量
|
||||
default int selectCountByOrderId(Long orderId, Long organId, Integer deleted) {
|
||||
return Math.toIntExact(selectCount(new LambdaUpdateWrapper<OrderBodyDO>()
|
||||
@@ -78,9 +84,9 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
|
||||
.eq(OrderBodyDO::getOrganId, organId)));
|
||||
}
|
||||
|
||||
// 按照房间名称查询
|
||||
// 按照房间名称查询
|
||||
default List<OrderBodyDO> selectByRoomName(Long orderId, String roomName,
|
||||
Long organId, Integer deleted){
|
||||
Long organId, Integer deleted) {
|
||||
return selectList(new LambdaUpdateWrapper<OrderBodyDO>()
|
||||
.eq(OrderBodyDO::getOrderId, orderId)
|
||||
.eq(OrderBodyDO::getRoomName, roomName)
|
||||
@@ -88,14 +94,38 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
|
||||
.eq(OrderBodyDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
// 按照房间id和柜体名称查询
|
||||
default List<OrderBodyDO> selectByRoomIdAndBodyName(Long orderId, Long roomId,
|
||||
String bodyName, Long organId, Integer deleted){
|
||||
return selectList(new LambdaUpdateWrapper<OrderBodyDO>()
|
||||
// 按照房间id和柜体名称查询
|
||||
default OrderBodyDO selectByRoomIdAndBodyName(Long orderId, Long roomId,
|
||||
String bodyName, Long organId, Integer deleted) {
|
||||
return selectOne(new LambdaUpdateWrapper<OrderBodyDO>()
|
||||
.eq(OrderBodyDO::getOrderId, orderId)
|
||||
.eq(OrderBodyDO::getRoomId, roomId)
|
||||
.eq(OrderBodyDO::getRoomId, roomId)
|
||||
.eq(OrderBodyDO::getName, bodyName)
|
||||
.eq(OrderBodyDO::getDeleted, deleted)
|
||||
.eq(OrderBodyDO::getOrganId, organId));
|
||||
}
|
||||
}
|
||||
|
||||
// 根据房间id查找OrderBodyDO的id
|
||||
default List<Long> selectBodyIdByRoomId(Long orderId, Long roomId, Long organId, Integer deleted) {
|
||||
return selectList(new LambdaQueryWrapper<OrderBodyDO>()
|
||||
.eq(OrderBodyDO::getOrderId, orderId)
|
||||
.eq(OrderBodyDO::getRoomId, roomId)
|
||||
.eq(OrderBodyDO::getOrganId, organId)
|
||||
.eq(OrderBodyDO::getDeleted, deleted)
|
||||
.select(OrderBodyDO::getId)).stream()
|
||||
.map(OrderBodyDO::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 根据生产单进行删除
|
||||
default int deleteByOrderId(Long orderId, Long organId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderBodyDO>()
|
||||
.eq(OrderBodyDO::getOrganId, organId)
|
||||
.eqIfPresent(OrderBodyDO::getOrderId, orderId));
|
||||
}
|
||||
// 批量删除
|
||||
default int deleteBatch(Collection<?> orderId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderBodyDO>()
|
||||
.in(OrderBodyDO::getOrderId, orderId));
|
||||
}
|
||||
}
|
||||
+28
-4
@@ -1,8 +1,10 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.orderGroup;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -11,6 +13,7 @@ import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 生产单加工组 Mapper
|
||||
@@ -52,7 +55,7 @@ public interface OrderGroupMapper extends BaseMapperX<OrderGroupDO> {
|
||||
|
||||
// 通过柜体id和加工组类型名称查询加工组
|
||||
default List<OrderGroupDO> selectByRoomIdAndGroupTypeName(Long orderId, Long bodyId,
|
||||
String groupTypeName, Long organId, Integer deleted) {
|
||||
String groupTypeName, Long organId, Integer deleted) {
|
||||
return selectList(new LambdaUpdateWrapper<OrderGroupDO>()
|
||||
.eq(OrderGroupDO::getOrderId, orderId)
|
||||
.eq(OrderGroupDO::getBodyId, bodyId)
|
||||
@@ -62,9 +65,9 @@ public interface OrderGroupMapper extends BaseMapperX<OrderGroupDO> {
|
||||
}
|
||||
|
||||
// 通过柜体id和加工组类型id加工组名称名称查询加工组
|
||||
default List<OrderGroupDO> selectByRoomIdAndGroupTypeIdAndGroupName(Long orderId, Long bodyId,
|
||||
Long groupTypeId, String groupName, Long organId, Integer deleted) {
|
||||
return selectList(new LambdaUpdateWrapper<OrderGroupDO>()
|
||||
default OrderGroupDO selectByRoomIdAndGroupTypeIdAndGroupName(Long orderId, Long bodyId,
|
||||
Long groupTypeId, String groupName, Long organId, Integer deleted) {
|
||||
return selectOne(new LambdaUpdateWrapper<OrderGroupDO>()
|
||||
.eq(OrderGroupDO::getOrderId, orderId)
|
||||
.eq(OrderGroupDO::getBodyId, bodyId)
|
||||
.eq(OrderGroupDO::getGroupTypeId, groupTypeId)
|
||||
@@ -72,4 +75,25 @@ public interface OrderGroupMapper extends BaseMapperX<OrderGroupDO> {
|
||||
.eq(OrderGroupDO::getOrganId, organId)
|
||||
.eq(OrderGroupDO::getDeleted, deleted));
|
||||
}
|
||||
|
||||
// 根据柜体id修改删除状态
|
||||
default int updateDeletedByBodyId(Long orderId, Long bodyId, Integer deleted, Long organId) {
|
||||
return update(new LambdaUpdateWrapper<OrderGroupDO>()
|
||||
.set(OrderGroupDO::getDeleted, deleted)
|
||||
.eq(OrderGroupDO::getOrderId, orderId)
|
||||
.eq(OrderGroupDO::getBodyId, bodyId)
|
||||
.eq(OrderGroupDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
// 根据生产单id删除
|
||||
default int deleteByOrderId(Long orderId, Long organId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderGroupDO>()
|
||||
.eq(OrderGroupDO::getOrganId, organId)
|
||||
.eqIfPresent(OrderGroupDO::getOrderId, orderId));
|
||||
}
|
||||
// 批量删除
|
||||
default int deleteBatch(Collection<?> orderId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderGroupDO>()
|
||||
.in(OrderGroupDO::getOrderId, orderId));
|
||||
}
|
||||
}
|
||||
+17
-3
@@ -21,6 +21,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -35,6 +36,7 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
@Param("bodyId") Long bodyId, @Param("groupId") Long groupId,
|
||||
@Param("groupName") String groupName, @Param("organId") Long organId,
|
||||
@Param("deleted") Integer deleted);
|
||||
|
||||
IPage<PlateRespVO> selectPlatesDetailByOrderId(@Param("page") IPage page, @Param("orderId") Long orderId, @Param("roomId") Long roomId,
|
||||
@Param("bodyId") Long bodyId, @Param("groupId") Long groupId,
|
||||
@Param("groupName") String groupName, @Param("organId") Long organId,
|
||||
@@ -43,9 +45,10 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
List<OrderPartsRespVO> selectPartsDetailByOrderId(@Param("orderId") Long orderId, @Param("roomId") Long roomId,
|
||||
@Param("bodyId") Long bodyId, @Param("name") String name,
|
||||
@Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
IPage<OrderPartsRespVO> selectPartsDetailByOrderId(@Param("page") IPage page,@Param("orderId") Long orderId, @Param("roomId") Long roomId,
|
||||
@Param("bodyId") Long bodyId, @Param("name") String name,
|
||||
@Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
|
||||
IPage<OrderPartsRespVO> selectPartsDetailByOrderId(@Param("page") IPage page, @Param("orderId") Long orderId, @Param("roomId") Long roomId,
|
||||
@Param("bodyId") Long bodyId, @Param("name") String name,
|
||||
@Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
|
||||
|
||||
List<OrderPlatesDetailRespVO> selectPartsByOrderId(@Param("orderId") Long orderId,
|
||||
@@ -70,4 +73,15 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
.eq(OrderItemDO::getBodyId, bodyId)
|
||||
.eq(OrderItemDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
default int deleteByOrderId(Long orderId, Long organId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderItemDO>()
|
||||
.eq(OrderItemDO::getOrganId, organId)
|
||||
.eqIfPresent(OrderItemDO::getOrderId, orderId));
|
||||
}
|
||||
// 批量删除
|
||||
default int deleteBatch(Collection<?> orderId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderItemDO>()
|
||||
.in(OrderItemDO::getOrderId, orderId));
|
||||
}
|
||||
}
|
||||
+14
@@ -8,6 +8,7 @@ import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPartsRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.*;
|
||||
@@ -70,4 +71,17 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
|
||||
|
||||
List<Long> selectPartsIdListByBodyId(@Param("bodyId") Long bodyId, @Param("organId") Long organId);
|
||||
|
||||
int countPartsByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
|
||||
// 根据生产单删除
|
||||
default int deleteByOrderId(Long orderId, Long organId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderPartsDO>()
|
||||
.eq(OrderPartsDO::getOrganId, organId)
|
||||
.eqIfPresent(OrderPartsDO::getOrderId, orderId));
|
||||
}
|
||||
// 批量删除
|
||||
default int deleteBatch(Collection<?> orderId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderPartsDO>()
|
||||
.in(OrderPartsDO::getOrderId, orderId));
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.plate;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产单板件统计Mapper
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/8/7 17:06
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderPlateStatisticsMapper extends BaseMapperX<PlateDO> {
|
||||
/**
|
||||
* 基于商品id分组的小板数量列表
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<OrderGoodsPlateRespVO> selectPlateCountList(@Param("req") OrderStatisticsReqVO reqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 基于订单日期分组的前10小板数量分组
|
||||
* @param goodsIdList
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<OrderGoodsPlateRespVO> selectTopTenPlateCountListGroupByOrderDate(@Param("goodsIds") List<Long> goodsIdList, @Param("req") OrderStatisticsReqVO reqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 基于商品id分组的小板面积列表
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<OrderGoodsPlateRespVO> selectPlateAreaList(@Param("req") OrderStatisticsReqVO reqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 基于订单日期分组的前10小板面积分组
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<OrderGoodsPlateRespVO> selectTopTenPlateAreaListGroupByOrderDate(@Param("goodsIds") List<Long> goodsIdList, @Param("req") OrderStatisticsReqVO reqVO);
|
||||
|
||||
}
|
||||
+14
-11
@@ -1,8 +1,6 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.plate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
@@ -12,7 +10,6 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.GoodsNum;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
@@ -136,13 +133,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
List<GoodsNum> selectGoodsNum(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
// 小板数据分析
|
||||
// List<OrderGoodsPlateRespVO> selectPlateAnalysisListByCount(@Param("organId") Long organId, @Param("startTime") String startTime, @Param("endTime") String endTime); // 数量
|
||||
IPage<OrderGoodsPlateRespVO> selectPlateAnalysisListByCount(@Param("page") IPage<OrderGoodsPlateRespVO> page, @Param("organId") Long organId, @Param("startTime") String startTime, @Param("endTime") String endTime); // 数量
|
||||
// List<OrderGoodsPlateRespVO> selectPlateAnalysisListByArea(@Param("organId") Long organId, @Param("startTime") String startTime, @Param("endTime") String endTime); // 面积
|
||||
IPage<OrderGoodsPlateRespVO> selectPlateAnalysisListByArea(@Param("page") IPage<OrderGoodsPlateRespVO> page, @Param("organId") Long organId, @Param("startTime") String startTime, @Param("endTime") String endTime); // 面积
|
||||
|
||||
|
||||
default List<PlateDO> selectPlateNum(Long orderId, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
@@ -151,6 +141,19 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
}
|
||||
|
||||
// 房间id查小板的开料状态
|
||||
List<Long> selectPlateTypeByRoomId(@Param("orderId") Long orderId, @Param("roomId") Long roomId, @Param("bodyId") Long bodyId,
|
||||
@Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
|
||||
|
||||
// 根据生产单id删除
|
||||
default int deleteByOrderId(Long orderId, Long organId) {
|
||||
return delete(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId, organId)
|
||||
.eqIfPresent(PlateDO::getOrderId, orderId));
|
||||
}
|
||||
// 批量删除
|
||||
default int deleteBatch(Collection<?> orderId) {
|
||||
return delete(new LambdaQueryWrapperX<PlateDO>()
|
||||
.in(PlateDO::getOrderId, orderId));
|
||||
}
|
||||
}
|
||||
+14
-1
@@ -10,6 +10,7 @@ import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsSaveReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -26,7 +27,7 @@ public interface RawGoodsMapper extends BaseMapperX<RawGoodsDO> {
|
||||
|
||||
default PageResult<RawGoodsDO> selectPage(RawGoodsPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RawGoodsDO>()
|
||||
.eq(RawGoodsDO::getOrganId,getUserOrganId())
|
||||
.eq(RawGoodsDO::getOrganId, getUserOrganId())
|
||||
.eqIfPresent(RawGoodsDO::getOrderId, reqVO.getOrderId())
|
||||
.eqIfPresent(RawGoodsDO::getRawGoodsId, reqVO.getRawGoodsId())
|
||||
.likeIfPresent(RawGoodsDO::getGoodsName, reqVO.getGoodsName())
|
||||
@@ -51,4 +52,16 @@ public interface RawGoodsMapper extends BaseMapperX<RawGoodsDO> {
|
||||
wrapper.eq(RawGoodsDO::getDeleted, 1);
|
||||
return update(wrapper);
|
||||
}
|
||||
|
||||
// 删除记录
|
||||
default int deleteByOrderId(Long orderId, Long organId) {
|
||||
return delete(new LambdaQueryWrapperX<RawGoodsDO>()
|
||||
.eq(RawGoodsDO::getOrganId, organId)
|
||||
.eqIfPresent(RawGoodsDO::getOrderId, orderId));
|
||||
}
|
||||
// 批量删除
|
||||
default int deleteBatch(Collection<?> orderId) {
|
||||
return delete(new LambdaQueryWrapperX<RawGoodsDO>()
|
||||
.in(RawGoodsDO::getOrderId, orderId));
|
||||
}
|
||||
}
|
||||
+72
-11
@@ -1,6 +1,10 @@
|
||||
package com.cf.imes.module.executor.service.order;
|
||||
|
||||
import co.elastic.clients.elasticsearch.core.BulkResponse;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch.core.*;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
@@ -27,13 +31,17 @@ import com.cf.imes.module.executor.dal.mysql.plate.PlateGoodMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
* 生产单入库处理器
|
||||
@@ -74,10 +82,10 @@ public class OrderInputProcessor {
|
||||
private PlateGoodMapper plateGoodMapper;
|
||||
|
||||
@Resource
|
||||
private OrderModuleExtraMapper orderModuleExtraMapper;
|
||||
private ESDocumentService esDocumentService;
|
||||
|
||||
@Resource
|
||||
private ESDocumentService esDocumentService;
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
|
||||
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
@@ -92,14 +100,12 @@ public class OrderInputProcessor {
|
||||
* @param orderGroupDOS
|
||||
* @param orderPartsDOS
|
||||
* @param plateDOS
|
||||
* @param orderModuleExtraDOS
|
||||
* @param itemDOS
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchInsert(Collection<RawGoodsDO> rawGoodsDOS, Collection<OrderBodyDO> orderBodyDOS,
|
||||
Collection<OrderGroupDO> orderGroupDOS, Collection<OrderPartsDO> orderPartsDOS,
|
||||
Collection<PlateDO> plateDOS, Collection<OrderModuleExtraDO> orderModuleExtraDOS,
|
||||
Collection<OrderItemDO> itemDOS,
|
||||
Collection<PlateDO> plateDOS, Collection<OrderItemDO> itemDOS,
|
||||
Collection<GoodsDO> goodsDOS, Collection<PlateGoodDO> plateGoodDOS) {
|
||||
|
||||
|
||||
@@ -123,11 +129,6 @@ public class OrderInputProcessor {
|
||||
for (int i = 0; i < plateDOS.size(); i += 1000) {
|
||||
plateMapper.insertBatch(plateDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
if (orderModuleExtraDOS != null) {
|
||||
for (int i = 0; i < orderModuleExtraDOS.size(); i += 1000) {
|
||||
orderModuleExtraMapper.insertBatch(orderModuleExtraDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
if (itemDOS != null) {
|
||||
for (int i = 0; i < itemDOS.size(); i += 1000) {
|
||||
orderItemMapper.insertBatch(itemDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
@@ -195,4 +196,64 @@ public class OrderInputProcessor {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产单id查询文档id
|
||||
*/
|
||||
public List<String> buildRespByOrderId(Long orderId, String index, Integer size) {
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.size(size);
|
||||
builder.query(q -> q.term(b -> b.field("orderId").value(orderId)));
|
||||
|
||||
builder.source(s -> s.fetch(false));
|
||||
|
||||
try {
|
||||
SearchResponse<?> search = elasticsearchClient.search(builder.build(), Object.class);
|
||||
List<? extends Hit<?>> hits = search.hits().hits();
|
||||
if (CollectionUtil.isNotEmpty(hits)) {
|
||||
return hits.stream().map(Hit::id).collect(Collectors.toList());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产单Id批量删除
|
||||
*/
|
||||
public void deleteByOrderId(Long orderId, String index) {
|
||||
DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.query(q -> q.term(t -> t.field("orderId").value(orderId)));
|
||||
|
||||
try {
|
||||
DeleteByQueryResponse response = elasticsearchClient.deleteByQuery(builder.build());
|
||||
log.info("Deleted {} documents with planId {}", response.deleted(), orderId);
|
||||
} catch (IOException e) {
|
||||
log.error("Error deleting documents with planId {}: {}", orderId, e.getMessage());
|
||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
public void deleteByOrderId(List<Long> orderIds, String index) {
|
||||
List<FieldValue> fieldValues = orderIds.stream().map(FieldValue::of).toList();
|
||||
|
||||
DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder();
|
||||
builder.index(index);
|
||||
|
||||
builder.query(q -> q.terms(b -> b.field("orderId").terms(e -> e.value(fieldValues))));
|
||||
|
||||
try {
|
||||
DeleteByQueryResponse response = elasticsearchClient.deleteByQuery(builder.build());
|
||||
log.info("Deleted {} documents with planId {}", response.deleted(), orderIds);
|
||||
} catch (IOException e) {
|
||||
log.error("Error deleting documents with planId {}: {}", orderIds, e.getMessage());
|
||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
-55
@@ -27,13 +27,6 @@ import java.util.Map;
|
||||
*/
|
||||
public interface OrderService {
|
||||
|
||||
/**
|
||||
* 创建生产单表 order_{N}
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createOrder(@Valid OrderSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新生产单表 order_{N}
|
||||
@@ -42,20 +35,6 @@ public interface OrderService {
|
||||
*/
|
||||
void updateOrder(@Valid OrderSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 作废生产单表 order_{N}
|
||||
*
|
||||
* @param orderId 编号组
|
||||
*/
|
||||
void deleteOrder(Long orderId);
|
||||
|
||||
/**
|
||||
* 还原生产单表 order_{N}
|
||||
*
|
||||
* @param orderId 编号组
|
||||
*/
|
||||
void restoreOrder(Long orderId);
|
||||
|
||||
/**
|
||||
* 获得生产单表 order_{N}
|
||||
*
|
||||
@@ -76,8 +55,7 @@ public interface OrderService {
|
||||
* @param orderId: 生产单Id
|
||||
* @return List<OrderBodyRespVO>
|
||||
*/
|
||||
List<OrderBodyRespVO> getOrderBody(Long orderId);
|
||||
String getOrderBodyToString(Long orderId);
|
||||
List<OrderBodyRespVO> getOrderBody(Long orderId, Integer deleted);
|
||||
|
||||
|
||||
List<OrderRoomBodyRespVO> getRoomAndBody(Long planId);
|
||||
@@ -87,7 +65,7 @@ public interface OrderService {
|
||||
* @param orderId: 生产单Id
|
||||
* @return Map<String, List<?>>
|
||||
*/
|
||||
Map<String,List<?>> getModule(Long orderId);
|
||||
Map<String,List<?>> getModule(Long orderId, Integer deleted);
|
||||
|
||||
/**
|
||||
* @param orderId: 生产单id
|
||||
@@ -96,7 +74,7 @@ public interface OrderService {
|
||||
* @return List<OrderPlatesDetailReqVO>
|
||||
* 需要修改返回值
|
||||
*/
|
||||
PageResult<OrderPlatesDetailReqVO> getPlatesDetail(Long orderId, Long roomId, Long bodyId, Long groupId, String groupName, Integer pageNo, Integer pageSize);
|
||||
PageResult<OrderPlatesDetailReqVO> getPlatesDetail(Long orderId, Long roomId, Long bodyId, Long groupId, String groupName, Integer pageNo, Integer pageSize, Integer deleted);
|
||||
|
||||
/**
|
||||
* @param orderId: 生产单id
|
||||
@@ -105,22 +83,15 @@ public interface OrderService {
|
||||
* @return List<OrderPartsRespVO>
|
||||
* 需要修改返回值
|
||||
*/
|
||||
PageResult<OrderPartsRespVO> getPartsDetail(Long orderId, Long roomId , Long bodyId , String name, Integer pageNo, Integer pageSize);
|
||||
PageResult<OrderPartsRespVO> getPartsDetail(Long orderId, Long roomId , Long bodyId , String name, Integer pageNo, Integer pageSize, Integer deleted);
|
||||
|
||||
/**
|
||||
* 删除柜体
|
||||
* 删除柜体/柜体还原
|
||||
* @param orderId: 生产单id
|
||||
* @param bodyIds: 柜体id
|
||||
* @param roomId: 房间id
|
||||
* @param bodyId: 柜体id
|
||||
*/
|
||||
void deleteBodyByOrder(Long orderId , Collection<Long> bodyIds);
|
||||
|
||||
/**
|
||||
* @param orderId:
|
||||
* @return Object
|
||||
* @author Administrator
|
||||
* @date 2024/3/30
|
||||
*/
|
||||
List<OrderBodyDO> getBody(Long orderId);
|
||||
void updateBodyDeletedByOrderId(Long orderId , Long roomId, Long bodyId, Integer status);
|
||||
|
||||
/**
|
||||
* @param listMap:生产单号
|
||||
@@ -130,22 +101,11 @@ public interface OrderService {
|
||||
*/
|
||||
Long importApiData(Map<String, List<?>> listMap);
|
||||
|
||||
/**
|
||||
* @param orderId: 生产单Id
|
||||
* @return List<GoodsDO>
|
||||
*/
|
||||
List<GoodsDO> getGoodsList(Long orderId);
|
||||
|
||||
/**
|
||||
* 文件数据导入
|
||||
*/
|
||||
void importExcelData(OrderDO orderDO, List<?> list, Integer index);
|
||||
|
||||
/**
|
||||
* 模板文件导入保存
|
||||
*/
|
||||
String importTemplate(MultipartFile file,Boolean type);
|
||||
|
||||
/**
|
||||
* 生产导入文件模板下载
|
||||
*/
|
||||
@@ -169,7 +129,8 @@ public interface OrderService {
|
||||
*/
|
||||
Boolean customOrderNoIsExists(String customOrderNo);
|
||||
|
||||
/**查找api单号列表
|
||||
/**
|
||||
* 查找api单号列表
|
||||
*/
|
||||
List<ApiOrderRespVO> getApiOrderList(JSONObject orderList);
|
||||
|
||||
@@ -179,13 +140,22 @@ public interface OrderService {
|
||||
*/
|
||||
Map<String,List<OrderOverdueRespVO>> getOrderWarn();
|
||||
|
||||
/**
|
||||
* 小板数量
|
||||
*/
|
||||
PageResult<OrderGoodsPlateRespVO> plateCount(String startTime, String endTime, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 小板面积
|
||||
* 生产单单量
|
||||
*/
|
||||
PageResult<OrderGoodsPlateRespVO> plateArea(String startTime, String endTime, Integer pageNo, Integer pageSize);
|
||||
Map<String, Integer> orderCountProducePeriod(String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 修改生产单是否删除
|
||||
*/
|
||||
Integer updateOrderDel(Long orderId, Integer status);
|
||||
|
||||
|
||||
/**
|
||||
* 作废中删除
|
||||
*/
|
||||
void realDeletedOrder(Long orderId);
|
||||
|
||||
|
||||
}
|
||||
+381
-529
File diff suppressed because one or more lines are too long
+22
-6
@@ -14,27 +14,27 @@ public interface OrderStatisticsService {
|
||||
/**
|
||||
* 生产单总数统计
|
||||
*/
|
||||
Integer orderCount(OrderStatisticsReqVO reqVO);
|
||||
Integer orderCount();
|
||||
|
||||
/**
|
||||
* 今日新增生产单总数统计
|
||||
*/
|
||||
Integer orderCountToday(OrderStatisticsReqVO reqVO);
|
||||
Integer orderCountToday();
|
||||
|
||||
/**
|
||||
* 今日生产单完成总数
|
||||
*/
|
||||
Integer orderCountTodayFinish(OrderStatisticsReqVO reqVO);
|
||||
Integer orderCountTodayFinish();
|
||||
|
||||
/**
|
||||
* 今日生产单完成总数
|
||||
*/
|
||||
Integer orderCountProduce(OrderStatisticsReqVO reqVO);
|
||||
Integer orderCountProduce();
|
||||
|
||||
/**
|
||||
* 今日生产单完成总数
|
||||
*/
|
||||
Integer orderSquareProduce(OrderStatisticsReqVO reqVO);
|
||||
Integer orderSquareProduce();
|
||||
|
||||
/**
|
||||
* 生产单状态分组统计
|
||||
@@ -50,10 +50,26 @@ public interface OrderStatisticsService {
|
||||
Map<String, Object> getOrderAndPlanCountGroup(OrderStatisticsReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 生产单、排单平方数统计
|
||||
* 生产单、排单平方数分组统计
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> getOrderAndPlanAreaSumGroup(OrderStatisticsReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 小板数量分组统计
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getOrderPlateCountGroup(OrderStatisticsReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 小板面积分组统计
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getOrderPlateAreaGroup(OrderStatisticsReqVO reqVO);
|
||||
}
|
||||
|
||||
+237
-62
@@ -2,8 +2,7 @@ package com.cf.imes.module.executor.service.order;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.OrderStatusEnum;
|
||||
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsAreaRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsStatusRespVO;
|
||||
@@ -11,7 +10,11 @@ import com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanStatisticsA
|
||||
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.plan.PlanMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.OrderPlateStatisticsMapper;
|
||||
import com.cf.imes.module.executor.enums.OrderStatisticsUnit;
|
||||
import com.cf.imes.module.system.api.dict.DictDataApi;
|
||||
import com.cf.imes.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -44,46 +47,47 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
@Resource
|
||||
private PlanMapper planMapper;
|
||||
|
||||
@Resource
|
||||
private OrderPlateStatisticsMapper orderPlateStatisticsMapper;
|
||||
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
// 常用的字段key
|
||||
private static final String DATELIST_FIELD_NAME = "dateList";
|
||||
private static final String SERIES_FIELD_NAME = "series";
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Integer orderCount(OrderStatisticsReqVO reqVO) {
|
||||
return orderStatisticsMapper.selectOrderCount(getOrganIdParam(reqVO));
|
||||
public Integer orderCount() {
|
||||
return orderStatisticsMapper.selectOrderCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Integer orderCountToday(OrderStatisticsReqVO reqVO) {
|
||||
return orderStatisticsMapper.selectOrderCountToday(getOrganIdParam(reqVO));
|
||||
public Integer orderCountToday() {
|
||||
return orderStatisticsMapper.selectOrderCountToday();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Integer orderCountTodayFinish(OrderStatisticsReqVO reqVO) {
|
||||
return orderStatisticsMapper.selectOrderCountTodayFinish(getOrganIdParam(reqVO));
|
||||
public Integer orderCountTodayFinish() {
|
||||
return orderStatisticsMapper.selectOrderCountTodayFinish();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Integer orderCountProduce(OrderStatisticsReqVO reqVO) {
|
||||
return orderStatisticsMapper.selectOrderCountProduce(getOrganIdParam(reqVO));
|
||||
public Integer orderCountProduce() {
|
||||
return orderStatisticsMapper.selectOrderCountProduce();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Integer orderSquareProduce(OrderStatisticsReqVO reqVO) {
|
||||
return orderStatisticsMapper.selectOrderSquareProduce(getOrganIdParam(reqVO));
|
||||
public Integer orderSquareProduce() {
|
||||
return orderStatisticsMapper.selectOrderSquareProduce();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Map<String, Object> getOrderStatusCount(OrderStatisticsReqVO reqVO) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
// 获取机构id
|
||||
reqVO.setOrganId(getOrganIdParam(reqVO));
|
||||
|
||||
// 计算时间跨度
|
||||
getTimeSpan(reqVO);
|
||||
// 所有的日期集合
|
||||
List<String> dateList = getDateList(reqVO);
|
||||
|
||||
// 查询订单状态统计数据
|
||||
List<OrderStatisticsStatusRespVO> orderStatusRespVOS = orderStatisticsMapper.selectOrderStatusCountGroupBy(reqVO);
|
||||
@@ -93,10 +97,6 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
.sorted(Comparator.naturalOrder())
|
||||
.collect(Collectors.groupingBy(OrderStatisticsStatusRespVO::getDate, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
// 所有的日期集合
|
||||
List<String> dateList = generateDateRange(reqVO);
|
||||
resultMap.put("dateList", dateList);
|
||||
|
||||
// 遍历订单状态所有枚举值
|
||||
List<Map<String, Object>> series = new ArrayList<>();
|
||||
for (OrderStatusEnum orderStatusEnum : OrderStatusEnum.values()) {
|
||||
@@ -123,25 +123,18 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
seriesItem.put("name", orderStatusEnum.getDescription());
|
||||
series.add(seriesItem);
|
||||
}
|
||||
|
||||
resultMap.put("series", series);
|
||||
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, reqVO.getUnit())).toList());
|
||||
resultMap.put(SERIES_FIELD_NAME, series);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Map<String, Object> getOrderAndPlanCountGroup(OrderStatisticsReqVO reqVO) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
|
||||
// 获取机构id
|
||||
reqVO.setOrganId(getOrganIdParam(reqVO));
|
||||
|
||||
// 计算时间跨度
|
||||
getTimeSpan(reqVO);
|
||||
|
||||
// 所有的日期集合
|
||||
List<String> dateList = generateDateRange(reqVO);
|
||||
List<String> dateList = getDateList(reqVO);
|
||||
|
||||
Map<String, List<OrderStatisticsStatusRespVO>> orderRespMap = orderStatisticsMapper.selectOrderCountGroupByOrderDate(reqVO).stream()
|
||||
.sorted(Comparator.naturalOrder())
|
||||
@@ -151,8 +144,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
.collect(Collectors.groupingBy(OrderPlanStatisticsCountRespVO::getDate, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
// 遍历时间跨度列表,匹配数量存入数组,没有补0存入数组
|
||||
for (int i = 0; i < dateList.size(); i++) {
|
||||
String dateStr = dateList.get(i);
|
||||
for (String dateStr : dateList) {
|
||||
int[] countArr = new int[2];
|
||||
// 存入生产单数量
|
||||
Integer orderCount = Optional.ofNullable(orderRespMap.get(dateStr))
|
||||
@@ -168,25 +160,18 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
.orElse(0);
|
||||
countArr[1] = planCount;
|
||||
|
||||
resultMap.put(dateStr, countArr);
|
||||
resultMap.put(generateDateRangeAxis(dateStr, reqVO.getUnit()), countArr);
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public Map<String, Object> getOrderAndPlanAreaSumGroup(OrderStatisticsReqVO reqVO) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
|
||||
// 获取机构id
|
||||
reqVO.setOrganId(getOrganIdParam(reqVO));
|
||||
|
||||
// 计算时间跨度
|
||||
getTimeSpan(reqVO);
|
||||
|
||||
// 所有的日期集合
|
||||
List<String> dateList = generateDateRange(reqVO);
|
||||
List<String> dateList = getDateList(reqVO);
|
||||
|
||||
Map<String, List<OrderStatisticsAreaRespVO>> orderRespMap = orderStatisticsMapper.selectOrderAreaGroupByOrderDate(reqVO).stream()
|
||||
.sorted(Comparator.naturalOrder())
|
||||
@@ -207,12 +192,171 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
List<OrderPlanStatisticsAreaRespVO> planCountRespVOS = planRespMap.get(dateStr);
|
||||
areaArr[1] = planCountRespVOS != null && !planCountRespVOS.isEmpty() ? planCountRespVOS.get(0).getAreaSum() : BigDecimal.ZERO;
|
||||
|
||||
resultMap.put(dateStr, areaArr);
|
||||
resultMap.put(generateDateRangeAxis(dateStr, reqVO.getUnit()), areaArr);
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getOrderPlateCountGroup(OrderStatisticsReqVO reqVO) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
|
||||
// 所有的日期集合
|
||||
List<String> dateList = getDateList(reqVO);
|
||||
|
||||
// 查询时间段内数量最多的小板,排序列出数量前10的goods_id
|
||||
List<Long> topTenCountGoodsId = orderPlateStatisticsMapper.selectPlateCountList(reqVO).stream()
|
||||
.sorted(Comparator.comparingLong(OrderGoodsPlateRespVO::getOrderCount).reversed())
|
||||
.map(OrderGoodsPlateRespVO::getGoodsId)
|
||||
.limit(10)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
// 前十goods_id基于时间分组
|
||||
Map<String, List<OrderGoodsPlateRespVO>> orderGoodsPlateRespMap = orderPlateStatisticsMapper.selectTopTenPlateCountListGroupByOrderDate(topTenCountGoodsId, reqVO).stream()
|
||||
.sorted(Comparator.naturalOrder())
|
||||
.collect(Collectors.groupingBy(OrderGoodsPlateRespVO::getOrderDate, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
// 获取所有商品{goodsId:respvo},根据top10排序
|
||||
Map<Long, OrderGoodsPlateRespVO> goodsMap = new LinkedHashMap<>();
|
||||
for (Long id : topTenCountGoodsId) {
|
||||
List<OrderGoodsPlateRespVO> list = orderGoodsPlateRespMap.values().stream()
|
||||
.flatMap(List::stream)
|
||||
.filter(vo -> vo.getGoodsId().equals(id))
|
||||
.collect(Collectors.toList());
|
||||
if (!list.isEmpty()) {
|
||||
// goodsId相同,其他属性任取
|
||||
goodsMap.put(id, list.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
// 遍历所有goods_id
|
||||
List<Map<String, Object>> series = new ArrayList<>();
|
||||
for (Map.Entry<Long, OrderGoodsPlateRespVO> entry : goodsMap.entrySet()) {
|
||||
Map<String, Object> seriesItem = new HashMap<>();
|
||||
int[] sumArr = new int[dateList.size()];
|
||||
|
||||
// 遍历完整的日期范围
|
||||
int index = 0;
|
||||
for (String dateStr : dateList) {
|
||||
// 查找匹配的goodsId
|
||||
List<OrderGoodsPlateRespVO> orderGoodsPlateRespVOS = orderGoodsPlateRespMap.get(dateStr);
|
||||
int count = 0;
|
||||
if (orderGoodsPlateRespVOS != null) {
|
||||
Optional<OrderGoodsPlateRespVO> matchingRespVO = orderGoodsPlateRespVOS.stream()
|
||||
.filter(respVO -> Objects.equals(entry.getKey(), respVO.getGoodsId()))
|
||||
.findFirst();
|
||||
count = matchingRespVO.map(OrderGoodsPlateRespVO::getOrderCount).orElse(0);
|
||||
}
|
||||
sumArr[index++] = count;
|
||||
}
|
||||
|
||||
seriesItem.put("data", sumArr);
|
||||
seriesItem.put("id", entry.getKey());
|
||||
// 材质-商品名称-颜色-纹理-宽-高-厚-品牌
|
||||
OrderGoodsPlateRespVO orderGoodsPlateRespVO = entry.getValue();
|
||||
// 获取纹路描述
|
||||
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.GRAIN_TYPE, String.valueOf(orderGoodsPlateRespVO.getTexture())).getData();
|
||||
String texture = ObjectUtil.isNotNull(grainDTO) ? grainDTO.getLabel() : "";
|
||||
seriesItem.put("name", orderGoodsPlateRespVO.getMaterial() + "-" + orderGoodsPlateRespVO.getGoodsName() +
|
||||
"-" + orderGoodsPlateRespVO.getColor() + "-" + texture + "-" + stripTrailingZeros(orderGoodsPlateRespVO.getWidth()) +
|
||||
"×" + stripTrailingZeros(orderGoodsPlateRespVO.getHeight()) + "×" + stripTrailingZeros(orderGoodsPlateRespVO.getThickness()) + "-" + orderGoodsPlateRespVO.getBrand());
|
||||
series.add(seriesItem);
|
||||
}
|
||||
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, reqVO.getUnit())).toList());
|
||||
resultMap.put(SERIES_FIELD_NAME, series);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getOrderPlateAreaGroup(OrderStatisticsReqVO reqVO) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
|
||||
// 所有的日期集合
|
||||
List<String> dateList = getDateList(reqVO);
|
||||
|
||||
// 查询时间段内面积最多的小板,排序列出前10面积的goods_id
|
||||
List<Long> topTenCountGoodsId = orderPlateStatisticsMapper.selectPlateAreaList(reqVO).stream()
|
||||
.sorted(Comparator.comparing(OrderGoodsPlateRespVO::getOrderArea).reversed())
|
||||
.map(OrderGoodsPlateRespVO::getGoodsId)
|
||||
.limit(10)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
// 前十goods_id基于时间分组
|
||||
Map<String, List<OrderGoodsPlateRespVO>> orderGoodsPlateRespMap = orderPlateStatisticsMapper.selectTopTenPlateAreaListGroupByOrderDate(topTenCountGoodsId, reqVO).stream()
|
||||
.sorted(Comparator.naturalOrder())
|
||||
.collect(Collectors.groupingBy(OrderGoodsPlateRespVO::getOrderDate, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
// 获取所有商品{goodsId:respvo},根据top10排序
|
||||
Map<Long, OrderGoodsPlateRespVO> goodsMap = new LinkedHashMap<>();
|
||||
for (Long id : topTenCountGoodsId) {
|
||||
List<OrderGoodsPlateRespVO> list = orderGoodsPlateRespMap.values().stream()
|
||||
.flatMap(List::stream)
|
||||
.filter(vo -> vo.getGoodsId().equals(id))
|
||||
.collect(Collectors.toList());
|
||||
if (!list.isEmpty()) {
|
||||
// goodsId相同,其他属性任取
|
||||
goodsMap.put(id, list.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
// 遍历所有goods_id
|
||||
List<Map<String, Object>> series = new ArrayList<>();
|
||||
for (Map.Entry<Long, OrderGoodsPlateRespVO> entry : goodsMap.entrySet()) {
|
||||
Map<String, Object> seriesItem = new HashMap<>();
|
||||
BigDecimal[] areaArr = new BigDecimal[dateList.size()];
|
||||
|
||||
// 遍历完整的日期范围
|
||||
int index = 0;
|
||||
for (String dateStr : dateList) {
|
||||
// 查找匹配的goodsId
|
||||
List<OrderGoodsPlateRespVO> orderGoodsPlateRespVOS = orderGoodsPlateRespMap.get(dateStr);
|
||||
BigDecimal area = new BigDecimal(0);
|
||||
if (orderGoodsPlateRespVOS != null) {
|
||||
area = orderGoodsPlateRespVOS.stream()
|
||||
.filter(respVO -> Objects.equals(entry.getKey(), respVO.getGoodsId()))
|
||||
.map(vo -> vo.getOrderArea().stripTrailingZeros())
|
||||
.findFirst().orElse(new BigDecimal(0));
|
||||
}
|
||||
areaArr[index++] = area;
|
||||
}
|
||||
|
||||
seriesItem.put("data", areaArr);
|
||||
seriesItem.put("id", entry.getKey());
|
||||
// 材质-商品名称-颜色-纹理-宽-高-厚-品牌
|
||||
OrderGoodsPlateRespVO orderGoodsPlateRespVO = entry.getValue();
|
||||
// 获取纹路描述
|
||||
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.GRAIN_TYPE, String.valueOf(orderGoodsPlateRespVO.getTexture())).getData();
|
||||
String texture = ObjectUtil.isNotNull(grainDTO) ? grainDTO.getLabel() : "";
|
||||
seriesItem.put("name", orderGoodsPlateRespVO.getMaterial() + "-" + orderGoodsPlateRespVO.getGoodsName() +
|
||||
"-" + orderGoodsPlateRespVO.getColor() + "-" + texture + "-" + stripTrailingZeros(orderGoodsPlateRespVO.getWidth()) +
|
||||
"×" + stripTrailingZeros(orderGoodsPlateRespVO.getHeight()) + "×" + stripTrailingZeros(orderGoodsPlateRespVO.getThickness()) + "-" + orderGoodsPlateRespVO.getBrand());
|
||||
series.add(seriesItem);
|
||||
}
|
||||
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, reqVO.getUnit())).toList());
|
||||
resultMap.put(SERIES_FIELD_NAME, series);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取日期区间格式下的所有日期字符串
|
||||
* 1、reqVO设置机构id
|
||||
* 2、计算时间跨度设置到reqVO
|
||||
* 3、返回所有日期的集合
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
private List<String> getDateList(OrderStatisticsReqVO reqVO) {
|
||||
// 计算时间跨度
|
||||
getTimeSpan(reqVO);
|
||||
|
||||
// 所有的日期集合
|
||||
return generateDateRange(reqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计的时间跨度
|
||||
* 计算起止时间:前端不传入时间就根据维度单位从当前日期计算
|
||||
@@ -232,16 +376,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;
|
||||
@@ -303,16 +447,47 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端传组织否则查当前用户所在的组织
|
||||
*
|
||||
* @param reqVO
|
||||
* 构建日期格式到图标横轴可用格式
|
||||
* 2024-1 -> 2024年第1季度
|
||||
* 2024-1-1 -> 2024年1月
|
||||
* ...
|
||||
* @param unit
|
||||
* @return
|
||||
*/
|
||||
private Long getOrganIdParam(OrderStatisticsReqVO reqVO) {
|
||||
if (reqVO != null && reqVO.getOrganId() != null) {
|
||||
return reqVO.getOrganId();
|
||||
private String generateDateRangeAxis(String date, Integer unit) {
|
||||
OrderStatisticsUnit orderStatisticsUnit = OrderStatisticsUnit.fromValue(unit);
|
||||
StringBuilder newDateStrBuffer = new StringBuilder();
|
||||
String[] dateSplit = date.split("-");
|
||||
switch (orderStatisticsUnit) {
|
||||
case QUARTER:
|
||||
newDateStrBuffer.append("第").append(dateSplit[1]).append("季度");
|
||||
break;
|
||||
case MONTH:
|
||||
newDateStrBuffer.append(dateSplit[1]).append("月");
|
||||
break;
|
||||
case WEEK:
|
||||
newDateStrBuffer.append("第").append(dateSplit[2]).append("周");
|
||||
break;
|
||||
case DAY:
|
||||
newDateStrBuffer.append(dateSplit[2]);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return newDateStrBuffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除尾数的0,600.000 -> 600
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
private String stripTrailingZeros(BigDecimal data) {
|
||||
if (ObjectUtil.isNotNull(data)) {
|
||||
return data.stripTrailingZeros().toPlainString();
|
||||
} else {
|
||||
return SecurityFrameworkUtils.getUserOrganId();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.cf.imes.module.executor.service.order.intervalometer;
|
||||
|
||||
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderGroup.OrderGroupMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
|
||||
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
|
||||
|
||||
/**
|
||||
* 生产单定时处理器
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OrderScheduledImpl {
|
||||
|
||||
@Resource
|
||||
// @Qualifier("imes_prod")
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Resource
|
||||
private RawGoodsMapper rawGoodsMapper;
|
||||
|
||||
@Resource
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
@Resource
|
||||
private OrderPartsMapper orderPartsMapper;
|
||||
|
||||
@Resource
|
||||
private PlateMapper plateMapper;
|
||||
|
||||
@Resource
|
||||
private OrderBodyMapper orderBodyMapper;
|
||||
|
||||
@Resource
|
||||
private OrderGroupMapper orderGroupMapper;
|
||||
|
||||
@Resource
|
||||
private OrderItemMapper orderItemMapper;
|
||||
|
||||
@Resource
|
||||
private OrderInputProcessor orderInputProcessor;
|
||||
|
||||
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
public static final String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
|
||||
|
||||
public OrderScheduledImpl() {
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "0 0 2 * * ?")
|
||||
// @Scheduled(cron = "0/1 * * * * *")
|
||||
@OrganIgnore
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void fixedDeletedOrder() {
|
||||
System.out.println(" 定时任务开始 ");
|
||||
if (getLoginUser() == null){
|
||||
|
||||
}
|
||||
List<Long> orderDOList = orderMapper.selectOrderListByUpdateTime();
|
||||
|
||||
// // 作废 生产单表,body,group,goods,parts,plate,raw_goods,item
|
||||
// rawGoodsMapper.deleteBatch(orderDOList);
|
||||
// goodsMapper.deleteBatch(orderDOList);
|
||||
// orderItemMapper.deleteBatch(orderDOList);
|
||||
// orderBodyMapper.deleteBatch(orderDOList);
|
||||
// orderGroupMapper.deleteBatch(orderDOList);
|
||||
//
|
||||
// orderPartsMapper.deleteBatch(orderDOList);
|
||||
// plateMapper.deleteBatch(orderDOList);
|
||||
//
|
||||
// orderMapper.deleteBatchIds(orderDOList); // 生产单删除
|
||||
//
|
||||
//// 删除板材的造型数据 es
|
||||
// orderInputProcessor.deleteByOrderId(orderDOList, ORDER_PLATE_MODEL);
|
||||
//// 删除备注信息 es
|
||||
// orderInputProcessor.deleteByOrderId(orderDOList, ORDER_PARTS_REMARK_MODEL);
|
||||
|
||||
System.out.println(" 定时任务结束 ");
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -182,7 +182,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
// 修改生产单的状态为待排单
|
||||
List<Long> orderIds = JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class);
|
||||
List<OrderDO> orderDOS = orderMapper.selectBatchIds(orderIds).stream().map(m -> m.setStatus(OrderStatusEnum.NO_SORT.getStatus())).collect(Collectors.toList());
|
||||
List<OrderDO> orderDOS = orderMapper.selectBatchIds(orderIds).stream().map(m -> m.setStatus(OrderStatusEnum.SORTED.getStatus())).collect(Collectors.toList());
|
||||
orderMapper.updateBatch(orderDOS);
|
||||
|
||||
return Boolean.TRUE;
|
||||
@@ -279,7 +279,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
QueryWrapperX<OrderDO> queryWrapperX = new QueryWrapperX<>();
|
||||
queryWrapperX
|
||||
.eq("a.organ_id",getUserOrganId())
|
||||
.eq("a.status",OrderStatusEnum.NO_SORT.getStatus())
|
||||
.eq("a.status",OrderStatusEnum.SORTED.getStatus())
|
||||
.eq("a.deleted",false)
|
||||
.likeIfPresent("a.id", pageReqVO.getOrderId() != null ? pageReqVO.getOrderId().toString() : null)
|
||||
// .isNull("opi.item_id")
|
||||
@@ -359,7 +359,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
QueryWrapperX<OrderDO> queryWrapperX = new QueryWrapperX<>();
|
||||
queryWrapperX
|
||||
.eq("a.organ_id",getUserOrganId())
|
||||
.eq("a.status",OrderStatusEnum.NO_SORT.getStatus())
|
||||
.eq("a.status",OrderStatusEnum.SORTED.getStatus())
|
||||
.eq("a.deleted",false)
|
||||
.likeIfPresent("a.id", pageReqVO.getOrderId() != null ? pageReqVO.getOrderId().toString() : null)
|
||||
// .isNull("opi.item_id")
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
});
|
||||
INDEX.set(0);
|
||||
// 修改生产单的状态
|
||||
orderMapper.updateOrderStatus(createReqVO.getOrderId(), OrderStatusEnum.NO_SORT.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
orderMapper.updateOrderStatus(createReqVO.getOrderId(), OrderStatusEnum.SORTED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
// 批量插入
|
||||
orderProcessMapper.insert(orderProcess.setNextStepId(processListReqDTO.getLists().get(0).getId()).setStatus(false));
|
||||
processStepMapper.insertBatch(processStepDOS);
|
||||
|
||||
+14
-2
@@ -171,6 +171,20 @@ public class ApiDataAchieve {
|
||||
return new AsyncResult<>(block);
|
||||
}
|
||||
|
||||
// 订单获取
|
||||
public Future<JSONObject> getApiOrder(String token, String shopId, String orderNo) {
|
||||
JSONObject jsonOrders = new JSONObject();
|
||||
jsonOrders.put("order_no", shopId + "@N" +orderNo);
|
||||
JSONObject order = apiDataProduction.getApiOrderList(token, jsonOrders);
|
||||
return new AsyncResult<>(order);
|
||||
}
|
||||
public Future<JSONObject> getApiOrder(String token) { // 批量导入专用,之后删除
|
||||
JSONObject jsonOrders = new JSONObject();
|
||||
jsonOrders.put("page_count", PARTS_PAGE_MAX );
|
||||
JSONObject order = apiDataProduction.getApiOrderList(token, jsonOrders);
|
||||
return new AsyncResult<>(order);
|
||||
}
|
||||
|
||||
// 订单列表
|
||||
public Future<JSONObject> getApiOrderList(String token,String shopId,String createDateMin, String createDateMax, String orderNo, String customOrderNo) {
|
||||
JSONObject jsonOrders = new JSONObject();
|
||||
@@ -201,8 +215,6 @@ public class ApiDataAchieve {
|
||||
}
|
||||
|
||||
JSONObject orders = apiDataProduction.getApiOrderList(token, jsonOrders);
|
||||
System.out.println(" jsonOrders " + jsonOrders);
|
||||
System.out.println(" orders " + orders);
|
||||
if (!orders.getString("err_code").equals("0")) {
|
||||
throw exception(ORDER_READ_ERR);
|
||||
}
|
||||
|
||||
+154
-123
@@ -24,6 +24,7 @@ import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -66,7 +67,7 @@ public class ApiTypeRealize {
|
||||
* @author Administrator
|
||||
* @date 2024/5/6
|
||||
*/
|
||||
public Map<String, List<?>> apiPlateDataChange(JSONObject dataPlates, JSONObject dataParts
|
||||
public Map<String, List<?>> apiPlateDataChange(JSONObject order, JSONObject dataPlates, JSONObject dataParts
|
||||
, JSONObject dataBody, JSONObject dataGoods
|
||||
, JSONObject plates, JSONObject dataModule
|
||||
, JSONObject dataBlocks, String orderNo) {
|
||||
@@ -77,9 +78,9 @@ public class ApiTypeRealize {
|
||||
Long orderId = (Long) identifierGenerator.nextId(null);
|
||||
|
||||
// 生产单数据
|
||||
OrderDO orderDO = orderInfoChange(dataPlates, orderId, orderNo);
|
||||
List<OrderDO> order = new ArrayList<>();
|
||||
order.add(orderDO);
|
||||
OrderDO orderDO = orderInfoChange(order, orderId, orderNo);
|
||||
List<OrderDO> orderList = new ArrayList<>();
|
||||
orderList.add(orderDO);
|
||||
|
||||
// 商品信息数据 信息以全
|
||||
Map<String, Map<Long, ?>> goodsInfoChange = rawGoodsInfoChange(dataGoods, orderId, dataBlocks);
|
||||
@@ -128,7 +129,7 @@ public class ApiTypeRealize {
|
||||
// + " 柜体信息 " + new ArrayList<>(bodyInfoChange.values())
|
||||
// + " 加工组信息 " + orderGroupDO
|
||||
// + " 配件Item " + partsItems + " 板材Item " + platesItems);
|
||||
map.put("orderDO", order);
|
||||
map.put("orderDO", orderList);
|
||||
map.put("itemDO", itemsList);
|
||||
map.put("bodyDO", bodyItemsPlates.values().stream().collect(Collectors.toList()));
|
||||
return map;
|
||||
@@ -258,22 +259,26 @@ public class ApiTypeRealize {
|
||||
/**
|
||||
* 生产单信息转换
|
||||
*
|
||||
* @param dataPlates:
|
||||
* @param orderJson:
|
||||
* @return OrderDO
|
||||
* @author Administrator
|
||||
* @date 2024/4/30
|
||||
*/
|
||||
public OrderDO orderInfoChange(JSONObject dataPlates, Long orderId, String orderNo) {
|
||||
public OrderDO orderInfoChange(JSONObject orderJson, Long orderId, String orderNo) {
|
||||
// 获取 Orders 字段对应的数组
|
||||
JSONObject order = dataPlates.getJSONArray("Orders").getJSONObject(0);
|
||||
JSONObject order = orderJson.getJSONArray("data").getJSONObject(0);
|
||||
|
||||
// 如果 Orders 数组不为空,则获取第一个订单对象
|
||||
if (order != null && !order.isEmpty()) {
|
||||
// 获取生产单信息
|
||||
// 使用 DateTimeFormatter 解析日期字符串
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate orderDate = LocalDate.parse(order.getString("SaleDate"), formatter);
|
||||
LocalDate deliveryDate = LocalDate.parse(order.getString("DeliveryDate"), formatter);
|
||||
LocalDate orderDate = LocalDate.parse(order.getString("start_date"), formatter);
|
||||
LocalDate deliveryDate = LocalDate.parse(order.getString("end_date"), formatter);
|
||||
if (deliveryDate.isBefore(orderDate)) {
|
||||
// 将 deliveryDate 设置为 orderDate 后的第 30 天
|
||||
deliveryDate = orderDate.plus(30, ChronoUnit.DAYS);
|
||||
}
|
||||
String orderRemark = "[" + orderNo + "]; ";
|
||||
|
||||
OrderDO orderDO = OrderDO.builder()
|
||||
@@ -285,18 +290,26 @@ public class ApiTypeRealize {
|
||||
.orderType(OrderTypeEnum.MAIN_ORDER.getStatus())
|
||||
// .orderSort(0)
|
||||
.dataType(DataTypeEnum.API_IMPORT.getStatus())
|
||||
.status(OrderStatusEnum.NEW_ORDER.getStatus())
|
||||
.customOrderNo(order.getString("CustomOrderNo"))
|
||||
.customer(order.getString("Consigee"))
|
||||
.address(order.getString("ConsigeeAddress"))
|
||||
.phoneNumber(order.getString("ConsigeePhone"))
|
||||
.dealer(order.getString("CustomName"))
|
||||
.dealerPhoneNumber("无")
|
||||
// .salesman(order.getString("SalePerson"))
|
||||
.salesman("")
|
||||
.splitter("")
|
||||
.remark(orderRemark + order.getString("Remark"))
|
||||
// .status(OrderStatusEnum.NEW_ORDER.getStatus())
|
||||
.customOrderNo(order.getString("custom_order_no"))
|
||||
.customer(order.getString("cosignee_name"))
|
||||
.address(order.getString("cosignee_address"))
|
||||
.phoneNumber(order.getString("cosignee_phone"))
|
||||
.dealer(order.getString("store_name"))
|
||||
.dealerPhoneNumber(order.getString("store_phone"))
|
||||
.salesman(order.getString("nick_name"))
|
||||
// .salesman("")
|
||||
// .splitter("")
|
||||
.splitter(order.getString("cd_nick_name"))
|
||||
.remark(orderRemark + order.getString("comments"))
|
||||
.build();
|
||||
|
||||
Integer submitState = order.getInteger("submit_state");
|
||||
if (submitState == 1){
|
||||
orderDO.setStatus(OrderStatusEnum.EMPTY.getStatus());
|
||||
}else {
|
||||
orderDO.setStatus(OrderStatusEnum.NEW_ORDER.getStatus());
|
||||
}
|
||||
return orderDO;
|
||||
}
|
||||
return null;
|
||||
@@ -512,6 +525,9 @@ public class ApiTypeRealize {
|
||||
|
||||
/**
|
||||
* 板材信息转换 写表 Integer指板材的ItemID板id 加一个板材自定义编号
|
||||
* value 板材造型数据
|
||||
* dataPlates 板材明细
|
||||
* dataBlocks 板材数据
|
||||
*/
|
||||
private Map<String, Map<Long, ?>> platesInfoChange(JSONObject value, JSONObject dataPlates, Long orderId,
|
||||
Map<Long, GoodsDO> goodsDOMap, Map<Long, OrderBodyDO> bodyInfos,
|
||||
@@ -546,16 +562,10 @@ public class ApiTypeRealize {
|
||||
.id(plateId)
|
||||
.orderId(orderId)
|
||||
.name(plate.getString("BoardName"))
|
||||
// .plateNo(plate.getString("CustBlockNo"))
|
||||
.plateNo((obtainingTime) + Long.toString(plateNo).substring(2))
|
||||
.type(type)
|
||||
|
||||
.goodsId(goodsDOMap.get(plate.getLong("GoodsID")) != null
|
||||
? goodsDOMap.get(plate.getLong("GoodsID")).getId() : plate.getLong("GoodsID"))
|
||||
// .width(BigDecimal.valueOf(plate.getDouble("CutWidth")))
|
||||
// .height(BigDecimal.valueOf(plate.getDouble("CutWidth")))
|
||||
// .thickness(goodsDOMap.get(plate.getLong("GoodsID")) != null
|
||||
// ? goodsDOMap.get(plate.getLong("GoodsID")).getThickness() : BigDecimal.valueOf(0L))
|
||||
.splitHeight(BigDecimal.valueOf(plate.getDouble("SpliteHeight")))
|
||||
.splitThickness(BigDecimal.valueOf(plate.getDouble("SpliteThickness")))
|
||||
.splitWidth(BigDecimal.valueOf(plate.getDouble("SpliteWidth")))
|
||||
@@ -563,22 +573,20 @@ public class ApiTypeRealize {
|
||||
.sealRight(BigDecimal.valueOf(plate.getDouble("SealedRight")))
|
||||
.sealUp(BigDecimal.valueOf(plate.getDouble("SealedUp")))
|
||||
.sealDown(BigDecimal.valueOf(plate.getDouble("SealedDown")))
|
||||
.area(plateDetail.get(plate.getLong("BlockNo")).getSealAcreage())
|
||||
.texture(plateDetail.get(plate.getLong("BlockNo")).getTexture())
|
||||
|
||||
.holeFace(plateDetail.get(plate.getLong("BlockNo")).getTypographicFace()) // 孔面类型
|
||||
// .area(plateDetail.get(plate.getLong("BlockNo")).getSealAcreage())
|
||||
// .texture(plateDetail.get(plate.getLong("BlockNo")).getTexture())
|
||||
// .holeFace(plateDetail.get(plate.getLong("BlockNo")).getTypographicFace()) // 孔面类型
|
||||
.holeArrange(0) // 排孔类型 值无实际含义,默认初始化值
|
||||
.unregularPointCount(0)// 异形孔个数 值无实际含义,默认初始化值
|
||||
|
||||
.frontHoleCount(plate.getInteger("FrontHoleCount"))
|
||||
.sideHoleCount(plate.getInteger("BackHoleCount"))
|
||||
.sideHoleCount(plate.getInteger("SideHoleCount"))
|
||||
.frontModelCount(plate.getInteger("FrontModelCount"))
|
||||
.backModelCount(plate.getInteger("BackModelCount"))
|
||||
.isDoor(plateDetail.get(plate.getLong("BlockNo")).getOpenDoorType() == 0)
|
||||
.isDoor(plate.getInteger("OpenDoorType") != 0)
|
||||
.openDoorType(plate.getInteger("OpenDoorType"))
|
||||
.offsetX(plateDetail.get(plate.getLong("BlockNo")).getOffsetX())
|
||||
.offsetY(plateDetail.get(plate.getLong("BlockNo")).getOffsetY())
|
||||
// .offsetX(plateDetail.get(plate.getLong("BlockNo")).getOffsetX())
|
||||
// .offsetY(plateDetail.get(plate.getLong("BlockNo")).getOffsetY())
|
||||
.isArcAcross(false)
|
||||
.moduleTypeId(0L)
|
||||
.isSculpt(plate.getBoolean("IsModel"))
|
||||
@@ -603,39 +611,59 @@ public class ApiTypeRealize {
|
||||
.num(1.0)
|
||||
.build();
|
||||
|
||||
if (plateDetail.get(plate.getLong("BlockNo")) != null) {
|
||||
plateDetail.get(plate.getLong("BlockNo")).setPlateId(plateId)
|
||||
.setExtraRemark(plate.getString("ExtraRemark"))
|
||||
.setSpecialRemarkDei(plate.getString("SpecialRemark"))
|
||||
.setExtraHandleRemark(plate.getString("ExtraHandleRemark"))
|
||||
.setDrillsRemark(plate.getString("DrillsRemark"))
|
||||
.setInfoRemark(plate.getString("InfoRemark"))
|
||||
.setRemarkJsonDei(plate.getString("RemarkJson"));
|
||||
if (plateDetail.get(plate.getLong("BlockNo")).getThroughModelCount() != null
|
||||
&& plateDetail.get(plate.getLong("BlockNo")).getThroughModelCount() > 0){
|
||||
plateInfo.setFilterType(plateInfo.getFilterType() + ",1");
|
||||
}
|
||||
if (plateDetail.get(plate.getLong("BlockNo")).getThroughHoleCount() != null
|
||||
&& plateDetail.get(plate.getLong("BlockNo")).getThroughHoleCount() > 0){
|
||||
plateInfo.setFilterType(plateInfo.getFilterType() + ",2");
|
||||
}
|
||||
if (plateDetail.get(plate.getLong("BlockNo")).getHas2DModel() != null
|
||||
&& plateDetail.get(plate.getLong("BlockNo")).getHas2DModel()){
|
||||
plateInfo.setFilterType(plateInfo.getFilterType() + ",4");
|
||||
if (plateDetail != null){
|
||||
Long blockNo = plate.getLong("BlockNo");
|
||||
if (plateDetail.get(blockNo) != null) {
|
||||
plateDetail.get(blockNo).setPlateId(plateId)
|
||||
.setExtraRemark(plate.getString("ExtraRemark"))
|
||||
.setSpecialRemarkDei(plate.getString("SpecialRemark"))
|
||||
.setExtraHandleRemark(plate.getString("ExtraHandleRemark"))
|
||||
.setDrillsRemark(plate.getString("DrillsRemark"))
|
||||
.setInfoRemark(plate.getString("InfoRemark"))
|
||||
.setRemarkJsonDei(plate.getString("RemarkJson"));
|
||||
|
||||
plateInfo.setHoleFace(plateDetail.get(blockNo).getTypographicFace()).setIsDoor(plateDetail.get(blockNo).getOpenDoorType() == 0)
|
||||
.setOffsetX(plateDetail.get(blockNo).getOffsetX()).setOffsetY(plateDetail.get(blockNo).getOffsetY());
|
||||
|
||||
if (plateDetail.get(blockNo).getThroughModelCount() != null
|
||||
&& plateDetail.get(blockNo).getThroughModelCount() > 0){
|
||||
plateInfo.setFilterType(plateInfo.getFilterType() + ",1");
|
||||
}
|
||||
if (plateDetail.get(blockNo).getThroughHoleCount() != null
|
||||
&& plateDetail.get(blockNo).getThroughHoleCount() > 0){
|
||||
plateInfo.setFilterType(plateInfo.getFilterType() + ",2");
|
||||
}
|
||||
if (plateDetail.get(blockNo).getHas2DModel() != null
|
||||
&& plateDetail.get(blockNo).getHas2DModel()){
|
||||
plateInfo.setFilterType(plateInfo.getFilterType() + ",4");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (plateMap.get(blockNo) != null) {
|
||||
JSONObject jsonObject = plateMap.get(blockNo);
|
||||
if (plateDetail.get(blockNo) != null){
|
||||
plateDetail.get(blockNo)
|
||||
.setRemarkJson(jsonObject.getString("RemarkJson"))
|
||||
.setSpecialRemark(jsonObject.getString("SpecialRemark"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plateMap.get(plate.getLong("BlockNo")) != null) {
|
||||
JSONObject jsonObject = plateMap.get(plate.getLong("BlockNo"));
|
||||
plateInfo.setHeight(BigDecimal.valueOf(jsonObject.getDouble("Height")))
|
||||
.setWidth(BigDecimal.valueOf(jsonObject.getDouble("Width")))
|
||||
.setThickness(BigDecimal.valueOf(jsonObject.getDouble("Thickness")))
|
||||
.setArea(BigDecimal.valueOf(jsonObject.getDouble("Area")))
|
||||
.setIsRowHole(jsonObject.getBoolean("IsHole"));
|
||||
plateDetail.get(plate.getLong("BlockNo"))
|
||||
.setRemarkJson(jsonObject.getString("RemarkJson"))
|
||||
.setSpecialRemark(jsonObject.getString("SpecialRemark"));
|
||||
|
||||
if (plateMap != null){
|
||||
Long blockNo = plate.getLong("BlockNo");
|
||||
if (plateMap.get(blockNo) != null) {
|
||||
JSONObject jsonObject = plateMap.get(blockNo);
|
||||
plateInfo.setHeight(BigDecimal.valueOf(jsonObject.getDouble("Height")))
|
||||
.setWidth(BigDecimal.valueOf(jsonObject.getDouble("Width")))
|
||||
.setThickness(BigDecimal.valueOf(jsonObject.getDouble("Thickness")))
|
||||
.setArea(BigDecimal.valueOf(jsonObject.getDouble("Area")))
|
||||
.setTexture(jsonObject.getInteger("Wave"))
|
||||
.setIsRowHole(jsonObject.getBoolean("IsHole"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
platesInfos.put(plate.getLong("ItemID"), plateInfo);
|
||||
platesItem.put(plate.getLong("ItemID"), itemPlate);
|
||||
|
||||
@@ -699,79 +727,82 @@ public class ApiTypeRealize {
|
||||
*/
|
||||
public Map<Long, PlateDetail> platesDetailChange(JSONObject dataPlates) {
|
||||
Map<Long, PlateDetail> plateDetails = new HashMap<>();
|
||||
// 获取 Orders 字段对应的数组
|
||||
JSONArray ordersArray = dataPlates.getJSONArray("Orders");
|
||||
if (dataPlates.getJSONObject("value") != null){
|
||||
// 获取 Orders 字段对应的数组
|
||||
JSONArray ordersArray = dataPlates.getJSONArray("Orders");
|
||||
// System.err.println(dataPlates);
|
||||
if (ordersArray != null && !ordersArray.isEmpty()) {
|
||||
for (int i = 0; i < ordersArray.size(); i++) {
|
||||
JSONObject order = ordersArray.getJSONObject(i);
|
||||
// 获取材料信息
|
||||
if (order.getJSONArray("Materials") != null && !order.getJSONArray("Materials").isEmpty()) {
|
||||
for (int j = 0; j < order.getJSONArray("Materials").size(); j++) {
|
||||
JSONObject material = order.getJSONArray("Materials").getJSONObject(j);
|
||||
if (ordersArray != null && !ordersArray.isEmpty()) {
|
||||
for (int i = 0; i < ordersArray.size(); i++) {
|
||||
JSONObject order = ordersArray.getJSONObject(i);
|
||||
// 获取材料信息
|
||||
if (order.getJSONArray("Materials") != null && !order.getJSONArray("Materials").isEmpty()) {
|
||||
for (int j = 0; j < order.getJSONArray("Materials").size(); j++) {
|
||||
JSONObject material = order.getJSONArray("Materials").getJSONObject(j);
|
||||
// goodsMap.put()
|
||||
// 板件信息
|
||||
if (material.getJSONArray("Blocks") != null && !material.getJSONArray("Blocks").isEmpty()) {
|
||||
for (int k = 0; k < material.getJSONArray("Blocks").size(); k++) {
|
||||
JSONObject block = material.getJSONArray("Blocks").getJSONObject(k);// 每块板
|
||||
// 板件信息
|
||||
if (material.getJSONArray("Blocks") != null && !material.getJSONArray("Blocks").isEmpty()) {
|
||||
for (int k = 0; k < material.getJSONArray("Blocks").size(); k++) {
|
||||
JSONObject block = material.getJSONArray("Blocks").getJSONObject(k);// 每块板
|
||||
|
||||
PlateDetail plateDetail = PlateDetail.builder()
|
||||
.bodyNo(block.getString("BoxNo"))
|
||||
.plateNo(block.getString("BlockNo"))
|
||||
.name(block.getString("BlockName"))
|
||||
.customPlateNo(block.getString("CustomNo"))
|
||||
.roomsName(block.getString("RoomName"))
|
||||
.bodyName(block.getString("BoxName"))
|
||||
.group(block.getString("ProcessGroupName"))
|
||||
.multiNum(1)
|
||||
.plateWidth(block.getBigDecimal("Width"))
|
||||
.plateLength(block.getBigDecimal("Length"))
|
||||
.acreage(block.getBigDecimal("Size"))
|
||||
.splitWidth(block.getBigDecimal("CuttingWidth"))
|
||||
.splitLength(block.getBigDecimal("CuttingLength"))
|
||||
.sealAcreage(block.getBigDecimal("CuttingSize"))
|
||||
.isUnRegular(block.getBoolean("IsUnRegular"))
|
||||
.sealLeft(block.getBigDecimal("BorderLeft"))
|
||||
.sealRight(block.getBigDecimal("BorderRight"))
|
||||
.sealUp(block.getBigDecimal("BorderUpper"))
|
||||
.sealDown(block.getBigDecimal("BorderUnder"))
|
||||
.texture(block.getInteger("Wave"))
|
||||
.typographicFace(Integer.valueOf(block.getString("PlaceFace")))
|
||||
.openDoorType(Integer.valueOf(block.getString("OpenDoorType")))
|
||||
.offsetX(block.getBigDecimal("OffsetX"))
|
||||
.offsetY(block.getBigDecimal("OffsetY"))
|
||||
.pointDetail(getPointDetail(block, true))
|
||||
.rawPointDetail(getPointDetail(block, false))
|
||||
.holeDetail(getHoleDetail(block, true))
|
||||
.sideHoleDetail(getHoleDetail(block, false))
|
||||
.contourDetail(getModelDetail(block))
|
||||
PlateDetail plateDetail = PlateDetail.builder()
|
||||
.bodyNo(block.getString("BoxNo"))
|
||||
.plateNo(block.getString("BlockNo"))
|
||||
.name(block.getString("BlockName"))
|
||||
.customPlateNo(block.getString("CustomNo"))
|
||||
.roomsName(block.getString("RoomName"))
|
||||
.bodyName(block.getString("BoxName"))
|
||||
.group(block.getString("ProcessGroupName"))
|
||||
.multiNum(1)
|
||||
.plateWidth(block.getBigDecimal("Width"))
|
||||
.plateLength(block.getBigDecimal("Length"))
|
||||
.acreage(block.getBigDecimal("Size"))
|
||||
.splitWidth(block.getBigDecimal("CuttingWidth"))
|
||||
.splitLength(block.getBigDecimal("CuttingLength"))
|
||||
.sealAcreage(block.getBigDecimal("CuttingSize"))
|
||||
.isUnRegular(block.getBoolean("IsUnRegular"))
|
||||
.sealLeft(block.getBigDecimal("BorderLeft"))
|
||||
.sealRight(block.getBigDecimal("BorderRight"))
|
||||
.sealUp(block.getBigDecimal("BorderUpper"))
|
||||
.sealDown(block.getBigDecimal("BorderUnder"))
|
||||
.texture(block.getInteger("Wave"))
|
||||
.typographicFace(Integer.valueOf(block.getString("PlaceFace")))
|
||||
.openDoorType(Integer.valueOf(block.getString("OpenDoorType")))
|
||||
.offsetX(block.getBigDecimal("OffsetX"))
|
||||
.offsetY(block.getBigDecimal("OffsetY"))
|
||||
.pointDetail(getPointDetail(block, true))
|
||||
.rawPointDetail(getPointDetail(block, false))
|
||||
.holeDetail(getHoleDetail(block, true))
|
||||
.sideHoleDetail(getHoleDetail(block, false))
|
||||
.contourDetail(getModelDetail(block))
|
||||
// 排钻类型
|
||||
.drillsInfos(getDrillsInfo(block))
|
||||
.build();
|
||||
.drillsInfos(getDrillsInfo(block))
|
||||
.build();
|
||||
|
||||
if (block.getJSONObject("ExtraRemark") != null) {
|
||||
if (block.getJSONObject("ExtraRemark").getJSONObject("extra") != null)
|
||||
plateDetail.setBoardType(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("boardType"))
|
||||
.setThroughHoleCount(Double.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("throughHoleCount")))
|
||||
.setThroughModelCount(Double.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("throughModelCount")))
|
||||
.setHas2DModel(Boolean.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("has2DModel")))
|
||||
.setHas3DModel(Boolean.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("has3DModel")))
|
||||
.setRemark(remarkToMap(block))
|
||||
.setSideRemark(edgeRemarkToMap(block.getJSONObject("ExtraRemark").getJSONObject("extra")));
|
||||
if (block.getJSONObject("ExtraRemark") != null) {
|
||||
if (block.getJSONObject("ExtraRemark").getJSONObject("extra") != null)
|
||||
plateDetail.setBoardType(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("boardType"))
|
||||
.setThroughHoleCount(Double.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("throughHoleCount")))
|
||||
.setThroughModelCount(Double.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("throughModelCount")))
|
||||
.setHas2DModel(Boolean.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("has2DModel")))
|
||||
.setHas3DModel(Boolean.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("has3DModel")))
|
||||
.setRemark(remarkToMap(block))
|
||||
.setSideRemark(edgeRemarkToMap(block.getJSONObject("ExtraRemark").getJSONObject("extra")));
|
||||
}
|
||||
plateDetails.put(block.getLong("BlockNo"), plateDetail);
|
||||
}
|
||||
plateDetails.put(block.getLong("BlockNo"), plateDetail);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// System.out.println("板块 " + plateDetails);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
} else {
|
||||
// System.out.println("JSON 数据中没有订单信息(Orders 数组为空)。");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return plateDetails;
|
||||
}
|
||||
|
||||
|
||||
+53
-16
@@ -69,7 +69,7 @@ public class ExcelReadUtil { // 文件读取
|
||||
// if (MapUtil.isEmpty(orderMap) || CollectionUtil.isEmpty(list)) {
|
||||
// isErr.set(-1);
|
||||
// }
|
||||
map.put("order", orderMap);
|
||||
map.put("order", changeOrderDO(orderMap));
|
||||
map.put("plate", list);
|
||||
return map;
|
||||
|
||||
@@ -80,28 +80,28 @@ public class ExcelReadUtil { // 文件读取
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String error = "";
|
||||
// 判断是否为空
|
||||
if ( orderMap.get("客户") == null){
|
||||
if (orderMap.get("客户") == null) {
|
||||
error += "客户不能为空;";
|
||||
}
|
||||
if (orderMap.get("经销商") == null){
|
||||
if (orderMap.get("经销商") == null) {
|
||||
error += "经销商不能为空;";
|
||||
}
|
||||
if (orderMap.get("客户地址") == null){
|
||||
if (orderMap.get("客户地址") == null) {
|
||||
error += "客户地址不能为空;";
|
||||
}
|
||||
if (orderMap.get("出货日期") == null){
|
||||
if (orderMap.get("出货日期") == null) {
|
||||
error += "出货日期不能为空;";
|
||||
}
|
||||
if (orderMap.get("客户电话") == null){
|
||||
if (orderMap.get("客户电话") == null) {
|
||||
error += "客户电话不能为空;";
|
||||
} else {
|
||||
if (!validatePhoneNumber((String) orderMap.get("客户电话"))) {
|
||||
error += orderMap.get("客户电话")+ "-客户电话格式错误;";
|
||||
error += orderMap.get("客户电话") + "-客户电话格式错误;";
|
||||
}
|
||||
}
|
||||
if (orderMap.get("经销商电话") != null){
|
||||
if (orderMap.get("经销商电话") != null) {
|
||||
if (!validatePhoneNumber((String) orderMap.get("经销商电话"))) {
|
||||
error += orderMap.get("经销商电话")+ "-经销商电话格式错误;";
|
||||
error += orderMap.get("经销商电话") + "-经销商电话格式错误;";
|
||||
}
|
||||
}
|
||||
OrderDO orderDO = OrderDO.builder()
|
||||
@@ -117,16 +117,16 @@ public class ExcelReadUtil { // 文件读取
|
||||
.splitter((String) orderMap.get("拆单员"))
|
||||
.remark((String) orderMap.get("备注"))
|
||||
.build();
|
||||
if (orderMap.get("出货日期") == null){
|
||||
if (orderMap.get("出货日期") == null) {
|
||||
error += "出货日期不能为空;";
|
||||
}else {
|
||||
} else {
|
||||
String s = (String) orderMap.get("出货日期");
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
try {
|
||||
LocalDate orderDate = LocalDate.parse(s, formatter);
|
||||
orderDO.setDeliveryDate(orderDate.atStartOfDay()); //
|
||||
} catch (DateTimeParseException e) {
|
||||
error += s + "-出货日期格式错误;";
|
||||
error += s + "-出货日期格式错误;";
|
||||
}
|
||||
}
|
||||
map.put("order", orderDO);
|
||||
@@ -317,10 +317,21 @@ public class ExcelReadUtil { // 文件读取
|
||||
List<String> errList = new ArrayList<>();
|
||||
Boolean flag = true;
|
||||
// 检查非空 类型、数量
|
||||
if (StringUtils.isEmpty(vo.getGoodType()) || StringUtils.isEmpty(vo.getGoodsNumber())) {
|
||||
errList.add("类型、数量不能为空");
|
||||
if (StringUtils.isEmpty(vo.getGoodType())) {
|
||||
errList.add("类型不能为空");
|
||||
flag = false;
|
||||
}
|
||||
if (StringUtils.isEmpty(vo.getGoodsNumber())) {
|
||||
errList.add("数量不能为空");
|
||||
flag = false;
|
||||
} else {
|
||||
|
||||
if (!checkNumber(vo.getGoodsNumber())) {
|
||||
flag = false;
|
||||
errList.add("数量不能为0");
|
||||
}
|
||||
|
||||
}
|
||||
// 检查商品物料编码或是商品名称、规格、材质、颜色不可全为空
|
||||
if (StringUtils.isEmpty(vo.getGoodsId()) && (StringUtils.isEmpty(vo.getGoodsName()) || StringUtils.isEmpty(vo.getSpec())
|
||||
|| StringUtils.isEmpty(vo.getMaterial()) || StringUtils.isEmpty(vo.getColor()) || StringUtils.isEmpty(vo.getUnit()))) {
|
||||
@@ -329,11 +340,16 @@ public class ExcelReadUtil { // 文件读取
|
||||
}
|
||||
// 若商品类型为板材,需检查房间、柜体、板名称、成品长、成品宽、拆单长、拆单宽、厚、左封边、右封边、上封边、下封边、排版面、纹路、开门方向不能为空
|
||||
if (StringUtils.equals(vo.getGoodType(), "板材")) {
|
||||
// 数量类型判断
|
||||
if (!convertToInteger(vo.getGoodsNumber())) {
|
||||
flag = false;
|
||||
errList.add("数量类型错误");
|
||||
}
|
||||
// 纹理有效性判断
|
||||
if (StringUtils.isEmpty(vo.getWave())) {
|
||||
errList.add("板材纹理不可为空");
|
||||
flag = false;
|
||||
}else {
|
||||
} else {
|
||||
if (!StringUtils.equals(vo.getWave().trim(), "无") && !StringUtils.equals(vo.getWave().trim(), "有")) {
|
||||
flag = false;
|
||||
errList.add("纹理无效");
|
||||
@@ -343,7 +359,7 @@ public class ExcelReadUtil { // 文件读取
|
||||
if (StringUtils.isEmpty(vo.getGoodsHeight()) && StringUtils.isEmpty(vo.getGoodsWidth()) && StringUtils.isEmpty(vo.getGoodsThickness())) {
|
||||
flag = false;
|
||||
errList.add("板材长宽厚数据不能为空");
|
||||
}else {
|
||||
} else {
|
||||
// 大板长宽厚数据不为空,检查数据格式
|
||||
if (!convertToDouble(vo.getGoodsHeight())) {
|
||||
flag = false;
|
||||
@@ -515,6 +531,16 @@ public class ExcelReadUtil { // 文件读取
|
||||
return true;
|
||||
}
|
||||
|
||||
// 数据类型可否转换判断
|
||||
public Boolean convertToInteger(String str) {
|
||||
try {
|
||||
Integer.parseInt(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 数据长度判断
|
||||
public boolean checkPrecision(String numberStr) {
|
||||
if (numberStr == null) {
|
||||
@@ -545,4 +571,15 @@ public class ExcelReadUtil { // 文件读取
|
||||
public void setErr(int isErr) {
|
||||
this.isErr.set(isErr);
|
||||
}
|
||||
|
||||
// 数量大小判断
|
||||
public Boolean checkNumber(String numberStr) {
|
||||
if (numberStr == null) {
|
||||
return false;
|
||||
}
|
||||
if (Double.parseDouble(numberStr) <= 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+19
-8
@@ -119,12 +119,12 @@ public class ExcelTypeRealize {
|
||||
RawGoodsDO rawGoodsDO = setRawGoodsDO(value.get(0)).setId((Long) snowFlakeGenerator.nextId(null)).setOrderId(orderId);
|
||||
rawGoodsDOS.add(rawGoodsDO);
|
||||
Long goodId = (Long) snowFlakeGenerator.nextId(null);
|
||||
GoodsDO plateDO = setGoodsDO(value.get(0)).setId(goodId).setOrderId(orderId)
|
||||
GoodsDO goodsDO = setGoodsDO(value.get(0)).setId(goodId).setOrderId(orderId)
|
||||
.setRawGoodsId(String.valueOf(rawGoodsDO.getId())).setGoodsId(String.valueOf(rawGoodsDO.getRawGoodsId()))
|
||||
.setHeight(BigDecimal.valueOf(Double.parseDouble(value.get(0).getGoodsHeight())))
|
||||
.setWidth(BigDecimal.valueOf(Double.parseDouble(value.get(0).getGoodsWidth())))
|
||||
.setThickness(BigDecimal.valueOf(Double.parseDouble(value.get(0).getGoodsThickness())));
|
||||
goodsDOS.add(plateDO);
|
||||
goodsDOS.add(goodsDO);
|
||||
// 赋值给板件未对应前order_raw_goods的id
|
||||
for (OrderPlateImportExcelVO reqVO : value) {
|
||||
reqVO.setGoodId(goodId);
|
||||
@@ -248,7 +248,7 @@ public class ExcelTypeRealize {
|
||||
.remark(remarkExtract(combination.remarkJSON())).build();
|
||||
orderPartsRemarks.add(orderPartsRemark);
|
||||
OrderItemDO orderItemDO = OrderItemDO.builder().orderId(orderId).type(OrderItemTypeEnum.PARTS_ITEM.getStatus())
|
||||
.roomId(roomId).bodyId(bodyId).partsId(partsId).groupId(synthesisTypeName != " " ? groupId : null)
|
||||
.roomId(roomName != " " ? roomId : null).bodyId(bodyName != " " ? bodyId : null).partsId(partsId).groupId(synthesisTypeName != " " ? groupId : null)
|
||||
.num(Double.valueOf(combination.getGoodsNumber())).build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
}
|
||||
@@ -282,18 +282,29 @@ public class ExcelTypeRealize {
|
||||
}
|
||||
|
||||
// 备注提取
|
||||
// private String remarkExtract(String remark) {
|
||||
// JSONObject jsonObject = new JSONObject(remark);
|
||||
// JSONObject nonNullJsonObject = new JSONObject();
|
||||
//
|
||||
// for (String key : jsonObject.keySet()) {
|
||||
// Object value = jsonObject.get(key);
|
||||
// if (value != null) {
|
||||
// nonNullJsonObject.put(key, value);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return nonNullJsonObject.toString();
|
||||
// }
|
||||
private String remarkExtract(String remark) {
|
||||
JSONObject jsonObject = new JSONObject(remark);
|
||||
JSONObject nonNullJsonObject = new JSONObject();
|
||||
List<Object> nonNullValues = new ArrayList<>();
|
||||
|
||||
for (String key : jsonObject.keySet()) {
|
||||
Object value = jsonObject.get(key);
|
||||
if (value != null) {
|
||||
nonNullJsonObject.put(key, value);
|
||||
}
|
||||
nonNullValues.add(value);
|
||||
}
|
||||
|
||||
return nonNullJsonObject.toString();
|
||||
return nonNullValues.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-1
@@ -6,6 +6,7 @@ import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -24,6 +25,7 @@ import java.math.BigDecimal;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class OrderPlateImportExcelVO {
|
||||
|
||||
@ExcelProperty(value = "序号")
|
||||
@@ -39,6 +41,7 @@ public class OrderPlateImportExcelVO {
|
||||
private String goodsId;
|
||||
|
||||
@ExcelIgnore
|
||||
@JsonIgnore
|
||||
private Long goodId;//商品id
|
||||
|
||||
@ExcelProperty(value = "商品名称")
|
||||
@@ -221,7 +224,7 @@ public class OrderPlateImportExcelVO {
|
||||
return json;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "{}";
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-5
@@ -103,16 +103,16 @@
|
||||
o.splitter,
|
||||
o.remark,
|
||||
CONCAT(
|
||||
LPAD(FLOOR(TIMESTAMPDIFF(SECOND, o.delivery_date, #{today}) / (24 * 60 * 60)), 2, '0'), '天 ',
|
||||
LPAD(FLOOR(MOD(TIMESTAMPDIFF(SECOND, o.delivery_date, #{today}), (24 * 60 * 60)) / (60 * 60)), 2, '0'), ':',
|
||||
LPAD(FLOOR(MOD(MOD(TIMESTAMPDIFF(SECOND, o.delivery_date, #{today}), (24 * 60 * 60)), (60 * 60)) / 60), 2, '0'), ':',
|
||||
LPAD(MOD(MOD(TIMESTAMPDIFF(SECOND, o.delivery_date, #{today}), (24 * 60 * 60)), (60 * 60)) % 60, 2, '0')
|
||||
LPAD(FLOOR(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date ) / (24 * 60 * 60)), 2, '0'), '天 ',
|
||||
LPAD(FLOOR(MOD(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date), (24 * 60 * 60)) / (60 * 60)), 2, '0'), ':',
|
||||
LPAD(FLOOR(MOD(MOD(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date), (24 * 60 * 60)), (60 * 60)) / 60), 2, '0'), ':',
|
||||
LPAD(MOD(MOD(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date), (24 * 60 * 60)), (60 * 60)) % 60, 2, '0')
|
||||
) AS becomeDue
|
||||
from orders o
|
||||
where o.organ_id = #{organId}
|
||||
and o.deleted = 0
|
||||
and o.status != 4
|
||||
and o.delivery_date between #{orderDate} and #{today}
|
||||
and o.delivery_date between #{today} and #{orderDate}
|
||||
</select>
|
||||
|
||||
<select id="selectOrderOverdue" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO">
|
||||
@@ -148,4 +148,22 @@
|
||||
and o.status != 4
|
||||
and #{today} > DATE(o.delivery_date)
|
||||
</select>
|
||||
|
||||
<select id="selectOrderCountProducePeriod" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCountProducePeriodRespVO">
|
||||
SELECT
|
||||
DATE(o.order_date) AS order_date,
|
||||
COUNT(o.id) AS count
|
||||
FROM
|
||||
orders o
|
||||
WHERE
|
||||
o.deleted = 0
|
||||
AND DATE(o.order_date) BETWEEN #{startTime} AND #{endTime}
|
||||
<if test="organId != null">
|
||||
AND o.organ_id = #{organId}
|
||||
</if>
|
||||
GROUP BY
|
||||
DATE(o.order_date)
|
||||
ORDER BY
|
||||
order_date;
|
||||
</select>
|
||||
</mapper>
|
||||
+15
-40
@@ -5,15 +5,9 @@
|
||||
SELECT SUM(op.area) as area FROM orders o
|
||||
LEFT JOIN order_plate op on op.order_id = o.id
|
||||
WHERE o.deleted = 0
|
||||
<if test="organId != null">
|
||||
AND o.organ_id = #{organId}
|
||||
</if>
|
||||
</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>
|
||||
@@ -21,15 +15,20 @@
|
||||
,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.organ_id = #{req.organId}
|
||||
and o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
where o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
and o.deleted = 0
|
||||
group by orderStatus, date;
|
||||
</select>
|
||||
@@ -37,21 +36,9 @@
|
||||
<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.organ_id = #{req.organId}
|
||||
and o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
where o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
and o.deleted = 0
|
||||
group by date;
|
||||
</select>
|
||||
@@ -59,22 +46,10 @@
|
||||
<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 and op.organ_id = #{req.organId}
|
||||
where o.organ_id = #{req.organId}
|
||||
and o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
join order_plate op on op.order_id = o.id
|
||||
where o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
and o.deleted = 0
|
||||
group by date;
|
||||
</select>
|
||||
|
||||
+7
-5
@@ -26,15 +26,14 @@
|
||||
a.brand,
|
||||
a.factory,
|
||||
a.unit,
|
||||
a.price,
|
||||
a.is_composite,
|
||||
a.remark,
|
||||
b.num,
|
||||
c.name as body_name,
|
||||
c.id as body_id,
|
||||
c.room_id,
|
||||
c.room_name,
|
||||
b.num * a.price AS total_price -- 添加计算总金额的列
|
||||
c.room_name
|
||||
|
||||
FROM order_parts a
|
||||
LEFT JOIN order_item b ON a.id = b.parts_id
|
||||
LEFT JOIN order_body c on c.id = b.body_id
|
||||
@@ -81,7 +80,7 @@
|
||||
<foreach collection="partsIds" item="partsId" open="(" separator="," close=")">
|
||||
#{partsId}
|
||||
</foreach>
|
||||
AND organ_id = #{organId}
|
||||
AND organ_id = #{organId}
|
||||
</delete>
|
||||
|
||||
<select id="selectPartList"
|
||||
@@ -117,6 +116,9 @@
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="countPartsByOrderId" resultType="java.lang.Integer">
|
||||
SELECT count(*) FROM order_plate
|
||||
WHERE order_id = #{orderId} AND organ_id = #{organId} AND deleted = #{deleted}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+1
-2
@@ -156,8 +156,7 @@
|
||||
,CONCAT(YEAR(p.create_time), '-', 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
|
||||
,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time), '-', 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
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.cf.imes.module.executor.dal.mysql.plate.OrderPlateStatisticsMapper">
|
||||
<select id="selectPlateCountList" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO">
|
||||
select g.goods_id,
|
||||
count(a.id) as orderCount
|
||||
from order_goods g
|
||||
left join order_plate a ON g.id = a.goods_id and a.deleted = 0
|
||||
left join orders o ON o.id = a.order_id and o.deleted = 0
|
||||
where g.deleted = 0
|
||||
and o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
group by g.goods_id
|
||||
having orderCount > 0
|
||||
order by null;
|
||||
</select>
|
||||
|
||||
<select id="selectTopTenPlateCountListGroupByOrderDate" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO">
|
||||
SELECT g.goods_id,
|
||||
MIN(g.material) AS material,
|
||||
MIN(g.brand) AS brand,
|
||||
MIN(g.color) AS color,
|
||||
MIN(g.goods_name) AS goods_name,
|
||||
MIN(g.height) AS height,
|
||||
MIN(g.spec) AS spec,
|
||||
MIN(g.texture) AS texture,
|
||||
MIN(g.thickness) AS thickness,
|
||||
MIN(g.width) AS width,
|
||||
COUNT(a.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 orderDate
|
||||
</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 orderDate
|
||||
</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 orderDate
|
||||
</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 orderDate
|
||||
</if>
|
||||
FROM order_goods g
|
||||
LEFT JOIN order_plate a ON g.id = a.goods_id and a.deleted = 0
|
||||
LEFT JOIN orders o ON o.id = a.order_id and o.deleted = 0
|
||||
WHERE g.deleted = 0
|
||||
AND o.order_date BETWEEN #{req.createTime[0]} AND #{req.createTime[1]}
|
||||
and g.goods_id in
|
||||
<foreach item="goodsId" collection="goodsIds" open="(" separator="," close=")">
|
||||
#{goodsId}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
g.goods_id,orderDate;
|
||||
</select>
|
||||
|
||||
<select id="selectPlateAreaList" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO">
|
||||
select g.goods_id,
|
||||
SUM(a.area) AS orderArea
|
||||
from order_goods g
|
||||
left join order_plate a ON g.id = a.goods_id and a.deleted = 0
|
||||
left join orders o ON o.id = a.order_id and o.deleted = 0
|
||||
where g.deleted = 0
|
||||
and o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
group by g.goods_id
|
||||
having orderArea > 0
|
||||
order by null;
|
||||
</select>
|
||||
|
||||
<select id="selectTopTenPlateAreaListGroupByOrderDate"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO">
|
||||
SELECT g.goods_id,
|
||||
MIN(g.material) AS material,
|
||||
MIN(g.brand) AS brand,
|
||||
MIN(g.color) AS color,
|
||||
MIN(g.goods_name) AS goods_name,
|
||||
MIN(g.height) AS height,
|
||||
MIN(g.spec) AS spec,
|
||||
MIN(g.texture) AS texture,
|
||||
MIN(g.thickness) AS thickness,
|
||||
MIN(g.width) AS width,
|
||||
SUM(a.area) AS orderArea
|
||||
<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 orderDate
|
||||
</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 orderDate
|
||||
</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 orderDate
|
||||
</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 orderDate
|
||||
</if>
|
||||
FROM order_goods g
|
||||
LEFT JOIN order_plate a ON g.id = a.goods_id and a.deleted = 0
|
||||
LEFT JOIN orders o ON o.id = a.order_id and o.deleted = 0
|
||||
WHERE g.deleted = 0
|
||||
AND o.order_date BETWEEN #{req.createTime[0]} AND #{req.createTime[1]}
|
||||
and g.goods_id in
|
||||
<foreach item="goodsId" collection="goodsIds" open="(" separator="," close=")">
|
||||
#{goodsId}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
g.goods_id,orderDate;
|
||||
</select>
|
||||
</mapper>
|
||||
+10
-64
@@ -603,71 +603,17 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlateAnalysisListByCount" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO">
|
||||
|
||||
SELECT
|
||||
MIN(g.brand) AS brand,
|
||||
MIN(g.color) AS color,
|
||||
g.goods_id,
|
||||
MIN(g.goods_name) AS goods_name,
|
||||
MIN(g.height) AS height,
|
||||
MIN(g.material) AS material,
|
||||
MIN(g.spec) AS spec,
|
||||
MIN(g.texture) AS texture,
|
||||
MIN(g.thickness) AS thickness,
|
||||
MIN(g.width) AS width,
|
||||
MIN(o.order_date) AS orderDate,
|
||||
SUM(a.area) AS orderArea,
|
||||
COUNT(a.id) AS orderCount
|
||||
FROM
|
||||
order_goods g
|
||||
LEFT JOIN order_plate a ON g.id = a.goods_id AND g.organ_id = a.organ_id
|
||||
LEFT JOIN orders o ON o.id = a.order_id
|
||||
WHERE
|
||||
a.deleted = 0
|
||||
AND DATE(o.order_date) BETWEEN #{startTime} AND #{endTime}
|
||||
<if test="organId != null">
|
||||
AND o.organ_id = #{organId}
|
||||
<select id="selectPlateTypeByRoomId" resultType="java.lang.Long">
|
||||
SELECT p.id
|
||||
FROM order_plate p
|
||||
LEFT JOIN order_item i ON p.id = i.plate_id
|
||||
WHERE i.organ_id = #{organId} AND i.order_id = #{orderId} AND p.deleted = #{deleted}
|
||||
<if test="roomId != null">
|
||||
AND i.room_id = #{roomId}
|
||||
</if>
|
||||
<if test="bodyId != null">
|
||||
AND i.body_id = #{bodyId}
|
||||
</if>
|
||||
GROUP BY
|
||||
g.goods_id
|
||||
HAVING
|
||||
SUM(a.area) > 0
|
||||
ORDER BY
|
||||
orderCount DESC;
|
||||
</select>
|
||||
|
||||
<select id="selectPlateAnalysisListByArea" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO">
|
||||
|
||||
SELECT
|
||||
MIN(g.brand) AS brand,
|
||||
MIN(g.color) AS color,
|
||||
g.goods_id,
|
||||
MIN(g.goods_name) AS goods_name,
|
||||
MIN(g.height) AS height,
|
||||
MIN(g.material) AS material,
|
||||
MIN(g.spec) AS spec,
|
||||
MIN(g.texture) AS texture,
|
||||
MIN(g.thickness) AS thickness,
|
||||
MIN(g.width) AS width,
|
||||
MIN(o.order_date) AS orderDate,
|
||||
SUM(a.area) AS orderArea,
|
||||
COUNT(a.id) AS orderCount
|
||||
FROM
|
||||
order_goods g
|
||||
LEFT JOIN order_plate a ON g.id = a.goods_id AND g.organ_id = a.organ_id
|
||||
LEFT JOIN orders o ON o.id = a.order_id
|
||||
WHERE
|
||||
a.deleted = 0
|
||||
AND DATE(o.order_date) BETWEEN #{startTime} AND #{endTime}
|
||||
<if test="organId != null">
|
||||
AND o.organ_id = #{organId}
|
||||
</if>
|
||||
GROUP BY
|
||||
g.goods_id
|
||||
HAVING
|
||||
SUM(a.area) > 0
|
||||
ORDER BY
|
||||
orderArea DESC;
|
||||
</select>
|
||||
</mapper>
|
||||
+13
-4
@@ -4,6 +4,7 @@ import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.manage.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -17,11 +18,19 @@ public interface PlateApi {
|
||||
|
||||
@GetMapping(PREFIX +"/get")
|
||||
@Operation(summary = "获得板材信息表")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
CommonResult<Boolean> getPlate(@RequestParam("id") Long id);
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024"),
|
||||
@Parameter(name = "organId", description = "板材所属组织ID", required = true, example = "1024")
|
||||
})
|
||||
CommonResult<Boolean> getPlate(@RequestParam("id") Long id,
|
||||
@RequestParam("organId") Long organId);
|
||||
|
||||
@GetMapping(PREFIX +"/getGoodsId")
|
||||
@Operation(summary = "判断板材是否存在")
|
||||
@Parameter(name = "id", description = "客户的商品编号", required = true, example = "1024")
|
||||
CommonResult<Long> getPlateGoods(@RequestParam("id") Long goodsId);
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "客户的商品编号", required = true, example = "1024"),
|
||||
@Parameter(name = "organId", description = "板材所属组织ID", required = true, example = "1024")
|
||||
})
|
||||
CommonResult<Long> getPlateGoods(@RequestParam("id") String goodsId,
|
||||
@RequestParam("organId") Long organId);
|
||||
}
|
||||
|
||||
+5
-5
@@ -8,14 +8,14 @@ import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
public class PlateServiceImpl implements PlateApi{
|
||||
public class PlateServiceApiImpl implements PlateApi{
|
||||
|
||||
@Resource
|
||||
private PlateService plateService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> getPlate(Long id) {
|
||||
PlateDO plateDO = plateService.getPlate(id);
|
||||
public CommonResult<Boolean> getPlate(Long id, Long organId) {
|
||||
PlateDO plateDO = plateService.getPlate(id, organId);
|
||||
if (plateDO == null) {
|
||||
return success(false);
|
||||
}
|
||||
@@ -23,11 +23,11 @@ public class PlateServiceImpl implements PlateApi{
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> getPlateGoods(Long goodsId) {
|
||||
public CommonResult<Long> getPlateGoods(String goodsId, Long organId) {
|
||||
if (goodsId == null) {
|
||||
return success(0L);
|
||||
}
|
||||
PlateDO plateDO = plateService.getPlateGoods(goodsId);
|
||||
PlateDO plateDO = plateService.getPlateGoods(goodsId, organId);
|
||||
if (plateDO == null) {
|
||||
return success(0L);
|
||||
}
|
||||
+8
-4
@@ -68,18 +68,22 @@ public class PlateController {
|
||||
// @PreAuthorize("@ss.hasPermission('manage:plate:delete')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:delete','base:plate:delete')")
|
||||
public CommonResult<Boolean> deletePlate(@RequestParam("id") Long id,
|
||||
@RequestParam(value = "organId",required = false) Long organId) {
|
||||
@RequestParam(value = "organId",required = false, defaultValue = "0") Long organId) {
|
||||
plateService.deletePlate(id,organId);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得板材信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024"),
|
||||
@Parameter(name = "organId", description = "板材所属组织ID", required = true, example = "1024")
|
||||
})
|
||||
// @PreAuthorize("@ss.hasPermission('manage:plate:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:query','base:plate:query')")
|
||||
public CommonResult<PlateRespVO> getPlate(@RequestParam("id") Long id) {
|
||||
PlateDO plate = plateService.getPlate(id);
|
||||
public CommonResult<PlateRespVO> getPlate(@RequestParam("id") Long id,
|
||||
@RequestParam("organId") Long organId) {
|
||||
PlateDO plate = plateService.getPlate(id, organId);
|
||||
return success(BeanUtils.toBean(plate, PlateRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ public class RemainPlateController {
|
||||
@Operation(summary = "余料板批量核销")
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:remain')")
|
||||
public CommonResult<Boolean> updateRemainPlate(@RequestBody RemainPlateUptReqVO updateReqVO) {
|
||||
remainPlateService.updateRemainPlateStatus(updateReqVO.getId(),
|
||||
remainPlateService.updateRemainPlateStatus(updateReqVO.getIds(),
|
||||
updateReqVO.getStatus(),
|
||||
updateReqVO.getUseType(),
|
||||
updateReqVO.getPlanId());
|
||||
@@ -77,7 +77,7 @@ public class RemainPlateController {
|
||||
@Operation(summary = "余料板批量释放")
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:remain')")
|
||||
public CommonResult<Boolean> revertRemainPlate(@RequestBody RemainPlateUptReqVO updateReqVO) {
|
||||
remainPlateService.revertRemainPlateStatus(updateReqVO.getId(),updateReqVO.getStatus());
|
||||
remainPlateService.revertRemainPlateStatus(updateReqVO.getIds(),updateReqVO.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import java.util.Set;
|
||||
public class RemainPlateUptReqVO {
|
||||
|
||||
@Schema(description = "余料板集", example = "16470")
|
||||
private Set<Long> id;
|
||||
private Set<Long> ids;
|
||||
|
||||
@Schema(description = "余料板状态,0未使用,1使用中", example = "1")
|
||||
private Integer status;
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ public interface PlateService {
|
||||
* @param id 编号
|
||||
* @return 板材信息表 plate_{N}
|
||||
*/
|
||||
PlateDO getPlate(Long id);
|
||||
PlateDO getPlate(Long id, Long organId);
|
||||
|
||||
/**
|
||||
* 获得板材信息表 plate_{N}
|
||||
@@ -54,7 +54,7 @@ public interface PlateService {
|
||||
* @param id 编号
|
||||
* @return 板材信息表 plate_{N}
|
||||
*/
|
||||
PlateDO getPlateGoods(Long id);
|
||||
PlateDO getPlateGoods(String id, Long organId);
|
||||
|
||||
/**
|
||||
* 获得板材信息表 plate_{N}分页
|
||||
|
||||
+14
-12
@@ -96,16 +96,18 @@ public class PlateServiceImpl implements PlateService {
|
||||
@OrganIgnore
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePlate(Long id,Long organId) {
|
||||
if (permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_DELETE_PERMISSION).getData()){
|
||||
if (organId != null && organId != 0 ){
|
||||
validateOrganExists(organId);
|
||||
}
|
||||
} else {
|
||||
organId = OrganContextHolder.getOrganId();
|
||||
}
|
||||
boolean hasPermission = permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_DELETE_PERMISSION).getData();
|
||||
|
||||
Long organIdDefault = OrganContextHolder.getOrganId();
|
||||
|
||||
if (hasPermission && organId != null && organId != 0) {
|
||||
|
||||
validateOrganExists(organId);
|
||||
|
||||
organIdDefault = organId;
|
||||
}
|
||||
// 校验存在
|
||||
validatePlateExists(id,organId);
|
||||
validatePlateExists(id,organIdDefault);
|
||||
// 删除
|
||||
plateMapper.deleteById(id);
|
||||
}
|
||||
@@ -118,13 +120,13 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public PlateDO getPlate(Long id) {
|
||||
return plateMapper.selectById(id);
|
||||
public PlateDO getPlate(Long id, Long organId) {
|
||||
return plateMapper.selectOneById(id, organId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlateDO getPlateGoods(Long id) {
|
||||
return plateMapper.selectOne(PlateDO::getGoodsId,id);
|
||||
public PlateDO getPlateGoods(String id, Long organId) {
|
||||
return plateMapper.selectByGoodID(id,organId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+9
-1
@@ -68,6 +68,8 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateRemainPlateStatus(Set<Long> ids, Integer status, Integer useType, Long planId) {
|
||||
// 余料存在判断
|
||||
validateRemainPlateExists(ids);
|
||||
if (useType != RemainPlateUseTypeEnum.TYPE_ONE.getStatus() && useType != RemainPlateUseTypeEnum.TYPE_ZERO.getStatus()) { //余料使用状态为2或3
|
||||
// 判断该排单是否存在以使用的余料
|
||||
if (remainPlateMapper.selectRemainPlatesByPlanId(planId, RemainPlateStatusEnum.IN_USE.getStatus(),
|
||||
@@ -127,6 +129,8 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
if (ids == null) {
|
||||
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
|
||||
}
|
||||
// 余料存在判断
|
||||
validateRemainPlateExists(ids);
|
||||
// 判断余料的状态是否存在使用中
|
||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.IN_USE.getStatus());
|
||||
// 删除
|
||||
@@ -150,7 +154,11 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateRemainPlateExists(Set<Long> id) {
|
||||
if (remainPlateMapper.selectBatchIds(id).isEmpty()) {
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
private RemainPlateDO validateRemainPlateIsCutting(Long id) {
|
||||
return remainPlateMapper.selectById(id);
|
||||
}
|
||||
|
||||
+1
@@ -128,6 +128,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode TENANT_PACKAGE_DISABLE = new ErrorCode(1_002_016_002, "名字为【{}】的组织套餐已被禁用");
|
||||
ErrorCode TENANT_PACKAGE_DEPT_EXIT = new ErrorCode(1_002_016_003, "无法修改内置组织权限套餐");
|
||||
ErrorCode TENANT_PACKAGE_DELETED_EXIT = new ErrorCode(1_002_016_004, "无法删除内置组织权限套餐");
|
||||
ErrorCode TENANT_PACKAGE_NAME_UNIQE_ERROR = new ErrorCode(1_002_016_005, "套餐名已存在,请编辑套餐名后重试");
|
||||
|
||||
// ========== 错误码模块 1-002-017-000 ==========
|
||||
ErrorCode ERROR_CODE_NOT_EXISTS = new ErrorCode(1_002_017_000, "错误码不存在");
|
||||
|
||||
+6
-6
@@ -40,7 +40,7 @@ public class DictDataController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "新增字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:create')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:create')")
|
||||
public CommonResult<Long> createDictData(@Valid @RequestBody DictDataSaveReqVO createReqVO) {
|
||||
Long dictDataId = dictDataService.createDictData(createReqVO);
|
||||
return success(dictDataId);
|
||||
@@ -48,7 +48,7 @@ public class DictDataController {
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "修改字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:update')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:update')")
|
||||
public CommonResult<Boolean> updateDictData(@Valid @RequestBody DictDataSaveReqVO updateReqVO) {
|
||||
dictDataService.updateDictData(updateReqVO);
|
||||
return success(true);
|
||||
@@ -57,7 +57,7 @@ public class DictDataController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除字典数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:delete')")
|
||||
public CommonResult<Boolean> deleteDictData(Long id) {
|
||||
dictDataService.deleteDictData(id);
|
||||
return success(true);
|
||||
@@ -74,7 +74,7 @@ public class DictDataController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "/获得字典类型的分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:query')")
|
||||
public CommonResult<PageResult<DictDataRespVO>> getDictTypePage(@Valid DictDataPageReqVO pageReqVO) {
|
||||
PageResult<DictDataDO> pageResult = dictDataService.getDictDataPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DictDataRespVO.class));
|
||||
@@ -83,7 +83,7 @@ public class DictDataController {
|
||||
@GetMapping(value = "/get")
|
||||
@Operation(summary = "/查询字典数据详细")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:query')")
|
||||
public CommonResult<DictDataRespVO> getDictData(@RequestParam("id") Long id) {
|
||||
DictDataDO dictData = dictDataService.getDictData(id);
|
||||
return success(BeanUtils.toBean(dictData, DictDataRespVO.class));
|
||||
@@ -91,7 +91,7 @@ public class DictDataController {
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "导出字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:export')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void export(HttpServletResponse response, @Valid DictDataPageReqVO exportReqVO) throws IOException {
|
||||
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
|
||||
+6
-6
@@ -39,7 +39,7 @@ public class DictTypeController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建字典类型")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:create')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:create')")
|
||||
public CommonResult<Long> createDictType(@Valid @RequestBody DictTypeSaveReqVO createReqVO) {
|
||||
Long dictTypeId = dictTypeService.createDictType(createReqVO);
|
||||
return success(dictTypeId);
|
||||
@@ -47,7 +47,7 @@ public class DictTypeController {
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "修改字典类型")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:update')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:update')")
|
||||
public CommonResult<Boolean> updateDictType(@Valid @RequestBody DictTypeSaveReqVO updateReqVO) {
|
||||
dictTypeService.updateDictType(updateReqVO);
|
||||
return success(true);
|
||||
@@ -56,7 +56,7 @@ public class DictTypeController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除字典类型")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:delete')")
|
||||
public CommonResult<Boolean> deleteDictType(Long id) {
|
||||
dictTypeService.deleteDictType(id);
|
||||
return success(true);
|
||||
@@ -64,7 +64,7 @@ public class DictTypeController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得字典类型的分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:query')")
|
||||
public CommonResult<PageResult<DictTypeRespVO>> pageDictTypes(@Valid DictTypePageReqVO pageReqVO) {
|
||||
PageResult<DictTypeDO> pageResult = dictTypeService.getDictTypePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DictTypeRespVO.class));
|
||||
@@ -73,7 +73,7 @@ public class DictTypeController {
|
||||
@Operation(summary = "/查询字典类型详细")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@GetMapping(value = "/get")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:query')")
|
||||
public CommonResult<DictTypeRespVO> getDictType(@RequestParam("id") Long id) {
|
||||
DictTypeDO dictType = dictTypeService.getDictType(id);
|
||||
return success(BeanUtils.toBean(dictType, DictTypeRespVO.class));
|
||||
@@ -89,7 +89,7 @@ public class DictTypeController {
|
||||
|
||||
@Operation(summary = "导出数据类型")
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
@PreAuthorize("@ss.hasPermission('dict:query')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void export(HttpServletResponse response, @Valid DictTypePageReqVO exportReqVO) throws IOException {
|
||||
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
|
||||
-9
@@ -10,7 +10,6 @@ import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.*;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserImportExcelVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserImportRespVO;
|
||||
@@ -26,10 +25,8 @@ import com.cf.imes.module.system.dal.dataobject.dept.PostDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.dept.UserPostDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.cf.imes.module.system.dal.mysql.dept.PostMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.dept.UserPostMapper;
|
||||
import com.cf.imes.module.system.enums.common.SexEnum;
|
||||
import com.cf.imes.module.system.service.dept.DeptService;
|
||||
import com.cf.imes.module.system.service.dept.PostService;
|
||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -47,7 +44,6 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
@@ -122,11 +118,6 @@ public class UserController {
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return success(new PageResult<>(pageResult.getTotal()));
|
||||
}
|
||||
// 用户列表不展示当前登录人
|
||||
boolean removeCurrentUser = pageResult.getList().removeIf(user -> Objects.equals(user.getId(), SecurityFrameworkUtils.getLoginUserId()));
|
||||
if (removeCurrentUser) {
|
||||
pageResult.setTotal(pageResult.getTotal() - 1);
|
||||
}
|
||||
// 拼接数据
|
||||
Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
||||
convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
||||
|
||||
+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);
|
||||
}
|
||||
|
||||
+22
@@ -1,9 +1,12 @@
|
||||
package com.cf.imes.module.system.service.organ;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.packages.TenantPackagePageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.packages.TenantPackageSaveReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO;
|
||||
@@ -39,6 +42,8 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
||||
|
||||
@Override
|
||||
public Long createTenantPackage(TenantPackageSaveReqVO createReqVO) {
|
||||
// 唯一性校验
|
||||
validateTenantPackageUnique(createReqVO);
|
||||
// 插入
|
||||
TenantPackageDO tenantPackage = BeanUtils.toBean(createReqVO, TenantPackageDO.class);
|
||||
tenantPackageMapper.insert(tenantPackage);
|
||||
@@ -49,6 +54,8 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
||||
@Override
|
||||
@DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换
|
||||
public void updateTenantPackage(TenantPackageSaveReqVO updateReqVO) {
|
||||
// 唯一性校验
|
||||
validateTenantPackageUnique(updateReqVO);
|
||||
// 校验存在
|
||||
TenantPackageDO tenantPackage = validateTenantPackageExists(updateReqVO.getId());
|
||||
if(Objects.equals(tenantPackage.getId(), SYSTEM_ORGAN_PACKAGE_ID) || Objects.equals(tenantPackage.getId(), SYSTEM_SUPER_PACKAGE_ID)) {
|
||||
@@ -87,6 +94,21 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
||||
return tenantPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验唯一性约束
|
||||
* @param reqVO
|
||||
*/
|
||||
private void validateTenantPackageUnique(TenantPackageSaveReqVO reqVO) {
|
||||
Long packageId = reqVO.getId();
|
||||
LambdaQueryWrapper<TenantPackageDO> wrapper = new LambdaQueryWrapperX<TenantPackageDO>().eq(TenantPackageDO::getName, reqVO.getName());
|
||||
if (ObjectUtil.isNotNull(packageId)) {
|
||||
wrapper.ne(TenantPackageDO::getId, packageId);
|
||||
}
|
||||
if (tenantPackageMapper.exists(wrapper)) {
|
||||
throw exception(TENANT_PACKAGE_NAME_UNIQE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateOrganUsed(Long id) {
|
||||
if (organService.getOrganCountByPackageId(id) > 0) {
|
||||
throw exception(TENANT_PACKAGE_USED);
|
||||
|
||||
+31
-38
@@ -1,9 +1,8 @@
|
||||
package com.cf.imes.module.system.service.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
@@ -39,6 +38,7 @@ import com.cf.imes.module.system.service.organ.OrganService;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
@@ -103,7 +103,6 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
// 校验账户配合
|
||||
organService.handleOrganInfo(organ -> {
|
||||
long count = userMapper.selectCount(new LambdaQueryWrapperX<AdminUserDO>().eq(AdminUserDO::getOrganId, organId));
|
||||
//long count = userMapper.selectCount();
|
||||
if (count >= organ.getAccountCount()) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_COUNT_MAX, organ.getAccountCount());
|
||||
}
|
||||
@@ -118,14 +117,14 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
user.setPassword(encodePassword(createReqVO.getPassword())); // 加密密码
|
||||
|
||||
String pinyinFull = PinYinUtils.convertToPinyin(user.getNickname());
|
||||
if (StrUtil.isNotBlank(pinyinFull)) {
|
||||
pinyinFull = pinyinFull.replaceAll(" ", "");
|
||||
if (StringUtils.isNotBlank(pinyinFull)) {
|
||||
pinyinFull = pinyinFull.replace(" ", "");
|
||||
}
|
||||
user.setPinyinFull(pinyinFull);
|
||||
user.setPinyinInitial(PinYinUtils.convertFirstChar(user.getNickname()));
|
||||
userMapper.insert(user);
|
||||
// 插入关联岗位
|
||||
if (CollectionUtil.isNotEmpty(user.getPostIds())) {
|
||||
if (CollUtil.isNotEmpty(user.getPostIds())) {
|
||||
userPostMapper.insertBatch(convertList(user.getPostIds(),
|
||||
postId -> new UserPostDO().setUserId(user.getId()).setPostId(postId)));
|
||||
}
|
||||
@@ -137,6 +136,8 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
public void updateUser(UserSaveReqVO updateReqVO) {
|
||||
Long organId = updateReqVO.getOrganId() == null ? OrganContextHolder.getOrganId(): updateReqVO.getOrganId();
|
||||
updateReqVO.setPassword(null); // 特殊:此处不更新密码
|
||||
// 不允许自身操作
|
||||
checkCurrentWhenOperate(updateReqVO.getId());
|
||||
// 校验正确性
|
||||
validateUserForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getUsername(),
|
||||
updateReqVO.getMobile(), updateReqVO.getEmail(), updateReqVO.getDeptId(), updateReqVO.getPostIds(),null, organId);
|
||||
@@ -146,8 +147,8 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
if(!Objects.isNull(updateReqVO.getNickname())) {
|
||||
|
||||
String pinyinFull = PinYinUtils.convertToPinyin(updateReqVO.getNickname());
|
||||
if (StrUtil.isNotBlank(pinyinFull)) {
|
||||
pinyinFull = pinyinFull.replaceAll(" ", "");
|
||||
if (StringUtils.isNotBlank(pinyinFull)) {
|
||||
pinyinFull = pinyinFull.replace(" ", "");
|
||||
}
|
||||
updateObj.setPinyinFull(pinyinFull);
|
||||
updateObj.setPinyinInitial(PinYinUtils.convertFirstChar(updateReqVO.getNickname()));
|
||||
@@ -166,11 +167,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
Collection<Long> createPostIds = CollUtil.subtract(postIds, dbPostIds);
|
||||
Collection<Long> deletePostIds = CollUtil.subtract(dbPostIds, postIds);
|
||||
// 执行新增和删除。对于已经授权的菜单,不用做任何处理
|
||||
if (!CollectionUtil.isEmpty(createPostIds)) {
|
||||
if (!CollUtil.isEmpty(createPostIds)) {
|
||||
userPostMapper.insertBatch(convertList(createPostIds,
|
||||
postId -> new UserPostDO().setUserId(userId).setPostId(postId)));
|
||||
}
|
||||
if (!CollectionUtil.isEmpty(deletePostIds)) {
|
||||
if (!CollUtil.isEmpty(deletePostIds)) {
|
||||
userPostMapper.deleteByUserIdAndPostId(userId, deletePostIds);
|
||||
}
|
||||
}
|
||||
@@ -229,6 +230,8 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@Override
|
||||
public void updateUserStatus(Long id, Integer status) {
|
||||
// 不允许自身操作
|
||||
checkCurrentWhenOperate(id);
|
||||
// 校验用户存在
|
||||
validateUserExists(id);
|
||||
// 更新状态
|
||||
@@ -241,9 +244,8 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteUser(Long id) {
|
||||
if(Objects.equals(id, SecurityFrameworkUtils.getLoginUserId())) {
|
||||
throw exception(USER_ME_ERROR);
|
||||
}
|
||||
// 不允许自身操作
|
||||
checkCurrentWhenOperate(id);
|
||||
// 校验用户存在
|
||||
validateUserExists(id);
|
||||
// 删除用户
|
||||
@@ -275,9 +277,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@Override
|
||||
public PageResult<AdminUserDO> getUserPage(UserPageReqVO reqVO) {
|
||||
if (StrUtil.isNotBlank(reqVO.getNickname())) {
|
||||
if (StringUtils.isNotBlank(reqVO.getNickname())) {
|
||||
reqVO.setPyFirstChar(PinYinUtils.convertFirstChar(reqVO.getNickname()));
|
||||
reqVO.setPyAll(PinYinUtils.convertToPinyin(reqVO.getNickname()).replaceAll(" ", ""));
|
||||
reqVO.setPyAll(PinYinUtils.convertToPinyin(reqVO.getNickname()).replace(" ", ""));
|
||||
}
|
||||
|
||||
PageResult<AdminUserDO> adminUserDOPageResult = userMapper.selectPage(reqVO, getDeptCondition(reqVO.getDeptId()));
|
||||
@@ -416,11 +418,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@VisibleForTesting
|
||||
void validateUsernameUnique(Long id, String username, Long organId) {
|
||||
if (StrUtil.isBlank(username)) {
|
||||
if (StringUtils.isBlank(username)) {
|
||||
return;
|
||||
}
|
||||
AdminUserDO user = userMapper.selectOne(AdminUserDO::getUsername, username, AdminUserDO::getOrganId, organId);
|
||||
//AdminUserDO user = userMapper.selectByUsername(username);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
@@ -435,7 +436,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@VisibleForTesting
|
||||
void validateEmailUnique(Long id, String email, Long organId) {
|
||||
if (StrUtil.isBlank(email)) {
|
||||
if (StringUtils.isBlank(email)) {
|
||||
return;
|
||||
}
|
||||
AdminUserDO user = userMapper.selectOne(AdminUserDO::getOrganId, organId, AdminUserDO::getEmail, email);
|
||||
@@ -453,7 +454,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@VisibleForTesting
|
||||
void validateMobileUnique(Long id, String mobile, Long organId) {
|
||||
if (StrUtil.isBlank(mobile)) {
|
||||
if (StringUtils.isBlank(mobile)) {
|
||||
return;
|
||||
}
|
||||
AdminUserDO user = userMapper.selectOne(AdminUserDO::getOrganId, organId, AdminUserDO::getMobile, mobile);
|
||||
@@ -538,9 +539,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
public List<AdminUserDO> getUserListByTerms(Integer status, String name) {
|
||||
String namePyFirstChar = "";
|
||||
String namePyAll = "";
|
||||
if(StrUtil.isNotBlank(name)) {
|
||||
if(StringUtils.isNotBlank(name)) {
|
||||
namePyFirstChar = PinYinUtils.convertToPinyin(name);
|
||||
namePyAll = PinYinUtils.convertToPinyin(name).replaceAll(" ", "");
|
||||
namePyAll = PinYinUtils.convertToPinyin(name).replace(" ", "");
|
||||
}
|
||||
return userMapper.selectListByTerms(status, namePyAll, namePyFirstChar, name, SecurityFrameworkUtils.getUserOrganId());
|
||||
}
|
||||
@@ -548,7 +549,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public List<OrganAdminUserRespDTO> getOrganAdminByOrganIds(Collection<Long> organIds) {
|
||||
if(CollectionUtil.isEmpty(organIds)) {
|
||||
if(CollUtil.isEmpty(organIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
MPJLambdaWrapperX<AdminUserDO> wrapperX = new MPJLambdaWrapperX<>();
|
||||
@@ -557,22 +558,6 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
;
|
||||
List<OrganAdminUserRespDTO> organAdminUserRespDTOS = userMapper.selectJoinList(OrganAdminUserRespDTO.class, wrapperX);
|
||||
return organAdminUserRespDTOS;
|
||||
|
||||
/*List<AdminUserDO> adminUserDOS = userMapper.selectList(new LambdaQueryWrapperX<AdminUserDO>()
|
||||
.in(AdminUserDO::getOrganId, organIds)
|
||||
);
|
||||
if(CollectionUtil.isNotEmpty(adminUserDOS)) {
|
||||
return adminUserDOS.stream().map(e->
|
||||
OrganAdminUserRespDTO.builder()
|
||||
.organId(e.getOrganId())
|
||||
.userId(e.getId())
|
||||
.nickname(e.getNickname())
|
||||
.username(e.getUsername())
|
||||
.build()
|
||||
|
||||
).toList();
|
||||
}*/
|
||||
// return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -585,4 +570,12 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
return passwordEncoder.encode(password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否当前用户操作
|
||||
*/
|
||||
private void checkCurrentWhenOperate(Long userId) {
|
||||
if (ObjectUtil.equal(userId, SecurityFrameworkUtils.getLoginUserId())) {
|
||||
throw exception(USER_ME_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user