|
|
|
@ -11,10 +11,18 @@ import com.daqing.framework.domain.guarantee.DgComplianceInvestigation; |
|
|
|
|
import com.daqing.framework.domain.guarantee.GuaranteeCode; |
|
|
|
|
import com.daqing.framework.exception.ExceptionCast; |
|
|
|
|
import com.daqing.framework.model.response.CommonCode; |
|
|
|
|
import com.daqing.framework.model.response.PromptSuccess; |
|
|
|
|
import com.daqing.framework.util.RedisUtil; |
|
|
|
|
import com.daqing.framework.utils.PageUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* <p> |
|
|
|
@ -37,55 +45,152 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl<DgComplian |
|
|
|
|
page = 1; |
|
|
|
|
size = 10; |
|
|
|
|
} |
|
|
|
|
IPage<DgComplianceInvestigationResponse> 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<DgComplianceInvestigationResponse> 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<DgComplianceInvestigationResponse> 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){ |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
// 获取登录用户id
|
|
|
|
|
Integer userId = 1; |
|
|
|
|
// TODO 驳回至资产调查指派A/B角
|
|
|
|
|
return this.getBaseMapper().surveyReturn(iid,auditOpinion,userId,new Date()); |
|
|
|
|
Boolean result = this.getBaseMapper().survey(iid, null, surveyOpinion, new Date(), Integer.parseInt(userId), status); |
|
|
|
|
if (result){ |
|
|
|
|
// 在审核进程表中插入一条拒绝数据,流程结束
|
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
// 驳回
|
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
// 获取登录用户id
|
|
|
|
|
Integer userId = 1; |
|
|
|
|
// TODO 直接拒接至初始状态
|
|
|
|
|
return this.getBaseMapper().surveyRefuse(iid,auditOpinion,userId,new Date()); |
|
|
|
|
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){ |
|
|
|
|
// 法规领导审核
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|