From d1c02d10848b80594d8f1d2895bbd620267ce2e2 Mon Sep 17 00:00:00 2001 From: river <1376754470@qq.com> Date: Sun, 22 Nov 2020 15:02:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E8=A7=84=E8=B0=83=E6=9F=A5=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DgComplianceInvestigationController.java | 10 +- .../DgComplianceInvestigationMapper.java | 24 ++- .../DgComplianceInvestigationResponse.java | 6 +- .../IDgComplianceInvestigationService.java | 6 +- .../DgComplianceInvestigationServiceImpl.java | 159 +++++++++++++++--- .../DgComplianceInvestigationMapper.xml | 70 ++++++-- .../resources/mapper/hrms/EmployeeDao.xml | 2 +- .../guarantee/DgComplianceInvestigation.java | 11 +- .../domain/guarantee/GuaranteeCode.java | 6 +- 9 files changed, 232 insertions(+), 62 deletions(-) diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgComplianceInvestigationController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgComplianceInvestigationController.java index c91e9461..66ab3b83 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgComplianceInvestigationController.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgComplianceInvestigationController.java @@ -39,11 +39,11 @@ public class DgComplianceInvestigationController { /** * 调查同意 */ - @PostMapping("/surveyConsent") - @ApiOperation(value = "调查同意",notes = "调查同意") - public ResponseResult surveyConsent(@RequestParam("iid") Integer iid, - @RequestParam("fileUrl") String fileUrl,@RequestParam("auditOpinion") String auditOpinion) { - Boolean result = iDgComplianceInvestigationService.surveyConsent(iid, fileUrl, auditOpinion); + @PostMapping("/survey") + @ApiOperation(value = "调查",notes = "调查") + public ResponseResult survey(@RequestParam("iid") Integer iid,@RequestParam("status") Integer status, + @RequestParam("fileUrl") String fileUrl, @RequestParam("auditOpinion") String auditOpinion) { + Boolean result = iDgComplianceInvestigationService.survey(iid, fileUrl, auditOpinion,status); return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); } } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgComplianceInvestigationMapper.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgComplianceInvestigationMapper.java index b848f8ea..cc3f2125 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgComplianceInvestigationMapper.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgComplianceInvestigationMapper.java @@ -22,15 +22,23 @@ import java.util.Date; @Mapper public interface DgComplianceInvestigationMapper extends BaseMapper { - IPage list(Page page, @Param("cr") DgComplianceInvestigationRequest dgComplianceInvestigationRequest); + IPage list(Page page, @Param("cr") DgComplianceInvestigationRequest dgComplianceInvestigationRequest, + @Param("roleId") Integer roleId); - Boolean surveyConsent(@Param("iid") Integer iid, @Param("fileUrl") String fileUrl, - @Param("auditOpinion") String auditOpinion, @Param("date")Date date, - @Param("empId") Integer empId); + IPage listByUserId(Page page, @Param("cr") DgComplianceInvestigationRequest dgComplianceInvestigationRequest, + @Param("userId") Integer userId,@Param("roleId") Integer roleId); - Boolean surveyReturn(@Param("iid") Integer iid,@Param("auditOpinion") String auditOpinion, - @Param("empId") Integer empId,@Param("date") Date date); + Boolean survey(@Param("iid") Integer iid, @Param("fileUrl") String fileUrl, @Param("surveyOpinion") String surveyOpinion, + @Param("date")Date date, @Param("userId") Integer userId, @Param("status") Integer status); - Boolean surveyRefuse(@Param("iid") Integer iid,@Param("auditOpinion") String auditOpinion, - @Param("empId")Integer empId,@Param("date") Date date); + DgComplianceInvestigation getComplianceInvestigation(Integer iid); + + Boolean updateAssign(@Param("iid") Integer iid, @Param("userId") Integer userId); + + Boolean assign(@Param("dci") DgComplianceInvestigation dgComplianceInvestigation); + + Boolean insertManager(@Param("dci") DgComplianceInvestigation dgComplianceInvestigation); + + Boolean check(@Param("iid") Integer iid,@Param("auditOpinion") String auditOpinion, + @Param("date") Date date,@Param("status") Integer status); } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/DgComplianceInvestigationResponse.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/DgComplianceInvestigationResponse.java index e211858e..e5dfc282 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/DgComplianceInvestigationResponse.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/DgComplianceInvestigationResponse.java @@ -43,12 +43,12 @@ public class DgComplianceInvestigationResponse implements Serializable { @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date createTime; - @ApiModelProperty("当前审批人") - private String empName; - @ApiModelProperty("状态,0:,1:,2:,3:,4:") private Integer status; @ApiModelProperty("合规调查表id") private Integer iId; + + @ApiModelProperty("角色id") + private Integer roleId; } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgComplianceInvestigationService.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgComplianceInvestigationService.java index 174de4e1..3f0c3403 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgComplianceInvestigationService.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgComplianceInvestigationService.java @@ -17,9 +17,9 @@ public interface IDgComplianceInvestigationService extends IService @@ -37,55 +45,152 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl list = this.getBaseMapper().list(new Page(page, size), dgComplianceInvestigationRequest); - + String userId = this.getUserId(); + // 获取当前登录用户的角色id + String roleIdString = RedisUtil.get("dq:userRole:" + userId); + if (roleIdString == null || roleIdString.length() == 0){ + ExceptionCast.cast(GuaranteeCode.ROLE_IS_NOT); + } + String[] roleIds = roleIdString.split(","); + IPage list = new Page<>(); + for (String roleId : roleIds) { + if (Integer.parseInt(roleId) == PromptSuccess.FG_JL_ID || Integer.parseInt(roleId) == PromptSuccess.FG_LD_ID){ + // 当前角色都能看到的数据 + list = this.getBaseMapper().list(new Page(page, size), dgComplianceInvestigationRequest, Integer.parseInt(roleId)); + // 当前角色和用户同时满足才能看到的数据 + IPage listByUserId = this.getBaseMapper().listByUserId(new Page(page, size), dgComplianceInvestigationRequest, Integer.parseInt(userId), Integer.parseInt(roleId)); + list.getRecords().addAll(listByUserId.getRecords()); + list.setTotal(list.getRecords().size()); + list.setSize(list.getTotal() % size == 0 ? list.getTotal() / size : list.getTotal() / size + 1 ); + break; + }else if (Integer.parseInt(roleId) == PromptSuccess.FG_C_ID){ + list = this.getBaseMapper().listByUserId(new Page(page, size), dgComplianceInvestigationRequest, Integer.parseInt(userId), Integer.parseInt(roleId)); + break; + } + } return new PageUtils(list); } /** - * 调查同意 + * 指派 */ + @Transactional @Override - public Boolean surveyConsent(Integer iid, String fileUrl, String auditOpinion) { - if (iid == null || fileUrl == null || fileUrl.length() == 0){ - ExceptionCast.cast(CommonCode.INVALID_PARAM); + public Boolean assign(Integer iid, Integer userId) { + DgComplianceInvestigation complianceInvestigation = this.getComplianceInvestigation(iid); + complianceInvestigation.setEmpId(userId); + complianceInvestigation.setCreateTime(new Date()); + complianceInvestigation.setUpdateTime(new Date()); + complianceInvestigation.setStatus(0); + complianceInvestigation.setRoleId(PromptSuccess.FG_C_ID); + Boolean result = this.getBaseMapper().assign(complianceInvestigation); + if (result){ + // 绑定该条数据的指派操作人;在审核进程表中插入一条指派数据;在角色表中插入一条数据,与当前被指派的员工(用户)关联 + String id = this.getUserId(); + this.getBaseMapper().updateAssign(iid, Integer.parseInt(id)); } - // 获取登录用户id - Integer userId = 1; - return this.getBaseMapper().surveyConsent(iid, fileUrl, auditOpinion, new Date(), userId); + return false; } /** - * 调查驳回 + * 调查 */ @Override - public Boolean surveyReturn(Integer iid, String auditOpinion) { - if (iid == null){ + public Boolean survey(Integer iid, String fileUrl, String surveyOpinion, Integer status) { + if (iid == null || status == null){ ExceptionCast.cast(CommonCode.INVALID_PARAM); } - if (auditOpinion == null || auditOpinion.length() == 0){ - ExceptionCast.cast(GuaranteeCode.COMPLIANCE_INVESTIGATION_REMARK_NOT_NULL); + String userId = this.getUserId(); + // 同意 + if (status == 1){ + if (fileUrl == null || fileUrl.length() == 0){ + ExceptionCast.cast(GuaranteeCode.COMPLIANCE_UPLOAD_NOT_NULL); + } + Boolean result = this.getBaseMapper().survey(iid, fileUrl, surveyOpinion, new Date(), Integer.parseInt(userId), status); + // 在审核进程中插入一条调查成功数据;在合规调查表中插入一条审核数据 + if (result){ + DgComplianceInvestigation complianceInvestigation = this.getBaseMapper().getComplianceInvestigation(iid); + complianceInvestigation.setRoleId(PromptSuccess.FG_JL_ID); + complianceInvestigation.setStatus(0); + complianceInvestigation.setCreateTime(new Date()); + complianceInvestigation.setUpdateTime(new Date()); + complianceInvestigation.setFile(fileUrl); + complianceInvestigation.setSurveyOpinion(surveyOpinion); + return this.getBaseMapper().insertManager(complianceInvestigation); + } + return false; + } + // 拒绝 + if (status == 2){ + if (surveyOpinion == null || surveyOpinion.length() == 0){ + ExceptionCast.cast(GuaranteeCode.COMPLIANCE_INVESTIGATION_REMARK_NOT_NULL); + } + Boolean result = this.getBaseMapper().survey(iid, null, surveyOpinion, new Date(), Integer.parseInt(userId), status); + if (result){ + // 在审核进程表中插入一条拒绝数据,流程结束 + } + return false; } - // 获取登录用户id - Integer userId = 1; - // TODO 驳回至资产调查指派A/B角 - return this.getBaseMapper().surveyReturn(iid,auditOpinion,userId,new Date()); + // 驳回 + if (status == 3){ + if (surveyOpinion == null || surveyOpinion.length() == 0){ + ExceptionCast.cast(GuaranteeCode.COMPLIANCE_INVESTIGATION_REMARK_NOT_NULL); + } + Boolean result = this.getBaseMapper().survey(iid, null, surveyOpinion, new Date(), Integer.parseInt(userId), status); + if (result){ + // 在审核进程表中插入一条驳回数据;修改担保部调查表中AB角的数据状态为驳回 + } + return false; + } + return false; } /** - * 调查拒绝 + * 审核 */ @Override - public Boolean surveyRefuse(Integer iid, String auditOpinion) { - if (iid == null){ + public Boolean check(Integer iid, String auditOpinion, Integer status) { + if (iid == null || status == null){ ExceptionCast.cast(CommonCode.INVALID_PARAM); } - if (auditOpinion == null || auditOpinion.length() == 0){ - ExceptionCast.cast(GuaranteeCode.COMPLIANCE_INVESTIGATION_REMARK_NOT_NULL); + String userId = this.getUserId(); + String roleIdString = RedisUtil.get("dq:userRole:" + userId); + if (roleIdString == null || roleIdString.length() == 0){ + ExceptionCast.cast(GuaranteeCode.ROLE_IS_NOT); + } + String[] roleIds = roleIdString.split(","); + for (String roleId : roleIds) { + if (Integer.parseInt(roleId) == PromptSuccess.FG_JL_ID){ + // 法规经理审核 + if (status == 1){ + // 同意 + Boolean result = this.getBaseMapper().check(iid, auditOpinion, new Date(), status); + if (result){ + + } + } + }else if (Integer.parseInt(roleId) == PromptSuccess.FG_LD_ID){ + // 法规领导审核 + } } - // 获取登录用户id - Integer userId = 1; - // TODO 直接拒接至初始状态 - return this.getBaseMapper().surveyRefuse(iid,auditOpinion,userId,new Date()); + return null; + } + + + /** + * 获取当前登录用户信息 + */ + private String getUserId(){ + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String token = request.getHeader("token"); + return RedisUtil.get("dq:token:"+token); + } + + /** + * 获取基本信息 + */ + private DgComplianceInvestigation getComplianceInvestigation(Integer iid){ + + return this.getBaseMapper().getComplianceInvestigation(iid); } } diff --git a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgComplianceInvestigationMapper.xml b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgComplianceInvestigationMapper.xml index 56004860..a6d86522 100644 --- a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgComplianceInvestigationMapper.xml +++ b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgComplianceInvestigationMapper.xml @@ -14,10 +14,10 @@ - SELECT a.id AS id,a.business_code AS business_code,a.business_type AS business_type,a.apply_amount AS apply_amount, - a.apply_time AS apply_time,a.create_time AS create_time,c.name AS name,c.phone AS phone,p.emp_name AS emp_name, - i.status AS status,i.id AS iid + a.apply_time AS apply_time,a.create_time AS create_time,c.name AS name,c.phone AS phone,i.status AS status, + i.id AS iid,i.role_id AS role_id FROM dg_apply_amount_info AS a LEFT JOIN dg_audit_process AS p ON a.id = p.apply_amount_info_id @@ -26,6 +26,8 @@ LEFT JOIN dg_compliance_investigation AS i ON a.id = i.business_id WHERE c.del_or_not = 0 + AND i.role_id = #{roleId} + AND i.user_id = '' AND i.status = #{cr.status} @@ -35,21 +37,63 @@ ORDER BY a.create_time DESC - - - UPDATE dg_compliance_investigation SET emp_id = #{empId},file = #{fileUrl},remark = #{auditOpinion},status = 2,update_time = #{date} + + + + + + UPDATE dg_compliance_investigation + SET user_id = #{userId},file = #{fileUrl},survey_opinion = #{surveyOpinion},status = #{status},update_time = #{date} WHERE id = #{iid} - - - UPDATE dg_compliance_investigation SET emp_id = #{empId},remark = #{auditOpinion},status = 3,update_time = #{date} - WHERE id = #{iid} + + + + + UPDATE dg_compliance_investigation SET user_id = #{userId} WHERE id = #{iid} - - - UPDATE dg_compliance_investigation SET emp_id = #{empId},remark = #{auditOpinion},status = 4,update_time = #{date} + + + INSERT INTO (company_id,user_id,status,create_time,update_time,business_id,role_id) + VALUES (#{dci.companyId},#{dci.userId},#{dci.status},#{dci.createTime},#{dci.updateTime},#{dci.businessId},#{dci.roleId}) + + + + + INSERT INTO (company_id,file,status,create_time,update_time,business_id,role_id,survey_opinion) + VALUES (#{dci.companyId},#{dci.file},#{dci.status},#{dci.createTime},#{dci.updateTime}, + #{dci.businessId},#{dci.roleId},#{dci.surveyOpinion}) + + + + + UPDATE dg_compliance_investigation + SET remark = #{auditOpinion},status = #{status},update_time = #{date} WHERE id = #{iid} diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml index 762eeea3..b4c15745 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml @@ -133,7 +133,7 @@ - + diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgComplianceInvestigation.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgComplianceInvestigation.java index ee984c0a..be44e5af 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgComplianceInvestigation.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgComplianceInvestigation.java @@ -33,7 +33,7 @@ public class DgComplianceInvestigation implements Serializable { private Integer companyId; /** - * 调查者id + * 用户id */ private Integer empId; @@ -60,4 +60,13 @@ public class DgComplianceInvestigation implements Serializable { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; + @ApiModelProperty("贷款信息表id") + private Integer businessId; + + @ApiModelProperty("角色id") + private Integer roleId; + + @ApiModelProperty("调查意见") + private String surveyOpinion; + } diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/GuaranteeCode.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/GuaranteeCode.java index 2419386a..40424ca6 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/GuaranteeCode.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/GuaranteeCode.java @@ -16,7 +16,11 @@ import lombok.ToString; public enum GuaranteeCode implements ResultCode { - COMPLIANCE_INVESTIGATION_REMARK_NOT_NULL(false,80001,"驳回或拒绝时,意见不能为空!"); + COMPLIANCE_INVESTIGATION_REMARK_NOT_NULL(false,80001,"意见不能为空,请输入拒绝/驳回意见!"), + COMPLIANCE_UPLOAD_NOT_NULL(false,80002,"附件不能为空,请上传附件!"), + + ROLE_IS_NOT(false,90001,"当前登录用户角色信息不存在,无法查询!"); + /** * 操作是否成功