户主、居民身份证重复验证

main
hansha 2 years ago
parent 67ba4953ad
commit 342b178654

@ -1,25 +1,19 @@
package com.ruoyi.szxc.controller; package com.ruoyi.szxc.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.szxc.domain.SzxcHjAddress; import com.ruoyi.szxc.domain.SzxcHjAddress;
import com.ruoyi.szxc.service.ISzxcHjAddressService; import com.ruoyi.szxc.service.ISzxcHjAddressService;
import com.ruoyi.common.utils.poi.ExcelUtil; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* Controller * Controller
@ -77,7 +71,7 @@ public class SzxcHjAddressController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SzxcHjAddress szxcHjAddress) public AjaxResult add(@RequestBody SzxcHjAddress szxcHjAddress)
{ {
return toAjax(szxcHjAddressService.insertSzxcHjAddress(szxcHjAddress)); return szxcHjAddressService.insertSzxcHjAddress(szxcHjAddress);
} }
/** /**
@ -88,7 +82,7 @@ public class SzxcHjAddressController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody SzxcHjAddress szxcHjAddress) public AjaxResult edit(@RequestBody SzxcHjAddress szxcHjAddress)
{ {
return toAjax(szxcHjAddressService.updateSzxcHjAddress(szxcHjAddress)); return szxcHjAddressService.updateSzxcHjAddress(szxcHjAddress);
} }
/** /**

@ -76,7 +76,7 @@ public class SzxcJmInfoController extends BaseController
szxcJmInfo.setDeptId(getDeptId()); szxcJmInfo.setDeptId(getDeptId());
} }
szxcJmInfo.setUserId(getUserId()); szxcJmInfo.setUserId(getUserId());
return toAjax(szxcJmInfoService.insertSzxcJmInfo(szxcJmInfo)); return szxcJmInfoService.insertSzxcJmInfo(szxcJmInfo);
} }
/** /**
@ -87,7 +87,7 @@ public class SzxcJmInfoController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody SzxcJmInfo szxcJmInfo) public AjaxResult edit(@RequestBody SzxcJmInfo szxcJmInfo)
{ {
return toAjax(szxcJmInfoService.updateSzxcJmInfo(szxcJmInfo)); return szxcJmInfoService.updateSzxcJmInfo(szxcJmInfo);
} }
/** /**

@ -9,7 +9,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* szxc_hj_address * szxc_hj_address
* *
* @author hs * @author hs
* @date 2024-03-15 * @date 2024-03-27
*/ */
public class SzxcHjAddress extends BaseEntity public class SzxcHjAddress extends BaseEntity
{ {
@ -18,6 +18,10 @@ public class SzxcHjAddress extends BaseEntity
/** id */ /** id */
private Long id; private Long id;
/** 居民id */
@Excel(name = "居民id")
private Long jmId;
/** 姓名 */ /** 姓名 */
@Excel(name = "姓名") @Excel(name = "姓名")
private String name; private String name;
@ -55,6 +59,15 @@ public class SzxcHjAddress extends BaseEntity
{ {
return id; return id;
} }
public void setJmId(Long jmId)
{
this.jmId = jmId;
}
public Long getJmId()
{
return jmId;
}
public void setName(String name) public void setName(String name)
{ {
this.name = name; this.name = name;
@ -122,18 +135,19 @@ public class SzxcHjAddress extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("name", getName()) .append("jmId", getJmId())
.append("idCard", getIdCard()) .append("name", getName())
.append("acountNo", getAcountNo()) .append("idCard", getIdCard())
.append("hjAddress", getHjAddress()) .append("acountNo", getAcountNo())
.append("createBy", getCreateBy()) .append("hjAddress", getHjAddress())
.append("createTime", getCreateTime()) .append("createBy", getCreateBy())
.append("updateBy", getUpdateBy()) .append("createTime", getCreateTime())
.append("updateTime", getUpdateTime()) .append("updateBy", getUpdateBy())
.append("deptId", getDeptId()) .append("updateTime", getUpdateTime())
.append("deptName", getDeptName()) .append("deptId", getDeptId())
.append("userId", getUserId()) .append("deptName", getDeptName())
.toString(); .append("userId", getUserId())
.toString();
} }
} }

