瀏覽代碼

Merge remote-tracking branch 'origin/master'

xiahan 1 年之前
父節點
當前提交
e2e42f7d72

+ 21 - 0
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/dao/CheckItemsDao.java

@@ -19,4 +19,25 @@ public interface CheckItemsDao extends BaseDao<CheckItemsDo> {
 
     @Select("select *  from asp_check_items WHERE DELETED='0' and STANDBY='y' and (ENABLED is NULL  or ENABLED ='enable' or ENABLED='')")
     IPage<CheckItemsDo> spareList(Page page);
+
+    @Select("SELECT * FROM asp_check_items where DELETED = 0 and DATE_FORMAT(WARNDATE, '%Y-%m-%d') <= DATE_FORMAT(NOW(), '%Y-%m-%d')")
+    List<CheckItemsDo> selectNeedReportEqu();
+
+    @Select("SELECT\n" +
+            "\tsu.ID \n" +
+            "FROM\n" +
+            "\tsys_user su\n" +
+            "\tLEFT JOIN sys_user_role sur ON su.ID = sur.USERID \n" +
+            "\tAND sur.DELETED = 0\n" +
+            "\tLEFT JOIN sys_user_org suo ON suo.USERID = su.ID \n" +
+            "\tAND suo.DELETED = 0\n" +
+            "\tLEFT JOIN sys_organization so ON suo.ORGID = so.ID \n" +
+            "\tAND so.DELETED = 0 \n" +
+            "WHERE\n" +
+            "\tsu.DELETED = 0 \n" +
+            "\tAND sur.ROLEID = '08e111e9dbc04706a3eb8367a65a3dc5' \n" +
+            "\tAND (\n" +
+            "\tso.ID = #{tenantId} \n" +
+            "\tOR so.FULLPID LIKE CONCAT( '%', #{tenantId}, '%' ))")
+    List<String> selectUserByTenantId(String tenantId);
 }

+ 2 - 0
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/CheckItemsService.java

@@ -20,5 +20,7 @@ public interface CheckItemsService extends IService<CheckItemsDo> {
     String deleteValidate(List<String> ids);
 
     IPage<CheckItemsDo> spareList(Page page);
+
+    void reportEquMessage();
 }
 

+ 32 - 4
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/CheckItemsServiceImpl.java

@@ -1,9 +1,11 @@
 package com.rongwei.sfcommon.sys.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.rongwe.scentity.domian.CheckItemsDo;
 import com.rongwe.scentity.domian.PointCheckDo;
+import com.rongwei.safecommon.utils.CXCommonUtils;
 import com.rongwei.sfcommon.sys.dao.CheckItemsDao;
 import com.rongwei.sfcommon.sys.service.CheckItemsService;
 import com.rongwei.sfcommon.sys.service.PointCheckService;
@@ -11,10 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service("checkItemsService")
 public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItemsDo> implements CheckItemsService {
@@ -62,4 +62,32 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
         return checkItemsDao.spareList(page);
     }
 
+    @Override
+    public void reportEquMessage() {
+        //查询所有需要提醒的设备
+        List<CheckItemsDo> list = this.baseMapper.selectNeedReportEqu();
+        //查询设备的工厂,三个工厂的设备管理员角色下的员工ID
+        Set<String> tenantIds = list.stream().map(CheckItemsDo::getTenantid).collect(Collectors.toSet());
+        Map<String, List<String>> equManager = new HashMap<>();
+        tenantIds.forEach(tenantId ->{
+            List<String> userIdList = this.baseMapper.selectUserByTenantId(tenantId);
+            equManager.put(tenantId, userIdList);
+        });
+
+        //根据设备的所属工厂给自己工厂的设备管理员发送消息
+        list.forEach(item->{
+            if(ObjectUtil.isNotEmpty(item.getTenantid())) {
+                //发送消息
+                CXCommonUtils.sendNotify("特种设备提醒",
+                        "特种设备【" + item.getCheckitemname() + "】预计提醒时间已到",
+                        null,
+                        equManager.get(item.getTenantid()),
+                        item.getId(),
+                        "specialequipment");
+            }
+        });
+
+
+    }
+
 }

