Browse Source

1.新增:删除特殊人员信息。2.将创建接口,改为保存接口,同时支持创建和修改

master
wxz 2 years ago
parent
commit
5ecc91771f
  1. 44
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java
  2. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailAzbjDao.java
  3. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJdryDao.java
  4. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJzhzDao.java
  5. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailSqjzDao.java
  6. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailXfryDao.java
  7. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java
  8. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java
  9. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java
  10. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java
  11. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailAzbjDao.xml
  12. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJdryDao.xml
  13. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJzhzDao.xml
  14. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailSqjzDao.xml
  15. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailXfryDao.xml
  16. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonDao.xml
  17. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml

44
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java

@ -3,6 +3,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.annotation.MaskResponse;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.FileUtils;
@ -13,6 +14,7 @@ import com.epmet.excel.data.*;
import com.epmet.service.LingShanSpecialCrowdService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -23,6 +25,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @description: 灵山社会维稳特殊人群
@ -104,40 +107,40 @@ public class LingShanSpecialCrowdController {
* @author: WangXianZhang
* @date: 2023/4/20 2:50 PM
*/
@PostMapping("anzhibangjiao/create")
public Result createSpecialCrowd(@RequestBody LingShanSpecialCrowdDetailAzbjExcelData azbjData) {
@PostMapping("anzhibangjiao/save")
public Result saveSpecialCrowd(@RequestBody LingShanSpecialCrowdDetailAzbjExcelData azbjData) {
ValidatorUtils.validateEntity(azbjData);
lingShanSpecialCrowdService.createSpecialCrowd(azbjData, "anzhibangjiao");
return new Result();
}
@PostMapping("xidurenyuan/create")
public Result createSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJdryExcelData jdryData) {
@PostMapping("xidurenyuan/save")
public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJdryExcelData jdryData) {
ValidatorUtils.validateEntity(jdryData);
lingShanSpecialCrowdService.createSpecialCrowd(jdryData, "xidurenyuan");
return new Result();
}
@PostMapping("jingzhanhuanzhe/create")
public Result createSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJzhzExcelData jzhzData) {
@PostMapping("jingzhanhuanzhe/save")
public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJzhzExcelData jzhzData) {
ValidatorUtils.validateEntity(jzhzData);
lingShanSpecialCrowdService.createSpecialCrowd(jzhzData, "jingzhanhuanzhe");
return new Result();
}
@PostMapping("shequjiaozheng/create")
public Result createSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailSqjzExcelData sqjzData) {
@PostMapping("shequjiaozheng/save")
public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailSqjzExcelData sqjzData) {
ValidatorUtils.validateEntity(sqjzData);
lingShanSpecialCrowdService.createSpecialCrowd(sqjzData, "shequjiaozheng");
return new Result();
}
@PostMapping("xinfangrenyuan/create")
public Result createSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailXfryExcelData xfryData) {
@PostMapping("xinfangrenyuan/save")
public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailXfryExcelData xfryData) {
ValidatorUtils.validateEntity(xfryData);
lingShanSpecialCrowdService.createSpecialCrowd(xfryData, "xinfangrenyuan");
@ -190,5 +193,26 @@ public class LingShanSpecialCrowdController {
return new Result<PageData<LingShanSpecialCrowdListResultDTO>>().ok(pd);
}
// 修改 todo
/**
* @description: 删除
* @param params:
* @return
* @author: WangXianZhang
* @date: 2023/4/21 9:40 AM
*/
@PostMapping("deleteByType")
public Result deleteByType(@RequestBody Map<String, String> params) {
String specialType = params.get("specialType");
String idCard = params.get("idCard");
if (StringUtils.isAnyBlank(specialType, idCard)) {
throw new ValidateException("特殊人群类型或身份证不能为空");
}
lingShanSpecialCrowdService.deleteByType(specialType, idCard);
return new Result();
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailAzbjDao.java

@ -17,4 +17,6 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailAzbjDao extends BaseDao<LingshanSpecialCrowdDetailAzbjEntity> {
void saveBatchManually(@Param("asbjList") List<LingshanSpecialCrowdDetailAzbjEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJdryDao.java

@ -17,4 +17,5 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailJdryDao extends BaseDao<LingshanSpecialCrowdDetailJdryEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailJdryEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJzhzDao.java

@ -17,4 +17,5 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailJzhzDao extends BaseDao<LingshanSpecialCrowdDetailJzhzEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailJzhzEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailSqjzDao.java

@ -17,4 +17,5 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailSqjzDao extends BaseDao<LingshanSpecialCrowdDetailSqjzEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailSqjzEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailXfryDao.java

@ -17,4 +17,5 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailXfryDao extends BaseDao<LingshanSpecialCrowdDetailXfryEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailXfryEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java

@ -18,4 +18,6 @@ import java.util.List;
public interface LingshanSpecialCrowdPersonDao extends BaseDao<LingshanSpecialCrowdPersonEntity> {
void saveOrUpdateManually(@Param("list") List<LingshanSpecialCrowdPersonEntity> list);
void deletePhysical(@Param("idCard") String idCard);
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java

@ -1,5 +1,6 @@
package com.epmet.dao;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO;
import com.epmet.entity.LingshanSpecialCrowdPersonTypeEntity;
@ -25,4 +26,6 @@ public interface LingshanSpecialCrowdPersonTypeDao extends BaseDao<LingshanSpeci
@Param("name") String name,
@Param("mobile") String mobile,
@Param("idCard") String idCard);
void deletePhysical(@Param("specialType") String specialType, @Param("idCard") String idCard);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java

@ -80,4 +80,6 @@ public interface LingShanSpecialCrowdService {
*/
PageData<LingShanSpecialCrowdListResultDTO> listSpecialCrowds(String orgId, String orgType, String specialType, String name, String mobile,
String idCard, Integer pageNo, Integer pageSize);
void deleteByType(String specialType, String idCard);
}

47
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java

@ -43,6 +43,7 @@ import com.epmet.service.LingShanSpecialCrowdService;
import com.epmet.utils.ImportTaskUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.dialect.helper.SqlServer2012Dialect;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
@ -52,6 +53,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.IOException;
@ -310,6 +312,12 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
@Override
public void createSpecialCrowd(LingShanSpecialCrowdDetailBaseExcelData specialData, String specialType) {
// 检查
String validateRst = validate(specialData);
if (StringUtils.isNotBlank(validateRst)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, validateRst);
}
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
String staffId = EpmetRequestHolder.getLoginUserId();
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staffId);
@ -317,12 +325,6 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
Date now = new Date();
// 检查
String validateRst = validate(specialData);
if (StringUtils.isNotBlank(validateRst)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, validateRst);
}
// 保存人员和类型信息
LingshanSpecialCrowdPersonEntity person = new LingshanSpecialCrowdPersonEntity(IdWorker.getIdStr(), customerId, orgIdPath, specialData.getName(), specialData.getIdCard(),
"0", 0, now, staffId, now, staffId);
@ -499,4 +501,37 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
});
return new PageData<>(l, new PageInfo<>(l).getTotal());
}
@Transactional
@Override
public void deleteByType(String specialType, String idCard) {
// 先删除type
specialCrowdPersonTypeDao.deletePhysical(specialType, idCard);
// 再删除detail
switch (specialType) {
case "anzhibangjiao":
specialCrowdDetailAzbjDao.deletePhysical(idCard);
break;
case "xinfangrenyuan":
specialCrowdDetailXfryDao.deletePhysical(idCard);
break;
case "xidurenyuan":
specialCrowdDetailJdryDao.deletePhysical(idCard);
break;
case "shequjiaozheng":
specialCrowdDetailSqjzDao.deletePhysical(idCard);
break;
case "jingzhanghuanzhe":
specialCrowdDetailJzhzDao.deletePhysical(idCard);
break;
}
LambdaQueryWrapper<LingshanSpecialCrowdPersonTypeEntity> q = new LambdaQueryWrapper<>();
q.eq(LingshanSpecialCrowdPersonTypeEntity::getIdCard, idCard);
if (specialCrowdPersonTypeDao.selectCount(q) == 0) {
// 没有type了,那就吧person也删了
specialCrowdPersonDao.deletePhysical(idCard);
}
}
}

