修改导入和列表页字典匹配的逻辑
This commit is contained in:
parent
47da52461d
commit
3cbc84c1dc
@ -100,7 +100,10 @@ public class BasePopulationInfoServiceImpl extends AbstractService implements IB
|
||||
@Override
|
||||
public void saveBasePopulationInfoImport(Map<String, Object> dataObj) {
|
||||
String idCardNumber = dataObj.get("idCardNumber").toString().toLowerCase();
|
||||
if("".equals(idCardNumber) || 18 != idCardNumber.length()){
|
||||
if("".equals(idCardNumber)){
|
||||
throw new SaveException("身份证号码错误");
|
||||
}
|
||||
if(15 != idCardNumber.length() && 18 != idCardNumber.length()){
|
||||
throw new SaveException("身份证号码错误");
|
||||
}
|
||||
Map<String, Object> queryMap = getHashMap(4);
|
||||
@ -114,7 +117,9 @@ public class BasePopulationInfoServiceImpl extends AbstractService implements IB
|
||||
String year = idCardNumber.substring(6,10);
|
||||
String month = idCardNumber.substring(10,12);
|
||||
String day = idCardNumber.substring(12,14);
|
||||
dataObj.put("birthDate",year + "-" + month + "-" + day);
|
||||
if(15 != idCardNumber.length()){
|
||||
dataObj.put("birthDate",year + "-" + month + "-" + day);
|
||||
}
|
||||
basePopulationInfoDao.saveBasePopulationInfo(dataObj);
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,15 @@ import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.exception.RemoveException;
|
||||
import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
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.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.common.utils.HashMapUtil;
|
||||
import com.cm.common.utils.UUIDUtil;
|
||||
import com.cm.population.dao.basepopulationinfo.IBasePopulationInfoDao;
|
||||
import com.cm.population.dao.communitycorrection.ICommunityCorrectionDao;
|
||||
import com.cm.population.pojo.dtos.basepopulationinfo.BasePopulationInfoDTO;
|
||||
import com.cm.population.pojo.dtos.communitycorrection.CommunityCorrectionDTO;
|
||||
@ -40,6 +43,11 @@ public class CommunityCorrectionServiceImpl extends AbstractService implements I
|
||||
@Autowired
|
||||
private IBasePopulationInfoService basePopulationInfoService;
|
||||
|
||||
@Autowired
|
||||
private IBasePopulationInfoDao basePopulationInfoDao;
|
||||
@Autowired
|
||||
private IDataDictionaryService dataDictionaryService;
|
||||
|
||||
@Override
|
||||
public SuccessResult saveCommunityCorrection(CommunityCorrectionVO communityCorrectionVO) throws Exception {
|
||||
saveCommunityCorrectionInfo(null, communityCorrectionVO);
|
||||
@ -184,12 +192,21 @@ public class CommunityCorrectionServiceImpl extends AbstractService implements I
|
||||
public CommunityCorrectionDTO getCommunityCorrectionById(String communityCorrectionId) throws SearchException {
|
||||
Map<String, Object> params = super.getHashMap(1);
|
||||
params.put("communityCorrectionId", communityCorrectionId);
|
||||
return communityCorrectionDao.getCommunityCorrection(params);
|
||||
CommunityCorrectionDTO dto = communityCorrectionDao.getCommunityCorrection(params);
|
||||
if(dto != null){
|
||||
DataDictionaryDTO dictDto = dataDictionaryService.getDictionaryById(dto.getGender());
|
||||
dto.setGender(dictDto.getDictionaryName());
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommunityCorrectionDTO getCommunityCorrectionInfo(Map<String, Object> params) throws SearchException {
|
||||
CommunityCorrectionDTO dto = communityCorrectionDao.getCommunityCorrection(params);
|
||||
if(dto != null){
|
||||
DataDictionaryDTO dictDto = dataDictionaryService.getDictionaryById(dto.getGender());
|
||||
dto.setGender(dictDto.getDictionaryName());
|
||||
}
|
||||
return dto == null ? new CommunityCorrectionDTO(): dto;
|
||||
}
|
||||
|
||||
@ -200,8 +217,19 @@ public class CommunityCorrectionServiceImpl extends AbstractService implements I
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<CommunityCorrectionDTO>> listPageCommunityCorrection(ListPage page) throws SearchException {
|
||||
//查询数据字典用于比对字典数据值
|
||||
List<Map<String, Object>> dicList = basePopulationInfoDao.listDictionaryAll();
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<CommunityCorrectionDTO> communityCorrectionDTOs = communityCorrectionDao.listCommunityCorrection(page.getParams());
|
||||
for(CommunityCorrectionDTO item : communityCorrectionDTOs){
|
||||
for(Map<String, Object> dictItem : dicList){
|
||||
String dicId = dictItem.get("dictionary_id").toString();
|
||||
//性别
|
||||
if(dicId.equals(item.getGender())){
|
||||
item.setGender(dictItem.get("dictionary_name").toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
PageInfo<CommunityCorrectionDTO> pageInfo = new PageInfo<>(communityCorrectionDTOs);
|
||||
return new SuccessResultList<>(communityCorrectionDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user