|
@@ -1,6 +1,7 @@
|
|
|
package com.gree.mall.manager.logic.policy;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.db.sql.Order;
|
|
|
import com.alibaba.druid.support.spring.stat.annotation.Stat;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
@@ -55,6 +56,7 @@ public class WorkerManagerLogic {
|
|
|
|
|
|
public void stop(String id) {
|
|
|
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
WebsitUser websitUserBean = websitUserService.getById(id);
|
|
|
if (!websitUserBean.getExamineStatus().equals(ExamineWorkerStatusEnum.OK.getKey()))
|
|
|
throw new RemoteServiceException("师傅不处于审核通过");
|
|
@@ -63,6 +65,14 @@ public class WorkerManagerLogic {
|
|
|
websitUser.setId(id);
|
|
|
websitUser.setExamineStatus(ExamineWorkerStatusEnum.STOP.getKey());
|
|
|
websitUser.updateById();
|
|
|
+
|
|
|
+ WebsitUserLog websitUserLog = new WebsitUserLog();
|
|
|
+
|
|
|
+ websitUserLog.setTypeText("暂停接单");
|
|
|
+ websitUserLog.setOpRemark("操作该账号暂停接单");
|
|
|
+
|
|
|
+ websitUserLog.insert();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public void activation(String id) {
|
|
@@ -75,6 +85,13 @@ public class WorkerManagerLogic {
|
|
|
websitUser.setId(id);
|
|
|
websitUser.setExamineStatus(ExamineWorkerStatusEnum.POLICY_WAIT.getKey());
|
|
|
websitUser.updateById();
|
|
|
+
|
|
|
+ WebsitUserLog websitUserLog = new WebsitUserLog();
|
|
|
+
|
|
|
+ websitUserLog.setTypeText("激活账号");
|
|
|
+ websitUserLog.setOpRemark("操作激活账号");
|
|
|
+
|
|
|
+ websitUserLog.insert();
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -103,6 +120,13 @@ public class WorkerManagerLogic {
|
|
|
websitUser.setId(id);
|
|
|
websitUser.setExamineStatus(ExamineWorkerStatusEnum.QUIT.getKey());
|
|
|
websitUser.updateById();
|
|
|
+
|
|
|
+ WebsitUserLog websitUserLog = new WebsitUserLog();
|
|
|
+
|
|
|
+ websitUserLog.setTypeText("操作离职");
|
|
|
+ websitUserLog.setOpRemark("操作离职");
|
|
|
+
|
|
|
+ websitUserLog.insert();
|
|
|
}
|
|
|
|
|
|
public void againQuit(String id) {
|
|
@@ -115,6 +139,13 @@ public class WorkerManagerLogic {
|
|
|
websitUser.setId(id);
|
|
|
websitUser.setExamineStatus(ExamineWorkerStatusEnum.POLICY_WAIT.getKey());
|
|
|
websitUser.updateById();
|
|
|
+
|
|
|
+ WebsitUserLog websitUserLog = new WebsitUserLog();
|
|
|
+
|
|
|
+ websitUserLog.setTypeText("重新入职");
|
|
|
+ websitUserLog.setOpRemark("操作重新入职");
|
|
|
+
|
|
|
+ websitUserLog.insert();
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -123,19 +154,37 @@ public class WorkerManagerLogic {
|
|
|
|
|
|
User user = userService.getById(workerManagerBean.getUserId());
|
|
|
|
|
|
+ WebsitUser websitUser = websitUserService.getById(workerManagerBean.getId());
|
|
|
+
|
|
|
+
|
|
|
+ workerManagerBean.setExamineStatus(ExamineWorkerStatusEnum.POLICY_WAIT.getKey());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (!StringUtil.isEmpty(user.getWorkerNumber())){
|
|
|
if (!workerManagerBean.getWorkerNumber().equals(user.getWorkerNumber())) {
|
|
|
throw new RemoteServiceException("师傅编号已经录入不允许更改");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
if(userService.lambdaQuery().eq(User::getWorkerNumber,workerManagerBean.getWorkerNumber())
|
|
|
.ne(User::getUserId,workerManagerBean.getUserId()).count() > 0)
|
|
|
throw new RemoteServiceException("已有该师傅编号");
|
|
|
|
|
|
+
|
|
|
+ workerManagerBean.setBankAccount(workerManagerBean.getUser().getBankAccount());
|
|
|
+ workerManagerBean.setWorkerNumber(workerManagerBean.getUser().getWorkerNumber());
|
|
|
+
|
|
|
workerManagerBean.updateById();
|
|
|
|
|
|
|
|
|
+ workerManagerBean.getUser().updateById();
|
|
|
+
|
|
|
+
|
|
|
+ this.changeList(workerManagerBean.getWorkerPolicies(),workerManagerBean.getId());
|
|
|
+
|
|
|
workerManagerBean.getUser().setWorkerNumber(workerManagerBean.getWorkerNumber());
|
|
|
|
|
|
workerManagerBean.getUser().updateById();
|
|
@@ -146,6 +195,7 @@ public class WorkerManagerLogic {
|
|
|
|
|
|
for (WorkerImg workerImg : workerManagerBean.getWorkerImgs()) {
|
|
|
workerImg.setWorkerId(workerManagerBean.getUserId());
|
|
|
+ workerImg.setUserId(workerManagerBean.getUserId());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -157,13 +207,57 @@ public class WorkerManagerLogic {
|
|
|
for (WorkerPolicy workerPolicy : workerManagerBean.getWorkerPolicies()) {
|
|
|
workerPolicy.setWorkerId(workerManagerBean.getUserId());
|
|
|
workerPolicy.setWebsitUserId(workerManagerBean.getId());
|
|
|
+ workerPolicy.setEndTime(DateUtil.endOfDay(workerPolicy.getEndTime()));
|
|
|
}
|
|
|
|
|
|
workerPolicyService.saveOrUpdateBatch(workerManagerBean.getWorkerPolicies());
|
|
|
|
|
|
|
|
|
+ this.examine(workerManagerBean);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ private void changeList(List<WorkerPolicy> workerPolicies, String id) {
|
|
|
+
|
|
|
+ List<WorkerPolicy> workerPolicyList = workerPolicyService.lambdaQuery().eq(WorkerPolicy::getWebsitUserId, id).list();
|
|
|
+
|
|
|
+ for (WorkerPolicy workerPolicy : workerPolicies) {
|
|
|
+
|
|
|
+ workerPolicy.setEndTime(DateUtil.endOfDay(workerPolicy.getEndTime()));
|
|
|
+
|
|
|
+ if (StringUtil.isEmpty(workerPolicy.getId())){
|
|
|
+ WebsitUserLog websitUserLog = new WebsitUserLog();
|
|
|
+
|
|
|
+ websitUserLog.setTypeText("添加保险");
|
|
|
+ websitUserLog.setOpRemark("保险时间为"+ DateUtil.format(workerPolicy.getStartTime(),"yyyy-MM-dd")+","+
|
|
|
+ DateUtil.format(workerPolicy.getEndTime(),"yyyy-MM-dd"));
|
|
|
+
|
|
|
+ websitUserLog.insert();
|
|
|
+ }else {
|
|
|
+ List<WorkerPolicy> workerPolicyLists = workerPolicyList.stream()
|
|
|
+ .filter(item -> item.getId().equals(workerPolicy.getId())).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(workerPolicyLists))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ WorkerPolicy workerPolicyOne = workerPolicyLists.get(0);
|
|
|
+
|
|
|
+ if (!(workerPolicyOne.getStartTime().equals(workerPolicy.getStartTime()) && workerPolicyOne.getEndTime().equals(workerPolicy.getEndTime()))) {
|
|
|
+ WebsitUserLog websitUserLog = new WebsitUserLog();
|
|
|
+
|
|
|
+ websitUserLog.setTypeText("更改保险日期");
|
|
|
+ websitUserLog.setOpRemark("保险时间为"+ DateUtil.format(workerPolicy.getStartTime(),"yyyy-MM-dd")+","+
|
|
|
+ DateUtil.format(workerPolicy.getEndTime(),"yyyy-MM-dd"));
|
|
|
+
|
|
|
+ websitUserLog.insert();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public WorkerManagerDetail detail(String id) {
|
|
|
|
|
@@ -198,8 +292,15 @@ public class WorkerManagerLogic {
|
|
|
if (!websitUser.getExamineStatus().equals(ExamineWorkerStatusEnum.WAIT.getKey()))
|
|
|
throw new RemoteServiceException("状态不为待审核状态");
|
|
|
|
|
|
+ if (workerManagerBean.getUser().getEndTime() != null && workerManagerBean.getUser().getEndTime().before(new Date()))
|
|
|
+ throw new RemoteServiceException("高空证不能填入失效时间");
|
|
|
+
|
|
|
+ if (workerManagerBean.getUser().getIdCardEndTime() != null && workerManagerBean.getUser().getIdCardEndTime().before(new Date()))
|
|
|
+ throw new RemoteServiceException("身份证不能填入过期时间");
|
|
|
+
|
|
|
workerManagerBean.setCreateTime(null);
|
|
|
|
|
|
+
|
|
|
workerManagerBean.setExamineBy(adminUser.getNickName());
|
|
|
workerManagerBean.setExamineTime(new Date());
|
|
|
|
|
@@ -211,16 +312,18 @@ public class WorkerManagerLogic {
|
|
|
throw new RemoteServiceException("师傅编号已经录入不允许更改");
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtil.isEmpty(workerManagerBean.getWorkerNumber()))
|
|
|
+ if (StringUtil.isEmpty(workerManagerBean.getUser().getWorkerNumber()))
|
|
|
throw new RemoteServiceException("师傅编号不能为空");
|
|
|
|
|
|
|
|
|
- if(userService.lambdaQuery().eq(User::getWorkerNumber,workerManagerBean.getWorkerNumber())
|
|
|
+ if(userService.lambdaQuery().eq(User::getWorkerNumber,workerManagerBean.getUser().getWorkerNumber())
|
|
|
.ne(User::getUserId,workerManagerBean.getUserId()).count() > 0)
|
|
|
throw new RemoteServiceException("已有该师傅编号");
|
|
|
|
|
|
|
|
|
- workerManagerBean.getUser().setWorkerNumber(workerManagerBean.getWorkerNumber());
|
|
|
+ workerManagerBean.setBankAccount(workerManagerBean.getUser().getBankAccount());
|
|
|
+ workerManagerBean.setWorkerNumber(workerManagerBean.getUser().getWorkerNumber());
|
|
|
+
|
|
|
|
|
|
workerManagerBean.updateById();
|
|
|
|
|
@@ -232,8 +335,11 @@ public class WorkerManagerLogic {
|
|
|
|
|
|
for (WorkerImg workerImg : workerManagerBean.getWorkerImgs()) {
|
|
|
workerImg.setWorkerId(workerManagerBean.getUserId());
|
|
|
+ workerImg.setUserId(workerManagerBean.getUserId());
|
|
|
}
|
|
|
|
|
|
+ this.changeList(workerManagerBean.getWorkerPolicies(),workerManagerBean.getId());
|
|
|
+
|
|
|
|
|
|
workerImgService.saveOrUpdateBatch(workerManagerBean.getWorkerImgs());
|
|
|
|
|
@@ -290,6 +396,13 @@ public class WorkerManagerLogic {
|
|
|
|
|
|
|
|
|
if (adminWebsit.getInsureType().equals("意外险,工伤险")) {
|
|
|
+
|
|
|
+ if (workerManagerBean.getWorkerPolicies().stream()
|
|
|
+ .filter(item -> item.getPolicyType().equals("EM") && item.getStatus().equals("BZZ")).count() > 0) {
|
|
|
+ throw new RemoteServiceException("该网点未配置雇主保险");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
List<WorkerPolicy> workerPoliciesIn = workerManagerBean.getWorkerPolicies().stream()
|
|
|
.filter(item -> item.getPolicyType().equals("IN")).collect(Collectors.toList());
|
|
|
|
|
@@ -304,6 +417,14 @@ public class WorkerManagerLogic {
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
+
|
|
|
+
|
|
|
+ if (workerManagerBean.getWorkerPolicies().stream()
|
|
|
+ .filter(item -> item.getPolicyType().equals("IN") && item.getStatus().equals("BZZ")).count() > 0) {
|
|
|
+ throw new RemoteServiceException("该网点未配置工伤保险");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
List<WorkerPolicy> workerPoliciesEm = workerManagerBean.getWorkerPolicies().stream()
|
|
|
.filter(item -> item.getPolicyType().equals("EM")).collect(Collectors.toList());
|
|
|
|
|
@@ -516,6 +637,17 @@ public class WorkerManagerLogic {
|
|
|
workerManagerBean.setPolicyExamineTime(new Date());
|
|
|
|
|
|
|
|
|
+ workerManagerBean.setBankAccount(workerManagerBean.getUser().getBankAccount());
|
|
|
+ workerManagerBean.setWorkerNumber(workerManagerBean.getUser().getWorkerNumber());
|
|
|
+
|
|
|
+
|
|
|
+ if (workerManagerBean.getUser().getEndTime() != null && workerManagerBean.getUser().getEndTime().before(new Date()))
|
|
|
+ throw new RemoteServiceException("高空证不能填入失效时间");
|
|
|
+
|
|
|
+ if (workerManagerBean.getUser().getIdCardEndTime() != null && workerManagerBean.getUser().getIdCardEndTime().before(new Date()))
|
|
|
+ throw new RemoteServiceException("身份证不能填入过期时间");
|
|
|
+
|
|
|
+
|
|
|
WebsitUser websitUser = websitUserService.getById(workerManagerBean.getId());
|
|
|
|
|
|
if (!websitUser.getExamineStatus().equals(ExamineWorkerStatusEnum.POLICY_WAIT.getKey()))
|
|
@@ -534,6 +666,7 @@ public class WorkerManagerLogic {
|
|
|
|
|
|
for (WorkerImg workerImg : workerManagerBean.getWorkerImgs()) {
|
|
|
workerImg.setWorkerId(workerManagerBean.getUserId());
|
|
|
+ workerImg.setUserId(workerManagerBean.getUserId());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -547,6 +680,8 @@ public class WorkerManagerLogic {
|
|
|
workerPolicy.setWebsitUserId(workerManagerBean.getId());
|
|
|
}
|
|
|
|
|
|
+ this.changeList(workerManagerBean.getWorkerPolicies(),workerManagerBean.getId());
|
|
|
+
|
|
|
workerPolicyService.saveOrUpdateBatch(workerManagerBean.getWorkerPolicies());
|
|
|
|
|
|
if (workerManagerBean.getExamineStatus().equals(ExamineWorkerStatusEnum.FAIL.getKey()))
|
|
@@ -585,6 +720,13 @@ public class WorkerManagerLogic {
|
|
|
|
|
|
|
|
|
if (adminWebsit.getInsureType().equals("意外险,工伤险")) {
|
|
|
+
|
|
|
+ if (workerManagerBean.getWorkerPolicies().stream()
|
|
|
+ .filter(item -> item.getPolicyType().equals("EM") && item.getStatus().equals("BZZ")).count() > 0) {
|
|
|
+ throw new RemoteServiceException("该网点未配置雇主保险");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
List<WorkerPolicy> workerPoliciesIn = workerManagerBean.getWorkerPolicies().stream()
|
|
|
.filter(item -> item.getPolicyType().equals("IN")).collect(Collectors.toList());
|
|
|
|
|
@@ -609,6 +751,11 @@ public class WorkerManagerLogic {
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
+
|
|
|
+ if (workerManagerBean.getWorkerPolicies().stream()
|
|
|
+ .filter(item -> item.getPolicyType().equals("IN") && item.getStatus().equals("BZZ")).count() > 0) {
|
|
|
+ throw new RemoteServiceException("该网点未配置工伤保险");
|
|
|
+ }
|
|
|
List<WorkerPolicy> workerPoliciesEm = workerManagerBean.getWorkerPolicies().stream()
|
|
|
.filter(item -> item.getPolicyType().equals("EM")).collect(Collectors.toList());
|
|
|
|