Showing
28 changed files
with
1768 additions
and
5 deletions
| @@ -2290,3 +2290,57 @@ CREATE TABLE domestic_plan_summary_detail | @@ -2290,3 +2290,57 @@ CREATE TABLE domestic_plan_summary_detail | ||
| 2290 | KEY idx_dpsd_summary_id (summary_id), | 2290 | KEY idx_dpsd_summary_id (summary_id), |
| 2291 | KEY idx_dpsd_plan_id (plan_id) | 2291 | KEY idx_dpsd_plan_id (plan_id) |
| 2292 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='内贸计划明细汇总明细表'; | 2292 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='内贸计划明细汇总明细表'; |
| 2293 | + | ||
| 2294 | +CREATE TABLE `coordination_summary_approval` | ||
| 2295 | +( | ||
| 2296 | + `id` varchar(32) NOT NULL COMMENT '主键ID', | ||
| 2297 | + `code` varchar(32) NOT NULL COMMENT '编号', | ||
| 2298 | + `summary_date` date NOT NULL COMMENT '汇总生成日期(年月日)', | ||
| 2299 | + `total_quantity` decimal(18, 4) DEFAULT NULL COMMENT '合计', | ||
| 2300 | + `weighted_avg_coordination` decimal(18, 6) DEFAULT NULL COMMENT '吨超协加权平均 Σ(吨超协*数量)/Σ数量', | ||
| 2301 | + `approval_status` varchar(20) DEFAULT NULL COMMENT '审核状态', | ||
| 2302 | + `process_node` varchar(50) DEFAULT NULL COMMENT '流程节点', | ||
| 2303 | + `general_manager_name` varchar(50) DEFAULT NULL COMMENT '总经理姓名', | ||
| 2304 | + `management_dept_name` varchar(50) DEFAULT NULL COMMENT '供应管理科主管', | ||
| 2305 | + `create_by_id` varchar(32) DEFAULT NULL, | ||
| 2306 | + `create_by` varchar(50) DEFAULT NULL, | ||
| 2307 | + `update_by_id` varchar(32) DEFAULT NULL, | ||
| 2308 | + `update_by` varchar(50) DEFAULT NULL, | ||
| 2309 | + `create_time` datetime DEFAULT NULL, | ||
| 2310 | + `update_time` datetime DEFAULT NULL, | ||
| 2311 | + PRIMARY KEY (`id`), | ||
| 2312 | + UNIQUE KEY `uk_csa_code` (`code`), | ||
| 2313 | + KEY `idx_csa_summary_date` (`summary_date`), | ||
| 2314 | + KEY `idx_csa_approval_status` (`approval_status`) | ||
| 2315 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='采购吨超协汇总审批表'; | ||
| 2316 | + | ||
| 2317 | +CREATE TABLE `coordination_summary_approval_line` | ||
| 2318 | +( | ||
| 2319 | + `id` varchar(32) NOT NULL COMMENT '主键ID', | ||
| 2320 | + `approval_id` varchar(32) NOT NULL COMMENT '审批表主表ID', | ||
| 2321 | + `order_no` int NOT NULL COMMENT '排序号', | ||
| 2322 | + `plan_create_date` date DEFAULT NULL COMMENT '计划创建日期(年-月-日)', | ||
| 2323 | + `purchase_dept_id` varchar(32) DEFAULT NULL COMMENT '采购处ID', | ||
| 2324 | + `supplier_name` VARCHAR(200) NOT NULL COMMENT '客户名称(供应商简称)', | ||
| 2325 | + `plan_id` varchar(32) DEFAULT NULL COMMENT '原采购计划ID', | ||
| 2326 | + `plan_code` varchar(32) DEFAULT NULL COMMENT '订单编号(原计划编号)', | ||
| 2327 | + `product_id` varchar(32) DEFAULT NULL COMMENT '品种ID', | ||
| 2328 | + `quantity` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '数量(吨)', | ||
| 2329 | + `actual_purchase_price` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '实际采购价(元/吨)', | ||
| 2330 | + `shipping_cost` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '运费(元/吨)', | ||
| 2331 | + `price_with_shipping` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '单价(含运) = 实际采购价 + 运费', | ||
| 2332 | + `workshop_id` varchar(32) DEFAULT NULL COMMENT '分厂ID', | ||
| 2333 | + `coordination_range` decimal(18, 6) NOT NULL DEFAULT 0.000000 COMMENT '吨超协(协调幅度)', | ||
| 2334 | + `remark_flag` varchar(50) DEFAULT NULL COMMENT '备注标记 空/买断/补单/买断 补单', | ||
| 2335 | + `plan_line_id` varchar(32) DEFAULT NULL COMMENT '原计划明细行ID', | ||
| 2336 | + `approval_pass_time` datetime DEFAULT NULL COMMENT '原计划审核通过时间', | ||
| 2337 | + `create_by_id` varchar(32) DEFAULT NULL, | ||
| 2338 | + `create_by` varchar(50) DEFAULT NULL, | ||
| 2339 | + `update_by_id` varchar(32) DEFAULT NULL, | ||
| 2340 | + `update_by` varchar(50) DEFAULT NULL, | ||
| 2341 | + `create_time` datetime DEFAULT NULL, | ||
| 2342 | + `update_time` datetime DEFAULT NULL, | ||
| 2343 | + PRIMARY KEY (`id`), | ||
| 2344 | + KEY `idx_csal_approval_id` (`approval_id`), | ||
| 2345 | + KEY `idx_csal_plan_id` (`plan_id`) | ||
| 2346 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='采购吨超协汇总审批表明细'; |
| 1 | +package com.lframework.xingyun.sc.bo.procurement; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.starter.common.constants.StringPool; | ||
| 5 | +import com.lframework.starter.web.core.bo.BaseBo; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApproval; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | +import java.time.LocalDate; | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | +import java.util.List; | ||
| 12 | +import lombok.Data; | ||
| 13 | + | ||
| 14 | +@Data | ||
| 15 | +public class GetCoordinationSummaryApprovalBo extends BaseBo<CoordinationSummaryApproval> { | ||
| 16 | + | ||
| 17 | + @ApiModelProperty("ID") | ||
| 18 | + private String id; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty("编号") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty("汇总生成日期") | ||
| 24 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | ||
| 25 | + private LocalDate summaryDate; | ||
| 26 | + | ||
| 27 | + @ApiModelProperty("合计 数量合计") | ||
| 28 | + private BigDecimal totalQuantity; | ||
| 29 | + | ||
| 30 | + @ApiModelProperty("吨超协加权平均") | ||
| 31 | + private BigDecimal weightedAvgCoordination; | ||
| 32 | + | ||
| 33 | + @ApiModelProperty("审核状态 AUDIT/PASS/REFUSE/CANCEL") | ||
| 34 | + private String approvalStatus; | ||
| 35 | + | ||
| 36 | + @ApiModelProperty("流程节点") | ||
| 37 | + private String processNode; | ||
| 38 | + | ||
| 39 | + @ApiModelProperty("总经理审核人") | ||
| 40 | + private String generalManagerName; | ||
| 41 | + | ||
| 42 | + @ApiModelProperty("管理科审核人") | ||
| 43 | + private String managementDeptName; | ||
| 44 | + | ||
| 45 | + @ApiModelProperty("备注") | ||
| 46 | + private String remark; | ||
| 47 | + | ||
| 48 | + @ApiModelProperty("是否展示审核按钮 前端用") | ||
| 49 | + private Boolean showExamine; | ||
| 50 | + | ||
| 51 | + @ApiModelProperty("是否展示审核详情按钮") | ||
| 52 | + private Boolean showExamineDetail; | ||
| 53 | + | ||
| 54 | + @ApiModelProperty("创建人") | ||
| 55 | + private String createBy; | ||
| 56 | + | ||
| 57 | + @ApiModelProperty("创建时间") | ||
| 58 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 59 | + private LocalDateTime createTime; | ||
| 60 | + | ||
| 61 | + @ApiModelProperty("明细列表") | ||
| 62 | + private List<GetCoordinationSummaryApprovalLineBo> lines; | ||
| 63 | + | ||
| 64 | + @ApiModelProperty("明细底部合计行:数量合计 非持久化") | ||
| 65 | + private BigDecimal totalQuantitySum; | ||
| 66 | + | ||
| 67 | + @ApiModelProperty("明细底部合计行:吨超协加权平均 非持久化") | ||
| 68 | + private BigDecimal weightedAvgCoordinationAtBottom; | ||
| 69 | + | ||
| 70 | + public GetCoordinationSummaryApprovalBo() { | ||
| 71 | + super(); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + public GetCoordinationSummaryApprovalBo(CoordinationSummaryApproval dto) { | ||
| 75 | + super(dto); | ||
| 76 | + } | ||
| 77 | +} |
| 1 | +package com.lframework.xingyun.sc.bo.procurement; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.starter.common.constants.StringPool; | ||
| 5 | +import com.lframework.starter.web.core.bo.BaseBo; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApprovalLine; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | +import java.time.LocalDate; | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +import lombok.Data; | ||
| 13 | + | ||
| 14 | +@Data | ||
| 15 | +public class GetCoordinationSummaryApprovalLineBo extends BaseBo<CoordinationSummaryApprovalLine> { | ||
| 16 | + | ||
| 17 | + @ApiModelProperty("主键ID") | ||
| 18 | + private String id; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty("审批表主表ID") | ||
| 21 | + private String approvalId; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty("序号(从1开始 手动赋值) 非持久化") | ||
| 24 | + private Integer seq; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty("计划创建日期") | ||
| 27 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | ||
| 28 | + private LocalDate planCreateDate; | ||
| 29 | + | ||
| 30 | + @ApiModelProperty("采购处ID") | ||
| 31 | + private String purchaseDeptId; | ||
| 32 | + | ||
| 33 | + @ApiModelProperty("采购处") | ||
| 34 | + private String purchaseDeptName; | ||
| 35 | + | ||
| 36 | + @ApiModelProperty("客户名称") | ||
| 37 | + private String supplierName; | ||
| 38 | + | ||
| 39 | + @ApiModelProperty("原采购计划ID") | ||
| 40 | + private String planId; | ||
| 41 | + | ||
| 42 | + @ApiModelProperty("订单编号") | ||
| 43 | + private String planCode; | ||
| 44 | + | ||
| 45 | + @ApiModelProperty("品种ID") | ||
| 46 | + private String productId; | ||
| 47 | + | ||
| 48 | + @ApiModelProperty("品种") | ||
| 49 | + private String productName; | ||
| 50 | + | ||
| 51 | + @ApiModelProperty("数量") | ||
| 52 | + private BigDecimal quantity; | ||
| 53 | + | ||
| 54 | + @ApiModelProperty("实际采购价(元/吨)") | ||
| 55 | + private BigDecimal actualPurchasePrice; | ||
| 56 | + | ||
| 57 | + @ApiModelProperty("运费(元/吨)") | ||
| 58 | + private BigDecimal shippingCost; | ||
| 59 | + | ||
| 60 | + @ApiModelProperty("单价(含运)=实际采购价+运费") | ||
| 61 | + private BigDecimal priceWithShipping; | ||
| 62 | + | ||
| 63 | + @ApiModelProperty("分厂ID") | ||
| 64 | + private String workshopId; | ||
| 65 | + | ||
| 66 | + @ApiModelProperty("分厂") | ||
| 67 | + private String workshopName; | ||
| 68 | + | ||
| 69 | + @ApiModelProperty("吨超协") | ||
| 70 | + private BigDecimal coordinationRange; | ||
| 71 | + | ||
| 72 | + @ApiModelProperty("原计划明细行ID") | ||
| 73 | + private String planLineId; | ||
| 74 | + | ||
| 75 | + @ApiModelProperty("原计划审核通过时间") | ||
| 76 | + private LocalDateTime approvalPassTime; | ||
| 77 | + | ||
| 78 | + @ApiModelProperty("与平均对比=吨超协-吨超协加权平均 正=前端标红 非持久化") | ||
| 79 | + private BigDecimal compareWithAvg; | ||
| 80 | + | ||
| 81 | + @ApiModelProperty("备注:有买断显示买断 有补单显示补单 同时有显示买断 补单") | ||
| 82 | + private String remarkLabel; | ||
| 83 | + | ||
| 84 | + public GetCoordinationSummaryApprovalLineBo() { | ||
| 85 | + super(); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public GetCoordinationSummaryApprovalLineBo(CoordinationSummaryApprovalLine dto) { | ||
| 89 | + super(dto); | ||
| 90 | + } | ||
| 91 | +} |
| @@ -21,6 +21,7 @@ import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | @@ -21,6 +21,7 @@ import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | ||
| 21 | import com.lframework.xingyun.sc.procurement.entity.ProcurementDomesticCustomerCredit; | 21 | import com.lframework.xingyun.sc.procurement.entity.ProcurementDomesticCustomerCredit; |
| 22 | import com.lframework.xingyun.sc.procurement.entity.ProcurementForeignTradeCredit; | 22 | import com.lframework.xingyun.sc.procurement.entity.ProcurementForeignTradeCredit; |
| 23 | import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService; | 23 | import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService; |
| 24 | +import com.lframework.xingyun.sc.procurement.service.coordination.CoordinationSummaryApprovalService; | ||
| 24 | import com.lframework.xingyun.sc.procurement.service.credit.ProcurementDomesticCustomerCreditService; | 25 | import com.lframework.xingyun.sc.procurement.service.credit.ProcurementDomesticCustomerCreditService; |
| 25 | import com.lframework.xingyun.sc.procurement.service.credit.ProcurementForeignTradeCreditService; | 26 | import com.lframework.xingyun.sc.procurement.service.credit.ProcurementForeignTradeCreditService; |
| 26 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; | 27 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; |
| @@ -165,6 +166,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -165,6 +166,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 165 | private ProcurementPlanChangeService procurementPlanChangeService; | 166 | private ProcurementPlanChangeService procurementPlanChangeService; |
| 166 | @Resource | 167 | @Resource |
| 167 | private ProcurementPlanReplenishService procurementPlanReplenishService; | 168 | private ProcurementPlanReplenishService procurementPlanReplenishService; |
| 169 | + @Resource | ||
| 170 | + private CoordinationSummaryApprovalService coordinationSummaryApprovalService; | ||
| 168 | 171 | ||
| 169 | 172 | ||
| 170 | 173 | ||
| @@ -264,6 +267,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -264,6 +267,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 264 | case "PLAN_REPLENISH": | 267 | case "PLAN_REPLENISH": |
| 265 | handleProcurementPlanReplenishData(flowStatus, businessId); | 268 | handleProcurementPlanReplenishData(flowStatus, businessId); |
| 266 | break; | 269 | break; |
| 270 | + case "XT_APPROVAL": | ||
| 271 | + handleCoordinationSummaryApprovalData(flowStatus, businessId); | ||
| 272 | + break; | ||
| 267 | default: | 273 | default: |
| 268 | break; | 274 | break; |
| 269 | } | 275 | } |
| @@ -1192,4 +1198,14 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -1192,4 +1198,14 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 1192 | } | 1198 | } |
| 1193 | } | 1199 | } |
| 1194 | 1200 | ||
| 1201 | + private void handleCoordinationSummaryApprovalData(String flowStatus, String businessId) { | ||
| 1202 | + if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) | ||
| 1203 | + || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { | ||
| 1204 | + coordinationSummaryApprovalService.updateApprovalStatus(businessId, "PASS"); | ||
| 1205 | + } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) | ||
| 1206 | + || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus) | ||
| 1207 | + || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) { | ||
| 1208 | + coordinationSummaryApprovalService.updateApprovalStatus(businessId, "REFUSE"); | ||
| 1209 | + } | ||
| 1210 | + } | ||
| 1195 | } | 1211 | } |
| @@ -19,6 +19,7 @@ import com.lframework.xingyun.sc.entity.ProductSampleConfirmationSlip; | @@ -19,6 +19,7 @@ import com.lframework.xingyun.sc.entity.ProductSampleConfirmationSlip; | ||
| 19 | import com.lframework.xingyun.sc.handlers.TransactorHandler; | 19 | import com.lframework.xingyun.sc.handlers.TransactorHandler; |
| 20 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange; | 20 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange; |
| 21 | import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService; | 21 | import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService; |
| 22 | +import com.lframework.xingyun.sc.procurement.service.coordination.CoordinationSummaryApprovalService; | ||
| 22 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; | 23 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; |
| 23 | import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService; | 24 | import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService; |
| 24 | import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo; | 25 | import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo; |
| @@ -70,6 +71,8 @@ public class FlowTaskServiceImpl implements FlowTaskService { | @@ -70,6 +71,8 @@ public class FlowTaskServiceImpl implements FlowTaskService { | ||
| 70 | private ProcurementPlanChangeService procurementPlanChangeService; | 71 | private ProcurementPlanChangeService procurementPlanChangeService; |
| 71 | @Resource | 72 | @Resource |
| 72 | private ProcurementPlanReplenishService procurementPlanReplenishService; | 73 | private ProcurementPlanReplenishService procurementPlanReplenishService; |
| 74 | + @Resource | ||
| 75 | + private CoordinationSummaryApprovalService coordinationSummaryApprovalService; | ||
| 73 | 76 | ||
| 74 | 77 | ||
| 75 | @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"}) | 78 | @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"}) |
| @@ -469,6 +472,12 @@ public class FlowTaskServiceImpl implements FlowTaskService { | @@ -469,6 +472,12 @@ public class FlowTaskServiceImpl implements FlowTaskService { | ||
| 469 | procurementPlanReplenishService.updateNoFlowInstance(map); | 472 | procurementPlanReplenishService.updateNoFlowInstance(map); |
| 470 | } | 473 | } |
| 471 | 474 | ||
| 475 | + @Transactional(rollbackFor = Exception.class) | ||
| 476 | + @Override | ||
| 477 | + public void updateCoordinationSummaryApprovalMap(Map<String, Object> map) { | ||
| 478 | + coordinationSummaryApprovalService.updateNoFlowInstance(map); | ||
| 479 | + } | ||
| 480 | + | ||
| 472 | @Override | 481 | @Override |
| 473 | public Map<String, Object> findById(String s) { | 482 | public Map<String, Object> findById(String s) { |
| 474 | ProductSampleConfirmationSlip slip = productSampleConfirmationSlipService.findById(s); | 483 | ProductSampleConfirmationSlip slip = productSampleConfirmationSlipService.findById(s); |
| 1 | +package com.lframework.xingyun.sc.procurement.controller.coordination; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.annotations.security.HasPermission; | ||
| 4 | +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | ||
| 5 | +import com.lframework.starter.web.core.controller.DefaultBaseController; | ||
| 6 | +import com.lframework.starter.web.core.components.resp.InvokeResult; | ||
| 7 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 8 | +import com.lframework.xingyun.sc.bo.procurement.GetCoordinationSummaryApprovalBo; | ||
| 9 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApproval; | ||
| 10 | +import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummary; | ||
| 11 | +import com.lframework.xingyun.sc.procurement.service.coordination.CoordinationSummaryApprovalService; | ||
| 12 | +import com.lframework.xingyun.sc.procurement.vo.coordination.CreateCoordinationSummaryApprovalVo; | ||
| 13 | +import com.lframework.xingyun.sc.procurement.vo.coordination.QueryCandidateLineVo; | ||
| 14 | +import com.lframework.xingyun.sc.procurement.vo.coordination.QueryCoordinationSummaryApprovalVo; | ||
| 15 | +import com.lframework.xingyun.sc.procurement.vo.coordination.UpdateCoordinationSummaryApprovalVo; | ||
| 16 | +import com.lframework.xingyun.sc.procurement.vo.summary.QueryDomesticPlanSummaryVo; | ||
| 17 | +import io.swagger.annotations.Api; | ||
| 18 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 19 | +import io.swagger.annotations.ApiOperation; | ||
| 20 | +import java.util.List; | ||
| 21 | +import java.util.Map; | ||
| 22 | +import javax.annotation.Resource; | ||
| 23 | +import javax.validation.Valid; | ||
| 24 | +import javax.validation.constraints.NotBlank; | ||
| 25 | +import lombok.extern.slf4j.Slf4j; | ||
| 26 | +import org.springframework.validation.annotation.Validated; | ||
| 27 | +import org.springframework.web.bind.annotation.*; | ||
| 28 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 29 | + | ||
| 30 | +@Api(tags = "采购吨超协汇总审批表管理") | ||
| 31 | +@Slf4j | ||
| 32 | +@Validated | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("/procurement/coordination/summary") | ||
| 35 | +public class CoordinationSummaryApprovalController extends DefaultBaseController { | ||
| 36 | + | ||
| 37 | + @Resource | ||
| 38 | + private CoordinationSummaryApprovalService coordinationSummaryApprovalService; | ||
| 39 | + | ||
| 40 | + @ApiOperation("分页查询采购吨超协汇总审批表") | ||
| 41 | + @HasPermission({"plan-manage:approval-form:query"}) | ||
| 42 | + @GetMapping("/query") | ||
| 43 | + public InvokeResult<PageResult<CoordinationSummaryApproval>> query( | ||
| 44 | + @Valid QueryCoordinationSummaryApprovalVo vo) { | ||
| 45 | + return InvokeResultBuilder.success(coordinationSummaryApprovalService.query(getPageIndex(vo), getPageSize(vo), vo)); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @ApiOperation("查询采购吨超协汇总审批表详情") | ||
| 49 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) | ||
| 50 | + @HasPermission({"plan-manage:approval-form:query","plan-manage:approval-form:review"}) | ||
| 51 | + @GetMapping("") | ||
| 52 | + public InvokeResult<GetCoordinationSummaryApprovalBo> findById(@NotBlank(message = "ID不能为空!") String id) { | ||
| 53 | + return InvokeResultBuilder.success(coordinationSummaryApprovalService.findDetail(id)); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @ApiOperation("第一步:按日期筛选 DomesticPlanSummary(内贸计划明细汇总表) 列表,前端拿到 id 后再查候选明细") | ||
| 57 | + @GetMapping("/queryDomesticPlanSummaryList") | ||
| 58 | + public InvokeResult<List<DomesticPlanSummary>> queryDomesticPlanSummaryList( | ||
| 59 | + @Valid QueryDomesticPlanSummaryVo vo) { | ||
| 60 | + return InvokeResultBuilder.success(coordinationSummaryApprovalService.queryDomesticPlanSummaryList(vo)); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @ApiOperation("第二步:根据 DomesticPlanSummary ID + 协调幅度区间 查询候选勾选明细 数据来源DomesticPlanSummaryDetail") | ||
| 64 | + @GetMapping("/queryCandidateLines") | ||
| 65 | + public InvokeResult<List<Map<String, Object>>> queryCandidateLines(@Valid QueryCandidateLineVo vo) { | ||
| 66 | + return InvokeResultBuilder.success(coordinationSummaryApprovalService.queryCandidateLines(vo)); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @ApiOperation("新增采购吨超协汇总审批表(草稿)") | ||
| 70 | + @HasPermission({"plan-manage:approval-form:add"}) | ||
| 71 | + @PostMapping("/create") | ||
| 72 | + public InvokeResult<String> create(@RequestBody @Valid CreateCoordinationSummaryApprovalVo vo) { | ||
| 73 | + return InvokeResultBuilder.success(coordinationSummaryApprovalService.create(vo)); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @ApiOperation("修改采购吨超协汇总审批表") | ||
| 77 | + @HasPermission({"plan-manage:approval-form:modify","plan-manage:approval-form:approve"}) | ||
| 78 | + @PutMapping("") | ||
| 79 | + public InvokeResult<Void> update(@RequestBody @Valid UpdateCoordinationSummaryApprovalVo vo) { | ||
| 80 | + coordinationSummaryApprovalService.update(vo); | ||
| 81 | + return InvokeResultBuilder.success(); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + @ApiOperation("取消采购吨超协汇总审批表") | ||
| 85 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) | ||
| 86 | + @HasPermission({"plan-manage:approval-form:cancel"}) | ||
| 87 | + @PutMapping("/cancel") | ||
| 88 | + public InvokeResult<Void> cancel(@NotBlank(message = "ID不能为空!") String id) { | ||
| 89 | + coordinationSummaryApprovalService.cancel(id); | ||
| 90 | + return InvokeResultBuilder.success(); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @ApiOperation("提交审核采购吨超协汇总审批表") | ||
| 94 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) | ||
| 95 | + @HasPermission({"plan-manage:approval-form:submit"}) | ||
| 96 | + @PutMapping("/submit") | ||
| 97 | + public InvokeResult<Void> submit(@NotBlank(message = "ID不能为空!") String id) { | ||
| 98 | + coordinationSummaryApprovalService.submit(id); | ||
| 99 | + return InvokeResultBuilder.success(); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + @ApiOperation("打印采购吨超协汇总审批表") | ||
| 103 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) | ||
| 104 | + @HasPermission({"plan-manage:approval-form:print"}) | ||
| 105 | + @GetMapping("/print") | ||
| 106 | + public InvokeResult<GetCoordinationSummaryApprovalBo> print(@NotBlank(message = "ID不能为空!") String id) { | ||
| 107 | + return InvokeResultBuilder.success(coordinationSummaryApprovalService.findDetail(id)); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | +} |
| @@ -40,7 +40,7 @@ public class DomesticPlanSummaryController extends DefaultBaseController { | @@ -40,7 +40,7 @@ public class DomesticPlanSummaryController extends DefaultBaseController { | ||
| 40 | private DomesticPlanSummaryService domesticPlanSummaryService; | 40 | private DomesticPlanSummaryService domesticPlanSummaryService; |
| 41 | 41 | ||
| 42 | @ApiOperation("分页查询内贸计划明细汇总表列表") | 42 | @ApiOperation("分页查询内贸计划明细汇总表列表") |
| 43 | - @HasPermission({"plan-manage:domestic-plan-summary:query"}) | 43 | + @HasPermission({"plan-manage:detail-form:query"}) |
| 44 | @GetMapping("/query") | 44 | @GetMapping("/query") |
| 45 | public InvokeResult<PageResult<DomesticPlanSummary>> query(@Valid QueryDomesticPlanSummaryVo vo) { | 45 | public InvokeResult<PageResult<DomesticPlanSummary>> query(@Valid QueryDomesticPlanSummaryVo vo) { |
| 46 | PageResult<DomesticPlanSummary> result = domesticPlanSummaryService.query(getPageIndex(vo), getPageSize(vo), vo); | 46 | PageResult<DomesticPlanSummary> result = domesticPlanSummaryService.query(getPageIndex(vo), getPageSize(vo), vo); |
| @@ -49,7 +49,7 @@ public class DomesticPlanSummaryController extends DefaultBaseController { | @@ -49,7 +49,7 @@ public class DomesticPlanSummaryController extends DefaultBaseController { | ||
| 49 | 49 | ||
| 50 | @ApiOperation("查询内贸计划明细汇总表详情") | 50 | @ApiOperation("查询内贸计划明细汇总表详情") |
| 51 | @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) | 51 | @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) |
| 52 | - @HasPermission({"plan-manage:domestic-plan-summary:query","plan-manage:domestic-plan-summary:view"}) | 52 | + @HasPermission({"plan-manage:detail-form:query"}) |
| 53 | @GetMapping("") | 53 | @GetMapping("") |
| 54 | public InvokeResult<GetDomesticPlanSummaryBo> findById(@NotBlank(message = "ID不能为空!") String id) { | 54 | public InvokeResult<GetDomesticPlanSummaryBo> findById(@NotBlank(message = "ID不能为空!") String id) { |
| 55 | GetDomesticPlanSummaryBo result = domesticPlanSummaryService.findDetail(id); | 55 | GetDomesticPlanSummaryBo result = domesticPlanSummaryService.findDetail(id); |
| @@ -58,7 +58,7 @@ public class DomesticPlanSummaryController extends DefaultBaseController { | @@ -58,7 +58,7 @@ public class DomesticPlanSummaryController extends DefaultBaseController { | ||
| 58 | 58 | ||
| 59 | @ApiOperation("触发生成内贸计划明细汇总表(补跑)") | 59 | @ApiOperation("触发生成内贸计划明细汇总表(补跑)") |
| 60 | @ApiImplicitParam(value = "生成日期(yyyy-MM-dd 默认当天)", name = "date", paramType = "query", required = false) | 60 | @ApiImplicitParam(value = "生成日期(yyyy-MM-dd 默认当天)", name = "date", paramType = "query", required = false) |
| 61 | - @HasPermission({"plan-manage:domestic-plan-summary:add"}) | 61 | + @HasPermission({"plan-manage:detail-form:add"}) |
| 62 | @PostMapping("/generate") | 62 | @PostMapping("/generate") |
| 63 | public InvokeResult<String> generate( | 63 | public InvokeResult<String> generate( |
| 64 | @RequestParam(required = false) @DateTimeFormat(pattern = StringPool.DATE_PATTERN) LocalDate date) { | 64 | @RequestParam(required = false) @DateTimeFormat(pattern = StringPool.DATE_PATTERN) LocalDate date) { |
| 1 | +package com.lframework.xingyun.sc.procurement.entity.coordination; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import com.lframework.starter.web.core.dto.BaseDto; | ||
| 7 | +import com.lframework.starter.web.core.entity.BaseEntity; | ||
| 8 | +import lombok.Data; | ||
| 9 | +import lombok.NoArgsConstructor; | ||
| 10 | +import java.math.BigDecimal; | ||
| 11 | +import java.time.LocalDate; | ||
| 12 | +import java.time.LocalDateTime; | ||
| 13 | + | ||
| 14 | +@Data | ||
| 15 | +@TableName("coordination_summary_approval") | ||
| 16 | +@NoArgsConstructor | ||
| 17 | +public class CoordinationSummaryApproval extends BaseEntity implements BaseDto { | ||
| 18 | + | ||
| 19 | + private static final long serialVersionUID = 1L; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 主键ID | ||
| 23 | + */ | ||
| 24 | + private String id; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 编号 XT260001 XT+年2位+4位流水 每年重置 | ||
| 28 | + */ | ||
| 29 | + private String code; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 汇总生成日期(年月日) | ||
| 33 | + */ | ||
| 34 | + private LocalDate summaryDate; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 合计 数量合计 | ||
| 38 | + */ | ||
| 39 | + private BigDecimal totalQuantity; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 吨超协加权平均 Σ(吨超协*数量)/Σ数量 | ||
| 43 | + */ | ||
| 44 | + private BigDecimal weightedAvgCoordination; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 审核状态 AUDIT待审核 PASS审核通过 REFUSE拒绝 CANCEL取消 | ||
| 48 | + */ | ||
| 49 | + private String approvalStatus; | ||
| 50 | + | ||
| 51 | + private String processNode; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 总经理姓名 | ||
| 55 | + */ | ||
| 56 | + private String generalManagerName; | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 供应管理科主管 | ||
| 60 | + */ | ||
| 61 | + private String managementDeptName; | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 是否展示审核按钮 | ||
| 65 | + */ | ||
| 66 | + @TableField(exist = false) | ||
| 67 | + private Boolean showExamine; | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 是否展示审核详情按钮 | ||
| 71 | + */ | ||
| 72 | + @TableField(exist = false) | ||
| 73 | + private Boolean showExamineDetail; | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 创建人ID | ||
| 77 | + */ | ||
| 78 | + @TableField(fill = FieldFill.INSERT) | ||
| 79 | + private String createById; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 创建人 | ||
| 83 | + */ | ||
| 84 | + @TableField(fill = FieldFill.INSERT) | ||
| 85 | + private String createBy; | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * 更新人ID | ||
| 89 | + */ | ||
| 90 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 91 | + private String updateById; | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * 更新人 | ||
| 95 | + */ | ||
| 96 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 97 | + private String updateBy; | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * 创建时间 | ||
| 101 | + */ | ||
| 102 | + @TableField(fill = FieldFill.INSERT) | ||
| 103 | + private LocalDateTime createTime; | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * 更新时间 | ||
| 107 | + */ | ||
| 108 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 109 | + private LocalDateTime updateTime; | ||
| 110 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.entity.coordination; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import com.lframework.starter.web.core.dto.BaseDto; | ||
| 7 | +import com.lframework.starter.web.core.entity.BaseEntity; | ||
| 8 | +import lombok.Data; | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | +import java.time.LocalDate; | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Data | ||
| 14 | +@TableName("coordination_summary_approval_line") | ||
| 15 | +public class CoordinationSummaryApprovalLine extends BaseEntity implements BaseDto { | ||
| 16 | + | ||
| 17 | + private static final long serialVersionUID = 1L; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 主键ID | ||
| 21 | + */ | ||
| 22 | + private String id; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 审批表主表ID | ||
| 26 | + */ | ||
| 27 | + private String approvalId; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 排序号 | ||
| 31 | + */ | ||
| 32 | + private Integer orderNo; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 计划创建日期(年-月-日) | ||
| 36 | + */ | ||
| 37 | + private LocalDate planCreateDate; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 采购处ID | ||
| 41 | + */ | ||
| 42 | + private String purchaseDeptId; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 采购处名称(冗余) | ||
| 46 | + */ | ||
| 47 | + @TableField(exist = false) | ||
| 48 | + private String purchaseDeptName; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 客户名称(供应商简称) | ||
| 52 | + */ | ||
| 53 | + private String supplierName; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 原采购计划ID | ||
| 57 | + */ | ||
| 58 | + private String planId; | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 订单编号(原计划编号) | ||
| 62 | + */ | ||
| 63 | + private String planCode; | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 品种ID | ||
| 67 | + */ | ||
| 68 | + private String productId; | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 品种(冗余) | ||
| 72 | + */ | ||
| 73 | + @TableField(exist = false) | ||
| 74 | + private String productName; | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 数量(吨) | ||
| 78 | + */ | ||
| 79 | + private BigDecimal quantity; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 实际采购价(元/吨) | ||
| 83 | + */ | ||
| 84 | + private BigDecimal actualPurchasePrice; | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * 运费(元/吨) | ||
| 88 | + */ | ||
| 89 | + private BigDecimal shippingCost; | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * 单价(含运) = 实际采购价 + 运费 | ||
| 93 | + */ | ||
| 94 | + private BigDecimal priceWithShipping; | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * 分厂ID | ||
| 98 | + */ | ||
| 99 | + private String workshopId; | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 分厂名称(不取简称) | ||
| 103 | + */ | ||
| 104 | + @TableField(exist = false) | ||
| 105 | + private String workshopName; | ||
| 106 | + | ||
| 107 | + /** | ||
| 108 | + * 吨超协(协调幅度) | ||
| 109 | + */ | ||
| 110 | + private BigDecimal coordinationRange; | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * 备注标记 空/买断/补单/买断 补单 | ||
| 114 | + */ | ||
| 115 | + private String remarkFlag; | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * 原计划明细行ID | ||
| 119 | + */ | ||
| 120 | + private String planLineId; | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * 原计划审核通过时间 | ||
| 124 | + */ | ||
| 125 | + private LocalDateTime approvalPassTime; | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * 创建人ID | ||
| 129 | + */ | ||
| 130 | + @TableField(fill = FieldFill.INSERT) | ||
| 131 | + private String createById; | ||
| 132 | + | ||
| 133 | + /** | ||
| 134 | + * 创建人 | ||
| 135 | + */ | ||
| 136 | + @TableField(fill = FieldFill.INSERT) | ||
| 137 | + private String createBy; | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * 更新人ID | ||
| 141 | + */ | ||
| 142 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 143 | + private String updateById; | ||
| 144 | + | ||
| 145 | + /** | ||
| 146 | + * 更新人 | ||
| 147 | + */ | ||
| 148 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 149 | + private String updateBy; | ||
| 150 | + | ||
| 151 | + /** | ||
| 152 | + * 创建时间 | ||
| 153 | + */ | ||
| 154 | + @TableField(fill = FieldFill.INSERT) | ||
| 155 | + private LocalDateTime createTime; | ||
| 156 | + | ||
| 157 | + /** | ||
| 158 | + * 更新时间 | ||
| 159 | + */ | ||
| 160 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 161 | + private LocalDateTime updateTime; | ||
| 162 | +} |
| @@ -127,6 +127,9 @@ public class ProcurementPlanReplenish extends BaseEntity implements BaseDto { | @@ -127,6 +127,9 @@ public class ProcurementPlanReplenish extends BaseEntity implements BaseDto { | ||
| 127 | 127 | ||
| 128 | private String workshopId; | 128 | private String workshopId; |
| 129 | 129 | ||
| 130 | + @TableField(exist = false) | ||
| 131 | + private String workshopName; | ||
| 132 | + | ||
| 130 | /** | 133 | /** |
| 131 | * 总经理审核人(name) | 134 | * 总经理审核人(name) |
| 132 | */ | 135 | */ |
| @@ -22,7 +22,7 @@ public class DomesticPlanSummary extends BaseEntity implements BaseDto { | @@ -22,7 +22,7 @@ public class DomesticPlanSummary extends BaseEntity implements BaseDto { | ||
| 22 | private String id; | 22 | private String id; |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | - * 编号 XT260001 (XT+年份后2位+4位流水 每年重置) | 25 | + * 编号 MX260001 (MX+年份后2位+4位流水 每年重置) |
| 26 | */ | 26 | */ |
| 27 | private String code; | 27 | private String code; |
| 28 | 28 |
| 1 | +package com.lframework.xingyun.sc.procurement.impl.coordination; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApprovalLine; | ||
| 5 | +import com.lframework.xingyun.sc.procurement.mappers.coordination.CoordinationSummaryApprovalLineMapper; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.service.coordination.CoordinationSummaryApprovalLineService; | ||
| 7 | +import java.util.List; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | + | ||
| 10 | +@Service | ||
| 11 | +public class CoordinationSummaryApprovalLineServiceImpl | ||
| 12 | + extends BaseMpServiceImpl<CoordinationSummaryApprovalLineMapper, CoordinationSummaryApprovalLine> | ||
| 13 | + implements CoordinationSummaryApprovalLineService { | ||
| 14 | + | ||
| 15 | + @Override | ||
| 16 | + public List<CoordinationSummaryApprovalLine> getByApprovalId(String approvalId) { | ||
| 17 | + return getBaseMapper().getByApprovalId(approvalId); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public void deleteByApprovalId(String approvalId) { | ||
| 22 | + getBaseMapper().deleteByApprovalId(approvalId); | ||
| 23 | + } | ||
| 24 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.impl.coordination; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.bean.BeanUtil; | ||
| 4 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
| 5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
| 6 | +import com.github.pagehelper.PageInfo; | ||
| 7 | +import com.lframework.starter.bpm.dto.FlowTaskDto; | ||
| 8 | +import com.lframework.starter.bpm.entity.FlowInstanceWrapper; | ||
| 9 | +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper; | ||
| 10 | +import com.lframework.starter.bpm.service.FlowInstanceWrapperService; | ||
| 11 | +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; | ||
| 12 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | ||
| 13 | +import com.lframework.starter.common.exceptions.impl.InputErrorException; | ||
| 14 | +import com.lframework.starter.common.utils.Assert; | ||
| 15 | +import com.lframework.starter.common.utils.CollectionUtil; | ||
| 16 | +import com.lframework.starter.common.utils.StringUtil; | ||
| 17 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | ||
| 18 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 19 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | ||
| 20 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 21 | +import com.lframework.starter.web.core.utils.*; | ||
| 22 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | ||
| 23 | +import com.lframework.starter.web.inner.service.system.SysRoleService; | ||
| 24 | +import com.lframework.xingyun.sc.bo.procurement.GetCoordinationSummaryApprovalBo; | ||
| 25 | +import com.lframework.xingyun.sc.bo.procurement.GetCoordinationSummaryApprovalLineBo; | ||
| 26 | +import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | ||
| 27 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementBuyoutApply; | ||
| 28 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApproval; | ||
| 29 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApprovalLine; | ||
| 30 | +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish; | ||
| 31 | +import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummary; | ||
| 32 | +import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummaryDetail; | ||
| 33 | +import com.lframework.xingyun.sc.procurement.mappers.coordination.CoordinationSummaryApprovalMapper; | ||
| 34 | +import com.lframework.xingyun.sc.procurement.mappers.summary.DomesticPlanSummaryDetailMapper; | ||
| 35 | +import com.lframework.xingyun.sc.procurement.service.buyout.ProcurementBuyoutApplyService; | ||
| 36 | +import com.lframework.xingyun.sc.procurement.service.coordination.CoordinationSummaryApprovalLineService; | ||
| 37 | +import com.lframework.xingyun.sc.procurement.service.coordination.CoordinationSummaryApprovalService; | ||
| 38 | +import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService; | ||
| 39 | +import com.lframework.xingyun.sc.procurement.service.summary.DomesticPlanSummaryService; | ||
| 40 | +import com.lframework.xingyun.sc.procurement.vo.coordination.CreateCoordinationSummaryApprovalLineVo; | ||
| 41 | +import com.lframework.xingyun.sc.procurement.vo.coordination.CreateCoordinationSummaryApprovalVo; | ||
| 42 | +import com.lframework.xingyun.sc.procurement.vo.coordination.QueryCandidateLineVo; | ||
| 43 | +import com.lframework.xingyun.sc.procurement.vo.coordination.QueryCoordinationSummaryApprovalVo; | ||
| 44 | +import com.lframework.xingyun.sc.procurement.vo.coordination.UpdateCoordinationSummaryApprovalLineVo; | ||
| 45 | +import com.lframework.xingyun.sc.procurement.vo.coordination.UpdateCoordinationSummaryApprovalVo; | ||
| 46 | +import com.lframework.xingyun.sc.procurement.vo.summary.QueryDomesticPlanSummaryVo; | ||
| 47 | +import java.math.BigDecimal; | ||
| 48 | +import java.math.RoundingMode; | ||
| 49 | +import java.util.*; | ||
| 50 | +import java.util.stream.Collectors; | ||
| 51 | +import javax.annotation.Resource; | ||
| 52 | +import org.apache.commons.lang3.StringUtils; | ||
| 53 | +import org.springframework.stereotype.Service; | ||
| 54 | +import org.springframework.transaction.annotation.Transactional; | ||
| 55 | + | ||
| 56 | +@Service | ||
| 57 | +public class CoordinationSummaryApprovalServiceImpl | ||
| 58 | + extends BaseMpServiceImpl<CoordinationSummaryApprovalMapper, CoordinationSummaryApproval> | ||
| 59 | + implements CoordinationSummaryApprovalService { | ||
| 60 | + | ||
| 61 | + private static final String BPM_FLAG = "XT_APPROVAL"; | ||
| 62 | + | ||
| 63 | + @Resource | ||
| 64 | + private CoordinationSummaryApprovalLineService lineService; | ||
| 65 | + @Resource | ||
| 66 | + private CoordinationSummaryApprovalMapper approvalMapper; | ||
| 67 | + @Resource | ||
| 68 | + private FlowInstanceWrapperService flowInstanceWrapperService; | ||
| 69 | + @Resource | ||
| 70 | + private ProcurementBuyoutApplyService buyoutApplyService; | ||
| 71 | + @Resource | ||
| 72 | + private ProcurementPlanReplenishService replenishService; | ||
| 73 | + @Resource | ||
| 74 | + private FlowTaskWrapperMapper flowTaskWrapperMapper; | ||
| 75 | + @Resource | ||
| 76 | + private DomesticPlanSummaryService domesticPlanSummaryService; | ||
| 77 | + @Resource | ||
| 78 | + private DomesticPlanSummaryDetailMapper domesticPlanSummaryDetailMapper; | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public PageResult<CoordinationSummaryApproval> query(Integer pageIndex, Integer pageSize, | ||
| 82 | + QueryCoordinationSummaryApprovalVo vo) { | ||
| 83 | + Assert.greaterThanZero(pageIndex); | ||
| 84 | + Assert.greaterThanZero(pageSize); | ||
| 85 | + | ||
| 86 | + PageHelperUtil.startPage(pageIndex, pageSize); | ||
| 87 | + List<CoordinationSummaryApproval> datas = this.query(vo); | ||
| 88 | + if (CollectionUtil.isNotEmpty(datas)) { | ||
| 89 | + fillShowExamineInfo(datas); | ||
| 90 | + } | ||
| 91 | + return PageResultUtil.convert(new PageInfo<>(datas)); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @Override | ||
| 95 | + public List<CoordinationSummaryApproval> query(QueryCoordinationSummaryApprovalVo vo) { | ||
| 96 | + return approvalMapper.query(vo); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + @Override | ||
| 100 | + public GetCoordinationSummaryApprovalBo findDetail(String id) { | ||
| 101 | + if (StringUtil.isBlank(id)) { | ||
| 102 | + throw new InputErrorException("ID不能为空!"); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + CoordinationSummaryApproval entity = approvalMapper.findById(id); | ||
| 106 | + if (entity == null) { | ||
| 107 | + throw new DefaultClientException("吨超协汇总审批表不存在!"); | ||
| 108 | + } | ||
| 109 | + fillShowExamineInfo(Collections.singletonList(entity)); | ||
| 110 | + | ||
| 111 | + GetCoordinationSummaryApprovalBo bo = new GetCoordinationSummaryApprovalBo(entity); | ||
| 112 | + bo.convert(entity); | ||
| 113 | + | ||
| 114 | + List<CoordinationSummaryApprovalLine> lines = lineService.getByApprovalId(id); | ||
| 115 | + List<GetCoordinationSummaryApprovalLineBo> detailBoList = new ArrayList<>(); | ||
| 116 | + if (!CollectionUtil.isEmpty(lines)) { | ||
| 117 | + BigDecimal weightedAvg = entity.getWeightedAvgCoordination() == null | ||
| 118 | + ? BigDecimal.ZERO : entity.getWeightedAvgCoordination(); | ||
| 119 | + for (int i = 0; i < lines.size(); i++) { | ||
| 120 | + CoordinationSummaryApprovalLine line = lines.get(i); | ||
| 121 | + GetCoordinationSummaryApprovalLineBo lineBo = new GetCoordinationSummaryApprovalLineBo(line); | ||
| 122 | + lineBo.setSeq(i + 1); | ||
| 123 | + BigDecimal cr = line.getCoordinationRange() == null ? BigDecimal.ZERO : line.getCoordinationRange(); | ||
| 124 | + lineBo.setCompareWithAvg(cr.subtract(weightedAvg)); | ||
| 125 | + lineBo.setRemarkLabel(line.getRemarkFlag()); | ||
| 126 | + detailBoList.add(lineBo); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + bo.setLines(detailBoList); | ||
| 130 | + bo.setTotalQuantitySum(entity.getTotalQuantity()); | ||
| 131 | + bo.setWeightedAvgCoordinationAtBottom(entity.getWeightedAvgCoordination()); | ||
| 132 | + | ||
| 133 | + return bo; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + @Override | ||
| 137 | + @Transactional(rollbackFor = Exception.class) | ||
| 138 | + @OpLog(type = OtherOpLogType.class, name = "创建吨超协汇总审批表,ID:{}", params = {"#result"}) | ||
| 139 | + public String create(CreateCoordinationSummaryApprovalVo vo) { | ||
| 140 | + Assert.notNull(vo.getSummaryDate(), "汇总生成日期不能为空!"); | ||
| 141 | + if (CollectionUtil.isEmpty(vo.getLines())) { | ||
| 142 | + throw new DefaultClientException("明细不能为空!"); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + String prefix = "XT" + String.format("%02d", vo.getSummaryDate().getYear() % 100); | ||
| 146 | + CoordinationSummaryApproval maxCodeEntity = approvalMapper.findMaxCodeByYearPrefix(prefix); | ||
| 147 | + int seq = 1; | ||
| 148 | + if (maxCodeEntity != null && StringUtil.isNotBlank(maxCodeEntity.getCode())) { | ||
| 149 | + String code = maxCodeEntity.getCode(); | ||
| 150 | + if (code.length() > prefix.length()) { | ||
| 151 | + String numPart = code.substring(prefix.length()); | ||
| 152 | + try { | ||
| 153 | + seq = Integer.parseInt(numPart) + 1; | ||
| 154 | + } catch (Exception ignore) { | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + String code = prefix + String.format("%04d", seq); | ||
| 159 | + | ||
| 160 | + CoordinationSummaryApproval main = new CoordinationSummaryApproval(); | ||
| 161 | + BeanUtil.copyProperties(vo, main); | ||
| 162 | + main.setId(IdUtil.getId()); | ||
| 163 | + main.setCode(code); | ||
| 164 | + main.setApprovalStatus(null); | ||
| 165 | + main.setProcessNode("GYGLKJHGLY"); | ||
| 166 | + | ||
| 167 | + BigDecimal totalQty = BigDecimal.ZERO; | ||
| 168 | + BigDecimal weightedSum = BigDecimal.ZERO; | ||
| 169 | + for (CreateCoordinationSummaryApprovalLineVo lineVo : vo.getLines()) { | ||
| 170 | + BigDecimal qty = lineVo.getQuantity() == null ? BigDecimal.ZERO : lineVo.getQuantity(); | ||
| 171 | + BigDecimal cr = lineVo.getCoordinationRange() == null ? BigDecimal.ZERO : lineVo.getCoordinationRange(); | ||
| 172 | + totalQty = totalQty.add(qty); | ||
| 173 | + weightedSum = weightedSum.add(cr.multiply(qty)); | ||
| 174 | + } | ||
| 175 | + main.setTotalQuantity(totalQty); | ||
| 176 | + BigDecimal weightedAvg = BigDecimal.ZERO; | ||
| 177 | + if (totalQty.compareTo(BigDecimal.ZERO) > 0) { | ||
| 178 | + weightedAvg = weightedSum.divide(totalQty, 6, RoundingMode.HALF_UP); | ||
| 179 | + } | ||
| 180 | + main.setWeightedAvgCoordination(weightedAvg); | ||
| 181 | + | ||
| 182 | + Set<String> planIds = vo.getLines().stream() | ||
| 183 | + .map(CreateCoordinationSummaryApprovalLineVo::getPlanId) | ||
| 184 | + .filter(Objects::nonNull) | ||
| 185 | + .collect(Collectors.toSet()); | ||
| 186 | + | ||
| 187 | + Set<String> buyoutPlanIds = Collections.emptySet(); | ||
| 188 | + if (!planIds.isEmpty()) { | ||
| 189 | + List<ProcurementBuyoutApply> buyoutList = buyoutApplyService.list( | ||
| 190 | + Wrappers.lambdaQuery(ProcurementBuyoutApply.class) | ||
| 191 | + .in(ProcurementBuyoutApply::getProcurementPlanId, planIds) | ||
| 192 | + .select(ProcurementBuyoutApply::getProcurementPlanId)); | ||
| 193 | + buyoutPlanIds = buyoutList.stream() | ||
| 194 | + .map(ProcurementBuyoutApply::getProcurementPlanId) | ||
| 195 | + .filter(Objects::nonNull) | ||
| 196 | + .collect(Collectors.toSet()); | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + Set<String> replenishPlanIds = Collections.emptySet(); | ||
| 200 | + if (!planIds.isEmpty()) { | ||
| 201 | + List<ProcurementPlanReplenish> replenishList = replenishService.list( | ||
| 202 | + Wrappers.lambdaQuery(ProcurementPlanReplenish.class) | ||
| 203 | + .in(ProcurementPlanReplenish::getProcurementPlanId, planIds) | ||
| 204 | + .eq(ProcurementPlanReplenish::getApprovalStatus, "PASS") | ||
| 205 | + .select(ProcurementPlanReplenish::getProcurementPlanId)); | ||
| 206 | + replenishPlanIds = replenishList.stream() | ||
| 207 | + .map(ProcurementPlanReplenish::getProcurementPlanId) | ||
| 208 | + .filter(Objects::nonNull) | ||
| 209 | + .collect(Collectors.toSet()); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + List<CoordinationSummaryApprovalLine> saveLines = new ArrayList<>(); | ||
| 213 | + int orderNo = 0; | ||
| 214 | + for (CreateCoordinationSummaryApprovalLineVo lineVo : vo.getLines()) { | ||
| 215 | + CoordinationSummaryApprovalLine saveLine = BeanUtil.copyProperties(lineVo, CoordinationSummaryApprovalLine.class); | ||
| 216 | + saveLine.setId(IdUtil.getId()); | ||
| 217 | + saveLine.setApprovalId(main.getId()); | ||
| 218 | + saveLine.setOrderNo(++orderNo); | ||
| 219 | + BigDecimal actualPrice = lineVo.getActualPurchasePrice() == null ? BigDecimal.ZERO : lineVo.getActualPurchasePrice(); | ||
| 220 | + BigDecimal shipCost = lineVo.getShippingCost() == null ? BigDecimal.ZERO : lineVo.getShippingCost(); | ||
| 221 | + saveLine.setPriceWithShipping(actualPrice.add(shipCost)); | ||
| 222 | + boolean hasB = buyoutPlanIds.contains(saveLine.getPlanId()); | ||
| 223 | + boolean hasR = replenishPlanIds.contains(saveLine.getPlanId()); | ||
| 224 | + String remarkFlag; | ||
| 225 | + if (hasB && hasR) { | ||
| 226 | + remarkFlag = "买断 补单"; | ||
| 227 | + } else if (hasB) { | ||
| 228 | + remarkFlag = "买断"; | ||
| 229 | + } else if (hasR) { | ||
| 230 | + remarkFlag = "补单"; | ||
| 231 | + } else { | ||
| 232 | + remarkFlag = lineVo.getRemarkFlag(); | ||
| 233 | + } | ||
| 234 | + saveLine.setRemarkFlag(remarkFlag); | ||
| 235 | + saveLines.add(saveLine); | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + this.save(main); | ||
| 239 | + if (!saveLines.isEmpty()) { | ||
| 240 | + lineService.saveBatch(saveLines); | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + OpLogUtil.setVariable("id", main.getId()); | ||
| 244 | + OpLogUtil.setExtra(main); | ||
| 245 | + | ||
| 246 | + return main.getId(); | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + @Override | ||
| 250 | + @Transactional(rollbackFor = Exception.class) | ||
| 251 | + @OpLog(type = OtherOpLogType.class, name = "修改吨超协汇总审批表,ID:{}", params = {"#vo.id"}) | ||
| 252 | + public void update(UpdateCoordinationSummaryApprovalVo vo) { | ||
| 253 | + Assert.notBlank(vo.getId(), "ID不能为空!"); | ||
| 254 | + CoordinationSummaryApproval oldEntity = this.getById(vo.getId()); | ||
| 255 | + if (oldEntity == null) { | ||
| 256 | + throw new DefaultClientException("吨超协汇总审批表不存在!"); | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + CoordinationSummaryApproval update = new CoordinationSummaryApproval(); | ||
| 260 | + BeanUtil.copyProperties(vo, update); | ||
| 261 | + update.setId(vo.getId()); | ||
| 262 | + if (update.getCode() == null) { | ||
| 263 | + update.setCode(oldEntity.getCode()); | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + BigDecimal totalQty = BigDecimal.ZERO; | ||
| 267 | + BigDecimal weightedSum = BigDecimal.ZERO; | ||
| 268 | + if (!CollectionUtil.isEmpty(vo.getLines())) { | ||
| 269 | + for (UpdateCoordinationSummaryApprovalLineVo lineVo : vo.getLines()) { | ||
| 270 | + BigDecimal qty = lineVo.getQuantity() == null ? BigDecimal.ZERO : lineVo.getQuantity(); | ||
| 271 | + BigDecimal cr = lineVo.getCoordinationRange() == null ? BigDecimal.ZERO : lineVo.getCoordinationRange(); | ||
| 272 | + totalQty = totalQty.add(qty); | ||
| 273 | + weightedSum = weightedSum.add(cr.multiply(qty)); | ||
| 274 | + } | ||
| 275 | + } | ||
| 276 | + update.setTotalQuantity(totalQty); | ||
| 277 | + BigDecimal weightedAvg = BigDecimal.ZERO; | ||
| 278 | + if (totalQty.compareTo(BigDecimal.ZERO) > 0) { | ||
| 279 | + weightedAvg = weightedSum.divide(totalQty, 6, RoundingMode.HALF_UP); | ||
| 280 | + } | ||
| 281 | + update.setWeightedAvgCoordination(weightedAvg); | ||
| 282 | + | ||
| 283 | + this.updateById(update); | ||
| 284 | + | ||
| 285 | + saveOrUpdateLines(vo.getId(), vo.getLines()); | ||
| 286 | + | ||
| 287 | + OpLogUtil.setVariable("id", vo.getId()); | ||
| 288 | + OpLogUtil.setExtra(oldEntity); | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + @Override | ||
| 292 | + @Transactional(rollbackFor = Exception.class) | ||
| 293 | + @OpLog(type = OtherOpLogType.class, name = "取消吨超协汇总审批表,ID:{}", params = {"#id"}) | ||
| 294 | + public void cancel(String id) { | ||
| 295 | + Assert.notBlank(id); | ||
| 296 | + CoordinationSummaryApproval entity = this.getById(id); | ||
| 297 | + if (entity == null) { | ||
| 298 | + throw new DefaultClientException("吨超协汇总审批表不存在!"); | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + this.update(Wrappers.lambdaUpdate(CoordinationSummaryApproval.class) | ||
| 302 | + .set(CoordinationSummaryApproval::getApprovalStatus, "CANCEL") | ||
| 303 | + .eq(CoordinationSummaryApproval::getId, id)); | ||
| 304 | + | ||
| 305 | + OpLogUtil.setVariable("id", id); | ||
| 306 | + OpLogUtil.setExtra(entity); | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + @Override | ||
| 310 | + @Transactional(rollbackFor = Exception.class) | ||
| 311 | + @OpLog(type = OtherOpLogType.class, name = "提交吨超协汇总审批表审核,ID:{}", params = {"#id"}) | ||
| 312 | + public void submit(String id) { | ||
| 313 | + CoordinationSummaryApproval entity = this.getById(id); | ||
| 314 | + if (entity == null) { | ||
| 315 | + throw new DefaultClientException("吨超协汇总审批表不存在!"); | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + this.update(Wrappers.lambdaUpdate(CoordinationSummaryApproval.class) | ||
| 319 | + .set(CoordinationSummaryApproval::getProcessNode, "GYGLKZG") | ||
| 320 | + .eq(CoordinationSummaryApproval::getId, id)); | ||
| 321 | + | ||
| 322 | + flowInstanceWrapperService.startInstance(BPM_FLAG, id, BPM_FLAG, null); | ||
| 323 | + | ||
| 324 | + OpLogUtil.setVariable("id", id); | ||
| 325 | + OpLogUtil.setExtra(entity); | ||
| 326 | + } | ||
| 327 | + | ||
| 328 | + @Override | ||
| 329 | + @Transactional(rollbackFor = Exception.class) | ||
| 330 | + @OpLog(type = OtherOpLogType.class, name = "更新吨超协汇总审批表审核状态,ID:{}", params = {"#id"}) | ||
| 331 | + public void updateApprovalStatus(String id, String approvalStatus) { | ||
| 332 | + if (StringUtil.isBlank(id) || StringUtil.isBlank(approvalStatus)) { | ||
| 333 | + throw new InputErrorException("ID、审核状态不能为空!"); | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + CoordinationSummaryApproval entity = this.getById(id); | ||
| 337 | + if (entity == null) { | ||
| 338 | + throw new DefaultClientException("吨超协汇总审批表不存在!"); | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + if ("PASS".equals(approvalStatus)) { | ||
| 342 | + LambdaUpdateWrapper<CoordinationSummaryApproval> updateWrapper = | ||
| 343 | + Wrappers.lambdaUpdate(CoordinationSummaryApproval.class) | ||
| 344 | + .set(CoordinationSummaryApproval::getApprovalStatus, "PASS") | ||
| 345 | + .set(CoordinationSummaryApproval::getProcessNode, null) | ||
| 346 | + .set(CoordinationSummaryApproval::getGeneralManagerName, SecurityUtil.getCurrentUser().getName()) | ||
| 347 | + .eq(CoordinationSummaryApproval::getId, id); | ||
| 348 | + this.update(updateWrapper); | ||
| 349 | + } else if ("REFUSE".equals(approvalStatus)) { | ||
| 350 | + LambdaUpdateWrapper<CoordinationSummaryApproval> updateWrapper = | ||
| 351 | + Wrappers.lambdaUpdate(CoordinationSummaryApproval.class) | ||
| 352 | + .set(CoordinationSummaryApproval::getApprovalStatus, "REFUSE") | ||
| 353 | + .set(CoordinationSummaryApproval::getProcessNode, "GYGLKJHGLY") | ||
| 354 | + .set(CoordinationSummaryApproval::getGeneralManagerName, null) | ||
| 355 | + .set(CoordinationSummaryApproval::getManagementDeptName, null) | ||
| 356 | + .eq(CoordinationSummaryApproval::getId, id); | ||
| 357 | + this.update(updateWrapper); | ||
| 358 | + } | ||
| 359 | + | ||
| 360 | + OpLogUtil.setVariable("id", id); | ||
| 361 | + OpLogUtil.setExtra(entity); | ||
| 362 | + } | ||
| 363 | + | ||
| 364 | + @Override | ||
| 365 | + @Transactional(rollbackFor = Exception.class) | ||
| 366 | + @OpLog(type = OtherOpLogType.class, name = "吨超协汇总审批表流程数据修改,ID:{}", params = {"#id"}) | ||
| 367 | + public void updateNoFlowInstance(Map<String, Object> map) { | ||
| 368 | + try { | ||
| 369 | + Object nodeCodeObj = map.get("nodeCode"); | ||
| 370 | + String nodeCode = nodeCodeObj == null ? null : String.valueOf(nodeCodeObj); | ||
| 371 | + | ||
| 372 | + Object examStatusObj = map.get("examStatus"); | ||
| 373 | + String examStatus = examStatusObj == null ? null : String.valueOf(examStatusObj); | ||
| 374 | + | ||
| 375 | + Object bizIdObj = map.get("bizId"); | ||
| 376 | + String bizId = bizIdObj == null ? null : String.valueOf(bizIdObj); | ||
| 377 | + | ||
| 378 | + if ("PASS".equals(examStatus)) { | ||
| 379 | + String processNode = null; | ||
| 380 | + if ("xt_approval_gyglkzg".equals(nodeCode)) { | ||
| 381 | + processNode = "ZJL"; | ||
| 382 | + } | ||
| 383 | + if (StringUtil.isNotBlank(bizId) && StringUtil.isNotBlank(processNode)) { | ||
| 384 | + LambdaUpdateWrapper<CoordinationSummaryApproval> updateWrapper = | ||
| 385 | + Wrappers.lambdaUpdate(CoordinationSummaryApproval.class) | ||
| 386 | + .set(CoordinationSummaryApproval::getProcessNode, processNode) | ||
| 387 | + .set("xt_approval_gyglkzg".equals(nodeCode), CoordinationSummaryApproval::getManagementDeptName, SecurityUtil.getCurrentUser().getName()) | ||
| 388 | + .eq(CoordinationSummaryApproval::getId, bizId); | ||
| 389 | + this.update(updateWrapper); | ||
| 390 | + } | ||
| 391 | + } | ||
| 392 | + | ||
| 393 | + if (StringUtil.isNotBlank(bizId)) { | ||
| 394 | + OpLogUtil.setVariable("id", bizId); | ||
| 395 | + } | ||
| 396 | + } catch (Exception e) { | ||
| 397 | + e.printStackTrace(); | ||
| 398 | + } | ||
| 399 | + } | ||
| 400 | + | ||
| 401 | + @Override | ||
| 402 | + public List<DomesticPlanSummary> queryDomesticPlanSummaryList(QueryDomesticPlanSummaryVo vo) { | ||
| 403 | + return domesticPlanSummaryService.query(vo); | ||
| 404 | + } | ||
| 405 | + | ||
| 406 | + @Override | ||
| 407 | + public List<Map<String, Object>> queryCandidateLines(QueryCandidateLineVo vo) { | ||
| 408 | + Assert.notBlank(vo.getSummaryId(), "DomesticPlanSummary ID不能为空!"); | ||
| 409 | + List<DomesticPlanSummaryDetail> detailList = domesticPlanSummaryDetailMapper | ||
| 410 | + .getBySummaryIdAndCoordinationRange( | ||
| 411 | + vo.getSummaryId(), | ||
| 412 | + vo.getCoordinationMin(), | ||
| 413 | + vo.getCoordinationMax()); | ||
| 414 | + | ||
| 415 | + if (CollectionUtil.isEmpty(detailList)) { | ||
| 416 | + return Collections.emptyList(); | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + List<Map<String, Object>> resultList = new ArrayList<>(detailList.size()); | ||
| 420 | + for (DomesticPlanSummaryDetail d : detailList) { | ||
| 421 | + Map<String, Object> row = new LinkedHashMap<>(); | ||
| 422 | + row.put("planLineId", d.getPlanLineId()); | ||
| 423 | + row.put("planId", d.getPlanId()); | ||
| 424 | + row.put("planCode", d.getPlanCode()); | ||
| 425 | + row.put("planCreateDate", d.getPlanCreateDate()); | ||
| 426 | + row.put("purchaseDeptId", d.getPurchaseDeptId()); | ||
| 427 | + row.put("purchaseDeptName", d.getPurchaseDeptName()); | ||
| 428 | + row.put("supplierName", d.getSupplierName()); | ||
| 429 | + row.put("productId", d.getProductId()); | ||
| 430 | + row.put("productName", d.getProductName()); | ||
| 431 | + row.put("quantity", d.getQuantity()); | ||
| 432 | + row.put("priceWithShipping", d.getPriceWithShipping()); | ||
| 433 | + row.put("actualPurchasePrice", d.getActualPurchasePrice()); | ||
| 434 | + row.put("shippingCost", d.getShippingCost()); | ||
| 435 | + row.put("workshopId", d.getWorkshopId()); | ||
| 436 | + row.put("workshopName", d.getWorkshopName()); | ||
| 437 | + row.put("coordinationRange", d.getCoordinationRange()); | ||
| 438 | + row.put("remarkFlag", d.getRemarkFlag()); | ||
| 439 | + row.put("approvalPassTime", d.getApprovalPassTime()); | ||
| 440 | + resultList.add(row); | ||
| 441 | + } | ||
| 442 | + | ||
| 443 | + return resultList; | ||
| 444 | + } | ||
| 445 | + | ||
| 446 | + private void saveOrUpdateLines(String approvalId, List<? extends CreateCoordinationSummaryApprovalLineVo> lineList) { | ||
| 447 | + String finalApprovalId = approvalId; | ||
| 448 | + if (StringUtil.isBlank(finalApprovalId) && !CollectionUtil.isEmpty(lineList)) { | ||
| 449 | + finalApprovalId = lineList.stream() | ||
| 450 | + .filter(l -> l != null && l instanceof UpdateCoordinationSummaryApprovalLineVo | ||
| 451 | + && StringUtil.isNotBlank(((UpdateCoordinationSummaryApprovalLineVo) l).getApprovalId())) | ||
| 452 | + .map(l -> ((UpdateCoordinationSummaryApprovalLineVo) l).getApprovalId()) | ||
| 453 | + .findFirst().orElse(null); | ||
| 454 | + } | ||
| 455 | + if (StringUtil.isBlank(finalApprovalId)) { | ||
| 456 | + throw new DefaultClientException("审批表ID为空,无法保存明细!"); | ||
| 457 | + } | ||
| 458 | + if (CollectionUtil.isEmpty(lineList)) { | ||
| 459 | + // 空明细:删除老明细即可 | ||
| 460 | + List<CoordinationSummaryApprovalLine> old = lineService.getByApprovalId(finalApprovalId); | ||
| 461 | + if (CollectionUtil.isNotEmpty(old)) { | ||
| 462 | + lineService.removeByIds(old.stream().map(CoordinationSummaryApprovalLine::getId).collect(Collectors.toList())); | ||
| 463 | + } | ||
| 464 | + return; | ||
| 465 | + } | ||
| 466 | + | ||
| 467 | + List<CoordinationSummaryApprovalLine> oldLineList = lineService.getByApprovalId(finalApprovalId); | ||
| 468 | + Map<String, CoordinationSummaryApprovalLine> oldLineMap = CollectionUtil.isEmpty(oldLineList) | ||
| 469 | + ? Collections.emptyMap() | ||
| 470 | + : oldLineList.stream().collect(Collectors.toMap(CoordinationSummaryApprovalLine::getId, v -> v)); | ||
| 471 | + | ||
| 472 | + // 汇总 planId 批量查买断/补单 remarkFlag(覆盖前端传值,避免前端乱传) | ||
| 473 | + Set<String> planIds = lineList.stream() | ||
| 474 | + .filter(l -> l != null && StringUtil.isNotBlank(l.getPlanId())) | ||
| 475 | + .map(CreateCoordinationSummaryApprovalLineVo::getPlanId) | ||
| 476 | + .collect(Collectors.toSet()); | ||
| 477 | + | ||
| 478 | + Set<String> buyoutPlanIds = Collections.emptySet(); | ||
| 479 | + if (!planIds.isEmpty()) { | ||
| 480 | + List<ProcurementBuyoutApply> buyoutList = buyoutApplyService.list( | ||
| 481 | + Wrappers.lambdaQuery(ProcurementBuyoutApply.class) | ||
| 482 | + .in(ProcurementBuyoutApply::getProcurementPlanId, planIds) | ||
| 483 | + .select(ProcurementBuyoutApply::getProcurementPlanId)); | ||
| 484 | + buyoutPlanIds = buyoutList.stream() | ||
| 485 | + .map(ProcurementBuyoutApply::getProcurementPlanId) | ||
| 486 | + .filter(Objects::nonNull) | ||
| 487 | + .collect(Collectors.toSet()); | ||
| 488 | + } | ||
| 489 | + Set<String> replenishPlanIds = Collections.emptySet(); | ||
| 490 | + if (!planIds.isEmpty()) { | ||
| 491 | + List<ProcurementPlanReplenish> replenishList = replenishService.list( | ||
| 492 | + Wrappers.lambdaQuery(ProcurementPlanReplenish.class) | ||
| 493 | + .in(ProcurementPlanReplenish::getProcurementPlanId, planIds) | ||
| 494 | + .eq(ProcurementPlanReplenish::getApprovalStatus, "PASS") | ||
| 495 | + .select(ProcurementPlanReplenish::getProcurementPlanId)); | ||
| 496 | + replenishPlanIds = replenishList.stream() | ||
| 497 | + .map(ProcurementPlanReplenish::getProcurementPlanId) | ||
| 498 | + .filter(Objects::nonNull) | ||
| 499 | + .collect(Collectors.toSet()); | ||
| 500 | + } | ||
| 501 | + | ||
| 502 | + List<String> existIdList = new ArrayList<>(lineList.size()); | ||
| 503 | + List<CoordinationSummaryApprovalLine> batchList = new ArrayList<>(lineList.size()); | ||
| 504 | + | ||
| 505 | + // 重排 orderNo:从 1 开始按前端 lineList 顺序连续编号(无论是修改还是新增,都重新分配序号) | ||
| 506 | + int orderNo = 0; | ||
| 507 | + for (CreateCoordinationSummaryApprovalLineVo lineVo : lineList) { | ||
| 508 | + if (lineVo == null) continue; | ||
| 509 | + orderNo++; | ||
| 510 | + CoordinationSummaryApprovalLine saveLine; | ||
| 511 | + if (lineVo instanceof UpdateCoordinationSummaryApprovalLineVo | ||
| 512 | + && StringUtil.isNotBlank(lineVo.getId())) { | ||
| 513 | + UpdateCoordinationSummaryApprovalLineVo updateLineVo = (UpdateCoordinationSummaryApprovalLineVo) lineVo; | ||
| 514 | + CoordinationSummaryApprovalLine oldLine = oldLineMap.get(updateLineVo.getId()); | ||
| 515 | + if (oldLine == null) { | ||
| 516 | + throw new DefaultClientException("审批表明细不存在或不属于当前审批表!"); | ||
| 517 | + } | ||
| 518 | + existIdList.add(updateLineVo.getId()); | ||
| 519 | + if (StringUtil.isBlank(updateLineVo.getPlanLineId())) { | ||
| 520 | + updateLineVo.setPlanLineId(oldLine.getPlanLineId()); | ||
| 521 | + } | ||
| 522 | + saveLine = BeanUtil.copyProperties(updateLineVo, CoordinationSummaryApprovalLine.class); | ||
| 523 | + saveLine.setId(updateLineVo.getId()); | ||
| 524 | + } else { | ||
| 525 | + saveLine = BeanUtil.copyProperties(lineVo, CoordinationSummaryApprovalLine.class); | ||
| 526 | + saveLine.setId(IdUtil.getId()); | ||
| 527 | + } | ||
| 528 | + saveLine.setApprovalId(finalApprovalId); | ||
| 529 | + saveLine.setOrderNo(orderNo); | ||
| 530 | + | ||
| 531 | + // 兜底重算 单价(含运) = 实际采购价 + 运费 | ||
| 532 | + BigDecimal actualPrice = lineVo.getActualPurchasePrice() == null ? BigDecimal.ZERO : lineVo.getActualPurchasePrice(); | ||
| 533 | + BigDecimal shipCost = lineVo.getShippingCost() == null ? BigDecimal.ZERO : lineVo.getShippingCost(); | ||
| 534 | + saveLine.setPriceWithShipping(actualPrice.add(shipCost)); | ||
| 535 | + | ||
| 536 | + // 重写 remarkFlag:以数据库查的买断/补单结果为准(前端传了也覆盖) | ||
| 537 | + boolean hasB = buyoutPlanIds.contains(saveLine.getPlanId()); | ||
| 538 | + boolean hasR = replenishPlanIds.contains(saveLine.getPlanId()); | ||
| 539 | + String remarkFlag; | ||
| 540 | + if (hasB && hasR) { | ||
| 541 | + remarkFlag = "买断 补单"; | ||
| 542 | + } else if (hasB) { | ||
| 543 | + remarkFlag = "买断"; | ||
| 544 | + } else if (hasR) { | ||
| 545 | + remarkFlag = "补单"; | ||
| 546 | + } else { | ||
| 547 | + remarkFlag = lineVo.getRemarkFlag(); | ||
| 548 | + } | ||
| 549 | + saveLine.setRemarkFlag(remarkFlag); | ||
| 550 | + | ||
| 551 | + batchList.add(saveLine); | ||
| 552 | + } | ||
| 553 | + | ||
| 554 | + // 批量保存 / 更新(MP saveOrUpdateBatch 按 id 自动判 insert 还是 update) | ||
| 555 | + if (CollectionUtil.isNotEmpty(batchList)) { | ||
| 556 | + lineService.saveOrUpdateBatch(batchList); | ||
| 557 | + } | ||
| 558 | + | ||
| 559 | + // 删老明细:不在本次 existIdList 中的老行全删掉 | ||
| 560 | + List<CoordinationSummaryApprovalLine> safeOldLineList = oldLineList == null ? Collections.emptyList() : oldLineList; | ||
| 561 | + List<String> needDeleteIdList = safeOldLineList.stream() | ||
| 562 | + .map(CoordinationSummaryApprovalLine::getId) | ||
| 563 | + .filter(oldLineId -> !existIdList.contains(oldLineId)) | ||
| 564 | + .collect(Collectors.toList()); | ||
| 565 | + if (CollectionUtil.isNotEmpty(needDeleteIdList)) { | ||
| 566 | + lineService.removeByIds(needDeleteIdList); | ||
| 567 | + } | ||
| 568 | + } | ||
| 569 | + | ||
| 570 | + private void fillShowExamineInfo(List<CoordinationSummaryApproval> datas) { | ||
| 571 | + if (CollectionUtil.isEmpty(datas)) { | ||
| 572 | + return; | ||
| 573 | + } | ||
| 574 | + | ||
| 575 | + List<CoordinationSummaryApproval> validDatas = datas.stream() | ||
| 576 | + .filter(Objects::nonNull) | ||
| 577 | + .collect(Collectors.toList()); | ||
| 578 | + if (CollectionUtil.isEmpty(validDatas)) { | ||
| 579 | + return; | ||
| 580 | + } | ||
| 581 | + | ||
| 582 | + List<String> businessIds = validDatas.stream() | ||
| 583 | + .map(CoordinationSummaryApproval::getId) | ||
| 584 | + .collect(Collectors.toList()); | ||
| 585 | + | ||
| 586 | + List<FlowInstanceWrapper> flowList = flowInstanceWrapperService.getFlowByBusinessIdList(businessIds); | ||
| 587 | + Set<String> flowBusinessIdSet = CollectionUtil.isNotEmpty(flowList) | ||
| 588 | + ? flowList.stream().map(FlowInstanceWrapper::getBusinessId).collect(Collectors.toSet()) | ||
| 589 | + : new HashSet<>(); | ||
| 590 | + | ||
| 591 | + List<FlowTaskDto> todoFlowTaskList = flowTaskWrapperMapper.queryTodoList( | ||
| 592 | + new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId()); | ||
| 593 | + Set<String> todoBusinessIdSet = CollectionUtil.isNotEmpty(todoFlowTaskList) | ||
| 594 | + ? todoFlowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toSet()) | ||
| 595 | + : new HashSet<>(); | ||
| 596 | + | ||
| 597 | + for (CoordinationSummaryApproval approval : validDatas) { | ||
| 598 | + boolean hasFlow = flowBusinessIdSet.contains(approval.getId()); | ||
| 599 | + boolean hasTodo = todoBusinessIdSet.contains(approval.getId()); | ||
| 600 | + approval.setShowExamineDetail(hasFlow && StringUtils.isNotBlank(approval.getApprovalStatus())); | ||
| 601 | + approval.setShowExamine(hasTodo && CustomerDevelopStatus.AUDIT.name().equals(approval.getApprovalStatus())); | ||
| 602 | + } | ||
| 603 | + } | ||
| 604 | +} |
| @@ -165,7 +165,7 @@ public class DomesticPlanSummaryServiceImpl extends | @@ -165,7 +165,7 @@ public class DomesticPlanSummaryServiceImpl extends | ||
| 165 | summary.setId(IdUtil.getId()); | 165 | summary.setId(IdUtil.getId()); |
| 166 | 166 | ||
| 167 | String yearPart = String.format("%02d", summaryDate.getYear() % 100); | 167 | String yearPart = String.format("%02d", summaryDate.getYear() % 100); |
| 168 | - String prefix = "XT" + yearPart; | 168 | + String prefix = "MX" + yearPart; |
| 169 | DomesticPlanSummary max = domesticPlanSummaryMapper.findMaxCodeByYearPrefix(prefix); | 169 | DomesticPlanSummary max = domesticPlanSummaryMapper.findMaxCodeByYearPrefix(prefix); |
| 170 | int seq = 1; | 170 | int seq = 1; |
| 171 | if (max != null && StringUtil.isNotBlank(max.getCode())) { | 171 | if (max != null && StringUtil.isNotBlank(max.getCode())) { |
| 1 | +package com.lframework.xingyun.sc.procurement.mappers.coordination; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApprovalLine; | ||
| 5 | +import java.math.BigDecimal; | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | +import java.util.List; | ||
| 8 | +import java.util.Map; | ||
| 9 | +import org.apache.ibatis.annotations.Param; | ||
| 10 | + | ||
| 11 | +public interface CoordinationSummaryApprovalLineMapper extends BaseMapper<CoordinationSummaryApprovalLine> { | ||
| 12 | + | ||
| 13 | + List<CoordinationSummaryApprovalLine> getByApprovalId(@Param("approvalId") String approvalId); | ||
| 14 | + | ||
| 15 | + void deleteByApprovalId(@Param("approvalId") String approvalId); | ||
| 16 | + | ||
| 17 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.mappers.coordination; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApproval; | ||
| 5 | +import com.lframework.xingyun.sc.procurement.vo.coordination.QueryCoordinationSummaryApprovalVo; | ||
| 6 | +import java.util.List; | ||
| 7 | +import org.apache.ibatis.annotations.Param; | ||
| 8 | + | ||
| 9 | +public interface CoordinationSummaryApprovalMapper extends BaseMapper<CoordinationSummaryApproval> { | ||
| 10 | + | ||
| 11 | + List<CoordinationSummaryApproval> query(@Param("vo") QueryCoordinationSummaryApprovalVo vo); | ||
| 12 | + | ||
| 13 | + CoordinationSummaryApproval findById(@Param("id") String id); | ||
| 14 | + | ||
| 15 | + CoordinationSummaryApproval findMaxCodeByYearPrefix(@Param("prefix") String prefix); | ||
| 16 | +} |
| @@ -2,6 +2,7 @@ package com.lframework.xingyun.sc.procurement.mappers.summary; | @@ -2,6 +2,7 @@ package com.lframework.xingyun.sc.procurement.mappers.summary; | ||
| 2 | 2 | ||
| 3 | import com.lframework.starter.web.core.mapper.BaseMapper; | 3 | import com.lframework.starter.web.core.mapper.BaseMapper; |
| 4 | import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummaryDetail; | 4 | import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummaryDetail; |
| 5 | +import java.math.BigDecimal; | ||
| 5 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 6 | import java.util.List; | 7 | import java.util.List; |
| 7 | import java.util.Map; | 8 | import java.util.Map; |
| @@ -18,6 +19,19 @@ public interface DomesticPlanSummaryDetailMapper extends BaseMapper<DomesticPlan | @@ -18,6 +19,19 @@ public interface DomesticPlanSummaryDetailMapper extends BaseMapper<DomesticPlan | ||
| 18 | List<DomesticPlanSummaryDetail> getBySummaryId(@Param("summaryId") String summaryId); | 19 | List<DomesticPlanSummaryDetail> getBySummaryId(@Param("summaryId") String summaryId); |
| 19 | 20 | ||
| 20 | /** | 21 | /** |
| 22 | + * 根据汇总ID + 协调幅度区间查询明细列表(用于吨超协审批勾选候选) | ||
| 23 | + * | ||
| 24 | + * @param summaryId | ||
| 25 | + * @param coordinationMin | ||
| 26 | + * @param coordinationMax | ||
| 27 | + * @return | ||
| 28 | + */ | ||
| 29 | + List<DomesticPlanSummaryDetail> getBySummaryIdAndCoordinationRange( | ||
| 30 | + @Param("summaryId") String summaryId, | ||
| 31 | + @Param("coordinationMin") BigDecimal coordinationMin, | ||
| 32 | + @Param("coordinationMax") BigDecimal coordinationMax); | ||
| 33 | + | ||
| 34 | + /** | ||
| 21 | * 根据汇总ID删除明细 | 35 | * 根据汇总ID删除明细 |
| 22 | * | 36 | * |
| 23 | * @param summaryId | 37 | * @param summaryId |
| 1 | +package com.lframework.xingyun.sc.procurement.service.coordination; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApprovalLine; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +public interface CoordinationSummaryApprovalLineService extends IService<CoordinationSummaryApprovalLine> { | ||
| 8 | + | ||
| 9 | + List<CoordinationSummaryApprovalLine> getByApprovalId(String approvalId); | ||
| 10 | + | ||
| 11 | + void deleteByApprovalId(String approvalId); | ||
| 12 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.service.coordination; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
| 4 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 5 | +import com.lframework.xingyun.sc.bo.procurement.GetCoordinationSummaryApprovalBo; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApproval; | ||
| 7 | +import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummary; | ||
| 8 | +import com.lframework.xingyun.sc.procurement.vo.coordination.CreateCoordinationSummaryApprovalVo; | ||
| 9 | +import com.lframework.xingyun.sc.procurement.vo.coordination.QueryCandidateLineVo; | ||
| 10 | +import com.lframework.xingyun.sc.procurement.vo.coordination.QueryCoordinationSummaryApprovalVo; | ||
| 11 | +import com.lframework.xingyun.sc.procurement.vo.coordination.UpdateCoordinationSummaryApprovalVo; | ||
| 12 | +import com.lframework.xingyun.sc.procurement.vo.summary.QueryDomesticPlanSummaryVo; | ||
| 13 | +import java.util.List; | ||
| 14 | +import java.util.Map; | ||
| 15 | + | ||
| 16 | +public interface CoordinationSummaryApprovalService extends IService<CoordinationSummaryApproval> { | ||
| 17 | + | ||
| 18 | + PageResult<CoordinationSummaryApproval> query(Integer pageIndex, Integer pageSize, | ||
| 19 | + QueryCoordinationSummaryApprovalVo vo); | ||
| 20 | + | ||
| 21 | + List<CoordinationSummaryApproval> query(QueryCoordinationSummaryApprovalVo vo); | ||
| 22 | + | ||
| 23 | + GetCoordinationSummaryApprovalBo findDetail(String id); | ||
| 24 | + | ||
| 25 | + String create(CreateCoordinationSummaryApprovalVo vo); | ||
| 26 | + | ||
| 27 | + void update(UpdateCoordinationSummaryApprovalVo vo); | ||
| 28 | + | ||
| 29 | + void cancel(String id); | ||
| 30 | + | ||
| 31 | + void submit(String id); | ||
| 32 | + | ||
| 33 | + void updateApprovalStatus(String id, String approvalStatus); | ||
| 34 | + | ||
| 35 | + void updateNoFlowInstance(Map<String, Object> map); | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 第一步:按日期筛选 DomesticPlanSummary 列表(前端拿到 id 后再进行第二步) | ||
| 39 | + * | ||
| 40 | + * @param vo | ||
| 41 | + * @return | ||
| 42 | + */ | ||
| 43 | + List<DomesticPlanSummary> queryDomesticPlanSummaryList(QueryDomesticPlanSummaryVo vo); | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 第二步:根据 DomesticPlanSummary ID + 协调幅度区间 查候选勾选明细 | ||
| 47 | + * 数据来源:DomesticPlanSummaryDetail | ||
| 48 | + * | ||
| 49 | + * @param vo | ||
| 50 | + * @return | ||
| 51 | + */ | ||
| 52 | + List<Map<String, Object>> queryCandidateLines(QueryCandidateLineVo vo); | ||
| 53 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.coordination; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.starter.common.constants.StringPool; | ||
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 6 | +import io.swagger.annotations.ApiModel; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import java.io.Serializable; | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | +import java.time.LocalDate; | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | +import javax.validation.constraints.Digits; | ||
| 13 | +import javax.validation.constraints.NotNull; | ||
| 14 | +import lombok.Data; | ||
| 15 | + | ||
| 16 | +@Data | ||
| 17 | +@ApiModel("新增采购吨超协汇总审批表明细Vo") | ||
| 18 | +public class CreateCoordinationSummaryApprovalLineVo implements BaseVo, Serializable { | ||
| 19 | + | ||
| 20 | + private static final long serialVersionUID = 1L; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty("ID") | ||
| 23 | + private String id; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty(value = "原采购计划明细行ID 必填 用于追溯", required = true) | ||
| 26 | + private String planLineId; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty("原采购计划ID") | ||
| 29 | + private String planId; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty("原采购计划单编号") | ||
| 32 | + private String planCode; | ||
| 33 | + | ||
| 34 | + @ApiModelProperty("计划创建日期") | ||
| 35 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | ||
| 36 | + private LocalDate planCreateDate; | ||
| 37 | + | ||
| 38 | + @ApiModelProperty("采购处ID") | ||
| 39 | + private String purchaseDeptId; | ||
| 40 | + | ||
| 41 | + @ApiModelProperty("客户名称(供应商简称)") | ||
| 42 | + private String supplierName; | ||
| 43 | + | ||
| 44 | + @ApiModelProperty("品种ID") | ||
| 45 | + private String productId; | ||
| 46 | + | ||
| 47 | + @ApiModelProperty(value = "数量", required = true) | ||
| 48 | + @NotNull(message = "数量不能为空!") | ||
| 49 | + @Digits(integer = 14, fraction = 5, message = "数量最多支持14位整数和5位小数!") | ||
| 50 | + private BigDecimal quantity; | ||
| 51 | + | ||
| 52 | + @ApiModelProperty("实际采购价(元/吨)") | ||
| 53 | + private BigDecimal actualPurchasePrice; | ||
| 54 | + | ||
| 55 | + @ApiModelProperty("运费(元/吨)") | ||
| 56 | + private BigDecimal shippingCost; | ||
| 57 | + | ||
| 58 | + @ApiModelProperty("单价(含运)=实际采购价+运费 前端计算好传入") | ||
| 59 | + private BigDecimal priceWithShipping; | ||
| 60 | + | ||
| 61 | + @ApiModelProperty("分厂ID") | ||
| 62 | + private String workshopId; | ||
| 63 | + | ||
| 64 | + @ApiModelProperty("吨超协(协调幅度)") | ||
| 65 | + private BigDecimal coordinationRange; | ||
| 66 | + | ||
| 67 | + @ApiModelProperty("备注标记 空/买断/补单/买断 补单") | ||
| 68 | + private String remarkFlag; | ||
| 69 | + | ||
| 70 | + @ApiModelProperty("原计划审核通过时间 前端传回用于排序") | ||
| 71 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 72 | + private LocalDateTime approvalPassTime; | ||
| 73 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.coordination; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.starter.common.constants.StringPool; | ||
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 6 | +import io.swagger.annotations.ApiModel; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import java.io.Serializable; | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | +import java.time.LocalDate; | ||
| 11 | +import java.util.List; | ||
| 12 | +import javax.validation.Valid; | ||
| 13 | +import javax.validation.constraints.NotNull; | ||
| 14 | +import lombok.Data; | ||
| 15 | + | ||
| 16 | +@Data | ||
| 17 | +@ApiModel("新增采购吨超协汇总审批表Vo") | ||
| 18 | +public class CreateCoordinationSummaryApprovalVo implements BaseVo, Serializable { | ||
| 19 | + | ||
| 20 | + private static final long serialVersionUID = 1L; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty("编号(后端生成)") | ||
| 23 | + private String code; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty(value = "汇总生成日期 必填", required = true) | ||
| 26 | + @NotNull(message = "汇总生成日期不能为空!") | ||
| 27 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | ||
| 28 | + private LocalDate summaryDate; | ||
| 29 | + | ||
| 30 | + @ApiModelProperty("合计 数量合计 后端根据明细计算 可不传") | ||
| 31 | + private BigDecimal totalQuantity; | ||
| 32 | + | ||
| 33 | + @ApiModelProperty("吨超协加权平均 后端根据明细计算 可不传") | ||
| 34 | + private BigDecimal weightedAvgCoordination; | ||
| 35 | + | ||
| 36 | + @ApiModelProperty("勾选的明细列表") | ||
| 37 | + @Valid | ||
| 38 | + private List<CreateCoordinationSummaryApprovalLineVo> lines; | ||
| 39 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.coordination; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | +import javax.validation.constraints.NotBlank; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +@Data | ||
| 12 | +@ApiModel("查询候选勾选明细筛选条件Vo") | ||
| 13 | +public class QueryCandidateLineVo implements BaseVo, Serializable { | ||
| 14 | + | ||
| 15 | + private static final long serialVersionUID = 1L; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty(value = "内贸计划明细汇总主表ID", required = true) | ||
| 18 | + @NotBlank(message = "内贸计划明细汇总主表 ID不能为空!") | ||
| 19 | + private String summaryId; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty("协调幅度筛选最小值(含)") | ||
| 22 | + private BigDecimal coordinationMin; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty("协调幅度筛选最大值(含)") | ||
| 25 | + private BigDecimal coordinationMax; | ||
| 26 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.coordination; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.starter.common.constants.StringPool; | ||
| 5 | +import com.lframework.starter.web.core.vo.SortPageVo; | ||
| 6 | +import io.swagger.annotations.ApiModel; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import java.io.Serializable; | ||
| 9 | +import java.time.LocalDate; | ||
| 10 | +import lombok.Data; | ||
| 11 | + | ||
| 12 | +@Data | ||
| 13 | +@ApiModel("查询采购吨超协汇总审批表") | ||
| 14 | +public class QueryCoordinationSummaryApprovalVo extends SortPageVo implements Serializable { | ||
| 15 | + | ||
| 16 | + private static final long serialVersionUID = 1L; | ||
| 17 | + | ||
| 18 | + @ApiModelProperty("编号(精确或模糊匹配)") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty("汇总生成日期开始") | ||
| 22 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | ||
| 23 | + private LocalDate startDate; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty("汇总生成日期结束") | ||
| 26 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | ||
| 27 | + private LocalDate endDate; | ||
| 28 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.coordination; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import java.io.Serializable; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.EqualsAndHashCode; | ||
| 8 | + | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +@ApiModel("修改采购吨超协汇总审批表明细Vo") | ||
| 12 | +public class UpdateCoordinationSummaryApprovalLineVo extends CreateCoordinationSummaryApprovalLineVo implements Serializable { | ||
| 13 | + | ||
| 14 | + private static final long serialVersionUID = 1L; | ||
| 15 | + | ||
| 16 | + @ApiModelProperty("明细行主键ID") | ||
| 17 | + private String id; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty("主表ID") | ||
| 20 | + private String approvalId; | ||
| 21 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.coordination; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | +import java.time.LocalDate; | ||
| 9 | +import java.util.List; | ||
| 10 | +import javax.validation.Valid; | ||
| 11 | +import javax.validation.constraints.NotBlank; | ||
| 12 | +import javax.validation.constraints.NotNull; | ||
| 13 | +import lombok.Data; | ||
| 14 | +import org.hibernate.validator.constraints.Length; | ||
| 15 | + | ||
| 16 | +@Data | ||
| 17 | +@ApiModel("修改采购吨超协汇总审批表Vo") | ||
| 18 | +public class UpdateCoordinationSummaryApprovalVo implements BaseVo, Serializable { | ||
| 19 | + | ||
| 20 | + private static final long serialVersionUID = 1L; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty(value = "ID", required = true) | ||
| 23 | + @NotBlank(message = "ID不能为空!") | ||
| 24 | + private String id; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty(value = "CODE", required = true) | ||
| 27 | + @NotBlank(message = "code不能为空!") | ||
| 28 | + private String code; | ||
| 29 | + | ||
| 30 | + @ApiModelProperty(value = "汇总生成日期 必填", required = true) | ||
| 31 | + @NotNull(message = "汇总生成日期不能为空!") | ||
| 32 | + private LocalDate summaryDate; | ||
| 33 | + | ||
| 34 | + @ApiModelProperty("合计 数量合计") | ||
| 35 | + private BigDecimal totalQuantity; | ||
| 36 | + | ||
| 37 | + @ApiModelProperty("吨超协加权平均") | ||
| 38 | + private BigDecimal weightedAvgCoordination; | ||
| 39 | + | ||
| 40 | + @ApiModelProperty("勾选的明细列表") | ||
| 41 | + @Valid | ||
| 42 | + private List<UpdateCoordinationSummaryApprovalLineVo> lines; | ||
| 43 | +} |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="com.lframework.xingyun.sc.procurement.mappers.coordination.CoordinationSummaryApprovalLineMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="CoordinationSummaryApprovalLineResult" type="com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApprovalLine"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="approval_id" property="approvalId"/> | ||
| 8 | + <result column="order_no" property="orderNo"/> | ||
| 9 | + <result column="plan_create_date" property="planCreateDate"/> | ||
| 10 | + <result column="purchase_dept_id" property="purchaseDeptId"/> | ||
| 11 | + <result column="purchase_dept_name" property="purchaseDeptName"/> | ||
| 12 | + <result column="supplier_name" property="supplierName"/> | ||
| 13 | + <result column="plan_id" property="planId"/> | ||
| 14 | + <result column="plan_code" property="planCode"/> | ||
| 15 | + <result column="product_id" property="productId"/> | ||
| 16 | + <result column="product_name" property="productName"/> | ||
| 17 | + <result column="quantity" property="quantity"/> | ||
| 18 | + <result column="actual_purchase_price" property="actualPurchasePrice"/> | ||
| 19 | + <result column="shipping_cost" property="shippingCost"/> | ||
| 20 | + <result column="price_with_shipping" property="priceWithShipping"/> | ||
| 21 | + <result column="workshop_id" property="workshopId"/> | ||
| 22 | + <result column="workshop_name" property="workshopName"/> | ||
| 23 | + <result column="coordination_range" property="coordinationRange"/> | ||
| 24 | + <result column="remark_flag" property="remarkFlag"/> | ||
| 25 | + <result column="plan_line_id" property="planLineId"/> | ||
| 26 | + <result column="approval_pass_time" property="approvalPassTime"/> | ||
| 27 | + <result column="create_by_id" property="createById"/> | ||
| 28 | + <result column="create_by" property="createBy"/> | ||
| 29 | + <result column="update_by_id" property="updateById"/> | ||
| 30 | + <result column="update_by" property="updateBy"/> | ||
| 31 | + <result column="create_time" property="createTime"/> | ||
| 32 | + <result column="update_time" property="updateTime"/> | ||
| 33 | + </resultMap> | ||
| 34 | + | ||
| 35 | + <sql id="CSAL_sql"> | ||
| 36 | + SELECT | ||
| 37 | + csal.id, | ||
| 38 | + csal.approval_id, | ||
| 39 | + csal.order_no, | ||
| 40 | + csal.plan_create_date, | ||
| 41 | + csal.purchase_dept_id, | ||
| 42 | + sd.name AS purchase_dept_name, | ||
| 43 | + csal.supplier_name, | ||
| 44 | + csal.plan_id, | ||
| 45 | + csal.plan_code, | ||
| 46 | + csal.product_id, | ||
| 47 | + br.product_name, | ||
| 48 | + csal.quantity, | ||
| 49 | + csal.actual_purchase_price, | ||
| 50 | + csal.shipping_cost, | ||
| 51 | + csal.price_with_shipping, | ||
| 52 | + csal.workshop_id, | ||
| 53 | + ws.name AS workshop_name, | ||
| 54 | + csal.coordination_range, | ||
| 55 | + csal.remark_flag, | ||
| 56 | + csal.plan_line_id, | ||
| 57 | + csal.approval_pass_time, | ||
| 58 | + csal.create_by_id, | ||
| 59 | + csal.create_by, | ||
| 60 | + csal.update_by_id, | ||
| 61 | + csal.update_by, | ||
| 62 | + csal.create_time, | ||
| 63 | + csal.update_time | ||
| 64 | + FROM coordination_summary_approval_line AS csal | ||
| 65 | + LEFT JOIN base_data_breed_relationship br ON br.id = csal.product_id | ||
| 66 | + LEFT JOIN base_data_workshop as ws on ws.id = csal.workshop_id | ||
| 67 | + LEFT JOIN sys_dept sd ON sd.id = csal.purchase_dept_id | ||
| 68 | + </sql> | ||
| 69 | + | ||
| 70 | + <select id="getByApprovalId" resultMap="CoordinationSummaryApprovalLineResult"> | ||
| 71 | + <include refid="CSAL_sql"/> | ||
| 72 | + WHERE csal.approval_id = #{approvalId} | ||
| 73 | + ORDER BY csal.order_no ASC | ||
| 74 | + </select> | ||
| 75 | + | ||
| 76 | + <delete id="deleteByApprovalId"> | ||
| 77 | + DELETE FROM coordination_summary_approval_line WHERE approval_id = #{approvalId} | ||
| 78 | + </delete> | ||
| 79 | +</mapper> |
xingyun-sc/src/main/resources/mappers/procurement/coordination/CoordinationSummaryApprovalMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="com.lframework.xingyun.sc.procurement.mappers.coordination.CoordinationSummaryApprovalMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="CoordinationSummaryApprovalResult" type="com.lframework.xingyun.sc.procurement.entity.coordination.CoordinationSummaryApproval"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="code" property="code"/> | ||
| 8 | + <result column="summary_date" property="summaryDate"/> | ||
| 9 | + <result column="total_quantity" property="totalQuantity"/> | ||
| 10 | + <result column="weighted_avg_coordination" property="weightedAvgCoordination"/> | ||
| 11 | + <result column="approval_status" property="approvalStatus"/> | ||
| 12 | + <result column="process_node" property="processNode"/> | ||
| 13 | + <result column="general_manager_name" property="generalManagerName"/> | ||
| 14 | + <result column="management_dept_name" property="managementDeptName"/> | ||
| 15 | + <result column="create_by_id" property="createById"/> | ||
| 16 | + <result column="create_by" property="createBy"/> | ||
| 17 | + <result column="update_by_id" property="updateById"/> | ||
| 18 | + <result column="update_by" property="updateBy"/> | ||
| 19 | + <result column="create_time" property="createTime"/> | ||
| 20 | + <result column="update_time" property="updateTime"/> | ||
| 21 | + </resultMap> | ||
| 22 | + | ||
| 23 | + <sql id="CSA_sql"> | ||
| 24 | + SELECT | ||
| 25 | + csa.id, | ||
| 26 | + csa.code, | ||
| 27 | + csa.summary_date, | ||
| 28 | + csa.total_quantity, | ||
| 29 | + csa.weighted_avg_coordination, | ||
| 30 | + csa.approval_status, | ||
| 31 | + csa.process_node, | ||
| 32 | + csa.general_manager_name, | ||
| 33 | + csa.management_dept_name, | ||
| 34 | + csa.create_by_id, | ||
| 35 | + csa.create_by, | ||
| 36 | + csa.update_by_id, | ||
| 37 | + csa.update_by, | ||
| 38 | + csa.create_time, | ||
| 39 | + csa.update_time | ||
| 40 | + FROM coordination_summary_approval AS csa | ||
| 41 | + </sql> | ||
| 42 | + | ||
| 43 | + <select id="query" resultMap="CoordinationSummaryApprovalResult"> | ||
| 44 | + <include refid="CSA_sql"/> | ||
| 45 | + <where> | ||
| 46 | + <if test="vo.code != null and vo.code != ''"> | ||
| 47 | + AND csa.code LIKE CONCAT('%', #{vo.code}, '%') | ||
| 48 | + </if> | ||
| 49 | + <if test="vo.startDate != null"> | ||
| 50 | + AND csa.summary_date <![CDATA[ >= ]]> #{vo.startDate} | ||
| 51 | + </if> | ||
| 52 | + <if test="vo.endDate != null"> | ||
| 53 | + AND csa.summary_date <![CDATA[ <= ]]> #{vo.endDate} | ||
| 54 | + </if> | ||
| 55 | + </where> | ||
| 56 | + ORDER BY csa.summary_date DESC, csa.code DESC | ||
| 57 | + </select> | ||
| 58 | + | ||
| 59 | + <select id="findById" resultMap="CoordinationSummaryApprovalResult"> | ||
| 60 | + <include refid="CSA_sql"/> | ||
| 61 | + WHERE csa.id = #{id} | ||
| 62 | + </select> | ||
| 63 | + | ||
| 64 | + <select id="findMaxCodeByYearPrefix" resultMap="CoordinationSummaryApprovalResult"> | ||
| 65 | + <include refid="CSA_sql"/> | ||
| 66 | + WHERE csa.code LIKE CONCAT(#{prefix}, '%') | ||
| 67 | + ORDER BY csa.code DESC | ||
| 68 | + LIMIT 1 | ||
| 69 | + </select> | ||
| 70 | +</mapper> |
| @@ -73,6 +73,18 @@ | @@ -73,6 +73,18 @@ | ||
| 73 | ORDER BY dpsd.order_no ASC | 73 | ORDER BY dpsd.order_no ASC |
| 74 | </select> | 74 | </select> |
| 75 | 75 | ||
| 76 | + <select id="getBySummaryIdAndCoordinationRange" resultMap="DomesticPlanSummaryDetail"> | ||
| 77 | + <include refid="DomesticPlanSummaryDetail_sql"/> | ||
| 78 | + WHERE dpsd.summary_id = #{summaryId} | ||
| 79 | + <if test="coordinationMin != null"> | ||
| 80 | + AND dpsd.coordination_range <![CDATA[ >= ]]> #{coordinationMin} | ||
| 81 | + </if> | ||
| 82 | + <if test="coordinationMax != null"> | ||
| 83 | + AND dpsd.coordination_range <![CDATA[ <= ]]> #{coordinationMax} | ||
| 84 | + </if> | ||
| 85 | + ORDER BY dpsd.coordination_range ASC, dpsd.order_no ASC | ||
| 86 | + </select> | ||
| 87 | + | ||
| 76 | <delete id="deleteBySummaryId"> | 88 | <delete id="deleteBySummaryId"> |
| 77 | DELETE FROM domestic_plan_summary_detail WHERE summary_id = #{summaryId} | 89 | DELETE FROM domestic_plan_summary_detail WHERE summary_id = #{summaryId} |
| 78 | </delete> | 90 | </delete> |