@ -1,8 +1,10 @@
package com.ruoyi.szxc.service; package com.ruoyi.szxc.service;
import java.util.List; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.szxc.domain.SzxcHjAddress; import com.ruoyi.szxc.domain.SzxcHjAddress;
import java.util.List;
/** /**
* Service * Service
* *
@ -33,7 +35,7 @@ public interface ISzxcHjAddressService
* @param szxcHjAddress * @param szxcHjAddress
* @return * @return
*/ */
public int insertSzxcHjAddress(SzxcHjAddress szxcHjAddress); public AjaxResult insertSzxcHjAddress(SzxcHjAddress szxcHjAddress);
/** /**
* *
@ -41,7 +43,7 @@ public interface ISzxcHjAddressService
* @param szxcHjAddress * @param szxcHjAddress
* @return * @return
*/ */
public int updateSzxcHjAddress(SzxcHjAddress szxcHjAddress); public AjaxResult updateSzxcHjAddress(SzxcHjAddress szxcHjAddress);
/** /**
* *

@ -1,5 +1,6 @@
package com.ruoyi.szxc.service; package com.ruoyi.szxc.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.szxc.domain.SzxcJmInfo; import com.ruoyi.szxc.domain.SzxcJmInfo;
import java.util.List; import java.util.List;
@ -34,7 +35,7 @@ public interface ISzxcJmInfoService
* @param szxcJmInfo * @param szxcJmInfo
* @return * @return
*/ */
public int insertSzxcJmInfo(SzxcJmInfo szxcJmInfo); public AjaxResult insertSzxcJmInfo(SzxcJmInfo szxcJmInfo);
/** /**
* *
@ -42,7 +43,7 @@ public interface ISzxcJmInfoService
* @param szxcJmInfo * @param szxcJmInfo
* @return * @return
*/ */
public int updateSzxcJmInfo(SzxcJmInfo szxcJmInfo); public AjaxResult updateSzxcJmInfo(SzxcJmInfo szxcJmInfo);
/** /**
* *

@ -1,12 +1,14 @@
package com.ruoyi.szxc.service.impl; package com.ruoyi.szxc.service.impl;
import java.util.List; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.szxc.mapper.SzxcHjAddressMapper;
import com.ruoyi.szxc.domain.SzxcHjAddress; import com.ruoyi.szxc.domain.SzxcHjAddress;
import com.ruoyi.szxc.mapper.SzxcHjAddressMapper;
import com.ruoyi.szxc.service.ISzxcHjAddressService; import com.ruoyi.szxc.service.ISzxcHjAddressService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/** /**
* Service * Service
@ -17,7 +19,7 @@ import com.ruoyi.szxc.service.ISzxcHjAddressService;
@Service @Service
public class SzxcHjAddressServiceImpl implements ISzxcHjAddressService public class SzxcHjAddressServiceImpl implements ISzxcHjAddressService
{ {
@Autowired @Resource
private SzxcHjAddressMapper szxcHjAddressMapper; private SzxcHjAddressMapper szxcHjAddressMapper;
/** /**
@ -51,10 +53,28 @@ public class SzxcHjAddressServiceImpl implements ISzxcHjAddressService
* @return * @return
*/ */
@Override @Override
public int insertSzxcHjAddress(SzxcHjAddress szxcHjAddress) public AjaxResult insertSzxcHjAddress(SzxcHjAddress szxcHjAddress)
{ {
//户号重复验证
SzxcHjAddress hjAddress = new SzxcHjAddress();
hjAddress.setAcountNo(szxcHjAddress.getAcountNo());
List<SzxcHjAddress> szxcHjAddresses = szxcHjAddressMapper.selectSzxcHjAddressList(hjAddress);
if(szxcHjAddresses!=null&&szxcHjAddresses.size()>0){
return AjaxResult.error("户号已存在");
}
//身份证重复验证
hjAddress.setAcountNo(null);
hjAddress.setIdCard(szxcHjAddress.getIdCard());
szxcHjAddresses=szxcHjAddressMapper.selectSzxcHjAddressList(hjAddress);
if(szxcHjAddresses!=null&&szxcHjAddresses.size()>0){
return AjaxResult.error("身份证号已存在");
}
szxcHjAddress.setCreateTime(DateUtils.getNowDate()); szxcHjAddress.setCreateTime(DateUtils.getNowDate());
return szxcHjAddressMapper.insertSzxcHjAddress(szxcHjAddress); int result = szxcHjAddressMapper.insertSzxcHjAddress(szxcHjAddress);
if (result>0){
return AjaxResult.success("操作成功");
}
return AjaxResult.error("操作失败");
} }
/** /**
@ -64,10 +84,28 @@ public class SzxcHjAddressServiceImpl implements ISzxcHjAddressService
* @return * @return
*/ */
@Override @Override
public int updateSzxcHjAddress(SzxcHjAddress szxcHjAddress) public AjaxResult updateSzxcHjAddress(SzxcHjAddress szxcHjAddress)
{ {
//户号重复验证
SzxcHjAddress hjAddress = new SzxcHjAddress();
hjAddress.setAcountNo(szxcHjAddress.getAcountNo());
List<SzxcHjAddress> szxcHjAddresses = szxcHjAddressMapper.selectSzxcHjAddressList(hjAddress);
if(szxcHjAddresses!=null&&szxcHjAddresses.size()>0){
return AjaxResult.error("户号已存在");
}
//身份证重复验证
hjAddress.setAcountNo(null);
hjAddress.setIdCard(szxcHjAddress.getIdCard());
szxcHjAddresses=szxcHjAddressMapper.selectSzxcHjAddressList(hjAddress);
if(szxcHjAddresses!=null&&szxcHjAddresses.size()>0){
return AjaxResult.error("身份证号已存在");
}
szxcHjAddress.setUpdateTime(DateUtils.getNowDate()); szxcHjAddress.setUpdateTime(DateUtils.getNowDate());
return szxcHjAddressMapper.updateSzxcHjAddress(szxcHjAddress); int result = szxcHjAddressMapper.updateSzxcHjAddress(szxcHjAddress);
if(result>0){
return AjaxResult.success("操作成功");
}
return AjaxResult.error("操作失败");
} }
/** /**

@ -69,6 +69,11 @@ public class SzxcHkbgRecardServiceImpl implements ISzxcHkbgRecardService
jmInfo.setRelation(szxcHkbgRecard.getRelation()); jmInfo.setRelation(szxcHkbgRecard.getRelation());
jmInfo.setLongLive(szxcHkbgRecard.getLongLive()); jmInfo.setLongLive(szxcHkbgRecard.getLongLive());
jmInfo.setJgNature(szxcHkbgRecard.getJgNature()); jmInfo.setJgNature(szxcHkbgRecard.getJgNature());
if(szxcHkbgRecard.getRelation().equals("1")){
jmInfo.setHead("0");
}else {
jmInfo.setHead("1");
}
try { try {
szxcJmInfoMapper.updateSzxcJmInfo(jmInfo); szxcJmInfoMapper.updateSzxcJmInfo(jmInfo);
} catch (Exception e) { } catch (Exception e) {

@ -1,6 +1,7 @@
package com.ruoyi.szxc.service.impl; package com.ruoyi.szxc.service.impl;
import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.szxc.domain.SzxcJmInfo; import com.ruoyi.szxc.domain.SzxcJmInfo;
import com.ruoyi.szxc.mapper.SzxcJmInfoMapper; import com.ruoyi.szxc.mapper.SzxcJmInfoMapper;
@ -66,10 +67,21 @@ public class SzxcJmInfoServiceImpl implements ISzxcJmInfoService
* @return * @return
*/ */
@Override @Override
public int insertSzxcJmInfo(SzxcJmInfo szxcJmInfo) public AjaxResult insertSzxcJmInfo(SzxcJmInfo szxcJmInfo)
{ {
//身份证号重复验证
SzxcJmInfo hj = new SzxcJmInfo();
hj.setCardId(szxcJmInfo.getCardId());
List<SzxcJmInfo> szxcJmInfos = szxcJmInfoMapper.selectSzxcJmInfoList(hj);
if(szxcJmInfos!=null&&szxcJmInfos.size()>0){
return AjaxResult.error("身份证号已存在");
}
szxcJmInfo.setCreateTime(DateUtils.getNowDate()); szxcJmInfo.setCreateTime(DateUtils.getNowDate());
return szxcJmInfoMapper.insertSzxcJmInfo(szxcJmInfo); int result = szxcJmInfoMapper.insertSzxcJmInfo(szxcJmInfo);
if(result>0){
return AjaxResult.success();
}
return AjaxResult.error();
} }
/** /**
@ -79,10 +91,21 @@ public class SzxcJmInfoServiceImpl implements ISzxcJmInfoService
* @return * @return
*/ */
@Override @Override
public int updateSzxcJmInfo(SzxcJmInfo szxcJmInfo) public AjaxResult updateSzxcJmInfo(SzxcJmInfo szxcJmInfo)
{ {
//身份证号重复验证
SzxcJmInfo hj = new SzxcJmInfo();
hj.setCardId(szxcJmInfo.getCardId());
List<SzxcJmInfo> szxcJmInfos = szxcJmInfoMapper.selectSzxcJmInfoList(hj);
if(szxcJmInfos!=null&&szxcJmInfos.size()>0){
return AjaxResult.error("身份证号已存在");
}
szxcJmInfo.setUpdateTime(DateUtils.getNowDate()); szxcJmInfo.setUpdateTime(DateUtils.getNowDate());
return szxcJmInfoMapper.updateSzxcJmInfo(szxcJmInfo); int result = szxcJmInfoMapper.updateSzxcJmInfo(szxcJmInfo);
if(result>0){
return AjaxResult.success();
}
return AjaxResult.error();
} }
/** /**

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.szxc.mapper.SzxcHjAddressMapper"> <mapper namespace="com.ruoyi.szxc.mapper.SzxcHjAddressMapper">
<resultMap type="SzxcHjAddress" id="SzxcHjAddressResult"> <resultMap type="SzxcHjAddress" id="SzxcHjAddressResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="jmId" column="jm_id" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="idCard" column="id_card" /> <result property="idCard" column="id_card" />
<result property="acountNo" column="acount_no" /> <result property="acountNo" column="acount_no" />
@ -20,12 +21,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectSzxcHjAddressVo"> <sql id="selectSzxcHjAddressVo">
select id, name, id_card, acount_no, hj_address, create_by, create_time, update_by, update_time, dept_id, dept_name, user_id from szxc_hj_address select id, jm_id, name, id_card, acount_no, hj_address, create_by, create_time, update_by, update_time, dept_id, dept_name, user_id from szxc_hj_address
</sql> </sql>
<select id="selectSzxcHjAddressList" parameterType="SzxcHjAddress" resultMap="SzxcHjAddressResult"> <select id="selectSzxcHjAddressList" parameterType="SzxcHjAddress" resultMap="SzxcHjAddressResult">
<include refid="selectSzxcHjAddressVo"/> <include refid="selectSzxcHjAddressVo"/>
<where> <where>
<if test="jmId != null "> and jm_id = #{jmId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <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="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="acountNo != null "> and acount_no = #{acountNo}</if> <if test="acountNo != null "> and acount_no = #{acountNo}</if>
@ -44,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertSzxcHjAddress" parameterType="SzxcHjAddress" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSzxcHjAddress" parameterType="SzxcHjAddress" useGeneratedKeys="true" keyProperty="id">
insert into szxc_hj_address insert into szxc_hj_address
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jmId != null">jm_id,</if>
<if test="name != null">name,</if> <if test="name != null">name,</if>
<if test="idCard != null">id_card,</if> <if test="idCard != null">id_card,</if>
<if test="acountNo != null">acount_no,</if> <if test="acountNo != null">acount_no,</if>
@ -55,8 +58,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null">dept_id,</if> <if test="deptId != null">dept_id,</if>
<if test="deptName != null">dept_name,</if> <if test="deptName != null">dept_name,</if>
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jmId != null">#{jmId},</if>
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
<if test="idCard != null">#{idCard},</if> <if test="idCard != null">#{idCard},</if>
<if test="acountNo != null">#{acountNo},</if> <if test="acountNo != null">#{acountNo},</if>
@ -68,12 +72,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null">#{deptId},</if> <if test="deptId != null">#{deptId},</if>
<if test="deptName != null">#{deptName},</if> <if test="deptName != null">#{deptName},</if>
<if test="userId != null">#{userId},</if> <if test="userId != null">#{userId},</if>
</trim> </trim>
</insert> </insert>
<update id="updateSzxcHjAddress" parameterType="SzxcHjAddress"> <update id="updateSzxcHjAddress" parameterType="SzxcHjAddress">
update szxc_hj_address update szxc_hj_address
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="jmId != null">jm_id = #{jmId},</if>
<if test="name != null">name = #{name},</if> <if test="name != null">name = #{name},</if>
<if test="idCard != null">id_card = #{idCard},</if> <if test="idCard != null">id_card = #{idCard},</if>
<if test="acountNo != null">acount_no = #{acountNo},</if> <if test="acountNo != null">acount_no = #{acountNo},</if>

Loading…
Cancel
Save