Commit 6e1f978694fe1bde1354d989185f1762c4a151a5

Authored by 房远帅
1 parent 9b7fe037

资金协调手续-审核

... ... @@ -216,6 +216,17 @@ public class FundCoordination extends BaseEntity implements BaseDto {
216 216 private String generalManagerOpinion;
217 217
218 218 /**
  219 + * 审核状态
  220 + */
  221 + private String status;
  222 +
  223 + /**
  224 + * 办事处code
  225 + */
  226 + @TableField(exist = false)
  227 + private String deptCode;
  228 +
  229 + /**
219 230 * 创建人ID
220 231 */
221 232 @TableField(fill = FieldFill.INSERT)
... ...
... ... @@ -22,6 +22,7 @@ import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService;
22 22 import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService;
23 23 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
24 24 import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService;
  25 +import com.lframework.xingyun.sc.service.ledger.FundCoordinationService;
25 26 import com.lframework.xingyun.sc.service.order.*;
26 27 import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
27 28 import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService;
... ... @@ -111,6 +112,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
111 112 private ShipmentsPlanDetailService shipmentsPlanDetailService;
112 113 @Resource
113 114 private SysUserRoleService sysUserRoleService;
  115 + @Resource
  116 + private FundCoordinationService fundCoordinationService;
114 117
115 118
116 119
... ... @@ -176,6 +179,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
176 179 case "DELAYED_SHIPMENT":
177 180 handleDelayedShipmentData(flowStatus, businessId);
178 181 break;
  182 + case "FUND_COORDINATION":
  183 + handleFundCoordinationData(flowStatus, businessId);
  184 + break;
179 185 default:
180 186 break;
181 187 }
... ... @@ -619,6 +625,17 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
619 625 }
620 626 }
621 627
  628 + private void handleFundCoordinationData(String flowStatus, String businessId) {
  629 + if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)
  630 + || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) {
  631 + fundCoordinationService.reviewPass(businessId);
  632 + } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)
  633 + || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus)
  634 + || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) {
  635 + fundCoordinationService.updateStatus(businessId, "REFUSE");
  636 + }
  637 + }
  638 +
