From 145d0064af5ceca7a2f0d244aa8d50a8f594f3d7 Mon Sep 17 00:00:00 2001
From: zf <1603559716@qq.com>
Date: 星期五, 04 八月 2023 09:42:05 +0800
Subject: [PATCH] bug修改

---
 src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java            |    2 
 src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java |    2 
 src/main/java/com/gk/hotwork/Domain/Utils/Constants.java                       |    2 
 src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml                 |    2 
 src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyInspectionItemMapper.xml     |   91 ++++++++++++++++++++++++++++++
 src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java |   11 +++
 src/main/java/com/gk/hotwork/Controller/UserController.java                    |   37 ++++++++----
 src/main/resources/application-dev.yml                                         |    2 
 src/main/resources/application-prod.yml                                        |    2 
 src/main/java/com/gk/hotwork/Domain/SafetySelfInspection.java                  |    4 
 10 files changed, 133 insertions(+), 22 deletions(-)

diff --git a/src/main/java/com/gk/hotwork/Controller/UserController.java b/src/main/java/com/gk/hotwork/Controller/UserController.java
index b65bdd6..deda520 100644
--- a/src/main/java/com/gk/hotwork/Controller/UserController.java
+++ b/src/main/java/com/gk/hotwork/Controller/UserController.java
@@ -201,9 +201,12 @@
             @ApiImplicitParam(name = "company",value = "单位名称"),
             @ApiImplicitParam(name = "realname",value = "姓名"),
             @ApiImplicitParam(name = "idcard",value = "身份证号"),
+            @ApiImplicitParam(name = "province",value = "省"),
+            @ApiImplicitParam(name = "city",value = "市"),
+            @ApiImplicitParam(name = "county",value = "县"),
     })
     public Msg getSuperviseUserInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