3
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailAzbjDao.xml

@ -52,6 +52,9 @@
, UPDATED_BY = values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</update>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_azbj where ID_CARD=#{idCard}
</delete>
</mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJdryDao.xml

@ -31,6 +31,9 @@
UPDATED_BY = values(UPDATED_BY),
UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_jdry where ID_CARD=#{idCard}
</delete>
</mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJzhzDao.xml

@ -56,6 +56,9 @@
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_jzhz where ID_CARD=#{idCard}
</delete>
</mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailSqjzDao.xml

@ -54,6 +54,9 @@
, UPDATED_BY = values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_sqjz where ID_CARD=#{idCard}
</delete>
</mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailXfryDao.xml

@ -55,6 +55,9 @@
, UPDATED_BY = values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_xfry where ID_CARD=#{idCard}
</delete>
</mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonDao.xml

@ -40,6 +40,9 @@
, UPDATED_BY=values(UPDATED_BY)
, UPDATED_TIME=values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_person where ID_CARD = #{idCard}
</delete>
</mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml

@ -31,6 +31,9 @@
, UPDATED_BY =values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_person_type where ID_CARD = #{idCard} and SPECIAL_TYPE = #{specialType}
</delete>
<select id="listSpecialCrowds"
resultType="com.epmet.dto.result.LingShanSpecialCrowdListResultDTO">

Loading…
Cancel
Save