622 639
623 640 /**
624 641 * 通知生产科计划员
... ...
... ... @@ -3,7 +3,10 @@ package com.lframework.xingyun.sc.impl.ledger;
3 3 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.github.pagehelper.PageInfo;
  6 +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
  7 +import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
6 8 import com.lframework.starter.common.utils.CollectionUtil;
  9 +import com.lframework.starter.web.core.components.security.SecurityUtil;
7 10 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
8 11 import com.lframework.starter.web.core.utils.PageResultUtil;
9 12 import com.lframework.starter.web.core.utils.OpLogUtil;
... ... @@ -18,15 +21,22 @@ import com.lframework.starter.common.utils.StringUtil;
18 21 import com.lframework.starter.common.utils.ObjectUtil;
19 22 import com.lframework.starter.common.utils.Assert;
20 23 import com.lframework.xingyun.sc.entity.FundCoordination;
  24 +import com.lframework.xingyun.sc.entity.FundOrderingUnit;
  25 +import com.lframework.xingyun.sc.entity.FundOrderingUnitDetail;
  26 +import com.lframework.xingyun.sc.handlers.TransactorHandler;
21 27 import com.lframework.xingyun.sc.mappers.FundCoordinationMapper;
22 28 import com.lframework.xingyun.sc.service.ledger.FundCoordinationService;
  29 +import com.lframework.xingyun.sc.service.ledger.FundOrderingUnitDetailService;
23 30 import com.lframework.xingyun.sc.service.ledger.FundOrderingUnitService;
24 31 import com.lframework.xingyun.sc.service.ledger.PendingDeliveryOrderService;
  32 +import com.lframework.xingyun.sc.vo.ledger.detail.QueryFundOrderingUnitDetailVo;
25 33 import com.lframework.xingyun.sc.vo.ledger.fund.CreateFundCoordinationVo;
26 34 import com.lframework.xingyun.sc.vo.ledger.fund.QueryFundCoordinationVo;
27 35 import com.lframework.xingyun.sc.vo.ledger.fund.UpdateFundCoordinationVo;
28 36 import com.lframework.xingyun.sc.vo.ledger.pending.CreatePendingDeliveryOrderVo;
29 37 import com.lframework.xingyun.sc.vo.ledger.rel.CreateFundOrderingUnitVo;
  38 +import com.lframework.xingyun.sc.vo.ledger.rel.QueryFundOrderingUnitVo;
  39 +import org.apache.commons.collections.CollectionUtils;
30 40 import org.springframework.transaction.annotation.Transactional;
31 41 import org.springframework.stereotype.Service;
32 42 import javax.annotation.Resource;
... ... @@ -34,11 +44,19 @@ import java.util.List;
34 44
35 45 @Service
36 46 public class FundCoordinationServiceImpl extends BaseMpServiceImpl<FundCoordinationMapper, FundCoordination> implements FundCoordinationService {
  47 + private static final String BPM_FLAG = "FUND_COORDINATION";
37 48
38 49 @Resource
39 50 private FundOrderingUnitService fundOrderingUnitService;
40 51 @Resource
41 52 private PendingDeliveryOrderService pendingDeliveryOrderService;
  53 + @Resource
  54 + private TransactorHandler transactorHandler;
  55 + @Resource
  56 + private FlowInstanceWrapperService flowInstanceWrapperService;
  57 + @Resource
  58 + private FundOrderingUnitDetailService fundOrderingUnitDetailService;
  59 +
42 60
43 61 @Override
44 62 public PageResult<FundCoordination> query(Integer pageIndex, Integer pageSize, QueryFundCoordinationVo vo) {
... ... @@ -110,6 +128,7 @@ public class FundCoordinationServiceImpl extends BaseMpServiceImpl<FundCoordinat
110 128 if (!StringUtil.isBlank(vo.getType())) {
111 129 data.setType(vo.getType());
112 130 }
  131 + data.setStatus("AUDIT");
113 132
114 133 getBaseMapper().insert(data);
115 134
... ... @@ -131,6 +150,10 @@ public class FundCoordinationServiceImpl extends BaseMpServiceImpl<FundCoordinat
131 150 }
132 151 OpLogUtil.setVariable("id", data.getId());
133 152 OpLogUtil.setExtra(vo);
  153 + //审核
  154 + String deptCode = transactorHandler.returnDeptCode(SecurityUtil.getCurrentUser().getId());
  155 + data.setDeptCode(deptCode);
  156 + flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data);
134 157
135 158 return data.getId();
136 159 }
... ... @@ -178,6 +201,57 @@ public class FundCoordinationServiceImpl extends BaseMpServiceImpl<FundCoordinat
178 201 getBaseMapper().deleteById(id);
179 202 }
180 203
  204 + @OpLog(type = OtherOpLogType.class, name = "修改资金协调手续,ID:{}", params = {"#id"})
  205 + @Transactional(rollbackFor = Exception.class)
  206 + @Override
  207 + public void updateStatus(String id, String status) {
  208 +
  209 + FundCoordination data = getBaseMapper().findById(id);
  210 + if (ObjectUtil.isNull(data)) {
  211 + throw new DefaultClientException("资金协调手续不存在!");
  212 + }
  213 +
  214 + LambdaUpdateWrapper<FundCoordination> updateWrapper = Wrappers.lambdaUpdate(FundCoordination.class)
  215 + .set(FundCoordination::getStatus, StringUtil.isBlank(status) ? null : status)
  216 + .eq(FundCoordination::getId, id);
  217 +
  218 + getBaseMapper().update(updateWrapper);
  219 +
  220 + OpLogUtil.setVariable("id", data.getId());
  221 + OpLogUtil.setExtra(id);
  222 + }
  223 +
  224 + @OpLog(type = OtherOpLogType.class, name = "修改资金协调手续,ID:{}", params = {"#id"})
  225 + @Transactional(rollbackFor = Exception.class)
  226 + @Override
  227 + public void reviewPass(String id) {
  228 +
  229 + FundCoordination data = getBaseMapper().findById(id);
  230 + if (ObjectUtil.isNull(data)) {
  231 + throw new DefaultClientException("资金协调手续不存在!");
  232 + }
  233 + //更新状态
  234 + updateStatus(id, "PASS");
  235 + //更新应收款台账的协调办理日期
  236 + QueryFundOrderingUnitVo vo = new QueryFundOrderingUnitVo();
  237 + vo.setFundId(id);
  238 + List<FundOrderingUnit> fundOrderingUnitList = fundOrderingUnitService.query(vo);
  239 + if (CollectionUtil.isNotEmpty(fundOrderingUnitList)){
  240 + for (FundOrderingUnit fundOrderingUnit : fundOrderingUnitList) {
  241 + //资金协调手续订货单位应收款明细
  242 + QueryFundOrderingUnitDetailVo vo1 = new QueryFundOrderingUnitDetailVo();
  243 + vo1.setFundOrderingUnitId(fundOrderingUnit.getId());
  244 + List<FundOrderingUnitDetail> fundOrderingUnitDetailList = fundOrderingUnitDetailService.query(vo1);
  245 + if (CollectionUtils.isNotEmpty(fundOrderingUnitDetailList)) {
  246 + //更新应收款台账的协调办理日期
  247 +
  248 + }
  249 + }
  250 + }
  251 + //解封订货单
  252 + }
  253 +
  254 +
181 255 @Override
182 256 public void cleanCacheByKey(Serializable key) {
183 257
... ...
... ... @@ -52,4 +52,19 @@ public interface FundCoordinationService extends BaseMpService<FundCoordination>
52 52 * @return
53 53 */
54 54 void deleteById(String id);
  55 +
  56 + /**
  57 + * 更新审核状态
  58 + *
  59 + * @param id 主键
  60 + * @param status 审核状态
  61 + */
  62 + void updateStatus(String id, String status);
  63 +
  64 + /**
  65 + * 审核通过
  66 + *
  67 + * @param id 主键
  68 + */
  69 + void reviewPass(String id);
55 70 }
... ...