-                                  String username,String company,String realname, String idcard){
+                                  String username,String company,String realname, String idcard, String province,String city,String county){
         Msg msg = new Msg();
         msg.setCode("200");
         msg.setMessage("success");
@@ -226,16 +229,29 @@
         if (StringUtils.isNotBlank(idcard)){
             condition.put("idcard",idcard.trim());
         }
+        if (StringUtils.isNotBlank(province)){
+            condition.put("province",province.trim());
 
-        if(StringUtils.isNotBlank(userInfoCurrent.getProvince())){
-            condition.put("province", userInfoCurrent.getProvince());
+            if(StringUtils.isNotBlank(city)){
+                condition.put("city", city);
+            }
+            if(StringUtils.isNotBlank(county)){
+                condition.put("county", county);
+            }
+
+        }else {
+            if(StringUtils.isNotBlank(userInfoCurrent.getProvince())){
+                condition.put("province", userInfoCurrent.getProvince());
+            }
+            if(StringUtils.isNotBlank(userInfoCurrent.getCity())){
+                condition.put("city", userInfoCurrent.getCity());
+            }
+            if(StringUtils.isNotBlank(userInfoCurrent.getCounty())){
+                condition.put("county", userInfoCurrent.getCounty());
+            }
         }
-        if(StringUtils.isNotBlank(userInfoCurrent.getCity())){
-            condition.put("city", userInfoCurrent.getCity());
-        }
-        if(StringUtils.isNotBlank(userInfoCurrent.getCounty())){
-            condition.put("county", userInfoCurrent.getCounty());
-        }
+
+
 
         pageInfo.setCondition(condition);
         userService.selectSuperviseUserDataGrid(pageInfo);
@@ -2685,9 +2701,6 @@
 
     /**
      * 获取监管辖区内的企业
-     */
-    /**
-     * 获取专家用户列表
      */
     @GetMapping("/company/list")
     @ApiOperation(value = "获取监管辖区企业数据",response = Msg.class)
diff --git a/src/main/java/com/gk/hotwork/Domain/SafetySelfInspection.java b/src/main/java/com/gk/hotwork/Domain/SafetySelfInspection.java
index 3a5ef88..1dc0ed2 100644
--- a/src/main/java/com/gk/hotwork/Domain/SafetySelfInspection.java
+++ b/src/main/java/com/gk/hotwork/Domain/SafetySelfInspection.java
@@ -60,8 +60,7 @@
     private Date inspectionStartTime;
 
     /** 检查结束时间   **/
-    @TableField(exist = false)
-    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     private Date inspectionEndTime;
 
     /** 检查项集合   **/
@@ -102,6 +101,7 @@
 
     //检查标识 2自查,1监管检查
     private Byte flag;
+
     /**
      * 隐患总数
      */
diff --git a/src/main/java/com/gk/hotwork/Domain/Utils/Constants.java b/src/main/java/com/gk/hotwork/Domain/Utils/Constants.java
index 63b0d70..f7cbbb0 100644
--- a/src/main/java/com/gk/hotwork/Domain/Utils/Constants.java
+++ b/src/main/java/com/gk/hotwork/Domain/Utils/Constants.java
@@ -30,7 +30,7 @@
     /**
      * 非过滤URL **,
      */
-    public static final String FILTER_EXCLUDE_PATH = "/,/v2/api-docs,/swagger-resources/**,/swagger-ui.html,/webjars/**,/auth/**,/api/**,/error,/upload/**,/dbback/**,/push/**,/register/add,/companyList,/departmentList,/districtByName,/district,/pwd-change";
+    public static final String FILTER_EXCLUDE_PATH = "/,/v2/api-docs,/swagger-resources/**,/swagger-ui.html,/webjars/**,/auth/**,/api/**,/error,/upload/**,/dbback/**,/push/**,/register/add,/companyList,/departmentList,/districtByName,/district,/pwd-change,/uploadfile/**";
 
     /**
      * 登录授权类型
diff --git a/src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java b/src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java
index 15f1c69..c5bbb8a 100644
--- a/src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java
+++ b/src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java
@@ -19,7 +19,7 @@
 
     SafetyInspectionItem getById(@Param("id")Long id);
 
-    void updateSafetyInspectionItem(@Param("param") SafetyInspectionItem param);
+    void updateSafetyInspectionItem(@Param("item") SafetyInspectionItem item);
 
     IPage<SafetyInspectionItem> selectCPages(Page<SafetyInspectionItem> page,@Param("params") Map<String, Object> params);
 }
diff --git a/src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyInspectionItemMapper.xml b/src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyInspectionItemMapper.xml
index 34481ae..d5b351d 100644
--- a/src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyInspectionItemMapper.xml
+++ b/src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyInspectionItemMapper.xml
@@ -12,6 +12,7 @@
 
     <result column="element_a" property="elementA" jdbcType="BIGINT" />
     <result column="element_b" property="elementB" jdbcType="BIGINT" />
+    <result column="element_c" property="elementC" jdbcType="BIGINT" />
     <result column="standardization_requirements" property="standardizationRequirements" jdbcType="VARCHAR" />
     <result column="enterprise_standard" property="enterpriseStandard" jdbcType="VARCHAR" />
     <result column="review_method" property="reviewMethod" jdbcType="VARCHAR" />
@@ -67,4 +68,94 @@
     where a.valid_flag = 1 and a.id= #{id}
   </select>
 
+    <update id="updateBatch">
+        <foreach collection="itemList" item="item" index="index" open="" close="" separator=";">
+            update safety_inspection_item
+            set
+            <trim prefix="" suffix="" suffixOverrides=",">
+                <if test="item.validFlag != null">
+                    valid_flag = #{item.validFlag},
+                </if>
+                <if test="item.createTime != null and item.createTime != '' ">
+                    create_time = #{item.createTime},
+                </if>
+                <if test="item.createBy != null and item.createBy != '' ">
+                    create_by = #{item.createBy},
+                </if>
+                <if test="item.updateTime != null and item.updateTime != '' ">
+                    update_time = #{item.updateTime},
+                </if>
+                <if test="item.updateBy != null and item.updateBy != '' ">
+                    update_by = #{item.updateBy},
+                </if>
+                <if test="item.elementA != null">
+                    element_a = #{item.elementA},
+                </if>
+                <if test="item.elementB != null">
+                    element_b = #{item.elementB},
+                </if>
+                <if test="item.elementC != null">
+                    element_c = #{item.elementC},
+                </if>
+                <if test="item.standardizationRequirements != null and item.standardizationRequirements != '' ">
+                    standardization_requirements = #{item.standardizationRequirements},
+                </if>
+                <if test="item.enterpriseStandard != null and item.enterpriseStandard != '' ">
+                    enterprise_standard = #{item.enterpriseStandard},
+                </if>
+                <if test="item.reviewMethod != null and item.reviewMethod != '' ">
+                    review_method = #{item.reviewMethod},
+                </if>
+                <if test="item.veto != null and item.veto != '' ">
+                    veto = #{item.veto},
+                </if>
+            </trim>
+            where id=#{item.id}
+        </foreach>
+
+    </update>
+    <update id="updateSafetyInspectionItem">
+        update safety_inspection_item
+        <trim prefix="set" suffix="" suffixOverrides=",">
+            <if test="item.validFlag != null">
+                valid_flag = #{item.validFlag},
+            </if>
+            <if test="item.createTime != null">
+                create_time = #{item.createTime},
+            </if>
+            <if test="item.createBy != null and item.createBy != '' ">
+                create_by = #{item.createBy},
+            </if>
+            <if test="item.updateTime != null">
+                update_time = #{item.updateTime},
+            </if>
+            <if test="item.updateBy != null and item.updateBy != '' ">
+                update_by = #{item.updateBy},
+            </if>
+            <if test="item.elementA != null">
+                element_a = #{item.elementA},
+            </if>
+            <if test="item.elementB != null">
+                element_b = #{item.elementB},
+            </if>
+            <if test="item.elementC != null">
+                element_c = #{item.elementC},
+            </if>
+            <if test="item.standardizationRequirements != null and item.standardizationRequirements != '' ">
+                standardization_requirements = #{item.standardizationRequirements},
+            </if>
+            <if test="item.enterpriseStandard != null and item.enterpriseStandard != '' ">
+                enterprise_standard = #{item.enterpriseStandard},
+            </if>
+            <if test="item.reviewMethod != null and item.reviewMethod != '' ">
+                review_method = #{item.reviewMethod},
+            </if>
+            <if test="item.veto != null and item.veto != '' ">
+                veto = #{item.veto},
+            </if>
+        </trim>
+        where id=#{item.id}
+
+    </update>
+
 </mapper>
diff --git a/src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml b/src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml
index 2ff81a2..a7f2e16 100644
--- a/src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml
+++ b/src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml
@@ -263,7 +263,7 @@
         and user.realname like concat ('%',#{record.realname,jdbcType=VARCHAR},'%')
       </if>
       <if test="record.company != null and record.company !=''">
-        and user.company like concat ('%',#{record.company,jdbcType=VARCHAR},'%')
+        and user.company like concat ('%',#{record.company},'%')
       </if>
       <if test="record.job != null and record.job !=''">
         and user.job like concat ('%',#{record.job,jdbcType=VARCHAR},'%')
diff --git a/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java b/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java
index d1dc7fb..b7bd72b 100644
--- a/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java
+++ b/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java
@@ -289,7 +289,7 @@
         if (param.getElementB() == null) throw new BusinessException("请选择B级要素");
         //如果有三级要素则不创建标准
         List<ElementManagement> elementList = elementManagementService.getElementByParentId(param.getElementB());
-        if(elementList.size() > 0){
+        if(param.getElementC() == null && elementList.size() > 0){
             throw new BusinessException("请先删除三级要素");
         }
         if(StringUtils.isBlank(param.getStandardizationRequirements())) throw new BusinessException("请填写标准化要求");
diff --git a/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java b/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java
index c8548a1..2dc28f5 100644
--- a/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java
+++ b/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java
@@ -421,7 +421,11 @@
         if (CollectionUtils.isNotEmpty(elementTreeList)) {
             for (ElementTree elementA : elementTreeList) {
 
-                List<SafetySelfInspectionItem> selectElementList = itemList.stream().filter(item -> item.getElementA().equals(elementA.getValue())).collect(Collectors.toList());
+                List<SafetySelfInspectionItem> selectElementList = itemList
+                        .stream()
+                        .filter(item -> item.getElementA() != null &&
+                        item.getElementA().equals(elementA.getValue()))
+                        .collect(Collectors.toList());
                 if (CollectionUtils.isNotEmpty(selectElementList)) {
                     SafetySelfInspectionElementRespDTO elementARespDTO = new SafetySelfInspectionElementRespDTO();
                     elementARespDTO.setElementId(elementA.getValue());
@@ -449,7 +453,9 @@
                                 //无三级要素过滤出二级要素检查内容
                                 List<SafetySelfInspectionItem> sItemList = itemList
                                         .stream()
-                                        .filter(item -> item.getElementC() == null && item.getElementB().equals(stree.getValue()))
+                                        .filter(item -> item.getElementC() == null
+                                                && item.getElementB() != null
+                                                && item.getElementB().equals(stree.getValue()))
                                         .collect(Collectors.toList());
                                 //填充检查项
                                 elementBRespDTO.setItemList(assemblyDeduction(sItemList));
@@ -724,6 +730,7 @@
         safetySelfInspection.setStatus(2);
         safetySelfInspection.setUpdateTime(date);
         safetySelfInspection.setUpdateBy(username);
+        safetySelfInspection.setInspectionEndTime(new Date());
         safetySelfInspectionMapper.updateById(safetySelfInspection);
     }
 
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 0d5847e..1a63ccd 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -129,4 +129,4 @@
 
 # swagger生产环境中禁止显示
 swagger:
-  show: false
\ No newline at end of file
+  show: true
\ No newline at end of file
diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml
index d0377e0..7848908 100644
--- a/src/main/resources/application-prod.yml
+++ b/src/main/resources/application-prod.yml
@@ -2,7 +2,7 @@
 server:
   tomcat:
     uri-encoding: UTF-8
-    basedir: /
+    basedir: /home/ecs-shanghai/temp
   port: 8006
   servlet:
     context-path: /

--
Gitblit v1.9.2