Commit f7ccace13e5776aac535cb1c79af6cb0c9a13333

Authored by 房远帅
1 parent 21480ca8

资金协调手续-审核后续操作

... ... @@ -1033,6 +1033,7 @@ CREATE TABLE `fund_coordination` (
1033 1033 `marketing_center_supervisor_opinion` text DEFAULT NULL COMMENT '营销中心主管审核意见',
1034 1034 `general_manager` varchar(32) DEFAULT NULL COMMENT '总经理ID',
1035 1035 `general_manager_opinion` text DEFAULT NULL COMMENT '总经理审核意见',
  1036 + `status` varchar(50) DEFAULT NULL COMMENT '审核状态',
1036 1037 `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID',
1037 1038 `create_by` varchar(20) NOT NULL COMMENT '创建人',
1038 1039 `update_by_id` varchar(32) NOT NULL COMMENT '更新人ID',
... ... @@ -1060,6 +1061,7 @@ CREATE TABLE `fund_ordering_unit` (
1060 1061 CREATE TABLE `fund_ordering_unit_detail`(
1061 1062 `id` varchar(32) NOT NULL COMMENT 'ID',
1062 1063 `fund_ordering_unit_id` varchar(32) DEFAULT NULL COMMENT '资金协调手续订货单位关联表ID',
  1064 + `ledger_id` varchar(32) DEFAULT NULL COMMENT '应收款台账明细ID',
1063 1065 `delivery_date` date DEFAULT NULL COMMENT '发货日期',
1064 1066 `accounts_receivable` varchar(50) DEFAULT NULL COMMENT '应收款(元)',
1065 1067 `status` varchar(20) DEFAULT NULL COMMENT '当前欠款状态',
... ...
... ... @@ -165,6 +165,12 @@ public class GetFundCoordinationBo extends BaseBo<FundCoordination> {
165 165 @ApiModelProperty("是否能审核")
166 166 private boolean showExamine;
167 167
  168 + /**
  169 + * 审核状态
  170 + */
  171 + @ApiModelProperty("审核状态")
  172 + private String status;
  173 +
168 174 public GetFundCoordinationBo() {
169 175
170 176 }
... ...
... ... @@ -138,6 +138,18 @@ public class QueryFundCoordinationBo extends BaseBo<FundCoordination> {
138 138 @ApiModelProperty("贸易类型")
139 139 private String type;
140 140
  141 + /**
  142 + * 是否能审核
  143 + */
  144 + @ApiModelProperty("是否能审核")
  145 + private boolean showExamine;
  146 +
  147 + /**
  148 + * 审核状态
  149 + */
  150 + @ApiModelProperty("审核状态")
  151 + private String status;
  152 +
141 153 public QueryFundCoordinationBo() {
142 154
143 155 }
... ...
... ... @@ -249,6 +249,7 @@ public class FundCoordinationController extends DefaultBaseController {
249 249 List<FundOrderingUnitDetail> fundOrderingUnitDetailList = new ArrayList<>();
250 250 for (ReceiptLedgerInfo receipt : receiptList) {
251 251 FundOrderingUnitDetail fundOrderingUnitDetail = new FundOrderingUnitDetail();
  252 + fundOrderingUnitDetail.setLedgerId(receipt.getId());
252 253 fundOrderingUnitDetail.setDeliveryDate(receipt.getShipmentDate());
253 254 if (receipt.getStartAccountReceivable() != null) {
254 255 fundOrderingUnitDetail.setAccountsReceivable(receipt.getStartAccountReceivable().stripTrailingZeros().toPlainString());
... ...
... ... @@ -221,6 +221,12 @@ public class FundCoordination extends BaseEntity implements BaseDto {
221 221 private String status;
222 222
223 223 /**
  224 + * 是否能审核
  225 + */
  226 + @TableField(exist = false)
  227 + private boolean showExamine;
  228 +
  229 + /**
224 230 * 办事处code
225 231 */
226 232 @TableField(exist = false)
... ...
... ... @@ -34,6 +34,11 @@ public class FundOrderingUnitDetail extends BaseEntity implements BaseDto {
34 34 private String fundOrderingUnitId;
35 35
36 36 /**
  37 + * 应收款台账ID
  38 + */
  39 + private String ledgerId;
  40 +
  41 + /**
37 42 * 发货日期
38 43 */
39 44 private LocalDate deliveryDate;
... ...
... ... @@ -3,8 +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.dto.FlowTaskDto;
6 7 import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
7 8 import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
  9 +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
8 10 import com.lframework.starter.common.utils.CollectionUtil;
9 11 import com.lframework.starter.web.core.components.security.SecurityUtil;
10 12 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
... ... @@ -20,20 +22,17 @@ import com.lframework.starter.web.core.components.resp.PageResult;
20 22 import com.lframework.starter.common.utils.StringUtil;
21 23 import com.lframework.starter.common.utils.ObjectUtil;
22 24 import com.lframework.starter.common.utils.Assert;
23   -import com.lframework.xingyun.sc.entity.FundCoordination;
24   -import com.lframework.xingyun.sc.entity.FundOrderingUnit;
25   -import com.lframework.xingyun.sc.entity.FundOrderingUnitDetail;
  25 +import com.lframework.xingyun.sc.entity.*;
26 26 import com.lframework.xingyun.sc.handlers.TransactorHandler;
27 27 import com.lframework.xingyun.sc.mappers.FundCoordinationMapper;
28   -import com.lframework.xingyun.sc.service.ledger.FundCoordinationService;
29   -import com.lframework.xingyun.sc.service.ledger.FundOrderingUnitDetailService;
30   -import com.lframework.xingyun.sc.service.ledger.FundOrderingUnitService;
31   -import com.lframework.xingyun.sc.service.ledger.PendingDeliveryOrderService;
  28 +import com.lframework.xingyun.sc.service.ledger.*;
  29 +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
32 30 import com.lframework.xingyun.sc.vo.ledger.detail.QueryFundOrderingUnitDetailVo;
33 31 import com.lframework.xingyun.sc.vo.ledger.fund.CreateFundCoordinationVo;
34 32 import com.lframework.xingyun.sc.vo.ledger.fund.QueryFundCoordinationVo;
35 33 import com.lframework.xingyun.sc.vo.ledger.fund.UpdateFundCoordinationVo;
36 34 import com.lframework.xingyun.sc.vo.ledger.pending.CreatePendingDeliveryOrderVo;
  35 +import com.lframework.xingyun.sc.vo.ledger.pending.QueryPendingDeliveryOrderVo;
37 36 import com.lframework.xingyun.sc.vo.ledger.rel.CreateFundOrderingUnitVo;
38 37 import com.lframework.xingyun.sc.vo.ledger.rel.QueryFundOrderingUnitVo;
39 38 import org.apache.commons.collections.CollectionUtils;
... ... @@ -41,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
41 40 import org.springframework.stereotype.Service;
42 41 import javax.annotation.Resource;
43 42 import java.util.List;
  43 +import java.util.stream.Collectors;
44 44
45 45 @Service
46 46 public class FundCoordinationServiceImpl extends BaseMpServiceImpl<FundCoordinationMapper, FundCoordination> implements FundCoordinationService {
... ... @@ -56,6 +56,12 @@ public class FundCoordinationServiceImpl extends BaseMpServiceImpl<FundCoordinat
56 56 private FlowInstanceWrapperService flowInstanceWrapperService;
57 57 @Resource
58 58 private FundOrderingUnitDetailService fundOrderingUnitDetailService;
  59 + @Resource
  60 + private ReceiptLedgerInfoService receiptLedgerInfoService;
  61 + @Resource
  62 + private PurchaseOrderInfoService purchaseOrderInfoService;
  63 + @Resource
  64 + private FlowTaskWrapperMapper flowTaskWrapperMapper;
59 65
60 66
61 67 @Override
... ... @@ -66,6 +72,21 @@ public class FundCoordinationServiceImpl extends BaseMpServiceImpl<FundCoordinat
66 72
67 73 PageHelperUtil.startPage(pageIndex, pageSize);
68 74 List<FundCoordination> datas = this.query(vo);
  75 + if (CollectionUtils.isNotEmpty(datas)) {
  76 + // 获取当前人员的待办任务数据
  77 + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
  78 + if (CollectionUtils.isEmpty(flowTaskList)) {
  79 + return PageResultUtil.convert(new PageInfo<>(datas));
  80 + }
  81 + List<String> ids = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
  82 + for (FundCoordination fundCoordination : datas) {
  83 + if (ids.contains(fundCoordination.getId())) {
  84 + fundCoordination.setShowExamine(true);
  85 + } else {
  86 + fundCoordination.setShowExamine(false);
  87 + }
  88 + }
  89 + }
69 90
70 91 return PageResultUtil.convert(new PageInfo<>(datas));
71 92 }
... ... @@ -236,19 +257,30 @@ public class FundCoordinationServiceImpl extends BaseMpServiceImpl<FundCoordinat
236 257 QueryFundOrderingUnitVo vo = new QueryFundOrderingUnitVo();
237 258 vo.setFundId(id);
238 259 List<FundOrderingUnit> fundOrderingUnitList = fundOrderingUnitService.query(vo);
239   - if (CollectionUtil.isNotEmpty(fundOrderingUnitList)){
  260 + if (CollectionUtil.isNotEmpty(fundOrderingUnitList)) {
240 261 for (FundOrderingUnit fundOrderingUnit : fundOrderingUnitList) {
241 262 //资金协调手续订货单位应收款明细
242 263 QueryFundOrderingUnitDetailVo vo1 = new QueryFundOrderingUnitDetailVo();
243 264 vo1.setFundOrderingUnitId(fundOrderingUnit.getId());
244 265 List<FundOrderingUnitDetail> fundOrderingUnitDetailList = fundOrderingUnitDetailService.query(vo1);
245 266 if (CollectionUtils.isNotEmpty(fundOrderingUnitDetailList)) {
246   - //更新应收款台账的协调办理日期
247   -
  267 + //更新应收款台账的协调办理日期
  268 + for (FundOrderingUnitDetail detail : fundOrderingUnitDetailList) {
  269 + receiptLedgerInfoService.updateCoordinateDate(detail.getLedgerId(),
  270 + detail.getCoordinateHandleDate(), detail.getStatus());
  271 + }
248 272 }
249 273 }
250 274 }
251 275 //解封订货单
  276 + QueryPendingDeliveryOrderVo vo2 = new QueryPendingDeliveryOrderVo();
  277 + vo2.setFundId(id);
  278 + List<PendingDeliveryOrder> pendingDeliveryOrderList = pendingDeliveryOrderService.query(vo2);
  279 + if (CollectionUtils.isNotEmpty(pendingDeliveryOrderList)) {
  280 + List<String> purchaseOrderIdList = pendingDeliveryOrderList
  281 + .stream().map(PendingDeliveryOrder::getPurchaseOrderId).collect(Collectors.toList());
  282 + purchaseOrderInfoService.batchUnblock(purchaseOrderIdList);
  283 + }
252 284 }
253 285
254 286
... ...
... ... @@ -65,6 +65,7 @@ public class FundOrderingUnitDetailServiceImpl extends BaseMpServiceImpl<FundOrd
65 65 FundOrderingUnitDetail data = new FundOrderingUnitDetail();
66 66 data.setId(IdUtil.getId());
67 67 data.setFundOrderingUnitId(vo.getFundOrderingUnitId());
  68 + data.setLedgerId(vo.getLedgerId());
68 69 if (vo.getDeliveryDate() != null) {
69 70 data.setDeliveryDate(vo.getDeliveryDate());
70 71 }
... ... @@ -136,6 +137,7 @@ public class FundOrderingUnitDetailServiceImpl extends BaseMpServiceImpl<FundOrd
136 137 for (CreateFundOrderingUnitDetailVo vo : createFundOrderingUnitDetailVoList) {
137 138 FundOrderingUnitDetail fundOrderingUnitDetail = new FundOrderingUnitDetail();
138 139 fundOrderingUnitDetail.setFundOrderingUnitId(vo.getFundOrderingUnitId());
  140 + fundOrderingUnitDetail.setLedgerId(vo.getLedgerId());
139 141 fundOrderingUnitDetail.setDeliveryDate(vo.getDeliveryDate());
140 142 fundOrderingUnitDetail.setAccountsReceivable(vo.getAccountsReceivable());
141 143 fundOrderingUnitDetail.setStatus(vo.getStatus());
... ...
... ... @@ -537,4 +537,53 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge
537 537 }
538 538 return targetValue;
539 539 }
  540 +
  541 + @OpLog(type = OtherOpLogType.class, name = "修改应收款台账明细,ID:{}", params = {"#id"})
  542 + @Transactional(rollbackFor = Exception.class)
  543 + @Override
  544 + public void updateCoordinateDate(String id, LocalDate coordinateDate, String debtStatus) {
  545 + ReceiptLedgerInfo data = getBaseMapper().selectById(id);
  546 + if (ObjectUtil.isNull(data)) {
  547 + throw new DefaultClientException("应收款台账明细不存在!");
  548 + }
  549 + if ("一次协调".equals(debtStatus)) {
  550 + LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class)
  551 + .set(ReceiptLedgerInfo::getCoordinateDate, coordinateDate)
  552 + .eq(ReceiptLedgerInfo::getId, id);
  553 +
  554 + getBaseMapper().update(updateWrapper);
  555 + } else if ("二次协调".equals(debtStatus)) {
  556 + LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class)
  557 + .set(ReceiptLedgerInfo::getCoordinateDate, coordinateDate)
  558 + .set(ReceiptLedgerInfo::getSecondCoordinateDate, coordinateDate)
  559 + .eq(ReceiptLedgerInfo::getId, id);
  560 +
  561 + getBaseMapper().update(updateWrapper);
  562 + } else if ("清欠".equals(debtStatus)) {
  563 + if (data.getThirdCoordinateDate() == null) {
  564 + LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class)
  565 + .set(ReceiptLedgerInfo::getCoordinateDate, coordinateDate)
  566 + .set(ReceiptLedgerInfo::getThirdCoordinateDate, coordinateDate)
  567 + .eq(ReceiptLedgerInfo::getId, id);
  568 +
  569 + getBaseMapper().update(updateWrapper);
  570 + } else if (data.getFourthCoordinateDate() == null) {
  571 + LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class)
  572 + .set(ReceiptLedgerInfo::getCoordinateDate, coordinateDate)
  573 + .set(ReceiptLedgerInfo::getFourthCoordinateDate, coordinateDate)
  574 + .eq(ReceiptLedgerInfo::getId, id);
  575 +
  576 + getBaseMapper().update(updateWrapper);
  577 + } else if (data.getFifthCoordinateDate() == null) {
  578 + LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class)
  579 + .set(ReceiptLedgerInfo::getCoordinateDate, coordinateDate)
  580 + .set(ReceiptLedgerInfo::getFifthCoordinateDate, coordinateDate)
  581 + .eq(ReceiptLedgerInfo::getId, id);
  582 +
  583 + getBaseMapper().update(updateWrapper);
  584 + }
  585 + }
  586 + OpLogUtil.setVariable("id", data.getId());
  587 + OpLogUtil.setExtra(data.getId());
  588 + }
540 589 }
... ...
... ... @@ -618,6 +618,17 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
618 618 }
619 619
620 620 @Override
  621 + public void batchUnblock(List<String> ids) {
  622 + if (CollectionUtils.isEmpty(ids)) {
  623 + return;
  624 + }
  625 + LambdaUpdateWrapper<PurchaseOrderInfo> updateWrapper = Wrappers.lambdaUpdate(PurchaseOrderInfo.class);
  626 + updateWrapper.set(PurchaseOrderInfo::isFreeze, false)
  627 + .in(PurchaseOrderInfo::getId, ids);
  628 + getBaseMapper().update(updateWrapper);
  629 + }
  630 +
  631 + @Override
621 632 public void cleanCacheByKey(Serializable key) {
622 633
623 634 }
... ...
... ... @@ -7,6 +7,7 @@ import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo;
7 7 import com.lframework.starter.web.core.service.BaseMpService;
8 8 import com.lframework.starter.web.core.components.resp.PageResult;
9 9
  10 +import java.time.LocalDate;
10 11 import java.util.List;
11 12
12 13 /**
... ... @@ -95,4 +96,13 @@ public interface ReceiptLedgerInfoService extends BaseMpService<ReceiptLedgerInf
95 96 * @return PageResult<ReceiptLedgerReportBo>
96 97 */
97 98 PageResult<ReceiptLedgerReportBo> report(Integer pageIndex, Integer pageSize, ReceiptLedgerReportVo vo);
  99 +
  100 + /**
  101 + * 更新协调办理日期
  102 + *
  103 + * @param id 主键
  104 + * @param coordinateDate 协调办事日期
  105 + * @param debtStatus 清欠状态
  106 + */
  107 + void updateCoordinateDate(String id, LocalDate coordinateDate, String debtStatus);
98 108 }
... ...
... ... @@ -139,4 +139,11 @@ public interface PurchaseOrderInfoService extends BaseMpService<PurchaseOrderInf
139 139 * @return
140 140 */
141 141 PageResult<PurchaseOrderInfo> queryFreeze(Integer pageIndex, Integer pageSize, QueryPurchaseOrderInfoVo vo);
  142 +
  143 + /**
  144 + * 批量解封
  145 + *
  146 + * @param ids
  147 + */
  148 + void batchUnblock(List<String> ids);
142 149 }
... ...
... ... @@ -23,6 +23,14 @@ public class CreateFundOrderingUnitDetailVo implements BaseVo, Serializable {
23 23 private String fundOrderingUnitId;
24 24
25 25 /**
  26 + * 应收款台账ID
  27 + */
  28 + @ApiModelProperty(value = "应收款台账ID", required = true)
  29 + @NotBlank(message = "请输入应收款台账ID!")
  30 + @Length(message = "应收款台账ID最多允许32个字符!")
  31 + private String ledgerId;
  32 +
  33 + /**
26 34 * 发货日期
27 35 */
28 36 @ApiModelProperty("发货日期")
... ...
... ... @@ -39,4 +39,10 @@ public class QueryFundCoordinationVo extends PageVo implements BaseVo, Serializa
39 39 @ApiModelProperty("客户简称")
40 40 private String shortName;
41 41
  42 + /**
  43 + * 审核状态
  44 + */
  45 + @ApiModelProperty("审核状态")
  46 + private String status;
  47 +
42 48 }
... ...
... ... @@ -39,6 +39,7 @@
39 39 <result column="marketing_center_supervisor_opinion" property="marketingCenterSupervisorOpinion"/>
40 40 <result column="general_manager" property="generalManager"/>
41 41 <result column="general_manager_opinion" property="generalManagerOpinion"/>
  42 + <result column="status" property="status"/>
42 43 <result column="create_by_id" property="createById"/>
43 44 <result column="create_by" property="createBy"/>
44 45 <result column="update_by_id" property="updateById"/>
... ... @@ -85,6 +86,7 @@
85 86 tb.marketing_center_supervisor_opinion,
86 87 tb.general_manager,
87 88 tb.general_manager_opinion,
  89 + tb.status,
88 90 tb.create_by_id,
89 91 tb.create_by,
90 92 tb.update_by_id,
... ... @@ -112,6 +114,9 @@
112 114 <if test="vo.shortName != null and vo.shortName != ''">
113 115 AND tb.customer_short_name LIKE CONCAT('%', #{vo.shortName}, '%')
114 116 </if>
  117 + <if test="vo.status != null and vo.status != ''">
  118 + AND tb.status = #{vo.status}
  119 + </if>
115 120 </where>
116 121 ORDER BY tb.create_time DESC
117 122 </select>
... ...
... ... @@ -5,6 +5,7 @@
5 5 <resultMap id="FundOrderingUnitDetail" type="com.lframework.xingyun.sc.entity.FundOrderingUnitDetail">
6 6 <id column="id" property="id"/>
7 7 <result column="fund_ordering_unit_id" property="fundOrderingUnitId"/>
  8 + <result column="ledger_id" property="ledgerId"/>
8 9 <result column="delivery_date" property="deliveryDate"/>
9 10 <result column="accounts_receivable" property="accountsReceivable"/>
10 11 <result column="status" property="status"/>
... ... @@ -25,6 +26,7 @@
25 26 SELECT
26 27 tb.id,
27 28 tb.fund_ordering_unit_id,
  29 + tb.ledger_id,
28 30 tb.delivery_date,
29 31 tb.accounts_receivable,
30 32 tb.status,
... ... @@ -56,6 +58,7 @@
56 58 INSERT INTO fund_ordering_unit_detail (
57 59 id,
58 60 fund_ordering_unit_id,
  61 + ledger_id,
59 62 delivery_date,
60 63 accounts_receivable,
61 64 status,
... ... @@ -75,6 +78,7 @@
75 78 (
76 79 #{item.id},
77 80 #{item.fundOrderingUnitId},
  81 + #{item.ledgerId},
78 82 #{item.deliveryDate},
79 83 #{item.accountsReceivable},
80 84 #{item.status},
... ...