浏览代码

整理数据

shiqian 3 年之前
父节点
当前提交
4658772ee9

+ 9 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/VaccineInfoOperation.java

@@ -205,6 +205,7 @@ public class VaccineInfoOperation extends BaseEntity {
      */
     @Excel(name = "操作类型")
     private String operationType;
+    private String yhzgx;
 
     /**
      * 疫苗信息
@@ -293,6 +294,14 @@ public class VaccineInfoOperation extends BaseEntity {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
+    public String getYhzgx() {
+        return yhzgx;
+    }
+
+    public void setYhzgx(String yhzgx) {
+        this.yhzgx = yhzgx;
+    }
+
     public String getRlr() {
         return rlr;
     }

+ 4 - 0
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysDeptServiceImpl.java

@@ -374,6 +374,10 @@ public class SysDeptServiceImpl implements ISysDeptService {
         List<SysDept> allDepts = selectDepts(new SysDept());
         SysDept sysDept = ObjectUtils.filterOne(allDepts, dept -> deptId.equals(dept.getId()));
         List<SysDept> returnData = Lists.newArrayListWithCapacity(16);
+        if (null == sysDept) {
+            return returnData;
+        }
+
         List<SysDept> sysDepts = recursionChildrenDepts(allDepts, sysDept, returnData);
         SysDept selfDept = new SysDept();
         selfDept.setId(deptId);

+ 76 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/TestController.java

@@ -0,0 +1,76 @@
+package com.boman.web.core.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.boman.common.core.utils.obj.ObjectUtils;
+import com.boman.domain.VaccineInfoOperation;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.web.core.mapper.StandardlyMapper;
+import com.boman.web.core.mapper.VaccineInfoMapper;
+import com.boman.web.core.service.vaccineInfo.IVaccineInfoService;
+import com.boman.web.core.service.vaccineInfo.impl.VaccineInfoServiceImpl;
+import com.boman.web.core.utils.IdUtils;
+import com.google.common.base.Strings;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author shiqian
+ * @date 2021年09月08日 10:40
+ **/
+@RestController
+@RequestMapping("/test")
+public class TestController {
+    @Resource
+    private VaccineInfoMapper mapper;
+
+    @GetMapping("/handleData")
+    public AjaxResult handleData(){
+        List<VaccineInfoOperation> list = mapper.handleData();
+        for (VaccineInfoOperation vaccineInfoOperation : list) {
+            if (Objects.isNull(vaccineInfoOperation.getAge()) && ObjectUtils.isEmpty(vaccineInfoOperation.getBirthday())) {
+                continue;
+            }
+
+            mapper.updateAgeBirthday(vaccineInfoOperation);
+        }
+
+        return new AjaxResult();
+    }
+
+    @GetMapping("/setHouseType")
+    public AjaxResult setHouseType() {
+        List<JSONObject> list = mapper.getHouseType();
+        for (JSONObject json : list) {
+            String idCard = json.getString("idCard");
+            String yhzgx = json.getString("yhzgx");// 与户主关系
+            String code = json.getString("code"); // 户号
+
+            String houseType = "", yhzgx1 = "";
+            if (StringUtils.isNotEmpty(yhzgx)) {
+                yhzgx = yhzgx.trim();
+                if ("户主".equals(yhzgx)) {
+                    houseType = "是";
+                    yhzgx1 = "户主";
+                } else {
+                    houseType = "否";
+                    yhzgx1 = yhzgx;
+                }
+            }
+
+            mapper.setHouseType(idCard, code, yhzgx1, houseType);
+        }
+
+        return new AjaxResult();
+    }
+
+}

+ 9 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/VaccineInfoMapper.java

@@ -1,5 +1,6 @@
 package com.boman.web.core.mapper;
 
+import com.alibaba.fastjson.JSONObject;
 import com.boman.domain.VaccineInfoOperation;
 import org.apache.ibatis.annotations.Param;
 
@@ -59,6 +60,7 @@ public interface VaccineInfoMapper
      * @return 结果
      */
     public int updateVaccineInfo(VaccineInfoOperation vaccineInfo);
+    public int updateAgeBirthday(VaccineInfoOperation vaccineInfo);
 
     int update(VaccineInfoOperation info);
 
@@ -126,4 +128,11 @@ public interface VaccineInfoMapper
     List<VaccineInfoOperation> listByCode(String code);
 
     int reduction(String id);
+
+    List<VaccineInfoOperation> handleData();
+
+    List<JSONObject> getHouseType();
+
+    int setHouseType(@Param("idCard") String idCard, @Param("code") String code
+    , @Param("yhzgx") String yhzgx, @Param("houseType") String houseType);
 }

+ 18 - 7
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoServiceImpl.java

@@ -1069,6 +1069,17 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
             vaccineInfoOperation.setDeptIdList(deptIdList);
         }
 
