shiqian 3 lat temu
rodzic
commit
e84eb73a0f

+ 8 - 184
boman-api/boman-domain/src/main/java/com/boman/domain/Fxry.java

@@ -1,8 +1,11 @@
 package com.boman.domain;
 
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.sql.Timestamp;
 import java.util.Date;
 
 /**
@@ -10,10 +13,10 @@ import java.util.Date;
  * @author shiqian
  * @date 2022年01月05日 15:50
  **/
+@Data
 public class Fxry implements Serializable {
 
     private String id;
-
     private String name;
     private String sex;
     private int age;
@@ -31,6 +34,8 @@ public class Fxry implements Serializable {
     private String group;
     /** 详细地址 */
     private String detailAddr;
+    /** 完整户籍地址 ***/
+    private String wzhjdz;
 
 
     /** 身份证隐藏中间几位数字 **/
@@ -38,7 +43,8 @@ public class Fxry implements Serializable {
     /** 省外工作地址 **/
     private String addrOutsideProvince;
     /** 拟返回时间 ***/
-    private Date IntendedReturnTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date intendedReturnTime;
     private String telephone;
     /** 备注 ***/
     private String remark;
@@ -53,187 +59,5 @@ public class Fxry implements Serializable {
     private Date startTime;
     private Date endTime;
 
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getSex() {
-        return sex;
-    }
-
-    public void setSex(String sex) {
-        this.sex = sex;
-    }
-
-    public int getAge() {
-        return age;
-    }
-
-    public void setAge(int age) {
-        this.age = age;
-    }
-
-    public String getIdCard() {
-        return idCard;
-    }
-
-    public void setIdCard(String idCard) {
-        this.idCard = idCard;
-    }
-
-    public Long getVillageTownsId() {
-        return villageTownsId;
-    }
-
-    public void setVillageTownsId(Long villageTownsId) {
-        this.villageTownsId = villageTownsId;
-    }
-
-    public String getVillageTowns() {
-        return villageTowns;
-    }
-
-    public void setVillageTowns(String villageTowns) {
-        this.villageTowns = villageTowns;
-    }
-
-    public Long getVillageId() {
-        return villageId;
-    }
-
-    public void setVillageId(Long villageId) {
-        this.villageId = villageId;
-    }
-
-    public String getVillage() {
-        return village;
-    }
-
-    public void setVillage(String village) {
-        this.village = village;
-    }
-
-    public Long getGroupId() {
-        return groupId;
-    }
-
-    public void setGroupId(Long groupId) {
-        this.groupId = groupId;
-    }
-
-    public String getGroup() {
-        return group;
-    }
-
-    public void setGroup(String group) {
-        this.group = group;
-    }
-
-    public String getIdCardHide() {
-        return idCardHide;
-    }
-
-    public void setIdCardHide(String idCardHide) {
-        this.idCardHide = idCardHide;
-    }
-
-    public String getAddrOutsideProvince() {
-        return addrOutsideProvince;
-    }
-
-    public void setAddrOutsideProvince(String addrOutsideProvince) {
-        this.addrOutsideProvince = addrOutsideProvince;
-    }
-
-    public Date getIntendedReturnTime() {
-        return IntendedReturnTime;
-    }
-
-    public void setIntendedReturnTime(Date intendedReturnTime) {
-        IntendedReturnTime = intendedReturnTime;
-    }
-
-    public String getTelephone() {
-        return telephone;
-    }
-
-    public void setTelephone(String telephone) {
-        this.telephone = telephone;
-    }
-
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-
-    public String getDelete() {
-        return delete;
-    }
-
-    public void setDelete(String delete) {
-        this.delete = delete;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public String getCreateBy() {
-        return createBy;
-    }
-
-    public void setCreateBy(String createBy) {
-        this.createBy = createBy;
-    }
-
-    public String getUpdateBy() {
-        return updateBy;
-    }
-
-    public void setUpdateBy(String updateBy) {
-        this.updateBy = updateBy;
-    }
-
-    public Date getStartTime() {
-        return startTime;
-    }
-
-    public void setStartTime(Date startTime) {
-        this.startTime = startTime;
-    }
-
-    public Date getEndTime() {
-        return endTime;
-    }
 
-    public void setEndTime(Date endTime) {
-        this.endTime = endTime;
-    }
 }

+ 5 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/FxryController.java

@@ -33,6 +33,11 @@ public class FxryController extends BaseController {
         return service.add(fxry);
     }
 
+    @GetMapping("/getById/{id}")
+    public AjaxResult getById(@PathVariable String id) {
+        return AjaxResult.success(service.getById(id));
+    }
+
     @PostMapping("/edit")
     public AjaxResult edit(@RequestBody Fxry fxry) {
         return service.edit(fxry);

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

@@ -16,4 +16,6 @@ public interface FxryMapper{
     int edit(Fxry fxry);
     int delete(@Param("id") String id, @Param("updateBy") String updateBy);
     List<Fxry> list(Fxry fxry);
+
+    Fxry getById(String id);
 }

+ 2 - 0
boman-web-core/src/main/java/com/boman/web/core/service/fxry/FxryService.java

@@ -15,4 +15,6 @@ public interface FxryService {
     AjaxResult edit(Fxry fxry);
     AjaxResult delete(String id);
     List<Fxry> list(Fxry fxry);
+
+    Fxry getById(String id);
 }

+ 24 - 0
boman-web-core/src/main/java/com/boman/web/core/service/fxry/FxryServiceImpl.java

@@ -1,6 +1,7 @@
 package com.boman.web.core.service.fxry;
 
 import com.boman.common.core.utils.StringUtils;
+import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.common.core.utils.sql.SqlUtil;
 import com.boman.common.core.web.page.PageDomain;
 import com.boman.common.core.web.page.TableSupport;
@@ -11,11 +12,14 @@ import com.boman.web.core.utils.AuthUtils;
 import com.boman.web.core.utils.IdCardUtils;
 import com.boman.web.core.utils.IdUtils;
 import com.github.pagehelper.PageHelper;
+import com.google.common.base.Strings;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.List;
 
+import static com.google.common.base.Strings.nullToEmpty;
+
 /**
  * @author shiqian
  * @date 2022年01月05日 16:18
@@ -23,6 +27,7 @@ import java.util.List;
 @Service
 public class FxryServiceImpl implements FxryService {
 
+    private static final String DEFAULT = "安徽省安庆市潜山市";
     @Resource
     private FxryMapper mapper;
 
@@ -35,6 +40,7 @@ public class FxryServiceImpl implements FxryService {
         fxry.setUpdateBy(AuthUtils.getLoginUser().getSysUser().getUserName());
         fxry.setAge(IdCardUtils.getAge(idCard));
         fxry.setId(IdUtils.getMaxId("fxry", "id").toString());
+        packWzhjdz(fxry);
 
         int add = mapper.add(fxry);
         return add > 0 ? AjaxResult.success() : AjaxResult.error();
@@ -45,6 +51,7 @@ public class FxryServiceImpl implements FxryService {
         String hideIdCard = IdCardUtils.hideIdCard(fxry.getIdCard());
         fxry.setIdCardHide(hideIdCard);
         fxry.setUpdateBy(AuthUtils.getLoginUser().getSysUser().getUserName());
+        packWzhjdz(fxry);
 
         int edit = mapper.edit(fxry);
         return edit > 0 ? AjaxResult.success() : AjaxResult.error();
@@ -56,6 +63,15 @@ public class FxryServiceImpl implements FxryService {
         return delete > 0 ? AjaxResult.success() : AjaxResult.error();
     }
 
+    @Override
+    public Fxry getById(String id) {
+        if (ObjectUtils.isEmpty(id)) {
+            return null;
+        }
+
+        return mapper.getById(id);
+    }
+
     @Override
     public List<Fxry> list(Fxry fxry) {
         PageDomain pageDomain = TableSupport.buildPageRequest();
@@ -70,4 +86,12 @@ public class FxryServiceImpl implements FxryService {
 
         return list;
     }
+
+    private void packWzhjdz(Fxry fxry){
+        if (null == fxry) {
+            return;
+        }
+
+        fxry.setWzhjdz(DEFAULT + nullToEmpty(fxry.getVillageTowns()) + nullToEmpty(fxry.getVillage()) + nullToEmpty(fxry.getGroup()) + nullToEmpty(fxry.getDetailAddr()));
+    }
 }

+ 24 - 13
boman-web-core/src/main/resources/mapper/FxryMapper.xml

@@ -8,11 +8,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <insert id="add">
         INSERT INTO fxry(`id`, `name`, `sex`, `age`, `id_card`, `village_towns_id`, `village_towns`, `village_id`,
                          `village`, `group_id`, `group`, `detail_addr`, `id_card_hide`, `addr_outside_province`,
-                         `intended_return_time`, `telephone`, `remark`, `delete`,
+                         `intended_return_time`, `telephone`, `remark`, `detail_addr`, `wzhjdz`
                         `create_time`, `create_by`, `update_time`, `update_by`)
         VALUES (#{id}, #{name}, #{sex}, #{age}, #{idCard}, #{villageTownsId}, #{villageTowns}, #{villageId},
             #{village}, #{groupId}, #{group}, #{detailAddr}, #{idCardHide}, #{addrOutsideProvince},
-            #{IntendedReturnTime}, #{telephone}, #{remark}, #{delete},
+            #{intendedReturnTime}, #{telephone}, #{remark}, #{detailAddr}, #{wzhjdz},
                 SYSDATE(), #{createBy}, SYSDATE(), #{updateBy});
     </insert>
 
@@ -31,10 +31,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="groupId != null and groupId != ''">group_id = #{groupId},</if>
                 <if test="group != null and group != ''">`group` = #{group},</if>
                 <if test="detailAddr != null and detailAddr != ''">detail_addr = #{detailAddr},</if>
+                <if test="wzhjdz != null and wzhjdz != ''">wzhjdz = #{wzhjdz},</if>
                 <if test="idCardHide != null and idCardHide != ''">id_card_hide = #{idCardHide},</if>
                 <if test="addrOutsideProvince != null and addrOutsideProvince != ''">addr_outside_province = #{addrOutsideProvince},</if>
-                <if test="IntendedReturnTime != null and IntendedReturnTime != ''">intended_return_time = #{IntendedReturnTime},</if>
-                <if test="IntendedReturnTime != null and IntendedReturnTime != ''">intended_return_time = #{IntendedReturnTime},</if>
+                <if test="intendedReturnTime != null and intendedReturnTime != ''">intended_return_time = #{intendedReturnTime},</if>
+                <if test="intendedReturnTime != null and intendedReturnTime != ''">intended_return_time = #{intendedReturnTime},</if>
                 <if test="telephone != null and telephone != ''">telephone = #{telephone},</if>
                 <if test="remark != null and remark != ''">remark = #{remark},</if>
                 <if test="delete != null and delete != ''">`delete` = #{delete},</if>
@@ -55,19 +56,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="list" resultType="com.boman.domain.Fxry">
         select id,
                `name`,
-               sex,
-               age,
-               village_towns,
-               village,
-               id_card_hide,
-               addr_outside_province,
-               intended_return_time,
-               telephone
+               telephone,
+               id_card_hide idCard,
+               wzhjdz,
+               addr_outside_province addrOutsideProvince,
+               intended_return_time intendedReturnTime
         from fxry
-        where 1 = 1
+        where `delete` = '否'
         <if test="name != null and name != ''">and `name` like concat('%', #{name}, '%')</if>
         <if test="sex != null and sex != ''">and `sex` like concat('%', #{sex}, '%')</if>
         <if test="idCard != null and idCard != ''">and `id_card` like concat('%', #{idCard}, '%')</if>
         <if test="telephone != null and telephone != ''">and telephone = #{telephone}</if>
+        order by create_time desc
+    </select>
+
+    <select id="getById" resultType="com.boman.domain.Fxry">
+        select id,
+               `name`,
+               detail_addr detailAddr,
+               id_card idCard,
+               addr_outside_province addrOutsideProvince,
+               intended_return_time intendedReturnTime,
+               telephone
+        from fxry
+        where id = #{id} limit 1;
     </select>
 </mapper>