自定义列全局设置

This commit is contained in:
钱涛 2024-10-11 17:04:13 +08:00
parent 32b3ce97a9
commit b6c7a7f2bd
6 changed files with 53 additions and 21 deletions

View File

@ -0,0 +1,22 @@
package com.engine.salary.entity.setting.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 薪资帐套表
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PageListSettingQueryParam {
@DataCheck(require = true,message = "请选择页面")
private String page;
private String name;
}

View File

@ -10,6 +10,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.setting.param.PageListSettingQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
@ -359,7 +360,8 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
List<SalaryAcctResultPO> salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
// 3.获取薪资项目
Map setting = getSettingService(user).getPageListSetting("salary_details_report");
PageListSettingQueryParam param = PageListSettingQueryParam.builder().page("salary_details_report").build();
Map setting = getSettingService(user).getPageListSetting(param);
List<Long> checked = setting.get("checked") != null ? JsonUtil.parseList(setting.get("checked"), Long.class) : new ArrayList<>();
List<SalaryItemPO> salaryItemList = getSalaryItemService(user).listByIds(checked);
// salaryItemList = salaryItemList.stream()

View File

@ -1,5 +1,6 @@
package com.engine.salary.service;
import com.engine.salary.entity.setting.param.PageListSettingQueryParam;
import com.engine.salary.entity.setting.param.PageListSettingSaveParam;
import java.util.Map;
@ -7,5 +8,5 @@ import java.util.Map;
public interface SettingService {
void savePageListSetting(PageListSettingSaveParam pageListSettingSaveParam);
Map getPageListSetting(String page);
Map getPageListSetting(PageListSettingQueryParam param);
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.setting.param.PageListSettingQueryParam;
import com.engine.salary.entity.setting.param.PageListSettingSaveParam;
import com.engine.salary.entity.setting.po.PageListSettingPO;
import com.engine.salary.mapper.setting.PageListSettingMapper;
@ -67,25 +68,29 @@ public class SettingServiceImpl extends Service implements SettingService {
}
@Override
public Map getPageListSetting(String page) {
public Map getPageListSetting(PageListSettingQueryParam param) {
String page = param.getPage();
Map result = new HashMap();
PageListSettingPO pageListSettingPO = getPageListSettingMapper().getByPage(page);
if ("salary_details_report".equals(page)) {
List<SalaryItemPO> salaryItemList = getSalaryItemService(user).listAll();
salaryItemList = salaryItemList.stream()
.sorted(new Comparator<SalaryItemPO>() {
@Override
public int compare(SalaryItemPO o1, SalaryItemPO o2) {
if (o1.getSortedIndex() == null && o2.getSortedIndex() == null) {
Integer systemType1 = o1.getSystemType() == null ? 0 : o1.getSystemType();
Integer systemType2 = o2.getSystemType() == null ? 0 : o2.getSystemType();
return systemType1.compareTo(systemType2);
} else {
Integer sortedIndex1 = o1.getSortedIndex() == null ? 0 : o1.getSortedIndex();
Integer sortedIndex2 = o2.getSortedIndex() == null ? 0 : o2.getSortedIndex();
return sortedIndex2.compareTo(sortedIndex1);
}
.filter(po -> {
String name = param.getName();
if (StrUtil.isNotEmpty(name)) {
return po.getName() != null && po.getName().contains(name);
}
return true;
})
.sorted((o1, o2) -> {
if (o1.getSortedIndex() == null && o2.getSortedIndex() == null) {
Integer systemType1 = o1.getSystemType() == null ? 0 : o1.getSystemType();
Integer systemType2 = o2.getSystemType() == null ? 0 : o2.getSystemType();
return systemType1.compareTo(systemType2);
} else {
Integer sortedIndex1 = o1.getSortedIndex() == null ? 0 : o1.getSortedIndex();
Integer sortedIndex2 = o2.getSortedIndex() == null ? 0 : o2.getSortedIndex();
return sortedIndex2.compareTo(sortedIndex1);
}
})
.collect(Collectors.toList());

View File

@ -1,6 +1,7 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.setting.param.PageListSettingQueryParam;
import com.engine.salary.entity.setting.param.PageListSettingSaveParam;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryEnumUtil;
@ -65,11 +66,11 @@ public class SalaryCommonController {
return new ResponseResult<PageListSettingSaveParam, String>(user).run(getSalaryCommonWrapper(user)::savePageListSetting, param);
}
@GET
@POST
@Path("/pageList/get/setting")
@Produces(MediaType.APPLICATION_JSON)
public String getPageListSetting(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "page") String page) {
public String getPageListSetting(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody PageListSettingQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String, Map>(user).run(getSalaryCommonWrapper(user)::getPageListSetting, page);
return new ResponseResult<PageListSettingQueryParam, Map>(user).run(getSalaryCommonWrapper(user)::getPageListSetting, param);
}
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.setting.param.PageListSettingQueryParam;
import com.engine.salary.entity.setting.param.PageListSettingSaveParam;
import com.engine.salary.service.SalaryCacheService;
import com.engine.salary.service.SettingService;
@ -35,7 +36,7 @@ public class SalaryCommonWrapper extends Service {
}
public Map getPageListSetting(String page) {
return getSettingService(user).getPageListSetting(page);
public Map getPageListSetting(PageListSettingQueryParam param) {
return getSettingService(user).getPageListSetting(param);
}
}