|
@@ -84,6 +84,9 @@ public class PartyTwoServiceImpl implements PartyTwoService {
|
|
|
@Autowired
|
|
|
private PartyService partyService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private com.ghsc.partybuild.util.StringUtils stringUtils;
|
|
|
+
|
|
|
@Override
|
|
|
public DjDnpxxx getDnpxxx(String id) {
|
|
|
return dnpxxxMapper.selectByPrimaryKey(id);
|
|
@@ -909,4 +912,88 @@ public class PartyTwoServiceImpl implements PartyTwoService {
|
|
|
PageInfo<HashMap<String, Object>> result = new PageInfo(list);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> importDnpxxx(List<Map<String, Object>> dataList) throws Exception {
|
|
|
+ if (dataList.size() <= 0) {
|
|
|
+ throw new Exception("请添加导入数据");
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> errorList = new ArrayList<>();
|
|
|
+ List<CfDictionary> positionLevelList = dictionaryService.getDictionaryListByDicTypeKey("positionLevel");
|
|
|
+ List<CfDictionary> honourTypeList = dictionaryService.getDictionaryListByDicTypeKey("honourType");
|
|
|
+
|
|
|
+ for (int i = 0; i < dataList.size(); i++) {
|
|
|
+ String errorInfo = "";
|
|
|
+ Integer honourlevel = null;
|
|
|
+ Integer honourtype = null;
|
|
|
+ HashMap<String, Object> partyUserInfo = new HashMap<>();
|
|
|
+
|
|
|
+ int finalI = i;
|
|
|
+ if (stringUtils.IsNullOrEmpty((String) dataList.get(i).get("userName"))) {
|
|
|
+ errorInfo += "请填写党员姓名!";
|
|
|
+ } else {
|
|
|
+ partyUserInfo = partyUserService.getPartyUserExtByName((String) dataList.get(i).get("userName")); // 按名字查询出党员信息
|
|
|
+ if (partyUserInfo == null || partyUserInfo.isEmpty()) {
|
|
|
+ errorInfo += "该党员不存在!";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (stringUtils.IsNullOrEmpty((String) dataList.get(i).get("honourname"))) {
|
|
|
+ errorInfo += "请填写荣誉名称!";
|
|
|
+ }
|
|
|
+ if (stringUtils.IsNullOrEmpty((String) dataList.get(i).get("honourlevel"))) {
|
|
|
+ errorInfo += "请填写荣誉等级!";
|
|
|
+ } else {
|
|
|
+ honourlevel = positionLevelList.stream().filter(it -> it.getDicvalue().equals(dataList.get(finalI).get("honourlevel"))).findFirst().orElse(new CfDictionary()).getDickey();
|
|
|
+ if (honourlevel == null) {
|
|
|
+ errorInfo += "荣誉等级不存在!";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (stringUtils.IsNullOrEmpty((String) dataList.get(i).get("honourtime"))) {
|
|
|
+ errorInfo += "请填写获得荣誉时间!";
|
|
|
+ }
|
|
|
+ if (stringUtils.IsNullOrEmpty((String) dataList.get(i).get("honourtype"))) {
|
|
|
+ errorInfo += "请填写荣誉类型!";
|
|
|
+ } else {
|
|
|
+ honourtype = honourTypeList.stream().filter(it -> it.getDicvalue().equals(dataList.get(finalI).get("honourtype"))).findFirst().orElse(new CfDictionary()).getDickey();
|
|
|
+ if (honourtype == null) {
|
|
|
+ errorInfo += "荣誉等级不存在!";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (stringUtils.IsNullOrEmpty(errorInfo)) {
|
|
|
+ // 处理数据
|
|
|
+ // 创建实体类
|
|
|
+ DjDnpxxx model = new DjDnpxxx();
|
|
|
+ model.setId(UUID.randomUUID().toString());
|
|
|
+ model.setDzzdm((String) partyUserInfo.get("DZZDM"));
|
|
|
+ model.setDzzmc((String) partyUserInfo.get("DZZMC"));
|
|
|
+ model.setHonourlevel(honourlevel);
|
|
|
+ model.setHonourtype(honourtype);
|
|
|
+ model.setHonourname((String) dataList.get(i).get("honourname"));
|
|
|
+ model.setHonourtime(dateUtils.strToDateExt((String) dataList.get(i).get("honourtime")));
|
|
|
+ model.setPxlx("1");
|
|
|
+
|
|
|
+ UserItemVo userItem = new UserItemVo();
|
|
|
+ userItem.setRybm((String) partyUserInfo.get("RYBM"));
|
|
|
+ userItem.setXm((String) partyUserInfo.get("XM"));
|
|
|
+ UserItemVo[] vos = new UserItemVo[]{userItem};
|
|
|
+
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("model", model);
|
|
|
+ result.put("userItemVo", vos);
|
|
|
+ resultList.add(result);
|
|
|
+ } else {
|
|
|
+ dataList.get(i).put("errorInfo", errorInfo);
|
|
|
+ errorList.add(dataList.get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (errorList.isEmpty()) {
|
|
|
+ resultList.forEach(item -> {
|
|
|
+ RequsetData<String> stringRequsetData = saveDnpxxx((DjDnpxxx) item.get("model"), (UserItemVo[]) item.get("userItemVo"));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return errorList;
|
|
|
+ }
|
|
|
}
|