|
@@ -14,6 +14,7 @@ import com.jpsoft.shinestar.modules.base.service.ApprovalConfigService;
|
|
|
import com.jpsoft.shinestar.modules.base.service.CompanyInfoService;
|
|
|
import com.jpsoft.shinestar.modules.base.service.PersonInfoService;
|
|
|
import com.jpsoft.shinestar.modules.base.service.PersonPopedomService;
|
|
|
+import com.jpsoft.shinestar.modules.business.dto.UpdatePersonAttendanceDTO;
|
|
|
import com.jpsoft.shinestar.modules.common.utils.JwtUtil2;
|
|
|
import com.jpsoft.shinestar.modules.common.utils.WechatMessageUtil;
|
|
|
import com.jpsoft.shinestar.modules.workflow.entity.ProcinstActUser;
|
|
@@ -21,6 +22,7 @@ import com.jpsoft.shinestar.modules.workflow.entity.ProcinstActivity;
|
|
|
import com.jpsoft.shinestar.modules.workflow.service.ProcinstActUserService;
|
|
|
import com.jpsoft.shinestar.modules.workflow.service.ProcinstActivityService;
|
|
|
import com.jpsoft.shinestar.modules.workflow.service.ProcinstService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.joda.time.DateTime;
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
@@ -37,6 +39,7 @@ import com.github.pagehelper.PageHelper;
|
|
|
|
|
|
@Transactional
|
|
|
@Component(value="yearRequestForLeaveInfoService")
|
|
|
+@Slf4j
|
|
|
public class YearRequestForLeaveInfoServiceImpl implements YearRequestForLeaveInfoService {
|
|
|
@Resource(name="yearRequestForLeaveInfoDAO")
|
|
|
private YearRequestForLeaveInfoDAO yearRequestForLeaveInfoDAO;
|
|
@@ -130,6 +133,73 @@ public class YearRequestForLeaveInfoServiceImpl implements YearRequestForLeaveIn
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ public void logic(YearRequestForLeaveInfo yearRequestForLeaveInfo) throws Exception {
|
|
|
+ //更新人员工作状态
|
|
|
+ updatePersonWorkStatus(yearRequestForLeaveInfo);
|
|
|
+
|
|
|
+ Date now = new Date();
|
|
|
+ if (yearRequestForLeaveInfo.getStartTime().before(now)) {
|
|
|
+ PersonPopedom personPopedom = personPopedomService.get(yearRequestForLeaveInfo.getPersonPopedomId());
|
|
|
+ PersonInfo personInfo = personInfoService.get(personPopedom.getPersonId());
|
|
|
+
|
|
|
+ UpdatePersonAttendanceDTO updatePersonAttendanceDTO = new UpdatePersonAttendanceDTO(
|
|
|
+ personInfo.getId(), yearRequestForLeaveInfo.getStartTime(),yearRequestForLeaveInfo.getEndTime());
|
|
|
+
|
|
|
+ rabbitTemplate.convertAndSend("updatePersonAttendanceQueue", updatePersonAttendanceDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updatePersonWorkStatus(YearRequestForLeaveInfo yearRequestForLeaveInfo) {
|
|
|
+ try{
|
|
|
+ PersonPopedom personPopedom = personPopedomService.get(yearRequestForLeaveInfo.getPersonPopedomId());
|
|
|
+ PersonInfo personInfo = personInfoService.get(personPopedom.getPersonId());
|
|
|
+
|
|
|
+ Date now = new Date();
|
|
|
+
|
|
|
+ //如果出差开始时间<=当前时间,说明是补出差记录,可能正在出差
|
|
|
+ if (yearRequestForLeaveInfo.getStartTime().compareTo(now) <=0){
|
|
|
+ personInfo.setWorkStatus("7");
|
|
|
+ personInfoService.update(personInfo);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //如果出差开始开始时间>当前时间,则延时修改状态
|
|
|
+ long millisecond = DateUtil.betweenMs(now,yearRequestForLeaveInfo.getStartTime());
|
|
|
+
|
|
|
+ log.warn("创建延时队列修改工作状态,id:"+yearRequestForLeaveInfo.getId());
|
|
|
+
|
|
|
+ rabbitTemplate.convertAndSend("businessOutDelayExchange", "businessOutSubmit",
|
|
|
+ yearRequestForLeaveInfo.getId(), (message)->{
|
|
|
+ message.getMessageProperties().setHeader("x-delay",millisecond);
|
|
|
+ return message;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if(yearRequestForLeaveInfo.getEndTime()!=null) {
|
|
|
+ //如果年假结束时间<=当前时间,说明年假结束
|
|
|
+ if (yearRequestForLeaveInfo.getEndTime().compareTo(now) <= 0) {
|
|
|
+ personInfo.setWorkStatus("1");
|
|
|
+ personInfoService.update(personInfo);
|
|
|
+ } else {
|
|
|
+ //如果出差结束时间>当前时间,则延时修改状态
|
|
|
+ long millisecond = DateUtil.betweenMs(now, yearRequestForLeaveInfo.getEndTime())+60000;
|
|
|
+
|
|
|
+ log.warn("创建延时队列修改工作状态,id:" + yearRequestForLeaveInfo.getId());
|
|
|
+
|
|
|
+ rabbitTemplate.convertAndSend("businessOutDelayExchange", "businessOutSubmit",
|
|
|
+ yearRequestForLeaveInfo.getId(), (message) -> {
|
|
|
+ message.getMessageProperties().setHeader("x-delay", millisecond);
|
|
|
+ return message;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception ex){
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public String leaveSubmit(PersonPopedom personPopedom, String startTime, String endTime, String startTimeQuantum, String endTimeQuantum, String imageUrl, String reason, String days, String formId, String activity, String draft, String id) throws Exception {
|
|
|
try {
|