|
@@ -1,53 +1,49 @@
|
|
|
package com.jpsoft.shinestar.mq.listener;
|
|
|
|
|
|
-import com.jpsoft.shinestar.modules.base.entity.PersonDeviceRelation;
|
|
|
import com.jpsoft.shinestar.modules.base.entity.PersonInfo;
|
|
|
-import com.jpsoft.shinestar.modules.base.service.PersonDeviceRelationService;
|
|
|
import com.jpsoft.shinestar.modules.base.service.PersonInfoService;
|
|
|
-import com.jpsoft.shinestar.modules.business.entity.GuestInfoRecord;
|
|
|
-import com.jpsoft.shinestar.modules.business.entity.RequestForLeaveInfo;
|
|
|
-import com.jpsoft.shinestar.modules.business.service.GuestInfoRecordService;
|
|
|
-import com.jpsoft.shinestar.modules.business.service.RequestForLeaveInfoService;
|
|
|
-import com.jpsoft.shinestar.modules.pacs.dto.PacsMsgResult;
|
|
|
-import com.jpsoft.shinestar.modules.pacs.service.IGuardService;
|
|
|
-import com.jpsoft.shinestar.modules.sys.service.SysLogService;
|
|
|
+import com.jpsoft.shinestar.modules.common.utils.StringUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
|
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
@RabbitListener(queues = "updateWorkStatusQueue",concurrency = "10")
|
|
|
public class UpdateWorkStatusListener {
|
|
|
-
|
|
|
@Autowired
|
|
|
private PersonInfoService personInfoService;
|
|
|
|
|
|
-
|
|
|
@RabbitHandler
|
|
|
public void process(String id) {
|
|
|
-
|
|
|
-
|
|
|
try {
|
|
|
-
|
|
|
-
|
|
|
- log.warn("收到访客访问记录:" + id);
|
|
|
+ log.warn("收到修改工作状态记录:" + id);
|
|
|
String[]sz=id.split("_");
|
|
|
String type=sz[0];//A 修改为请假, b还原
|
|
|
- String thisid=sz[1];//id
|
|
|
+ String personId=sz[1];//id
|
|
|
String status=sz[2];//之前的状态
|
|
|
- // RequestForLeaveInfo target = requestForLeaveInfoService.get(id);
|
|
|
- PersonInfo info =personInfoService.get(Long.valueOf(thisid));
|
|
|
+ String approvePersonId = "";
|
|
|
+
|
|
|
+ if (sz.length>3){
|
|
|
+ approvePersonId = sz[3];
|
|
|
+ }
|
|
|
+
|
|
|
+ //RequestForLeaveInfo target = requestForLeaveInfoService.get(id);
|
|
|
+ PersonInfo info =personInfoService.get(Long.valueOf(personId));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(approvePersonId)){
|
|
|
+ info.setUpdateBy(type + "_" + approvePersonId);
|
|
|
+ }
|
|
|
+
|
|
|
Date now = new Date();
|
|
|
+
|
|
|
if("A".equals(type)){
|
|
|
info.setWorkStatus("4");
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
if("B".equals(type)){
|
|
|
//如果是请假, 则修改回来, 否则不管
|
|
|
if("4".equals(info.getWorkStatus())) {
|
|
@@ -57,6 +53,7 @@ public class UpdateWorkStatusListener {
|
|
|
info.setWorkStatus("1");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
info.setUpdateTime(now);
|
|
|
personInfoService.update(info);
|
|
|
}
|