Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

LIVE_YE 2 жил өмнө
parent
commit
1bce91c7b6

+ 141 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/info/KeyPeopleInfoController.java

@@ -0,0 +1,141 @@
+package com.ruoyi.web.controller.info;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.UserInfo;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.KeyPeopleInfo;
+import com.ruoyi.system.service.IKeyPeopleInfoService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 重点人群信息Controller
+ * 
+ * @author boman
+ * @date 2022-09-27
+ */
+@RestController
+@RequestMapping("/keyPeople/info")
+public class KeyPeopleInfoController extends BaseController
+{
+    @Autowired
+    private IKeyPeopleInfoService keyPeopleInfoService;
+
+    /**
+     * 查询重点人群信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('keyPeople:info:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(KeyPeopleInfo keyPeopleInfo)
+    {
+        startPage();
+        List<KeyPeopleInfo> list = keyPeopleInfoService.selectKeyPeopleInfoList(keyPeopleInfo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出重点人群信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('keyPeople:info:export')")
+    @Log(title = "重点人群信息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, KeyPeopleInfo keyPeopleInfo)
+    {
+        List<KeyPeopleInfo> list = keyPeopleInfoService.selectKeyPeopleInfoList(keyPeopleInfo);
+        ExcelUtil<KeyPeopleInfo> util = new ExcelUtil<KeyPeopleInfo>(KeyPeopleInfo.class);
+        util.exportExcel(response, list, "重点人群信息数据");
+    }
+
+    @Log(title = "导入重点人群信息", businessType = BusinessType.IMPORT)
+    @PreAuthorize("@ss.hasPermi('keyPeople:info:import')")
+    @PostMapping("/importData")
+    public AjaxResult importData(MultipartFile file) throws Exception {
+        ExcelUtil<KeyPeopleInfo> util = new ExcelUtil<KeyPeopleInfo>(KeyPeopleInfo.class);
+        List<KeyPeopleInfo> userList = util.importExcel(file.getInputStream());
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if (userList == null) {
+            return AjaxResult.error("表格格式错误,请按照表格模板格式上传人员名单");
+        }
+
+        System.out.println("接口开始========");
+        StringBuilder sb = new StringBuilder();
+        for (KeyPeopleInfo userInfo : userList) {
+            if (userInfo == null) {
+                return AjaxResult.error("表格格式错误,请按照表格模板格式上传人员名单");
+            }
+            //插入部门id
+            userInfo.setDeptId(user.getDeptId().toString());
+            if (userInfo.getIdCard().length() != 18) {
+                sb.append(userInfo.getName()).append(",");
+            }
+        }
+
+        if (StringUtils.isNotEmpty(sb.toString())) {
+            return AjaxResult.error("操作失败,以下人员身份证格式错误【" + sb.toString() + "】");
+        }
+        keyPeopleInfoService.importUser(userList);
+        return AjaxResult.success("正在处理中,请稍后刷新页面");
+    }
+
+    /**
+     * 获取重点人群信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('keyPeople:info:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(keyPeopleInfoService.selectKeyPeopleInfoById(id));
+    }
+
+    /**
+     * 新增重点人群信息
+     */
+    @PreAuthorize("@ss.hasPermi('keyPeople:info:add')")
+    @Log(title = "重点人群信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody KeyPeopleInfo keyPeopleInfo)
+    {
+        return toAjax(keyPeopleInfoService.insertKeyPeopleInfo(keyPeopleInfo));
+    }
+
+    /**
+     * 修改重点人群信息
+     */
+    @PreAuthorize("@ss.hasPermi('keyPeople:info:edit')")
+    @Log(title = "重点人群信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody KeyPeopleInfo keyPeopleInfo)
+    {
+        return toAjax(keyPeopleInfoService.updateKeyPeopleInfo(keyPeopleInfo));
+    }
+
+    /**
+     * 删除重点人群信息
+     */
+    @PreAuthorize("@ss.hasPermi('keyPeople:info:remove')")
+    @Log(title = "重点人群信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(keyPeopleInfoService.deleteKeyPeopleInfoByIds(ids));
+    }
+}

+ 19 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/info/UserInfoController.java

@@ -104,6 +104,25 @@ public class UserInfoController extends BaseController {
         ExcelUtil<UserInfo> util = new ExcelUtil<UserInfo>(UserInfo.class);
         List<UserInfo> userList = util.importExcel(file.getInputStream());
         SysUser user = SecurityUtils.getLoginUser().getUser();
+        if (userList == null) {
+            return AjaxResult.error("表格格式错误,请按照表格模板格式上传人员名单");
+        }
+
+        System.out.println("接口开始========");
+        StringBuilder sb = new StringBuilder();
+        for (UserInfo userInfo : userList) {
+            if (userInfo == null) {
+                return AjaxResult.error("表格格式错误,请按照表格模板格式上传人员名单");
+            }
+
+            if (userInfo.getIdCard().length() != 18) {
+                sb.append(userInfo.getName()).append(",");
+            }
+        }
+
+        if (StringUtils.isNotEmpty(sb.toString())) {
+            return AjaxResult.error("操作失败,以下人员身份证格式错误【" + sb.toString() + "】");
+        }
         //String operName = getUsername();
         userInfoService.importUser(userList, jobStyle, focusCrowdStyle, detectionNumber, detectionScope, startTime, endTime, user);
 

+ 97 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/KeyPeopleInfo.java

@@ -0,0 +1,97 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 重点人群信息对象 key_people_info
+ * 
+ * @author boman
+ * @date 2022-09-27
+ */
+public class KeyPeopleInfo extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 姓名 */
+    @Excel(name = "姓名")
+    private String name;
+
+    /** 身份证号码 */
+    @Excel(name = "身份证号码")
+    private String idCard;
+
+    /** 联系号码 */
+    @Excel(name = "联系号码")
+    private String phoneNum;
+
+    /** 部门id */
+    private String deptId;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+    public void setIdCard(String idCard) 
+    {
+        this.idCard = idCard;
+    }
+
+    public String getIdCard() 
+    {
+        return idCard;
+    }
+    public void setPhoneNum(String phoneNum) 
+    {
+        this.phoneNum = phoneNum;
+    }
+
+    public String getPhoneNum() 
+    {
+        return phoneNum;
+    }
+    public void setDeptId(String deptId) 
+    {
+        this.deptId = deptId;
+    }
+
+    public String getDeptId() 
+    {
+        return deptId;
+    }
+
+    @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("deptId", getDeptId())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/KeyPeopleInfoMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.KeyPeopleInfo;
+
+/**
+ * 重点人群信息Mapper接口
+ * 
+ * @author boman
+ * @date 2022-09-27
+ */
+public interface KeyPeopleInfoMapper 
+{
+    /**
+     * 查询重点人群信息
+     * 
+     * @param id 重点人群信息主键
+     * @return 重点人群信息
+     */
+    public KeyPeopleInfo selectKeyPeopleInfoById(Long id);
+
+    /**
+     * 查询重点人群信息列表
+     * 
+     * @param keyPeopleInfo 重点人群信息
+     * @return 重点人群信息集合
+     */
+    public List<KeyPeopleInfo> selectKeyPeopleInfoList(KeyPeopleInfo keyPeopleInfo);
+
+    /**
+     * 新增重点人群信息
+     * 
+     * @param keyPeopleInfo 重点人群信息
+     * @return 结果
+     */
+    public int insertKeyPeopleInfo(KeyPeopleInfo keyPeopleInfo);
+
+    /**
+     * 修改重点人群信息
+     * 
+     * @param keyPeopleInfo 重点人群信息
+     * @return 结果
+     */
+    public int updateKeyPeopleInfo(KeyPeopleInfo keyPeopleInfo);
+
+    /**
+     * 删除重点人群信息
+     * 
+     * @param id 重点人群信息主键
+     * @return 结果
+     */
+    public int deleteKeyPeopleInfoById(Long id);
+
+    /**
+     * 批量删除重点人群信息
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKeyPeopleInfoByIds(Long[] ids);
+}

+ 70 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IKeyPeopleInfoService.java

@@ -0,0 +1,70 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.system.domain.KeyPeopleInfo;
+
+/**
+ * 重点人群信息Service接口
+ * 
+ * @author boman
+ * @date 2022-09-27
+ */
+public interface IKeyPeopleInfoService 
+{
+    /**
+     * 查询重点人群信息
+     * 
+     * @param id 重点人群信息主键
+     * @return 重点人群信息
+     */
+    public KeyPeopleInfo selectKeyPeopleInfoById(Long id);
+
+    /**
+     * 查询重点人群信息列表
+     * 
+     * @param keyPeopleInfo 重点人群信息
+     * @return 重点人群信息集合
+     */
+    public List<KeyPeopleInfo> selectKeyPeopleInfoList(KeyPeopleInfo keyPeopleInfo);
+
+    /**
+     * 新增重点人群信息
+     * 
+     * @param keyPeopleInfo 重点人群信息
+     * @return 结果
+     */
+    public int insertKeyPeopleInfo(KeyPeopleInfo keyPeopleInfo);
+
+    /**
+     * 修改重点人群信息
+     * 
+     * @param keyPeopleInfo 重点人群信息
+     * @return 结果
+     */
+    public int updateKeyPeopleInfo(KeyPeopleInfo keyPeopleInfo);
+
+    /**
+     * 批量删除重点人群信息
+     * 
+     * @param ids 需要删除的重点人群信息主键集合
+     * @return 结果
+     */
+    public int deleteKeyPeopleInfoByIds(Long[] ids);
+
+    /**
+     * 删除重点人群信息信息
+     * 
+     * @param id 重点人群信息主键
+     * @return 结果
+     */
+    public int deleteKeyPeopleInfoById(Long id);
+
+    /**
+     * 导入重点人群信息
+     * @param keyPeopleList
+     * @return
+     */
+    public void importUser(List<KeyPeopleInfo> keyPeopleList);
+}

+ 121 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/KeyPeopleInfoServiceImpl.java

@@ -0,0 +1,121 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.KeyPeopleInfoMapper;
+import com.ruoyi.system.domain.KeyPeopleInfo;
+import com.ruoyi.system.service.IKeyPeopleInfoService;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 重点人群信息Service业务层处理
+ * 
+ * @author boman
+ * @date 2022-09-27
+ */
+@Service
+public class KeyPeopleInfoServiceImpl implements IKeyPeopleInfoService 
+{
+    @Autowired
+    private KeyPeopleInfoMapper keyPeopleInfoMapper;
+
+    /**
+     * 查询重点人群信息
+     * 
+     * @param id 重点人群信息主键
+     * @return 重点人群信息
+     */
+    @Override
+    public KeyPeopleInfo selectKeyPeopleInfoById(Long id)
+    {
+        return keyPeopleInfoMapper.selectKeyPeopleInfoById(id);
+    }
+
+    /**
+     * 查询重点人群信息列表
+     * 
+     * @param keyPeopleInfo 重点人群信息
+     * @return 重点人群信息
+     */
+    @Override
+    public List<KeyPeopleInfo> selectKeyPeopleInfoList(KeyPeopleInfo keyPeopleInfo)
+    {
+        return keyPeopleInfoMapper.selectKeyPeopleInfoList(keyPeopleInfo);
+    }
+
+    /**
+     * 新增重点人群信息
+     * 
+     * @param keyPeopleInfo 重点人群信息
+     * @return 结果
+     */
+    @Override
+    public int insertKeyPeopleInfo(KeyPeopleInfo keyPeopleInfo)
+    {
+        keyPeopleInfo.setCreateTime(DateUtils.getNowDate());
+        return keyPeopleInfoMapper.insertKeyPeopleInfo(keyPeopleInfo);
+    }
+
+    /**
+     * 修改重点人群信息
+     * 
+     * @param keyPeopleInfo 重点人群信息
+     * @return 结果
+     */
+    @Override
+    public int updateKeyPeopleInfo(KeyPeopleInfo keyPeopleInfo)
+    {
+        keyPeopleInfo.setUpdateTime(DateUtils.getNowDate());
+        return keyPeopleInfoMapper.updateKeyPeopleInfo(keyPeopleInfo);
+    }
+
+    /**
+     * 批量删除重点人群信息
+     * 
+     * @param ids 需要删除的重点人群信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKeyPeopleInfoByIds(Long[] ids)
+    {
+        return keyPeopleInfoMapper.deleteKeyPeopleInfoByIds(ids);
+    }
+
+    /**
+     * 删除重点人群信息信息
+     * 
+     * @param id 重点人群信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKeyPeopleInfoById(Long id)
+    {
+        return keyPeopleInfoMapper.deleteKeyPeopleInfoById(id);
+    }
+
+    /**
+     * 导入人员信息
+     * @param keyPeopleList
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    @Async
+    public void importUser(List<KeyPeopleInfo> keyPeopleList) {
+        //插入数据
+        for (KeyPeopleInfo keyPeopleInfo : keyPeopleList) {
+            //查询一下这个人是否存在
+            List<KeyPeopleInfo> keyPeopleInfos = keyPeopleInfoMapper.selectKeyPeopleInfoList(keyPeopleInfo);
+            if (keyPeopleInfos != null && keyPeopleInfos.size() > 0){
+                keyPeopleInfoMapper.updateKeyPeopleInfo(keyPeopleInfo);
+            }else {
+                keyPeopleInfoMapper.insertKeyPeopleInfo(keyPeopleInfo);
+            }
+        }
+    }
+}

+ 0 - 8
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserInfoServiceImpl.java

@@ -141,12 +141,6 @@ public class UserInfoServiceImpl implements IUserInfoService {
     @Async
     public String importUser(List<UserInfo> userList, String jobStyle, String focusCrowdStyle, String detectionNumber,
                              String detectionScope, String startTime, String endTime, SysUser user) throws Exception {
-
-        if (userList == null) {
-            return "表格格式错误,请按照表格模板格式上传人员名单";
-        }
-
-        System.out.println("接口开始========");
         long start1 = System.currentTimeMillis();
 
         StringBuilder sb = new StringBuilder();
@@ -191,8 +185,6 @@ public class UserInfoServiceImpl implements IUserInfoService {
         int count = 0;
         String PhoneNum = "";
         for (UserInfo userInfo : userList) {
-
-            System.out.println("我在循环");
             userInfo.setDeptId(user.getDeptId().toString());
             //采集地点
             StringBuilder collectPlace = new StringBuilder();

+ 90 - 0
ruoyi-system/src/main/resources/mapper/system/KeyPeopleInfoMapper.xml

@@ -0,0 +1,90 @@
+<?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.ruoyi.system.mapper.KeyPeopleInfoMapper">
+    
+    <resultMap type="KeyPeopleInfo" id="KeyPeopleInfoResult">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="idCard"    column="id_card"    />
+        <result property="phoneNum"    column="phone_num"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectKeyPeopleInfoVo">
+        select id, name, id_card, phone_num, dept_id, create_by, create_time, update_by, update_time, remark from key_people_info
+    </sql>
+
+    <select id="selectKeyPeopleInfoList" parameterType="KeyPeopleInfo" resultMap="KeyPeopleInfoResult">
+        <include refid="selectKeyPeopleInfoVo"/>
+        <where>  
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
+            <if test="phoneNum != null  and phoneNum != ''"> and phone_num = #{phoneNum}</if>
+        </where>
+    </select>
+    
+    <select id="selectKeyPeopleInfoById" parameterType="Long" resultMap="KeyPeopleInfoResult">
+        <include refid="selectKeyPeopleInfoVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertKeyPeopleInfo" parameterType="KeyPeopleInfo" useGeneratedKeys="true" keyProperty="id">
+        insert into key_people_info
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null">name,</if>
+            <if test="idCard != null">id_card,</if>
+            <if test="phoneNum != null">phone_num,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="name != null">#{name},</if>
+            <if test="idCard != null">#{idCard},</if>
+            <if test="phoneNum != null">#{phoneNum},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateKeyPeopleInfo" parameterType="KeyPeopleInfo">
+        update key_people_info
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null">name = #{name},</if>
+            <if test="idCard != null">id_card = #{idCard},</if>
+            <if test="phoneNum != null">phone_num = #{phoneNum},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteKeyPeopleInfoById" parameterType="Long">
+        delete from key_people_info where id = #{id}
+    </delete>
+
+    <delete id="deleteKeyPeopleInfoByIds" parameterType="String">
+        delete from key_people_info where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 2 - 0
ruoyi-system/src/main/resources/mapper/system/UserInfoMapper.xml

@@ -253,6 +253,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         from ( select sfzhm,xm,sjhm,cjsj,jgcjss,jcdd,jcjg,sjly
         from ods_qss_hsjcxx_all
         where cjsj > #{startTime}  and #{endTime}>=cjsj
+        from ods_qss_hsjcxx
+        where cjsj BETWEEN  #{startTime}  and #{endTime}
         and sfzhm in
         <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
             #{idCard}