From 22cc779aff6d1ff2174e2cd4cfcb64ebe22f698f Mon Sep 17 00:00:00 2001
From: 叶松 <2217086471@qq.com>
Date: 星期二, 28 十一月 2023 13:28:41 +0800
Subject: [PATCH] Merge branch 'master' of http://111.30.93.211:10101/r/supipe

---
 hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailDto.java               |   54 +++++++++++++
 hd/pipe/secure/src/main/resources/mapping/HiddenDangerMapper.xml                                                     |   22 ++++-
 hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailEntity.java            |   18 ++--
 hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/entity/HiddenDangerEntity.java                 |    3 
 hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/mapper/IntegralDetailMapper.java            |    4 
 hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/impl/IntegralDetailServiceImpl.java |   32 +++++++-
 hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/impl/HiddenDangerServiceImpl.java      |   21 ++--
 hd/pipe/secure/src/main/resources/mapping/IntegralDetailMapper.xml                                                   |   47 ++++++++---
 8 files changed, 160 insertions(+), 41 deletions(-)

diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/entity/HiddenDangerEntity.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/entity/HiddenDangerEntity.java
index 6bf9cce..c15a7c2 100644
--- a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/entity/HiddenDangerEntity.java
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/entity/HiddenDangerEntity.java
@@ -117,4 +117,7 @@
 		}
 		return name;
 	}
+
+	private String auditUser;
+	private Date auditTime;
 }
diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/impl/HiddenDangerServiceImpl.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/impl/HiddenDangerServiceImpl.java
index c6fbf3b..5bed478 100644
--- a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/impl/HiddenDangerServiceImpl.java
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/impl/HiddenDangerServiceImpl.java
@@ -65,6 +65,9 @@
 		SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
 		String userId = sysUserInfo.getUserId();
 		hiddenDangerEntity.setUpdateUser(userId);
+		if (hiddenDangerEntity.getDictId() != null){
+			hiddenDangerEntity.setDangerLocation(hiddenDangerEntity.getDictId());
+		}
 		hiddenDangerEntity.setUpdateTime(new Date());
 		synchronized (Lock){
 			hiddenDangerMapper.update(hiddenDangerEntity);
@@ -103,19 +106,13 @@
 		PageHelper.startPage(pageNum,pageSize);
 		List<HiddenDangerEntity> hiddenDangerEntities = new ArrayList<>();
 		if(type == 1){//审核列表
-			if (sysUserInfo.getUserType() == 2){
-				map.put("createUser",sysUserInfo.getUserId());
-			}
 			//小程序 待审核排前面 待审核按时间正序 审核成功的倒叙
 			hiddenDangerEntities = hiddenDangerMapper.selectAppList(map);
 		}else if(type == 2){//隐患举报详情列表
-			if (sysUserInfo.getUserType() == 2){
-				map.put("createUser",sysUserInfo.getUserId());
-			}
+			map.put("createUser",sysUserInfo.getUserId());
 			//小程序 待审核排前面 待审核按时间正序 审核成功的倒叙
 			hiddenDangerEntities = hiddenDangerMapper.selectPageList(map);
-		}
-		else {
+		} else {
 			//web 按时间倒序
 			hiddenDangerEntities = hiddenDangerMapper.selectPageList(map);
 		}
@@ -175,6 +172,8 @@
 		SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
 		String platUserId = regionInspectionRecordMapper.selectPlatUserId(hiddenDangerEntity.getCreateUser());
 
+		Map platUser = regionInspectionRecordMapper.getPlatUser(platUserId);
+		int user_type = (int) platUser.get("user_type");
 		Map account = new HashMap();
 		account.put("userId",platUserId);
 		//查询账户
@@ -187,6 +186,8 @@
 		}
 		hiddenDangerEntity.setAuditStatus(1);//1审核通过
 		hiddenDangerEntity.setDangerLocation(null);
