瀏覽代碼

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	boman-web-core/src/main/java/com/boman/web/core/domain/VaccineInfoOperation.java
Administrator 3 年之前
父節點
當前提交
1bc923023d

+ 183 - 158
boman-web-core/src/main/java/com/boman/web/core/domain/VaccineInfoOperation.java

@@ -8,405 +8,430 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 
 /**
  * 疫苗信息操作对象 vaccine_info_operation
- * 
+ *
  * @author ruoyi
  * @date 2021-09-05
  */
-public class VaccineInfoOperation extends BaseEntity
-{
+public class VaccineInfoOperation extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 编号 */
+    /**
+     * 编号
+     */
     private Long id;
 
-    /** 乡镇 */
+    /**
+     * 乡镇
+     */
     @Excel(name = "乡镇")
     private String villageTowns;
 
-    /** 村居 */
+    /**
+     * 村居
+     */
     @Excel(name = "村居")
     private String village;
 
-    /** 村民组(社区) */
+    /**
+     * 村民组(社区)
+     */
     @Excel(name = "村民组", readConverterExp = "社=区")
     private String villagerGroup;
 
-    /** 户别 */
+    /**
+     * 户别
+     */
     @Excel(name = "户别")
     private String houseType;
 
-    /** 户籍地 */
+    /**
+     * 户籍地
+     */
     @Excel(name = "户籍地")
     private String domicile;
 
-    /** 省 */
+    /**
+     * 省
+     */
     @Excel(name = "省")
     private String province;
 
-    /** 市 */
+    /**
+     * 市
+     */
     @Excel(name = "市")
     private String city;
 
-    /** 区 */
+    /**
+     * 区
+     */
     @Excel(name = "区")
-    private String area;
+    private String region;
 
-    /** 姓名 */
+    /**
+     * 姓名
+     */
     @Excel(name = "姓名")
     private String userName;
 
-    /** 性别 */
+    /**
+     * 性别
+     */
     @Excel(name = "性别")
     private String gender;
 
-    /** 身份证号码 */
+    /**
+     * 身份证号码
+     */
     @Excel(name = "身份证号码")
     private String idCard;
 
-    /** 联系号码 */
+    /**
+     * 联系号码
+     */
     @Excel(name = "联系号码")
     private String phoneNum;
 
-    /** 重点行业 */
+    /**
+     * 重点行业
+     */
     @Excel(name = "重点行业")
     private String keyIndustries;
 
-    /** 接种情况(是/否) */
+    /**
+     * 接种情况(是/否)
+     */
     @Excel(name = "接种情况", readConverterExp = "是=/否")
     private String isVaccination;
 
-    /** 疫苗名称 */
+    /**
+     * 疫苗名称
+     */
     @Excel(name = "疫苗名称")
     private String vaccineName;
 
-    /** 剂次(1/2/3/加强针) */
+    /**
+     * 剂次(1/2/3/加强针)
+     */
     @Excel(name = "剂次", readConverterExp = "1=/2/3/加强针")
     private String jici;
 
-    /** 接种时间 */
+    /**
+     * 接种时间
+     */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "接种时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date vaccinationTime;
 
-    /** 接种地点 */
+    /**
+     * 接种地点
+     */
     @Excel(name = "接种地点")
     private String vaccinationPlace;
 
-    /** 禁忌症 */
+    /**
+     * 禁忌症
+     */
     @Excel(name = "禁忌症")
     private String contraindication;
 
-    /** 暂缓
- */
+    /**
+     * 暂缓
+     */
     @Excel(name = "暂缓")
     private String suspend;
 
-    /** 死亡 */
+    /**
+     * 死亡
+     */
     @Excel(name = "死亡")
     private String death;
 
-    /** 失联失踪
- */
+    /**
+     * 失联失踪
+     */
     @Excel(name = "失联失踪")
     private String lostInMissing;
 
-    /** 应种未种
- */
+    /**
+     * 应种未种
+     */
     @Excel(name = "应种未种")
     private String shouldBe;
 
-    /** 其他 */
+    /**
+     * 其他
+     */
     @Excel(name = "其他")
     private String other;
 
-    /** 进度 */
+    /**
+     * 进度
+     */
     @Excel(name = "进度")
     private String progress;
 
-    /** 状态 */
+    /**
+     * 状态
+     */
     @Excel(name = "状态")
     private String status;
 
-    /** 是否删除 */
+    /**
+     * 是否删除
+     */
     @Excel(name = "是否删除")
     private String isDel;
 
-    /** 操作类型 */
+    /**
+     * 操作类型
+     */
     @Excel(name = "操作类型")
     private String operationType;
 
-    /** 疫苗信息 */
+    /**
+     * 疫苗信息
+     */
     @Excel(name = "疫苗信息")
     private Long vaccineInfoId;
 
-    public void setId(Long id) 
-    {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setVillageTowns(String villageTowns) 
-    {
+
+    public void setVillageTowns(String villageTowns) {
         this.villageTowns = villageTowns;
     }
 
-    public String getVillageTowns() 
-    {
+    public String getVillageTowns() {
         return villageTowns;
     }
-    public void setVillage(String village) 
-    {
+
+    public void setVillage(String village) {
         this.village = village;
     }
 
-    public String getArea() {
-        return area;
+    public String getRegion() {
+        return region;
     }
 
-    public void setArea(String area) {
-        this.area = area;
+    public void setRegion(String region) {
+        this.region = region;
     }
 
-    public String getVillage()
-    {
+    public String getVillage() {
         return village;
     }
-    public void setVillagerGroup(String villagerGroup) 
-    {
+
+    public void setVillagerGroup(String villagerGroup) {
         this.villagerGroup = villagerGroup;
     }
 
-    public String getVillagerGroup() 
-    {
+    public String getVillagerGroup() {
         return villagerGroup;
     }
-    public void setHouseType(String houseType) 
-    {
+
+    public void setHouseType(String houseType) {
         this.houseType = houseType;
     }
 
-    public String getHouseType() 
-    {
+    public String getHouseType() {
         return houseType;
     }
-    public void setDomicile(String domicile) 
-    {
+
+    public void setDomicile(String domicile) {
         this.domicile = domicile;
     }
 
-    public String getDomicile() 
-    {
+    public String getDomicile() {
         return domicile;
     }
-    public void setProvince(String province) 
-    {
+
+    public void setProvince(String province) {
         this.province = province;
     }
 
-    public String getProvince() 
-    {
+    public String getProvince() {
         return province;
     }
-    public void setCity(String city) 
-    {
+
+    public void setCity(String city) {
         this.city = city;
     }
 
-    public String getCity() 
-    {
+    public String getCity() {
         return city;
     }
 
-    public void setUserName(String userName) 
-    {
+    public void setUserName(String userName) {
         this.userName = userName;
     }
 
-    public String getUserName() 
-    {
+    public String getUserName() {
         return userName;
     }
-    public void setGender(String gender) 
-    {
+
+    public void setGender(String gender) {
         this.gender = gender;
     }
 
-    public String getGender() 
-    {
+    public String getGender() {
         return gender;
     }
-    public void setIdCard(String idCard) 
-    {
+
+    public void setIdCard(String idCard) {
         this.idCard = idCard;
     }
 
-    public String getIdCard() 
-    {
+    public String getIdCard() {
         return idCard;
     }
-    public void setPhoneNum(String phoneNum) 
-    {
+
+    public void setPhoneNum(String phoneNum) {
         this.phoneNum = phoneNum;
     }
 
-    public String getPhoneNum() 
-    {
+    public String getPhoneNum() {
         return phoneNum;
     }
-    public void setKeyIndustries(String keyIndustries) 
-    {
+
+    public void setKeyIndustries(String keyIndustries) {
         this.keyIndustries = keyIndustries;
     }
 
-    public String getKeyIndustries() 
-    {
+    public String getKeyIndustries() {
         return keyIndustries;
     }
-    public void setIsVaccination(String isVaccination) 
-    {
+
+    public void setIsVaccination(String isVaccination) {
         this.isVaccination = isVaccination;
     }
 
-    public String getIsVaccination() 
-    {
+    public String getIsVaccination() {
         return isVaccination;
     }
-    public void setVaccineName(String vaccineName) 
-    {
+
+    public void setVaccineName(String vaccineName) {
         this.vaccineName = vaccineName;
     }
 
-    public String getVaccineName() 
-    {
+    public String getVaccineName() {
         return vaccineName;
     }
-    public void setJici(String jici) 
-    {
+
+    public void setJici(String jici) {
         this.jici = jici;
     }
 
-    public String getJici() 
-    {
+    public String getJici() {
         return jici;
     }
-    public void setVaccinationTime(Date vaccinationTime) 
-    {
+
+    public void setVaccinationTime(Date vaccinationTime) {
         this.vaccinationTime = vaccinationTime;
     }
 
-    public Date getVaccinationTime() 
-    {
+    public Date getVaccinationTime() {
         return vaccinationTime;
     }
-    public void setVaccinationPlace(String vaccinationPlace) 
-    {
+
+    public void setVaccinationPlace(String vaccinationPlace) {
         this.vaccinationPlace = vaccinationPlace;
     }
 
-    public String getVaccinationPlace() 
-    {
+    public String getVaccinationPlace() {
         return vaccinationPlace;
     }
-    public void setContraindication(String contraindication) 
-    {
+
+    public void setContraindication(String contraindication) {
         this.contraindication = contraindication;
     }
 
-    public String getContraindication() 
-    {
+    public String getContraindication() {
         return contraindication;
     }
-    public void setSuspend(String suspend) 
-    {
+
+    public void setSuspend(String suspend) {
         this.suspend = suspend;
     }
 
-    public String getSuspend() 
-    {
+    public String getSuspend() {
         return suspend;
     }
-    public void setDeath(String death) 
-    {
+
+    public void setDeath(String death) {
         this.death = death;
     }
 
-    public String getDeath() 
-    {
+    public String getDeath() {
         return death;
     }
-    public void setLostInMissing(String lostInMissing) 
-    {
+
+    public void setLostInMissing(String lostInMissing) {
         this.lostInMissing = lostInMissing;
     }
 
-    public String getLostInMissing() 
-    {
+    public String getLostInMissing() {
         return lostInMissing;
     }
-    public void setShouldBe(String shouldBe) 
-    {
+
+    public void setShouldBe(String shouldBe) {
         this.shouldBe = shouldBe;
     }
 
-    public String getShouldBe() 
-    {
+    public String getShouldBe() {
         return shouldBe;
     }
-    public void setOther(String other) 
-    {
+
+    public void setOther(String other) {
         this.other = other;
     }
 
-    public String getOther() 
-    {
+    public String getOther() {
         return other;
     }
-    public void setProgress(String progress) 
-    {
+
+    public void setProgress(String progress) {
         this.progress = progress;
     }
 
-    public String getProgress() 
-    {
+    public String getProgress() {
         return progress;
     }
-    public void setStatus(String status) 
-    {
+
+    public void setStatus(String status) {
         this.status = status;
     }
 
-    public String getStatus() 
-    {
+    public String getStatus() {
         return status;
     }
-    public void setIsDel(String isDel) 
-    {
+
+    public void setIsDel(String isDel) {
         this.isDel = isDel;
     }
 
-    public String getIsDel() 
-    {
+    public String getIsDel() {
         return isDel;
     }
-    public void setOperationType(String operationType) 
-    {
+
+    public void setOperationType(String operationType) {
         this.operationType = operationType;
     }
 
-    public String getOperationType() 
-    {
+    public String getOperationType() {
         return operationType;
     }
-    public void setVaccineInfoId(Long vaccineInfoId) 
-    {
+
+    public void setVaccineInfoId(Long vaccineInfoId) {
         this.vaccineInfoId = vaccineInfoId;
     }
 
-    public Long getVaccineInfoId() 
-    {
+    public Long getVaccineInfoId() {
         return vaccineInfoId;
     }
 
@@ -421,7 +446,7 @@ public class VaccineInfoOperation extends BaseEntity
                 ", domicile='" + domicile + '\'' +
                 ", province='" + province + '\'' +
                 ", city='" + city + '\'' +
-                ", area='" + area + '\'' +
+                ", region='" + region + '\'' +
                 ", userName='" + userName + '\'' +
                 ", gender='" + gender + '\'' +
                 ", idCard='" + idCard + '\'' +

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

@@ -20,6 +20,8 @@ public interface VaccineInfoMapper
      */
     public VaccineInfoOperation selectVaccineInfoById(Long id);
 
+    public List<VaccineInfoOperation> selectVaccineInfoByIds(Long[] ids);
+
     /**
      * 查询疫苗信息列表
      * 

+ 67 - 27
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoServiceImpl.java

@@ -1,97 +1,137 @@
 package com.boman.web.core.service.vaccineInfo.impl;
 
+import java.util.Date;
 import java.util.List;
 
 import com.boman.common.core.utils.DateUtils;
+import com.boman.common.core.utils.SecurityUtils;
 import com.boman.web.core.domain.VaccineInfoOperation;
+import com.boman.web.core.mapper.VaccineInfoOperationMapper;
 import com.boman.web.core.service.vaccineInfo.IVaccineInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.boman.web.core.mapper.VaccineInfoMapper;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 疫苗信息Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2021-09-05
  */
 @Service
-public class VaccineInfoServiceImpl implements IVaccineInfoService
-{
+public class VaccineInfoServiceImpl implements IVaccineInfoService {
+
+    private static final String INSERT = "insert";
+    private static final String EDIT = "edit";
+    private static final String DELETE = "delete";
+
     @Autowired
     private VaccineInfoMapper vaccineInfoMapper;
+    @Autowired
+    private VaccineInfoOperationMapper vaccineInfoOperationMapper;
 
     /**
      * 查询疫苗信息
-     * 
+     *
      * @param id 疫苗信息ID
      * @return 疫苗信息
      */
     @Override
-    public VaccineInfoOperation selectVaccineInfoById(Long id)
-    {
+    public VaccineInfoOperation selectVaccineInfoById(Long id) {
         return vaccineInfoMapper.selectVaccineInfoById(id);
     }
 
     /**
      * 查询疫苗信息列表
-     * 
-     * @param vaccineInfo 疫苗信息
+     *
+     * @param vaccineInfoOperation 疫苗信息
      * @return 疫苗信息
      */
     @Override
-    public List<VaccineInfoOperation> selectVaccineInfoList(VaccineInfoOperation vaccineInfo)
-    {
-        return vaccineInfoMapper.selectVaccineInfoList(vaccineInfo);
+    public List<VaccineInfoOperation> selectVaccineInfoList(VaccineInfoOperation vaccineInfoOperation) {
+        return vaccineInfoMapper.selectVaccineInfoList(vaccineInfoOperation);
     }
 
     /**
      * 新增疫苗信息
-     * 
-     * @param vaccineInfo 疫苗信息
+     *
+     * @param vaccineInfoOperation 疫苗信息
      * @return 结果
      */
     @Override
-    public int insertVaccineInfo(VaccineInfoOperation vaccineInfo)
-    {
-        vaccineInfo.setCreateTime(DateUtils.getNowDate());
-        return vaccineInfoMapper.insertVaccineInfo(vaccineInfo);
+    @Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
+    public int insertVaccineInfo(VaccineInfoOperation vaccineInfoOperation) {
+        // 疫苗信息
+        vaccineInfoOperation.setCreateTime(DateUtils.getNowDate());
+        int info = vaccineInfoMapper.insertVaccineInfo(vaccineInfoOperation);
+
+        // 疫苗信息新增操作记录
+        vaccineInfoOperation.setOperationType(INSERT);
+        vaccineInfoOperation.setVaccineInfoId(vaccineInfoOperation.getId());
+        vaccineInfoOperation.setCreateBy(SecurityUtils.getUsername());
+        vaccineInfoOperationMapper.insertVaccineInfoOperation(vaccineInfoOperation);
+
+        return info;
     }
 
     /**
      * 修改疫苗信息
-     * 
+     *
      * @param vaccineInfo 疫苗信息
      * @return 结果
      */
     @Override
-    public int updateVaccineInfo(VaccineInfoOperation vaccineInfo)
-    {
+    @Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
+    public int updateVaccineInfo(VaccineInfoOperation vaccineInfo) {
         vaccineInfo.setUpdateTime(DateUtils.getNowDate());
-        return vaccineInfoMapper.updateVaccineInfo(vaccineInfo);
+        int info = vaccineInfoMapper.updateVaccineInfo(vaccineInfo);
+
+        // 疫苗信息新增操作记录
+        vaccineInfo.setOperationType(EDIT);
+        vaccineInfo.setCreateTime(new Date());
+        vaccineInfo.setCreateBy(SecurityUtils.getUsername());
+        vaccineInfo.setVaccineInfoId(vaccineInfo.getId());
+        vaccineInfoOperationMapper.insertVaccineInfoOperation(vaccineInfo);
+        return info;
     }
 
     /**
      * 批量删除疫苗信息
-     * 
+     *
      * @param ids 需要删除的疫苗信息ID
      * @return 结果
      */
     @Override
-    public int deleteVaccineInfoByIds(Long[] ids)
-    {
+    public int deleteVaccineInfoByIds(Long[] ids) {
+        List<VaccineInfoOperation> vaccineInfos = vaccineInfoMapper.selectVaccineInfoByIds(ids);
+        String userName = SecurityUtils.getUsername();
+        for(VaccineInfoOperation vaccineInfoOperation : vaccineInfos) {
+            // 疫苗信息新增操作记录
+            vaccineInfoOperation.setOperationType(DELETE);
+            vaccineInfoOperation.setCreateTime(new Date());
+            vaccineInfoOperation.setCreateBy(userName);
+            vaccineInfoOperation.setVaccineInfoId(vaccineInfoOperation.getId());
+            vaccineInfoOperationMapper.insertVaccineInfoOperation(vaccineInfoOperation);
+        }
+
         return vaccineInfoMapper.deleteVaccineInfoByIds(ids);
     }
 
     /**
      * 删除疫苗信息信息
-     * 
+     *
      * @param id 疫苗信息ID
      * @return 结果
      */
     @Override
-    public int deleteVaccineInfoById(Long id)
-    {
+    public int deleteVaccineInfoById(Long id) {
+        VaccineInfoOperation vaccineInfo = vaccineInfoMapper.selectVaccineInfoById(id);
+        vaccineInfo.setVaccineInfoId(id);
+        vaccineInfo.setCreateBy(SecurityUtils.getUsername());
+        vaccineInfo.setCreateTime(new Date());
+        vaccineInfo.setOperationType(DELETE);
         return vaccineInfoMapper.deleteVaccineInfoById(id);
     }
 }

+ 7 - 0
boman-web-core/src/main/resources/mapper/VaccineInfoMapper.xml

@@ -81,6 +81,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectVaccineInfoVo"/>
         where id = #{id}
     </select>
+    <select id="selectVaccineInfoByIds" parameterType="Long" resultMap="VaccineInfoResult">
+        <include refid="selectVaccineInfoVo"/>
+        where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
         
     <insert id="insertVaccineInfo" parameterType="VaccineInfoOperation" useGeneratedKeys="true" keyProperty="id">
         insert into vaccine_info

+ 7 - 7
boman-web-core/src/main/resources/mapper/VaccineInfoOperationMapper.xml

@@ -13,7 +13,7 @@
         <result property="domicile" column="domicile"/>
         <result property="province" column="province"/>
         <result property="city" column="city"/>
-        <result property="area" column="area"/>
+        <result property="region" column="region"/>
         <result property="userName" column="user_name"/>
         <result property="gender" column="gender"/>
         <result property="idCard" column="id_card"/>
@@ -43,8 +43,8 @@
     </resultMap>
 
     <sql id="selectVaccineInfoOperationVo">
-        select id, village_towns, village, villager_group, house_type, domicile, province, city, 
-area, user_name, gender, id_card, phone_num, key_industries, is_vaccination, vaccine_name, jici, vaccination_time, vaccination_place, contraindication, suspend, death, lost_in_missing, should_be, other, progress, remark, status, create_by, create_time, update_by, update_time, is_del, operation_type, vaccine_info_id from vaccine_info_operation
+        select id, village_towns, village, villager_group, house_type, domicile, province, city,
+               region, user_name, gender, id_card, phone_num, key_industries, is_vaccination, vaccine_name, jici, vaccination_time, vaccination_place, contraindication, suspend, death, lost_in_missing, should_be, other, progress, remark, status, create_by, create_time, update_by, update_time, is_del, operation_type, vaccine_info_id from vaccine_info_operation
     </sql>
 
     <select id="selectVaccineInfoOperationList" parameterType="VaccineInfoOperation"
@@ -58,7 +58,7 @@ area, user_name, gender, id_card, phone_num, key_industries, is_vaccination, vac
             <if test="domicile != null  and domicile != ''">and domicile = #{domicile}</if>
             <if test="province != null  and province != ''">and province = #{province}</if>
             <if test="city != null  and city != ''">and city = #{city}</if>
-            <if test="area != null  and area != ''">and area = #{area}</if>
+            <if test="region != null  and region != ''">and region = #{region}</if>
             <if test="userName != null  and userName != ''">and user_name like concat('%', #{userName}, '%')</if>
             <if test="gender != null  and gender != ''">and gender = #{gender}</if>
             <if test="idCard != null  and idCard != ''">and id_card = #{idCard}</if>
@@ -99,7 +99,7 @@ area, user_name, gender, id_card, phone_num, key_industries, is_vaccination, vac
             <if test="domicile != null">domicile,</if>
             <if test="province != null">province,</if>
             <if test="city != null">city,</if>
-            <if test="area != null">area,</if>
+            <if test="region != null">region,</if>
             <if test="userName != null">user_name,</if>
             <if test="gender != null">gender,</if>
             <if test="idCard != null">id_card,</if>
@@ -135,7 +135,7 @@ area, user_name, gender, id_card, phone_num, key_industries, is_vaccination, vac
             <if test="domicile != null">#{domicile},</if>
             <if test="province != null">#{province},</if>
             <if test="city != null">#{city},</if>
-            <if test="area != null">#{area},</if>
+            <if test="region != null">#{region},</if>
             <if test="userName != null">#{userName},</if>
             <if test="gender != null">#{gender},</if>
             <if test="idCard != null">#{idCard},</if>
@@ -175,7 +175,7 @@ area, user_name, gender, id_card, phone_num, key_industries, is_vaccination, vac
             <if test="domicile != null">domicile = #{domicile},</if>
             <if test="province != null">province = #{province},</if>
             <if test="city != null">city = #{city},</if>
-            <if test="area != null">area = #{area},</if>
+            <if test="region != null">region = #{region},</if>
             <if test="userName != null">user_name = #{userName},</if>
             <if test="gender != null">gender = #{gender},</if>
             <if test="idCard != null">id_card = #{idCard},</if>