|
@@ -8,10 +8,7 @@ import com.qmth.sop.business.bean.params.FlowApproveParam;
|
|
import com.qmth.sop.business.bean.result.CrmProjectResult;
|
|
import com.qmth.sop.business.bean.result.CrmProjectResult;
|
|
import com.qmth.sop.business.bean.result.DingApplyDoneResult;
|
|
import com.qmth.sop.business.bean.result.DingApplyDoneResult;
|
|
import com.qmth.sop.business.bean.result.DingApplyUnDoneResult;
|
|
import com.qmth.sop.business.bean.result.DingApplyUnDoneResult;
|
|
-import com.qmth.sop.business.entity.SysUser;
|
|
|
|
-import com.qmth.sop.business.entity.TBDing;
|
|
|
|
-import com.qmth.sop.business.entity.TBDingApply;
|
|
|
|
-import com.qmth.sop.business.entity.TFCustomFlowEntity;
|
|
|
|
|
|
+import com.qmth.sop.business.entity.*;
|
|
import com.qmth.sop.business.mapper.TBDingApplyMapper;
|
|
import com.qmth.sop.business.mapper.TBDingApplyMapper;
|
|
import com.qmth.sop.business.service.*;
|
|
import com.qmth.sop.business.service.*;
|
|
import com.qmth.sop.common.contant.SpringContextHolder;
|
|
import com.qmth.sop.common.contant.SpringContextHolder;
|
|
@@ -62,6 +59,15 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
@Resource
|
|
@Resource
|
|
TBCrmService tbCrmService;
|
|
TBCrmService tbCrmService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ TBUserArchivesService tbUserArchivesService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ SysUserService sysUserService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ SysUserRoleService sysUserRoleService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 新增考勤异常补卡申请
|
|
* 新增考勤异常补卡申请
|
|
*
|
|
*
|
|
@@ -74,15 +80,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
public Boolean saveDingApply(TBDingApply tbDingApply) throws InterruptedException {
|
|
public Boolean saveDingApply(TBDingApply tbDingApply) throws InterruptedException {
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
|
|
TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
|
|
-
|
|
|
|
- String sopNo = null, crmNo = null;
|
|
|
|
- if (Objects.nonNull(tbDing)) {
|
|
|
|
- sopNo = tbDing.getSopNo();
|
|
|
|
- crmNo = tbDing.getCrmNo();
|
|
|
|
- } else {
|
|
|
|
- sopNo = tbDingApply.getSopNo();
|
|
|
|
- crmNo = tbDingApply.getCrmNo();
|
|
|
|
- }
|
|
|
|
|
|
+ String sopNo = Objects.nonNull(tbDing) ? tbDing.getSopNo() : tbDingApply.getSopNo();
|
|
|
|
+ String crmNo = Objects.nonNull(tbDing) ? tbDing.getCrmNo() : tbDingApply.getCrmNo();
|
|
CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(sopNo, crmNo);
|
|
CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(sopNo, crmNo);
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
Optional.ofNullable(crmProjectResult.getRegionManagerId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm大区经理数据为空"));
|
|
Optional.ofNullable(crmProjectResult.getRegionManagerId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm大区经理数据为空"));
|
|
@@ -204,14 +203,32 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
public Boolean updateDingExceptionTime(TBDingApply tbDingApply, DingExceptionApproveEnum dingExceptionApprove) {
|
|
public Boolean updateDingExceptionTime(TBDingApply tbDingApply, DingExceptionApproveEnum dingExceptionApprove) {
|
|
if (dingExceptionApprove == DingExceptionApproveEnum.PASS) {
|
|
if (dingExceptionApprove == DingExceptionApproveEnum.PASS) {
|
|
TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
|
|
TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
|
|
- Optional.ofNullable(tbDing).orElseThrow(() -> ExceptionResultEnum.DING_NO_DATA.exception());
|
|
|
|
|
|
+ if (Objects.nonNull(tbDing)) {
|
|
|
|
+ if (tbDingApply.getType() == InOutTypeEnum.IN) {
|
|
|
|
+ tbDing.setSignInTime(tbDingApply.getApplyTime());
|
|
|
|
+ } else if (tbDingApply.getType() == InOutTypeEnum.OUT) {
|
|
|
|
+ tbDing.setSignOutTime(tbDingApply.getApplyTime());
|
|
|
|
+ }
|
|
|
|
+ tbDingService.updateById(tbDing);
|
|
|
|
+ } else {
|
|
|
|
+ TBCrm tbCrm = tbCrmService.getOne(new QueryWrapper<TBCrm>().lambda().eq(TBCrm::getCrmNo, tbDingApply.getCrmNo()));
|
|
|
|
+ Optional.ofNullable(tbCrm).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ SysUser sysUser = sysUserService.getById(tbDingApply.getCreateId());
|
|
|
|
+ Optional.ofNullable(sysUser).orElseThrow(() -> ExceptionResultEnum.USER_NO_EXISTS.exception());
|
|
|
|
+
|
|
|
|
+ List<SysRole> sysRoleList = sysUserRoleService.listRoleByUserId(sysUser.getId());
|
|
|
|
+ if (CollectionUtils.isEmpty(sysRoleList)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("用户角色不存在");
|
|
|
|
+ }
|
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbDingApply.getSopNo()));
|
|
|
|
+ Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
|
|
|
- if (tbDingApply.getType() == InOutTypeEnum.IN) {
|
|
|
|
- tbDing.setSignInTime(tbDingApply.getApplyTime());
|
|
|
|
- } else if (tbDingApply.getType() == InOutTypeEnum.OUT) {
|
|
|
|
- tbDing.setSignOutTime(tbDingApply.getApplyTime());
|
|
|
|
|
|
+ TBUserArchives tbUserArchives = tbUserArchivesService.getOne(new QueryWrapper<TBUserArchives>().lambda().eq(TBUserArchives::getMobileNumber, sysUser.getMobileNumber()));
|
|
|
|
+ tbDing = new TBDing(tbDingApply.getSopNo(), tbDingApply.getCrmNo(), tbCrm.getServiceId(), tbUserArchives.getId(), sysRoleList.get(0).getType(), sysUser.getId(), tfCustomFlowEntity.getFlowId());
|
|
|
|
+ tbDingService.save(tbDing);
|
|
|
|
+ tbDingApply.setDingId(tbDing.getId());
|
|
}
|
|
}
|
|
- tbDingService.updateById(tbDing);
|
|
|
|
}
|
|
}
|
|
tbDingApply.setApprove(dingExceptionApprove);
|
|
tbDingApply.setApprove(dingExceptionApprove);
|
|
return tbDingApplyService.updateById(tbDingApply);
|
|
return tbDingApplyService.updateById(tbDingApply);
|