Merge remote-tracking branch 'origin/main'

main
wanglei 2 years ago
commit cfc3836af0

@ -12,7 +12,7 @@ import java.util.Date;
* szxc_hkbg_recard
*
* @author hs
* @date 2024-03-26
* @date 2024-03-27
*/
public class SzxcHkbgRecard extends BaseEntity
{
@ -53,8 +53,8 @@ public class SzxcHkbgRecard extends BaseEntity
@Excel(name = "变更原因(字典)")
private String bgReason;
/** 居民id */
@Excel(name = "居民id")
/** 居民id */
@Excel(name = "居民id")
private Long xJmId;
/** 新户主姓名 */
@ -69,15 +69,23 @@ public class SzxcHkbgRecard extends BaseEntity
@Excel(name = "与户主关系")
private String relation;
/** 变更编号 */
@Excel(name = "变更编号")
private String number;
/** 变更时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "变更时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date bgTime;
/** 户籍地址 */
@Excel(name = "户籍地址")
private String hjAddress;
/** 户籍性质 */
@Excel(name = "户籍性质")
private String jgNature;
/** 是否常住0是 1否 */
@Excel(name = "是否常住", readConverterExp = "0=是,1=否")
private String longLive;
/** 部门id */
@Excel(name = "部门id")
private Long deptId;
@ -86,6 +94,10 @@ public class SzxcHkbgRecard extends BaseEntity
@Excel(name = "创建者ID")
private Long userId;
/** 所属网格 */
@Excel(name = "所属网格")
private String deptName;
public void setId(Long id)
{
this.id = id;
@ -203,23 +215,41 @@ public class SzxcHkbgRecard extends BaseEntity
{
return relation;
}
public void setNumber(String number)
public void setBgTime(Date bgTime)
{
this.number = number;
this.bgTime = bgTime;
}
public String getNumber()
public Date getBgTime()
{
return number;
return bgTime;
}
public void setBgTime(Date bgTime)
public void setHjAddress(String hjAddress)
{
this.bgTime = bgTime;
this.hjAddress = hjAddress;
}
public Date getBgTime()
public String getHjAddress()
{
return bgTime;
return hjAddress;
}
public void setJgNature(String jgNature)
{
this.jgNature = jgNature;
}
public String getJgNature()
{
return jgNature;
}
public void setLongLive(String longLive)
{
this.longLive = longLive;
}
public String getLongLive()
{
return longLive;
}
public void setDeptId(Long deptId)
{
@ -239,6 +269,15 @@ public class SzxcHkbgRecard extends BaseEntity
{
return userId;
}
public void setDeptName(String deptName)
{
this.deptName = deptName;
}
public String getDeptName()
{
return deptName;
}
@Override
public String toString() {
@ -256,8 +295,10 @@ public class SzxcHkbgRecard extends BaseEntity
.append("xName", getxName())
.append("xIdCard", getxIdCard())
.append("relation", getRelation())
.append("number", getNumber())
.append("bgTime", getBgTime())
.append("hjAddress", getHjAddress())
.append("jgNature", getJgNature())
.append("longLive", getLongLive())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
@ -265,6 +306,7 @@ public class SzxcHkbgRecard extends BaseEntity
.append("updateTime", getUpdateTime())
.append("deptId", getDeptId())
.append("userId", getUserId())
.append("deptName", getDeptName())
.toString();
}
}

@ -52,7 +52,7 @@ public class SzxcJmInfo extends BaseEntity
/** 年龄 */
@Excel(name = "年龄")
private Long age;
private Integer age;
/** 性别0男 1女 2未知 */
@Excel(name = "性别", readConverterExp = "0=男,1=女,2=未知")
@ -206,12 +206,12 @@ public class SzxcJmInfo extends BaseEntity
{
return bornDate;
}
public void setAge(Long age)
public void setAge(Integer age)
{
this.age = age;
}
public Long getAge()
public Integer getAge()
{
return age;
}

@ -1,12 +1,16 @@
package com.ruoyi.szxc.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.szxc.mapper.SzxcHkbgRecardMapper;
import com.ruoyi.szxc.domain.SzxcHkbgRecard;
import com.ruoyi.szxc.domain.SzxcJmInfo;
import com.ruoyi.szxc.mapper.SzxcHkbgRecardMapper;
import com.ruoyi.szxc.mapper.SzxcJmInfoMapper;
import com.ruoyi.szxc.service.ISzxcHkbgRecardService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* Service
@ -17,8 +21,10 @@ import com.ruoyi.szxc.service.ISzxcHkbgRecardService;
@Service
public class SzxcHkbgRecardServiceImpl implements ISzxcHkbgRecardService
{
@Autowired
@Resource
private SzxcHkbgRecardMapper szxcHkbgRecardMapper;
@Resource
private SzxcJmInfoMapper szxcJmInfoMapper;
/**
*
@ -51,8 +57,25 @@ public class SzxcHkbgRecardServiceImpl implements ISzxcHkbgRecardService
* @return
*/
@Override
@Transactional
public int insertSzxcHkbgRecard(SzxcHkbgRecard szxcHkbgRecard)
{
//先修改居民所属户主信息
SzxcJmInfo jmInfo = new SzxcJmInfo();
jmInfo.setAcountNo(szxcHkbgRecard.getAcountNo());
jmInfo.setDeptId(szxcHkbgRecard.getDeptId());
jmInfo.setDeptName(szxcHkbgRecard.getDeptName());
jmInfo.setHjAddress(szxcHkbgRecard.getHjAddress());
jmInfo.setRelation(szxcHkbgRecard.getRelation());
jmInfo.setLongLive(szxcHkbgRecard.getLongLive());
jmInfo.setJgNature(szxcHkbgRecard.getJgNature());
try {
szxcJmInfoMapper.updateSzxcJmInfo(jmInfo);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
//添加户口变更记录
szxcHkbgRecard.setCreateTime(DateUtils.getNowDate());
return szxcHkbgRecardMapper.insertSzxcHkbgRecard(szxcHkbgRecard);
}

@ -5,9 +5,11 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.szxc.domain.SzxcJmInfo;
import com.ruoyi.szxc.mapper.SzxcJmInfoMapper;
import com.ruoyi.szxc.service.ISzxcJmInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.szxc.util.GetAgeByBirthdayUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
@ -19,7 +21,7 @@ import java.util.List;
@Service
public class SzxcJmInfoServiceImpl implements ISzxcJmInfoService
{
@Autowired
@Resource
private SzxcJmInfoMapper szxcJmInfoMapper;
/**
@ -31,7 +33,11 @@ public class SzxcJmInfoServiceImpl implements ISzxcJmInfoService
@Override
public SzxcJmInfo selectSzxcJmInfoById(Long id)
{
return szxcJmInfoMapper.selectSzxcJmInfoById(id);
SzxcJmInfo jmInfo = szxcJmInfoMapper.selectSzxcJmInfoById(id);
Date bornDate = jmInfo.getBornDate();
int ageByBirth = GetAgeByBirthdayUtil.getAgeByBirth(bornDate);
jmInfo.setAge(ageByBirth);
return jmInfo;
}
/**
@ -44,7 +50,13 @@ public class SzxcJmInfoServiceImpl implements ISzxcJmInfoService
@DataScope(deptAlias = "j")
public List<SzxcJmInfo> selectSzxcJmInfoList(SzxcJmInfo szxcJmInfo)
{
return szxcJmInfoMapper.selectSzxcJmInfoList(szxcJmInfo);
List<SzxcJmInfo> szxcJmInfos = szxcJmInfoMapper.selectSzxcJmInfoList(szxcJmInfo);
szxcJmInfos.forEach(info->{
Date bornDate = info.getBornDate();
int ageByBirth = GetAgeByBirthdayUtil.getAgeByBirth(bornDate);
info.setAge(ageByBirth);
});
return szxcJmInfos;
}
/**

@ -0,0 +1,45 @@
package com.ruoyi.szxc.util;
import java.util.Calendar;
import java.util.Date;
public class GetAgeByBirthdayUtil {
/**
*
*
* @param birthday
* @return: int
*/
public static int getAgeByBirth(Date birthday){
//获取当前时间
Calendar cal = Calendar.getInstance();
//获取出生日期的Calendar对象
Calendar bir = Calendar.getInstance();
bir.setTime(birthday);
//如果出生日期大于当前日期则返回0
if(cal.before(birthday)){
return 0;
}
//取出当前年月日
int nowYear = cal.get(Calendar.YEAR);
int nowMonth = cal.get(Calendar.MONTH);
int nowDay = cal.get(Calendar.DAY_OF_MONTH);
//取出出生日期的年月日
int birthYear = bir.get(Calendar.YEAR);
int birthMonth = bir.get(Calendar.MONTH);
int birthDay = bir.get(Calendar.DAY_OF_MONTH);
//计算年份
int age = nowYear - birthYear;
//计算月份和日,看看是否大于当前月日,如果小于则减去一岁
if(nowMonth < birthMonth || (nowMonth == birthMonth && nowDay < birthDay)){
age--;
}
return age;
}
}

@ -18,8 +18,10 @@
<result property="xName" column="x_name" />
<result property="xIdCard" column="x_id_card" />
<result property="relation" column="relation" />
<result property="number" column="number" />
<result property="bgTime" column="bg_time" />
<result property="hjAddress" column="hj_address" />
<result property="jgNature" column="jg_nature" />
<result property="longLive" column="long_live" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@ -27,10 +29,11 @@
<result property="updateTime" column="update_time" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="deptName" column="dept_name" />
</resultMap>
<sql id="selectSzxcHkbgRecardVo">
select id, acount_no, jm_id, name, id_card, y_jm_id, y_name, y_id_card, bg_reason, x_jm_id, x_name, x_id_card, relation, number, bg_time, remark, create_by, create_time, update_by, update_time, dept_id, user_id from szxc_hkbg_recard
select id, acount_no, jm_id, name, id_card, y_jm_id, y_name, y_id_card, bg_reason, x_jm_id, x_name, x_id_card, relation, bg_time, hj_address, jg_nature, long_live, remark, create_by, create_time, update_by, update_time, dept_id, user_id, dept_name from szxc_hkbg_recard
</sql>
<select id="selectSzxcHkbgRecardList" parameterType="SzxcHkbgRecard" resultMap="SzxcHkbgRecardResult">
@ -48,10 +51,13 @@
<if test="xName != null and xName != ''"> and x_name like concat('%', #{xName}, '%')</if>
<if test="xIdCard != null and xIdCard != ''"> and x_id_card = #{xIdCard}</if>
<if test="relation != null and relation != ''"> and relation = #{relation}</if>
<if test="number != null and number != ''"> and number = #{number}</if>
<if test="bgTime != null "> and bg_time = #{bgTime}</if>
<if test="hjAddress != null and hjAddress != ''"> and hj_address = #{hjAddress}</if>
<if test="jgNature != null and jgNature != ''"> and jg_nature = #{jgNature}</if>
<if test="longLive != null and longLive != ''"> and long_live = #{longLive}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
</where>
</select>
@ -75,8 +81,10 @@
<if test="xName != null">x_name,</if>
<if test="xIdCard != null">x_id_card,</if>
<if test="relation != null">relation,</if>
<if test="number != null">number,</if>
<if test="bgTime != null">bg_time,</if>
<if test="hjAddress != null">hj_address,</if>
<if test="jgNature != null">jg_nature,</if>
<if test="longLive != null">long_live,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@ -84,6 +92,7 @@
<if test="updateTime != null">update_time,</if>
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
<if test="deptName != null">dept_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="acountNo != null">#{acountNo},</if>
@ -98,8 +107,10 @@
<if test="xName != null">#{xName},</if>
<if test="xIdCard != null">#{xIdCard},</if>
<if test="relation != null">#{relation},</if>
<if test="number != null">#{number},</if>
<if test="bgTime != null">#{bgTime},</if>
<if test="hjAddress != null">#{hjAddress},</if>
<if test="jgNature != null">#{jgNature},</if>
<if test="longLive != null">#{longLive},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@ -107,6 +118,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
<if test="deptName != null">#{deptName},</if>
</trim>
</insert>
@ -125,8 +137,10 @@
<if test="xName != null">x_name = #{xName},</if>
<if test="xIdCard != null">x_id_card = #{xIdCard},</if>
<if test="relation != null">relation = #{relation},</if>
<if test="number != null">number = #{number},</if>
<if test="bgTime != null">bg_time = #{bgTime},</if>
<if test="hjAddress != null">hj_address = #{hjAddress},</if>
<if test="jgNature != null">jg_nature = #{jgNature},</if>
<if test="longLive != null">long_live = #{longLive},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
@ -134,6 +148,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
</trim>
where id = #{id}
</update>

@ -65,10 +65,10 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="居民id" prop="xJmId">
<el-form-item label="居民id" prop="xJmId">
<el-input
v-model="queryParams.xJmId"
placeholder="请输入居民id"
placeholder="请输入居民id"
clearable
@keyup.enter.native="handleQuery"
/>
@ -97,14 +97,6 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="变更编号" prop="number">
<el-input
v-model="queryParams.number"
placeholder="请输入变更编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="变更时间" prop="bgTime">
<el-date-picker clearable
v-model="queryParams.bgTime"
@ -113,6 +105,30 @@
placeholder="请选择变更时间">
</el-date-picker>
</el-form-item>
<el-form-item label="户籍地址" prop="hjAddress">
<el-input
v-model="queryParams.hjAddress"
placeholder="请输入户籍地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="户籍性质" prop="jgNature">
<el-input
v-model="queryParams.jgNature"
placeholder="请输入户籍性质"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否常住" prop="longLive">
<el-input
v-model="queryParams.longLive"
placeholder="请输入是否常住"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="部门id" prop="deptId">
<el-input
v-model="queryParams.deptId"
@ -129,6 +145,14 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属网格" prop="deptName">
<el-input
v-model="queryParams.deptName"
placeholder="请输入所属网格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -192,19 +216,22 @@
<el-table-column label="原户主姓名" align="center" prop="yName" />
<el-table-column label="原户主身份证号" align="center" prop="yIdCard" />
<el-table-column label="变更原因(字典)" align="center" prop="bgReason" />
<el-table-column label="居民id" align="center" prop="xJmId" />
<el-table-column label="居民id" align="center" prop="xJmId" />
<el-table-column label="新户主姓名" align="center" prop="xName" />
<el-table-column label="新户主身份证号" align="center" prop="xIdCard" />
<el-table-column label="与户主关系" align="center" prop="relation" />
<el-table-column label="变更编号" align="center" prop="number" />
<el-table-column label="变更时间" align="center" prop="bgTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.bgTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="户籍地址" align="center" prop="hjAddress" />
<el-table-column label="户籍性质" align="center" prop="jgNature" />
<el-table-column label="是否常住" align="center" prop="longLive" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="部门id" align="center" prop="deptId" />
<el-table-column label="创建者ID" align="center" prop="userId" />
<el-table-column label="所属网格" align="center" prop="deptName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -260,8 +287,8 @@
<el-form-item label="变更原因(字典)" prop="bgReason">
<el-input v-model="form.bgReason" placeholder="请输入变更原因(字典)" />
</el-form-item>
<el-form-item label="居民id" prop="xJmId">
<el-input v-model="form.xJmId" placeholder="请输入居民id" />
<el-form-item label="居民id" prop="xJmId">
<el-input v-model="form.xJmId" placeholder="请输入居民id" />
</el-form-item>
<el-form-item label="新户主姓名" prop="xName">
<el-input v-model="form.xName" placeholder="请输入新户主姓名" />
@ -272,9 +299,6 @@
<el-form-item label="与户主关系" prop="relation">
<el-input v-model="form.relation" placeholder="请输入与户主关系" />
</el-form-item>
<el-form-item label="变更编号" prop="number">
<el-input v-model="form.number" placeholder="请输入变更编号" />
</el-form-item>
<el-form-item label="变更时间" prop="bgTime">
<el-date-picker clearable
v-model="form.bgTime"
@ -283,6 +307,15 @@
placeholder="请选择变更时间">
</el-date-picker>
</el-form-item>
<el-form-item label="户籍地址" prop="hjAddress">
<el-input v-model="form.hjAddress" placeholder="请输入户籍地址" />
</el-form-item>
<el-form-item label="户籍性质" prop="jgNature">
<el-input v-model="form.jgNature" placeholder="请输入户籍性质" />
</el-form-item>
<el-form-item label="是否常住" prop="longLive">
<el-input v-model="form.longLive" placeholder="请输入是否常住" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
@ -292,6 +325,9 @@
<el-form-item label="创建者ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入创建者ID" />
</el-form-item>
<el-form-item label="所属网格" prop="deptName">
<el-input v-model="form.deptName" placeholder="请输入所属网格" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -342,10 +378,13 @@
xName: null,
xIdCard: null,
relation: null,
number: null,
bgTime: null,
hjAddress: null,
jgNature: null,
longLive: null,
deptId: null,
userId: null
userId: null,
deptName: null
},
//
form: {},
@ -394,15 +433,18 @@
xName: null,
xIdCard: null,
relation: null,
number: null,
bgTime: null,
hjAddress: null,
jgNature: null,
longLive: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
userId: null
userId: null,
deptName: null
};
this.resetForm("form");
},

Loading…
Cancel
Save