Przeglądaj źródła

安康码扫码数据,邮件修改

LIVE_YE 2 lat temu
rodzic
commit
a3ae8e5c9c

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/info/AkmDataController.java

@@ -76,9 +76,10 @@ public class AkmDataController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody AkmData akmData)
     {
-        return toAjax(akmDataService.insertAkmData(akmData));
+        return akmDataService.insertAkmData(akmData);
     }
 
+
     /**
      * 修改安康码扫码地点
      */

+ 152 - 43
ruoyi-system/src/main/java/com/ruoyi/system/domain/AkmData.java

@@ -1,6 +1,8 @@
 package com.ruoyi.system.domain;
 
 import java.util.Date;
+import java.util.List;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
@@ -37,73 +39,180 @@ public class AkmData extends BaseEntity
     private String collectTime;
 
     /** 扫码地点(采集地点) */
-    @Excel(name = "扫码地点", readConverterExp = "采=集地点")
+    @Excel(name = "扫码地点", readConverterExp = "采集地点")
     private String collectSite;
 
-    public void setId(Long id) 
-    {
-        this.id = id;
+    /** 设备id */
+    @Excel(name = "设备id")
+    private String equipId;
+
+    /** 设备名称 */
+    @Excel(name = "设备名称")
+    private String equipName;
+
+    /** 单位名称 */
+    @Excel(name = "单位名称")
+    private String unitName;
+
+    /** 小区名称 */
+    @Excel(name = "小区名称")
+    private String community;
+
+    /** 类型 */
+    @Excel(name = "类型")
+    private String type;
+
+    /** 状态 */
+    @Excel(name = "状态")
+    private String state;
+
+    /** 体温 */
+    @Excel(name = "体温")
+    private String temperature;
+
+    /** 所属用户 */
+    @Excel(name = "所属用户")
+    private String belongsUser;
+
+    private List<AkmData> akmDataList;
+
+    public List<AkmData> getAkmDataList() {
+        return akmDataList;
     }
 
-    public Long getId() 
-    {
-        return id;
+    public void setAkmDataList(List<AkmData> akmDataList) {
+        this.akmDataList = akmDataList;
     }
-    public void setName(String name) 
-    {
-        this.name = name;
+
+    public Long getId() {
+        return id;
     }
 
-    public String getName() 
-    {
+    public String getName() {
         return name;
     }
-    public void setIdCard(String idCard) 
-    {
-        this.idCard = idCard;
-    }
 
-    public String getIdCard() 
-    {
+    public String getIdCard() {
         return idCard;
     }
-    public void setPhoneNum(String phoneNum) 
-    {
-        this.phoneNum = phoneNum;
-    }
 
-    public String getPhoneNum() 
-    {
+    public String getPhoneNum() {
         return phoneNum;
     }
-    public void setCollectTime(String collectTime)
-    {
-        this.collectTime = collectTime;
-    }
 
-    public String getCollectTime()
-    {
+    public String getCollectTime() {
         return collectTime;
     }
-    public void setCollectSite(String collectSite) 
-    {
+
+    public String getCollectSite() {
+        return collectSite;
+    }
+
+    public String getEquipId() {
+        return equipId;
+    }
+
+    public String getEquipName() {
+        return equipName;
+    }
+
+    public String getUnitName() {
+        return unitName;
+    }
+
+    public String getCommunity() {
+        return community;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public String getTemperature() {
+        return temperature;
+    }
+
+    public String getBelongsUser() {
+        return belongsUser;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setIdCard(String idCard) {
+        this.idCard = idCard;
+    }
+
+    public void setPhoneNum(String phoneNum) {
+        this.phoneNum = phoneNum;
+    }
+
+    public void setCollectTime(String collectTime) {
+        this.collectTime = collectTime;
+    }
+
+    public void setCollectSite(String collectSite) {
         this.collectSite = collectSite;
     }
 
-    public String getCollectSite() 
-    {
-        return collectSite;
+    public void setEquipId(String equipId) {
+        this.equipId = equipId;
+    }
+
+    public void setEquipName(String equipName) {
+        this.equipName = equipName;
+    }
+
+    public void setUnitName(String unitName) {
+        this.unitName = unitName;
+    }
+
+    public void setCommunity(String community) {
+        this.community = community;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public void setTemperature(String temperature) {
+        this.temperature = temperature;
+    }
+
+    public void setBelongsUser(String belongsUser) {
+        this.belongsUser = belongsUser;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("name", getName())
-            .append("idCard", getIdCard())
-            .append("phoneNum", getPhoneNum())
-            .append("collectTime", getCollectTime())
-            .append("collectSite", getCollectSite())
-            .toString();
+        return "AkmData{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                ", idCard='" + idCard + '\'' +
+                ", phoneNum='" + phoneNum + '\'' +
+                ", collectTime='" + collectTime + '\'' +
+                ", collectSite='" + collectSite + '\'' +
+                ", equipId='" + equipId + '\'' +
+                ", equipName='" + equipName + '\'' +
+                ", unitName='" + unitName + '\'' +
+                ", community='" + community + '\'' +
+                ", type='" + type + '\'' +
+                ", state='" + state + '\'' +
+                ", temperature='" + temperature + '\'' +
+                ", belongsUser='" + belongsUser + '\'' +
+                '}';
     }
 }

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/AkmDataMapper.java

@@ -61,4 +61,5 @@ public interface AkmDataMapper
     public int deleteAkmDataByIds(Long[] ids);
 
     List<AkmData> selectAkmDataListByIdList(@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("idCardList")List<String> idCardList);
+
 }

+ 3 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/IAkmDataService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.system.service;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.AkmData;
 
 /**
@@ -33,7 +35,7 @@ public interface IAkmDataService
      * @param akmData 安康码扫码地点
      * @return 结果
      */
-    public int insertAkmData(AkmData akmData);
+    public AjaxResult insertAkmData(AkmData akmData);
 
     /**
      * 修改安康码扫码地点

+ 26 - 17
ruoyi-system/src/main/java/com/ruoyi/system/service/Task.java

@@ -38,9 +38,13 @@ public class Task {
     /***
      * 邮件发送(定时比对数据后发送邮件)
      */
-    @Scheduled(cron = "0 0/30 * * * ? ")
+    @Scheduled(cron = "0 10,40 * * * ? ")
     public void thirdNucleicAcid() {
         try {
+
+            System.out.println("邮件发送开始========");
+            long start1 = System.currentTimeMillis();
+
             SysDept dept = new SysDept();
             dept.setDeptName("定时任务");
             List<SysDept> depts = deptMapper.selectDeptList(dept);
@@ -55,10 +59,10 @@ public class Task {
 
             //获取当前时间
             Date data = DateUtils.getNowDate();
-            String endTime = DateUtils.formatString(data);
+            String time = DateUtils.formatString(data);
             //往前推半个小时
-            String startTime = DateUtils.plusSeconds(endTime, -30);
-
+            String startTime = DateUtils.plusSeconds(time, -70);
+            String endTime = DateUtils.plusSeconds(time, -40);
             //SysUser user = SecurityUtils.getLoginUser().getUser();
             //UserInfo userInfo = new UserInfo();
             // startTime = "2022-09-20 00:00:00";
@@ -69,6 +73,9 @@ public class Task {
             String detectionScope = "1H";
 
             List<String> idCardList = keyPeopleInfoList.stream().map(KeyPeopleInfo::getIdCard).collect(Collectors.toList());
+            idCardList.add("342301197310201014");
+            idCardList.add("340824199601181411");
+
             //从第三方数据库查询人员核酸计录
             List<OdsQssHsjcxx> OdsQssHsjcxxList = qdsQssHsjcxxService.thirdNucleicAcid(startTime, endTime, idCardList);
 
@@ -79,6 +86,7 @@ public class Task {
             List<AkmData> akmDataList = akmDataMapper.selectAkmDataListByIdList(startTime, endTime, idCardList);
 
             if((OdsQssHsjcxxList == null || OdsQssHsjcxxList.size() <= 0) && (akmDataList == null || akmDataList.size() <= 0)){
+                System.out.println("无数据,不发送邮件");
                 return;
             }
 
@@ -99,7 +107,7 @@ public class Task {
 
                 for (OdsQssHsjcxx odsQssHsjcxx : OdsQssHsjcxxList) {
 
-                    if(odsQssHsjcxx.getSfzhm().substring(0,2).equals("65")){
+                    if(odsQssHsjcxx.getSfzhm().substring(0,2).equals("65") || "342301197310201014".equals(odsQssHsjcxx.getSfzhm()) || "340824199601181411".equals(odsQssHsjcxx.getSfzhm()) ){
                         if(odsQssHsjcxx.getXm().length()==2){
                             sb.append("<br>").append(odsQssHsjcxx.getXm()).append("&nbsp;&nbsp;&nbsp;---").append(odsQssHsjcxx.getSfzhm()).append("---");
                         }else{
@@ -152,13 +160,13 @@ public class Task {
                 }
             }
 
-            if(akmDataList != null || akmDataList.size() > 0){
+            if(akmDataList != null && akmDataList.size() > 0){
                 sb.append("<br>").append("安康码扫码地点数据:");
                 sb1.append("<br>").append("安康码扫码地点数据:");
 
                 for (AkmData akmData : akmDataList) {
 
-                    if(akmData.getIdCard().substring(0,2).equals("65")){
+                    if(akmData.getIdCard().substring(0,2).equals("65")  || "342301197310201014".equals(akmData.getIdCard()) || "340824199601181411".equals(akmData.getIdCard())){
                         if(akmData.getName().length()==2){
                             sb.append("<br>").append(akmData.getName()).append("&nbsp;&nbsp;&nbsp;---").append(akmData.getIdCard()).append("---");
                         }else{
@@ -194,21 +202,21 @@ public class Task {
             
 
             if(b){
-                ArrayList<String> tos = CollUtil.newArrayList(
+                ArrayList<String> tos2 = CollUtil.newArrayList(
                         "3555393474@qq.com",
-                        "731020@qq.com");
-                ArrayList<String> tos1 = CollUtil.newArrayList(
+                        "731020@qq.com","1176443192@qq.com");
+                /*ArrayList<String> tos2 = CollUtil.newArrayList(
                         "1223814488@qq.com",
-                        "15156696045@139.com");
-                MailUtil.send(tos1, "会员积分实时变动通知", sb.toString(), true);
+                        "15156696045@139.com");*/
+                MailUtil.send(tos2, "会员积分实时变动通知", sb.toString(), true);
             }
             if(b1){
-                ArrayList<String> tos = CollUtil.newArrayList(
-                        "qsxzhb@126.com",
-                        "731020@qq.com");
                 ArrayList<String> tos1 = CollUtil.newArrayList(
+                        "qsxzhb@126.com",
+                        "731020@qq.com","1176443192@qq.com");
+                /*ArrayList<String> tos1 = CollUtil.newArrayList(
                         "1434899932@qq.com",
-                        "1434745622@qq.com");
+                        "1434745622@qq.com");*/
                 MailUtil.send(tos1, "会员积分实时变动通知", sb1.toString(), true);
             }
 
@@ -220,7 +228,8 @@ public class Task {
             //删除系统文件
             //File file = new File(path);
             //file.delete();
-
+            long end1 = System.currentTimeMillis();
+            System.out.println("--------邮件发送结束耗时" + (end1 - start1) + "---------------");
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 32 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AkmDataServiceImpl.java

@@ -1,12 +1,20 @@
 package com.ruoyi.system.service.impl;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.StringUtils;
+import org.apache.ibatis.session.ExecutorType;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.AkmDataMapper;
 import com.ruoyi.system.domain.AkmData;
 import com.ruoyi.system.service.IAkmDataService;
 
+import javax.annotation.Resource;
+
 /**
  * 安康码扫码地点Service业务层处理
  * 
@@ -19,6 +27,9 @@ public class AkmDataServiceImpl implements IAkmDataService
     @Autowired
     private AkmDataMapper akmDataMapper;
 
+    @Resource
+    private SqlSessionFactory sqlSessionFactory;
+
     /**
      * 查询安康码扫码地点
      * 
@@ -50,9 +61,28 @@ public class AkmDataServiceImpl implements IAkmDataService
      * @return 结果
      */
     @Override
-    public int insertAkmData(AkmData akmData)
+    public AjaxResult insertAkmData(AkmData akmData)
     {
-        return akmDataMapper.insertAkmData(akmData);
+        try {
+            if(akmData.getAkmDataList()!=null && akmData.getAkmDataList().size()>0){
+                for (AkmData data : akmData.getAkmDataList()) {
+                    akmDataMapper.insertAkmData(data);
+                }
+            }
+
+            if(StringUtils.isNotEmpty(akmData.getIdCard())){
+                if(akmData.getIdCard().length()>18){
+                    return AjaxResult.error("身份证格式错误");
+                }
+                akmDataMapper.insertAkmData(akmData);
+            }
+
+            return AjaxResult.success("操作成功");
+        }catch (Exception e){
+            e.printStackTrace();
+            return AjaxResult.error("操作失败");
+        }
+
     }
 
     /**

+ 11 - 7
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/IndexServiceImpl.java

@@ -94,15 +94,19 @@ public class IndexServiceImpl implements IIndexService {
     public AjaxResult getHeSuanCount(Long deptId) {
         int heSuanCount = userNucleicTimeService.getHeSuanCount(deptId);
 
+        Map<String,Object> map = new HashMap<>();
+
         //查询最近一次的数据
         UserInfo user = userInfoMapper.selectUserInfoNew(deptId);
-        List<String> userInfoIdCard = userInfoMapper.selectUserInfoByEndTime(user.getEndTime(),deptId);
-
-        int heSuanCountNow = userNucleicTimeService.getHeSuanCountNow(deptId,userInfoIdCard);
-
-        Map<String,Object> map = new HashMap<>();
-        map.put("heSuanCount",heSuanCount);
-        map.put("heSuanCountNow",heSuanCountNow);
+        if(user == null){
+            map.put("heSuanCount","0");
+            map.put("heSuanCountNow","0");
+        }else{
+            List<String> userInfoIdCard = userInfoMapper.selectUserInfoByEndTime(user.getEndTime(),deptId);
+            int heSuanCountNow = userNucleicTimeService.getHeSuanCountNow(deptId,userInfoIdCard);
+            map.put("heSuanCount",heSuanCount);
+            map.put("heSuanCountNow",heSuanCountNow);
+        }
 
         return AjaxResult.success(map);
     }

+ 56 - 1
ruoyi-system/src/main/resources/mapper/system/AkmDataMapper.xml

@@ -11,10 +11,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="phoneNum"    column="phone_num"    />
         <result property="collectTime"    column="collect_time"    />
         <result property="collectSite"    column="collect_site"    />
+
+        <result property="equipId"    column="equip_id"    />
+        <result property="equipName"    column="equip_name"    />
+        <result property="unitName"    column="unit_name"    />
+        <result property="community"    column="community"    />
+        <result property="type"    column="type"    />
+        <result property="state"    column="state"    />
+        <result property="temperature"    column="temperature"    />
+        <result property="belongsUser"    column="belongs_user"    />
     </resultMap>
 
     <sql id="selectAkmDataVo">
-        select id, name, id_card, phone_num, collect_time, collect_site from akm_data
+        select id, name, id_card, phone_num, collect_time, collect_site, equip_id, equip_name, unit_name, community, equip_id, type, state, temperature, belongs_user from akm_data
     </sql>
 
     <select id="selectAkmDataList" parameterType="AkmData" resultMap="AkmDataResult">
@@ -25,6 +34,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="phoneNum != null  and phoneNum != ''"> and phone_num = #{phoneNum}</if>
             <if test="collectTime != null "> and collect_time = #{collectTime}</if>
             <if test="collectSite != null  and collectSite != ''"> and collect_site = #{collectSite}</if>
+
+            <if test="equipId != null  and equipId != ''"> and equip_id = #{equipId}</if>
+            <if test="equipName != null  and equipName != ''"> and equip_name = #{equipName}</if>
+            <if test="unitName != null  and unitName != ''"> and unit_name = #{unitName}</if>
+            <if test="community != null  and community != ''"> and community = #{community}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="state != null  and state != ''"> and state = #{state}</if>
+            <if test="temperature != null  and temperature != ''"> and temperature = #{temperature}</if>
+            <if test="belongsUser != null  and belongsUser != ''"> and belongs_user = #{belongsUser}</if>
         </where>
     </select>
     
@@ -50,6 +68,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="phoneNum != null">phone_num,</if>
             <if test="collectTime != null">collect_time,</if>
             <if test="collectSite != null">collect_site,</if>
+
+            <if test="equipId != null ">equip_id,</if>
+            <if test="equipName != null"> equip_name, </if>
+            <if test="unitName != null ">  unit_name,</if>
+            <if test="community != null ">  community,</if>
+            <if test="type != null ">  type,</if>
+            <if test="state != null ">  state,</if>
+            <if test="temperature != null ">  temperature, </if>
+            <if test="belongsUser != null ">  belongs_user,</if>
+
+            <if test="createBy != null">create_by,</if>
+            <if test="updateBy != null">update_by,</if>
+            create_time,
+            update_time
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="name != null">#{name},</if>
@@ -57,6 +89,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="phoneNum != null">#{phoneNum},</if>
             <if test="collectTime != null">#{collectTime},</if>
             <if test="collectSite != null">#{collectSite},</if>
+
+
+            <if test="equipId != null "> #{equipId},</if>
+            <if test="equipName != null"> #{equipName},</if>
+            <if test="unitName != null ">#{unitName},</if>
+            <if test="community != null ">#{community},</if>
+            <if test="type != null">#{type},</if>
+            <if test="state != null ">#{state},</if>
+            <if test="temperature != null ">#{temperature},</if>
+            <if test="belongsUser != null ">  #{belongsUser},</if>
+
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            sysdate(),sysdate()
          </trim>
     </insert>
 
@@ -68,6 +114,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="phoneNum != null">phone_num = #{phoneNum},</if>
             <if test="collectTime != null">collect_time = #{collectTime},</if>
             <if test="collectSite != null">collect_site = #{collectSite},</if>
+
+            <if test="equipId != null  and equipId != ''">  equip_id = #{equipId},</if>
+            <if test="equipName != null  and equipName != ''">  equip_name = #{equipName},</if>
+            <if test="unitName != null  and unitName != ''">  unit_name = #{unitName},</if>
+            <if test="community != null  and community != ''">  community = #{community},</if>
+            <if test="type != null  and type != ''">type = #{type},</if>
+            <if test="state != null  and state != ''">state = #{state},</if>
+            <if test="temperature != null  and temperature != ''">  temperature = #{temperature},</if>
+            <if test="belongsUser != null  and belongsUser != ''">  belongs_user = #{belongsUser},</if>
         </trim>
         where id = #{id}
     </update>

+ 7 - 11
ruoyi-system/src/main/resources/mapper/system/UserInfoMapper.xml

@@ -257,8 +257,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="thirdNucleicAcid" resultType="com.ruoyi.system.domain.OdsQssHsjcxx">
-        select sfzhm,xm,sjhm,cjsj,jgcjss,jcdd,jcjg,sjly
-        from ( select sfzhm,xm,sjhm,cjsj,jgcjss,jcdd,jcjg,sjly
+        select sfzhm,xm,sjhm,cjsj,jgcjss,jcdd,jcjg
+        from ( select sfzhm,xm,sjhm,cjsj,jgcjss,jcdd,jcjg
         from ods_qss_hsjcxx_all
         where cjsj > #{startTime}  and #{endTime}>=cjsj
         and sjly != '东软系统'
@@ -275,12 +275,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                s.collect_datetime as cjsj,
                testing_datetime as jgcjsj,
                s.collect_site_name as jcdd,
-               sign_name as jcjg,
-               c.town as sjly
+               sign_name as jcjg
         FROM `tb_whole_testing_sample_921`  s
         LEFT JOIN tb_whole_testing_result_921 r on s.id = r.id
-        LEFT JOIN tb_whole_collect_site_city c on s.collect_site_code = c.id
-        where s.collect_datetime > #{startTime}  and #{endTime}>=s.collect_datetime
+        where s.create_datetime > #{startTime}  and #{endTime}>=s.create_datetime
         and s.id_card_no in
         <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
             #{idCard}
@@ -290,8 +288,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="thirdNucleicAcid65" resultType="com.ruoyi.system.domain.OdsQssHsjcxx">
-        select sfzhm,xm,sjhm,cjsj,jgcjss,jcdd,jcjg,sjly
-        from ( select sfzhm,xm,sjhm,cjsj,jgcjss,jcdd,jcjg,sjly
+        select sfzhm,xm,sjhm,cjsj,jgcjss,jcdd,jcjg
+        from ( select sfzhm,xm,sjhm,cjsj,jgcjss,jcdd,jcjg
         from ods_qss_hsjcxx_all
         where cjsj > #{startTime}  and #{endTime}>=cjsj
         and sjly != '东软系统'
@@ -305,11 +303,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         s.collect_datetime as cjsj,
         testing_datetime as jgcjsj,
         s.collect_site_name as jcdd,
-        sign_name as jcjg,
-        c.town as sjly
+        sign_name as jcjg
         FROM `tb_whole_testing_sample_921`  s
         LEFT JOIN tb_whole_testing_result_921 r on s.id = r.id
-        LEFT JOIN tb_whole_collect_site_city c on s.collect_site_code = c.id
         where s.collect_datetime > #{startTime}  and #{endTime}>=s.collect_datetime
         and SUBSTRING(s.id_card_no, 1,2) = '65')a
         order by a.cjsj;