Showing
9 changed files
with
307 additions
and
9 deletions
| @@ -78,6 +78,12 @@ public class GetProcurementPlanChangeBo extends BaseBo<ProcurementPlanChange> { | @@ -78,6 +78,12 @@ public class GetProcurementPlanChangeBo extends BaseBo<ProcurementPlanChange> { | ||
| 78 | private String purchaseDepartmentName; | 78 | private String purchaseDepartmentName; |
| 79 | 79 | ||
| 80 | /** | 80 | /** |
| 81 | + * 采购处编码 | ||
| 82 | + */ | ||
| 83 | + @ApiModelProperty("采购处编码") | ||
| 84 | + private String purchaseDepartmentCode; | ||
| 85 | + | ||
| 86 | + /** | ||
| 81 | * 区域 | 87 | * 区域 |
| 82 | */ | 88 | */ |
| 83 | @ApiModelProperty("区域") | 89 | @ApiModelProperty("区域") |
| @@ -20,6 +20,8 @@ import com.lframework.xingyun.sc.entity.*; | @@ -20,6 +20,8 @@ import com.lframework.xingyun.sc.entity.*; | ||
| 20 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | 20 | 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.entity.ProcurementPlanChange; | ||
| 24 | +import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService; | ||
| 23 | import com.lframework.xingyun.sc.procurement.service.credit.ProcurementDomesticCustomerCreditService; | 25 | import com.lframework.xingyun.sc.procurement.service.credit.ProcurementDomesticCustomerCreditService; |
| 24 | import com.lframework.xingyun.sc.procurement.service.credit.ProcurementForeignTradeCreditService; | 26 | import com.lframework.xingyun.sc.procurement.service.credit.ProcurementForeignTradeCreditService; |
| 25 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; | 27 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; |
| @@ -160,6 +162,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -160,6 +162,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 160 | private SalesmanQuotationService salesmanQuotationService; | 162 | private SalesmanQuotationService salesmanQuotationService; |
| 161 | @Resource | 163 | @Resource |
| 162 | private ProcurementPlanService procurementPlanService; | 164 | private ProcurementPlanService procurementPlanService; |
| 165 | + @Resource | ||
| 166 | + private ProcurementPlanChangeService procurementPlanChangeService; | ||
| 163 | 167 | ||
| 164 | 168 | ||
| 165 | 169 | ||
| @@ -253,6 +257,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -253,6 +257,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 253 | case "PROCUREMENT_PLAN": | 257 | case "PROCUREMENT_PLAN": |
| 254 | handleProcurementPlanData(flowStatus, businessId); | 258 | handleProcurementPlanData(flowStatus, businessId); |
| 255 | break; | 259 | break; |
| 260 | + case "PLAN_CHANGE": | ||
| 261 | + handleProcurementPlanChangeData(flowStatus, businessId); | ||
| 262 | + break; | ||
| 256 | default: | 263 | default: |
| 257 | break; | 264 | break; |
| 258 | } | 265 | } |
| @@ -1147,4 +1154,21 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -1147,4 +1154,21 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 1147 | } | 1154 | } |
| 1148 | } | 1155 | } |
| 1149 | 1156 | ||
| 1157 | + /** | ||
| 1158 | + * 采购计划变更审核业务数据处理 | ||
| 1159 | + * | ||
| 1160 | + * @param flowStatus 审核结果 | ||
| 1161 | + * @param businessId 业务ID | ||
| 1162 | + */ | ||
| 1163 | + private void handleProcurementPlanChangeData(String flowStatus, String businessId) { | ||
| 1164 | + if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) | ||
| 1165 | + || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { | ||
| 1166 | + procurementPlanChangeService.updateApprovalStatus(businessId, "PASS"); | ||
| 1167 | + } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) | ||
| 1168 | + || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus) | ||
| 1169 | + || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) { | ||
| 1170 | + procurementPlanChangeService.updateApprovalStatus(businessId, "REFUSE"); | ||
| 1171 | + } | ||
| 1172 | + } | ||
| 1173 | + | ||
| 1150 | } | 1174 | } |
| @@ -17,7 +17,10 @@ import com.lframework.xingyun.sc.entity.ContractDistributorStandard; | @@ -17,7 +17,10 @@ import com.lframework.xingyun.sc.entity.ContractDistributorStandard; | ||
| 17 | import com.lframework.xingyun.sc.entity.FundCoordination; | 17 | import com.lframework.xingyun.sc.entity.FundCoordination; |
| 18 | import com.lframework.xingyun.sc.entity.ProductSampleConfirmationSlip; | 18 | 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; | ||
| 21 | +import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService; | ||
| 20 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; | 22 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; |
| 23 | +import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo; | ||
| 21 | import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; | 24 | import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; |
| 22 | import com.lframework.xingyun.sc.service.customer.CustomerCreditService; | 25 | import com.lframework.xingyun.sc.service.customer.CustomerCreditService; |
| 23 | import com.lframework.xingyun.sc.service.ledger.FundCoordinationService; | 26 | import com.lframework.xingyun.sc.service.ledger.FundCoordinationService; |
| @@ -62,6 +65,8 @@ public class FlowTaskServiceImpl implements FlowTaskService { | @@ -62,6 +65,8 @@ public class FlowTaskServiceImpl implements FlowTaskService { | ||
| 62 | private ContractDistributorStandardService contractDistributorStandardService; | 65 | private ContractDistributorStandardService contractDistributorStandardService; |
| 63 | @Resource | 66 | @Resource |
| 64 | private ProcurementPlanService procurementPlanService; | 67 | private ProcurementPlanService procurementPlanService; |
| 68 | + @Resource | ||
| 69 | + private ProcurementPlanChangeService procurementPlanChangeService; | ||
| 65 | 70 | ||
| 66 | 71 | ||
| 67 | @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"}) | 72 | @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"}) |
| @@ -439,6 +444,7 @@ public class FlowTaskServiceImpl implements FlowTaskService { | @@ -439,6 +444,7 @@ public class FlowTaskServiceImpl implements FlowTaskService { | ||
| 439 | sampleResultTrackingService.updateExamine(id, nodeCode, message); | 444 | sampleResultTrackingService.updateExamine(id, nodeCode, message); |
| 440 | } | 445 | } |
| 441 | 446 | ||
| 447 | + @Transactional(rollbackFor = Exception.class) | ||
| 442 | @Override | 448 | @Override |
| 443 | public void updateProcurementPlanMap(Map<String, Object> map) { | 449 | public void updateProcurementPlanMap(Map<String, Object> map) { |
| 444 | //主键 | 450 | //主键 |
| @@ -448,6 +454,12 @@ public class FlowTaskServiceImpl implements FlowTaskService { | @@ -448,6 +454,12 @@ public class FlowTaskServiceImpl implements FlowTaskService { | ||
| 448 | procurementPlanService.updateExamine(id); | 454 | procurementPlanService.updateExamine(id); |
| 449 | } | 455 | } |
| 450 | 456 | ||
| 457 | + @Transactional(rollbackFor = Exception.class) | ||
| 458 | + @Override | ||
| 459 | + public void updateProcurementPlanChangeMap(Map<String, Object> map) { | ||
| 460 | + procurementPlanChangeService.updateNoFlowInstance(map); | ||
| 461 | + } | ||
| 462 | + | ||
| 451 | @Override | 463 | @Override |
| 452 | public Map<String, Object> findById(String s) { | 464 | public Map<String, Object> findById(String s) { |
| 453 | ProductSampleConfirmationSlip slip = productSampleConfirmationSlipService.findById(s); | 465 | ProductSampleConfirmationSlip slip = productSampleConfirmationSlipService.findById(s); |
| @@ -50,7 +50,7 @@ public class ProcurementPlanChangeController extends DefaultBaseController { | @@ -50,7 +50,7 @@ public class ProcurementPlanChangeController extends DefaultBaseController { | ||
| 50 | */ | 50 | */ |
| 51 | @ApiOperation("查询详情") | 51 | @ApiOperation("查询详情") |
| 52 | @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) | 52 | @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) |
| 53 | - @HasPermission({"plan-manage:plan-change:query"}) | 53 | + @HasPermission({"plan-manage:plan-change:query","plan-manage:schedule-plan:view"}) |
| 54 | @GetMapping("/findById") | 54 | @GetMapping("/findById") |
| 55 | public InvokeResult<GetProcurementPlanChangeBo> findById(@NotBlank(message = "ID不能为空!") String id) { | 55 | public InvokeResult<GetProcurementPlanChangeBo> findById(@NotBlank(message = "ID不能为空!") String id) { |
| 56 | GetProcurementPlanChangeBo result = procurementPlanChangeService.findDetail(id); | 56 | GetProcurementPlanChangeBo result = procurementPlanChangeService.findDetail(id); |
| @@ -61,7 +61,7 @@ public class ProcurementPlanChangeController extends DefaultBaseController { | @@ -61,7 +61,7 @@ public class ProcurementPlanChangeController extends DefaultBaseController { | ||
| 61 | * 新增 | 61 | * 新增 |
| 62 | */ | 62 | */ |
| 63 | @ApiOperation("新增采购计划变更单") | 63 | @ApiOperation("新增采购计划变更单") |
| 64 | - @HasPermission({"plan-manage:plan-change:add"}) | 64 | + @HasPermission({"plan-manage:schedule-plan:add"}) |
| 65 | @PostMapping("/create") | 65 | @PostMapping("/create") |
| 66 | public InvokeResult<String> create(@RequestBody @Valid CreateProcurementPlanChangeVo vo) { | 66 | public InvokeResult<String> create(@RequestBody @Valid CreateProcurementPlanChangeVo vo) { |
| 67 | vo.validate(); | 67 | vo.validate(); |
| @@ -73,7 +73,7 @@ public class ProcurementPlanChangeController extends DefaultBaseController { | @@ -73,7 +73,7 @@ public class ProcurementPlanChangeController extends DefaultBaseController { | ||
| 73 | * 修改 | 73 | * 修改 |
| 74 | */ | 74 | */ |
| 75 | @ApiOperation("修改采购计划变更单") | 75 | @ApiOperation("修改采购计划变更单") |
| 76 | - @HasPermission({"plan-manage:plan-change:supple"}) | 76 | + @HasPermission({"plan-manage:schedule-plan:modify","plan-manage:schedule-plan:approve"}) |
| 77 | @PostMapping("/update") | 77 | @PostMapping("/update") |
| 78 | public InvokeResult<Void> update(@RequestBody @Valid UpdateProcurementPlanChangeVo vo) { | 78 | public InvokeResult<Void> update(@RequestBody @Valid UpdateProcurementPlanChangeVo vo) { |
| 79 | vo.validate(); | 79 | vo.validate(); |
| @@ -81,4 +81,26 @@ public class ProcurementPlanChangeController extends DefaultBaseController { | @@ -81,4 +81,26 @@ public class ProcurementPlanChangeController extends DefaultBaseController { | ||
| 81 | return InvokeResultBuilder.success(); | 81 | return InvokeResultBuilder.success(); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | + /** | ||
| 85 | + * 采购计划变更单提交审核 | ||
| 86 | + */ | ||
| 87 | + @ApiOperation("采购计划变更单提交审核") | ||
| 88 | + @HasPermission({"plan-manage:schedule-plan:initiate"}) | ||
| 89 | + @PostMapping("/submit") | ||
| 90 | + public InvokeResult<Void> submit(@NotBlank(message = "ID不能为空!") String id) { | ||
| 91 | + procurementPlanChangeService.submit(id); | ||
| 92 | + return InvokeResultBuilder.success(); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * 取消采购计划变更单 | ||
| 97 | + */ | ||
| 98 | + @ApiOperation("取消采购计划变更单") | ||
| 99 | + @HasPermission({"plan-manage:schedule-plan:cancel"}) | ||
| 100 | + @PostMapping("/cancel") | ||
| 101 | + public InvokeResult<Void> cancel(@NotBlank(message = "ID不能为空!") String id) { | ||
| 102 | + procurementPlanChangeService.cancel(id); | ||
| 103 | + return InvokeResultBuilder.success(); | ||
| 104 | + } | ||
| 105 | + | ||
| 84 | } | 106 | } |
| @@ -70,6 +70,12 @@ public class ProcurementPlanChange extends BaseEntity implements BaseDto { | @@ -70,6 +70,12 @@ public class ProcurementPlanChange extends BaseEntity implements BaseDto { | ||
| 70 | private String purchaseDepartmentName; | 70 | private String purchaseDepartmentName; |
| 71 | 71 | ||
| 72 | /** | 72 | /** |
| 73 | + * 采购处编码 | ||
| 74 | + */ | ||
| 75 | + @TableField(exist = false) | ||
| 76 | + private String purchaseDepartmentCode; | ||
| 77 | + | ||
| 78 | + /** | ||
| 73 | * 区域 | 79 | * 区域 |
| 74 | */ | 80 | */ |
| 75 | private String region; | 81 | private String region; |
| @@ -278,6 +284,9 @@ public class ProcurementPlanChange extends BaseEntity implements BaseDto { | @@ -278,6 +284,9 @@ public class ProcurementPlanChange extends BaseEntity implements BaseDto { | ||
| 278 | */ | 284 | */ |
| 279 | private String workshopId; | 285 | private String workshopId; |
| 280 | 286 | ||
| 287 | + @TableField(exist = false) | ||
| 288 | + private String roleCode; | ||
| 289 | + | ||
| 281 | /** | 290 | /** |
| 282 | * 创建人ID | 291 | * 创建人ID |
| 283 | */ | 292 | */ |
| @@ -2,9 +2,13 @@ package com.lframework.xingyun.sc.procurement.impl.change; | @@ -2,9 +2,13 @@ package com.lframework.xingyun.sc.procurement.impl.change; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | import com.baomidou.mybatisplus.core.conditions.Wrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| 5 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
| 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 8 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 9 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 7 | import com.github.pagehelper.PageInfo; | 10 | import com.github.pagehelper.PageInfo; |
| 11 | +import com.lframework.starter.bpm.service.FlowInstanceWrapperService; | ||
| 8 | import com.lframework.starter.common.exceptions.impl.DefaultClientException; | 12 | import com.lframework.starter.common.exceptions.impl.DefaultClientException; |
| 9 | import com.lframework.starter.common.exceptions.impl.InputErrorException; | 13 | import com.lframework.starter.common.exceptions.impl.InputErrorException; |
| 10 | import com.lframework.starter.common.utils.Assert; | 14 | import com.lframework.starter.common.utils.Assert; |
| @@ -13,9 +17,7 @@ import com.lframework.starter.common.utils.StringUtil; | @@ -13,9 +17,7 @@ import com.lframework.starter.common.utils.StringUtil; | ||
| 13 | import com.lframework.starter.web.core.annotations.oplog.OpLog; | 17 | import com.lframework.starter.web.core.annotations.oplog.OpLog; |
| 14 | import com.lframework.starter.web.core.components.resp.PageResult; | 18 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 15 | import com.lframework.starter.web.core.components.security.SecurityUtil; | 19 | import com.lframework.starter.web.core.components.security.SecurityUtil; |
| 16 | -import com.lframework.starter.web.core.utils.IdUtil; | ||
| 17 | -import com.lframework.starter.web.core.utils.PageHelperUtil; | ||
| 18 | -import com.lframework.starter.web.core.utils.PageResultUtil; | 20 | +import com.lframework.starter.web.core.utils.*; |
| 19 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | 21 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 20 | import com.lframework.starter.web.inner.entity.SysRole; | 22 | import com.lframework.starter.web.inner.entity.SysRole; |
| 21 | import com.lframework.starter.web.inner.service.system.SysRoleService; | 23 | import com.lframework.starter.web.inner.service.system.SysRoleService; |
| @@ -45,6 +47,8 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -45,6 +47,8 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 45 | ServiceImpl<ProcurementPlanChangeMapper, ProcurementPlanChange> implements | 47 | ServiceImpl<ProcurementPlanChangeMapper, ProcurementPlanChange> implements |
| 46 | ProcurementPlanChangeService { | 48 | ProcurementPlanChangeService { |
| 47 | 49 | ||
| 50 | + private static final String BPM_FLAG = "PLAN_CHANGE"; | ||
| 51 | + | ||
| 48 | @Resource | 52 | @Resource |
| 49 | private ProcurementPlanService procurementPlanService; | 53 | private ProcurementPlanService procurementPlanService; |
| 50 | @Resource | 54 | @Resource |
| @@ -53,6 +57,8 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -53,6 +57,8 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 53 | private ProcurementPlanChangeLineMapper procurementPlanChangeLineMapper; | 57 | private ProcurementPlanChangeLineMapper procurementPlanChangeLineMapper; |
| 54 | @Resource | 58 | @Resource |
| 55 | private SysRoleService sysRoleService; | 59 | private SysRoleService sysRoleService; |
| 60 | + @Resource | ||
| 61 | + private FlowInstanceWrapperService flowInstanceWrapperService; | ||
| 56 | 62 | ||
| 57 | 63 | ||
| 58 | private static final List<String> PROCESS_STATUSES = Arrays.asList( | 64 | private static final List<String> PROCESS_STATUSES = Arrays.asList( |
| @@ -90,7 +96,6 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -90,7 +96,6 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 90 | ProcurementPlanChange planChange = new ProcurementPlanChange(); | 96 | ProcurementPlanChange planChange = new ProcurementPlanChange(); |
| 91 | BeanUtil.copyProperties(vo, planChange); | 97 | BeanUtil.copyProperties(vo, planChange); |
| 92 | planChange.setId(IdUtil.getId()); | 98 | planChange.setId(IdUtil.getId()); |
| 93 | - planChange.setProcessStatus("DRAFT"); | ||
| 94 | if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg") | 99 | if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg") |
| 95 | || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) { | 100 | || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) { |
| 96 | planChange.setProcessNode("CGCZG"); | 101 | planChange.setProcessNode("CGCZG"); |
| @@ -140,7 +145,7 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -140,7 +145,7 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 140 | } | 145 | } |
| 141 | ProcurementPlanChange planChange = new ProcurementPlanChange(); | 146 | ProcurementPlanChange planChange = new ProcurementPlanChange(); |
| 142 | BeanUtil.copyProperties(vo, planChange); | 147 | BeanUtil.copyProperties(vo, planChange); |
| 143 | - this.updateById(entity); | 148 | + this.updateById(planChange); |
| 144 | //保存或更新采购计划变更单明细 | 149 | //保存或更新采购计划变更单明细 |
| 145 | saveOrUpdateLines(vo.getProcurementPlanId(), vo.getLines()); | 150 | saveOrUpdateLines(vo.getProcurementPlanId(), vo.getLines()); |
| 146 | } | 151 | } |
| @@ -168,7 +173,7 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -168,7 +173,7 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 168 | throw new InputErrorException("ID不能为空!"); | 173 | throw new InputErrorException("ID不能为空!"); |
| 169 | } | 174 | } |
| 170 | 175 | ||
| 171 | - ProcurementPlanChange entity = this.getById(id); | 176 | + ProcurementPlanChange entity = this.getBaseMapper().findById(id); |
| 172 | if (entity == null) { | 177 | if (entity == null) { |
| 173 | throw new DefaultClientException("采购计划变更单不存在!"); | 178 | throw new DefaultClientException("采购计划变更单不存在!"); |
| 174 | } | 179 | } |
| @@ -186,6 +191,188 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -186,6 +191,188 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 186 | return bo; | 191 | return bo; |
| 187 | } | 192 | } |
| 188 | 193 | ||
| 194 | + @Override | ||
| 195 | + @Transactional(rollbackFor = Exception.class) | ||
| 196 | + @OpLog(type = OtherOpLogType.class, name = "采购计划变更单提交审核,ID:{}", params = {"#id"}) | ||
| 197 | + public void submit(String id) { | ||
| 198 | + if (StringUtil.isBlank(id)) { | ||
| 199 | + throw new InputErrorException("ID不能为空!"); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + ProcurementPlanChange entity = this.getById(id); | ||
| 203 | + if (entity == null) { | ||
| 204 | + throw new DefaultClientException("采购计划变更单不存在!"); | ||
| 205 | + } | ||
| 206 | + String processNode = null; | ||
| 207 | + String node = entity.getProcessNode(); | ||
| 208 | + if ("YWY".equals(node)) { | ||
| 209 | + processNode = "QYJL"; | ||
| 210 | + } else if ("QYJL".equals(node)) { | ||
| 211 | + processNode = "CGCZG"; | ||
| 212 | + } else if ("CGCZG".equals(node)) { | ||
| 213 | + processNode = "GYGLKJHGLY"; | ||
| 214 | + } | ||
| 215 | + LambdaUpdateWrapper<ProcurementPlanChange> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanChange.class) | ||
| 216 | + .set(ProcurementPlanChange::getApprovalStatus, "AUDIT") | ||
| 217 | + .set(ProcurementPlanChange::getProcessNode, processNode) | ||
| 218 | + .eq(ProcurementPlanChange::getId, id); | ||
| 219 | + getBaseMapper().update(updateWrapper); | ||
| 220 | + ProcurementPlanChange procurementPlanChange = this.getBaseMapper().findById(id); | ||
| 221 | + List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId()); | ||
| 222 | + String roleCode = null; | ||
| 223 | + if (CollectionUtil.isNotEmpty(sysRoleList)) { | ||
| 224 | + // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率 | ||
| 225 | + Set<String> roleCodeSet = sysRoleList.stream() | ||
| 226 | + .map(SysRole::getCode) | ||
| 227 | + .collect(Collectors.toSet()); | ||
| 228 | + | ||
| 229 | + // 2. 判断是否包含采购主管相关的角色 | ||
| 230 | + if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg") | ||
| 231 | + || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) { | ||
| 232 | + roleCode = "cgczg"; | ||
| 233 | + } else if (roleCodeSet.contains("qyjl")) { | ||
| 234 | + // 3. 如果没有,继续判断是否包含区域经理 | ||
| 235 | + roleCode = "qyjl"; | ||
| 236 | + } else if (roleCodeSet.contains("nmcgkywy")) { | ||
| 237 | + // 4. 如果还没有,继续判断是否包含内贸采购科业务员 | ||
| 238 | + roleCode = "nmcgkywy"; | ||
| 239 | + } else { | ||
| 240 | + throw new DefaultClientException("当前角色无法发起审核!"); | ||
| 241 | + } | ||
| 242 | + } else { | ||
| 243 | + throw new DefaultClientException("当前角色无法发起审核!"); | ||
| 244 | + } | ||
| 245 | + procurementPlanChange.setRoleCode(roleCode); | ||
| 246 | + flowInstanceWrapperService.startInstance(BPM_FLAG, entity.getId(), BPM_FLAG, procurementPlanChange); | ||
| 247 | + OpLogUtil.setVariable("id", id); | ||
| 248 | + OpLogUtil.setExtra(entity); | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + @Override | ||
| 252 | + @Transactional(rollbackFor = Exception.class) | ||
| 253 | + @OpLog(type = OtherOpLogType.class, name = "取消采购计划变更单,ID:{}", params = {"#id"}) | ||
| 254 | + public void cancel(String id) { | ||
| 255 | + if (StringUtil.isBlank(id)) { | ||
| 256 | + throw new InputErrorException("ID不能为空!"); | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + ProcurementPlanChange entity = this.getById(id); | ||
| 260 | + if (entity == null) { | ||
| 261 | + throw new DefaultClientException("采购计划变更单不存在!"); | ||
| 262 | + } | ||
| 263 | + LambdaUpdateWrapper<ProcurementPlanChange> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanChange.class) | ||
| 264 | + .set(ProcurementPlanChange::getApprovalStatus, "CANCEL") | ||
| 265 | + .set(ProcurementPlanChange::getProcessNode, null) | ||
| 266 | + .eq(ProcurementPlanChange::getId, id); | ||
| 267 | + getBaseMapper().update(updateWrapper); | ||
| 268 | + | ||
| 269 | + Wrapper<ProcurementPlan> parentWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class) | ||
| 270 | + .set(ProcurementPlan::getChangeStatus, "CHANGED") | ||
| 271 | + .eq(ProcurementPlan::getId, entity.getProcurementPlanId()); | ||
| 272 | + procurementPlanService.update(parentWrapper); | ||
| 273 | + | ||
| 274 | + OpLogUtil.setVariable("id", id); | ||
| 275 | + OpLogUtil.setExtra(entity); | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + @Override | ||
| 279 | + @Transactional(rollbackFor = Exception.class) | ||
| 280 | + @OpLog(type = OtherOpLogType.class, name = "更新采购计划变更单审核状态,ID:{}", params = {"#id"}) | ||
| 281 | + public void updateApprovalStatus(String id, String approvalStatus) { | ||
| 282 | + if (StringUtil.isBlank(id) || StringUtil.isBlank(approvalStatus)) { | ||
| 283 | + throw new InputErrorException("ID、审核状态不能为空!"); | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + ProcurementPlanChange entity = this.getById(id); | ||
| 287 | + if (entity == null) { | ||
| 288 | + throw new DefaultClientException("采购计划变更单不存在!"); | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + if ("PASS".equals(approvalStatus)) { | ||
| 292 | + LambdaUpdateWrapper<ProcurementPlanChange> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanChange.class) | ||
| 293 | + .set(ProcurementPlanChange::getApprovalStatus, approvalStatus) | ||
| 294 | + .set(ProcurementPlanChange::getProcessNode, null) | ||
| 295 | + .eq(ProcurementPlanChange::getId, id); | ||
| 296 | + getBaseMapper().update(updateWrapper); | ||
| 297 | + | ||
| 298 | + Wrapper<ProcurementPlan> parentWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class) | ||
| 299 | + .set(ProcurementPlan::getChangeStatus, "CHANGED") | ||
| 300 | + .eq(ProcurementPlan::getId, entity.getProcurementPlanId()); | ||
| 301 | + procurementPlanService.update(parentWrapper); | ||
| 302 | + //todo 拆分分厂、生产买断操作申请单、生成合同,生成一份原始的计划数据(第一次变更) | ||
| 303 | + } else if ("REFUSE".equals(approvalStatus)) { | ||
| 304 | + List<SysRole> roles = sysRoleService.getByUserId(entity.getCreateById()); | ||
| 305 | + List<String> roleCodes = CollectionUtil.isEmpty(roles) ? new java.util.ArrayList<>() | ||
| 306 | + : roles.stream().map(SysRole::getCode).collect(Collectors.toList()); | ||
| 307 | + String processNode = null; | ||
| 308 | + if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg") | ||
| 309 | + || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) { | ||
| 310 | + processNode = "CGCZG"; | ||
| 311 | + } else if (roleCodes.contains("qyjl")) { | ||
| 312 | + processNode = "QYJL"; | ||
| 313 | + } else if (roleCodes.contains("nmcgkywy")) { | ||
| 314 | + processNode = "YWY"; | ||
| 315 | + } | ||
| 316 | + | ||
| 317 | + LambdaUpdateWrapper<ProcurementPlanChange> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanChange.class) | ||
| 318 | + .set(ProcurementPlanChange::getApprovalStatus, approvalStatus) | ||
| 319 | + .set(ProcurementPlanChange::getProcessNode, processNode) | ||
| 320 | + .eq(ProcurementPlanChange::getId, id); | ||
| 321 | + getBaseMapper().update(updateWrapper); | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + OpLogUtil.setVariable("id", id); | ||
| 325 | + OpLogUtil.setExtra(entity); | ||
| 326 | + } | ||
| 327 | + | ||
| 328 | + | ||
| 329 | + @Override | ||
| 330 | + @Transactional(rollbackFor = Exception.class) | ||
| 331 | + @OpLog(type = OtherOpLogType.class, name = "采购计划变更单流程数据修改,ID:{}", params = {"#id"}) | ||
| 332 | + public void updateNoFlowInstance(Map<String, Object> map) { | ||
| 333 | + try { | ||
| 334 | + //流程编码 | ||
| 335 | + Object n = map.get("nodeCode"); | ||
| 336 | + String nodeCode = String.valueOf(n); | ||
| 337 | + | ||
| 338 | + //审核状态 | ||
| 339 | + Object e = map.get("examStatus"); | ||
| 340 | + String examStatus = String.valueOf(e); | ||
| 341 | + // 创建 ObjectMapper 实例 | ||
| 342 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
| 343 | + //先将 Map 序列化为 JSON 字符串,再反序列化为目标对象 | ||
| 344 | + String json = objectMapper.writeValueAsString(map); | ||
| 345 | + UpdateProcurementPlanChangeVo vo = JsonUtil.parseObject(json, UpdateProcurementPlanChangeVo.class); | ||
| 346 | + ProcurementPlanChange planChange = new ProcurementPlanChange(); | ||
| 347 | + BeanUtil.copyProperties(vo, planChange); | ||
| 348 | + this.updateById(planChange); | ||
| 349 | + //保存或更新采购计划变更单明细 | ||
| 350 | + saveOrUpdateLines(vo.getProcurementPlanId(), vo.getLines()); | ||
| 351 | + if ("PASS".equals(examStatus)) { | ||
| 352 | + String processNode = null; | ||
| 353 | + if ("plan_change_qyjl".equals(nodeCode)) { | ||
| 354 | + processNode = "CGCZG"; | ||
| 355 | + } else if ("plan_change_ztcgczg".equals(nodeCode) || "plan_change_ltcgczg".equals(nodeCode) | ||
| 356 | + || "plan_change_htcgyczg".equals(nodeCode) || "plan_change_htcgeczg".equals(nodeCode)) { | ||
| 357 | + processNode = "GYGLKJHGLY"; | ||
| 358 | + } else if ("plan_change_gyglkjhgly".equals(nodeCode)) { | ||
| 359 | + processNode = "GYGLKZLGLG"; | ||
| 360 | + } else if ("plan_change_gyglkzlglg".equals(nodeCode)) { | ||
| 361 | + processNode = "GYGLKZG"; | ||
| 362 | + } else if ("plan_change_gyglkzg".equals(nodeCode)) { | ||
| 363 | + processNode = "GYBZG"; | ||
| 364 | + } else if ("plan_change_gybzg".equals(nodeCode)) { | ||
| 365 | + processNode = "YSFG"; | ||
| 366 | + } | ||
| 367 | + LambdaUpdateWrapper<ProcurementPlanChange> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanChange.class) | ||
| 368 | + .set(ProcurementPlanChange::getProcessNode, processNode) | ||
| 369 | + .eq(ProcurementPlanChange::getId, vo.getId()); | ||
| 370 | + getBaseMapper().update(updateWrapper); | ||
| 371 | + } | ||
| 372 | + } catch (JsonProcessingException e) { | ||
| 373 | + e.printStackTrace(); | ||
| 374 | + } | ||
| 375 | + } | ||
| 189 | 376 | ||
| 190 | /** | 377 | /** |
| 191 | * 保存或更新采购计划变更单明细 | 378 | * 保存或更新采购计划变更单明细 |
| @@ -8,6 +8,7 @@ import com.lframework.xingyun.sc.procurement.vo.change.CreateProcurementPlanChan | @@ -8,6 +8,7 @@ import com.lframework.xingyun.sc.procurement.vo.change.CreateProcurementPlanChan | ||
| 8 | import com.lframework.xingyun.sc.procurement.vo.change.QueryProcurementPlanChangeVo; | 8 | import com.lframework.xingyun.sc.procurement.vo.change.QueryProcurementPlanChangeVo; |
| 9 | import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo; | 9 | import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo; |
| 10 | import java.util.List; | 10 | import java.util.List; |
| 11 | +import java.util.Map; | ||
| 11 | 12 | ||
| 12 | public interface ProcurementPlanChangeService extends IService<ProcurementPlanChange> { | 13 | public interface ProcurementPlanChangeService extends IService<ProcurementPlanChange> { |
| 13 | 14 | ||
| @@ -52,4 +53,33 @@ public interface ProcurementPlanChangeService extends IService<ProcurementPlanCh | @@ -52,4 +53,33 @@ public interface ProcurementPlanChangeService extends IService<ProcurementPlanCh | ||
| 52 | * @return | 53 | * @return |
| 53 | */ | 54 | */ |
| 54 | GetProcurementPlanChangeBo findDetail(String id); | 55 | GetProcurementPlanChangeBo findDetail(String id); |
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 提交审核 | ||
| 59 | + * | ||
| 60 | + * @param id | ||
| 61 | + */ | ||
| 62 | + void submit(String id); | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 取消 | ||
| 66 | + * | ||
| 67 | + * @param id | ||
| 68 | + */ | ||
| 69 | + void cancel(String id); | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 修改审核状态 | ||
| 73 | + * | ||
| 74 | + * @param id 主键 | ||
| 75 | + * @param approvalStatus 审核状态 | ||
| 76 | + */ | ||
| 77 | + void updateApprovalStatus(String id, String approvalStatus); | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * 更新审核流程数据 | ||
| 81 | + * | ||
| 82 | + * @param map 更新数据 | ||
| 83 | + */ | ||
| 84 | + void updateNoFlowInstance(Map<String, Object> map); | ||
| 55 | } | 85 | } |
| @@ -279,6 +279,12 @@ public class CreateProcurementPlanChangeVo implements BaseVo, Serializable { | @@ -279,6 +279,12 @@ public class CreateProcurementPlanChangeVo implements BaseVo, Serializable { | ||
| 279 | private String workshopId; | 279 | private String workshopId; |
| 280 | 280 | ||
| 281 | /** | 281 | /** |
| 282 | + * 变更类型 快速变更:FAST | ||
| 283 | + */ | ||
| 284 | + @ApiModelProperty("变更类型") | ||
| 285 | + private String changeType; | ||
| 286 | + | ||
| 287 | + /** | ||
| 282 | * 明细信息 | 288 | * 明细信息 |
| 283 | */ | 289 | */ |
| 284 | @ApiModelProperty(value = "明细信息", required = true) | 290 | @ApiModelProperty(value = "明细信息", required = true) |
| @@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
| 13 | <result column="supplier_name" property="supplierName"/> | 13 | <result column="supplier_name" property="supplierName"/> |
| 14 | <result column="purchase_department" property="purchaseDepartment"/> | 14 | <result column="purchase_department" property="purchaseDepartment"/> |
| 15 | <result column="purchase_department_name" property="purchaseDepartmentName"/> | 15 | <result column="purchase_department_name" property="purchaseDepartmentName"/> |
| 16 | + <result column="purchase_department_code" property="purchaseDepartmentCode"/> | ||
| 16 | <result column="region" property="region"/> | 17 | <result column="region" property="region"/> |
| 17 | <result column="region_name" property="regionName"/> | 18 | <result column="region_name" property="regionName"/> |
| 18 | <result column="date" property="date"/> | 19 | <result column="date" property="date"/> |
| @@ -75,6 +76,7 @@ | @@ -75,6 +76,7 @@ | ||
| 75 | pdc.unit_name AS supplier_name, | 76 | pdc.unit_name AS supplier_name, |
| 76 | ppc.purchase_department, | 77 | ppc.purchase_department, |
| 77 | sd.name AS purchase_department_name, | 78 | sd.name AS purchase_department_name, |
| 79 | + sd.code AS purchase_department_code, | ||
| 78 | ppc.region, | 80 | ppc.region, |
| 79 | sd1.name AS region_name, | 81 | sd1.name AS region_name, |
| 80 | ppc.date, | 82 | ppc.date, |