+		hiddenDangerEntity.setAuditTime(new Date());
+		hiddenDangerEntity.setAuditUser(sysUserInfo.getUserId());
 		synchronized (Lock){
 			hiddenDangerMapper.update(hiddenDangerEntity);
 			IntegralAccountEntity integralAccountEntity = IntegralAccountEntity
@@ -195,7 +196,7 @@
 					.id(UUIDUtils.create())
 					.accumulateIntegral(accumulateIntegral+hiddenDangerEntity.getIntegral())
 					.totalIntegral(totalIntegral+hiddenDangerEntity.getIntegral())
-					.userType(sysUserInfo.getUserType())
+					.userType(user_type)
 					.build();
 
 			IntegralDetailEntity integralDetailEntity = IntegralDetailEntity
@@ -206,7 +207,7 @@
 					.integralWater(hiddenDangerEntity.getIntegral())
 					.createTime(new Date())
 					.createUser(sysUserInfo.getUserId())
-					.userType(sysUserInfo.getUserType())
+					.userType(user_type)
 					.userId(platUserId)
 					.type(1)
 					.remark("隐患审核")
diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailDto.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailDto.java
new file mode 100644
index 0000000..616456c
--- /dev/null
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailDto.java
@@ -0,0 +1,54 @@
+package com.thhy.secure.modules.biz.integralAccount.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thhy.general.annotations.Excel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+/**
+ * @Author QiuYuHao
+ * @CreateDate 2023-11-28 11:06:19
+ */
+@Builder
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class IntegralDetailDto {
+
+	private String id;
+	private Integer type;//1、获取 2、消耗
+
+	private String createUser;
+	private String companyId;
+	private String userId;
+	private Integer userType;
+	private Double changeIntegral;//变量在积分超市 修改前的变量
+
+
+	@Excel(sort = 1,title = "时间")
+	private String createDate;
+
+	private Date createTime;
+	@Excel(sort = 2,title = "积分分值")
+	private Double integralWater;//当前可改积分流水
+
+	@Excel(sort = 3,title = "余额")
+	private Double balanc;//当前余额
+
+	@Excel(sort = 4,title = "类型")
+	private String typeName;//1、获取 2、消耗
+	private String integralSource;//积分怎么来的
+	private String userTypeName;
+
+	private String realName;//真实姓名
+
+
+	@Excel(sort = 5,title = "说明")
+	private String remark;//说明
+
+
+}
diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailEntity.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailEntity.java
index 961909e..142f0e1 100644
--- a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailEntity.java
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailEntity.java
@@ -21,7 +21,6 @@
 
 	private String id;
 	private Integer type;//1、获取 2、消耗
-	@Excel(sort = 4,title = "类型")
 	private String typeName;//1、获取 2、消耗
 
 	private String integralSource;//积分怎么来的
@@ -29,20 +28,19 @@
 	private String companyId;
 	private String userId;
 	private Integer userType;
-	@Excel(sort = 3,title = "余额")
 	private Double balanc;//当前余额
-
-	@Excel(sort = 2,title = "积分")
-	private Double integralWater;//当前可改积分流水
-
 	private Double changeIntegral;//变量在积分超市 修改前的变量
+
+
 	@Excel(sort = 1,title = "时间")
 	private Date createTime;
+	@Excel(sort = 2,title = "人员类别")
+	private String userTypeName;
+	@Excel(sort = 3,title = "人员姓名")
+	private String realName;//真实姓名
+	@Excel(sort = 4,title = "积分")
+	private Double integralWater;//当前可改积分流水
 
 	@Excel(sort = 5,title = "说明")
 	private String remark;//说明
-
-	@Excel(sort = 6,title = "人员姓名")
-	private String realName;//真实姓名
-
 }
diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/mapper/IntegralDetailMapper.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/mapper/IntegralDetailMapper.java
index 5e669aa..25c3fb4 100644
--- a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/mapper/IntegralDetailMapper.java
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/mapper/IntegralDetailMapper.java
@@ -1,6 +1,7 @@
 package com.thhy.secure.modules.biz.integralAccount.mapper;
 
 import com.thhy.secure.modules.biz.integralAccount.entity.IntegralAccountEntity;
+import com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailDto;
 import com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -30,6 +31,7 @@
 	 * @return
 	 */
 	List<IntegralDetailEntity> selectPageList(Map map);
+	List<IntegralDetailDto> selectPageInfoList(Map map);
 
 	/**
 	 * 积分超市删除
@@ -54,5 +56,5 @@
 	 * @param map
 	 * @return
 	 */
-	List<IntegralDetailEntity> selectSafeIntegralInfo(Map map);
+	List<IntegralDetailDto> selectSafeIntegralInfo(Map map);
 }
diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/impl/IntegralDetailServiceImpl.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/impl/IntegralDetailServiceImpl.java
index fdb0edc..9e9c823 100644
--- a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/impl/IntegralDetailServiceImpl.java
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/impl/IntegralDetailServiceImpl.java
@@ -8,6 +8,7 @@
 import com.thhy.general.utils.UUIDUtils;
 import com.thhy.general.utils.UserInfoUtils;
 import com.thhy.secure.modules.biz.integralAccount.entity.IntegralAccountEntity;
+import com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailDto;
 import com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity;
 import com.thhy.secure.modules.biz.integralAccount.mapper.IntegralDetailMapper;
 import com.thhy.secure.modules.biz.integralAccount.service.IntegralDetailService;
