weaver-hrm-salary/src/com/engine/salary/service/impl/SIAccountServiceImpl.java

264 lines
12 KiB
Java
Raw Normal View History

2022-04-11 19:07:35 +08:00
package com.engine.salary.service.impl;
2022-04-12 19:29:19 +08:00
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.util.ConditionFactory;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.pc.table.WeaTableOperate;
import com.cloudstore.eccom.pc.table.WeaTableOperates;
2022-04-11 19:07:35 +08:00
import com.cloudstore.eccom.result.WeaResultMsg;
2022-04-12 10:24:21 +08:00
import com.engine.common.util.ServiceUtil;
2022-04-11 19:07:35 +08:00
import com.engine.core.impl.Service;
import com.engine.salary.biz.SIAccountBiz;
import com.engine.salary.component.SalaryWeaTable;
2022-04-12 19:29:19 +08:00
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
2022-04-11 19:07:35 +08:00
import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO;
import com.engine.salary.entity.siaccount.param.InsuranceAccountBatchParam;
2022-04-12 10:24:21 +08:00
import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam;
2022-04-12 19:29:19 +08:00
import com.engine.salary.entity.siaccount.param.Permission;
2022-04-11 19:07:35 +08:00
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
2022-04-12 10:24:21 +08:00
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
2022-04-12 19:29:19 +08:00
import com.engine.salary.enums.siaccount.BillStatusEnum;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.service.ColumnBuildService;
2022-04-12 10:24:21 +08:00
import com.engine.salary.service.RecordsBuildService;
2022-04-11 19:07:35 +08:00
import com.engine.salary.service.SIAccountService;
import java.util.*;
2022-04-12 19:29:19 +08:00
import java.util.stream.Collectors;
2022-04-11 19:07:35 +08:00
2022-04-12 19:29:19 +08:00
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.db.MapperProxyFactory;
2022-04-11 19:07:35 +08:00
import com.engine.salary.util.page.PageInfo;
2022-04-12 19:29:19 +08:00
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
2022-04-12 10:24:21 +08:00
import weaver.hrm.User;
2022-04-11 19:07:35 +08:00
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/11
* @Version V1.0
**/
public class SIAccountServiceImpl extends Service implements SIAccountService {
private SIAccountBiz siAccountBiz = new SIAccountBiz();
2022-04-12 10:24:21 +08:00
public RecordsBuildService getService(User user) {
return ServiceUtil.getService(RecordsBuildServiceImpl.class,user);
}
2022-04-12 19:29:19 +08:00
public ColumnBuildService getColumnBuildService(User user) {
return ServiceUtil.getService(ColumnBuildServiceImpl.class,user);
}
2022-04-11 19:07:35 +08:00
@Override
public Map<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
Long employeeId = (long)user.getUID();
Map<String,Object> datas = new HashMap<>();
//福利台账列表
PageInfo<InsuranceAccountBatchPO> pageInfo = siAccountBiz.listPage(queryParam,employeeId);
Collection<InsuranceAccountBatchPO> insuranceAccountBatchPOS = pageInfo.getList();
List<InsuranceAccountBatchListDTO> insuranceAccountBatchListDTOS = InsuranceAccountBO.buildAccountBatchDTOList(insuranceAccountBatchPOS);
PageInfo<InsuranceAccountBatchListDTO> pageInfos = new PageInfo<>(insuranceAccountBatchListDTOS,InsuranceAccountBatchListDTO.class);
pageInfos.setTotal(insuranceAccountBatchListDTOS.size());
pageInfos.setPageNum(queryParam.getCurrent());
pageInfos.setPageSize(queryParam.getPageSize());
2022-04-12 19:29:19 +08:00
List<Map<Integer,List<Permission>>> operatesPermission = new ArrayList<>();
2022-04-11 19:07:35 +08:00
SalaryWeaTable<InsuranceAccountBatchListDTO> table = new SalaryWeaTable<>(user, InsuranceAccountBatchListDTO.class);
//table.getColumns().get(0).setFixed("left");
2022-04-12 19:29:19 +08:00
// for (int i = 0; i < insuranceAccountBatchListDTOS.size(); i++) {
// InsuranceAccountBatchListDTO insuranceAccountBatchListDTO = insuranceAccountBatchListDTOS.get(i);
// if (Objects.equals(insuranceAccountBatchListDTO.getBillStatus(), BillStatusEnum.ARCHIVED.getDefaultLabel())) {
// table.getOperates().getOperate().get(i).getIndex();
//
// resultTable.getOperatesPermission().get(i).get(0).setVisible(false);
// resultTable.getOperatesPermission().get(i).get(1).setVisible(false);
// resultTable.getOperatesPermission().get(i).get(2).setVisible(false);
// resultTable.getOperatesPermission().get(i).get(3).setVisible(false);
// resultTable.getOperates().get(4).setOuter(true);
// }
// if (Objects.equals(insuranceAccountBatchListDTO.getBillStatus(), BillStatusEnum.NOT_ARCHIVED.getDefaultLabel())) {
// resultTable.getOperatesPermission().get(i).get(4).setVisible(false);
// List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = siAccountInspectService.listByBillMonth(insuranceAccountBatchListDTO.getBillMonth(), tenantKey);
// if (CollectionUtils.isEmpty(insuranceAccountInspectPOS)) {
// resultTable.getOperatesPermission().get(i).get(2).setVisible(false);
// }
// }
// }
2022-04-11 19:07:35 +08:00
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
datas.put("pageInfo", pageInfos);
2022-04-12 19:29:19 +08:00
datas.put("operatesPermission",operatesPermission);
2022-04-11 19:07:35 +08:00
//datas.put("dataKey",result.getResultMap());
return datas;
// WeaTable<InsuranceAccountBatchListDTO> resultTable = FormatManager.<InsuranceAccountBatchListDTO>getInstance()
// .genTable(InsuranceAccountBatchListDTO.class, insuranceAccountBatchListDTOPage);
//
// resultTable.getOperates().forEach(e -> {
// if (e.getIndex() == 0) {
// e.setOuter(true);
// }
// });
2022-04-12 19:29:19 +08:00
2022-04-11 19:07:35 +08:00
// resultTable.setModule("hrmsalary");
// resultTable.getColumns().get(0).setFixed("left");
// return WeaResult.success(resultTable);
}
@Override
2022-04-12 10:24:21 +08:00
public Map<String, Object> listCommonPage(InsuranceAccountDetailParam queryParam) {
2022-04-11 19:07:35 +08:00
Long employeeId = (long)user.getUID();
Map<String,Object> datas = new HashMap<>();
2022-04-12 10:24:21 +08:00
//正常缴纳列表
PageInfo<InsuranceAccountDetailPO> pageInfo = siAccountBiz.listCommonPage(queryParam);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
//数据组装
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId);
2022-04-12 19:29:19 +08:00
PageInfo<Map<String, Object>> pageInfos = new PageInfo<Map<String, Object>>(records);
pageInfos.setTotal(records.size());
pageInfos.setPageNum(queryParam.getCurrent());
pageInfos.setPageSize(queryParam.getPageSize());
//动态列组装
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, false);
SalaryWeaTable<InsuranceAccountDetailPO> table = new SalaryWeaTable<>(user, SalaryArchiveListDTO.class);
table.setColumns(weaTableColumn);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
datas.put("pageInfo", pageInfos);
datas.put("dataKey",result.getResultMap());
return datas;
}
@Override
public Map<String, Object> listCommonPageByName(InsuranceAccountDetailParam queryParam) {
//增加查询参数userName
if (StringUtils.isNotBlank(queryParam.getUserName())) {
List<DataCollectionEmployee> employeeIdsByUserName = MapperProxyFactory.getProxy(EmployMapper.class).getEmployeeIdsByUserName(queryParam.getUserName());
List<Long> employeeIds = employeeIdsByUserName.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
queryParam.setEmployeeIds(employeeIds);
}
return listCommonPage(queryParam);
}
@Override
public Map<String, Object> listSupplementaryPage(InsuranceAccountDetailParam queryParam) {
Long employeeId = (long)user.getUID();
Map<String,Object> datas = new HashMap<>();
//正常缴纳列表
queryParam.setPaymentStatus(PaymentStatusEnum.REPAIR.getValue());
List<InsuranceAccountDetailPO> list = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).list(queryParam);
PageInfo<InsuranceAccountDetailPO> pageInfo = new PageInfo<>(list,InsuranceAccountDetailPO.class);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
//数据组装
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId);
PageInfo<Map<String, Object>> pageInfos = new PageInfo<Map<String, Object>>(records);
pageInfos.setTotal(records.size());
pageInfos.setPageNum(queryParam.getCurrent());
pageInfos.setPageSize(queryParam.getPageSize());
2022-04-12 10:24:21 +08:00
2022-04-12 19:29:19 +08:00
//动态列组装
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, false);
2022-04-12 10:24:21 +08:00
2022-04-12 19:29:19 +08:00
SalaryWeaTable<InsuranceAccountDetailPO> table = new SalaryWeaTable<>(user, SalaryArchiveListDTO.class);
table.setColumns(weaTableColumn);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
datas.put("pageInfo", pageInfos);
datas.put("dataKey",result.getResultMap());
2022-04-12 10:24:21 +08:00
return datas;
2022-04-11 19:07:35 +08:00
}
2022-04-12 10:24:21 +08:00
2022-04-12 19:29:19 +08:00
@Override
public Map<String, Object> supplementaryByNameList(InsuranceAccountDetailParam queryParam) {
//增加查询参数userName
if (StringUtils.isNotBlank(queryParam.getUserName())) {
List<DataCollectionEmployee> employeeIdsByUserName = MapperProxyFactory.getProxy(EmployMapper.class).getEmployeeIdsByUserName(queryParam.getUserName());
List<Long> employeeIds = employeeIdsByUserName.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
queryParam.setEmployeeIds(employeeIds);
}
return listSupplementaryPage(queryParam);
}
@Override
public Map<String, Object> getForm(Map<String, Object> params) {
ConditionFactory conditionFactory = new ConditionFactory(user);
//条件组
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
//
// WeaForm weaForm = new WeaForm();
// WeaFormItem weaFormItem = new WeaFormItem(WeaFormItemType.DATEPICKER);
// weaFormItem.setRequired(true);
// String minDate = SalaryDateUtil.getYearMonth(-1, 0);
// String maxDate = SalaryDateUtil.getYearMonth(0, 6);
// weaFormItem.getOtherParams().put("minDate", minDate);
// weaFormItem.getOtherParams().put("maxDate", maxDate);
// List<InsuranceAccountBatchPO> billMonthList = siAccountService.listByTimeRange(minDate, maxDate, tenantKey);
// if (CollectionUtils.isEmpty(billMonthList)) {
// weaFormItem.getOtherParams().put("disabledData", Collections.emptyList());
// } else {
// weaFormItem.getOtherParams().put("disabledData", billMonthList.stream().map(InsuranceAccountBatchPO::getBillMonth).collect(Collectors.toList()));
// }
// weaFormItem.getOtherParams().put("type", "month");
// weaFormItem.getOtherParams().put("format", "YYYY-MM");
// weaFormItem.getOtherParams().put("showFormat", "YYYY-MM");
// weaForm.getItems().put("billMonth", weaFormItem);
//
//
//
//
// WeaFormItem remarksItem = new WeaFormItem(WeaFormItemType.TEXTAREA);
// remarksItem.setMaxLength("60");
// weaForm.getItems().put("remarks", remarksItem);
// List<WeaFormLayout> one = new ArrayList<>();
// one.add(new WeaFormLayout("billMonth", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 92146, "账单月份"), new String[]{"billMonth"}));
// List<WeaFormLayout> two = new ArrayList<>();
// two.add(new WeaFormLayout("remarks", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 84961, "备注"), new String[]{"remarks"}));
// weaForm.getLayout().add(one);
// weaForm.getLayout().add(two);
// Map<String, Object> data = new HashMap<>();
// data.put("billMonth", SalaryDateUtil.getYearMonth(0, 0));
// weaForm.setData(data);
return null;
}
2022-04-12 10:24:21 +08:00
2022-04-11 19:07:35 +08:00
}