|
@@ -6,11 +6,16 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.zd.common.core.annotation.Log;
|
|
import com.zd.common.core.annotation.Log;
|
|
|
import com.zd.common.core.log.BusinessType;
|
|
import com.zd.common.core.log.BusinessType;
|
|
|
|
|
+import com.zd.common.core.utils.StringUtils;
|
|
|
import com.zd.common.core.web.controller.BaseController;
|
|
import com.zd.common.core.web.controller.BaseController;
|
|
|
|
|
+import com.zd.laboratory.api.entity.LabMessageContent;
|
|
|
import com.zd.laboratory.domain.LabTimedExhaust;
|
|
import com.zd.laboratory.domain.LabTimedExhaust;
|
|
|
import com.zd.laboratory.domain.vo.LabExhaustJoinSubVo;
|
|
import com.zd.laboratory.domain.vo.LabExhaustJoinSubVo;
|
|
|
import com.zd.laboratory.domain.vo.LabSubjectVO;
|
|
import com.zd.laboratory.domain.vo.LabSubjectVO;
|
|
|
|
|
+import com.zd.laboratory.domain.vo.LabTimedExhaustJoinsubVo;
|
|
|
import com.zd.laboratory.domain.vo.LabTimedExhaustVo;
|
|
import com.zd.laboratory.domain.vo.LabTimedExhaustVo;
|
|
|
|
|
+import com.zd.laboratory.mapper.LabTimedExhaustJoinsubMapper;
|
|
|
|
|
+import com.zd.laboratory.service.ILabMessageContentService;
|
|
|
import com.zd.laboratory.service.ILabTimedExhaustService;
|
|
import com.zd.laboratory.service.ILabTimedExhaustService;
|
|
|
import com.zd.model.domain.ResultData;
|
|
import com.zd.model.domain.ResultData;
|
|
|
import com.zd.model.page.TableDataInfo;
|
|
import com.zd.model.page.TableDataInfo;
|
|
@@ -18,10 +23,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 定时排风表Controller
|
|
* 定时排风表Controller
|
|
@@ -36,6 +38,12 @@ public class LabTimedExhaustController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ILabTimedExhaustService labTimedExhaustService;
|
|
private ILabTimedExhaustService labTimedExhaustService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private LabTimedExhaustJoinsubMapper labTimedExhaustJoinsubMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ILabMessageContentService labMessageContentService;
|
|
|
|
|
+
|
|
|
@ApiOperation(value = "定时排风列表")
|
|
@ApiOperation(value = "定时排风列表")
|
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(LabTimedExhaust labTimedExhaust) {
|
|
public TableDataInfo list(LabTimedExhaust labTimedExhaust) {
|
|
@@ -142,6 +150,45 @@ public class LabTimedExhaustController extends BaseController {
|
|
|
*/
|
|
*/
|
|
|
@RequestMapping(value = "/automaticExhaust")
|
|
@RequestMapping(value = "/automaticExhaust")
|
|
|
public ResultData automaticExhaust(){
|
|
public ResultData automaticExhaust(){
|
|
|
|
|
+ //这里公用一个定时器,如果日期是12月1日,需要下发实验室管理员和实验室责任人提示消息
|
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
|
+ int monthInt = calendar.get(Calendar.MONTH)+1;
|
|
|
|
|
+ int dateInt = calendar.get(Calendar.DATE);
|
|
|
|
|
+ if(monthInt==12 && dateInt==1){
|
|
|
|
|
+ //这里需要查询定时排风下的所有实验室和关联的责任人
|
|
|
|
|
+ new Thread(()->sendMassage()).start();
|
|
|
|
|
+ }
|
|
|
return ResultData.success(labTimedExhaustService.automaticExhaust());
|
|
return ResultData.success(labTimedExhaustService.automaticExhaust());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 异步调用消息通知
|
|
|
|
|
+ */
|
|
|
|
|
+ public void sendMassage(){
|
|
|
|
|
+ List <LabTimedExhaustJoinsubVo> timedExhaustJoinsubList = labTimedExhaustJoinsubMapper.selectJoinsubList();
|
|
|
|
|
+ StringBuffer stringBuffer = new StringBuffer();
|
|
|
|
|
+ Optional.ofNullable(timedExhaustJoinsubList).orElseGet(Collections::emptyList)
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .forEach(a->{
|
|
|
|
|
+ if(StringUtils.isNotNull(a.getAdminId())){
|
|
|
|
|
+ stringBuffer.append(",");
|
|
|
|
|
+ stringBuffer.append(a.getAdminId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotNull(a.getSafeUserIds())){
|
|
|
|
|
+ stringBuffer.append(",");
|
|
|
|
|
+ stringBuffer.append(a.getSafeUserIds());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if(StringUtils.isNotNull(stringBuffer)){
|
|
|
|
|
+ LabMessageContent labMessageContent = new LabMessageContent();
|
|
|
|
|
+ labMessageContent.setMessClass(1);
|
|
|
|
|
+ labMessageContent.setSendRange(3);
|
|
|
|
|
+ labMessageContent.setContent("你好,请及时更新定时排风任务排风日期");
|
|
|
|
|
+ labMessageContent.setUserIds(stringBuffer.substring(1));
|
|
|
|
|
+ labMessageContent.setCreateTime(new Date());
|
|
|
|
|
+ labMessageContent.setCreateBy("系统");
|
|
|
|
|
+ labMessageContent.setUserId(-2L);
|
|
|
|
|
+ labMessageContentService.insertLabMessageContent(labMessageContent);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|