From 58b231cda07936e4b42ccf9dbf1c0c437c76843a Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Tue, 24 Nov 2020 17:54:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=9B=9E=E6=AC=BE=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E5=8F=8A=E6=94=BE=E6=AC=BE=E9=80=9A=E7=9F=A5=EF=BC=88?= =?UTF-8?q?=E6=97=A0=E6=B7=BB=E5=8A=A0=E4=B8=9A=E5=8A=A1=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/sqldialects.xml | 1 + .../controller/DgLoanNoticeController.java | 50 +++++++- ...PaymentConfirmationConsiderController.java | 2 +- .../guarantee/mapper/DgLoanNoticeMapper.java | 4 + .../model/request/LoanNoticeListRequest.java | 18 +++ .../model/request/LoanNoticeQueryRequest.java | 32 +++++ .../request/LoanNoticeUpdateRequest.java | 26 ++++ .../PaymentConfirmationUpdateRequest.java | 4 +- .../response/LoanNoticeListResponse.java | 71 +++++++++++ .../service/IDgLoanNoticeService.java | 6 + ...gGuaranteeLetterAssignUserServiceImpl.java | 3 +- .../service/impl/DgLoanNoticeServiceImpl.java | 86 +++++++++++++ ...aymentConfirmationConsiderServiceImpl.java | 120 ++++++++++++++++-- .../DgGuaranteeLetterAssignUserMapper.xml | 4 +- .../mapper/guarantee/DgLoanNoticeMapper.xml | 37 +++++- .../DgPaymentConfirmationConsiderMapper.xml | 6 +- .../domain/guarantee/DgLoanNotice.java | 31 +++-- .../DgPaymentConfirmationConsider.java | 5 +- 18 files changed, 463 insertions(+), 43 deletions(-) create mode 100644 dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeListRequest.java create mode 100644 dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeQueryRequest.java create mode 100644 dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeUpdateRequest.java create mode 100644 dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/LoanNoticeListResponse.java diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml index d6d96c14..7f3f3332 100644 --- a/.idea/sqldialects.xml +++ b/.idea/sqldialects.xml @@ -2,6 +2,7 @@ + \ No newline at end of file diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgLoanNoticeController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgLoanNoticeController.java index 3945c2c2..4208d0f8 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgLoanNoticeController.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgLoanNoticeController.java @@ -1,14 +1,28 @@ package com.daqing.financial.guarantee.controller; +import com.daqing.financial.guarantee.model.request.*; +import com.daqing.financial.guarantee.model.response.LoanNoticeListResponse; +import com.daqing.financial.guarantee.model.response.PaymentConfirmationListResponse; import com.daqing.financial.guarantee.service.IDgLoanNoticeService; import com.daqing.financial.guarantee.service.impl.DgLoanNoticeServiceImpl; +import com.daqing.framework.model.response.ResponseResult; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.utils.excel.EasyExcelUtil; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + /** *

* 放款通知 前端控制器 @@ -23,6 +37,40 @@ import org.springframework.web.bind.annotation.RestController; public class DgLoanNoticeController { @Autowired - private IDgLoanNoticeService iDgLoanNoticeService; + private IDgLoanNoticeService loanNoticeService; + + @ApiOperation(value = "放款通知记录列表") + @PostMapping("/loanNoticeList") + public ResponseResult loanNoticeList( + @ApiParam(name = "loanNoticeQueryRequest", value = "放款通知列表查询条件", required = true) + @RequestBody LoanNoticeQueryRequest loanNoticeQueryRequest){ + PageUtils data = loanNoticeService.queryPage(loanNoticeQueryRequest); + return new ResponseResult().SUCCESS(data); + } + + + @ApiOperation(value = "导出放款通知列表数据") + @PostMapping("/loanNoticeListExport") + public void loanNoticeListExport( + @ApiParam(name = "loanNoticeListRequest", value = "放款通知列表数据", required = true) + @RequestBody LoanNoticeListRequest loanNoticeListRequest, HttpServletResponse response){ + //获取放款通知列表数据 + List loanNoticeListResponseList = loanNoticeListRequest.getLoanNoticeListResponseList(); + try { + //导出excel文件 + EasyExcelUtil.download(response, LoanNoticeListResponse.class, loanNoticeListResponseList,"放款通知列表","第一页"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @ApiOperation(value = "更新放款通知状态") + @PostMapping("/updateLoanNotice") + public ResponseResult updateLoanNotice( + @ApiParam(name = "loanNoticeUpdateRequest", value = "更新放款通知请求", required = true) + @RequestBody LoanNoticeUpdateRequest loanNoticeUpdateRequest) { + boolean result = loanNoticeService.updateLoanNotice(loanNoticeUpdateRequest); + return result ? ResponseResult.SUCCESS("更新成功!"):ResponseResult.FAIL(40005,"更新失败!"); + } } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgPaymentConfirmationConsiderController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgPaymentConfirmationConsiderController.java index 828d0a59..0d3eff76 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgPaymentConfirmationConsiderController.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgPaymentConfirmationConsiderController.java @@ -42,7 +42,7 @@ public class DgPaymentConfirmationConsiderController { @ApiOperation(value = "回款确认记录列表") @PostMapping("/paymentConfirmationList") public ResponseResult paymentConfirmationList( - @ApiParam(name = "paymentConfirmationRequest", value = "回款确认列表查询条件", required = true) + @ApiParam(name = "paymentConfirmationQueryRequest", value = "回款确认列表查询条件", required = true) @RequestBody PaymentConfirmationQueryRequest paymentConfirmationQueryRequest){ PageUtils data = paymentConfirmationConsiderService.queryPage(paymentConfirmationQueryRequest); return new ResponseResult().SUCCESS(data); diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgLoanNoticeMapper.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgLoanNoticeMapper.java index 1fb0f4d7..793f3beb 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgLoanNoticeMapper.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgLoanNoticeMapper.java @@ -1,6 +1,9 @@ package com.daqing.financial.guarantee.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.daqing.financial.guarantee.model.response.LoanNoticeListResponse; import com.daqing.framework.domain.guarantee.DgLoanNotice; import org.apache.ibatis.annotations.Mapper; @@ -15,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface DgLoanNoticeMapper extends BaseMapper { + IPage pageByCondition(Page page, Integer roleId, Integer status, String customerNumberOrName); } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeListRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeListRequest.java new file mode 100644 index 00000000..70192517 --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeListRequest.java @@ -0,0 +1,18 @@ +package com.daqing.financial.guarantee.model.request; + +import com.daqing.financial.guarantee.model.response.LoanNoticeListResponse; +import lombok.Data; + +import java.util.List; + +/** + * @Author chen + * @DATE 2020/11/24 11:58 + * @Version 1.0 + */ +@Data +public class LoanNoticeListRequest { + + private List loanNoticeListResponseList; + +} diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeQueryRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeQueryRequest.java new file mode 100644 index 00000000..f3b3e834 --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeQueryRequest.java @@ -0,0 +1,32 @@ +package com.daqing.financial.guarantee.model.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Author chen + * @DATE 2020/11/24 10:58 + * @Version 1.0 + * 放款通知列表查询条件 + */ +@Data +public class LoanNoticeQueryRequest { + + @ApiModelProperty(value = "当前页码,默认为第一页") + private Integer page = 1; + + @ApiModelProperty(value = "每页记录数,默认显示10条") + private Integer size = 10; + + @ApiModelProperty(value = "流程状态:1->审核中、2->拒绝、3->已审核") + private Integer status; + + @ApiModelProperty(value = "业务编号/客户名称") + private String CustomerNumberOrName; + + @NotNull + @ApiModelProperty(value = "角色ID") + private Integer roleId; +} diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeUpdateRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeUpdateRequest.java new file mode 100644 index 00000000..221e4234 --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/LoanNoticeUpdateRequest.java @@ -0,0 +1,26 @@ +package com.daqing.financial.guarantee.model.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2020/11/24 12:00 + * @Version 1.0 + */ +@Data +public class LoanNoticeUpdateRequest { + + @ApiModelProperty(value = "当前用户") + private Integer currentUser; + + @ApiModelProperty(value = "业务id") + private Integer businessId; + + @ApiModelProperty(value = "状态") + private Integer status; + + @ApiModelProperty(value = "审核意见") + private String auditOpinion; + +} diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/PaymentConfirmationUpdateRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/PaymentConfirmationUpdateRequest.java index 3e9b736b..0f75c9bd 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/PaymentConfirmationUpdateRequest.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/PaymentConfirmationUpdateRequest.java @@ -14,8 +14,8 @@ public class PaymentConfirmationUpdateRequest { @ApiModelProperty(value = "当前用户") private Integer currentUser; - @ApiModelProperty(value = "id") - private Integer id; + @ApiModelProperty(value = "业务id") + private Integer businessId; @ApiModelProperty(value = "状态") private Integer status; diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/LoanNoticeListResponse.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/LoanNoticeListResponse.java new file mode 100644 index 00000000..cc48aee2 --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/LoanNoticeListResponse.java @@ -0,0 +1,71 @@ +package com.daqing.financial.guarantee.model.response; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.daqing.framework.utils.excel.ApprovalStatusConverter; +import com.daqing.framework.utils.excel.BusinessStatusConverter; +import com.daqing.framework.utils.excel.OperatingStatusConverter; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @Author chen + * @DATE 2020/11/24 11:01 + * @Version 1.0 + * 放款通知列表返回数据 + */ +@Data +public class LoanNoticeListResponse { + + @ApiModelProperty("唯一标识") + private Integer id; + + @ApiModelProperty(value = "审核意见") + private String auditOpinion; + + @ApiModelProperty("银行名称") + private String bank; + + @ApiModelProperty("业务编号") + @ExcelProperty(value = "业务编号",index = 0) + private String businessCode; + + @ApiModelProperty("客户名称") + @ExcelProperty(value = "客户名称",index = 1) + private String name; + + @ApiModelProperty("联系电话") + @ExcelProperty(value = "联系电话",index = 2) + private String phone; + + @ApiModelProperty("业务类别") + @ExcelProperty(value = "业务类别",index = 3) + private String businessType; + + @ApiModelProperty("金额") + @ExcelProperty(value = "金额",index = 4) + private Double applyAmount; + + @ApiModelProperty("期限") + @ExcelProperty(value = "期数",index = 5) + private String applyTime; + + @ApiModelProperty("申请日期") + @ExcelProperty(value = "申请日期",index = 6) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date createTime; + + @ApiModelProperty("审核状态") + @ExcelProperty(value = "审核状态",index = 7,converter = ApprovalStatusConverter.class) + private Integer status; + + @ApiModelProperty("业务状态") + @ExcelProperty(value = "业务状态",index = 8,converter = BusinessStatusConverter.class) + private Integer businessStatus; + + @ApiModelProperty("操作状态") + @ExcelProperty(value = "操作状态",index = 9,converter = OperatingStatusConverter.class) + private Integer operatingStatus; +} diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgLoanNoticeService.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgLoanNoticeService.java index c3233b13..16c98405 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgLoanNoticeService.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgLoanNoticeService.java @@ -1,7 +1,10 @@ package com.daqing.financial.guarantee.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.financial.guarantee.model.request.LoanNoticeQueryRequest; +import com.daqing.financial.guarantee.model.request.LoanNoticeUpdateRequest; import com.daqing.framework.domain.guarantee.DgLoanNotice; +import com.daqing.framework.utils.PageUtils; /** *

@@ -13,4 +16,7 @@ import com.daqing.framework.domain.guarantee.DgLoanNotice; */ public interface IDgLoanNoticeService extends IService { + PageUtils queryPage(LoanNoticeQueryRequest loanNoticeQueryRequest); + + boolean updateLoanNotice(LoanNoticeUpdateRequest loanNoticeUpdateRequest); } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgGuaranteeLetterAssignUserServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgGuaranteeLetterAssignUserServiceImpl.java index c8443df5..2b78760b 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgGuaranteeLetterAssignUserServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgGuaranteeLetterAssignUserServiceImpl.java @@ -253,8 +253,9 @@ public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl 0 ? "资产部经理成功添加回款数据" : "资产部经理添加回款数据失败"); diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgLoanNoticeServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgLoanNoticeServiceImpl.java index ea998d13..f9985852 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgLoanNoticeServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgLoanNoticeServiceImpl.java @@ -1,9 +1,24 @@ package com.daqing.financial.guarantee.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.daqing.financial.guarantee.mapper.DgLoanNoticeMapper; +import com.daqing.financial.guarantee.mapper.DgPaymentConfirmationConsiderMapper; +import com.daqing.financial.guarantee.model.request.LoanNoticeQueryRequest; +import com.daqing.financial.guarantee.model.request.LoanNoticeUpdateRequest; +import com.daqing.financial.guarantee.model.response.LoanNoticeListResponse; +import com.daqing.financial.guarantee.model.response.PaymentConfirmationListResponse; import com.daqing.financial.guarantee.service.IDgLoanNoticeService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.daqing.framework.domain.guarantee.DgLoanNotice; +import com.daqing.framework.domain.guarantee.DgPaymentConfirmationConsider; +import com.daqing.framework.model.StatusCode; +import com.daqing.framework.model.response.PromptSuccess; +import com.daqing.framework.utils.PageUtils; +import jdk.nashorn.internal.ir.IfNode; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -14,7 +29,78 @@ import org.springframework.stereotype.Service; * @author Qyq * @since 2020-11-05 */ +@Slf4j @Service public class DgLoanNoticeServiceImpl extends ServiceImpl implements IDgLoanNoticeService { + @Autowired + private DgPaymentConfirmationConsiderMapper paymentConfirmationConsiderMapper; + + @Override + public PageUtils queryPage(LoanNoticeQueryRequest loanNoticeQueryRequest) { + //取出条件 + Integer page = loanNoticeQueryRequest.getPage(); + Integer size = loanNoticeQueryRequest.getSize(); + Integer status = loanNoticeQueryRequest.getStatus(); + //a根据角色id查询 + Integer roleId = loanNoticeQueryRequest.getRoleId(); + String customerNumberOrName = loanNoticeQueryRequest.getCustomerNumberOrName(); + //分页条件查询 + IPage loanNoticeVO = baseMapper.pageByCondition(new Page(page,size),roleId,status,customerNumberOrName); + return new PageUtils(loanNoticeVO); + } + + @Override + public boolean updateLoanNotice(LoanNoticeUpdateRequest loanNoticeUpdateRequest) { + // TODO 所有操作待添加业务流程数据 + //取出条件 + Integer businessId = loanNoticeUpdateRequest.getBusinessId(); + Integer currentUser = loanNoticeUpdateRequest.getCurrentUser(); + String auditOpinion = loanNoticeUpdateRequest.getAuditOpinion(); + //状态为2表示通过,为4表示驳回 + Integer status = loanNoticeUpdateRequest.getStatus(); + + //提交操作,更新数据 + if (StatusCode.SP_REVIEWED.equals(status)){ + QueryWrapper loanNoticeQueryWrapper = new QueryWrapper<>(); + loanNoticeQueryWrapper.eq("business_id",businessId).eq("role_id", PromptSuccess.FG_JL_ID); + DgLoanNotice loanNotice = baseMapper.selectOne(loanNoticeQueryWrapper); + loanNotice.setAuditOpinion(auditOpinion); + loanNotice.setConsiderId(currentUser); + loanNotice.setStatus(StatusCode.SP_REVIEWED); + loanNotice.setOperatingStatus(StatusCode.CZ_PROCESSED); + int update = baseMapper.updateById(loanNotice); + //TODO 更新成功更新业务流程已完成 + if (update > 0){ + return update > 0; + } + } + + //驳回操作,更新数据和资产部经理数据及返回上一流程 + if (StatusCode.SP_REJECT.equals(status)){ + QueryWrapper loanNoticeQueryWrapper = new QueryWrapper<>(); + loanNoticeQueryWrapper.eq("business_id",businessId).eq("role_id", PromptSuccess.FG_JL_ID); + DgLoanNotice loanNotice = baseMapper.selectOne(loanNoticeQueryWrapper); + loanNotice.setAuditOpinion(auditOpinion); + loanNotice.setConsiderId(currentUser); + loanNotice.setStatus(StatusCode.SP_REVIEWED); + loanNotice.setOperatingStatus(StatusCode.CZ_PROCESSED); + int update = baseMapper.updateById(loanNotice); + //更新成功,更新回款确认的财务部经理数据 + if (update > 0){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id", PromptSuccess.CWB_ID); + DgPaymentConfirmationConsider paymentConfirmationConsider = paymentConfirmationConsiderMapper.selectOne(queryWrapper); + paymentConfirmationConsider.setStatus(StatusCode.SP_REJECT); + paymentConfirmationConsider.setOperatingStatus(StatusCode.CZ_ON_HAND); + int updateById = paymentConfirmationConsiderMapper.updateById(paymentConfirmationConsider); + //更新成功,返回操作结果 + log.info(updateById > 0 ? "驳回更新财务部经理成功" : "驳回更新财务部经理失败"); + return updateById > 0; + } + } + //一个判断都不走,直接返回false + log.info("《《《《《数据更新失败,请确保数据完整》》》》》"); + return false; + } } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgPaymentConfirmationConsiderServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgPaymentConfirmationConsiderServiceImpl.java index 8d109a3c..cb7307ab 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgPaymentConfirmationConsiderServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgPaymentConfirmationConsiderServiceImpl.java @@ -1,15 +1,24 @@ package com.daqing.financial.guarantee.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.daqing.financial.guarantee.mapper.DgGuaranteeLetterAssignUserMapper; +import com.daqing.financial.guarantee.mapper.DgLoanNoticeMapper; import com.daqing.financial.guarantee.mapper.DgPaymentConfirmationConsiderMapper; import com.daqing.financial.guarantee.model.request.PaymentConfirmationQueryRequest; import com.daqing.financial.guarantee.model.request.PaymentConfirmationUpdateRequest; import com.daqing.financial.guarantee.model.response.PaymentConfirmationListResponse; import com.daqing.financial.guarantee.service.IDgPaymentConfirmationConsiderService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.framework.domain.guarantee.DgGuaranteeLetterAssignUser; +import com.daqing.framework.domain.guarantee.DgLoanNotice; import com.daqing.framework.domain.guarantee.DgPaymentConfirmationConsider; +import com.daqing.framework.model.StatusCode; +import com.daqing.framework.model.response.PromptSuccess; import com.daqing.framework.utils.PageUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -20,9 +29,16 @@ import org.springframework.stereotype.Service; * @author Qyq * @since 2020-11-05 */ +@Slf4j @Service public class DgPaymentConfirmationConsiderServiceImpl extends ServiceImpl implements IDgPaymentConfirmationConsiderService { + @Autowired + private DgLoanNoticeMapper dgLoanNoticeMapper; + + @Autowired + private DgGuaranteeLetterAssignUserMapper guaranteeLetterAssignUserMapper; + @Override public PageUtils queryPage(PaymentConfirmationQueryRequest paymentConfirmationQueryRequest) { //取出条件 @@ -40,24 +56,102 @@ public class DgPaymentConfirmationConsiderServiceImpl extends ServiceImpl queryWrapperTemp = new QueryWrapper<>(); + queryWrapperTemp.eq("business_id",businessId).eq("role_id", PromptSuccess.CWB_ID); + DgPaymentConfirmationConsider paymentConfirmationConsiderTemp = baseMapper.selectOne(queryWrapperTemp); + Integer approveStatus = paymentConfirmationConsiderTemp.getStatus(); + + //之前状态为审批中,同意则添加放款通知数据给法规部经理 + if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id", PromptSuccess.CWB_ID); + DgPaymentConfirmationConsider paymentConfirmationConsider = baseMapper.selectOne(queryWrapper); + paymentConfirmationConsider.setAuditOpinion(auditOpinion); + paymentConfirmationConsider.setConsiderId(currentUser); + paymentConfirmationConsider.setStatus(StatusCode.SP_REVIEWED); + paymentConfirmationConsider.setOperatingStatus(StatusCode.CZ_PROCESSED); + paymentConfirmationConsider.setImgFile(imgFile); + int update = baseMapper.updateById(paymentConfirmationConsider); + + Integer companyId = paymentConfirmationConsider.getCompanyId(); + //更新成功,添加法规部经理数据 + if (update > 0){ + DgLoanNotice loanNotice = new DgLoanNotice(); + loanNotice.setCompanyId(companyId); + loanNotice.setBusinessId(businessId); + loanNotice.setRoleId(PromptSuccess.FG_JL_ID); + int insert = dgLoanNoticeMapper.insert(loanNotice); + //更新成功,返回操作结果 + log.info(insert > 0 ? "财务部经理确认成功" : "财务部经理确认失败"); + return insert > 0; + } } - int i = baseMapper.updateById(paymentConfirmationConsider); - return i>0; + + //之前状态为驳回,同意则更新放款通知数据给法规部经理 + if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id", PromptSuccess.CWB_ID); + DgPaymentConfirmationConsider paymentConfirmationConsider = baseMapper.selectOne(queryWrapper); + paymentConfirmationConsider.setAuditOpinion(auditOpinion); + paymentConfirmationConsider.setConsiderId(currentUser); + paymentConfirmationConsider.setStatus(StatusCode.SP_REVIEWED); + paymentConfirmationConsider.setOperatingStatus(StatusCode.CZ_PROCESSED); + paymentConfirmationConsider.setImgFile(imgFile); + int update = baseMapper.updateById(paymentConfirmationConsider); + //更新成功,更新法规部经理数据 + if (update > 0){ + QueryWrapper loanNoticeQueryWrapper = new QueryWrapper<>(); + loanNoticeQueryWrapper.eq("business_id",businessId).eq("role_id", PromptSuccess.FG_JL_ID); + DgLoanNotice loanNotice = dgLoanNoticeMapper.selectOne(loanNoticeQueryWrapper); + //清空审批意见 + loanNotice.setAuditOpinion(""); + loanNotice.setStatus(StatusCode.SP_IN_REVIEW); + loanNotice.setOperatingStatus(StatusCode.CZ_ON_HAND); + int updateById = dgLoanNoticeMapper.updateById(loanNotice); + //更新成功,返回操作结果 + log.info(updateById > 0 ? "驳回后再次财务部经理确认成功" : "驳回后再次财务部经理确认失败"); + return updateById > 0; + } + } + + //驳回操作,更新数据和资产部经理数据及返回上一流程 + if (StatusCode.SP_REJECT.equals(status)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id", PromptSuccess.CWB_ID); + DgPaymentConfirmationConsider paymentConfirmationConsider = baseMapper.selectOne(queryWrapper); + paymentConfirmationConsider.setAuditOpinion(auditOpinion); + paymentConfirmationConsider.setConsiderId(currentUser); + paymentConfirmationConsider.setStatus(StatusCode.SP_REJECT); + paymentConfirmationConsider.setOperatingStatus(StatusCode.CZ_PROCESSED); + paymentConfirmationConsider.setImgFile(imgFile); + int update = baseMapper.updateById(paymentConfirmationConsider); + //更新成功,更新资产部经理数据 + if (update > 0){ + QueryWrapper guaranteeLetterAssignUserQueryWrapper = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapper.eq("business_id",businessId).eq("role_id", PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = guaranteeLetterAssignUserMapper.selectOne(guaranteeLetterAssignUserQueryWrapper); + dgGuaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); + dgGuaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_ON_HAND); + int updateById = guaranteeLetterAssignUserMapper.updateById(dgGuaranteeLetterAssignUser); + //更新成功,返回操作结果 + log.info(updateById > 0 ? "驳回更新资产部经理成功" : "驳回更新资产部经理失败"); + return updateById > 0; + } + } + + //一个判断都不走,直接返回false + log.info("《《《《《数据更新失败,请确保数据完整》》》》》"); + return false; } } diff --git a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgGuaranteeLetterAssignUserMapper.xml b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgGuaranteeLetterAssignUserMapper.xml index aaa021a9..406d2cb6 100644 --- a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgGuaranteeLetterAssignUserMapper.xml +++ b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgGuaranteeLetterAssignUserMapper.xml @@ -32,8 +32,8 @@ + select ln.id,aai.business_code,cc.name,cc.phone,aai.business_type,aai.apply_amount,aai.apply_time, + aai.create_time,ln.status,aai.bank,ln.audit_opinion,ln.operating_status,bps.business_status + from dg_loan_notice ln + left join dg_apply_amount_info aai on ln.business_id = aai.id + left join crms_company_customer ccc on ln.company_id = ccc.id + left join crms_customer cc on ccc.customer_id = cc.id + left join dg_business_process_status bps on ln.business_id = bps.business_id + + AND ln.role_id = #{roleId} + + AND aai.business_code LIKE CONCAT('%',#{customerNumberOrName},'%') OR cc.name LIKE CONCAT('%',#{customerNumberOrName},'%') + + + AND ln.status = #{status} + + + + diff --git a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgPaymentConfirmationConsiderMapper.xml b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgPaymentConfirmationConsiderMapper.xml index deb4b753..9e3cd102 100644 --- a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgPaymentConfirmationConsiderMapper.xml +++ b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgPaymentConfirmationConsiderMapper.xml @@ -29,16 +29,18 @@ +