+        Map<String, Object> params = vaccineInfoOperation.getParams();
+        String ageScope = (String) params.get("age");
+        if (isNotEmpty(ageScope)) {
+            ageScope = ageScope.trim();
+            String[] split = ageScope.split("-");
+            params.put("startAge", Integer.parseInt(split[0]));
+            if (split.length == 2) {
+                params.put("endAge", Integer.parseInt(split[1]));
+            }
+        }
+
         PageDomain pageDomain = TableSupport.buildPageRequest();
         Integer pageNum = pageDomain.getPageNum();
         Integer pageSize = pageDomain.getPageSize();
@@ -1079,12 +1090,12 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
 
         List<VaccineInfoOperation> infoOperations = vaccineInfoMapper.listByRlry(vaccineInfoOperation);
         for (VaccineInfoOperation infoOperation : infoOperations) {
-            String province = infoOperation.getProvince(); //省
-            String city = infoOperation.getCity();  //市
-            String region = infoOperation.getRegion();   //区
-            String domicile = infoOperation.getDomicile(); //户籍地
-            StringBuilder sbDomicile = new StringBuilder();
-            StringBuilder sbNowIn = new StringBuilder();
+            String province = infoOperation.getProvince(); // 现居住地的
+            String city = infoOperation.getCity();  // 现居住地的城
+            String region = infoOperation.getRegion();   // 现居住地的
+            String domicile = infoOperation.getDomicile(); // 户籍地
+            StringBuilder sbDomicile = new StringBuilder(); // 户籍地前端展示用 安徽省安庆市潜山市xx乡xx村xx组
+            StringBuilder sbNowIn = new StringBuilder(); // 現在居住地址查询展示 安徽省安庆市潜山市xx乡xx村xx组
             if (StringUtils.isNotBlank(province)) {
                 sbDomicile.append(province);
                 sbNowIn.append(province);
@@ -1097,7 +1108,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
                 sbDomicile.append(region);
                 sbNowIn.append(region);
             }
-            if (StringUtils.isNotBlank(domicile)) {
+            if (StringUtils.isNotBlank(domicile)) { // 户籍地
                 sbDomicile.append(domicile);
             }
 

+ 26 - 2
boman-web-core/src/main/resources/mapper/VaccineInfoMapper.xml

@@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="progress"    column="progress"    />
         <result property="deptId"    column="dept_id"    />
         <result property="rlr"    column="rlr"    />
+        <result property="yhzgx"    column="yhzgx"    />
         <result property="deleteReason"    column="delete_reason"    />
         <collection  property="vaccineInfoUserList"   javaType="java.util.List"        resultMap="VaccineInfoUser" />
     </resultMap>
@@ -385,14 +386,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="listByCode" resultMap="VaccineInfoResult">
         select vi.id, vi.user_name, vi.phone_num, vi.id_card, vi.gender, vi.province, vi.city, vi.region, vi.now_in
-        , vi.house_type, vi.update_by, vi.code, vi.rlr
+        , vi.house_type, vi.update_by, vi.code, vi.rlr, vi.yhzgx
         from vaccine_info vi
         where vi.is_del = 'N' and code = #{code}
     </select>
 
     <select id="listByRlry" resultMap="VaccineInfoResult">
         select vi.id, vi.user_name, vi.phone_num, vi.id_card, vi.gender, vi.province, vi.city, vi.region, vi.now_in
-               , vi.house_type, vi.update_by, vi.code, vi.rlr, vi.update_time, vi.delete_reason
+               , vi.house_type, vi.update_by, vi.code, vi.rlr, vi.update_time, vi.delete_reason, vi.domicile, vi.now_in
         from vaccine_info vi
         <where>
             vi.is_del = #{isDel}
@@ -512,6 +513,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select * from vaccine_info limit   #{startNum}, #{endNum}
     </select>
 
+    <select id="handleData" resultMap="VaccineInfoResult">
+        SELECT (DATE_FORMAT(substring(t.id_card, 7, 8), "%Y-%m-%d")) AS birthday
+            , ((YEAR(now())) - (YEAR(substring(t.id_card, 7, 8)))) AS age
+            , id AS id
+        FROM vaccine_info t where age is null or age = 0 or age = ''
+    </select>
+
+    <select id="getHouseType" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT zjhm idCard, hh code, yhzgx yhzgx FROM std_ga_hjrkxx
+    </select>
+
+    <update id="setHouseType">
+        update vaccine_info set code = #{code}, yhzgx = #{yhzgx}, house_type = #{houseType} where id_card = #{idCard}
+    </update>
 
     <select id="selectVaccineInfoById" parameterType="Long" resultMap="VaccineInfoResult">
         <include refid="selectVaccineInfoVo"/>
@@ -679,6 +694,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </update>
 
+    <update id="updateAgeBirthday" >
+        update vaccine_info
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="age != null and age != ''">age = #{age},</if>
+            <if test="birthday != null and birthday != ''">birthday = #{birthday},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
     <update id="update" >
         update vaccine_info
         <trim prefix="SET" suffixOverrides=",">