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

main
hansha 2 years ago
parent 67ba4953ad
commit 342b178654

@ -1,25 +1,19 @@
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.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.szxc.domain.SzxcHjAddress;
import com.ruoyi.szxc.service.ISzxcHjAddressService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
@ -77,7 +71,7 @@ public class SzxcHjAddressController extends BaseController
@PostMapping
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
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.setUserId(getUserId());
return toAjax(szxcJmInfoService.insertSzxcJmInfo(szxcJmInfo));
return szxcJmInfoService.insertSzxcJmInfo(szxcJmInfo);
}
/**
@ -87,7 +87,7 @@ public class SzxcJmInfoController extends BaseController
@PutMapping
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
*
* @author hs
* @date 2024-03-15
* @date 2024-03-27
*/
public class SzxcHjAddress extends BaseEntity
{
@ -18,6 +18,10 @@ public class SzxcHjAddress extends BaseEntity
/** id */
private Long id;
/** 居民id */
@Excel(name = "居民id")
private Long jmId;
/** 姓名 */
@Excel(name = "姓名")
private String name;
@ -55,6 +59,15 @@ public class SzxcHjAddress extends BaseEntity
{
return id;
}
public void setJmId(Long jmId)
{
this.jmId = jmId;
}
public Long getJmId()
{
return jmId;
}
public void setName(String name)
{
this.name = name;
@ -123,6 +136,7 @@ public class SzxcHjAddress extends BaseEntity
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("jmId", getJmId())
.append("name", getName())
.append("idCard", getIdCard())
.append("acountNo", getAcountNo())

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

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

@ -1,12 +1,14 @@
package com.ruoyi.szxc.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.stereotype.Service;
import com.ruoyi.szxc.mapper.SzxcHjAddressMapper;
import com.ruoyi.szxc.domain.SzxcHjAddress;
import com.ruoyi.szxc.mapper.SzxcHjAddressMapper;
import com.ruoyi.szxc.service.ISzxcHjAddressService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Service
@ -17,7 +19,7 @@ import com.ruoyi.szxc.service.ISzxcHjAddressService;
@Service
public class SzxcHjAddressServiceImpl implements ISzxcHjAddressService
{
@Autowired
@Resource
private SzxcHjAddressMapper szxcHjAddressMapper;
/**
@ -51,10 +53,28 @@ public class SzxcHjAddressServiceImpl implements ISzxcHjAddressService
* @return
*/
@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());
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
*/
@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());
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.setLongLive(szxcHkbgRecard.getLongLive());
jmInfo.setJgNature(szxcHkbgRecard.getJgNature());
if(szxcHkbgRecard.getRelation().equals("1")){
jmInfo.setHead("0");
}else {
jmInfo.setHead("1");
}
try {
szxcJmInfoMapper.updateSzxcJmInfo(jmInfo);
} catch (Exception e) {

@ -1,6 +1,7 @@
package com.ruoyi.szxc.service.impl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.szxc.domain.SzxcJmInfo;
import com.ruoyi.szxc.mapper.SzxcJmInfoMapper;
@ -66,10 +67,21 @@ public class SzxcJmInfoServiceImpl implements ISzxcJmInfoService
* @return
*/
@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());
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
*/
@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());
return szxcJmInfoMapper.updateSzxcJmInfo(szxcJmInfo);
int result = szxcJmInfoMapper.updateSzxcJmInfo(szxcJmInfo);
if(result>0){
return AjaxResult.success();
}
return AjaxResult.error();
}
/**

@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SzxcHjAddress" id="SzxcHjAddressResult">
<result property="id" column="id" />
<result property="jmId" column="jm_id" />
<result property="name" column="name" />
<result property="idCard" column="id_card" />
<result property="acountNo" column="acount_no" />
@ -20,12 +21,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<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>
<select id="selectSzxcHjAddressList" parameterType="SzxcHjAddress" resultMap="SzxcHjAddressResult">
<include refid="selectSzxcHjAddressVo"/>
<where>
<if test="jmId != null "> and jm_id = #{jmId}</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="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 into szxc_hj_address
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jmId != null">jm_id,</if>
<if test="name != null">name,</if>
<if test="idCard != null">id_card,</if>
<if test="acountNo != null">acount_no,</if>
@ -57,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jmId != null">#{jmId},</if>
<if test="name != null">#{name},</if>
<if test="idCard != null">#{idCard},</if>
<if test="acountNo != null">#{acountNo},</if>
@ -74,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateSzxcHjAddress" parameterType="SzxcHjAddress">
update szxc_hj_address
<trim prefix="SET" suffixOverrides=",">
<if test="jmId != null">jm_id = #{jmId},</if>
<if test="name != null">name = #{name},</if>
<if test="idCard != null">id_card = #{idCard},</if>
<if test="acountNo != null">acount_no = #{acountNo},</if>

Loading…
Cancel
Save