@@ -114,7 +115,7 @@
 	public BasicResult delete(String id){
 		Map map =new HashMap();
 		map.put("id",id);
-		IntegralDetailEntity integralDetailEntity = integralDetailMapper.selectSafeIntegralInfo(map).get(0);
+		IntegralDetailDto integralDetailEntity = integralDetailMapper.selectSafeIntegralInfo(map).get(0);
 		Double integralWater = integralDetailEntity.getIntegralWater();//获取消耗积分
 		Map account = new HashMap();
 		account.put("userId",integralDetailEntity.getUserId());
@@ -169,7 +170,7 @@
 		int pageSize = (int) map.get("pageSize");
 		PageHelper.startPage(pageNum,pageSize);
 		map.put("companyId",companyId);
-		List<IntegralDetailEntity> integralDetailEntities = integralDetailMapper.selectSafeIntegralInfo(map);
+		List<IntegralDetailDto> integralDetailEntities = integralDetailMapper.selectSafeIntegralInfo(map);
 		map.put("data",new PageInfo<>(integralDetailEntities));
 		return BasicResult.success(map);
 	}
@@ -181,6 +182,14 @@
 		map.put("companyId",companyId);
 		List<IntegralDetailEntity> integralDetailEntities = integralDetailMapper.selectPageList(map);
 
+		integralDetailEntities.forEach(obj->{
+			if(obj.getUserType() ==1){
+				obj.setUserTypeName("管服人员");
+			}
+			if(obj.getUserType() ==2){
+				obj.setUserTypeName("劳务人员");
+			}
+		});
 		ExcelUtils.downExcel(integralDetailEntities,IntegralDetailEntity.class,rsp,"班组列表");
 	}
 
@@ -188,11 +197,26 @@
 	public void exportSafeIntegralInfo(Map map, HttpServletResponse rsp) {
 		SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
 		String companyId = sysUserInfo.getCompanyId();
+
 		IntegralAccountEntity integralAccountEntity = integralDetailMapper.selectByOne(map);
 		map.put("integral",integralAccountEntity.getTotalIntegral());
 		map.put("companyId",companyId);
-		List<IntegralDetailEntity> integralDetailEntities = integralDetailMapper.selectSafeIntegralInfo(map);
-		ExcelUtils.downExcel(integralDetailEntities,IntegralDetailEntity.class,rsp,"班组列表");
+		List<IntegralDetailDto> integralDetailEntities = integralDetailMapper.selectSafeIntegralInfo(map);
+		integralDetailEntities.forEach(obj->{
+			if(obj.getUserType() ==1){
+				obj.setUserTypeName("管服人员");
+			}
+			if(obj.getUserType() ==2){
+				obj.setUserTypeName("劳务人员");
+			}
+			if(obj.getType() == 1){
+				obj.setTypeName("获取");
+			}
+			if(obj.getType() == 2){
+				obj.setTypeName("消耗");
+			}
+		});
+		ExcelUtils.downExcel(integralDetailEntities,IntegralDetailDto.class,rsp,"班组列表");
 	}
 
 }
diff --git a/hd/pipe/secure/src/main/resources/mapping/HiddenDangerMapper.xml b/hd/pipe/secure/src/main/resources/mapping/HiddenDangerMapper.xml
index aec436b..5725ca3 100644
--- a/hd/pipe/secure/src/main/resources/mapping/HiddenDangerMapper.xml
+++ b/hd/pipe/secure/src/main/resources/mapping/HiddenDangerMapper.xml
@@ -89,10 +89,10 @@
     <update id="update">
         update t_hidden_danger
         <set>
-            <if test="dangerLocation != null">
+            <if test="dangerLocation != null and dangerLocation !=''">
                 dangerLocation = #{dangerLocation,jdbcType=VARCHAR},
             </if>
-            <if test="title != null">
+            <if test="title != null and title !=''">
                 title = #{title,jdbcType=VARCHAR},
             </if>
             <if test="createTime != null">
@@ -122,7 +122,12 @@
             <if test="level != null">
                 `level` = #{level,jdbcType=INTEGER},
             </if>
-
+            <if test="auditUser != null">
+                auditUser = #{auditUser,jdbcType=VARCHAR},
+            </if>
+            <if test="auditTime != null">
+                auditTime = #{auditTime,jdbcType=TIMESTAMP},
+            </if>
         </set>
         where id=#{id,jdbcType=VARCHAR}
     </update>
@@ -151,10 +156,13 @@
                 t.integral,
                 su.real_name reporter,
                 t.integral,
-                t.level
+                t.level,
+                su2.real_name auditUser,
+                t.auditTime
         from t_hidden_danger t
          LEFT JOIN sys_users su ON su.user_id = t.createUser
          LEFT JOIN sys_users su1 ON su1.user_id = t.updateUser
+         LEFT JOIN sys_users su2 ON su2.user_id = t.auditUser
          LEFT JOIN sys_dict sd on sd.dict_id = t.dangerLocation
         where t.id=#{id}
     </select>
