担保函完成

master
chen 4 years ago
parent 9d742f9508
commit cc43b98306
  1. 68
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgGuaranteeLetterAssignUserController.java
  2. 4
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgGuaranteeLetterAssignUserMapper.java
  3. 25
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterAddRequest.java
  4. 21
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterListRequest.java
  5. 9
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterQueryRequest.java
  6. 24
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/GuaranteeLetterUpdateStatusRequest.java
  7. 19
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/GuaranteeLetterResponse.java
  8. 10
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgGuaranteeLetterAssignUserService.java
  9. 107
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgGuaranteeLetterAssignUserServiceImpl.java
  10. 45
      dq-financial-guarantee/src/main/resources/mapper/guarantee/DgGuaranteeLetterAssignUserMapper.xml
  11. 29
      dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgGuaranteeLetterAssignUser.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;
/**
* <p>
@ -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<PageUtils>().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<GuaranteeLetterResponse> 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,"确认失败!");
}
}

@ -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<DgGuaranteeLetterAssignUser> {
IPage<GuaranteeLetterResponse> pageByCondition(Page page, @Param("customerNumberOrName")String customerNumberOrName,@Param("status")Integer status);
IPage<GuaranteeLetterResponse> pageByCondition(Page page,@Param("userId") Integer userId,@Param("roleId") Integer roleId,@Param("status") Integer status,@Param("customerNumberOrName") String customerNumberOrName);
}

@ -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;
}

@ -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<GuaranteeLetterResponse> guaranteeLetterResponseList;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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<DgGuaranteeLetterAssignUser> {
PageUtils queryPage(Integer page, Integer size, String customerNumberOrName, Integer status);
PageUtils queryPage(GuaranteeLetterQueryRequest guaranteeLetterQueryRequest);
boolean saveGuaranteeLetter(GuaranteeLetterAddRequest guaranteeLetterAddRequest);
boolean updateGuaranteeLetterStatus(GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest);
}

@ -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;
/**
* <p>
@ -22,15 +33,93 @@ import org.springframework.stereotype.Service;
*/
@Service
public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl<DgGuaranteeLetterAssignUserMapper, DgGuaranteeLetterAssignUser> implements IDgGuaranteeLetterAssignUserService {
@Override
public PageUtils queryPage(Integer page, Integer size, String customerNumberOrName, Integer status) {
if (page==null){
page=1;
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<GuaranteeLetterResponse> guaranteeLetterVO = baseMapper.pageByCondition(new Page(page,size),userId,roleId,status,customerNumberOrName);
return new PageUtils(guaranteeLetterVO);
}
if (size==null){
size=10;
@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;
}
IPage<GuaranteeLetterResponse> guaranteeLetterVO = baseMapper.pageByCondition(new Page(page, size), customerNumberOrName, status);
return new PageUtils(guaranteeLetterVO);
@Override
public boolean updateGuaranteeLetterStatus(GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest) {
Integer businessId = guaranteeLetterUpdateStatusRequest.getBusinessId();
Integer currentUser = guaranteeLetterUpdateStatusRequest.getCurrentUser();
Integer status = guaranteeLetterUpdateStatusRequest.getStatus();
//根据业务id查询记录数
QueryWrapper<DgGuaranteeLetterAssignUser> wrapper = new QueryWrapper<>();
wrapper.eq("business_id",businessId);
Integer count = baseMapper.selectCount(wrapper);
//只有两条数据,经理还未有数据
if (count==2){
//查询当前用户
QueryWrapper<DgGuaranteeLetterAssignUser> 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<DgGuaranteeLetterAssignUser> 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<DgGuaranteeLetterAssignUser> 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;
}
}
}

@ -7,20 +7,47 @@
<id column="id" property="id" />
<result column="business_id" property="businessId" />
<result column="company_id" property="companyId" />
<result column="approval_id" property="approvalId" />
<result column="user_id" property="userId" />
<result column="status" property="status" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<select id="pageByCondition" resultType="com.daqing.financial.guarantee.model.response.GuaranteeLetterResponse">
select ai.id,ai.company_id,ai.presenter_id,ai.business_code,ai.business_type,ai.apply_amount,ai.apply_time,ai.create_time,
ai.status,cc.name,cc.phone
from dg_apply_amount_info ai
left join crms_company_customer ccl on ai.company_id = ccl.id
left join crms_customer cc on cc.id = ccl.customer_id
<resultMap id="GuaranteeLetterResponseMap" type="com.daqing.financial.guarantee.model.response.GuaranteeLetterResponse">
<id column="id" property="id" />
<result column="business_code" property="businessCode" />
<result column="bank" property="bank" />
<result column="update_time" property="updateTime" />
<result column="file" property="file" />
<result column="name" property="name" />
<result column="phone" property="phone" />
<result column="status" property="status" />
<result column="create_time" property="createTime" />
<result column="apply_time" property="applyTime" />
<result column="apply_amount" property="applyAmount" />
<result column="business_type" property="businessType" />
</resultMap>
<select id="pageByCondition" resultMap="GuaranteeLetterResponseMap">
select lau.id,aai.business_code,cc.name,cc.phone,aai.business_type,aai.apply_amount,
aai.apply_time,aai.create_time,lau.status,aai.bank,lcc.update_time,lcc.file
from dg_guarantee_letter_assign_user lau
left join dg_apply_amount_info aai on lau.business_id = aai.id
left join crms_company_customer ccc on lau.company_id = ccc.id
left join crms_customer cc on ccc.customer_id = cc.id
left join dg_loan_committee_consider lcc on lau.business_id = lcc.business_id
<where>
<if test="CustomerNumberOrName != null and CustomerNumberOrName != ''">
AND ai.business_code LIKE CONCAT('%',#{CustomerNumberOrName},'%') OR cc.name LIKE CONCAT('%',#{CustomerNumberOrName},'%')
<if test="roleId != null and roleId != ''">
AND lau.role_id = #{roleId}
</if>
<if test="userId != null and userId != ''">
and lau.user_id = #{userId}
</if>
<if test="customerNumberOrName != null and customerNumberOrName != ''">
AND aai.business_code LIKE CONCAT('%',#{customerNumberOrName},'%') OR cc.name LIKE CONCAT('%',#{customerNumberOrName},'%')
</if>
<if test="status != null and status != ''">
AND lau.status = #{status}
</if>
</where>
</select>

@ -21,34 +21,29 @@ public class DgGuaranteeLetterAssignUser implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ID_WORKER)
@ApiModelProperty(value = "主键id -》(自动生成)")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 业务id
*/
@ApiModelProperty(value = "业务id")
private Integer businessId;
/**
* 企业id
*/
@ApiModelProperty(value = "企业id")
private Integer companyId;
@ApiModelProperty(value = "角色id")
private Integer roleId;
@ApiModelProperty(value = "审核意见")
private Integer auditOpinion;
@ApiModelProperty(value = "类型(1:A角确认 2:B角确认 3:经理确认)")
private Integer type;
/**
* 审批人id
*/
private Integer approvalId;
@ApiModelProperty(value = "审批人id")
private Integer userId;
/**
* 状态1->审核中2->拒绝3->已审核
*/
@ApiModelProperty(value = "状态:1->审核中;2->拒绝;3->已审核")
private Integer status;
@ApiModelProperty(value = "创建时间")

Loading…
Cancel
Save