人口基本信息-增加人口认领功能
人口基本信息-增加日志记录功能
This commit is contained in:
parent
faf12be8dd
commit
805e157050
@ -0,0 +1,50 @@
|
||||
package com.cm.population.controller.api.populationlog;
|
||||
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.population.pojo.dtos.populationlog.PopulationLogDTO;
|
||||
import com.cm.population.service.populationlog.IPopulationLogService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: PopulationInfoAppController
|
||||
* @Description: 基础人口创建人日志
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2023-10-24 11:55:46
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_PREFIX + "基础人口创建人日志接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/populationlog")
|
||||
public class PopulationLogApiController extends AbstractController {
|
||||
@Autowired
|
||||
private IPopulationLogService populationLogService;
|
||||
|
||||
@ApiOperation(value = "新增基础人口创建人日志", notes = "新增基础人口创建人日志接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("save/{populationInfoIds}")
|
||||
public SuccessResult save(@PathVariable("populationInfoIds") String populationInfoIds) {
|
||||
populationLogService.save(null, populationInfoIds);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "基础人口信息列表", notes = "基础人口信息列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list/{populationInfoId}")
|
||||
public List<PopulationLogDTO> list(@PathVariable("populationInfoId") String populationInfoId) {
|
||||
return populationLogService.list(null, populationInfoId);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.cm.population.controller.app.api.populationlog;
|
||||
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoDTO;
|
||||
import com.cm.population.pojo.dtos.populationlog.PopulationLogDTO;
|
||||
import com.cm.population.service.populationlog.IPopulationLogService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: PopulationInfoAppController
|
||||
* @Description: 基础人口创建人日志
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2023-10-24 11:55:46
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "基础人口创建人日志接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.APP_PREFIX + "/populationlog")
|
||||
public class PopulationLogAppController extends AbstractController {
|
||||
@Autowired
|
||||
private IPopulationLogService populationLogService;
|
||||
|
||||
@ApiOperation(value = "新增基础人口创建人日志", notes = "新增基础人口创建人日志接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("save/{populationInfoIds}")
|
||||
public SuccessResult save(@RequestHeader("token") String token, @PathVariable("populationInfoIds") String populationInfoIds) {
|
||||
populationLogService.save(token, populationInfoIds);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "基础人口信息列表", notes = "基础人口信息列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list/{populationInfoId}")
|
||||
public List<PopulationLogDTO> list(@RequestHeader("token") String token, @PathVariable("populationInfoId") String populationInfoId) {
|
||||
return populationLogService.list(token, populationInfoId);
|
||||
}
|
||||
|
||||
}
|
@ -57,4 +57,18 @@ public class PopulationInfoRouteController extends AbstractController {
|
||||
return new ModelAndView("populationinfo/query");
|
||||
}
|
||||
|
||||
@GetMapping("bind")
|
||||
public ModelAndView bind() {
|
||||
ModelAndView mv = new ModelAndView("populationinfo/bind");
|
||||
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
|
||||
mv.addObject("creator", userInfoBO.getUserId());
|
||||
return mv;
|
||||
}
|
||||
@GetMapping("log")
|
||||
public ModelAndView log(String populationInfoId) {
|
||||
ModelAndView mv = new ModelAndView("populationinfo/log");
|
||||
mv.addObject("populationInfoId", populationInfoId);
|
||||
return mv;
|
||||
}
|
||||
|
||||
}
|
@ -118,4 +118,6 @@ public interface IPopulationInfoDao {
|
||||
Integer count(Map<String, Object> params) throws SearchException;
|
||||
|
||||
PopulationInfoBaseDTO getBase(Map<String, Object> params);
|
||||
|
||||
void updateCreator(Map<String, Object> params);
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.cm.population.dao.populationlog;
|
||||
|
||||
import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.population.pojo.dtos.populationlog.PopulationLogDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IPopulationLogDao
|
||||
* @Description: 基础人口创建人修改日志
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2023-10-24 11:55:46
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Repository
|
||||
public interface IPopulationLogDao {
|
||||
|
||||
/**
|
||||
* 新增基础人口信息
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 基础人口信息列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<PopulationLogDTO> list(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 基础人口信息统计
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
Integer count(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
@ -177,6 +177,16 @@ public class PopulationInfoDTO {
|
||||
private Integer age;
|
||||
@ApiModelProperty(name = "创建人", value = "创建人")
|
||||
private String creator;
|
||||
@ApiModelProperty(name = "创建人姓名", value = "创建人姓名")
|
||||
private String creatorName;
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
|
||||
public List getLabelList() {
|
||||
return labelList == null ? new ArrayList() : labelList;
|
||||
|
@ -0,0 +1,117 @@
|
||||
package com.cm.population.pojo.dtos.populationlog;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: PopulationInfoLogDTO
|
||||
* @Description: 基础人口创建人调整记录
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2023-10-24 11:55:46
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class PopulationLogDTO {
|
||||
|
||||
@ApiModelProperty(name = "populationInfoId", value = "人员ID")
|
||||
private String populationInfoId;
|
||||
@ApiModelProperty(name = "populationLogId", value = "日志ID")
|
||||
private String populationLogId;
|
||||
@ApiModelProperty(name = "populationInfoNewCreatorName", value = "新的创建人姓名")
|
||||
private String populationInfoNewCreatorName;
|
||||
@ApiModelProperty(name = "populationInfoNewCreator", value = "新的创建人")
|
||||
private String populationInfoNewCreator;
|
||||
@ApiModelProperty(name = "populationInfoOldCreatorName", value = "旧的创建人姓名")
|
||||
private String populationInfoOldCreatorName;
|
||||
@ApiModelProperty(name = "populationInfoOldCreator", value = "旧的创建人")
|
||||
private String populationInfoOldCreator;
|
||||
@ApiModelProperty(name = "populationInfoContent", value = "日志内容")
|
||||
private String populationInfoContent;
|
||||
@ApiModelProperty(name = "populationInfoData", value = "日志内容")
|
||||
private String populationInfoData;
|
||||
@ApiModelProperty(name = "creator")
|
||||
private String creator;
|
||||
@ApiModelProperty(name = "gmtCreate")
|
||||
private String gmtCreate;
|
||||
|
||||
public String getPopulationInfoData() {
|
||||
return populationInfoData;
|
||||
}
|
||||
|
||||
public void setPopulationInfoData(String populationInfoData) {
|
||||
this.populationInfoData = populationInfoData;
|
||||
}
|
||||
|
||||
public String getPopulationInfoId() {
|
||||
return populationInfoId;
|
||||
}
|
||||
|
||||
public void setPopulationInfoId(String populationInfoId) {
|
||||
this.populationInfoId = populationInfoId;
|
||||
}
|
||||
|
||||
public String getPopulationLogId() {
|
||||
return populationLogId;
|
||||
}
|
||||
|
||||
public void setPopulationLogId(String populationLogId) {
|
||||
this.populationLogId = populationLogId;
|
||||
}
|
||||
|
||||
public String getPopulationInfoNewCreatorName() {
|
||||
return populationInfoNewCreatorName;
|
||||
}
|
||||
|
||||
public void setPopulationInfoNewCreatorName(String populationInfoNewCreatorName) {
|
||||
this.populationInfoNewCreatorName = populationInfoNewCreatorName;
|
||||
}
|
||||
|
||||
public String getPopulationInfoNewCreator() {
|
||||
return populationInfoNewCreator;
|
||||
}
|
||||
|
||||
public void setPopulationInfoNewCreator(String populationInfoNewCreator) {
|
||||
this.populationInfoNewCreator = populationInfoNewCreator;
|
||||
}
|
||||
|
||||
public String getPopulationInfoOldCreatorName() {
|
||||
return populationInfoOldCreatorName;
|
||||
}
|
||||
|
||||
public void setPopulationInfoOldCreatorName(String populationInfoOldCreatorName) {
|
||||
this.populationInfoOldCreatorName = populationInfoOldCreatorName;
|
||||
}
|
||||
|
||||
public String getPopulationInfoOldCreator() {
|
||||
return populationInfoOldCreator;
|
||||
}
|
||||
|
||||
public void setPopulationInfoOldCreator(String populationInfoOldCreator) {
|
||||
this.populationInfoOldCreator = populationInfoOldCreator;
|
||||
}
|
||||
|
||||
public String getPopulationInfoContent() {
|
||||
return populationInfoContent;
|
||||
}
|
||||
|
||||
public void setPopulationInfoContent(String populationInfoContent) {
|
||||
this.populationInfoContent = populationInfoContent;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(String gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
}
|
@ -194,7 +194,6 @@ public interface IPopulationInfoService {
|
||||
|
||||
SuccessResultList<List<PopulationInfoDTO>> listPageBySelf(String token, ListPage page);
|
||||
|
||||
|
||||
/**
|
||||
* 基础人口信息统计
|
||||
*
|
||||
@ -203,7 +202,7 @@ public interface IPopulationInfoService {
|
||||
*/
|
||||
Integer count(Map<String, Object> params);
|
||||
|
||||
|
||||
List<PopulationInfoDTO> listByHouseId(String houseId);
|
||||
|
||||
void updateCreator(String populationInfoId, String creator);
|
||||
}
|
@ -2,6 +2,8 @@ package com.cm.population.service.populationinfo.impl;
|
||||
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.plugin.oauth.service.user.IUserService;
|
||||
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||
import com.cm.common.plugin.pojo.dtos.dataarea.DataAreaDTO;
|
||||
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
|
||||
import com.cm.common.plugin.service.dataarea.IDataAreaService;
|
||||
@ -34,6 +36,7 @@ import com.cm.population.service.dispute.IDisputeService;
|
||||
import com.cm.population.service.drug.IDrugService;
|
||||
import com.cm.population.service.petition.IPetitionService;
|
||||
import com.cm.population.service.populationinfo.IPopulationInfoService;
|
||||
import com.cm.population.service.populationlog.IPopulationLogService;
|
||||
import com.cm.population.service.release.IReleaseService;
|
||||
import com.cm.population.service.security.ISecurityService;
|
||||
import com.cm.population.utils.IdCardVerifyUtil;
|
||||
@ -61,6 +64,9 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
@Autowired
|
||||
private IAreatreeDao iAreatreeDao;
|
||||
|
||||
@Autowired
|
||||
private IPopulationLogService iPopulationLogService;
|
||||
|
||||
@Override
|
||||
public DataAreaDTO getAreaByCode(String code) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
@ -267,7 +273,8 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
}else{
|
||||
setSaveInfo(token, params);
|
||||
}
|
||||
populationInfoDao.save(params);//
|
||||
populationInfoDao.save(params);
|
||||
iPopulationLogService.saveInit(token, populationInfoId, params);// 记录日志
|
||||
return populationInfoId;
|
||||
}
|
||||
|
||||
@ -278,6 +285,7 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
|
||||
@Override
|
||||
public void remove(String token, List<String> ids) {
|
||||
iPopulationLogService.delete(token, StringUtils.join(ids, "_"));
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("populationInfoIds", ids);
|
||||
if(StringUtils.isEmpty(token)) {
|
||||
@ -339,7 +347,24 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
}else{
|
||||
setUpdateInfo(token, params);
|
||||
}
|
||||
PopulationInfoDTO populationInfoDTO = get(populationInfoId);
|
||||
populationInfoDao.update(params);
|
||||
/**
|
||||
* 找出变更的字段
|
||||
*/
|
||||
Map<String, Object> oldParams = HashMapUtil.objectToMap(populationInfoDTO);
|
||||
Map<String, Object> change = new LinkedHashMap<>();
|
||||
for(Map.Entry<String, Object> p : oldParams.entrySet()) {
|
||||
Object obj = params.get(p.getKey());
|
||||
if (obj != null) {
|
||||
if(!obj.toString().equals(p.getValue())) {
|
||||
change.put(p.getKey(), p.getValue());
|
||||
change.put(p.getKey() + "New", obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (change.size() > 0)
|
||||
iPopulationLogService.update(token, populationInfoId, change);// 记录日志
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@ -400,11 +425,30 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
return getPO(params);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IUserService iUserService;
|
||||
|
||||
@Override
|
||||
public List<PopulationInfoDTO> list(Map<String, Object> params) {
|
||||
List<PopulationInfoDTO> listList = populationInfoDao.list(params);
|
||||
ArrayList<String> arr = new ArrayList();
|
||||
for(PopulationInfoDTO dto : listList) {
|
||||
arr.add(dto.getCreator());
|
||||
}
|
||||
// 查询用户
|
||||
List<UserResourceBO> jsonArray = iUserService.listUserResourceByIds(arr);
|
||||
UserResourceBO bo1 = new UserResourceBO();
|
||||
bo1.setUserId("1");
|
||||
bo1.setUserName("超级管理员");
|
||||
jsonArray.add(bo1);
|
||||
List<DataDictionaryDTO> list = iDataDictionaryService.listDictionaryByParentId("5ea50f00-3d76-492c-8680-9c30d50cce21");
|
||||
for(PopulationInfoDTO populationInfoDTO : listList) {
|
||||
for(UserResourceBO bo : jsonArray) {
|
||||
if (bo.getUserId().equals(populationInfoDTO.getCreator())) {
|
||||
populationInfoDTO.setCreatorName(bo.getUserName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (populationInfoDTO != null && !StringUtil.isEmpty(populationInfoDTO.getLabel()) && populationInfoDTO.getLabel().length() > 0) {
|
||||
List<PopulationInfoLabelDTO> dataList = new ArrayList<>();
|
||||
for(DataDictionaryDTO dto : list) {
|
||||
@ -456,4 +500,12 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
params.put("houseId", houseId);
|
||||
return list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCreator(String populationInfoId, String creator) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("populationInfoId", populationInfoId);
|
||||
params.put("creator", creator);
|
||||
populationInfoDao.updateCreator(params);
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.cm.population.service.populationlog;
|
||||
|
||||
import com.cm.common.plugin.pojo.dtos.dataarea.DataAreaDTO;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.population.pojo.bos.populationinfo.PopulationInfoBO;
|
||||
import com.cm.population.pojo.dtos.areatree.AreaZtreeDTO;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoDTO;
|
||||
import com.cm.population.pojo.dtos.populationlog.PopulationLogDTO;
|
||||
import com.cm.population.pojo.pos.populationinfo.PopulationInfoPO;
|
||||
import com.cm.population.pojo.vos.populationinfo.PopulationInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IPopulationInfoService
|
||||
* @Description: 基础人口信息
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2023-10-24 11:55:46
|
||||
* @Version: 3.0
|
||||
**/
|
||||
public interface IPopulationLogService {
|
||||
|
||||
/**
|
||||
* 修改认领人保存
|
||||
* @return
|
||||
*/
|
||||
void save(String token, String populationInfoIds);
|
||||
|
||||
/**
|
||||
* 首次人口信息保存
|
||||
* @param token
|
||||
* @param populationInfoId
|
||||
*/
|
||||
void saveInit(String token, String populationInfoId, Map<String, Object> changeData);
|
||||
|
||||
/**
|
||||
* 人口信息修改
|
||||
* @param token
|
||||
* @param populationInfoId
|
||||
*/
|
||||
void update(String token, String populationInfoId, Map<String, Object> changeData);
|
||||
|
||||
void delete(String token, String populationInfoIds);
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
List<PopulationLogDTO> list(String token, String populationInfoId);
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
Integer count(String populationInfoId);
|
||||
|
||||
}
|
@ -0,0 +1,359 @@
|
||||
package com.cm.population.service.populationlog.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.plugin.oauth.service.user.IUserService;
|
||||
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||
import com.cm.common.plugin.pojo.dtos.dataarea.DataAreaDTO;
|
||||
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
|
||||
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.pojo.bos.UserInfoBO;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.common.token.app.AppTokenManager;
|
||||
import com.cm.common.token.app.entity.AppTokenUser;
|
||||
import com.cm.common.utils.DateUtil;
|
||||
import com.cm.common.utils.HashMapUtil;
|
||||
import com.cm.common.utils.UUIDUtil;
|
||||
import com.cm.population.dao.areatree.IAreatreeDao;
|
||||
import com.cm.population.dao.populationinfo.IPopulationInfoDao;
|
||||
import com.cm.population.dao.populationlog.IPopulationLogDao;
|
||||
import com.cm.population.pojo.bos.populationinfo.PopulationInfoBO;
|
||||
import com.cm.population.pojo.dtos.areatree.AreaZtreeDTO;
|
||||
import com.cm.population.pojo.dtos.correct.CorrectDTO;
|
||||
import com.cm.population.pojo.dtos.cult.CultDTO;
|
||||
import com.cm.population.pojo.dtos.dispute.DisputeDTO;
|
||||
import com.cm.population.pojo.dtos.drug.DrugDTO;
|
||||
import com.cm.population.pojo.dtos.petition.PetitionDTO;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoDTO;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoLabelDTO;
|
||||
import com.cm.population.pojo.dtos.populationlog.PopulationLogDTO;
|
||||
import com.cm.population.pojo.dtos.release.ReleaseDTO;
|
||||
import com.cm.population.pojo.dtos.security.SecurityDTO;
|
||||
import com.cm.population.pojo.pos.populationinfo.PopulationInfoPO;
|
||||
import com.cm.population.pojo.vos.populationinfo.PopulationInfoVO;
|
||||
import com.cm.population.service.correct.ICorrectService;
|
||||
import com.cm.population.service.cult.ICultService;
|
||||
import com.cm.population.service.dispute.IDisputeService;
|
||||
import com.cm.population.service.drug.IDrugService;
|
||||
import com.cm.population.service.petition.IPetitionService;
|
||||
import com.cm.population.service.populationinfo.IPopulationInfoService;
|
||||
import com.cm.population.service.populationlog.IPopulationLogService;
|
||||
import com.cm.population.service.release.IReleaseService;
|
||||
import com.cm.population.service.security.ISecurityService;
|
||||
import com.cm.population.utils.IdCardVerifyUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.record.BOFRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import springfox.documentation.spring.web.json.Json;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @ClassName: PopulationLogServiceImpl
|
||||
* @Description: 基础人口日志
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2023-10-24 11:55:46
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Service
|
||||
public class PopulationLogServiceImpl extends AbstractService implements IPopulationLogService {
|
||||
|
||||
@Autowired
|
||||
private IPopulationLogDao populationLogDao;
|
||||
|
||||
@Autowired
|
||||
private IPopulationInfoService iPopulationInfoService;
|
||||
|
||||
@Autowired
|
||||
private IUserService iUserService;
|
||||
|
||||
public static final SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
|
||||
public static String getTime() {
|
||||
return sdfTime.format(new Date());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String token, String populationInfoIds) {
|
||||
List<String> ids = Arrays.asList(populationInfoIds.split("\\_"));
|
||||
Map<String, Object> queryPopulation = new HashMap<>();
|
||||
queryPopulation.put("populationInfoIds", ids);
|
||||
List<PopulationInfoDTO> populationList = iPopulationInfoService.list(queryPopulation);
|
||||
// 拼接creator;
|
||||
ArrayList<String> arr = new ArrayList();
|
||||
for(PopulationInfoDTO dto : populationList) {
|
||||
arr.add(dto.getCreator());
|
||||
}
|
||||
// 查询用户
|
||||
List<UserResourceBO> jsonArray = iUserService.listUserResourceByIds(arr);
|
||||
UserResourceBO bo1 = new UserResourceBO();
|
||||
bo1.setUserId("1");
|
||||
bo1.setUserName("超级管理员");
|
||||
jsonArray.add(bo1);
|
||||
// 获取登录人信息
|
||||
String creator = "";
|
||||
String creatorName = "";
|
||||
if(StringUtils.isEmpty(token)) {
|
||||
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
|
||||
if (userInfoBO != null) {
|
||||
creator = userInfoBO.getUserId();
|
||||
creatorName = userInfoBO.getUserName();
|
||||
}
|
||||
}else{
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
creator = appTokenUser.getId();
|
||||
creatorName = appTokenUser.getName();
|
||||
}
|
||||
if (StringUtils.isEmpty(creator)) {
|
||||
throw new SaveException("请先登录");
|
||||
}
|
||||
if (creatorName.equals("admin")) {
|
||||
creatorName = "超级管理员";
|
||||
}
|
||||
// 循环保存日志
|
||||
for(PopulationInfoDTO dto : populationList) {
|
||||
String populationInfoId = dto.getPopulationInfoId();
|
||||
String oldCreator = dto.getCreator();
|
||||
String oldCreatorName = "";
|
||||
for(UserResourceBO bo : jsonArray) {
|
||||
if (bo.getUserId().equals(oldCreator)) {
|
||||
oldCreatorName = bo.getUserName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
String gmtCreate = getTime();
|
||||
String content = "DELETE --- 登录人将." + dto.getName() + "[" + dto.getIdcard() + "]基础人员信息删除 操作人." + creatorName + "[" + creator + "]";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("populationLogId", UUIDUtil.get32UUID());
|
||||
params.put("populationInfoId", populationInfoId);
|
||||
params.put("populationInfoNewCreatorName", creatorName);
|
||||
params.put("populationInfoNewCreator", creator);
|
||||
params.put("populationInfoOldCreatorName", oldCreatorName);
|
||||
params.put("populationInfoOldCreator", oldCreator);
|
||||
params.put("populationInfoContent", content);
|
||||
params.put("creator", creator);
|
||||
params.put("gmtCreate", gmtCreate);
|
||||
populationLogDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveInit(String token, String populationInfoId, Map<String, Object> changeParams) {
|
||||
// 获取登录人信息
|
||||
String creator = "";
|
||||
String creatorName = "";
|
||||
if(StringUtils.isEmpty(token)) {
|
||||
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
|
||||
if (userInfoBO != null) {
|
||||
creator = userInfoBO.getUserId();
|
||||
creatorName = userInfoBO.getUserName();
|
||||
}
|
||||
}else{
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
creator = appTokenUser.getId();
|
||||
creatorName = appTokenUser.getName();
|
||||
}
|
||||
if (StringUtils.isEmpty(creator)) {
|
||||
throw new SaveException("请先登录");
|
||||
}
|
||||
if (creatorName.equals("admin")) {
|
||||
creatorName = "超级管理员";
|
||||
}
|
||||
String gmtCreate = getTime();
|
||||
PopulationInfoDTO dto = iPopulationInfoService.get(populationInfoId);
|
||||
String content = "INSERT --- 登录人将." + dto.getName() + "[" + dto.getIdcard() + "]基础人员信息创建 操作人." + creatorName + "[" + creator + "]";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("populationLogId", UUIDUtil.get32UUID());
|
||||
params.put("populationInfoId", populationInfoId);
|
||||
params.put("populationInfoNewCreatorName", creatorName);
|
||||
params.put("populationInfoNewCreator", creator);
|
||||
params.put("populationInfoOldCreatorName", "");
|
||||
params.put("populationInfoOldCreator", "");
|
||||
params.put("populationInfoContent", content);
|
||||
params.put("populationInfoData", JSON.toJSONString(changeParams));
|
||||
params.put("creator", creator);
|
||||
params.put("gmtCreate", gmtCreate);
|
||||
populationLogDao.save(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String token, String populationInfoId, Map<String, Object> changeParams) {
|
||||
// 获取登录人信息
|
||||
String creator = "";
|
||||
String creatorName = "";
|
||||
if(StringUtils.isEmpty(token)) {
|
||||
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
|
||||
if (userInfoBO != null) {
|
||||
creator = userInfoBO.getUserId();
|
||||
creatorName = userInfoBO.getUserName();
|
||||
}
|
||||
}else{
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
creator = appTokenUser.getId();
|
||||
creatorName = appTokenUser.getName();
|
||||
}
|
||||
if (StringUtils.isEmpty(creator)) {
|
||||
throw new SaveException("请先登录");
|
||||
}
|
||||
if (creatorName.equals("admin")) {
|
||||
creatorName = "超级管理员";
|
||||
}
|
||||
String gmtCreate = getTime();
|
||||
PopulationInfoDTO dto = iPopulationInfoService.get(populationInfoId);
|
||||
String content = "UPDATE --- 登录人将." + dto.getName() + "[" + dto.getIdcard() + "]基础人员信息修改 操作人." + creatorName + "[" + creator + "]";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("populationLogId", UUIDUtil.get32UUID());
|
||||
params.put("populationInfoId", populationInfoId);
|
||||
params.put("populationInfoNewCreatorName", creatorName);
|
||||
params.put("populationInfoNewCreator", creator);
|
||||
params.put("populationInfoOldCreatorName", "");
|
||||
params.put("populationInfoOldCreator", "");
|
||||
params.put("populationInfoContent", content);
|
||||
params.put("populationInfoData", JSON.toJSONString(changeParams));
|
||||
params.put("creator", creator);
|
||||
params.put("gmtCreate", gmtCreate);
|
||||
populationLogDao.save(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(String token, String populationInfoIds) {
|
||||
List<String> ids = Arrays.asList(populationInfoIds.split("\\_"));
|
||||
Map<String, Object> queryPopulation = new HashMap<>();
|
||||
queryPopulation.put("populationInfoIds", ids);
|
||||
List<PopulationInfoDTO> populationList = iPopulationInfoService.list(queryPopulation);
|
||||
// 拼接creator;
|
||||
ArrayList<String> arr = new ArrayList();
|
||||
for(PopulationInfoDTO dto : populationList) {
|
||||
arr.add(dto.getCreator());
|
||||
}
|
||||
// 查询用户
|
||||
List<UserResourceBO> jsonArray = iUserService.listUserResourceByIds(arr);
|
||||
UserResourceBO bo1 = new UserResourceBO();
|
||||
bo1.setUserId("1");
|
||||
bo1.setUserName("超级管理员");
|
||||
jsonArray.add(bo1);
|
||||
// 获取登录人信息
|
||||
String creator = "";
|
||||
String creatorName = "";
|
||||
if(StringUtils.isEmpty(token)) {
|
||||
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
|
||||
if (userInfoBO != null) {
|
||||
creator = userInfoBO.getUserId();
|
||||
creatorName = userInfoBO.getUserName();
|
||||
}
|
||||
}else{
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
creator = appTokenUser.getId();
|
||||
creatorName = appTokenUser.getName();
|
||||
}
|
||||
if (StringUtils.isEmpty(creator)) {
|
||||
throw new SaveException("请先登录");
|
||||
}
|
||||
if (creatorName.equals("admin")) {
|
||||
creatorName = "超级管理员";
|
||||
}
|
||||
// 循环保存日志
|
||||
for(PopulationInfoDTO dto : populationList) {
|
||||
String populationInfoId = dto.getPopulationInfoId();
|
||||
String oldCreator = dto.getCreator();
|
||||
if (oldCreator.equals(creator)) {// 人如果相同的不记录
|
||||
continue;
|
||||
}
|
||||
String oldCreatorName = "";
|
||||
for(UserResourceBO bo : jsonArray) {
|
||||
if (bo.getUserId().equals(oldCreator)) {
|
||||
oldCreatorName = bo.getUserName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
String gmtCreate = getTime();
|
||||
String content = "CHANGE --- 登录人将." + dto.getName() + "[" + dto.getIdcard() + "]基础人员信息的信息归属从." + oldCreatorName + "[" + oldCreator + "]修改为了." + creatorName + "[" + creator + "]";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("populationLogId", UUIDUtil.get32UUID());
|
||||
params.put("populationInfoId", populationInfoId);
|
||||
params.put("populationInfoNewCreatorName", creatorName);
|
||||
params.put("populationInfoNewCreator", creator);
|
||||
params.put("populationInfoOldCreatorName", oldCreatorName);
|
||||
params.put("populationInfoOldCreator", oldCreator);
|
||||
params.put("populationInfoContent", content);
|
||||
params.put("creator", creator);
|
||||
params.put("gmtCreate", gmtCreate);
|
||||
populationLogDao.save(params);
|
||||
// 修改创建人
|
||||
iPopulationInfoService.updateCreator(populationInfoId, creator);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PopulationLogDTO> list(String token, String populationInfoId) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("populationInfoId", StringUtils.isEmpty(populationInfoId) ? "-1" : populationInfoId);
|
||||
// 获取登录人信息
|
||||
String creator = "";
|
||||
if(StringUtils.isEmpty(token)) {
|
||||
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
|
||||
if (userInfoBO != null) {
|
||||
creator = userInfoBO.getUserId();
|
||||
}
|
||||
}else{
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
creator = appTokenUser.getId();
|
||||
}
|
||||
if (StringUtils.isEmpty(creator)) {
|
||||
throw new SaveException("请先登录");
|
||||
}
|
||||
List<PopulationLogDTO> list = populationLogDao.list(params);
|
||||
if (!creator.equals("1")) {
|
||||
for(PopulationLogDTO dto : list) {
|
||||
dto.setPopulationInfoData(""); // 不给返回操作的数据
|
||||
String populationInfoContent = dto.getPopulationInfoContent();
|
||||
Pattern pattern = Pattern.compile("[a-zA-Z0-9-]{36}");
|
||||
Matcher matcher = pattern.matcher(populationInfoContent);
|
||||
while(matcher.find()) {
|
||||
String data = matcher.group();
|
||||
String text = data.substring(0, 8) + "-*-*-*-*" + data.substring(30, 36);
|
||||
populationInfoContent = populationInfoContent.replace(data, text);
|
||||
}
|
||||
Pattern pattern2 = Pattern.compile("[X0-9]{18}");
|
||||
Matcher matcher2 = pattern2.matcher(populationInfoContent);
|
||||
while(matcher2.find()) {
|
||||
String idcard = matcher2.group();
|
||||
if (IdCardVerifyUtil.isIDCard(idcard)) {
|
||||
String text = IdCardVerifyUtil.desensitizeIdCardNumber(idcard);
|
||||
populationInfoContent = populationInfoContent.replace(idcard, text);
|
||||
}
|
||||
}
|
||||
Pattern pattern3 = Pattern.compile("[X0-9]{15}");
|
||||
Matcher matcher3 = pattern3.matcher(populationInfoContent);
|
||||
while(matcher3.find()) {
|
||||
String idcard = matcher3.group();
|
||||
if (IdCardVerifyUtil.isIDCard(idcard)) {
|
||||
String text = IdCardVerifyUtil.desensitizeIdCardNumber(idcard);
|
||||
populationInfoContent = populationInfoContent.replace(idcard, text);
|
||||
}
|
||||
}
|
||||
dto.setPopulationInfoContent(populationInfoContent);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer count(String populationInfoId) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("populationInfoId", StringUtils.isEmpty(populationInfoId) ? "-1" : populationInfoId);
|
||||
return populationLogDao.count(params);
|
||||
}
|
||||
}
|
@ -75,6 +75,11 @@ public class IdCardVerifyUtil {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 身份证号码脱敏
|
||||
* @param idCardNumber
|
||||
* @return
|
||||
*/
|
||||
public static String desensitizeIdCardNumber(String idCardNumber) {
|
||||
if (idCardNumber.length() < 15 || idCardNumber.length() > 18) {
|
||||
return idCardNumber;
|
||||
|
@ -404,6 +404,15 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateCreator" parameterType="map">
|
||||
UPDATE
|
||||
population_population_info
|
||||
SET
|
||||
creator = #{creator}
|
||||
WHERE
|
||||
population_info_id = #{populationInfoId}
|
||||
</update>
|
||||
|
||||
<!-- 删除基础人口信息 -->
|
||||
<update id="remove" parameterType="map">
|
||||
UPDATE
|
||||
|
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cm.population.dao.populationlog.IPopulationLogDao">
|
||||
|
||||
<resultMap id="populationLogDTO" type="com.cm.population.pojo.dtos.populationlog.PopulationLogDTO">
|
||||
<result column="population_info_id" property="populationInfoId"/>
|
||||
<result column="population_log_id" property="populationLogId"/>
|
||||
<result column="population_info_new_creator_name" property="populationInfoNewCreatorName"/>
|
||||
<result column="population_info_new_creator" property="populationInfoNewCreator"/>
|
||||
<result column="population_info_old_creator_name" property="populationInfoOldCreatorName"/>
|
||||
<result column="population_info_old_creator" property="populationInfoOldCreator"/>
|
||||
<result column="population_info_content" property="populationInfoContent"/>
|
||||
<result column="population_info_data" property="populationInfoData"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO population_population_log(
|
||||
population_log_id,
|
||||
population_info_id,
|
||||
population_info_new_creator_name,
|
||||
population_info_new_creator,
|
||||
population_info_old_creator_name,
|
||||
population_info_old_creator,
|
||||
population_info_content,
|
||||
population_info_data,
|
||||
creator,
|
||||
gmt_create
|
||||
) VALUES(
|
||||
#{populationLogId},
|
||||
#{populationInfoId},
|
||||
#{populationInfoNewCreatorName},
|
||||
#{populationInfoNewCreator},
|
||||
#{populationInfoOldCreatorName},
|
||||
#{populationInfoOldCreator},
|
||||
#{populationInfoContent},
|
||||
#{populationInfoData},
|
||||
#{creator},
|
||||
#{gmtCreate}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="list" parameterType="map" resultMap="populationLogDTO">
|
||||
SELECT
|
||||
t1.population_info_id,
|
||||
t1.population_log_id,
|
||||
t1.population_info_new_creator_name,
|
||||
t1.population_info_new_creator,
|
||||
t1.population_info_old_creator_name,
|
||||
t1.population_info_old_creator,
|
||||
t1.population_info_content,
|
||||
t1.population_info_data,
|
||||
t1.creator,
|
||||
t1.gmt_create
|
||||
FROM
|
||||
population_population_log t1
|
||||
WHERE
|
||||
t1.population_info_id = #{populationInfoId}
|
||||
ORDER BY
|
||||
t1.gmt_create DESC
|
||||
</select>
|
||||
|
||||
<select id="count" parameterType="map" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
population_population_log t1
|
||||
WHERE
|
||||
t1.population_info_id = #{populationInfoId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
244
src/main/resources/templates/populationinfo/bind.html
Normal file
244
src/main/resources/templates/populationinfo/bind.html
Normal file
@ -0,0 +1,244 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<style>
|
||||
.layui-form-select{
|
||||
min-width:200px!important;
|
||||
}
|
||||
.layui-select-title{
|
||||
min-width:200px!important;
|
||||
}
|
||||
.layui-select-title input{
|
||||
min-width:200px!important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="name" class="layui-input search-item" placeholder="请输入姓名">
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item" id="idcardTypeSelectTemplateBox" lay-filter="idcardTypeSelectTemplateBox"></div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="idcard" class="layui-input search-item" placeholder="请输入证件号">
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-check"></i> 认领选择的人员
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script id="idcardTypeSelectTemplate" type="text/html" lay-search>
|
||||
<select id="idcardType" name="idcardType">
|
||||
<option value="">请选择证件类型</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.dictionaryName}}">{{item.dictionaryName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'form', 'laytpl', 'laydate', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/populationinfo/listpage';
|
||||
|
||||
// 初始化证件类型下拉选择
|
||||
function initIdcardTypeSelect() {
|
||||
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('idcardTypeSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('idcardTypeSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'idcardTypeSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
initIdcardTypeSelect();
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
defaultToolbar: [],
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 90,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'name', width: 180, title: '姓名', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'idcardType', width: 180, title: '证件类型', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'idcard', width: 180, title: '证件号码', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'birthday', width: 180, title: '出生日期', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'sex', width: 180, title: '性别', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'nation', width: 180, title: '民族', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'creatorName', width: 180, title: '当前认领人', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
name: $('#name').val(),
|
||||
idcardType: $('#idcardType').val(),
|
||||
idcard: $('#idcard').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 90,
|
||||
});
|
||||
}
|
||||
|
||||
initTable();
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
// 事件 - 增删改
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'saveEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||
} else {
|
||||
var ids = '';
|
||||
for(var i = 0, item; item = checkDatas[i++];) {
|
||||
if(i > 1) {
|
||||
ids += '_';
|
||||
}
|
||||
ids += item['populationInfoId'];
|
||||
}
|
||||
window.sessionStorage.setItem("tempBindPopulationInfo", ids);
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -55,6 +55,9 @@
|
||||
<!-- <button type="button" class="layui-btn layui-btn-sm" style="display: none" lay-event="excelEvent">-->
|
||||
<!-- <i class="fa fa-lg fa-file-excel-o"></i>Excel导入-->
|
||||
<!-- </button>-->
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="bindEvent">
|
||||
认领人员
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="correctEvent">
|
||||
社区矫正
|
||||
</button>
|
||||
@ -142,7 +145,7 @@
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'name', width: 180, title: '姓名', align:'center',
|
||||
{field: 'name', width: 130, title: '姓名', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -151,7 +154,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'idcardType', width: 180, title: '证件类型', align:'center',
|
||||
{field: 'idcardType', width: 130, title: '证件类型', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -169,7 +172,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'birthday', width: 180, title: '出生日期', align:'center',
|
||||
{field: 'birthday', width: 130, title: '出生日期', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -178,7 +181,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'sex', width: 180, title: '性别', align:'center',
|
||||
{field: 'sex', width: 130, title: '性别', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -187,7 +190,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'nation', width: 180, title: '民族', align:'center',
|
||||
{field: 'nation', width: 130, title: '民族', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -208,6 +211,11 @@
|
||||
}
|
||||
return b;
|
||||
}
|
||||
},
|
||||
{field: 'creator', width:120, title: '认领记录', align:'center',
|
||||
templet: function(row) {
|
||||
return '<button type="button" lay-event="bindEvent" class="layui-btn layui-btn-xs" >认领记录</button>';
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
@ -238,6 +246,27 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 表格行中按钮事件
|
||||
table.on('tool(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var data = obj.data;
|
||||
if(layEvent === 'bindEvent') {
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
title: data.name + "[" + data.idcard + "]",
|
||||
closeBtn: 1,
|
||||
offset:"r",
|
||||
area: ['500px', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/populationinfo/log?populationInfoId={populationInfoId}', [data.populationInfoId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 删除
|
||||
function removeData(ids) {
|
||||
top.dialog.msg(top.dataMessage.delete, {
|
||||
@ -322,6 +351,37 @@
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
} else if(layEvent === 'bindEvent') {
|
||||
window.sessionStorage.setItem("tempBindPopulationInfo", null);
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
title: "认领基础人口信息",
|
||||
closeBtn: 1,
|
||||
area: ['90%', '90%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/populationinfo/bind', []),
|
||||
end: function() {
|
||||
try{
|
||||
var loadLayerIndex;
|
||||
var ids = window.sessionStorage.getItem("tempBindPopulationInfo");
|
||||
if(ids != null && ids != undefined && ids != 'null' && ids.length > 0) {
|
||||
top.restAjax.post(top.restAjax.path('api/populationlog/save/' + ids, []), {}, null, function(code, data) {
|
||||
layer.msg("认领成功");
|
||||
reloadTable();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
}catch(err){
|
||||
top.layer.msg('查询失败');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'excelEvent') {
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
|
@ -52,9 +52,9 @@
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" style="display: none" lay-event="excelEvent">
|
||||
<i class="fa fa-lg fa-file-excel-o"></i>Excel导入
|
||||
</button>
|
||||
<!-- <button type="button" class="layui-btn layui-btn-sm" style="display: none" lay-event="excelEvent">-->
|
||||
<!-- <i class="fa fa-lg fa-file-excel-o"></i>Excel导入-->
|
||||
<!-- </button>-->
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="correctEvent">
|
||||
社区矫正
|
||||
</button>
|
||||
@ -142,7 +142,7 @@
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'name', width: 180, title: '姓名', align:'center',
|
||||
{field: 'name', width: 130, title: '姓名', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -151,7 +151,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'idcardType', width: 180, title: '证件类型', align:'center',
|
||||
{field: 'idcardType', width: 130, title: '证件类型', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -169,7 +169,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'birthday', width: 180, title: '出生日期', align:'center',
|
||||
{field: 'birthday', width: 130, title: '出生日期', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -178,7 +178,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'sex', width: 180, title: '性别', align:'center',
|
||||
{field: 'sex', width: 130, title: '性别', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -187,7 +187,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'nation', width: 180, title: '民族', align:'center',
|
||||
{field: 'nation', width: 130, title: '民族', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -208,6 +208,11 @@
|
||||
}
|
||||
return b;
|
||||
}
|
||||
},
|
||||
{field: 'creator', width:120, title: '认领记录', align:'center',
|
||||
templet: function(row) {
|
||||
return '<button type="button" lay-event="bindEvent" class="layui-btn layui-btn-xs" >认领记录</button>';
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
@ -238,6 +243,27 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 表格行中按钮事件
|
||||
table.on('tool(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var data = obj.data;
|
||||
if(layEvent === 'bindEvent') {
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
title: data.name + "[" + data.idcard + "]",
|
||||
closeBtn: 1,
|
||||
offset:"r",
|
||||
area: ['500px', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/populationinfo/log?populationInfoId={populationInfoId}', [data.populationInfoId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 删除
|
||||
function removeData(ids) {
|
||||
top.dialog.msg(top.dataMessage.delete, {
|
||||
@ -322,7 +348,7 @@
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
} else if(layEvent === 'excelEvent') {
|
||||
}else if(layEvent === 'excelEvent') {
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
|
132
src/main/resources/templates/populationinfo/log.html
Normal file
132
src/main/resources/templates/populationinfo/log.html
Normal file
@ -0,0 +1,132 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
<link href="assets/js/vendor/json-viewer/jquery.json-viewer.css" type="text/css" rel="stylesheet" />
|
||||
<style>
|
||||
.layui-form-select dl {
|
||||
max-height: 200px !important;
|
||||
}
|
||||
pre{
|
||||
max-height:300px!important;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<div id="orderExpressTemplateBox"></div>
|
||||
<script id="orderExpressTemplate" type="text/html">
|
||||
<div class="layui-form-item layui-row">
|
||||
<div class="layui-col-lg12">
|
||||
<ul class="layui-timeline">
|
||||
{{# var list = d; }}
|
||||
{{# for(var i = 0 ; i < list.length; i++) { }}
|
||||
{{# var item = list[i]; }}
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h3 class="layui-timeline-title">{{ item.gmtCreate }}</h3>
|
||||
<p>
|
||||
{{ item.populationInfoContent }}
|
||||
</p>
|
||||
<pre id="{{ item.populationLogId }}"></pre>
|
||||
</div>
|
||||
</li>
|
||||
{{# } }}
|
||||
{{# if(list.length < 1 ) { }}
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h3 class="layui-timeline-title">无</h3>
|
||||
<p>
|
||||
无
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
{{# } }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/json-viewer/jquery-1.11.0.min.js"></script>
|
||||
<script src="assets/js/vendor/json-viewer/jquery.json-viewer.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var populationInfoId = top.restAjax.params(window.location.href).populationInfoId;
|
||||
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var viewerObj = {};
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$(window).keydown(function (event) {
|
||||
if (event.keyCode == 27) {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/populationlog/list/[[${populationInfoId}]]', []), {}, null, function(code, data) {
|
||||
laytpl(document.getElementById('orderExpressTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('orderExpressTemplateBox').innerHTML = html;
|
||||
});
|
||||
for(var i = 0 ; i < data.length ; i++) {
|
||||
if (data[i].populationInfoData)
|
||||
$('#' + data[i].populationLogId).jsonViewer(JSON.parse(data[i].populationInfoData), {collapsed:false});
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -99,6 +99,7 @@
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
defaultToolbar: [],
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 90,
|
||||
limit: 20,
|
||||
|
Loading…
Reference in New Issue
Block a user