@@ -175,10 +183,13 @@
                 t.companyId,
                 t.level,
                 t.integral,
+                su2.real_name auditUser,
+                t.auditTime,
                 su.real_name reporter
          from t_hidden_danger t
          LEFT JOIN sys_users su ON su.user_id = t.createUser
          LEFT JOIN sys_users su1 ON su1.user_id = t.updateUser
+            LEFT JOIN sys_users su2 ON su2.user_id = t.auditUser
             LEFT JOIN sys_dict sd on sd.dict_id = t.dangerLocation
         WHERE
             t.isUse = 1
@@ -208,10 +219,13 @@
             t.companyId,
             t.level,
             t.integral,
+            su2.real_name auditUser,
+            t.auditTime,
             su.real_name reporter
         from t_hidden_danger t
         LEFT JOIN sys_users su ON su.user_id = t.createUser
         LEFT JOIN sys_users su1 ON su1.user_id = t.updateUser
+        LEFT JOIN sys_users su2 ON su2.user_id = t.auditUser
         LEFT JOIN sys_dict sd on sd.dict_id = t.dangerLocation
         WHERE
         t.isUse = 1
diff --git a/hd/pipe/secure/src/main/resources/mapping/IntegralDetailMapper.xml b/hd/pipe/secure/src/main/resources/mapping/IntegralDetailMapper.xml
index fb51580..49fd4d7 100644
--- a/hd/pipe/secure/src/main/resources/mapping/IntegralDetailMapper.xml
+++ b/hd/pipe/secure/src/main/resources/mapping/IntegralDetailMapper.xml
@@ -210,22 +210,44 @@
     update t_integral_detail set isUse = 0 where id = #{id,jdbcType=VARCHAR}
   </delete>
 
+
+  <!-- 积分超市 -->
+  <select id="selectPageInfoList" resultType="com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailDto">
+    SELECT
+    t.*,
+    spu.real_name realName,
+    spu.user_type userTypeName
+    FROM t_integral_detail t
+    LEFT JOIN sys_plat_user spu on spu.user_id = t.userId
+    WHERE t.isUse = 1 and t.type = 2  and t.companyId = #{companyId}
+    <if test="userId != null and userId !=''">
+      AND spu.user_id =#{userId}
+    </if>
+    <if test="startTime != null and startTime != '' and endTime !=null and endTime !=''">
+      AND t.createTime BETWEEN #{startTime} and #{endTime}
+    </if>
+    <if test="userType != null and userType != ''">
+      AND t.userType = #{userType}
+    </if>
+    order by  t.createTime desc
+  </select>
   <!-- 积分超市 -->
   <select id="selectPageList" resultType="com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity">
       SELECT
-        t.id,
-        t.createTime,
+        t.*,
         spu.real_name realName,
-        t.integralWater,
-        t.remark
+        spu.user_type userTypeName
       FROM t_integral_detail t
       LEFT JOIN sys_plat_user spu on spu.user_id = t.userId
       WHERE t.isUse = 1 and t.type = 2  and t.companyId = #{companyId}
-      <if test="realName != null and realName !=''">
-        AND spu.real_name  LIKE CONCAT('%',#{realName},'%')
+      <if test="userId != null and userId !=''">
+        AND spu.user_id =#{userId}
       </if>
       <if test="startTime != null and startTime != '' and endTime !=null and endTime !=''">
         AND t.createTime BETWEEN #{startTime} and #{endTime}
+      </if>
+      <if test="userType != null and userType != ''">
+        AND t.userType = #{userType}
       </if>
     order by  t.createTime desc
   </select>
@@ -246,18 +268,19 @@
     <if test="userType != null and userType !=''">
       and t.userType = #{userType}
     </if>
-    <if test="realName != null and realName !=''">
-      AND spu.real_name  LIKE CONCAT('%',#{realName},'%')
+    <if test="userId != null and userId !=''">
+      AND spu.user_id  =#{userId}
     </if>
-    <if test="startIntegral != null and startIntegral != '' and endIntegral !=null and endIntegral !=''">
-      AND t.accumulateIntegral BETWEEN #{startIntegral} and #{endIntegral}
+    <if test="startIntegral != null and startIntegral != '' and endIntegra !=null and endIntegra !=''">
+      AND t.accumulateIntegral BETWEEN #{startIntegral} and #{endIntegra}
     </if>
     order by  t.accumulateIntegral desc
   </select>
 
-  <select id="selectSafeIntegralInfo" resultType="com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity">
+  <select id="selectSafeIntegralInfo" resultType="com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailDto">
     SELECT
-            t.*
+            t.*,
+            DATE_FORMAT(t.createTime, '%Y-%m-%d') createDate
     FROM t_integral_detail t
     WHERE t.isUse = 1
     <if test="companyId != null and companyId !=''">

--
Gitblit v1.9.3