From f802a6876c8a86ffae9547ed5fea15df15c303f8 Mon Sep 17 00:00:00 2001
From: 邱宇豪 <qyh123230312>
Date: 星期一, 27 十一月 2023 22:31:58 +0800
Subject: [PATCH] 20231127_qiuyh_积分超市
---
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/controller/IntegraDetailController.java | 84 ++++++
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailEntity.java | 48 +++
hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml | 3
hd/pipe/secure/src/main/resources/mapping/RegionInspectionRecordMapper.xml | 4
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/IntegralDetailService.java | 55 +++
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralAccountEntity.java | 34 ++
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/mapper/IntegralDetailMapper.java | 58 ++++
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/impl/IntegralDetailServiceImpl.java | 194 +++++++++++++
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/impl/HiddenDangerServiceImpl.java | 51 +++
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionInspection/mapper/RegionInspectionRecordMapper.java | 1
hd/pipe/secure/src/main/resources/mapping/IntegralDetailMapper.xml | 300 +++++++++++++++++++++
11 files changed, 828 insertions(+), 4 deletions(-)
diff --git a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml b/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml
index 6ed1f03..d932fb5 100644
--- a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml
+++ b/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml
@@ -109,6 +109,9 @@
<if test="userId !=null and userId !=''">
sdu.user_id=#{userId} AND
</if>
+ <if test="userType !=null and userType !=''">
+ spu.user_type=#{userType} AND
+ </if>
</trim>
</where>
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 cc10f59..82cffe1 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
@@ -10,15 +10,17 @@
import com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerEntity;
import com.thhy.secure.modules.biz.hiddenDanger.mapper.HiddenDangerMapper;
import com.thhy.secure.modules.biz.hiddenDanger.service.HiddenDangerService;
+import com.thhy.secure.modules.biz.integralAccount.entity.IntegralAccountEntity;
+import com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity;
+import com.thhy.secure.modules.biz.integralAccount.mapper.IntegralDetailMapper;
+import com.thhy.secure.modules.biz.regionInspection.mapper.RegionInspectionRecordMapper;
+import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* @Author QiuYuHao
@@ -31,6 +33,11 @@
@Autowired
private HiddenDangerMapper hiddenDangerMapper;
+ @Autowired
+ private IntegralDetailMapper integralDetailMapper;
+
+ @Autowired
+ private RegionInspectionRecordMapper regionInspectionRecordMapper;
private static final Object Lock = new Object();
@Override
@Transactional(rollbackFor = Exception.class)
@@ -154,8 +161,44 @@
@Override
public BasicResult examine(HiddenDangerEntity hiddenDangerEntity) {
+ SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
+
+ String platUserId = regionInspectionRecordMapper.selectPlatUserId(hiddenDangerEntity.getCreateUser());
+ Map platUser = regionInspectionRecordMapper.getPlatUser(platUserId);
+ Integer user_type = (int)platUser.get("user_type");
+
+ Map account = new HashMap();
+ account.put("userId",platUserId);
+ //查询账户
+ IntegralAccountEntity queryAccount = integralDetailMapper.selectByOne(account);
+ Double accumulateIntegral = 0.0;
+ Double totalIntegral = 0.0;
+ if (queryAccount != null){
+ accumulateIntegral = queryAccount.getAccumulateIntegral();//累计积分
+ totalIntegral = queryAccount.getTotalIntegral();//当前余额
+ }
hiddenDangerEntity.setAuditStatus(1);//1审核通过
hiddenDangerMapper.update(hiddenDangerEntity);
+ IntegralAccountEntity integralAccountEntity = IntegralAccountEntity
+ .builder()
+ .userId(platUserId)
+ .accumulateIntegral(accumulateIntegral+hiddenDangerEntity.getIntegral())
+ .totalIntegral(totalIntegral+hiddenDangerEntity.getIntegral())
+ .build();
+
+ IntegralDetailEntity integralDetailEntity = IntegralDetailEntity
+ .builder()
+ .id(UUIDUtils.create())
+ .balanc(totalIntegral+hiddenDangerEntity.getIntegral())
+ .integralSource("隐患审核")
+ .integralWater(hiddenDangerEntity.getIntegral())
+ .createTime(new Date())
+ .createUser(sysUserInfo.getUserId())
+ .userType(user_type)
+ .build();
+
+ integralDetailMapper.insertAndUpdateAccount(integralAccountEntity);
+ integralDetailMapper.insertDetailAndUpdate(integralDetailEntity);
return BasicResult.success();
}
}
diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/controller/IntegraDetailController.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/controller/IntegraDetailController.java
new file mode 100644
index 0000000..67242a1
--- /dev/null
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/controller/IntegraDetailController.java
@@ -0,0 +1,84 @@
+package com.thhy.secure.modules.biz.integralAccount.controller;
+
+import com.thhy.general.common.BasicResult;
+import com.thhy.general.config.SysUserInfo;
+import com.thhy.general.utils.ExcelUtils;
+import com.thhy.general.utils.UserInfoUtils;
+import com.thhy.secure.modules.biz.integralAccount.entity.IntegralAccountEntity;
+import com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity;
+import com.thhy.secure.modules.biz.integralAccount.service.IntegralDetailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author QiuYuHao
+ * @CreateDate 2023-11-27 17:34:01
+ * 积分流水控制层
+ */
+@RestController
+@RequestMapping("integralAccount")
+public class IntegraDetailController {
+
+ @Autowired
+ private IntegralDetailService integralDetailService;
+ /**
+ * 积分超市新增和修改
+ * @param integralDetailEntity
+ */
+ @PostMapping("insertAndUpdate")
+ BasicResult insertAndUpdate(@RequestBody IntegralDetailEntity integralDetailEntity){
+ return integralDetailService.insertAndUpdate(integralDetailEntity);
+ }
+
+ /**
+ * 积分超市
+ * @param map
+ * @return
+ */
+ @PostMapping("selectPageList")
+ BasicResult selectPageList(@RequestBody Map map){
+ return integralDetailService.selectPageList(map);
+ }
+
+ /**
+ * 积分超市删除
+ * @param id
+ */
+ @GetMapping("delete")
+ BasicResult delete(@RequestParam String id){
+ return integralDetailService.delete(id);
+ }
+
+
+ /**
+ * 安全积分列表
+ */
+ @PostMapping("selectSafeIntegralPageList")
+ BasicResult selectSafeIntegralPageList(@RequestBody Map map){
+ return integralDetailService.selectSafeIntegralPageList(map);
+ }
+
+ /**
+ * 安全积分明细
+ * @param map
+ * @return
+ */
+ @PostMapping("selectSafeIntegralInfo")
+ BasicResult selectSafeIntegralInfo(@RequestBody Map map){
+ return integralDetailService.selectSafeIntegralInfo(map);
+ }
+
+ @PostMapping("exportList")
+ public void exportList(@RequestBody Map map, HttpServletResponse rsp) {
+ this.integralDetailService.exportList(map,rsp);
+ }
+
+ @PostMapping("exportSafeIntegralInfo")
+ public void exportSafeIntegralInfo(@RequestBody Map map, HttpServletResponse rsp) {
+ this.integralDetailService.exportSafeIntegralInfo(map,rsp);
+ }
+}
diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralAccountEntity.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralAccountEntity.java
new file mode 100644
index 0000000..cca96e8
--- /dev/null
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralAccountEntity.java
@@ -0,0 +1,34 @@
+package com.thhy.secure.modules.biz.integralAccount.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author QiuYuHao
+ * @CreateDate 2023-11-27 17:34:53
+ * 积分账户实体
+ */
+@Builder
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class IntegralAccountEntity {
+
+ private String id;
+ private String userId;
+ private Double totalIntegral;//当前余额
+ private Double accumulateIntegral;//累计积分
+ private Double totalConsumption;//总消耗
+ private Date createTime;
+ private String createUser;
+ private Date updateTime;
+ private String updateUser;
+ private Integer userType;
+ private String realName;
+ private List<IntegralDetailEntity> integralDetailList;
+}
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
new file mode 100644
index 0000000..961909e
--- /dev/null
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/entity/IntegralDetailEntity.java
@@ -0,0 +1,48 @@
+package com.thhy.secure.modules.biz.integralAccount.entity;
+
+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-27 17:38:37
+ * 积分流水实体
+ */
+@Builder
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class IntegralDetailEntity {
+
+ private String id;
+ private Integer type;//1、获取 2、消耗
+ @Excel(sort = 4,title = "类型")
+ private String typeName;//1、获取 2、消耗
+
+ private String integralSource;//积分怎么来的
+ private String createUser;
+ 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 = 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
new file mode 100644
index 0000000..5e669aa
--- /dev/null
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/mapper/IntegralDetailMapper.java
@@ -0,0 +1,58 @@
+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.IntegralDetailEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author QiuYuHao 积分明细
+ * @CreateDate 2023-11-27 17:42:43
+ */
+@Mapper
+public interface IntegralDetailMapper {
+
+ /**
+ * 积分超市新增和修改
+ * @param integralDetailEntity
+ */
+ void insertDetailAndUpdate(IntegralDetailEntity integralDetailEntity);
+ /**
+ * 积分账户
+ */
+ void insertAndUpdateAccount(IntegralAccountEntity integralAccountEntity);
+
+ /**
+ * 积分超市
+ * @param map
+ * @return
+ */
+ List<IntegralDetailEntity> selectPageList(Map map);
+
+ /**
+ * 积分超市删除
+ * @param id
+ */
+ void delete(String id);
+
+
+ /**
+ * 安全积分列表
+ */
+ List<IntegralAccountEntity> selectSafeIntegralPageList(Map map);
+
+ /**
+ * 查询账户积分
+ * @param id
+ * @return
+ */
+ IntegralAccountEntity selectByOne(Map m);
+ /**
+ * 安全积分明细
+ * @param map
+ * @return
+ */
+ List<IntegralDetailEntity> selectSafeIntegralInfo(Map map);
+}
diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/IntegralDetailService.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/IntegralDetailService.java
new file mode 100644
index 0000000..6715819
--- /dev/null
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/IntegralDetailService.java
@@ -0,0 +1,55 @@
+package com.thhy.secure.modules.biz.integralAccount.service;
+
+import com.thhy.general.common.BasicResult;
+import com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * @Author QiuYuHao
+ * @CreateDate 2023-11-27 18:32:15
+ * 积分超市
+ */
+
+public interface IntegralDetailService {
+
+
+ /**
+ * 积分超市新增和修改
+ * @param integralDetailEntity
+ */
+ BasicResult insertAndUpdate(IntegralDetailEntity integralDetailEntity);
+
+ /**
+ * 积分超市
+ * @param map
+ * @return
+ */
+ BasicResult selectPageList(Map map);
+ /**
+ * 积分超市
+ * @param map
+ * @param rsp
+ */
+ void exportList(Map map, HttpServletResponse rsp);
+ /**
+ * 积分超市删除
+ * @param id
+ */
+ BasicResult delete(String id);
+
+
+ /**
+ * 安全积分列表
+ */
+ BasicResult selectSafeIntegralPageList(Map map);
+
+ /**
+ * 安全积分明细
+ * @param map
+ * @return
+ */
+ BasicResult selectSafeIntegralInfo(Map map);
+ void exportSafeIntegralInfo(Map map, HttpServletResponse rsp);
+}
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
new file mode 100644
index 0000000..b4df2b5
--- /dev/null
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/integralAccount/service/impl/IntegralDetailServiceImpl.java
@@ -0,0 +1,194 @@
+package com.thhy.secure.modules.biz.integralAccount.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.thhy.general.common.BasicResult;
+import com.thhy.general.config.SysUserInfo;
+import com.thhy.general.utils.ExcelUtils;
+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.IntegralDetailEntity;
+import com.thhy.secure.modules.biz.integralAccount.mapper.IntegralDetailMapper;
+import com.thhy.secure.modules.biz.integralAccount.service.IntegralDetailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author QiuYuHao
+ * @CreateDate 2023-11-27 18:33:40
+ * 积分超市实现
+ */
+@Service
+public class IntegralDetailServiceImpl implements IntegralDetailService
+{
+
+ @Autowired
+ private IntegralDetailMapper integralDetailMapper;
+
+ /**
+ * 积分超市新增和修改
+ * @param integralDetailEntity
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public BasicResult insertAndUpdate(IntegralDetailEntity integralDetailEntity){
+ String id = integralDetailEntity.getId();
+ SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
+ String sysUserId = sysUserInfo.getUserId();
+ String companyId = sysUserInfo.getCompanyId();
+ //扣积分逻辑
+ IntegralAccountEntity integralAccountEntity = IntegralAccountEntity
+ .builder()
+ .userId(integralDetailEntity.getUserId())
+ .updateUser(sysUserId)
+ .updateTime(new Date())
+ .id(UUIDUtils.create())
+ .build();
+ Map map = new HashMap();
+ map.put("userId",integralDetailEntity.getUserId());
+ //查询账户
+ IntegralAccountEntity queryAccount = integralDetailMapper.selectByOne(map);
+ if(queryAccount == null || queryAccount.getTotalIntegral()<integralDetailEntity.getIntegralWater()){//无账户
+ return BasicResult.faild("500","积分不足,无法扣除积分",null);
+ }
+ //有账户
+ Double totalConsumption = queryAccount.getTotalConsumption();//总消耗
+ Double accumulateIntegral = queryAccount.getAccumulateIntegral();//累计积分
+ Double totalIntegral = queryAccount.getTotalIntegral();//当前余额
+
+ integralAccountEntity.setTotalIntegral(totalIntegral-integralDetailEntity.getIntegralWater());
+ integralAccountEntity.setAccumulateIntegral(accumulateIntegral);
+ integralAccountEntity.setTotalConsumption(totalConsumption+integralDetailEntity.getIntegralWater());
+ //修改账户
+ integralDetailMapper.insertAndUpdateAccount(integralAccountEntity);
+ if(id == null){
+ integralDetailEntity.setCompanyId(companyId);
+ integralDetailEntity.setId(UUIDUtils.create());
+ integralDetailEntity.setCreateTime(new Date());
+ integralDetailEntity.setCreateUser(sysUserId);
+ }
+ integralDetailEntity.setBalanc(totalIntegral-integralDetailEntity.getIntegralWater());//拿到当前余额
+
+ integralDetailEntity.setType(2);
+ integralDetailEntity.setIntegralSource("积分超市");
+ //添加或修改明细
+ integralDetailMapper.insertDetailAndUpdate(integralDetailEntity);
+ return BasicResult.success();
+ }
+
+ /**
+ * 积分超市
+ * @param map
+ * @return
+ */
+ @Override
+ public BasicResult selectPageList(Map map){
+ SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
+ String companyId = sysUserInfo.getCompanyId();
+ int pageNum = (int) map.get("pageNum");
+ int pageSize = (int) map.get("pageSize");
+ PageHelper.startPage(pageNum,pageSize);
+ map.put("companyId",companyId);
+ List<IntegralDetailEntity> integralDetailEntities = integralDetailMapper.selectPageList(map);
+ return BasicResult.success(new PageInfo<>(integralDetailEntities));
+ }
+
+
+ /**
+ * 积分超市删除
+ * @param id
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public BasicResult delete(String id){
+ Map map =new HashMap();
+ map.put("id",id);
+ IntegralDetailEntity integralDetailEntity = integralDetailMapper.selectSafeIntegralInfo(map).get(0);
+ Double integralWater = integralDetailEntity.getIntegralWater();//获取消耗积分
+ Map account = new HashMap();
+ account.put("userId",integralDetailEntity.getUserId());
+ //查询账户
+ IntegralAccountEntity queryAccount = integralDetailMapper.selectByOne(account);
+
+ Double totalConsumption = queryAccount.getTotalConsumption();//总消耗
+ Double accumulateIntegral = queryAccount.getAccumulateIntegral();//累计积分
+ Double totalIntegral = queryAccount.getTotalIntegral();//当前余额
+
+ IntegralAccountEntity integralAccountEntity = IntegralAccountEntity
+ .builder()
+ .userId(integralDetailEntity.getUserId())
+ .totalConsumption(totalConsumption - integralWater)
+ .accumulateIntegral(accumulateIntegral + integralWater)
+ .totalIntegral(totalIntegral + integralWater)
+ .build();
+ integralDetailMapper.insertAndUpdateAccount(integralAccountEntity);
+ integralDetailMapper.delete(id);
+ return BasicResult.success();
+ }
+
+
+ /**
+ * 安全积分列表
+ */
+ @Override
+ public BasicResult selectSafeIntegralPageList(Map map){
+ SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
+ String companyId = sysUserInfo.getCompanyId();
+ int pageNum = (int) map.get("pageNum");
+ int pageSize = (int) map.get("pageSize");
+ PageHelper.startPage(pageNum,pageSize);
+ map.put("companyId",companyId);
+ List<IntegralAccountEntity> integralAccountEntities = integralDetailMapper.selectSafeIntegralPageList(map);
+ return BasicResult.success(new PageInfo<>(integralAccountEntities));
+ }
+
+ /**
+ * 安全积分明细
+ * @param map
+ * @return
+ */
+ @Override
+ public BasicResult selectSafeIntegralInfo(Map map){
+ SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
+ String companyId = sysUserInfo.getCompanyId();
+ IntegralAccountEntity integralAccountEntity = integralDetailMapper.selectByOne(map);
+ map.put("integral",integralAccountEntity.getTotalIntegral());
+ int pageNum = (int) map.get("pageNum");
+ int pageSize = (int) map.get("pageSize");
+ PageHelper.startPage(pageNum,pageSize);
+ map.put("companyId",companyId);
+ List<IntegralDetailEntity> integralDetailEntities = integralDetailMapper.selectSafeIntegralInfo(map);
+ map.put("data",new PageInfo<>(integralDetailEntities));
+ return BasicResult.success(map);
+ }
+
+ @Override
+ public void exportList(Map map, HttpServletResponse rsp) {
+ SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
+ String companyId = sysUserInfo.getCompanyId();
+ map.put("companyId",companyId);
+ List<IntegralDetailEntity> integralDetailEntities = integralDetailMapper.selectPageList(map);
+
+ ExcelUtils.downExcel(integralDetailEntities,IntegralDetailEntity.class,rsp,"班组列表");
+ }
+
+ @Override
+ 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,"班组列表");
+ }
+
+}
diff --git a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionInspection/mapper/RegionInspectionRecordMapper.java b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionInspection/mapper/RegionInspectionRecordMapper.java
index 9fe5b0c..8ee41b7 100644
--- a/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionInspection/mapper/RegionInspectionRecordMapper.java
+++ b/hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionInspection/mapper/RegionInspectionRecordMapper.java
@@ -45,4 +45,5 @@
List<Map> selectAppList(Map map);
String selectPlatUserId(String userId);
+ Map getPlatUser(String platUserId);
}
diff --git a/hd/pipe/secure/src/main/resources/mapping/IntegralDetailMapper.xml b/hd/pipe/secure/src/main/resources/mapping/IntegralDetailMapper.xml
new file mode 100644
index 0000000..268dc7f
--- /dev/null
+++ b/hd/pipe/secure/src/main/resources/mapping/IntegralDetailMapper.xml
@@ -0,0 +1,300 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.thhy.secure.modules.biz.integralAccount.mapper.IntegralDetailMapper">
+
+ <insert id="insertDetailAndUpdate">
+ insert into t_integral_detail
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="type != null">
+ type,
+ </if>
+ <if test="integralSource != null">
+ integralSource,
+ </if>
+ <if test="integralWater != null">
+ integralWater,
+ </if>
+ <if test="balanc != null">
+ balanc,
+ </if>
+ <if test="createTime != null">
+ createTime,
+ </if>
+ <if test="createUser != null">
+ createUser,
+ </if>
+ <if test="companyId != null">
+ companyId,
+ </if>
+ <if test="userId != null">
+ userId,
+ </if>
+ <if test="userType != null">
+ userType,
+ </if>
+ <if test="remark != null">
+ remark,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=VARCHAR},
+ </if>
+ <if test="type != null">
+ #{type,jdbcType=INTEGER},
+ </if>
+ <if test="integralSource != null">
+ #{integralSource,jdbcType=VARCHAR},
+ </if>
+ <if test="integralWater != null">
+ #{integralWater,jdbcType=DOUBLE},
+ </if>
+ <if test="balanc != null">
+ #{balanc,jdbcType=DOUBLE},
+ </if>
+ <if test="createTime != null">
+ #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="createUser != null">
+ #{createUser,jdbcType=VARCHAR},
+ </if>
+ <if test="companyId != null">
+ #{companyId,jdbcType=VARCHAR},
+ </if>
+ <if test="userId != null">
+ #{userId,jdbcType=VARCHAR},
+ </if>
+ <if test="userType != null">
+ #{userType,jdbcType=VARCHAR},
+ </if>
+ <if test="remark != null">
+ #{remark,jdbcType=VARCHAR},
+ </if>
+
+ </trim>
+ on duplicate key update
+ <trim suffixOverrides=",">
+ <if test="type != null">
+ type = #{type,jdbcType=INTEGER},
+ </if>
+ <if test="integralSource != null">
+ integralSource = #{integralSource,jdbcType=VARCHAR},
+ </if>
+ <if test="integralWater != null">
+ integralWater = #{integralWater,jdbcType=DOUBLE},
+ </if>
+ <if test="balanc != null">
+ balanc = #{balanc,jdbcType=DOUBLE},
+ </if>
+ <if test="createTime != null">
+ createTime = #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="createUser != null">
+ createUser = #{createUser,jdbcType=VARCHAR},
+ </if>
+ <if test="companyId != null">
+ companyId = #{companyId,jdbcType=VARCHAR},
+ </if>
+ <if test="userId != null">
+ userId = #{userId,jdbcType=VARCHAR},
+ </if>
+ <if test="userType != null">
+ userType = #{userType,jdbcType=VARCHAR},
+ </if>
+ <if test="remark != null">
+ remark = #{remark,jdbcType=VARCHAR},
+ </if>
+ </trim>
+
+ </insert>
+
+ <insert id="insertAndUpdateAccount">
+ insert into t_integral_account
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="userId != null">
+ userId,
+ </if>
+ <if test="totalIntegral != null">
+ totalIntegral,
+ </if>
+ <if test="accumulateIntegral != null">
+ accumulateIntegral,
+ </if>
+ <if test="totalConsumption != null">
+ totalConsumption,
+ </if>
+ <if test="createTime != null">
+ createTime,
+ </if>
+ <if test="createUser != null">
+ createUser,
+ </if>
+ <if test="updateTime != null">
+ updateTime,
+ </if>
+ <if test="updateUser != null">
+ updateUser,
+ </if>
+ <if test="userType != null">
+ userType,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
+ <if test="id != null">
+ #{id,jdbcType=VARCHAR},
+ </if>
+ <if test="userId != null">
+ #{userId,jdbcType=VARCHAR},
+ </if>
+ <if test="totalIntegral != null">
+ #{totalIntegral,jdbcType=DOUBLE},
+ </if>
+ <if test="accumulateIntegral != null">
+ #{accumulateIntegral,jdbcType=DOUBLE},
+ </if>
+ <if test="totalConsumption != null">
+ #{totalConsumption,jdbcType=DOUBLE},
+ </if>
+ <if test="createTime != null">
+ #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="createUser != null">
+ #{createUser,jdbcType=VARCHAR},
+ </if>
+ <if test="updateTime != null">
+ #{updateTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="updateUser != null">
+ #{updateUser,jdbcType=VARCHAR},
+ </if>
+ <if test="userType != null">
+ #{userType,jdbcType=INTEGER},
+ </if>
+
+ </trim>
+ on duplicate key update
+ <trim suffixOverrides=",">
+ <if test="totalIntegral != null">
+ totalIntegral = #{totalIntegral,jdbcType=DOUBLE},
+ </if>
+ <if test="accumulateIntegral != null">
+ accumulateIntegral = #{accumulateIntegral,jdbcType=DOUBLE},
+ </if>
+ <if test="totalConsumption != null">
+ totalConsumption = #{totalConsumption,jdbcType=DOUBLE},
+ </if>
+ <if test="createTime != null">
+ createTime=#{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="createUser != null">
+ createUser = #{createUser,jdbcType=VARCHAR},
+ </if>
+ <if test="updateTime != null">
+ updateTime = #{updateTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="updateUser != null">
+ updateUser = #{updateUser,jdbcType=VARCHAR},
+ </if>
+ <if test="userType != null">
+ userType = #{userType,jdbcType=INTEGER},
+ </if>
+ </trim>
+ </insert>
+ <delete id="delete">
+ update t_integral_detail set isUse = 0 where id = #{id,jdbcType=VARCHAR}
+ </delete>
+
+ <!-- 积分超市 -->
+ <select id="selectPageList" resultType="com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity">
+ SELECT
+ t.id,
+ t.createTime,
+ spu.real_name realName,
+ t.integralWater,
+ t.remark
+ 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>
+ <if test="startTime != null and startTime != '' and endTime !=null and endTime !=''">
+ AND t.createTime BETWEEN #{startTime} and #{endTime}
+ </if>
+ order by t.createTime desc
+ </select>
+
+ <select id="selectSafeIntegralPageList" resultType="com.thhy.secure.modules.biz.integralAccount.entity.IntegralAccountEntity">
+ SELECT
+ t.id,
+ spu.real_name realName,
+ t.accumulateIntegral,
+ t.totalIntegral,
+ t.totalConsumption,
+ t.userType,
+ t.createTime,
+ t.userId
+ FROM t_integral_account t
+ LEFT JOIN sys_plat_user spu on spu.user_id = t.userId
+ WHERE 1=1
+ <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>
+ <if test="startIntegral != null and startIntegral != '' and endIntegral !=null and endIntegral !=''">
+ AND t.accumulateIntegral BETWEEN #{startIntegral} and #{endIntegral}
+ </if>
+ order by t.accumulateIntegral desc
+ </select>
+
+ <select id="selectSafeIntegralInfo" resultType="com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity">
+ SELECT
+ t.*
+ FROM t_integral_detail t
+ WHERE t.isUse = 1
+ <if test="companyId != null and companyId !=''">
+ and t.companyId = #{companyId}
+ </if>
+ <if test="userId != null and userId !=''">
+ and t.userId = #{userId}
+ </if>
+ <if test="id != null and id !=''">
+ and t.id = #{id}
+ </if>
+ <if test="type != null and type !=''">
+ AND t.type = #{type}
+ </if>
+ <if test="startTime != null and startTime != '' and endTime !=null and endTime !=''">
+ AND t.createTime BETWEEN #{startTime} and #{endTime}
+ </if>
+ </select>
+ <select id="selectByOne" resultType="com.thhy.secure.modules.biz.integralAccount.entity.IntegralAccountEntity">
+ SELECT
+ t.id,
+ t.userId,
+ spu.real_name realName,
+ t.accumulateIntegral,
+ t.totalIntegral,
+ t.totalConsumption,
+ t.userType
+ FROM t_integral_account t
+ LEFT JOIN sys_plat_user spu on spu.user_id = t.userId
+ WHERE 1=1
+ <if test="id != null and id != ''">
+ AND t.id = #{id,jdbcType=VARCHAR}
+ </if>
+ <if test="userId != null and userId != ''">
+ AND t.userId = #{userId}
+ </if>
+
+ </select>
+
+</mapper>
\ No newline at end of file
diff --git a/hd/pipe/secure/src/main/resources/mapping/RegionInspectionRecordMapper.xml b/hd/pipe/secure/src/main/resources/mapping/RegionInspectionRecordMapper.xml
index 3066bd9..a8df8b4 100644
--- a/hd/pipe/secure/src/main/resources/mapping/RegionInspectionRecordMapper.xml
+++ b/hd/pipe/secure/src/main/resources/mapping/RegionInspectionRecordMapper.xml
@@ -317,4 +317,8 @@
FROM sys_users
WHERE user_id= #{userId,jdbcType=VARCHAR}
</select>
+ <select id="getPlatUser" resultType="java.util.Map">
+ SELECT * FROM sys_plat_user where user_id = #{userId}
+ </select>
+
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3