|
@@ -1,11 +1,11 @@
|
|
package com.xjrsoft.module.personnel.service.impl;
|
|
package com.xjrsoft.module.personnel.service.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
+import com.google.gson.JsonObject;
|
|
|
|
+import com.google.gson.JsonParser;
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalMonthPageDto;
|
|
import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalMonthPageDto;
|
|
@@ -23,9 +23,8 @@ import lombok.AllArgsConstructor;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
|
+import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Map;
|
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -50,15 +49,15 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
|
|
User user = userService.getById(userId);
|
|
User user = userService.getById(userId);
|
|
dto.setJobNumber(user.getUserName());
|
|
dto.setJobNumber(user.getUserName());
|
|
Page<BasePersonnelLabourCapitalMonthPageVo> resultPage = labourCapitalMapper.getMonthPage(page, dto);
|
|
Page<BasePersonnelLabourCapitalMonthPageVo> resultPage = labourCapitalMapper.getMonthPage(page, dto);
|
|
-
|
|
|
|
|
|
+ JsonParser parser = new JsonParser();
|
|
for (BasePersonnelLabourCapitalMonthPageVo record : resultPage.getRecords()) {
|
|
for (BasePersonnelLabourCapitalMonthPageVo record : resultPage.getRecords()) {
|
|
- JSONObject extendJsonObj = JSON.parseObject(record.getPendingJson());
|
|
|
|
- Map<String, Object> newDict = new HashMap<>();
|
|
|
|
|
|
+ JsonObject extendJsonObj = parser.parse(record.getPendingJson()).getAsJsonObject();
|
|
|
|
+ LinkedHashMap<String, Object> newDict = new LinkedHashMap<>();
|
|
|
|
|
|
for (String key : extendJsonObj.keySet()) {
|
|
for (String key : extendJsonObj.keySet()) {
|
|
- String bpName = getBpName(key);
|
|
|
|
|
|
+ String bpName = getBpName(record.getLabourCapitalId(), key);
|
|
if (bpName != null) {
|
|
if (bpName != null) {
|
|
- newDict.put(bpName, extendJsonObj.getString(key));
|
|
|
|
|
|
+ newDict.put(bpName, extendJsonObj.get(key).isJsonNull()?"-":extendJsonObj.get(key).getAsString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -76,8 +75,13 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
|
|
return labourCapitalMapper.getYearPage(page, dto);
|
|
return labourCapitalMapper.getYearPage(page, dto);
|
|
}
|
|
}
|
|
|
|
|
|
- private String getBpName(String columnNumber) {
|
|
|
|
- List<BasePersonnelLabourCapitalTitle> bpTitles = capitalTitleMapper.selectList(Wrappers.<BasePersonnelLabourCapitalTitle>lambdaQuery().eq(BasePersonnelLabourCapitalTitle::getColumnNumber, columnNumber));
|
|
|
|
|
|
+ private String getBpName(Long labourCapitalId, String columnNumber) {
|
|
|
|
+ List<BasePersonnelLabourCapitalTitle> bpTitles = capitalTitleMapper.selectList(
|
|
|
|
+ Wrappers.<BasePersonnelLabourCapitalTitle>lambdaQuery()
|
|
|
|
+ .eq(BasePersonnelLabourCapitalTitle::getColumnNumber, columnNumber)
|
|
|
|
+ .eq(BasePersonnelLabourCapitalTitle::getLabourCapitalId, labourCapitalId)
|
|
|
|
+ .orderByDesc(BasePersonnelLabourCapitalTitle::getRowsNumber)
|
|
|
|
+ );
|
|
if (bpTitles != null && !bpTitles.isEmpty()) {
|
|
if (bpTitles != null && !bpTitles.isEmpty()) {
|
|
return bpTitles.get(0).getName();
|
|
return bpTitles.get(0).getName();
|
|
} else {
|
|
} else {
|