+ 267 - 14
cx-safe-check/cx-save-check-entity/src/main/java/com/rongwe/scentity/domian/CheckItemsDo.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -25,89 +26,341 @@ public class CheckItemsDo extends BaseDo implements Serializable {
 	/**
 	 * 主键
 	 */
-	@TableId
 	private String id;
+
 	/**
 	 * 检查项名称
 	 */
 	private String checkitemname;
+
 	/**
 	 * 检查项编号
 	 */
 	private String checkitemcode;
+
 	/**
 	 * 检查项类型
 	 */
 	private String checkitemtype;
+
 	/**
 	 * 检查项所属区域ID
 	 */
 	private String checkitemareaid;
+
 	/**
 	 * 年检日期
 	 */
 	private Date yearlyinspectiondate;
+
 	/**
 	 * 提前预警天数
 	 */
 	private Integer earlywarndays;
+
 	/**
 	 * 设备用途
 	 */
 	private String equipmentusage;
+
 	/**
 	 * 检查对象负责人IDS
 	 */
 	private String chargeuserid;
+
 	/**
 	 * 检查对象负责人名称
 	 */
 	private String chargeusername;
+
 	/**
-	 * 检查对象负责组织机构ID
+	 * 检查对象负责组织二级机构ID
 	 */
-	private String chargeorgid;
+	private String chargeorgpid;
+
 	/**
-	 * 检查对象负责组织机构名称
+	 * 检查对象负责组织二级机构名称
 	 */
-	private String chargeorgname;
+	private String chargeorgpname;
+
 	/**
-	 * 检查对象负责组织机构ID
+	 * 检查对象负责组织一级机构ID
 	 */
-	private String chargeorgpid;
+	private String chargeorgcid;
+
 	/**
-	 * 检查对象负责组织机构名称
+	 * 检查对象负责组织一级机构名称
 	 */
-	private String chargeorgpname;
+	private String chargeorgcname;
+
 	/**
-	 * 启用/禁用
+	 * 检查对象负责组织机构ID
 	 */
-	private String enabled;
+	private String chargeorgid;
+
 	/**
-	 * 是否备用
+	 * 检查对象负责组织机构名称
 	 */
-	private String standby;
+	private String chargeorgname;
 
 	/**
 	 * 排序
 	 */
 	private Integer sort;
+
+	/**
+	 * 启用/禁用
+	 */
+	private String enabled;
+
 	/**
 	 * 租户ID
 	 */
-	@TableField(value = "TENANTID", fill = FieldFill.INSERT)
 	private String tenantid;
+
 	/**
 	 * 扩展json格式配置
 	 */
 	private String roption;
+
+	/**
+	 * 是否删除Y/N
+	 */
+	private String deleted;
+
+	/**
+	 * 备注
+	 */
+	private String remark;
+
+	/**
+	 * 创建时间
+	 */
+	private Date createdate;
+
+	/**
+	 * 创建用户ID
+	 */
+	private String createuserid;
+
+	/**
+	 * 修改日期
+	 */
+	private Date modifydate;
+
+	/**
+	 * 修改用户ID
+	 */
+	private String modifyuserid;
+
 	/**
 	 * 创建人名称
 	 */
 	private String createusername;
+
 	/**
 	 * 修改人名称
 	 */
 	private String modifyusername;
 
+	/**
+	 * 是否备用
+	 */
+	private String standby;
+
+	/**
+	 * 规格型号
+	 */
+	private String devicemodel;
+
+	/**
+	 * 出厂编号
+	 */
+	private String deviceoutcode;
+
+	/**
+	 * 安装地点
+	 */
+	private String deviceaddress;
+
+	/**
+	 * 制造单位名称
+	 */
+	private String devicenakedname;
+
+	/**
+	 * 设备代码
+	 */
+	private String devicecode;
+
+	/**
+	 * 注册代码
+	 */
+	private String signupcode;
+
+	/**
+	 * 设备制造日期
+	 */
+	private Date devicecreatedate;
+
+	/**
+	 * 检验日期
+	 */
+	private Date devicecheckdate;
+
+	/**
+	 * 下次检验日期
+	 */
+	private Date nextcheckdate;
+
+	/**
+	 * 环保号
+	 */
+	private String environmentalprotectionno;
+
+	/**
+	 * 备案号
+	 */
+	private String filingno;
+
+	/**
+	 * 使用登记证编号
+	 */
+	private String registrationno;
+
+	/**
+	 * 设备状态
+	 */
+	private String devicestatus;
+
+	/**
+	 * 设备分类
+	 */
+	private String devicesort;
+
+	/**
+	 * 类别
+	 */
+	private String category;
+
+	/**
+	 * 年限
+	 */
+	private Integer life;
+
+	/**
+	 * 预计提醒日期
+	 */
+	private Date warndate;
+
+	/**
+	 * 公称直径(mm)
+	 */
+	private String nominaldiameter;
+
+	/**
+	 * 公称壁厚(mm)
+	 */
+	private String nominalwallthickness;
+
+	/**
+	 * 管道长度(m)
+	 */
+	private String pipelinelength;
+
+	/**
+	 * 管道总长度(m)
+	 */
+	private String pipelinelengthsum;
+
+	/**
+	 * 压力(Mpa)
+	 */
+	private String pressure;
+
+	/**
+	 * 温度(°C)
+	 */
+	private String temperature;
+
+	/**
+	 * 介质
+	 */
+	private String medium;
+
+	/**
+	 * 备注
+	 */
+	private String deviceremark;
+
+	/**
+	 * 设备图
+	 */
+	private String devicephoto;
+
+	/**
+	 * 设备其他资料
+	 */
+	private String deviceotherinformation;
+
+	/**
+	 * 设备安装日期
+	 */
+	private Date deviceinstalldate;
+
+	/**
+	 * 设备开始使用日期
+	 */
+	private Date devicestartdate;
+
+	/**
+	 * 检验结论
+	 */
+	private String inspectresult;
+
+	/**
+	 * 检验机构名称
+	 */
+	private String inspectby;
+
+	/**
+	 * 数据来源(0-普通设备 1-特种设备)
+	 */
+	private String source;
+
+	/**
+	 * 移交设备ID
+	 */
+	private String transferid;
+
+	/**
+	 * 使用部门车间id
+	 */
+	private String usedeptid;
+
+	/**
+	 * 使用部门车间名称
+	 */
+	private String usedeptname;
+
+	/**
+	 * 所属部分
+	 */
+	private String belongpart;
+
+	/**
+	 * 设备原价值(万元)
+	 */
+	private BigDecimal rawvalue;
+
+	/**
+	 * 设备性能
+	 */
+	private String property;
+
+	/**
+	 * 所属工厂
+	 */
+	private String ownedfactory;
+
 }

+ 13 - 0
cx-safe-check/cx-save-check-server/src/main/java/com/rongwei/savecheck/controller/CheckItemsController.java

@@ -39,4 +39,17 @@ public class CheckItemsController {
         }
     }
 
+    /**
+     * 设备定时任务提醒,定时任务每天执行一次,【预计提醒日期】在今天及今天之前的数据,给所有设备管理员角色下的员工提醒(分所属工厂)
+     */
+    @PostMapping("/reportEquMessage")
+    public R reportEquMessage(){
+        try{
+            checkItemsService.reportEquMessage();
+            return R.ok();
+        }catch (Exception e){
+            e.printStackTrace();
+            return R.error(e.getMessage());
+        }
+    }
 }