mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
资金管理接口,ES索引统一枚举
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
package com.cf.imes.module.executor.api.funds;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author 资金管理feign接口
|
||||
*/
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 资金管理")
|
||||
public interface ExecutorFundsApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/funds";
|
||||
|
||||
|
||||
|
||||
@GetMapping(PREFIX +"/getInvoiceAmount")
|
||||
@Operation(summary = "查询待审核的发票金额")
|
||||
CommonResult<BigDecimal> getToExamineAmount();
|
||||
|
||||
|
||||
}
|
||||
+2
@@ -16,6 +16,8 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode PLATE_ERROR = new ErrorCode(1_001_107_005, "当前新增的板材非同一类型的板材,禁止更改");
|
||||
public static final ErrorCode PLAN_PLATE_IS_ALL_CUT = new ErrorCode(1_001_107_006, "排单号:{} 的板材已全部开料,禁止删除!");
|
||||
public static final ErrorCode PLAN_NOT_DATA_EXISTS = new ErrorCode(1_001_107_007, "排单号:{} 不存在,无法进行操作,请检查排单数据");
|
||||
public static final ErrorCode PLAN_PLATE_IS_CUTTING = new ErrorCode(1_001_107_008, "当前排单已有板材开料,无法开启混单");
|
||||
public static final ErrorCode PLAN_IS_MIXED_ERROR = new ErrorCode(1_001_107_009, "当前排单为混单,无法开启混单配置");
|
||||
|
||||
|
||||
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.cf.imes.module.executor.api.funds;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.dal.mysql.funds.invoice.InvoiceRecordsMapper;
|
||||
import com.cf.imes.module.executor.enums.amount.InvoiceStatusEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class ExecutorFundsApiImpl implements ExecutorFundsApi{
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private InvoiceRecordsMapper invoiceRecordsMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public CommonResult<BigDecimal> getToExamineAmount() {
|
||||
|
||||
BigDecimal examineAmount = invoiceRecordsMapper.selectToExamineAmount(InvoiceStatusEnum.PENDINGINVOICING.getStatus());
|
||||
|
||||
return CommonResult.success(examineAmount);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+5
-13
@@ -51,6 +51,7 @@ import java.util.List;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
@@ -101,15 +102,6 @@ public class OrderPlanApiImpl implements OrderPlanApi{
|
||||
public static final String SEPARATE = "select";
|
||||
|
||||
|
||||
public static final String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
|
||||
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
|
||||
public static final String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
|
||||
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> getOrderPlan(Long machineId) {
|
||||
|
||||
@@ -186,7 +178,7 @@ public class OrderPlanApiImpl implements OrderPlanApi{
|
||||
public String getGoods(Long planId,String filed) {
|
||||
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = buildBoardByPlanId(planId, ORDER_REMAIN_PLATE_MODEL, 10);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = buildBoardByPlanId(planId, ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), 10);
|
||||
|
||||
|
||||
|
||||
@@ -244,7 +236,7 @@ public class OrderPlanApiImpl implements OrderPlanApi{
|
||||
List<String> esData = new ArrayList<>();
|
||||
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = buildBoardByPlanId(planId, ORDER_REMAIN_PLATE_MODEL, 99);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = buildBoardByPlanId(planId, ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), 99);
|
||||
|
||||
for (OptimizeBoardModelDO optimizeBoardModelDO : optimizeBoardModelDOS) {
|
||||
List<String> filedData = new ArrayList<>() ;
|
||||
@@ -317,7 +309,7 @@ public class OrderPlanApiImpl implements OrderPlanApi{
|
||||
List<Long> plateIds = getPlateIds(planId);
|
||||
|
||||
|
||||
List<OrderModelDO> orderModelDOS = buildBoardByPlateIds(plateIds, ORDER_PLATE_MODEL, plateIds.size());
|
||||
List<OrderModelDO> orderModelDOS = buildBoardByPlateIds(plateIds, ORDER_PLATE_MODEL.getIndex(), plateIds.size());
|
||||
|
||||
|
||||
for (OrderModelDO orderModelDO : orderModelDOS) {
|
||||
@@ -425,7 +417,7 @@ public class OrderPlanApiImpl implements OrderPlanApi{
|
||||
|
||||
List<String> esData = new ArrayList<>();
|
||||
|
||||
List<OrderPartsRemark> orderPartsRemarks = buildOrderPartsByOrderId(orderIds, ORDER_PARTS_REMARK_MODEL, partNum);
|
||||
List<OrderPartsRemark> orderPartsRemarks = buildOrderPartsByOrderId(orderIds, ORDER_PARTS_REMARK_MODEL.getIndex(), partNum);
|
||||
|
||||
|
||||
for (OrderPartsRemark orderPartsRemark : orderPartsRemarks) {
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.balancedetails;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsPageReqVO;
|
||||
import com.cf.imes.module.executor.service.funds.balancedetails.BalanceDetailsService;
|
||||
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;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
/**
|
||||
* @author 组织余额明细
|
||||
*/
|
||||
@Tag(name = "管理后台 - 组织余额明细")
|
||||
@RestController
|
||||
@RequestMapping("/executor/balance")
|
||||
@Validated
|
||||
public class BalanceDetailsController {
|
||||
|
||||
|
||||
@Resource
|
||||
private BalanceDetailsService balanceDetailsService;
|
||||
|
||||
|
||||
|
||||
@GetMapping("")
|
||||
@Operation(summary = "获取组织余额明细")
|
||||
public CommonResult<PageResult<BalanceDetailsRespVO>> getBalanceDetailsPage(@Valid BalanceDetailsPageReqVO pageReqVO) {
|
||||
|
||||
return success(balanceDetailsService.getBalanceDetailsPage(pageReqVO));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "组织余额明细导出")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void balanceDetailsExport(@Valid BalanceDetailsPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BalanceDetailsRespVO> list = balanceDetailsService.getBalanceDetailsPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "余额明细表.xls", "数据", BalanceDetailsRespVO.class,
|
||||
BeanUtils.toBean(list, BalanceDetailsRespVO.class));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
|
||||
@Schema(description = "管理后台 - 组织余额明细分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder
|
||||
public class BalanceDetailsPageReqVO extends PageParam {
|
||||
|
||||
|
||||
@Schema(description = "流水号")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "组织名称")
|
||||
private String organName;
|
||||
|
||||
|
||||
@Schema(description = "交易类型")
|
||||
private Integer tradeType;
|
||||
|
||||
|
||||
@Schema(description = "收支类型")
|
||||
private Integer incomeExpenseType;
|
||||
|
||||
|
||||
@Schema(description = "创建时间", example = "[2022-07-01 ,2022-07-01]")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate[] createTime;
|
||||
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class BalanceDetailsRespVO {
|
||||
|
||||
|
||||
@Schema(description = "流水号")
|
||||
@ExcelProperty("流水号")
|
||||
private Long businessNo;
|
||||
|
||||
|
||||
@Schema(description = "交易类型,0充值 1软件购买")
|
||||
@ExcelProperty("交易类型")
|
||||
private Integer tradeType;
|
||||
|
||||
|
||||
@Schema(description = "收支类型,0收入 1支出")
|
||||
private Integer incomeExpenseType;
|
||||
|
||||
|
||||
@Schema(description = "入账现金")
|
||||
@ExcelProperty("入账现金")
|
||||
private BigDecimal entryAmount;
|
||||
|
||||
|
||||
@Schema(description = "入账赠送金")
|
||||
@ExcelProperty("入账赠送金")
|
||||
private BigDecimal entryGiftAmount;
|
||||
|
||||
|
||||
@Schema(description = "支出现金")
|
||||
@ExcelProperty("支出现金")
|
||||
private BigDecimal expensesAmount;
|
||||
|
||||
|
||||
@Schema(description = "支出赠送金")
|
||||
@ExcelProperty("支出赠送金")
|
||||
private BigDecimal expensesGiftAmount;
|
||||
|
||||
|
||||
@Schema(description = "可用金额")
|
||||
@ExcelProperty("可用金额")
|
||||
private BigDecimal availableAmount;
|
||||
|
||||
|
||||
@Schema(description = "现金金额")
|
||||
@ExcelProperty("现金金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
@Schema(description = "赠送金额")
|
||||
@ExcelProperty("赠送金额")
|
||||
private BigDecimal giftAmount;
|
||||
|
||||
|
||||
@Schema(description = "交易时间")
|
||||
@ExcelProperty("交易时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@Schema(description = "操作人")
|
||||
@ExcelProperty("操作人")
|
||||
private LocalDateTime creator;
|
||||
|
||||
|
||||
@Schema(description = "支出/入账现金金额")
|
||||
private BigDecimal cashAmountChange;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "支出/入账赠送金金额")
|
||||
private BigDecimal bonusAmountChange;
|
||||
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.bill;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.bill.vo.BillDetailsRespVO;
|
||||
import com.cf.imes.module.executor.service.funds.bill.BillService;
|
||||
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;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
/**
|
||||
* @author 账单/总额明细
|
||||
*/
|
||||
@Tag(name = "管理后台 - 账单/总额明细")
|
||||
@RestController
|
||||
@RequestMapping("/executor/bill")
|
||||
@Validated
|
||||
public class BillController {
|
||||
|
||||
|
||||
@Resource
|
||||
private BillService billService;
|
||||
|
||||
|
||||
|
||||
@GetMapping("")
|
||||
@Operation(summary = "获取组织账单明细")
|
||||
public CommonResult<PageResult<BillDetailsRespVO>> getBillDetailsPage(@Valid BalanceDetailsPageReqVO pageReqVO) {
|
||||
|
||||
return success(billService.getBillDetailsPage(pageReqVO));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "组织账单明细下载")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void billDetailsExport(@Valid BalanceDetailsPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BillDetailsRespVO> list = billService.getBillDetailsPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "余额明细表.xls", "数据", BillDetailsRespVO.class,list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.bill.vo;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class BillDetailsRespVO {
|
||||
|
||||
|
||||
@Schema(description = "流水号")
|
||||
@ExcelProperty("流水号")
|
||||
private Long businessNo;
|
||||
|
||||
|
||||
@Schema(description = "交易类型-枚举类-")
|
||||
private Integer tradeType;
|
||||
|
||||
|
||||
@Schema(description = "收支类型-枚举类")
|
||||
private Integer incomeExpenseType;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "充值金额")
|
||||
@ExcelProperty("充值金额")
|
||||
private BigDecimal rechargeAmount;
|
||||
|
||||
|
||||
@Schema(description = "产品金额")
|
||||
@ExcelProperty("产品金额")
|
||||
private BigDecimal productAmount;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "支出现金")
|
||||
@ExcelProperty("支出现金")
|
||||
private BigDecimal cashExpenditure;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "支出账户余额")
|
||||
@ExcelProperty("支出账户余额")
|
||||
private BigDecimal expenditureAccountBalance;
|
||||
|
||||
|
||||
@Schema(description = "实际支出总费用")
|
||||
@ExcelProperty("实际支出总费用")
|
||||
private BigDecimal actualTotalExpenditure;
|
||||
|
||||
|
||||
@Schema(description = "交易时间")
|
||||
@ExcelProperty("交易时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@Schema(description = "操作人")
|
||||
@ExcelProperty("操作人")
|
||||
private LocalDateTime creator;
|
||||
|
||||
|
||||
@Schema(description = "支出/入账现金金额")
|
||||
private BigDecimal cashAmountChange;
|
||||
|
||||
|
||||
@Schema(description = "支出/入账赠送金金额")
|
||||
private BigDecimal bonusAmountChange;
|
||||
|
||||
|
||||
@Schema(description = "可用余额")
|
||||
private BigDecimal availableAmount;
|
||||
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.invoice.vo.*;
|
||||
import com.cf.imes.module.executor.service.funds.invoice.InvoiceService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.IMPORT;
|
||||
|
||||
/**
|
||||
* @author 发票管理
|
||||
*/
|
||||
@Tag(name = "管理后台 - 发票管理")
|
||||
@RestController
|
||||
@RequestMapping("/executor/invoice")
|
||||
@Validated
|
||||
public class InvoiceController {
|
||||
|
||||
|
||||
@Resource
|
||||
private InvoiceService invoiceService;
|
||||
|
||||
|
||||
|
||||
@GetMapping("/{organId}")
|
||||
@Operation(summary = "获取组织的开票金额信息")
|
||||
@Parameter(name = "organId", description = "组织ID", required = true, example = "1")
|
||||
public CommonResult<InvoiceAmountRespVO> getInvoiceAmount(@PathVariable("organId") Long organId) {
|
||||
|
||||
return success(invoiceService.getInvoiceAmount(organId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/details")
|
||||
@Operation(summary = "获取组织可开票数据明细")
|
||||
public CommonResult<PageResult<InvoiceDetailsRespVO>> getInvoiceDetails(@Valid InvoiceDetailsPageReqVO pageReqVO) {
|
||||
|
||||
return success(invoiceService.getInvoiceDetails(pageReqVO));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/records")
|
||||
@Operation(summary = "获取组织的开票记录")
|
||||
public CommonResult<PageResult<InvoiceRecordsRespVO>> getInvoiceRecords(@Valid InvoiceDetailsPageReqVO pageReqVO) {
|
||||
|
||||
return success(invoiceService.getInvoiceRecords(pageReqVO));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/invoice")
|
||||
@Parameter(name = "invoiceId", description = "发票ID", required = true)
|
||||
@Operation(summary = "获取发票对应的购买记录和抬头信息")
|
||||
public CommonResult<InvoiceDetailsRespVO> getInvoiceIncome(@Valid @RequestParam("invoiceId") Long invoiceId) {
|
||||
|
||||
return success(invoiceService.getInvoiceIncome(invoiceId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("")
|
||||
@Operation(summary = "组织新增开票记录")
|
||||
public CommonResult<Boolean> insetInvoiceRecords(@Valid @RequestBody InvoiceRecordsReqVO reqVO) {
|
||||
|
||||
invoiceService.insetInvoiceRecords(reqVO);
|
||||
|
||||
return success(Boolean.TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PutMapping("")
|
||||
@Operation(summary = "同意/拒绝开票")
|
||||
public CommonResult<Boolean> invoicing(@Valid @RequestBody InvoiceInvoicingReqVO reqVO) {
|
||||
|
||||
invoiceService.invoicing(reqVO);
|
||||
|
||||
return success(Boolean.TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/upload")
|
||||
@Operation(summary = "发票上传")
|
||||
@Parameter(name = "invoiceId", description = "发票ID", required = true)
|
||||
@OperateLog(type = IMPORT)
|
||||
public CommonResult<Boolean> uploadInvoice(@RequestParam("file") MultipartFile file,@RequestParam("invoiceId") Long invoiceId) {
|
||||
|
||||
invoiceService.uploadInvoice(file,invoiceId);
|
||||
|
||||
return success(Boolean.TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/download")
|
||||
@Operation(summary = "发票文件下载")
|
||||
@Parameter(name = "invoiceId", description = "发票ID", required = true)
|
||||
public void downloadInvoice(@RequestParam("invoiceId") Long invoiceId, HttpServletResponse response) {
|
||||
|
||||
invoiceService.downloadInvoice(invoiceId,response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class InvoiceAmountRespVO {
|
||||
|
||||
|
||||
@Schema(description = "可开票")
|
||||
private BigDecimal invocable;
|
||||
|
||||
|
||||
@Schema(description = "开票中")
|
||||
private BigDecimal inTheInvoice;
|
||||
|
||||
|
||||
@Schema(description = "已开票")
|
||||
private BigDecimal invoiced;
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice.vo;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 组织可开票的数据明细 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder
|
||||
public class InvoiceDetailsPageReqVO extends PageParam {
|
||||
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
@Schema(description = "发票号")
|
||||
private String invoiceNo;
|
||||
|
||||
|
||||
@Schema(description = "发票状态,1待开票 2已开票 3开票失败")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@Schema(description = "申请人")
|
||||
private String creator;
|
||||
|
||||
|
||||
@Schema(description = "开票人")
|
||||
private String invoicePerson;
|
||||
|
||||
|
||||
@Schema(description = "发票金额")
|
||||
private BigDecimal[] invoiceAmount;
|
||||
|
||||
|
||||
@Schema(description = "开票时间", example = "[2022-07-01 01:01:01 ,2022-07-01 01:01:01]")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] invoiceTime;
|
||||
|
||||
|
||||
@Schema(description = "交易时间", example = "[2022-07-01 01:01:01 ,2022-07-01 01:01:01]")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
|
||||
@Schema(description = "交易金额")
|
||||
private BigDecimal[] amount;
|
||||
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InvoiceDetailsRespVO {
|
||||
|
||||
|
||||
@Schema(description = "发票对应的购买记录")
|
||||
private List<InvoicePurchaseRecord> invoicePurchaseRecords;
|
||||
|
||||
|
||||
@Schema(description = "发票抬头信息")
|
||||
private InvoiceTitleInfo invoiceTitleInfo;
|
||||
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Getter
|
||||
@Data
|
||||
public class InvoiceFilePath {
|
||||
|
||||
@Value("${invoice.filepath}")
|
||||
private String filePath;
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InvoiceInvoicingReqVO {
|
||||
|
||||
|
||||
@Schema(description = "发票抬头ID")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "是否开票")
|
||||
private Boolean isInvoicing;
|
||||
|
||||
|
||||
@Schema(description = "发票号")
|
||||
private String invoiceNo;
|
||||
|
||||
|
||||
@Schema(description = "发票附件")
|
||||
private String invoiceAttachmentPath;
|
||||
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
public class InvoicePurchaseRecord {
|
||||
|
||||
|
||||
@Schema(description = "流水号")
|
||||
private Long businessNo;
|
||||
|
||||
|
||||
@Schema(description = "购买记录ID")
|
||||
private Long purchaseRecordId;
|
||||
|
||||
|
||||
@Schema(description = "产品名称")
|
||||
private String productName;
|
||||
|
||||
|
||||
@Schema(description = "交易类型")
|
||||
private Integer tradeType;
|
||||
|
||||
|
||||
@Schema(description = "可开票金额")
|
||||
private BigDecimal rechargeAmount;
|
||||
|
||||
|
||||
@Schema(description = "交易时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class InvoiceRecordsReqVO {
|
||||
|
||||
|
||||
@Schema(description = "购买记录ID")
|
||||
private List<Long> purchaseRecordId;
|
||||
|
||||
|
||||
@Schema(description = "发票金额")
|
||||
private BigDecimal invoiceAmount;
|
||||
|
||||
|
||||
@Schema(description = "发票抬头ID")
|
||||
private Long invoiceTitleId;
|
||||
|
||||
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class InvoiceRecordsRespVO {
|
||||
|
||||
|
||||
@Schema(description = "发票ID")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
@Schema(description = "组织名称")
|
||||
private String organName;
|
||||
|
||||
|
||||
@Schema(description = "发票申请人ID")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Schema(description = "发票申请人名称")
|
||||
private String creator;
|
||||
|
||||
|
||||
@Schema(description = "发票号")
|
||||
private String invoiceNo;
|
||||
|
||||
|
||||
@Schema(description = "发票金额")
|
||||
private BigDecimal invoiceAmount;
|
||||
|
||||
|
||||
@Schema(description = "发票状态,1待开票 2已开票 3开票失败")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@Schema(description = "发票附件保存路径")
|
||||
private String invoiceAttachmentPath;
|
||||
|
||||
|
||||
@Schema(description = "开票人")
|
||||
private String invoicePerson;
|
||||
|
||||
|
||||
@Schema(description = "开票人用户ID")
|
||||
private Long invoicePersonId;
|
||||
|
||||
|
||||
@Schema(description = "开票时间")
|
||||
private LocalDateTime invoiceTime;
|
||||
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.invoice.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InvoiceTitleInfo {
|
||||
|
||||
|
||||
@Schema(description = "发票抬头ID")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
@Schema(description = "发票抬头")
|
||||
private String invoiceTitle;
|
||||
|
||||
|
||||
@Schema(description = "开具类型,0企业 1个人")
|
||||
private Integer issueType;
|
||||
|
||||
|
||||
@Schema(description = "发票类型,0增值税普通发票 1增值税专用发票")
|
||||
private Integer invoiceType;
|
||||
|
||||
|
||||
@Schema(description = "纳税人识别号")
|
||||
private String taxpayerId;
|
||||
|
||||
|
||||
@Schema(description = "开户银行名称")
|
||||
private String bankName;
|
||||
|
||||
|
||||
@Schema(description = "开户银行账号")
|
||||
private String bankAccount;
|
||||
|
||||
|
||||
@Schema(description = "注册场所地址")
|
||||
private String registeredAddress;
|
||||
|
||||
|
||||
@Schema(description = "注册固定电话")
|
||||
private String fixedPhone;
|
||||
|
||||
|
||||
@Schema(description = "邮箱")
|
||||
private String email;
|
||||
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.purchase;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.purchase.vo.PurchaseRecordPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.purchase.vo.PurchaseRecordRespVO;
|
||||
import com.cf.imes.module.executor.service.funds.purchase.PurchaseService;
|
||||
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;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
/**
|
||||
* @author 软件购买
|
||||
*/
|
||||
@Tag(name = "管理后台 - 软件购买")
|
||||
@RestController
|
||||
@RequestMapping("/executor/purchase")
|
||||
@Validated
|
||||
public class PurchaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
private PurchaseService purchaseService;
|
||||
|
||||
|
||||
@GetMapping("")
|
||||
@Operation(summary = "获取软件的购买记录")
|
||||
public CommonResult<PageResult<PurchaseRecordRespVO>> getPurchaseRecord(@Valid PurchaseRecordPageReqVO pageReqVO) {
|
||||
|
||||
return success(purchaseService.getPurchaseRecord(pageReqVO));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "导出软件购买记录")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void billDetailsExport(@Valid PurchaseRecordPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PurchaseRecordRespVO> list = purchaseService.getPurchaseRecord(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "软件购买记录表.xls", "数据", PurchaseRecordRespVO.class, list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.purchase.vo;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 组织购买记录明细 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder
|
||||
public class PurchaseRecordPageReqVO extends PageParam {
|
||||
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
@Schema(description = "产品名称")
|
||||
private String productName;
|
||||
|
||||
|
||||
@Schema(description = "购买月数")
|
||||
private Integer purchaseMonths;
|
||||
|
||||
|
||||
@Schema(description = "购买时间", example = "[2022-07-01 01:01:01 ,2022-07-01 01:01:01]")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
|
||||
@Schema(description = "操作人")
|
||||
private String creator;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
package com.cf.imes.module.executor.controller.admin.funds.purchase.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
public class PurchaseRecordRespVO {
|
||||
|
||||
|
||||
@Schema(description = "购买记录ID")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
@Schema(description = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
|
||||
@Schema(description = "产品明细ID")
|
||||
private Long productDetailsId;
|
||||
|
||||
|
||||
@Schema(description = "产品名称")
|
||||
private String productName;
|
||||
|
||||
|
||||
@Schema(description = "购买月数")
|
||||
private Integer purchaseMonths;
|
||||
|
||||
|
||||
@Schema(description = "赠送月数")
|
||||
private Integer giftMonths;
|
||||
|
||||
|
||||
@Schema(description = "支付方式")
|
||||
private Integer paymentMethod;
|
||||
|
||||
|
||||
@Schema(description = "订单总额")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
|
||||
@Schema(description = "现金余额支出")
|
||||
private BigDecimal accountBalanceSpent;
|
||||
|
||||
|
||||
@Schema(description = "支付宝支出")
|
||||
private BigDecimal alipaySpent;
|
||||
|
||||
|
||||
@Schema(description = "微信支出")
|
||||
private BigDecimal wechatSpent;
|
||||
|
||||
|
||||
@Schema(description = "赠送金")
|
||||
private BigDecimal giftMoneySpent;
|
||||
|
||||
|
||||
@Schema(description = "货币类型")
|
||||
private Integer currency;
|
||||
|
||||
|
||||
@Schema(description = "货币单位")
|
||||
private String currencyUnit;
|
||||
|
||||
|
||||
@Schema(description = "是否开票")
|
||||
private Integer isInvocing;
|
||||
|
||||
|
||||
@Schema(description = "购买时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@Schema(description = "操作人")
|
||||
private String creator;
|
||||
|
||||
|
||||
}
|
||||
+5
-10
@@ -59,6 +59,7 @@ import static com.cf.imes.framework.common.pojo.CommonResult.error;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.IMPORT;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -114,10 +115,6 @@ public class OrderController {
|
||||
|
||||
private String errKey = "生产数据导入异常,{}";
|
||||
|
||||
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
// public static final String ORDER_PLATE_MODEL_COMPRESS = "imes_order_plate_model_compress";
|
||||
public static final String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
|
||||
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@@ -254,9 +251,8 @@ public class OrderController {
|
||||
// 进行判断,为空,写入时出现了错误,数据库数据回滚,此时删除 ES 里的数据
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
if (orderDO == null) {
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL);
|
||||
// orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL_COMPRESS);
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PARTS_REMARK_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL.getIndex());
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PARTS_REMARK_MODEL.getIndex());
|
||||
}
|
||||
|
||||
Throwable cause = e.getCause();
|
||||
@@ -406,9 +402,8 @@ public class OrderController {
|
||||
// 进行判断,为空,写入时出现了错误,数据库数据回滚,此时删除 ES 里的数据
|
||||
if (ObjectUtil.isNotNull(orderDO) && ObjectUtil.isNotNull(orderMapper.selectById(orderDO.getId()))) {
|
||||
Long deleteOrderId = orderDO.getId();
|
||||
orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PLATE_MODEL);
|
||||
// orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PLATE_MODEL_COMPRESS);
|
||||
orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PARTS_REMARK_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PLATE_MODEL.getIndex());
|
||||
orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PARTS_REMARK_MODEL.getIndex());
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
||||
-26
@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -53,31 +52,6 @@ public class OptimizePlanController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("commit")
|
||||
@Operation(summary = "开始开料")
|
||||
@Parameter(name = "planId", description = "排单ID", required = true)
|
||||
@Parameter(name = "goodsNo", description = "开料的大板编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:optimize')")
|
||||
public CommonResult<Boolean> commit(@RequestParam("planId") @NotNull(message = "排单ID不能为空") Long planId,
|
||||
@RequestParam("goodsId") @NotNull(message = "实际开料的大板ID不能为空") String goodsId,
|
||||
@RequestParam("planConfigId") @NotNull(message = "方案组的配置项ID") Long planConfigId,
|
||||
@RequestParam("goodsNo") @NotEmpty(message = "排单异常,请重新优化或重新进入排单") List<Long> goodsNo) {
|
||||
|
||||
return CommonResult.success(optimizePlanService.commit(planId,goodsId,planConfigId,goodsNo));
|
||||
}
|
||||
|
||||
@GetMapping("/endCutting")
|
||||
@Operation(summary = "结束开料")
|
||||
@Parameter(name = "planId", description = "排单ID", required = true)
|
||||
@Parameter(name = "planConfigId", description = "方案组的配置项ID", required = true)
|
||||
@Parameter(name = "goodsNo", description = "开料的大板编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:optimize')")
|
||||
public CommonResult<Boolean> endCutting(@RequestParam("planId") @NotNull(message = "排单ID不能为空") Long planId,
|
||||
@RequestParam("goodsId") @NotNull(message = "实际开料的大板ID不能为空") String goodsId,
|
||||
@RequestParam("planConfigId") @NotNull(message = "方案组的配置项ID不能为空") Long planConfigId,
|
||||
@RequestParam("goodsNo") @NotEmpty(message = "排单异常,请重新优化或重新进入排单") List<Long> goodsNo) {
|
||||
return success(optimizePlanService.endCutting(planId,goodsId,goodsNo,planConfigId));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/updateCuttingStatus")
|
||||
|
||||
+5
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.OrderPlateIds;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.PlanActualGoodsModelDO;
|
||||
import com.cf.imes.module.executor.validation.plan.PlanStatusValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -39,6 +40,10 @@ public class PlanSaveReqVO {
|
||||
private List<OrderPlateIds> insertOrderPlateIds;
|
||||
|
||||
|
||||
@Schema(description = "添加小板时选择的实际的大板信息")
|
||||
private PlanActualGoodsModelDO planActualGoodsModelDO;
|
||||
|
||||
|
||||
@Schema(description = "去除的小板ID")
|
||||
private List<OrderPlateIds> deleteOrderPlateIds;
|
||||
|
||||
|
||||
+4
@@ -21,6 +21,10 @@ public class SavePlanPlateList {
|
||||
private MixConfig mixConfig;
|
||||
|
||||
|
||||
@Schema(description = "排单ID")
|
||||
private Long planId;
|
||||
|
||||
|
||||
@Schema(description = "小板的信息列表",requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Valid
|
||||
private List<SavePlanPlateList.PlateItemList> plateItemList;
|
||||
|
||||
+10
@@ -30,12 +30,22 @@ public class NoPlanPlatePageReqVO extends PageParam {
|
||||
private Long planId;
|
||||
|
||||
|
||||
@Schema(description = "是否开启混单,true 开启 false 关闭")
|
||||
private Boolean isMixed;
|
||||
|
||||
|
||||
@Schema(description = "混单方式 1 相同材质和厚度 2 相同厚度")
|
||||
private Integer mixedType;
|
||||
|
||||
|
||||
@Schema(description = "板编号")
|
||||
private String plateNo;
|
||||
|
||||
|
||||
@Schema(description = "大板")
|
||||
private List<Long> goodsIdList;
|
||||
|
||||
|
||||
@Schema(description = "板号-小板ID")
|
||||
private String plateId;
|
||||
|
||||
|
||||
+3
@@ -27,4 +27,7 @@ public class OrderPlateIds {
|
||||
private Long planId;
|
||||
|
||||
|
||||
@Schema(description = "添加小板选择的混单方式 1 相同材质和厚度 2 相同厚度")
|
||||
private Integer mixedType;
|
||||
|
||||
}
|
||||
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.funds.balancedetails;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author 收支明细表
|
||||
*/
|
||||
@TableName("income_expense_details")
|
||||
@KeySequence("income_expense_details_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class IncomeExpenseDetailsDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
private String businessNo;
|
||||
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
private Long organId;
|
||||
|
||||
|
||||
/**
|
||||
* 充值-赠送金规则表
|
||||
*/
|
||||
private Long giftMoneyId;
|
||||
|
||||
|
||||
/**
|
||||
* 购买-购买记录id
|
||||
*/
|
||||
private Long purchaseId;
|
||||
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
|
||||
/**
|
||||
* 交易类型
|
||||
*/
|
||||
private Integer tradeType;
|
||||
|
||||
|
||||
/**
|
||||
* 收支类型
|
||||
*/
|
||||
private Integer incomeExpenseType;
|
||||
|
||||
|
||||
/**
|
||||
* 支出/入账现金金额
|
||||
*/
|
||||
private BigDecimal cashAmountChange;
|
||||
|
||||
|
||||
/**
|
||||
* 支出/入账赠送金金额
|
||||
*/
|
||||
private BigDecimal bonusAmountChange;
|
||||
|
||||
|
||||
/**
|
||||
* 可用余额
|
||||
*/
|
||||
private BigDecimal availableAmount;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 现金金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
/**
|
||||
* 赠送金额
|
||||
*/
|
||||
private BigDecimal giftAmount;
|
||||
|
||||
|
||||
/**
|
||||
* 货币类型
|
||||
*/
|
||||
private Integer currency;
|
||||
|
||||
|
||||
/**
|
||||
* 货币单位
|
||||
*/
|
||||
private String currencyUnit;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.funds.invoice;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author 开票记录表
|
||||
*/
|
||||
@TableName("invoice_records")
|
||||
@KeySequence("invoice_records_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InvoiceRecordsDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
private Long organId;
|
||||
|
||||
|
||||
/**
|
||||
* 组织/发票抬头名称
|
||||
*/
|
||||
private String organName;
|
||||
|
||||
|
||||
/**
|
||||
* 用户ID-发票申请人ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
|
||||
/**
|
||||
* 发票号
|
||||
*/
|
||||
private String invoiceNo;
|
||||
|
||||
|
||||
/**
|
||||
* 购买记录单号
|
||||
*/
|
||||
private String purchaseIds;
|
||||
|
||||
|
||||
/**
|
||||
* 发票金额
|
||||
*/
|
||||
private BigDecimal invoiceAmount;
|
||||
|
||||
|
||||
/**
|
||||
* 发票状态,1待开票 2已开票 3开票失败
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
/**
|
||||
* 发票附件保存路径
|
||||
*/
|
||||
private String invoiceAttachmentPath;
|
||||
|
||||
|
||||
/**
|
||||
* 开票人
|
||||
*/
|
||||
private String invoicePerson;
|
||||
|
||||
|
||||
/**
|
||||
* 开票人用户ID
|
||||
*/
|
||||
private Long invoicePersonId;
|
||||
|
||||
|
||||
/**
|
||||
* 开票时间
|
||||
*/
|
||||
private LocalDateTime invoiceTime;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 抬头ID
|
||||
*/
|
||||
private Long invoiceTitleId;
|
||||
|
||||
|
||||
/**
|
||||
* 抬头
|
||||
*/
|
||||
private String invoiceTitleInfo;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.funds.purchase;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @author 购买记录表
|
||||
*/
|
||||
@TableName("purchase_record")
|
||||
@KeySequence("purchase_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PurchaseRecordDO extends BaseDO {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
private Long organId;
|
||||
|
||||
|
||||
/**
|
||||
* 用户ID-发票申请人ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
private Long userName;
|
||||
|
||||
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
|
||||
/**
|
||||
* 产品明细ID
|
||||
*/
|
||||
private Long productDetailsId;
|
||||
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
|
||||
/**
|
||||
* 购买月数
|
||||
*/
|
||||
private Integer purchaseMonths;
|
||||
|
||||
|
||||
/**
|
||||
* 赠送月数
|
||||
*/
|
||||
private Integer giftMonths;
|
||||
|
||||
|
||||
/**
|
||||
* 产品开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
|
||||
/**
|
||||
* 产品结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
private Integer paymentMethod;
|
||||
|
||||
|
||||
/**
|
||||
* 订单总额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
|
||||
/**
|
||||
* 现金余额支出
|
||||
*/
|
||||
private BigDecimal accountBalanceSpent;
|
||||
|
||||
|
||||
/**
|
||||
* 支付宝支出
|
||||
*/
|
||||
private BigDecimal alipaySpent;
|
||||
|
||||
|
||||
/**
|
||||
* 微信支出
|
||||
*/
|
||||
private BigDecimal wechatSpent;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 赠送金
|
||||
*/
|
||||
private BigDecimal giftMoneySpent;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 货币类型
|
||||
*/
|
||||
private Integer currency;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 货币单位
|
||||
*/
|
||||
private String currencyUnit;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 是否开票
|
||||
*/
|
||||
private Integer isInvocing;
|
||||
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.funds.balancedetails;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.invoice.vo.InvoiceDetailsRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.funds.balancedetails.IncomeExpenseDetailsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface IncomeExpenseDetailsMapper extends BaseMapperX<IncomeExpenseDetailsDO> {
|
||||
|
||||
|
||||
|
||||
default PageResult<IncomeExpenseDetailsDO> selectDetailsPage(BalanceDetailsPageReqVO pageReqVO,List<Long> organIds) {
|
||||
return selectPage(pageReqVO, new LambdaQueryWrapperX<IncomeExpenseDetailsDO>()
|
||||
.eqIfPresent(IncomeExpenseDetailsDO::getOrganId, pageReqVO.getOrganId())
|
||||
.inIfPresent(IncomeExpenseDetailsDO::getOrganId,organIds)
|
||||
.eq(IncomeExpenseDetailsDO::getDeleted, false)
|
||||
.likeIfPresent(IncomeExpenseDetailsDO::getId,pageReqVO.getId() == null ? "" : String.valueOf(pageReqVO.getId()))
|
||||
.eqIfPresent(IncomeExpenseDetailsDO::getTradeType,pageReqVO.getTradeType())
|
||||
.eqIfPresent(IncomeExpenseDetailsDO::getIncomeExpenseType,pageReqVO.getIncomeExpenseType())
|
||||
.betweenIfPresent(IncomeExpenseDetailsDO::getCreateTime,pageReqVO.getCreateTime()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
IPage<InvoiceDetailsRespVO> selectOrganInvoicable(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<IncomeExpenseDetailsDO> wrapper);
|
||||
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.funds.invoice;
|
||||
|
||||
|
||||
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.module.executor.controller.admin.funds.invoice.vo.InvoiceDetailsPageReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.funds.invoice.InvoiceRecordsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface InvoiceRecordsMapper extends BaseMapperX<InvoiceRecordsDO> {
|
||||
|
||||
|
||||
default PageResult<InvoiceRecordsDO> selectInvoiceRecordsPage(InvoiceDetailsPageReqVO pageReqVO) {
|
||||
return selectPage(pageReqVO, new LambdaQueryWrapperX<InvoiceRecordsDO>()
|
||||
.eq(InvoiceRecordsDO::getDeleted,false)
|
||||
.eqIfPresent(InvoiceRecordsDO::getOrganId,pageReqVO.getOrganId())
|
||||
.likeIfPresent(InvoiceRecordsDO::getInvoiceNo,pageReqVO.getInvoiceNo())
|
||||
.eqIfPresent(InvoiceRecordsDO::getStatus,pageReqVO.getStatus())
|
||||
.likeIfPresent(InvoiceRecordsDO::getCreator,pageReqVO.getCreator())
|
||||
.likeIfPresent(InvoiceRecordsDO::getInvoicePerson,pageReqVO.getInvoicePerson())
|
||||
.betweenIfPresent(InvoiceRecordsDO::getInvoiceAmount,pageReqVO.getInvoiceAmount())
|
||||
.betweenIfPresent(InvoiceRecordsDO::getCreateTime,pageReqVO.getCreateTime())
|
||||
.betweenIfPresent(InvoiceRecordsDO::getInvoiceTime,pageReqVO.getInvoiceTime()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
BigDecimal selectToExamineAmount(@Param("status") Integer status);
|
||||
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.funds.purchase;
|
||||
|
||||
|
||||
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.module.executor.controller.admin.funds.invoice.vo.InvoiceAmountRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.invoice.vo.InvoicePurchaseRecord;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.purchase.vo.PurchaseRecordPageReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.funds.purchase.PurchaseRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PurchaseRecordMapper extends BaseMapperX<PurchaseRecordDO> {
|
||||
|
||||
|
||||
InvoiceAmountRespVO selectOrganInvoice(@Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
default PageResult<PurchaseRecordDO> selectPage(PurchaseRecordPageReqVO pageReqVO) {
|
||||
return selectPage(pageReqVO, new LambdaQueryWrapperX<PurchaseRecordDO>()
|
||||
.eq(PurchaseRecordDO::getDeleted,false)
|
||||
.eqIfPresent(PurchaseRecordDO::getOrganId,pageReqVO.getOrganId())
|
||||
.likeIfPresent(PurchaseRecordDO::getProductName,pageReqVO.getProductName())
|
||||
.eqIfPresent(PurchaseRecordDO::getPurchaseMonths,pageReqVO.getPurchaseMonths())
|
||||
.betweenIfPresent(PurchaseRecordDO::getCreateTime,pageReqVO.getCreateTime())
|
||||
.likeIfPresent(PurchaseRecordDO::getCreator,pageReqVO.getCreator()));
|
||||
|
||||
}
|
||||
|
||||
List<InvoicePurchaseRecord> selectPurchaseRecord(@Param("purchaseIdList") List<Long> purchaseIdList, @Param("organId") Long organId);
|
||||
|
||||
}
|
||||
-43
@@ -31,49 +31,6 @@ public interface PlanMapper extends BaseMapperX<PlanDO> {
|
||||
IPage<PlanDO> selectPlanPageList(@Param("page") IPage page,@Param(Constants.WRAPPER) Wrapper<PlanDO> wrapper);
|
||||
|
||||
|
||||
// default PageResult<PlanDO> selectPage(PlanPageReqVO reqVO) {
|
||||
// if(StringUtils.isNotBlank(reqVO.getCustomer())) {
|
||||
// return selectJoinPage(reqVO, PlanDO.class, new MPJLambdaWrapperX<PlanDO>()
|
||||
// .eq(PlanDO::getDeleted,false)
|
||||
// .eq(PlanDO::getOrganId,getUserOrganId())
|
||||
// .eqIfPresent(PlanDO::getIsScheduled,reqVO.getIsScheduled())
|
||||
// .eqIfPresent(PlanDO::getId, reqVO.getId())
|
||||
// .eqIfPresent(PlanDO::getSort, reqVO.getSort())
|
||||
// .eqIfPresent(PlanDO::getType, reqVO.getType())
|
||||
// .inIfPresent(PlanDO::getStatus, reqVO.getStatus())
|
||||
// .eqIfPresent(PlanDO::getMachineId, reqVO.getMachineId())
|
||||
// .betweenIfPresent(PlanDO::getPlanTime, reqVO.getPlanTime())
|
||||
// .likeIfPresent(PlanDO::getOrderNos, reqVO.getOrderNos())
|
||||
// .eqIfPresent(PlanDO::getRemark, reqVO.getRemark())
|
||||
// .betweenIfPresent(PlanDO::getCreateTime, reqVO.getCreateTime())
|
||||
// .eqIfPresent(PlanDO::getOperator, reqVO.getOperator())
|
||||
// .betweenIfPresent(PlanDO::getProduceTime, reqVO.getProduceTime())
|
||||
// .leftJoin(PlanItemDO.class, PlanItemDO::getPlanId, PlanDO::getId)
|
||||
// .leftJoin(OrderDO.class, OrderDO::getId, PlanItemDO::getOrderId)
|
||||
// .like(OrderDO::getCustomer, reqVO.getCustomer())
|
||||
// .orderByDesc(PlanDO::getCreateTime)
|
||||
// .distinct()
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// return selectPage(reqVO, new LambdaQueryWrapperX<PlanDO>()
|
||||
// .eq(PlanDO::getDeleted,false)
|
||||
// .eq(PlanDO::getOrganId,getUserOrganId())
|
||||
// .eqIfPresent(PlanDO::getIsScheduled,reqVO.getIsScheduled())
|
||||
// .eqIfPresent(PlanDO::getId, reqVO.getId())
|
||||
// .eqIfPresent(PlanDO::getSort, reqVO.getSort())
|
||||
// .eqIfPresent(PlanDO::getType, reqVO.getType())
|
||||
// .inIfPresent(PlanDO::getStatus, reqVO.getStatus())
|
||||
// .eqIfPresent(PlanDO::getMachineId, reqVO.getMachineId())
|
||||
// .betweenIfPresent(PlanDO::getPlanTime, reqVO.getPlanTime())
|
||||
// .likeIfPresent(PlanDO::getOrderNos, reqVO.getOrderNos())
|
||||
// .eqIfPresent(PlanDO::getRemark, reqVO.getRemark())
|
||||
// .betweenIfPresent(PlanDO::getCreateTime, reqVO.getCreateTime())
|
||||
// .eqIfPresent(PlanDO::getOperator, reqVO.getOperator())
|
||||
// .betweenIfPresent(PlanDO::getProduceTime, reqVO.getProduceTime())
|
||||
// .orderByDesc(PlanDO::getCreateTime));
|
||||
// }
|
||||
|
||||
List<PlateOptimize> selectPlateListByPlanId(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
+2
@@ -99,4 +99,6 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
|
||||
List<LabelOrderPlateData> selectLabelOrderPlateDataByPlanId(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
|
||||
|
||||
List<SavePlanPlateList.GoodsItemList> selectPlanGoodsList(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
|
||||
}
|
||||
+4
-9
@@ -25,6 +25,7 @@ import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
@@ -127,16 +128,10 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
void deletedById(@Param("plateIds") List<Long> plateIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
default List<PlateDO> selectPlateNum(List<Long> orderId, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
.eq(PlateDO::getDeleted,false)
|
||||
.in(PlateDO::getOrderId, orderId)
|
||||
.select(PlateDO::getId));
|
||||
@Select("select count(id) from order_plate where organ_id = #{organId} and deleted = false and order_id = #{orderId}")
|
||||
Integer selectPlateNum(@Param("orderId") Long orderId,@Param("organId") Long organId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
default List<PlateDO> selectPlateDeletedStatus(Long orderId,List<Long> goodsIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
@@ -179,7 +174,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
|
||||
|
||||
List<PlateDetailRespVO> selectPlateListByGoodsIds(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
List<PlateDetailRespVO> selectPlateListByGoodsIds(@Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
|
||||
List<PlateDetailRespVO> selectNoPlanPlate(@Param("orderIds") List<Long> orderIds, @Param("ids") List<Long> ids, @Param("organId") Long organId);
|
||||
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.cf.imes.module.executor.enums.amount;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 交易类型枚举类
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum IncomeExpenseTypeEnum {
|
||||
|
||||
/**
|
||||
* 收入
|
||||
*/
|
||||
INCOME(0, "收入"),
|
||||
/**
|
||||
* 支出
|
||||
*/
|
||||
EXPENSES(1, "支出");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
|
||||
|
||||
public static IncomeExpenseTypeEnum fromType(Integer type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
for (IncomeExpenseTypeEnum value : values()) {
|
||||
if (ObjectUtil.equal(value.getType(), type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.cf.imes.module.executor.enums.amount;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 发票状态枚举类型
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InvoiceStatusEnum {
|
||||
|
||||
|
||||
/**
|
||||
* 可开票
|
||||
*/
|
||||
INVOICABLE(0, "可开票"),
|
||||
/**
|
||||
* 待开票
|
||||
*/
|
||||
PENDINGINVOICING(1, "待开票"),
|
||||
/**
|
||||
* 已开票
|
||||
*/
|
||||
INVOICINGSUCCESSFUL(2,"已开票"),
|
||||
/**
|
||||
* 开票失败
|
||||
*/
|
||||
INVOICINGFAILED(3,"开票失败");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private final Integer status;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
|
||||
|
||||
public static InvoiceStatusEnum fromType(Integer status) {
|
||||
if (status == null) {
|
||||
return null;
|
||||
}
|
||||
for (InvoiceStatusEnum value : values()) {
|
||||
if (ObjectUtil.equal(value.getStatus(), status)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.cf.imes.module.executor.enums.amount;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 发票类型枚举类
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InvoiceTypeEnum {
|
||||
|
||||
/**
|
||||
* 增值税普通发票
|
||||
*/
|
||||
INCOME(0, "增值税普通发票"),
|
||||
/**
|
||||
* 增值税专用发票
|
||||
*/
|
||||
EXPENSES(1, "增值税专用发票");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.cf.imes.module.executor.enums.amount;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 发票开具类型枚举类
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum IssueTypeEnum {
|
||||
|
||||
/**
|
||||
* 企业
|
||||
*/
|
||||
INCOME(0, "企业"),
|
||||
/**
|
||||
* 个人
|
||||
*/
|
||||
EXPENSES(1, "个人");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.cf.imes.module.executor.enums.amount;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 交易类型枚举类
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TradeTypeEnum {
|
||||
|
||||
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
INCOME(0, "充值"),
|
||||
/**
|
||||
* 软件购买
|
||||
*/
|
||||
EXPENSES(1, "软件购买");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
|
||||
|
||||
public static TradeTypeEnum fromType(Integer type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
for (TradeTypeEnum value : values()) {
|
||||
if (ObjectUtil.equal(value.getType(), type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -5,6 +5,7 @@ import com.cf.imes.module.system.api.application.ApplicationApi;
|
||||
import com.cf.imes.module.system.api.customplateno.CustomPlateNoSeqApi;
|
||||
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
||||
import com.cf.imes.module.system.api.dict.DictDataApi;
|
||||
import com.cf.imes.module.system.api.funds.SystemFundsApi;
|
||||
import com.cf.imes.module.system.api.machine.MachineApi;
|
||||
import com.cf.imes.module.system.api.organ.OrganApi;
|
||||
import com.cf.imes.module.system.api.permission.PermissionApi;
|
||||
@@ -22,6 +23,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {AdminUserApi.class, MachineApi.class, DictDataApi.class,
|
||||
FileApi.class, ProcessGroupApi.class, FileApi.class, DataSourceApi.class, ApplicationApi.class,
|
||||
ProcessApi.class, OrganApi.class, SystemConfigApi.class, CustomPlateNoSeqApi.class, PermissionApi.class, SettingApi.class})
|
||||
ProcessApi.class, OrganApi.class, SystemConfigApi.class, CustomPlateNoSeqApi.class, PermissionApi.class, SettingApi.class, SystemFundsApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.cf.imes.module.executor.service.funds.balancedetails;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsRespVO;
|
||||
|
||||
/**
|
||||
* @author 组织余额明细接口
|
||||
*/
|
||||
public interface BalanceDetailsService {
|
||||
|
||||
|
||||
PageResult<BalanceDetailsRespVO> getBalanceDetailsPage(BalanceDetailsPageReqVO pageReqVO);
|
||||
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.cf.imes.module.executor.service.funds.balancedetails;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.funds.balancedetails.IncomeExpenseDetailsDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.funds.balancedetails.IncomeExpenseDetailsMapper;
|
||||
import com.cf.imes.module.executor.enums.amount.IncomeExpenseTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 组织余额明细接口 实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BalanceDetailsServiceImpl implements BalanceDetailsService{
|
||||
|
||||
|
||||
@Resource
|
||||
private IncomeExpenseDetailsMapper incomeExpenseDetailsMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PageResult<BalanceDetailsRespVO> getBalanceDetailsPage(BalanceDetailsPageReqVO pageReqVO) {
|
||||
|
||||
PageResult<IncomeExpenseDetailsDO> pageResult = incomeExpenseDetailsMapper.selectDetailsPage(pageReqVO,null);
|
||||
|
||||
if(CollUtil.isNotEmpty(pageResult.getList())){
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
PageResult<BalanceDetailsRespVO> result = BeanUtils.toBean(pageResult, BalanceDetailsRespVO.class);
|
||||
|
||||
|
||||
result.getList().forEach(f->{
|
||||
if(f.getIncomeExpenseType().equals(IncomeExpenseTypeEnum.INCOME.getType())){
|
||||
f.setEntryAmount(f.getCashAmountChange());
|
||||
f.setEntryGiftAmount(f.getBonusAmountChange());
|
||||
}else {
|
||||
f.setExpensesAmount(f.getCashAmountChange());
|
||||
f.setExpensesGiftAmount(f.getBonusAmountChange());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.cf.imes.module.executor.service.funds.bill;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.bill.vo.BillDetailsRespVO;
|
||||
|
||||
/**
|
||||
* @author 账单/总额明细 接口
|
||||
*/
|
||||
public interface BillService {
|
||||
|
||||
|
||||
PageResult<BillDetailsRespVO> getBillDetailsPage(BalanceDetailsPageReqVO pageReqVO);
|
||||
|
||||
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.cf.imes.module.executor.service.funds.bill;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.balancedetails.vo.BalanceDetailsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.bill.vo.BillDetailsRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.funds.balancedetails.IncomeExpenseDetailsDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.funds.balancedetails.IncomeExpenseDetailsMapper;
|
||||
import com.cf.imes.module.executor.enums.amount.IncomeExpenseTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.amount.TradeTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 账单/总额明细接口 实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BillServiceImpl implements BillService{
|
||||
|
||||
|
||||
@Resource
|
||||
private IncomeExpenseDetailsMapper incomeExpenseDetailsMapper;
|
||||
|
||||
@Override
|
||||
public PageResult<BillDetailsRespVO> getBillDetailsPage(BalanceDetailsPageReqVO pageReqVO) {
|
||||
|
||||
PageResult<IncomeExpenseDetailsDO> pageResult = incomeExpenseDetailsMapper.selectDetailsPage(pageReqVO,null);
|
||||
|
||||
if(CollUtil.isNotEmpty(pageResult.getList())){
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
PageResult<BillDetailsRespVO> result = BeanUtils.toBean(pageResult, BillDetailsRespVO.class);
|
||||
|
||||
result.getList().forEach(f->{
|
||||
// 收支类型
|
||||
f.setIncomeExpenseType(IncomeExpenseTypeEnum.EXPENSES.getType());
|
||||
// 支出账户余额
|
||||
f.setExpenditureAccountBalance(f.getAvailableAmount());
|
||||
if(f.getTradeType().equals(TradeTypeEnum.INCOME.getType())){
|
||||
// 充值金额
|
||||
f.setRechargeAmount(f.getCashAmountChange());
|
||||
// 支出现金
|
||||
f.setCashExpenditure(f.getCashAmountChange());
|
||||
// 实际支出总费用
|
||||
f.setActualTotalExpenditure(f.getCashAmountChange());
|
||||
|
||||
}else if(f.getTradeType().equals(TradeTypeEnum.EXPENSES.getType())){
|
||||
// 产品金额
|
||||
f.setProductAmount(f.getCashAmountChange().add(f.getBonusAmountChange()));
|
||||
// 支出现金
|
||||
f.setCashExpenditure(f.getCashAmountChange());
|
||||
// 实际支出总费用
|
||||
f.setActualTotalExpenditure(f.getCashAmountChange().add(f.getBonusAmountChange()));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.cf.imes.module.executor.service.funds.invoice;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.invoice.vo.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author 发票管理接口
|
||||
*/
|
||||
public interface InvoiceService {
|
||||
|
||||
|
||||
InvoiceAmountRespVO getInvoiceAmount(Long organId);
|
||||
|
||||
|
||||
PageResult<InvoiceDetailsRespVO> getInvoiceDetails(InvoiceDetailsPageReqVO pageReqVO);
|
||||
|
||||
|
||||
PageResult<InvoiceRecordsRespVO> getInvoiceRecords(InvoiceDetailsPageReqVO pageReqVO);
|
||||
|
||||
|
||||
void insetInvoiceRecords(InvoiceRecordsReqVO reqVO);
|
||||
|
||||
|
||||
InvoiceDetailsRespVO getInvoiceIncome(Long invoiceId);
|
||||
|
||||
|
||||
void invoicing(InvoiceInvoicingReqVO reqVO);
|
||||
|
||||
void uploadInvoice(MultipartFile file, Long invoiceId);
|
||||
|
||||
void downloadInvoice(Long invoiceId, HttpServletResponse response);
|
||||
|
||||
}
|
||||
+412
@@ -0,0 +1,412 @@
|
||||
package com.cf.imes.module.executor.service.funds.invoice;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.Header;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.QueryWrapperX;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.invoice.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.funds.balancedetails.IncomeExpenseDetailsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.funds.invoice.InvoiceRecordsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.funds.purchase.PurchaseRecordDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.funds.balancedetails.IncomeExpenseDetailsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.funds.invoice.InvoiceRecordsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.funds.purchase.PurchaseRecordMapper;
|
||||
import com.cf.imes.module.executor.enums.amount.InvoiceStatusEnum;
|
||||
import com.cf.imes.module.executor.enums.amount.TradeTypeEnum;
|
||||
import com.cf.imes.module.system.api.funds.SystemFundsApi;
|
||||
import com.cf.imes.module.system.api.funds.dto.InvoiceTitleInfoDTO;
|
||||
import com.cf.imes.module.system.api.organ.OrganApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.*;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* @author 发票管理接口 实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class InvoiceServiceImpl implements InvoiceService{
|
||||
|
||||
|
||||
@Resource
|
||||
private PurchaseRecordMapper purchaseRecordMapper;
|
||||
|
||||
@Resource
|
||||
private IncomeExpenseDetailsMapper incomeExpenseDetailsMapper;
|
||||
|
||||
@Resource
|
||||
private InvoiceRecordsMapper invoiceRecordsMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private SystemFundsApi systemFundsApi;
|
||||
|
||||
@Resource
|
||||
private OrganApi organApi;
|
||||
|
||||
|
||||
@Resource
|
||||
private InvoiceFilePath invoiceFilePath;
|
||||
|
||||
|
||||
|
||||
private static final String UTF8_CHARSET = CharsetUtil.UTF_8;
|
||||
private static final String ATTACHMENT_PREFIX = "attachment; filename=";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public InvoiceAmountRespVO getInvoiceAmount(Long organId) {
|
||||
|
||||
InvoiceAmountRespVO invoiceAmountRespVO = purchaseRecordMapper.selectOrganInvoice(organId);
|
||||
|
||||
BigDecimal invoiceableAmount = systemFundsApi.getOrganAmount(organId).getCheckedData().getInvoiceableAmount();
|
||||
|
||||
return invoiceAmountRespVO.setInvocable(invoiceableAmount);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PageResult<InvoiceDetailsRespVO> getInvoiceDetails(InvoiceDetailsPageReqVO pageReqVO) {
|
||||
|
||||
PageDTO<InvoiceDetailsRespVO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
|
||||
List<Integer> invoiceStatus = new ArrayList<>();
|
||||
invoiceStatus.add(InvoiceStatusEnum.INVOICABLE.getStatus());
|
||||
invoiceStatus.add(InvoiceStatusEnum.INVOICINGFAILED.getStatus());
|
||||
|
||||
QueryWrapperX<IncomeExpenseDetailsDO> queryWrapperX = new QueryWrapperX<>();
|
||||
|
||||
pageReqVO.setCreateTime(LocalDateTimeUtils.generateTimeSection(pageReqVO.getCreateTime()));
|
||||
queryWrapperX
|
||||
.eq("ied.organId",getUserOrganId())
|
||||
.eq("ied.deleted",false)
|
||||
.eq("ied.trade_type", TradeTypeEnum.EXPENSES.getType())
|
||||
.in("pr.is_invocing", invoiceStatus)
|
||||
.betweenIfPresent("ied.create_time",pageReqVO.getCreateTime())
|
||||
.betweenIfPresent("ied.cash_amount_change",pageReqVO.getAmount());
|
||||
|
||||
IPage<InvoiceDetailsRespVO> respVOIPage = incomeExpenseDetailsMapper.selectOrganInvoicable(page, queryWrapperX);
|
||||
|
||||
List<InvoiceDetailsRespVO> records = respVOIPage.getRecords();
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
return new PageResult<>(records, respVOIPage.getTotal());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PageResult<InvoiceRecordsRespVO> getInvoiceRecords(InvoiceDetailsPageReqVO pageReqVO) {
|
||||
|
||||
pageReqVO.setCreateTime(LocalDateTimeUtils.generateTimeSection(pageReqVO.getCreateTime()));
|
||||
pageReqVO.setInvoiceTime(LocalDateTimeUtils.generateTimeSection(pageReqVO.getInvoiceTime()));
|
||||
|
||||
PageResult<InvoiceRecordsDO> pageResult = invoiceRecordsMapper.selectInvoiceRecordsPage(pageReqVO);
|
||||
List<InvoiceRecordsDO> resultList = pageResult.getList();
|
||||
|
||||
if(CollUtil.isEmpty(resultList)){
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
List<InvoiceRecordsRespVO> recordsRespVOS = BeanUtils.toBean(resultList, InvoiceRecordsRespVO.class);
|
||||
|
||||
return new PageResult<>(recordsRespVOS, pageResult.getTotal());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void insetInvoiceRecords(InvoiceRecordsReqVO reqVO) {
|
||||
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
assert loginUser != null;
|
||||
|
||||
String organName = organApi.getOrganDetails(loginUser.getOrganId()).getCheckedData().getName();
|
||||
|
||||
InvoiceTitleInfoDTO titleInfoDTO = systemFundsApi.getInvoiceTitle(reqVO.getInvoiceTitleId()).getCheckedData();
|
||||
|
||||
invoiceRecordsMapper.insert(InvoiceRecordsDO.builder()
|
||||
.userId(loginUser.getId())
|
||||
.organName(organName)
|
||||
.purchaseIds(JsonUtils.toJsonString(reqVO.getPurchaseRecordId()))
|
||||
.invoiceAmount(reqVO.getInvoiceAmount())
|
||||
.invoiceTitleId(reqVO.getInvoiceTitleId())
|
||||
.invoiceTitleInfo(zipString(toJsonString(titleInfoDTO)))
|
||||
.status(InvoiceStatusEnum.PENDINGINVOICING.getStatus())
|
||||
.build());
|
||||
|
||||
|
||||
// 更新购买记录表的发票状态
|
||||
purchaseRecordMapper.update(new LambdaUpdateWrapper<PurchaseRecordDO>()
|
||||
.eq(PurchaseRecordDO::getOrganId, loginUser.getOrganId())
|
||||
.eq(PurchaseRecordDO::getDeleted,false)
|
||||
.in(PurchaseRecordDO::getId,reqVO.getPurchaseRecordId())
|
||||
.set(PurchaseRecordDO::getIsInvocing, InvoiceStatusEnum.PENDINGINVOICING.getStatus()));
|
||||
|
||||
|
||||
// 减少组织余额的可开票的金额
|
||||
systemFundsApi.reduceOrganAmount(loginUser.getOrganId(),reqVO.getInvoiceAmount());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public InvoiceDetailsRespVO getInvoiceIncome(Long invoiceId) {
|
||||
|
||||
InvoiceRecordsDO invoiceRecordsDO = invoiceRecordsMapper.selectById(invoiceId);
|
||||
|
||||
AssertUtils.notEmpty(invoiceRecordsDO,INVOICE_NO_EXIST);
|
||||
|
||||
String purchaseIds = Optional.ofNullable(invoiceRecordsDO.getPurchaseIds()).orElse("[]");
|
||||
|
||||
List<Long> purchaseIdList = JSON.parseArray(purchaseIds).toJavaList(Long.class).stream().distinct().toList();
|
||||
|
||||
List<InvoicePurchaseRecord> invoicePurchaseRecords = purchaseRecordMapper.selectPurchaseRecord(purchaseIdList, getUserOrganId());
|
||||
|
||||
InvoiceTitleInfo invoiceTitleInfo = parseObject(unzipString(invoiceRecordsDO.getInvoiceTitleInfo()), InvoiceTitleInfo.class);
|
||||
|
||||
return InvoiceDetailsRespVO.builder()
|
||||
.invoicePurchaseRecords(invoicePurchaseRecords)
|
||||
.invoiceTitleInfo(invoiceTitleInfo)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void invoicing(InvoiceInvoicingReqVO reqVO) {
|
||||
|
||||
InvoiceRecordsDO invoiceRecordsDO = validateInvoiceExists(reqVO.getId());
|
||||
|
||||
if(invoiceRecordsDO.getStatus().equals(InvoiceStatusEnum.INVOICINGFAILED.getStatus())){
|
||||
throw exception(THIS_INVOICE_IS_FAIL);
|
||||
}
|
||||
|
||||
|
||||
// if(invoiceRecordsDO.getStatus().equals(InvoiceStatusEnum.INVOICINGSUCCESSFUL.getStatus())){
|
||||
// throw exception(THIS_INVOICE_IS_SUCCESS);
|
||||
// }
|
||||
|
||||
|
||||
String purchaseIds = Optional.ofNullable(invoiceRecordsDO.getPurchaseIds()).orElse("[]");
|
||||
|
||||
List<Long> purchaseIdList = JSON.parseArray(purchaseIds).toJavaList(Long.class).stream().distinct().toList();
|
||||
|
||||
List<PurchaseRecordDO> purchaseRecordDOS = validatePurchaseRecordExists(purchaseIdList);
|
||||
|
||||
|
||||
if(Boolean.TRUE.equals(reqVO.getIsInvoicing())){
|
||||
|
||||
invoiceRecordsDO.setStatus(InvoiceStatusEnum.INVOICINGSUCCESSFUL.getStatus());
|
||||
invoiceRecordsDO.setRemark(reqVO.getRemark());
|
||||
|
||||
purchaseRecordDOS.forEach(f->f.setIsInvocing(InvoiceStatusEnum.INVOICINGSUCCESSFUL.getStatus()));
|
||||
|
||||
}else {
|
||||
|
||||
// 增加组织余额可开票的金额
|
||||
systemFundsApi.addOrganAmount(invoiceRecordsDO.getOrganId(),invoiceRecordsDO.getInvoiceAmount());
|
||||
|
||||
invoiceRecordsDO.setStatus(InvoiceStatusEnum.INVOICINGFAILED.getStatus());
|
||||
String remark = Optional.ofNullable(reqVO.getRemark()).orElseThrow(() -> new ServiceException(INVOICING_REJECT_REASON));
|
||||
invoiceRecordsDO.setRemark(remark);
|
||||
|
||||
purchaseRecordDOS.forEach(f->f.setIsInvocing(InvoiceStatusEnum.INVOICABLE.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
invoiceRecordsDO.setInvoiceAttachmentPath(reqVO.getInvoiceAttachmentPath());
|
||||
invoiceRecordsDO.setInvoiceNo(reqVO.getInvoiceNo());
|
||||
|
||||
invoiceRecordsMapper.updateById(invoiceRecordsDO);
|
||||
|
||||
purchaseRecordMapper.updateBatch(purchaseRecordDOS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void uploadInvoice(MultipartFile file, Long invoiceId) {
|
||||
|
||||
AssertUtils.notEmpty(file,INVOICE_FILE_IS_NULL);
|
||||
|
||||
// 生成存储目录
|
||||
Path invoiceDir = Paths.get(invoiceFilePath.getFilePath(),String.valueOf(invoiceId));
|
||||
if (!Files.exists(invoiceDir)) {
|
||||
try {
|
||||
Files.createDirectories(invoiceDir);
|
||||
} catch (IOException e) {
|
||||
log.error("发票附件目录创建失败" + e.getMessage());
|
||||
throw exception(INVOICE_FILE_UPLOAD_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 删除旧文件(确保目录中只有一个文件)
|
||||
try (Stream<Path> files = Files.list(invoiceDir)) {
|
||||
files.forEach(existingFile -> {
|
||||
try {
|
||||
Files.delete(existingFile);
|
||||
} catch (IOException e) {
|
||||
log.error("发票附件旧文件删除失败:" + e.getMessage());
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
log.error("发票附件旧文件删除失败: " + e.getMessage());
|
||||
throw exception(INVOICE_FILE_UPLOAD_FAILED);
|
||||
}
|
||||
|
||||
// 保存新文件
|
||||
String fileName = Objects.requireNonNull(file.getOriginalFilename());
|
||||
Path filePath = invoiceDir.resolve(fileName);
|
||||
|
||||
try (InputStream inputStream = file.getInputStream()) {
|
||||
Files.copy(inputStream, filePath, StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
log.error("发票附件上传失败: " + e.getMessage());
|
||||
throw exception(INVOICE_FILE_UPLOAD_FAILED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void downloadInvoice(Long invoiceId, HttpServletResponse response) {
|
||||
|
||||
Path invoiceDir = Paths.get(invoiceFilePath.getFilePath(), String.valueOf(invoiceId));
|
||||
|
||||
if (!Files.exists(invoiceDir)) {
|
||||
throw exception(INVOICE_FILE_IS_NULL_NOT_DOWNLOAD);
|
||||
}
|
||||
|
||||
|
||||
// 获取目录中的文件
|
||||
File[] files = invoiceDir.toFile().listFiles();
|
||||
if (files == null || files.length == 0) {
|
||||
throw exception(INVOICE_FILE_IS_NULL_NOT_DOWNLOAD);
|
||||
}
|
||||
|
||||
|
||||
// 取第一个文件
|
||||
File file = files[0];
|
||||
|
||||
try (InputStream inputStream = new FileInputStream(file);
|
||||
OutputStream outputStream = response.getOutputStream()) {
|
||||
|
||||
response.setCharacterEncoding(UTF8_CHARSET);
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
response.setHeader(Header.CONTENT_DISPOSITION.getValue(), ATTACHMENT_PREFIX + URLEncoder.encode(file.getName(), UTF8_CHARSET));
|
||||
response.setContentLengthLong(file.length());
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
outputStream.flush();
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("发票附件下载异常:"+ e.getMessage());
|
||||
throw exception(INVOICE_FILE_DATA_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private InvoiceRecordsDO validateInvoiceExists(Long invoiceId) {
|
||||
|
||||
InvoiceRecordsDO invoiceRecordsDO = invoiceRecordsMapper.selectById(invoiceId);
|
||||
|
||||
if (ObjectUtil.isNull(invoiceRecordsDO)) {
|
||||
throw exception(INVOICE_NO_EXIST);
|
||||
}
|
||||
|
||||
return invoiceRecordsDO;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<PurchaseRecordDO> validatePurchaseRecordExists(List<Long> purchaseId) {
|
||||
|
||||
List<PurchaseRecordDO> purchaseRecordDOS = purchaseRecordMapper.selectBatchIds(purchaseId);
|
||||
|
||||
if (ObjectUtil.isNull(purchaseRecordDOS)) {
|
||||
throw exception(PURCHASE_RECORD_NO_EXIST);
|
||||
}
|
||||
|
||||
return purchaseRecordDOS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.cf.imes.module.executor.service.funds.purchase;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.purchase.vo.PurchaseRecordPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.purchase.vo.PurchaseRecordRespVO;
|
||||
|
||||
/**
|
||||
* @author 软件购买接口
|
||||
*/
|
||||
public interface PurchaseService {
|
||||
|
||||
PageResult<PurchaseRecordRespVO> getPurchaseRecord(PurchaseRecordPageReqVO pageReqVO);
|
||||
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.cf.imes.module.executor.service.funds.purchase;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.purchase.vo.PurchaseRecordPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.funds.purchase.vo.PurchaseRecordRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.funds.purchase.PurchaseRecordDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.funds.purchase.PurchaseRecordMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 软件购买接口 实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PurchaseServiceImpl implements PurchaseService{
|
||||
|
||||
|
||||
@Resource
|
||||
private PurchaseRecordMapper purchaseRecordMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PageResult<PurchaseRecordRespVO> getPurchaseRecord(PurchaseRecordPageReqVO pageReqVO) {
|
||||
|
||||
|
||||
pageReqVO.setCreateTime(LocalDateTimeUtils.generateTimeSection(pageReqVO.getCreateTime()));
|
||||
|
||||
PageResult<PurchaseRecordDO> pageResult = purchaseRecordMapper.selectPage(pageReqVO);
|
||||
List<PurchaseRecordDO> resultList = pageResult.getList();
|
||||
|
||||
if(CollUtil.isEmpty(resultList)){
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
List<PurchaseRecordRespVO> respVOS = BeanUtils.toBean(resultList, PurchaseRecordRespVO.class);
|
||||
|
||||
return new PageResult<>(respVOS, pageResult.getTotal());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
-18
@@ -12,30 +12,12 @@ import java.util.Map;
|
||||
|
||||
public interface OptimizePlanService {
|
||||
|
||||
String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
String ORDER_OPTIMIZE_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
|
||||
|
||||
String PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL = "imes_plan_process_scheme_optimize_model";
|
||||
|
||||
String PLAN_ACTUAL_GOODS_MODEL = "imes_plan_actual_goods_model";
|
||||
|
||||
String PLAN_PROCESS_SCHEME_CONFIG = "imes_plan_process_scheme_config_model";
|
||||
|
||||
|
||||
List<PlateOptimize> getPlateListByPlanId(Long planId);
|
||||
|
||||
Boolean addRemain(AddRemainReqVO vo);
|
||||
|
||||
|
||||
Boolean commit(Long planId,String goodsId,Long planConfigId, List<Long> goodsNo);
|
||||
|
||||
|
||||
Boolean endCutting(Long planId,String goodsId,List<Long> goodsNo,Long planConfigId);
|
||||
|
||||
|
||||
void updateCuttingStatus(CuttingStatusRespVO respVO);
|
||||
|
||||
|
||||
|
||||
+61
-262
@@ -36,7 +36,6 @@ import com.cf.imes.module.executor.controller.admin.plan.bo.PlanProcessSchemeLis
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.ProcessGroupList;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.*;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.CutedBoardInfo;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.OptimizeBoardModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.PlanActualGoodsModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
@@ -179,213 +178,6 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean commit(Long planId,String goodsId,Long planConfigId, List<Long> goodsNo) {
|
||||
|
||||
PlanDO planDO = validatePlanExists(planId);
|
||||
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.NOCUTTING.getStatus())){
|
||||
throw exception(PLAN_STATUS_ERROR);
|
||||
}
|
||||
|
||||
Date date = new Date();
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_CONFIG_ID,FIELD_PLAN_ID,planConfigId, planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
|
||||
|
||||
List<PlateDO> plateDOS = getPlanGoodsPlateList(goodsNo,planDO,optimizeBoardModelDOS);
|
||||
|
||||
List<Long> orderIds = new ArrayList<>(plateDOS.stream().map(PlateDO::getOrderId).distinct().toList());
|
||||
|
||||
|
||||
OptimizeBoardModelDO optimizeBoardModelDO = optimizeBoardModelDOS.get(0);
|
||||
|
||||
|
||||
List<CutedBoardInfo> cutedBoardInfoList = Optional.ofNullable(optimizeBoardModelDO.getCutedBoardInfo()).orElse(new ArrayList<>());
|
||||
|
||||
List<CutedBoardInfo> cutedBoardInfos = cutedBoardInfoList.stream().filter(f -> f.getGoodsId().equals(goodsId)).toList();
|
||||
|
||||
CutedBoardInfo cutedBoardInfo = new CutedBoardInfo();
|
||||
|
||||
if(CollUtil.isNotEmpty(cutedBoardInfos)) {
|
||||
|
||||
CutedBoardInfo boardInfo = cutedBoardInfos.get(0);
|
||||
|
||||
// 获取原排单的已开料的大板编号
|
||||
List<Long> cutedBoardIsCuttingList = Optional.ofNullable(boardInfo.getCutedBoardIsCuttingList()).orElseGet(ArrayList::new);
|
||||
|
||||
|
||||
// 将开料的大板编号和已经开料的大板编号进行去重,相同去除,不同新增
|
||||
goodsNo.forEach(item -> {
|
||||
if (!cutedBoardIsCuttingList.contains(item)) {
|
||||
cutedBoardIsCuttingList.add(item);
|
||||
}
|
||||
});
|
||||
|
||||
// 将需要更新更新的数据更新到原数据中
|
||||
boardInfo.setCutedBoardIsCuttingList(cutedBoardIsCuttingList);
|
||||
|
||||
cutedBoardInfo = boardInfo;
|
||||
|
||||
}else {
|
||||
|
||||
cutedBoardInfo.setCutedBoardIsCuttingList(goodsNo);
|
||||
|
||||
}
|
||||
|
||||
// 更新开料相关的数据
|
||||
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("cutedBoardInfo",cutedBoardInfo);
|
||||
objectObjectHashMap.put(FIELD_UPDATETIME,simpleDateFormat.format(date));
|
||||
|
||||
try {
|
||||
|
||||
esDocumentService.updateById(ORDER_OPTIMIZE_PLATE_MODEL, optimizeBoardModelDO.getId(), HashMap.class, objectObjectHashMap);
|
||||
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 修改生产单的状态
|
||||
orderMapper.updateOrderListStatus(orderIds,OrderStatusEnum.IN_PRODUCTION.getStatus(),getUserOrganId());
|
||||
|
||||
|
||||
// 修改小板的开料状态
|
||||
plateDOS.forEach(f->f.setIsCutted(OrderPlateCutStatusEnum.OPENING.getStatus()));
|
||||
plateMapper.updateBatch(plateDOS);
|
||||
|
||||
|
||||
return Boolean.TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean endCutting(Long planId,String goodsId,List<Long> goodsNo,Long planConfigId) {
|
||||
|
||||
PlanDO planDO = validatePlanExists(planId);
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_CONFIG_ID,FIELD_PLAN_ID,planConfigId, planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
|
||||
Date date = new Date();
|
||||
|
||||
List<PlateDO> plateDOS = getPlanGoodsPlateList(goodsNo,planDO,optimizeBoardModelDOS);
|
||||
|
||||
List<Long> orderIds = new ArrayList<>(plateDOS.stream().map(PlateDO::getOrderId).distinct().toList());
|
||||
|
||||
|
||||
// 修改生产单的状态
|
||||
orderMapper.updateOrderListStatus(orderIds,OrderStatusEnum.IN_PRODUCTION.getStatus(),getUserOrganId());
|
||||
|
||||
|
||||
// 修改小板的开料状态
|
||||
plateDOS.forEach(f->f.setIsCutted(OrderPlateCutStatusEnum.OPENED.getStatus()));
|
||||
plateMapper.updateBatch(plateDOS);
|
||||
|
||||
|
||||
OptimizeBoardModelDO optimizeBoardModelDO = optimizeBoardModelDOS.get(0);
|
||||
|
||||
|
||||
List<CutedBoardInfo> cutedBoardInfoList = Optional.ofNullable(optimizeBoardModelDO.getCutedBoardInfo()).orElse(new ArrayList<>());
|
||||
|
||||
List<CutedBoardInfo> cutedBoardInfos = cutedBoardInfoList.stream().filter(f -> f.getGoodsId().equals(goodsId)).toList();
|
||||
|
||||
|
||||
AssertUtils.notEmpty(cutedBoardInfos,ORDER_PLAN_OPTIMIZE_ERROR);
|
||||
|
||||
CutedBoardInfo cutedBoardInfo = cutedBoardInfos.get(0);
|
||||
|
||||
|
||||
// 获取原排单的已开料的大板编号
|
||||
List<Long> cutedBoardList = Optional.ofNullable(cutedBoardInfo.getCutedBoardList()).orElseGet(ArrayList::new);
|
||||
|
||||
List<Long> cutedBoardIsCuttingList = cutedBoardInfo.getCutedBoardIsCuttingList();
|
||||
|
||||
// 将开料的大板编号和已经开料的大板编号进行去重,相同去除,不同新增
|
||||
goodsNo.forEach(item -> {
|
||||
if (!cutedBoardList.contains(item)) {
|
||||
cutedBoardList.add(item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
long cutedBoardNumber = cutedBoardList.size();
|
||||
|
||||
if(CollUtil.isEmpty(cutedBoardList)){
|
||||
cutedBoardNumber = 0;
|
||||
}
|
||||
|
||||
cutedBoardIsCuttingList.removeAll(goodsNo);
|
||||
|
||||
// 将需要更新更新的数据更新到原数据中
|
||||
cutedBoardInfo.setCutedBoardNumber(cutedBoardNumber);
|
||||
cutedBoardInfo.setCutedBoardList(cutedBoardList);
|
||||
cutedBoardInfo.setCutedBoardIsCuttingList(cutedBoardIsCuttingList);
|
||||
|
||||
|
||||
// 更新开料相关的数据
|
||||
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("cutedBoardInfo",cutedBoardInfo);
|
||||
objectObjectHashMap.put(FIELD_UPDATETIME,simpleDateFormat.format(date));
|
||||
|
||||
try {
|
||||
|
||||
esDocumentService.updateById(ORDER_OPTIMIZE_PLATE_MODEL, optimizeBoardModelDO.getId(), HashMap.class, objectObjectHashMap);
|
||||
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
|
||||
if(cutedBoardNumber > 0){
|
||||
|
||||
planDO.setStatus(PlanStatusEnum.OPENING.getStatus());
|
||||
planMapper.updateById(planDO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<PlateDO> plateDOList = plateMapper.selectNoCutPlateByPlateId(orderIds, getUserOrganId());
|
||||
|
||||
List<Long> orderIdList = plateDOList.stream().map(PlateDO::getOrderId).distinct().toList();
|
||||
|
||||
orderIds.removeAll(orderIdList);
|
||||
|
||||
if(CollUtil.isNotEmpty(orderIds)){
|
||||
|
||||
// 查询生产单的打包状态是否为已打包
|
||||
List<OrderDO> orderDOS = orderMapper.selectOrderPackList(orderIds, getUserOrganId());
|
||||
if (CollUtil.isNotEmpty(orderDOS)) {
|
||||
orderDOS.forEach(f -> {
|
||||
f.setStatus(OrderStatusEnum.FINISH_PRODUCTION.getStatus());
|
||||
f.setFinishTime(LocalDateTime.now());
|
||||
});
|
||||
|
||||
orderMapper.updateBatch(orderDOS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(optimizeBoardModelDO.getBoardCount() == cutedBoardNumber){
|
||||
|
||||
planDO.setStatus(PlanStatusEnum.OPENED.getStatus());
|
||||
planDO.setProduceTime(LocalDateTime.now());
|
||||
|
||||
planMapper.updateById(planDO);
|
||||
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@@ -414,7 +206,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
// 查询优化信息
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_CONFIG_ID,FIELD_PLAN_ID,planConfigId, planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_CONFIG_ID,FIELD_PLAN_ID,planConfigId, planId, ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), OptimizeBoardModelDO.class);
|
||||
|
||||
AssertUtils.notEmpty(optimizeBoardModelDOS,ORDER_PLAN_OPTIMIZE_ERROR);
|
||||
|
||||
@@ -494,7 +286,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
AssertUtils.notEmpty(goodsDOS,THIS_ORDER_NOT_PLATE_DATA);
|
||||
|
||||
List<PlateDetailRespVO> plateDOS = plateMapper.selectPlateListByGoodsIds(Collections.singletonList(orderId),getUserOrganId());
|
||||
List<PlateDetailRespVO> plateDOS = plateMapper.selectPlateListByGoodsIds(orderId,getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(plateDOS,ORDER_PLATE_ERROR);
|
||||
|
||||
@@ -512,13 +304,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
|
||||
|
||||
// 造型数据的尺寸长度
|
||||
Integer orderModelSize = plateDOS.size();
|
||||
|
||||
List<Long> plateIdList = plateDOS.stream().map(PlateDetailRespVO::getPlateId).distinct().toList();
|
||||
|
||||
List<OrderModelDO> orderModelDOS = esUtils.getEsDocument(FIELD_ORDER_ID,FIELD_PLATE_ID, orderId,plateIdList, orderModelSize, OptimizePlanService.ORDER_PLATE_MODEL, OrderModelDO.class);
|
||||
|
||||
List<OrderModelDO> orderModelDOS = esUtils.getEsDocumentByScroll(FIELD_ORDER_ID,orderId,1000,ORDER_PLATE_MODEL.getIndex(),OrderModelDO.class);
|
||||
|
||||
AssertUtils.notEmpty(orderModelDOS,ORDER_PLATE_MODEL_DATE_ERROR);
|
||||
|
||||
@@ -528,7 +314,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
// 查询生产单对应的配件的ES信息
|
||||
List<OrderPartsRemark> orderPartsRemarks = esUtils.getEsDocument(FIELD_ORDER_ID, orderId, printOrderPartsRespVOS.size(), ORDER_PARTS_REMARK_MODEL, OrderPartsRemark.class);
|
||||
List<OrderPartsRemark> orderPartsRemarks = esUtils.getEsDocument(FIELD_ORDER_ID, orderId, printOrderPartsRespVOS.size(), ORDER_PARTS_REMARK_MODEL.getIndex(), OrderPartsRemark.class);
|
||||
|
||||
|
||||
// 查询生产单对应的包裹信息
|
||||
@@ -607,7 +393,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
// 需要查询小板造型信息的板材ID
|
||||
List<Long> plateIds = plateDetailRespVOS.stream().map(PlateDetailRespVO::getPlateId).toList();
|
||||
|
||||
List<OrderModelDO> orderModelDOS = esUtils.getEsDocument(FIELD_PLATE_ID, plateIds, orderModelSize, OptimizePlanService.ORDER_PLATE_MODEL, OrderModelDO.class);
|
||||
List<OrderModelDO> orderModelDOS = esUtils.getEsDocument(FIELD_PLATE_ID, plateIds, orderModelSize, ORDER_PLATE_MODEL.getIndex(), OrderModelDO.class);
|
||||
|
||||
AssertUtils.notEmpty(orderModelDOS,ORDER_PLAN_PLATE_MODEL_DATE_ERROR);
|
||||
|
||||
@@ -619,14 +405,14 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
// 获取混单时选择的实际开料的大板信息
|
||||
List<PlanActualGoodsModelDO> planActualGoodsModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_ACTUAL_GOODS_MODEL, PlanActualGoodsModelDO.class);
|
||||
List<PlanActualGoodsModelDO> planActualGoodsModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_ACTUAL_GOODS_MODEL.getIndex(), PlanActualGoodsModelDO.class);
|
||||
|
||||
|
||||
// 查询生产单对应的配件信息
|
||||
List<PrintOrderPartsRespVO> printOrderPartsRespVOS = orderPartsMapper.selectPartList(orderIds, getUserOrganId());
|
||||
|
||||
// 查询生产单对应的配件的ES信息
|
||||
List<OrderPartsRemark> orderPartsRemarks = esUtils.getEsDocument(FIELD_ORDER_ID, orderIds, printOrderPartsRespVOS.size(), ORDER_PARTS_REMARK_MODEL, OrderPartsRemark.class);
|
||||
List<OrderPartsRemark> orderPartsRemarks = esUtils.getEsDocument(FIELD_ORDER_ID, orderIds, printOrderPartsRespVOS.size(), ORDER_PARTS_REMARK_MODEL.getIndex(), OrderPartsRemark.class);
|
||||
|
||||
|
||||
// 查询生产单对应的包裹信息
|
||||
@@ -691,7 +477,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
// 兼容数据,后期可删除
|
||||
List<OptimizeBoardModelDO> document = esUtils.getEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
List<OptimizeBoardModelDO> document = esUtils.getEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), OptimizeBoardModelDO.class);
|
||||
if(CollUtil.isNotEmpty(document)){
|
||||
OptimizeBoardModelDO optimizeBoardModelDO = document.get(0);
|
||||
processId = optimizeBoardModelDO.getProcessId();
|
||||
@@ -710,10 +496,10 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
// 保存排单对应的方案组的配置信息
|
||||
getPlanProcessSchemeConfig(planDO.getProcessId(),planId);
|
||||
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL.getIndex());
|
||||
|
||||
}else {
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID, FIELD_PLAN_CONFIG_ID, planId, boardModelDO.getPlanConfigId(), ORDER_OPTIMIZE_PLATE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID, FIELD_PLAN_CONFIG_ID, planId, boardModelDO.getPlanConfigId(), ORDER_OPTIMIZE_PLATE_MODEL.getIndex());
|
||||
}
|
||||
|
||||
|
||||
@@ -725,7 +511,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
if(req.getPlanConfigId() != null && req.getProcessId() == null){
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID, FIELD_PLAN_CONFIG_ID, planId, req.getPlanConfigId(), ORDER_OPTIMIZE_PLATE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID, FIELD_PLAN_CONFIG_ID, planId, req.getPlanConfigId(), ORDER_OPTIMIZE_PLATE_MODEL.getIndex());
|
||||
}
|
||||
|
||||
|
||||
@@ -744,16 +530,16 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
// 保存优化后的大板数据
|
||||
esUtils.saveEsDocument(ORDER_OPTIMIZE_PLATE_MODEL, Collections.singletonList(boardModelDO));
|
||||
esUtils.saveEsDocument(ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), Collections.singletonList(boardModelDO));
|
||||
|
||||
|
||||
// ES文档数据刷新
|
||||
esUtils.refresh(ORDER_OPTIMIZE_PLATE_MODEL);
|
||||
esUtils.refresh(ORDER_OPTIMIZE_PLATE_MODEL.getIndex());
|
||||
|
||||
|
||||
if (processId == null) {
|
||||
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL.getIndex());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -806,19 +592,19 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
planMapper.updateById(planDO.setProcessId(processId));
|
||||
|
||||
// 修改方案组,删除全部的方案组的优化信息
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,planId,PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,planId,PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL.getIndex());
|
||||
|
||||
// 删除全部的生产优化信息
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,planId,ORDER_OPTIMIZE_PLATE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,planId,ORDER_OPTIMIZE_PLATE_MODEL.getIndex());
|
||||
|
||||
// 保存此时的方案组的优化信息
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL,schemeModelDOS);
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL.getIndex(),schemeModelDOS);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
List<ProcessSchemeModelDO> processSchemeModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_PROCESS_SCHEME_CONFIG, ProcessSchemeModelDO.class);
|
||||
List<ProcessSchemeModelDO> processSchemeModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_PROCESS_SCHEME_CONFIG.getIndex(), ProcessSchemeModelDO.class);
|
||||
|
||||
// 保存排单对应的加工方案组的配置信息
|
||||
if(CollUtil.isEmpty(processSchemeModelDOS)){
|
||||
@@ -827,9 +613,9 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
}
|
||||
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,FIELD_PLAN_CONFIG_ID,planId,planConfigIds,PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,FIELD_PLAN_CONFIG_ID,planId,planConfigIds,PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL.getIndex());
|
||||
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL,schemeModelDOS);
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL.getIndex(),schemeModelDOS);
|
||||
|
||||
}
|
||||
|
||||
@@ -841,7 +627,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
@Override
|
||||
public PlanProcessSchemeList getProcessSchemeConfig(Long processId,Long planId) {
|
||||
|
||||
esUtils.refresh(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL);
|
||||
esUtils.refresh(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL.getIndex());
|
||||
|
||||
PlanProcessSchemeList planProcessSchemeList = new PlanProcessSchemeList();
|
||||
|
||||
@@ -853,7 +639,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
List<ProcessSchemeDTO> schemeDTOList;
|
||||
|
||||
// 获取排单对应的方案组的配置信息
|
||||
List<ProcessSchemeModelDO> schemeModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_PROCESS_SCHEME_CONFIG, ProcessSchemeModelDO.class);
|
||||
List<ProcessSchemeModelDO> schemeModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_PROCESS_SCHEME_CONFIG.getIndex(), ProcessSchemeModelDO.class);
|
||||
|
||||
if(CollUtil.isNotEmpty(schemeModelDOS)){
|
||||
|
||||
@@ -877,13 +663,13 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
// 查询排单对应的方案组信息
|
||||
List<SaveProcessSchemeModelDO> saveProcessSchemeReqVOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL, SaveProcessSchemeModelDO.class);
|
||||
List<SaveProcessSchemeModelDO> saveProcessSchemeReqVOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL.getIndex(), SaveProcessSchemeModelDO.class);
|
||||
|
||||
|
||||
if(CollUtil.isNotEmpty(saveProcessSchemeReqVOS)){
|
||||
|
||||
// 查询排单对应的优化信息
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, schemeDTOList.size(), ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, schemeDTOList.size(), ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), OptimizeBoardModelDO.class);
|
||||
|
||||
if(CollUtil.isNotEmpty(optimizeBoardModelDOS)){
|
||||
|
||||
@@ -1012,13 +798,8 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
|
||||
|
||||
// 造型数据的尺寸长度
|
||||
Integer orderModelSize = plateDetailRespVOS.size();
|
||||
|
||||
// 需要查询的小板造型信息的板材ID
|
||||
List<Long> plateIds = plateDetailRespVOS.stream().map(PlateDetailRespVO::getPlateId).toList();
|
||||
|
||||
List<OrderModelDO> orderModelDOS = esUtils.getEsDocument(FIELD_PLATE_ID, plateIds, orderModelSize, OptimizePlanService.ORDER_PLATE_MODEL, OrderModelDO.class);
|
||||
// todo 数据结构改后,可以增加排单ID作为筛选,只查为 0 的
|
||||
List<OrderModelDO> orderModelDOS = esUtils.getEsDocumentByScroll(FIELD_ORDER_ID, orderIds, 1000, ORDER_PLATE_MODEL.getIndex(), OrderModelDO.class);
|
||||
|
||||
AssertUtils.notEmpty(plateDetailRespVOS,ORDER_PLATE_MODEL_DATE_ERROR);
|
||||
|
||||
@@ -1134,7 +915,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
@Override
|
||||
public Boolean getNewPlanPlate(Long planId) {
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), OptimizeBoardModelDO.class);
|
||||
|
||||
if(CollUtil.isNotEmpty(optimizeBoardModelDOS)){
|
||||
List<OptimizeBoardModelDO> modelDOS = optimizeBoardModelDOS.stream().filter(f ->Boolean.TRUE.equals(f.getIsNewInsertPlate())).toList();
|
||||
@@ -1156,7 +937,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
UpdateByQueryRequest.Builder builder = new UpdateByQueryRequest.Builder();
|
||||
|
||||
builder.index(PLAN_PROCESS_SCHEME_CONFIG)
|
||||
builder.index(PLAN_PROCESS_SCHEME_CONFIG.getIndex())
|
||||
.query(qb -> qb.bool(bq -> bq
|
||||
.must(mq -> mq.term(t->t.field(FIELD_PLAN_ID).value(reqVO.getPlanId())))
|
||||
.must(mq -> mq.match(mtq -> mtq.field(FIELD_PLAN_CONFIG_ID).query(reqVO.getPlanConfigId())))
|
||||
@@ -1307,7 +1088,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
|
||||
builder.index(OptimizePlanService.ORDER_PLATE_MODEL);
|
||||
builder.index(ORDER_PLATE_MODEL.getIndex());
|
||||
|
||||
|
||||
// 生成查询 SQL
|
||||
@@ -1384,7 +1165,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
if(CharSequenceUtil.isNotBlank(goodsIdList)){
|
||||
|
||||
filterSql = " SELECT orderId,goodsId FROM " + OptimizePlanService.ORDER_PLATE_MODEL + " WHERE "
|
||||
filterSql = " SELECT orderId,goodsId FROM " + ORDER_PLATE_MODEL.getIndex() + " WHERE "
|
||||
+ "isOptimized = false " +
|
||||
"and ( orderId in ( " + orderIds + " ) and goodsId in ( " + goodsIdList + " ) )"
|
||||
+ logicalOperator
|
||||
@@ -1393,7 +1174,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
}else {
|
||||
|
||||
filterSql = "SELECT orderId,goodsId FROM " + OptimizePlanService.ORDER_PLATE_MODEL + " WHERE "
|
||||
filterSql = "SELECT orderId,goodsId FROM " + ORDER_PLATE_MODEL.getIndex() + " WHERE "
|
||||
+ " " +
|
||||
" ( orderId in ( " + orderIds + "))"
|
||||
+ logicalOperator
|
||||
@@ -1403,7 +1184,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
}else {
|
||||
|
||||
filterSql = "SELECT orderId,goodsId FROM " + OptimizePlanService.ORDER_PLATE_MODEL + " WHERE "
|
||||
filterSql = "SELECT orderId,goodsId FROM " + ORDER_PLATE_MODEL.getIndex() + " WHERE "
|
||||
+ "isOptimized = false and "
|
||||
+ config
|
||||
+ FIELD_SORT;
|
||||
@@ -1495,7 +1276,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
UpdateByQueryRequest.Builder builder = new UpdateByQueryRequest.Builder();
|
||||
|
||||
builder.index(ORDER_OPTIMIZE_PLATE_MODEL)
|
||||
builder.index(ORDER_OPTIMIZE_PLATE_MODEL.getIndex())
|
||||
.query(qb -> qb.bool(bq -> bq.filter(f->{
|
||||
f.term(t->t.field(FIELD_PLAN_ID).value(planId));
|
||||
f.term(t->t.field(FIELD_PLAN_CONFIG_ID).value(planConfigId));
|
||||
@@ -1537,8 +1318,12 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
AtomicLong goodsCount = new AtomicLong(0L);
|
||||
List<String> planNos = new ArrayList<>();
|
||||
|
||||
// 大板开料数量
|
||||
long cutedBoardNumber = Optional.ofNullable(optimizeBoardModelDO.getCutedBoardNumber()).orElse(0L);
|
||||
|
||||
|
||||
// 更新板材状态并统计数量
|
||||
updateRemainBoardInfo(remainBoardInfos, goodsIds, goodsNo, cutedType, goodsCount, planNos);
|
||||
updateRemainBoardInfo(remainBoardInfos, goodsIds, goodsNo, cutedType, goodsCount, planNos,cutedBoardNumber);
|
||||
|
||||
// 更新优化数据
|
||||
long goodsNum = updateOptimizeData(optimizeBoardModelDO, goodsCount.get(), planNos.size(), cutedType);
|
||||
@@ -1560,7 +1345,8 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
List<Integer> goodsNo,
|
||||
Integer cutedType,
|
||||
AtomicLong goodsCount,
|
||||
List<String> planNos) {
|
||||
List<String> planNos,
|
||||
Long cutedBoardNumber) {
|
||||
|
||||
remainBoardInfos.stream()
|
||||
.filter(remainBoard -> goodsIds.contains(remainBoard.getGoodsId()))
|
||||
@@ -1580,13 +1366,26 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
|
||||
goodsCount.incrementAndGet();
|
||||
board.setCutedType(cutedType);
|
||||
planNos.addAll(board.getBlocks().stream()
|
||||
.map(RemainBoardInfo.Blocks::getBlockId)
|
||||
.toList());
|
||||
|
||||
board.setCutedType(cutedType);
|
||||
planNos.addAll(board.getBlocks().stream()
|
||||
.map(RemainBoardInfo.Blocks::getBlockId)
|
||||
.toList());
|
||||
|
||||
});
|
||||
|
||||
|
||||
if(cutedBoardNumber == 0) {
|
||||
|
||||
remainBoardInfos.stream()
|
||||
.filter(remainBoard -> goodsIds.contains(remainBoard.getGoodsId()))
|
||||
.flatMap(remainBoard -> remainBoard.getPlaceBoardList().stream())
|
||||
.filter(board -> goodsNo.contains(board.getBoardId()) && cutedType.equals(OrderPlateCutStatusEnum.OPENED.getStatus()) && board.getCutedType().equals(OrderPlateCutStatusEnum.OPENED.getStatus()))
|
||||
|
||||
.forEach(f -> goodsCount.incrementAndGet());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1634,7 +1433,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
updateData.put(FIELD_UPDATETIME, simpleDateFormat.format(date));
|
||||
|
||||
try {
|
||||
esDocumentService.updateById(ORDER_OPTIMIZE_PLATE_MODEL, optimizeBoardModelDO.getId(), HashMap.class, updateData);
|
||||
esDocumentService.updateById(ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), optimizeBoardModelDO.getId(), HashMap.class, updateData);
|
||||
|
||||
} catch (IOException | ElasticsearchException e) {
|
||||
log.error("Failed to sync with Elasticsearch: {}", e.getMessage());
|
||||
@@ -1810,10 +1609,10 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
});
|
||||
|
||||
// 删除旧的排单对应的加工方案组的配置信息
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,planId,PLAN_PROCESS_SCHEME_CONFIG);
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,planId,PLAN_PROCESS_SCHEME_CONFIG.getIndex());
|
||||
|
||||
// 保存新的排单对应的加工方案组的配置信息
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_CONFIG,modelDOS);
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_CONFIG.getIndex(),modelDOS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+3
-29
@@ -43,6 +43,7 @@ import java.util.function.BiConsumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
@@ -92,13 +93,8 @@ public class OrderInputProcessor {
|
||||
@Resource
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
|
||||
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
private static final String FIELD_ORDER_ID = "orderId";
|
||||
|
||||
public static final String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
|
||||
|
||||
// public static final String ORDER_PLATE_MODEL_COMPRESS = "imes_order_plate_model_compress";
|
||||
|
||||
/**
|
||||
* 批量保存生产单小板五金数据
|
||||
@@ -189,7 +185,7 @@ public class OrderInputProcessor {
|
||||
*/
|
||||
public void batchSaveModel(List<OrderModelDO> orderModelDOs) {
|
||||
try {
|
||||
BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_PLATE_MODEL, orderModelDOs);
|
||||
BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_PLATE_MODEL.getIndex(), orderModelDOs);
|
||||
boolean errors = bulkResponse.errors();
|
||||
if (errors) {
|
||||
log.error(bulkResponse.items().toString());
|
||||
@@ -204,28 +200,6 @@ public class OrderInputProcessor {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存生产单板材造型的压缩数据
|
||||
*
|
||||
* @param orderModelDOs
|
||||
*/
|
||||
// public void batchSaveCompressModel(List<OrderModelCompressDO> orderModelDOs) {
|
||||
// try {
|
||||
// BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_PLATE_MODEL_COMPRESS, orderModelDOs);
|
||||
// boolean errors = bulkResponse.errors();
|
||||
// if (errors) {
|
||||
// log.error(bulkResponse.items().toString());
|
||||
// throw new ServiceException(500, "未知异常");
|
||||
// }
|
||||
// } catch (IOException | ElasticsearchException e) {
|
||||
// e.printStackTrace();
|
||||
// log.error(e.getMessage());
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -236,7 +210,7 @@ public class OrderInputProcessor {
|
||||
*/
|
||||
public void batchSaveOrderPartsModel(List<OrderPartsRemark> orderPartsRemarks) {
|
||||
try {
|
||||
BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_PARTS_REMARK_MODEL, orderPartsRemarks);
|
||||
BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_PARTS_REMARK_MODEL.getIndex(), orderPartsRemarks);
|
||||
boolean errors = bulkResponse.errors();
|
||||
if (errors) {
|
||||
log.error(bulkResponse.items().toString());
|
||||
|
||||
+6
-33
@@ -66,7 +66,6 @@ import com.cf.imes.module.executor.enums.DataTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.executor.service.customplateno.CustomPlateNoGenerateService;
|
||||
import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService;
|
||||
import com.cf.imes.module.executor.service.orderImport.OrderImportHandler;
|
||||
import com.cf.imes.module.executor.service.orderImport.factory.OrderImportHandlerFactory;
|
||||
import com.cf.imes.module.executor.service.plan.PlanService;
|
||||
@@ -100,6 +99,7 @@ import java.util.stream.Stream;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORDER_PLAN_DATA_ERROR;
|
||||
|
||||
@@ -174,13 +174,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
private static final String SUBMIT_STATE = "1"; // 空订单 原生产系统
|
||||
|
||||
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
public static final String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
|
||||
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
private static final String PLAN_ACTUAL_GOODS_MODEL = "imes_plan_actual_goods_model";
|
||||
|
||||
|
||||
public static final Double ZERO = 0.0;
|
||||
|
||||
@@ -510,17 +503,12 @@ public class OrderServiceImpl implements OrderService {
|
||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||
|
||||
if (orderModelDOs != null && !orderModelDOs.isEmpty()) {
|
||||
// // 将生产单板材的造型信息进行压缩并保存
|
||||
// OrderModelCompressDO orderModelCompressDO = new OrderModelCompressDO();
|
||||
// orderModelCompressDO.setOrderId(order.getId());
|
||||
|
||||
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(order.getId()));
|
||||
// 保存大板的分类和实际ID和未优化
|
||||
saveOrderPlateModel(plateDO,goodsDO,orderModelDOs);
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
|
||||
// 保存压缩的数据
|
||||
// orderInputProcessor.batchSaveCompressModel(Collections.singletonList(orderModelCompressDO));
|
||||
}
|
||||
if (!partsRemark.isEmpty()) {
|
||||
orderInputProcessor.batchSaveOrderPartsModel(partsRemark);
|
||||
@@ -592,19 +580,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
if (plateDetail != null && !plateDetail.isEmpty()){
|
||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||
// orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
|
||||
// // 将生产单板材的造型信息进行压缩并保存
|
||||
// OrderModelCompressDO orderModelCompressDO = new OrderModelCompressDO();
|
||||
// orderModelCompressDO.setOrderId(orderDO.getId());
|
||||
|
||||
saveOrderPlateModel(plateDO,goodsDO,orderModelDOs);
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
|
||||
// 保存压缩的数据
|
||||
// orderInputProcessor.batchSaveCompressModel(Collections.singletonList(orderModelCompressDO));
|
||||
|
||||
// }
|
||||
}
|
||||
if (orderPartsRemarks != null && !orderPartsRemarks.isEmpty()) {
|
||||
orderInputProcessor.batchSaveOrderPartsModel(orderPartsRemarks);
|
||||
@@ -738,9 +717,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderMapper.deleteOrder(orderId, getUserOrganId()); // 生产单删除
|
||||
|
||||
// 删除板材的造型数据 es
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL.getIndex());
|
||||
// 删除备注信息 es
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PARTS_REMARK_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PARTS_REMARK_MODEL.getIndex());
|
||||
|
||||
}
|
||||
|
||||
@@ -1444,10 +1423,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
private void saveOrderPlateModel(List<PlateDO> plateDO, List<GoodsDO> goodsDO, List<OrderModelDO> orderModelDOs) {
|
||||
|
||||
// // 将生产单板材的造型信息进行压缩并保存
|
||||
// String orderPlateModeList = toJsonString(BeanUtils.toBean(orderModelDOs, OrderPlateList.class));
|
||||
// orderModelCompressDO.setOrderModelZip(zipString(orderPlateModeList));
|
||||
|
||||
// 板材造型数据添加 大板分类ID,实际ID
|
||||
List<OrderGoodsPlateIds> orderGoodsPlateIds = BeanUtils.toBean(plateDO, OrderGoodsPlateIds.class);
|
||||
orderGoodsPlateIds.forEach(f->
|
||||
@@ -1517,7 +1492,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
List<Long> plateIdList = labelOrderPlateData.stream().map(LabelOrderPlateData::getPlateId).distinct().toList();
|
||||
|
||||
// 小板造型信息
|
||||
orderModelDOS = esUtils.getEsDocument("orderId","plateId", orderIds,plateIdList, plateIdList.size(), OptimizePlanService.ORDER_PLATE_MODEL, OrderModelDO.class);
|
||||
orderModelDOS = esUtils.getEsDocument("orderId","plateId", orderIds,plateIdList, plateIdList.size(), ORDER_PLATE_MODEL.getIndex(), OrderModelDO.class);
|
||||
|
||||
}else {
|
||||
|
||||
@@ -1529,9 +1504,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 板材信息
|
||||
labelOrderPlateData = plateMapper.selectLabelOrderPlateDataByOrderId(orderId,organId);
|
||||
|
||||
Integer plateIdSize = labelOrderPlateData.stream().map(LabelOrderPlateData::getPlateId).distinct().toList().size();
|
||||
|
||||
orderModelDOS = esUtils.getEsDocument("orderId", orderIds, plateIdSize, OptimizePlanService.ORDER_PLATE_MODEL, OrderModelDO.class);
|
||||
orderModelDOS = esUtils.getEsDocumentByScroll("orderId", orderIds,1000, ORDER_PLATE_MODEL.getIndex(), OrderModelDO.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1572,7 +1545,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 补充实际选择的大板信息-即生产的信息
|
||||
if(CollUtil.isNotEmpty(planIdList)){
|
||||
|
||||
List<PlanActualGoodsModelDO> actualGoodsModelDOS = esUtils.getEsDocument("planId", planIdList, planIdList.size(), PLAN_ACTUAL_GOODS_MODEL, PlanActualGoodsModelDO.class);
|
||||
List<PlanActualGoodsModelDO> actualGoodsModelDOS = esUtils.getEsDocument("planId", planIdList, planIdList.size(), PLAN_ACTUAL_GOODS_MODEL.getIndex(), PlanActualGoodsModelDO.class);
|
||||
|
||||
if(CollUtil.isNotEmpty(actualGoodsModelDOS)) {
|
||||
labelOrderPlateData.forEach(f -> {
|
||||
|
||||
+6
-12
@@ -6,7 +6,6 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch._types.SortOrder;
|
||||
import co.elastic.clients.elasticsearch._types.aggregations.Aggregate;
|
||||
|
||||
import co.elastic.clients.elasticsearch._types.aggregations.CalendarInterval;
|
||||
import co.elastic.clients.elasticsearch._types.aggregations.DateHistogramAggregation;
|
||||
import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||
@@ -27,7 +26,6 @@ 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.dal.mysql.plate.PlateGoodMapper;
|
||||
import com.cf.imes.module.executor.enums.OrderStatisticsUnit;
|
||||
import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService;
|
||||
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;
|
||||
@@ -43,16 +41,11 @@ import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.ORDER_OPTIMIZE_PLATE_MODEL;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/8/5 16:58
|
||||
@@ -61,6 +54,7 @@ import java.util.stream.Collectors;
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
|
||||
@Resource
|
||||
private OrderStatisticsMapper orderStatisticsMapper;
|
||||
|
||||
@@ -426,7 +420,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
// 查询创建时间段内,数量最多的goods_id前十
|
||||
SearchRequest searchRequest = new SearchRequest.Builder()
|
||||
.size(0)
|
||||
.index(OptimizePlanService.ORDER_OPTIMIZE_PLATE_MODEL)
|
||||
.index(ORDER_OPTIMIZE_PLATE_MODEL.getIndex())
|
||||
.query(q ->
|
||||
q.bool(b -> b
|
||||
.must(m -> m.range(m1 -> m1.field(ORDER_REMAIN_PLATE_MODEL_CREATE_TIME_FIELDNAME)
|
||||
@@ -457,7 +451,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
// 查询创建时间段内,数量最多的goods_id前十下的数据,按goods_id和日期分组
|
||||
SearchRequest dateGroupRequest = new SearchRequest.Builder()
|
||||
.size(0)
|
||||
.index(OptimizePlanService.ORDER_OPTIMIZE_PLATE_MODEL)
|
||||
.index(ORDER_OPTIMIZE_PLATE_MODEL.getIndex())
|
||||
.query(q ->
|
||||
q.bool(b -> b
|
||||
.must(m -> m.range(m1 -> m1.field(ORDER_REMAIN_PLATE_MODEL_CREATE_TIME_FIELDNAME)
|
||||
|
||||
+5
-7
@@ -12,13 +12,15 @@ 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.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.module.executor.enums.EsIndexEnum.ORDER_PARTS_REMARK_MODEL;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.ORDER_PLATE_MODEL;
|
||||
|
||||
|
||||
/**
|
||||
* 生产单定时处理器
|
||||
@@ -55,10 +57,6 @@ public class OrderScheduledImpl {
|
||||
@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";
|
||||
|
||||
|
||||
// @Scheduled(cron = "0 0 2 * * ?")
|
||||
@OrganIgnore
|
||||
@@ -80,9 +78,9 @@ public class OrderScheduledImpl {
|
||||
orderMapper.deleteBatchIds(orderDOList); // 生产单删除
|
||||
|
||||
// 删除板材的造型数据 es
|
||||
orderInputProcessor.deleteByOrderId(orderDOList, ORDER_PLATE_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(orderDOList, ORDER_PLATE_MODEL.getIndex());
|
||||
// 删除备注信息 es
|
||||
orderInputProcessor.deleteByOrderId(orderDOList, ORDER_PARTS_REMARK_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(orderDOList, ORDER_PARTS_REMARK_MODEL.getIndex());
|
||||
|
||||
}
|
||||
|
||||
|
||||
+187
-49
@@ -72,6 +72,7 @@ import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -114,14 +115,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Resource
|
||||
private IdentifierGenerator identifierGenerator;
|
||||
|
||||
private static final String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
private static final String PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL = "imes_plan_process_scheme_optimize_model";
|
||||
|
||||
private static final String PLAN_ACTUAL_GOODS_MODEL = "imes_plan_actual_goods_model";
|
||||
|
||||
private static final String PLAN_PROCESS_SCHEME_CONFIG = "imes_plan_process_scheme_config_model";
|
||||
|
||||
@Resource
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
|
||||
@@ -244,16 +237,32 @@ public class PlanServiceImpl implements PlanService {
|
||||
p.setProcessId(processId);
|
||||
}));
|
||||
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_CONFIG,processSchemeModelDOS);
|
||||
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_CONFIG.getIndex(),processSchemeModelDOS);
|
||||
|
||||
// 增加排单
|
||||
planMapper.insertBatch(planDOS);
|
||||
|
||||
// 排单明细表增加板材
|
||||
planItemMapper.insertBatch(planItemDOS, planItemDOS.size());
|
||||
|
||||
|
||||
// 板材造型数据更新排单ID
|
||||
planDOS.forEach(f->{
|
||||
|
||||
String orderNos = Optional.ofNullable(f.getOrderNos()).orElse("[]");
|
||||
|
||||
List<Long> orderIdList = JSON.parseArray(orderNos).toJavaList(Long.class).stream().toList();
|
||||
|
||||
List<Long> plateIdList = planItemDOS.stream().filter(pi -> f.getId().equals(pi.getPlanId())).map(PlanItemDO::getPlateId).toList();
|
||||
|
||||
// insertPlateModelPlanId(orderIdList,plateIdList,f.getId());
|
||||
|
||||
});
|
||||
|
||||
|
||||
// 增加实际生产选择的板材
|
||||
if(CollUtil.isNotEmpty(planActualGoodsModelDOS)) {
|
||||
esUtils.saveEsDocument(PLAN_ACTUAL_GOODS_MODEL, planActualGoodsModelDOS);
|
||||
esUtils.saveEsDocument(PLAN_ACTUAL_GOODS_MODEL.getIndex(), planActualGoodsModelDOS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -306,10 +315,12 @@ public class PlanServiceImpl implements PlanService {
|
||||
// 添加小板
|
||||
List<OrderPlateIds> insertOrderPlateIds = Optional.ofNullable(updateReqVO.getInsertOrderPlateIds()).orElse(new ArrayList<>());
|
||||
|
||||
PlanActualGoodsModelDO planActualGoodsModelDO = updateReqVO.getPlanActualGoodsModelDO();
|
||||
|
||||
if(CollUtil.isNotEmpty(insertOrderPlateIds)){
|
||||
|
||||
PlanServiceImpl p = (PlanServiceImpl) AopContext.currentProxy();
|
||||
p.insertPlanPlate(insertOrderPlateIds);
|
||||
p.insertPlanPlate(insertOrderPlateIds,planActualGoodsModelDO);
|
||||
|
||||
}
|
||||
|
||||
@@ -401,16 +412,18 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
|
||||
// 排单对应的优化数据删除
|
||||
esUtils.deleteEsDocument(FIELD_PLANID,planIds,ORDER_REMAIN_PLATE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLANID,planIds,ORDER_OPTIMIZE_PLATE_MODEL.getIndex());
|
||||
|
||||
|
||||
// 删除排单对应的加工方案的优化数据
|
||||
esUtils.deleteEsDocument(FIELD_PLANID,planIds,PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLANID,planIds,PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL.getIndex());
|
||||
|
||||
|
||||
// 删除排单对应的加工方案组的配置信息
|
||||
esUtils.deleteEsDocument(FIELD_PLANID,planIds,PLAN_PROCESS_SCHEME_CONFIG);
|
||||
esUtils.deleteEsDocument(FIELD_PLANID,planIds,PLAN_PROCESS_SCHEME_CONFIG.getIndex());
|
||||
|
||||
// 去除生产单板材造型对应的排单ID
|
||||
// removePlateModelPlanId(orderIds,planIds,new ArrayList<>());
|
||||
|
||||
}
|
||||
|
||||
@@ -496,7 +509,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
|
||||
// 根据排单ID查询ES中的优化数据
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLANID, planIds, 500, ORDER_REMAIN_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLANID, planIds, 500, ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), OptimizeBoardModelDO.class);
|
||||
|
||||
|
||||
// 获取排单对应的生产单的信息
|
||||
@@ -567,7 +580,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
}
|
||||
|
||||
// 根据排单ID查询ES中的优化数据
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLANID, planIds, planIds.size(), ORDER_REMAIN_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLANID, planIds, planIds.size(), ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), OptimizeBoardModelDO.class);
|
||||
|
||||
|
||||
// 获取排单对应的生产单的信息
|
||||
@@ -965,6 +978,25 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
List<PlanActualGoodsResp> planActualGoodsResps = new ArrayList<>();
|
||||
|
||||
if(savePlanPlateList.getPlanId() != null){
|
||||
|
||||
Long planId = savePlanPlateList.getPlanId();
|
||||
|
||||
PlanDO planDO = validatePlan(planId);
|
||||
|
||||
if(planDO.getType().equals(PlanTypeEnum.MIXEDORDERPLAN.getType())){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<SavePlanPlateList.GoodsItemList> goodsItemLists = planItemMapper.selectPlanGoodsList(planId, getUserOrganId());
|
||||
|
||||
goodsItemLists.forEach(f-> f.setThickness(new BigDecimal(f.getThickness().stripTrailingZeros().toPlainString())));
|
||||
|
||||
goodsItemListList.addAll(goodsItemLists);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Map<String, List<Long>> grouped;
|
||||
|
||||
if(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.getType().equals(mixedType)){
|
||||
@@ -1008,7 +1040,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<OptimizeBoardModelDO> boardModelDOS = esUtils.getEsDocument(FIELD_PLANID, planId, ORDER_REMAIN_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
List<OptimizeBoardModelDO> boardModelDOS = esUtils.getEsDocument(FIELD_PLANID, planId, ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), OptimizeBoardModelDO.class);
|
||||
|
||||
if(CollUtil.isNotEmpty(boardModelDOS)) {
|
||||
|
||||
@@ -1241,7 +1273,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
|
||||
// 删除优化生产中未开料的小板的优化数据
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLANID, deletePlanIds, processSize, ORDER_REMAIN_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLANID, deletePlanIds, processSize, ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), OptimizeBoardModelDO.class);
|
||||
|
||||
if(CollUtil.isNotEmpty(optimizeBoardModelDOS)){
|
||||
|
||||
@@ -1281,7 +1313,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
try {
|
||||
|
||||
esDocumentService.bulkUpdate(ORDER_REMAIN_PLATE_MODEL, optimizeBoardModelDOS);
|
||||
esDocumentService.bulkUpdate(ORDER_OPTIMIZE_PLATE_MODEL.getIndex(), optimizeBoardModelDOS);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
@@ -1326,7 +1358,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
planMapper.deleteBatchIds(noPlanIds);
|
||||
|
||||
// 删除排单对应的优化生产数据
|
||||
esUtils.deleteEsDocument(FIELD_PLANID,planIds,ORDER_REMAIN_PLATE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLANID,planIds,ORDER_OPTIMIZE_PLATE_MODEL.getIndex());
|
||||
|
||||
|
||||
}
|
||||
@@ -1349,30 +1381,50 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
List<Long> orderIds = planItemMapper.selectOrderPlateList(deleteOrderIds, getUserOrganId());
|
||||
|
||||
List<Long> diff = Stream.concat(
|
||||
orderIds.stream().filter(str -> !deleteOrderIds.contains(str)),
|
||||
deleteOrderIds.stream().filter(str -> !orderIds.contains(str)))
|
||||
.toList();
|
||||
List<Long> diff = Stream.concat(
|
||||
orderIds.stream().filter(str -> !deleteOrderIds.contains(str)),
|
||||
deleteOrderIds.stream().filter(str -> !orderIds.contains(str)))
|
||||
.toList();
|
||||
|
||||
if(CollUtil.isNotEmpty(diff)){
|
||||
if(CollUtil.isNotEmpty(diff)){
|
||||
|
||||
List<OrderDO> orderList = orderMapper.selectBatchIds(diff);
|
||||
List<OrderDO> orderList = orderMapper.selectBatchIds(diff);
|
||||
|
||||
orderList.forEach(f->f.setStatus(OrderStatusEnum.NEW_ORDER.getStatus()));
|
||||
orderList.forEach(f->f.setStatus(OrderStatusEnum.NEW_ORDER.getStatus()));
|
||||
|
||||
orderMapper.updateBatch(orderList);
|
||||
}
|
||||
orderMapper.updateBatch(orderList);
|
||||
}
|
||||
|
||||
// 去除生产单板材造型对应的排单ID
|
||||
// removePlateModelPlanId(deleteOrderIds,deletePlanIds,deletePlateIds);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertPlanPlate(List<OrderPlateIds> insertOrderPlateIds){
|
||||
public void insertPlanPlate(List<OrderPlateIds> insertOrderPlateIds,PlanActualGoodsModelDO planActualGoodsModelDO){
|
||||
|
||||
// 后面还需要看看是否需要进行混单的判断
|
||||
List<Long> insertPlanIds = insertOrderPlateIds.stream().map(OrderPlateIds::getPlanId).distinct().toList();
|
||||
|
||||
List<PlanDO> planDOS = validatePlanExists(insertPlanIds);
|
||||
|
||||
PlanDO planDO = validatePlan(insertPlanIds.get(0));
|
||||
|
||||
List<Long> orderIds = new ArrayList<>(insertOrderPlateIds.stream().map(OrderPlateIds::getOrderId).distinct().toList());
|
||||
|
||||
if(planActualGoodsModelDO != null){
|
||||
|
||||
List<Integer> mixedTypes = insertOrderPlateIds.stream().map(OrderPlateIds::getMixedType).distinct().toList();
|
||||
|
||||
Integer mixedType = mixedTypes.get(0) == null ? 0 : mixedTypes.get(0);
|
||||
|
||||
planDO.setType(PlanTypeEnum.MIXEDORDERPLAN.getType());
|
||||
planDO.setFilter(mixedType);
|
||||
|
||||
esUtils.saveEsDocument(PLAN_ACTUAL_GOODS_MODEL.getIndex(), Collections.singletonList(planActualGoodsModelDO));
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<PlanItemDO> planItemDOS = new ArrayList<>();
|
||||
|
||||
@@ -1386,19 +1438,17 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
});
|
||||
|
||||
planDOS.forEach(f->{
|
||||
|
||||
if(f.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||
f.setStatus(PlanStatusEnum.OPENING.getStatus());
|
||||
}
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||
|
||||
List<Long> orderIds = new ArrayList<>(insertOrderPlateIds.stream().map(OrderPlateIds::getOrderId).distinct().toList());
|
||||
planDO.setStatus(PlanStatusEnum.OPENING.getStatus());
|
||||
planDO.setProduceTime(null);
|
||||
}
|
||||
|
||||
orderIds.addAll(JSON.parseArray(f.getOrderNos()).toJavaList(Long.class).stream().distinct().toList());
|
||||
|
||||
f.setOrderNos(orderIds.stream().distinct().toList().toString());
|
||||
orderIds.addAll(JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class).stream().distinct().toList());
|
||||
|
||||
});
|
||||
planDO.setOrderNos(orderIds.stream().distinct().toList().toString());
|
||||
|
||||
|
||||
// 有新添加的小板,修改优化信息的字段信息
|
||||
@@ -1408,7 +1458,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
UpdateByQueryRequest.Builder builder = new UpdateByQueryRequest.Builder();
|
||||
|
||||
builder.index(ORDER_REMAIN_PLATE_MODEL)
|
||||
builder.index(ORDER_OPTIMIZE_PLATE_MODEL.getIndex())
|
||||
.query(qb -> qb.bool(bq -> bq.filter(f->{
|
||||
f.terms(t->t.field(FIELD_PLANID).terms(e->e.value(fieldValues)));
|
||||
return f;
|
||||
@@ -1435,7 +1485,19 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
planItemMapper.insertBatch(planItemDOS);
|
||||
|
||||
planMapper.updateBatch(planDOS);
|
||||
planMapper.update(new LambdaUpdateWrapper<PlanDO>()
|
||||
.eq(PlanDO::getOrganId,getUserOrganId())
|
||||
.eq(PlanDO::getId,planDO.getId())
|
||||
|
||||
.set(PlanDO::getProduceTime,planDO.getProduceTime())
|
||||
.set(PlanDO::getStatus,planDO.getStatus())
|
||||
.set(PlanDO::getType,planDO.getType())
|
||||
.set(PlanDO::getOrderNos,planDO.getOrderNos())
|
||||
.set(PlanDO::getFilter,planDO.getFilter())
|
||||
);
|
||||
|
||||
// 生产单板材造型信息增加排单ID
|
||||
// insertPlateModelPlanId(orderIds,insertPlateIds,insertPlanIds.get(0));
|
||||
|
||||
}
|
||||
|
||||
@@ -1445,8 +1507,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static Map<String, List<Long>> groupByMaterialAndThickness(List<SavePlanPlateList.GoodsItemList> items) {
|
||||
Map<String, List<Long>> groupedItems = new HashMap<>();
|
||||
|
||||
@@ -1657,15 +1717,14 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
UpdateByQueryRequest.Builder builder = new UpdateByQueryRequest.Builder();
|
||||
|
||||
List<FieldValue> fieldValues = planIds.stream().map(FieldValue::of).toList();
|
||||
|
||||
builder.index(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL)
|
||||
builder.index(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL.getName())
|
||||
.query(qb -> qb.bool(bq -> bq
|
||||
.must(mq -> mq.terms(tq -> tq.field(FIELD_PLANID).terms(t->t.value(fieldValues))))
|
||||
.must(mq -> mq.match(mtq -> mtq.field("machineType").query(MachineTypeEnum.CUTTING.getType())))
|
||||
.filter(mq -> mq.terms(tq -> tq.field(FIELD_PLANID).terms(t->t.value(fieldValues))))
|
||||
.filter(mq -> mq.match(mtq -> mtq.field("machineType").query(MachineTypeEnum.CUTTING.getType())))
|
||||
))
|
||||
.script(s -> s.inline(i -> i
|
||||
.source("ctx._source.isOptimized = params.new_value")
|
||||
@@ -1683,6 +1742,40 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void insertPlateModelPlanId(List<Long> orderIds,List<Long> plateIds,Long planId) {
|
||||
|
||||
try {
|
||||
|
||||
UpdateByQueryRequest.Builder builder = new UpdateByQueryRequest.Builder();
|
||||
|
||||
List<FieldValue> fieldValues1 = orderIds.stream().map(FieldValue::of).toList();
|
||||
List<FieldValue> fieldValues2 = plateIds.stream().map(FieldValue::of).toList();
|
||||
|
||||
builder.index(ORDER_PLATE_MODEL.getIndex())
|
||||
.query(qb -> qb.bool(bq -> bq
|
||||
.filter(f->f.terms(t->t.field("orderId").terms(ts->ts.value(fieldValues1))))
|
||||
.filter(f->f.terms(t->t.field("plateId").terms(ts->ts.value(fieldValues2))))
|
||||
))
|
||||
.script(s -> s.inline(i -> i
|
||||
.source("ctx._source.planId = params.new_value")
|
||||
.params("new_value", JsonData.of(planId))
|
||||
));
|
||||
|
||||
UpdateByQueryRequest request = builder.build();
|
||||
|
||||
// 执行更新操作
|
||||
elasticsearchClient.updateByQuery(request);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("排单加工方案状态更新异常:"+e.getMessage());
|
||||
throw new ServiceException(DATA_DATA_ERROR);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1690,8 +1783,53 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
|
||||
|
||||
|
||||
private void removePlateModelPlanId(List<Long> orderIds,List<Long> planIds,List<Long> plateIds) {
|
||||
|
||||
try {
|
||||
|
||||
UpdateByQueryRequest.Builder builder = new UpdateByQueryRequest.Builder();
|
||||
|
||||
List<FieldValue> fieldValues1 = orderIds.stream().map(FieldValue::of).toList();
|
||||
|
||||
List<FieldValue> fieldValues2 = planIds.stream().map(FieldValue::of).toList();
|
||||
|
||||
List<FieldValue> fieldValues3 = plateIds.stream().map(FieldValue::of).toList();
|
||||
|
||||
builder.index(ORDER_PLATE_MODEL.getIndex())
|
||||
.query(qb -> qb.bool(bq -> {
|
||||
bq.filter(f->f.terms(t->t.field("orderId").terms(ts->ts.value(fieldValues1))));
|
||||
bq.filter(f->f.terms(t->t.field(FIELD_PLANID).terms(ts->ts.value(fieldValues2))));
|
||||
|
||||
if(CollUtil.isNotEmpty(plateIds)){
|
||||
bq.filter(f->f.terms(t->t.field("plateId").terms(ts->ts.value(fieldValues3))));
|
||||
}
|
||||
|
||||
return bq;
|
||||
}
|
||||
))
|
||||
.script(s -> s.inline(i -> i
|
||||
.source("ctx._source.planId = params.new_value")
|
||||
.params("new_value", JsonData.of(0))
|
||||
));
|
||||
|
||||
UpdateByQueryRequest request = builder.build();
|
||||
|
||||
// 执行更新操作
|
||||
elasticsearchClient.updateByQuery(request);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("排单加工方案状态更新异常:"+e.getMessage());
|
||||
throw new ServiceException(DATA_DATA_ERROR);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void mergeOrderGoodsLists(List<OrderGoodsResp> list1, List<OrderGoodsResp> list2) {
|
||||
// Build a map for quick lookup of items in list1 by their unique properties
|
||||
Map<String, OrderGoodsResp> list1Map = new HashMap<>();
|
||||
for (OrderGoodsResp item1 : list1) {
|
||||
String key = generateKey(item1);
|
||||
|
||||
+100
-32
@@ -10,10 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.MixConfigTypeEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPlateCutStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPlateTypeEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanTypeEnum;
|
||||
import com.cf.imes.framework.common.enums.*;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
@@ -67,7 +64,8 @@ import java.util.stream.Collectors;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLAN_NOT_EXISTS;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.ORDER_PLATE_MODEL;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
/**
|
||||
* 生产单板件 Service 实现类
|
||||
@@ -125,10 +123,6 @@ public class PlateServiceImpl implements PlateService {
|
||||
@Resource
|
||||
private IdentifierGenerator identifierGenerator;
|
||||
|
||||
private static final String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
private static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
private static final String FIELD_PLATE_ID = "plateId";
|
||||
private static final String FIELD_OG_MATERIAL = "og.material";
|
||||
private static final String FIELD_OG_BRAND = "og.brand";
|
||||
@@ -301,35 +295,20 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
// 混单
|
||||
if(planDO.getType().equals(PlanTypeEnum.MIXEDORDERPLAN.getType())){
|
||||
// 相同材质和厚度
|
||||
if(planDO.getFilter().equals(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.getType())){
|
||||
queryWrapperX
|
||||
.inIfPresent(FIELD_OG_MATERIAL,material)
|
||||
.likeIfPresent(FIELD_OG_BRAND,pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR,pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS,thickness);
|
||||
|
||||
}
|
||||
// 相同厚度
|
||||
else {
|
||||
queryWrapperX
|
||||
.likeIfPresent(FIELD_OG_MATERIAL,pageReqVO.getMaterial())
|
||||
.likeIfPresent(FIELD_OG_BRAND,pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR,pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS,thickness);
|
||||
}
|
||||
// 混单添加查询条件
|
||||
mixedInsertQuery(pageReqVO,planDO,material,thickness,queryWrapperX);
|
||||
|
||||
}
|
||||
// 非混单
|
||||
else {
|
||||
queryWrapperX
|
||||
.inIfPresent(FIELD_OG_MATERIAL,material)
|
||||
.inIfPresent(FIELD_OG_BRAND,brand)
|
||||
.inIfPresent(FIELD_OG_COLOR,color)
|
||||
.inIfPresent(FIELD_OP_THICKNESS,thickness);
|
||||
}
|
||||
|
||||
// 非混单条件查询条件
|
||||
noMixedInsertQuery(pageReqVO,planDO,material,brand,color,thickness,queryWrapperX);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 无排单ID时
|
||||
else {
|
||||
|
||||
@@ -449,7 +428,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
.select(OrderItemDO::getBodyId)
|
||||
);
|
||||
List<Long> plateIds = list.stream().map(BodyPlateIdDTO::getPlateId).collect(Collectors.toList());
|
||||
List<OrderModelDO> orderModelDOS = buildRespByPlateIds(plateIds, ORDER_PLATE_MODEL);
|
||||
List<OrderModelDO> orderModelDOS = buildRespByPlateIds(plateIds, ORDER_PLATE_MODEL.getIndex());
|
||||
Map<Long, List<OrderModelDO>> map = orderModelDOS.stream().collect(Collectors.groupingBy(e -> {
|
||||
return list.stream().filter(f -> Objects.equals(f.getPlateId(), e.getPlateId())).map(BodyPlateIdDTO::getBodyId).findAny().orElse(null);
|
||||
}));
|
||||
@@ -662,4 +641,93 @@ public class PlateServiceImpl implements PlateService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void mixedInsertQuery(NoPlanPlatePageReqVO pageReqVO,
|
||||
PlanDO planDO,
|
||||
List<String> material,
|
||||
List<BigDecimal> thickness,
|
||||
QueryWrapperX<OrderDO> queryWrapperX){
|
||||
|
||||
|
||||
|
||||
if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){
|
||||
throw exception(PLAN_IS_MIXED_ERROR);
|
||||
}
|
||||
|
||||
// 相同材质和厚度
|
||||
if(planDO.getFilter().equals(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.getType())){
|
||||
|
||||
queryWrapperX
|
||||
.inIfPresent(FIELD_OG_MATERIAL,material)
|
||||
.likeIfPresent(FIELD_OG_BRAND,pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR,pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS,thickness);
|
||||
|
||||
}
|
||||
// 相同厚度
|
||||
else {
|
||||
|
||||
queryWrapperX
|
||||
.likeIfPresent(FIELD_OG_MATERIAL,pageReqVO.getMaterial())
|
||||
.likeIfPresent(FIELD_OG_BRAND,pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR,pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS,thickness);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void noMixedInsertQuery(NoPlanPlatePageReqVO pageReqVO,
|
||||
PlanDO planDO,
|
||||
List<String> material,
|
||||
List<String> brand,
|
||||
List<String> color,
|
||||
List<BigDecimal> thickness,
|
||||
QueryWrapperX<OrderDO> queryWrapperX){
|
||||
|
||||
// 是否开启混单
|
||||
if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){
|
||||
|
||||
if(!planDO.getStatus().equals(PlanStatusEnum.NOCUTTING.getStatus())){
|
||||
throw exception(PLAN_PLATE_IS_CUTTING);
|
||||
}
|
||||
|
||||
// 相同材质和厚度 混单
|
||||
if(pageReqVO.getMixedType().equals(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.getType())){
|
||||
queryWrapperX
|
||||
.inIfPresent(FIELD_OG_MATERIAL, material)
|
||||
.likeIfPresent(FIELD_OG_BRAND, pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR, pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS, thickness);
|
||||
|
||||
}
|
||||
// 相同厚度 混单
|
||||
else{
|
||||
queryWrapperX
|
||||
.likeIfPresent(FIELD_OG_MATERIAL, pageReqVO.getMaterial())
|
||||
.likeIfPresent(FIELD_OG_BRAND, pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR, pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS, thickness);
|
||||
|
||||
}
|
||||
}else {
|
||||
queryWrapperX
|
||||
.inIfPresent(FIELD_OG_MATERIAL, material)
|
||||
.inIfPresent(FIELD_OG_BRAND, brand)
|
||||
.inIfPresent(FIELD_OG_COLOR, color)
|
||||
.inIfPresent(FIELD_OP_THICKNESS, thickness);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+7
@@ -69,6 +69,13 @@ spring:
|
||||
database: 0 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
||||
|
||||
# 发票文件保存路径
|
||||
invoice:
|
||||
filepath: E:\ceshi123\
|
||||
|
||||
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?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.funds.balancedetails.IncomeExpenseDetailsMapper">
|
||||
|
||||
|
||||
<select id="selectOrganInvoicable"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.funds.invoice.vo.InvoiceDetailsRespVO">
|
||||
|
||||
select distinct ied.business_no as businessNo,
|
||||
ied.trade_type as tradeType,
|
||||
ied.create_time as createTime,
|
||||
ied.cash_amount_change as rechargeAmount,
|
||||
pr.id as purchaseRecordId
|
||||
from income_expense_details ied
|
||||
left join purchase_record pr on ied.organId = pr.organId and ied.purchase_id = pr.id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<?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.funds.invoice.InvoiceRecordsMapper">
|
||||
|
||||
|
||||
<select id="selectToExamineAmount" resultType="java.math.BigDecimal">
|
||||
|
||||
|
||||
select sum(invoice_amount)
|
||||
|
||||
from invoice_records
|
||||
|
||||
where deleted = false
|
||||
and status = #{status}
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
<?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.funds.purchase.PurchaseRecordMapper">
|
||||
|
||||
|
||||
<select id="selectOrganInvoice"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.funds.invoice.vo.InvoiceAmountRespVO">
|
||||
|
||||
|
||||
select
|
||||
sum(case when is_invocing = 1 then account_balance_spent + alipay_spent + wechat_spent end ) as inTheInvoice,
|
||||
sum(case when is_invocing = 2 then account_balance_spent + alipay_spent + wechat_spent end ) as invoiced
|
||||
|
||||
from purchase_record
|
||||
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPurchaseRecord"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.funds.invoice.vo.InvoicePurchaseRecord">
|
||||
|
||||
|
||||
select distinct pr.id as purchaseRecordId,
|
||||
pr.create_time as createTime,
|
||||
pr.product_name as productName,
|
||||
ied.cash_amount_change as rechargeAmount,
|
||||
ied.trade_type as tradeType,
|
||||
ied.business_no as businessNo
|
||||
|
||||
from purchase_record pr
|
||||
join income_expense_details ied on pr.organId = ied.organId and ied.purchase_id = pr.id
|
||||
where pr.organId = #{organId}
|
||||
and pr.deleted = false
|
||||
and pr.id in
|
||||
<foreach item="purchaseIdList" collection="purchaseIdList" open="(" separator="," close=")">
|
||||
#{purchaseIdList}
|
||||
</foreach>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
+24
-1
@@ -38,7 +38,7 @@
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
group by o.id
|
||||
group by o.id,o.order_date,o.delivery_date,o.customer,o.address,o.custom_order_no,o.status
|
||||
order by o.id desc
|
||||
limit #{pageNo},#{pageSize};
|
||||
|
||||
@@ -584,4 +584,27 @@
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectPlanGoodsList"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.SavePlanPlateList$GoodsItemList">
|
||||
|
||||
|
||||
select distinct
|
||||
|
||||
og.id,
|
||||
og.goods_id,
|
||||
og.color,
|
||||
og.material,
|
||||
og.thickness
|
||||
|
||||
from order_plan_item opi
|
||||
join order_goods og on opi.organ_id = og.organ_id and opi.order_id = og.order_id and opi.goods_id = og.id
|
||||
|
||||
where opi.organ_id = #{organId}
|
||||
and opi.plan_id = #{planId}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
+1
-5
@@ -447,11 +447,7 @@
|
||||
|
||||
where op.organ_id = #{organId}
|
||||
and op.deleted = false
|
||||
|
||||
and op.order_id in
|
||||
<foreach collection="orderIds" item="orderIds" open="(" close=")" separator=",">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
and op.order_id = #{orderId}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user