diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgGuaranteeLetterAssignUserController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgGuaranteeLetterAssignUserController.java
index 3e72b47f..14ce8bc5 100644
--- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgGuaranteeLetterAssignUserController.java
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgGuaranteeLetterAssignUserController.java
@@ -1,10 +1,16 @@
package com.daqing.financial.guarantee.controller;
-import com.daqing.financial.guarantee.model.request.GuaranteeLetterRequest;
+import ch.qos.logback.core.rolling.helper.IntegerTokenConverter;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterAddRequest;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterListRequest;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterQueryRequest;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterUpdateStatusRequest;
+import com.daqing.financial.guarantee.model.response.GuaranteeLetterResponse;
import com.daqing.financial.guarantee.service.IDgGuaranteeLetterAssignUserService;
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;
@@ -12,7 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
-;
+import java.io.IOException;
+import java.util.List;
/**
*
@@ -31,30 +38,47 @@ public class DgGuaranteeLetterAssignUserController {
private IDgGuaranteeLetterAssignUserService guaranteeLetterAssignUserService;
@ApiOperation(value = "担保函记录列表")
- @GetMapping("/guaranteeLetterList")
+ @PostMapping("/guaranteeLetterList")
public ResponseResult guaranteeLetterList(
- @ApiParam(name = "page", value = "当前页码,默认为第一页", required = false)
- @RequestParam(value="page",required=false) Integer page,
- @ApiParam(name = "size", value = "每页记录数,默认显示10条", required = false)
- @RequestParam(value="size",required=false) Integer size,
- @ApiParam(name = "customerNumberOrName", value = "业务编号/客户名称", required = false)
- @RequestParam(value = "customerNumberOrName", required = false) String customerNumberOrName,
- @ApiParam(name = "status", value = "流程状态:1->审核中、2->拒绝、3->已审核", required = false)
- @RequestParam(value = "status", required = false) Integer status){
- PageUtils data = guaranteeLetterAssignUserService.queryPage(page,size,customerNumberOrName,status);
+ @ApiParam(name = "guaranteeLetterRequest", value = "担保函列表查询条件", required = true)
+ @RequestBody GuaranteeLetterQueryRequest guaranteeLetterQueryRequest){
+ PageUtils data = guaranteeLetterAssignUserService.queryPage(guaranteeLetterQueryRequest);
return new ResponseResult().SUCCESS(data);
}
- @ApiOperation(value = "导出全部数据")
- @GetMapping("/excelExport")
- public void excelExport(
- @ApiParam(name = "", value = "", required = true)
- HttpServletResponse response){
- // try {
- // guaranteeLetterAssignUserService.export(response,contestId);
- // } catch (IOException e) {
- // e.printStackTrace();
- // }
+ @ApiOperation(value = "导出担保函列表数据")
+ @PostMapping("/guaranteeLetterListExport")
+ public void guaranteeLetterListExport(
+ @ApiParam(name = "guaranteeLetterListRequest", value = "担保函列表数据", required = true)
+ @RequestBody GuaranteeLetterListRequest guaranteeLetterListRequest, HttpServletResponse response){
+ //获取担保函列表数据
+ List guaranteeLetterResponseList = guaranteeLetterListRequest.getGuaranteeLetterResponseList();
+ try {
+ //导出excel文件
+ EasyExcelUtil.download(response,GuaranteeLetterResponse.class,guaranteeLetterResponseList,"担保函列表","第一页");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
+
+ @ApiOperation(value = "添加担保函记录")
+ @PostMapping("/addGuaranteeLetter")
+ public ResponseResult addGuaranteeLetter(
+ @ApiParam(name = "guaranteeLetterAddRequest", value = "担保函对象", required = true)
+ @RequestBody GuaranteeLetterAddRequest guaranteeLetterAddRequest) {
+ boolean result = guaranteeLetterAssignUserService.saveGuaranteeLetter(guaranteeLetterAddRequest);
+ return result ? ResponseResult.SUCCESS("添加成功!"):ResponseResult.FAIL(40005,"添加失败!");
+ }
+
+
+ @ApiOperation(value = "更新用户确认状态")
+ @PostMapping("/updateStatus")
+ public ResponseResult updateStatus(
+ @ApiParam(name = "guaranteeLetterAddRequest", value = "担保函对象", required = true)
+ @RequestBody GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest) {
+ boolean result = guaranteeLetterAssignUserService.updateGuaranteeLetterStatus(guaranteeLetterUpdateStatusRequest);
+ return result ? ResponseResult.SUCCESS("确认成功!"):ResponseResult.FAIL(40005,"确认失败!");
+ }
+
}
diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgGuaranteeLetterAssignUserMapper.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgGuaranteeLetterAssignUserMapper.java
index bdb37712..6a0550c7 100644
--- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgGuaranteeLetterAssignUserMapper.java
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgGuaranteeLetterAssignUserMapper.java
@@ -3,7 +3,6 @@ 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.BusinessApplicationListResponse;
import com.daqing.financial.guarantee.model.response.GuaranteeLetterResponse;
import com.daqing.framework.domain.guarantee.DgGuaranteeLetterAssignUser;
import org.apache.ibatis.annotations.Mapper;
@@ -20,5 +19,6 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface DgGuaranteeLetterAssignUserMapper extends BaseMapper {
- IPage pageByCondition(Page page, @Param("customerNumberOrName")String customerNumberOrName,@Param("status")Integer status);
+ IPage pageByCondition(Page page,@Param("userId") Integer userId,@Param("roleId") Integer roleId,@Param("status") Integer status,@Param("customerNumberOrName") String customerNumberOrName);
+
}
diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterAddRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterAddRequest.java
new file mode 100644
index 00000000..5573876d
--- /dev/null
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterAddRequest.java
@@ -0,0 +1,25 @@
+package com.daqing.financial.guarantee.model.request;
+
+import com.daqing.framework.domain.guarantee.DgGuaranteeLetterAssignUser;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author chen
+ * @DATE 2020/11/16 20:40
+ * @Version 1.0
+ * 添加担保函
+ */
+@Data
+public class GuaranteeLetterAddRequest {
+
+ @ApiModelProperty(value = "A角")
+ private Integer aRole;
+
+ @ApiModelProperty(value = "B角")
+ private Integer bRole;
+
+ @ApiModelProperty(value = "担保函对象")
+ private DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser;
+
+}
diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterListRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterListRequest.java
new file mode 100644
index 00000000..53ab4b81
--- /dev/null
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterListRequest.java
@@ -0,0 +1,21 @@
+package com.daqing.financial.guarantee.model.request;
+
+import com.daqing.financial.guarantee.model.response.GuaranteeLetterResponse;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author chen
+ * @DATE 2020/11/16 20:16
+ * @Version 1.0
+ * 担保函列表导出
+ */
+@Data
+public class GuaranteeLetterListRequest {
+
+ @ApiModelProperty(value = "担保函导出数据")
+ private List guaranteeLetterResponseList;
+
+}
diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterQueryRequest.java
similarity index 74%
rename from dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterRequest.java
rename to dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterQueryRequest.java
index 6df50d4e..fbabe524 100644
--- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterRequest.java
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterQueryRequest.java
@@ -7,9 +7,10 @@ import lombok.Data;
* @Author chen
* @DATE 2020/11/12 17:14
* @Version 1.0
+ * 担保函查询条件
*/
@Data
-public class GuaranteeLetterRequest {
+public class GuaranteeLetterQueryRequest {
@ApiModelProperty(value = "当前页码,默认为第一页")
private Integer page = 1;
@@ -22,4 +23,10 @@ public class GuaranteeLetterRequest {
@ApiModelProperty(value = "业务编号/客户名称")
private String CustomerNumberOrName;
+
+ @ApiModelProperty(value = "用户ID")
+ private Integer userId;
+
+ @ApiModelProperty(value = "角色ID")
+ private Integer roleId;
}
diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterUpdateStatusRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterUpdateStatusRequest.java
new file mode 100644
index 00000000..96dddee0
--- /dev/null
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterUpdateStatusRequest.java
@@ -0,0 +1,24 @@
+package com.daqing.financial.guarantee.model.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author chen
+ * @DATE 2020/11/18 16:44
+ * @Version 1.0
+ * 担保函更新确认状态
+ */
+@Data
+public class GuaranteeLetterUpdateStatusRequest {
+
+ @ApiModelProperty(value = "当前用户")
+ private Integer currentUser;
+
+ @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/GuaranteeLetterResponse.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/GuaranteeLetterResponse.java
index 3ce35309..e052bcb5 100644
--- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/GuaranteeLetterResponse.java
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/GuaranteeLetterResponse.java
@@ -16,6 +16,19 @@ import java.util.Date;
@Data
public class GuaranteeLetterResponse {
+ @ApiModelProperty("唯一标识")
+ private Integer id;
+
+ @ApiModelProperty("银行名称")
+ private String bank;
+
+ @ApiModelProperty("贷审会同意时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+ private Date updateTime;
+
+ @ApiModelProperty("附件(会议记录)")
+ private String file;
+
@ApiModelProperty("业务编号")
@ExcelProperty(value = "业务编号",index = 0)
private String businessCode;
@@ -45,12 +58,8 @@ public class GuaranteeLetterResponse {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date createTime;
- @ApiModelProperty("当前审批人")
- @ExcelProperty(value = "当前审批人",index = 7)
- private String empName;
-
@ApiModelProperty("状态")
- @ExcelProperty(value = "状态",index = 8,converter = StatusConverter.class)
+ @ExcelProperty(value = "状态",index = 7,converter = StatusConverter.class)
private Integer status;
}
diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgGuaranteeLetterAssignUserService.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgGuaranteeLetterAssignUserService.java
index 1f8f1796..2fbfdb1e 100644
--- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgGuaranteeLetterAssignUserService.java
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgGuaranteeLetterAssignUserService.java
@@ -1,7 +1,9 @@
package com.daqing.financial.guarantee.service;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.daqing.financial.guarantee.model.request.GuaranteeLetterRequest;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterAddRequest;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterQueryRequest;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterUpdateStatusRequest;
import com.daqing.framework.domain.guarantee.DgGuaranteeLetterAssignUser;
import com.daqing.framework.utils.PageUtils;
@@ -15,5 +17,9 @@ import com.daqing.framework.utils.PageUtils;
*/
public interface IDgGuaranteeLetterAssignUserService extends IService {
- PageUtils queryPage(Integer page, Integer size, String customerNumberOrName, Integer status);
+ PageUtils queryPage(GuaranteeLetterQueryRequest guaranteeLetterQueryRequest);
+
+ boolean saveGuaranteeLetter(GuaranteeLetterAddRequest guaranteeLetterAddRequest);
+
+ boolean updateGuaranteeLetterStatus(GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest);
}
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 044338e1..e5445925 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
@@ -1,16 +1,27 @@
package com.daqing.financial.guarantee.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.daqing.financial.guarantee.feign.HrmsFeignService;
import com.daqing.financial.guarantee.mapper.DgGuaranteeLetterAssignUserMapper;
-import com.daqing.financial.guarantee.model.request.GuaranteeLetterRequest;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterAddRequest;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterQueryRequest;
+import com.daqing.financial.guarantee.model.request.GuaranteeLetterUpdateStatusRequest;
import com.daqing.financial.guarantee.model.response.GuaranteeLetterResponse;
import com.daqing.financial.guarantee.service.IDgGuaranteeLetterAssignUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqing.framework.domain.guarantee.DgGuaranteeLetterAssignUser;
+import com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse;
+import com.daqing.framework.model.response.PromptSuccess;
+import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils;
-import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
/**
*
@@ -22,15 +33,93 @@ import org.springframework.stereotype.Service;
*/
@Service
public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl implements IDgGuaranteeLetterAssignUserService {
+
@Override
- public PageUtils queryPage(Integer page, Integer size, String customerNumberOrName, Integer status) {
- if (page==null){
- page=1;
- }
- if (size==null){
- size=10;
- }
- IPage guaranteeLetterVO = baseMapper.pageByCondition(new Page(page, size), customerNumberOrName, status);
+ public PageUtils queryPage(GuaranteeLetterQueryRequest guaranteeLetterQueryRequest) {
+ //取出条件
+ Integer page = guaranteeLetterQueryRequest.getPage();
+ Integer size = guaranteeLetterQueryRequest.getSize();
+ Integer status = guaranteeLetterQueryRequest.getStatus();
+ //a角和b角根据用户id查询,经理根据角色id查询
+ Integer userId = guaranteeLetterQueryRequest.getUserId();
+ Integer roleId = guaranteeLetterQueryRequest.getRoleId();
+ String customerNumberOrName = guaranteeLetterQueryRequest.getCustomerNumberOrName();
+ //分页条件查询
+ IPage guaranteeLetterVO = baseMapper.pageByCondition(new Page(page,size),userId,roleId,status,customerNumberOrName);
+
return new PageUtils(guaranteeLetterVO);
}
+
+ @Transactional
+ @Override
+ public boolean saveGuaranteeLetter(GuaranteeLetterAddRequest guaranteeLetterAddRequest) {
+ //获取A角用户
+ Integer aRole = guaranteeLetterAddRequest.getARole();
+ //获取B角用户
+ Integer bRole = guaranteeLetterAddRequest.getBRole();
+ //获取担保函信息
+ DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = guaranteeLetterAddRequest.getDgGuaranteeLetterAssignUser();
+ //添加A角用户
+ guaranteeLetterAssignUser.setUserId(aRole);
+ baseMapper.insert(guaranteeLetterAssignUser);
+ //添加B角用户
+ guaranteeLetterAssignUser.setUserId(bRole);
+ int insert = baseMapper.insert(guaranteeLetterAssignUser);
+ return insert>0;
+ }
+
+ @Override
+ public boolean updateGuaranteeLetterStatus(GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest) {
+ Integer businessId = guaranteeLetterUpdateStatusRequest.getBusinessId();
+ Integer currentUser = guaranteeLetterUpdateStatusRequest.getCurrentUser();
+ Integer status = guaranteeLetterUpdateStatusRequest.getStatus();
+
+ //根据业务id查询记录数
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq("business_id",businessId);
+ Integer count = baseMapper.selectCount(wrapper);
+ //只有两条数据,经理还未有数据
+ if (count==2){
+ //查询当前用户
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("business_id",businessId).eq("user_id",currentUser);
+ DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper);
+ guaranteeLetterAssignUser.setStatus(status);
+ //根据当前用户更新状态
+ int i = baseMapper.updateById(guaranteeLetterAssignUser);
+ //当状态为确认时,判断另一个用户是否确认
+ if (status==3){
+ //查询另一个用户
+ QueryWrapper anotherQueryWrapper = new QueryWrapper<>();
+ anotherQueryWrapper.eq("business_id",businessId).ne("user_id",currentUser);
+ DgGuaranteeLetterAssignUser anotherGuaranteeLetterAssignUser = baseMapper.selectOne(anotherQueryWrapper);
+ Integer anotherStatus = anotherGuaranteeLetterAssignUser.getStatus();
+ //如果另一个用户也确认,为资产部经理添加数据
+ if (anotherStatus==3){
+ Integer companyId = anotherGuaranteeLetterAssignUser.getCompanyId();
+ DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = new DgGuaranteeLetterAssignUser();
+ dgGuaranteeLetterAssignUser.setBusinessId(businessId);
+ dgGuaranteeLetterAssignUser.setCompanyId(companyId);
+ //添加资产部经理角色
+ dgGuaranteeLetterAssignUser.setRoleId(PromptSuccess.ZC_JL_ID);
+ int insert = baseMapper.insert(dgGuaranteeLetterAssignUser);
+ return insert > 0;
+ }
+ }
+ return i > 0;
+ //经理有数据,当前确认用户拥有经理角色,确认担保函
+ }else {
+ //当前用户角色为经理
+ QueryWrapper queryRoleWrapper = new QueryWrapper<>();
+ queryRoleWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID);
+ DgGuaranteeLetterAssignUser guaranteeLetterAssignRole = baseMapper.selectOne(queryRoleWrapper);
+ guaranteeLetterAssignRole.setUserId(currentUser);
+ guaranteeLetterAssignRole.setStatus(status);
+ //根据当前用户角色更新状态
+ int i = baseMapper.updateById(guaranteeLetterAssignRole);
+ //TODO 经理确认成功后,向回款确认添加数据
+ return i > 0;
+ }
+
+ }
}
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 1e081503..e10a4363 100644
--- a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgGuaranteeLetterAssignUserMapper.xml
+++ b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgGuaranteeLetterAssignUserMapper.xml
@@ -7,20 +7,47 @@
-
+
-