!27 修复方案列表

Merge pull request !27 from reset/archive
This commit is contained in:
reset 2022-04-22 07:19:56 +00:00 committed by Gitee
commit ef4ffacbcc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
13 changed files with 300 additions and 49 deletions

View File

@ -2,6 +2,7 @@ package com.engine.salary.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
@ -27,6 +28,8 @@ import com.engine.salary.mapper.siaccount.SIAccountDetailTempMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.service.SIAccountService;
import com.engine.salary.service.impl.SIAccountServiceImpl;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
@ -43,6 +46,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.hrm.User;
import java.math.BigDecimal;
import java.util.*;
@ -51,6 +55,7 @@ import java.util.concurrent.Executors;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import com.engine.core.impl.Service;
/**
* @Author weaver_cl
@ -58,10 +63,11 @@ import java.util.stream.Collectors;
* @Date 2022/4/11
* @Version V1.0
**/
public class SIAccountBiz {
public class SIAccountBiz extends Service{
private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
public PageInfo<InsuranceAccountBatchPO> listPage(InsuranceAccountBatchParam queryParam, Long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
@ -90,13 +96,13 @@ public class SIAccountBiz {
}
}
public void save(boolean flag, AccountParam param,Long employeeId,String username) {
public void save(boolean flag, AccountParam param,Long employeeId,String currentUserName) {
if (flag) {
InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth());
SalaryAssert.isNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel( 100461, "所属月份存在核算数据"));
InsuranceAccountBatchPO build = InsuranceAccountBatchPO.builder()
//.id(IdGenerator.generate())
.accountant(username)
.accountant(currentUserName)
.billMonth(param.getBillMonth())
.billStatus(BillStatusEnum.NOT_ARCHIVED.getValue())
.remarks(param.getRemarks())
@ -116,11 +122,11 @@ public class SIAccountBiz {
// insuranceSchemeContext.setNewValues(build);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
}
account(param.getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
account(param.getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName);
}
public void account(String billMonth, Long employeeId, String tenantKey) {
public void account(String billMonth, Long employeeId, String tenantKey,String currentUserName) {
List<Long> employeeIds = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(billMonth));
if (CollectionUtils.isEmpty(employeeIds)) {
List<InsuranceAccountBatchPO> list = Lists.newArrayList(MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth));
@ -137,25 +143,25 @@ public class SIAccountBiz {
taskExecutor.execute(() -> {
try {
DSTenantKeyThreadVar.tenantKey.set(tenantKey);
accounting(param, employeeId, tenantKey);
accounting(param, employeeId, tenantKey,currentUserName);
} finally {
DSTenantKeyThreadVar.tenantKey.remove();
}
});
}
public void accounting(AccountParam param, Long employeeId, String tenantKey) {
public void accounting(AccountParam param, Long employeeId, String tenantKey,String currentUserName) {
//薪资核算进度暂未实现
// SalaryAcctProgressDTO salaryAcctProgressDTO = salaryAcctProgressService.getProgress(tenantKey + param.getBillMonth(), employeeId, tenantKey);
// if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) {
// return;
// }
doAccounting(param, employeeId, tenantKey);
doAccounting(param, employeeId, tenantKey,currentUserName);
}
//@Transactional(propagation = Propagation.NEVER, rollbackFor = Exception.class)
public void doAccounting(AccountParam param, Long employeeId, String tenantKey) {
public void doAccounting(AccountParam param, Long employeeId, String tenantKey,String currentUserName) {
try {
List<Long> ids;
if (CollectionUtils.isEmpty(param.getIds())) {
@ -182,7 +188,7 @@ public class SIAccountBiz {
countDownLatch.await();
boolean allSuccess = results.stream().allMatch(Boolean::booleanValue);*/
/* if (allSuccess) {*/
handleData(ids, param.getBillMonth(), employeeId, tenantKey);
handleData(ids, param.getBillMonth(), employeeId, tenantKey,currentUserName);
/*}*/
MapperProxyFactory.getProxy(SIAccountDetailTempMapper.class).batchDelAccountTempDetails(ids, param.getBillMonth());
} catch (Exception e) {
@ -251,7 +257,7 @@ public class SIAccountBiz {
}
private void handleData(List<Long> ids, String billMonth, Long employeeId, String tenantKey) {
private void handleData(List<Long> ids, String billMonth, Long employeeId, String tenantKey,String currentUserName) {
//事务后续处理
//TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition());
try {
@ -265,7 +271,7 @@ public class SIAccountBiz {
if (CollectionUtils.isNotEmpty(collect)) {
batchSaveAccountInspectDetail(collect, billMonth, tenantKey);
MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchSaveAccountDetails(collect);
updateBatchAccount(billMonth, employeeId, tenantKey);
updateBatchAccount(billMonth, employeeId, tenantKey,currentUserName);
}
//transactionManager.commit(status);
} catch (Exception e) {
@ -636,7 +642,7 @@ public class SIAccountBiz {
* @param billMonth 账单月份
* @param tenantKey 租户key
*/
public void updateBatchAccount(String billMonth, Long employeeId, String tenantKey) {
public void updateBatchAccount(String billMonth, Long employeeId, String tenantKey,String currentUserName) {
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(billMonth);
Map<Long, List<InsuranceAccountDetailPO>> map = insuranceAccountDetailPOS.stream().filter(item -> item.getEmployeeId() != null)
@ -675,7 +681,7 @@ public class SIAccountBiz {
}
InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth);
DataCollectionEmployee simpleEmployee = MapperProxyFactory.getProxy(EmployMapper.class).getEmployeeById(employeeId);
insuranceAccountBatchPO.setAccountant(simpleEmployee.getUsername());
insuranceAccountBatchPO.setAccountant(currentUserName);
insuranceAccountBatchPO.setUpdateTime(new Date());
insuranceAccountBatchPO.setSocialPay(socialSum.toPlainString());
insuranceAccountBatchPO.setSocialNum(socialAccountPerson);
@ -696,7 +702,7 @@ public class SIAccountBiz {
}
public void saveCommonAccount(SaveCommonAccountParam param, Long employeeId) {
public void saveCommonAccount(SaveCommonAccountParam param, Long employeeId,String currentUserName) {
List<Long> collect;
SalaryAssert.notEmpty(param.getIncludes(), SalaryI18nUtil.getI18nLabel( 100466, "参数为空"));
SalaryAssert.notNull(param.getBillMonth(), SalaryI18nUtil.getI18nLabel( 100467, "账单月为空"));
@ -709,7 +715,7 @@ public class SIAccountBiz {
AccountParam accountParam = new AccountParam();
accountParam.setBillMonth(param.getBillMonth());
accountParam.setIds(collect);
accounting(accountParam, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
accounting(accountParam, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName);
}
public void delete(AccountParam param, Long employeeId) {
@ -727,7 +733,7 @@ public class SIAccountBiz {
// siAccountLoggerTemplate.write(insuranceSchemeContext);
}
public void saveSupplementaryAccount(SaveSupplementaryAccountParam param, Long employeeId) {
public void saveSupplementaryAccount(SaveSupplementaryAccountParam param, Long employeeId,String currentUserName) {
if (StringUtils.isBlank(param.getBillMonth()) || CollectionUtils.isEmpty(param.getBillMonthList()) || CollectionUtils.isEmpty(param.getProjects())
|| CollectionUtils.isEmpty(param.getIncludes())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
@ -756,7 +762,7 @@ public class SIAccountBiz {
});
//核算开始
accountSupplement(baseList, employeeIds, param.getBillMonth(),employeeId);
updateBatchAccount(param.getBillMonth(), employeeId,SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
updateBatchAccount(param.getBillMonth(), employeeId,SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName);
}
/**
@ -1192,7 +1198,7 @@ public class SIAccountBiz {
// });
}
public void deleteCommonAccount(SaveCommonAccountParam param, Long employeeId) {
public void deleteCommonAccount(SaveCommonAccountParam param, Long employeeId,String currentUserName) {
SalaryAssert.notBlank(param.getBillMonth(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
SalaryAssert.notEmpty(param.getIncludes(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDelAccountDetails(param.getIncludes(), param.getBillMonth());
@ -1205,10 +1211,10 @@ public class SIAccountBiz {
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100462, "新增台账"));
// insuranceSchemeContext.setNewValues(param);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
updateBatchAccount(param.getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
updateBatchAccount(param.getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName);
}
public void deleteSupplementaryAccount(List<SupplementAccountBaseParam> param, Long employeeId) {
public void deleteSupplementaryAccount(List<SupplementAccountBaseParam> param, Long employeeId,String currentUserName) {
SalaryAssert.notEmpty(param, SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
boolean valid = param.stream().anyMatch(item -> item.getEmployeeId() == null
|| StringUtils.isBlank(item.getSupplementaryMonth())
@ -1227,7 +1233,7 @@ public class SIAccountBiz {
// insuranceSchemeContext.setNewValues(item);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
// });
updateBatchAccount(param.get(0).getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
updateBatchAccount(param.get(0).getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName);
}
public void file(String billMonth, Long employeeId) {
@ -1254,7 +1260,7 @@ public class SIAccountBiz {
}
public void accountInspect(Collection<Long> ids, String billMonth, Long employeeId) {
public void accountInspect(Collection<Long> ids, String billMonth, Long employeeId,String currentUserName) {
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = allInspects(ids, billMonth);
SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel( 100515, "无核算数据"));
List<InsuranceAccountInspectPO> commonInspects = insuranceAccountInspectPOS.stream()
@ -1268,7 +1274,7 @@ public class SIAccountBiz {
SaveCommonAccountParam param = new SaveCommonAccountParam();
param.setBillMonth(billMonth);
param.setIncludes(commonInspects.stream().map(InsuranceAccountInspectPO::getEmployeeId).collect(Collectors.toList()));
saveCommonAccount(param, employeeId);
saveCommonAccount(param, employeeId,currentUserName);
}
//核算补缴
if (CollectionUtils.isNotEmpty(supplementInspects)) {

View File

@ -0,0 +1,63 @@
package com.engine.salary.entity.sischeme.dto;
import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableOperate;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/22
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "f5f6fcf7-9db5-25da-419f-750f62a6095c", tableType = WeaTableType.NONE,operates = {
@SalaryTableOperate(index = "0", text = "编辑"),
@SalaryTableOperate(index = "1", text = "复制"),
})
public class InsuranceSchemeListDTO {
@TableTitle(title = "id", dataIndex = "id", key = "id")
private Long id;
@TableTitle(title = "方案名称", dataIndex = "schemeName", key = "schemeName")
private String schemeName;
@TableTitle(title = "缴纳类型", dataIndex = "paymentType", key = "paymentType")
private String paymentType;
/* @WeaFormat(
label = "缴纳地区",
labelId = 87613,
tableColumn = @TableColumn(width = "10%")
)*
* 等前端组件暂时频闭
/
*/
@TableTitle(title = "缴纳地区", dataIndex = "paymentArea", key = "paymentArea")
private String paymentArea;
@TableTitle(title = "缴纳范围", dataIndex = "paymentScope", key = "paymentScope")
private String paymentScope;
@TableTitle(title = "备注", dataIndex = "remarks", key = "remarks")
private String remarks;
/* @WeaFormat(
label = "参保人数",
labelId = 87619,
tableColumn = @TableColumn(width = "5%")
)
@ApiModelProperty("参保人数")
private String Num;*/
}

View File

@ -0,0 +1,28 @@
package com.engine.salary.entity.sischeme.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/22
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InsuranceSchemeParam extends BaseQueryParam {
//方案名称或者缴纳地区搜索条件
private String searchCondition;
private WelfareTypeEnum welfareTypeEnum;
}

View File

@ -48,7 +48,7 @@ public interface InsuranceAccountBatchMapper {
* 更新
* @param pos
*/
void updateById(@Param("pos") InsuranceAccountBatchPO pos);
void updateById(InsuranceAccountBatchPO pos);
/**
*

View File

@ -66,4 +66,7 @@ public interface InsuranceSchemeDetailMapper {
List<InsuranceSchemeDetailPO> queryListByPrimaryIdIsPayment(@Param("primaryId") Long primaryId, @Param("isPayment") Integer isPayment,
@Param("welfareType") Integer welfareType);
List<InsuranceSchemeDetailPO> queryInsuranceSchemeDetailList(@Param("primaryId") Long primaryId, @Param("isPayment") Integer isPayment);
}

View File

@ -171,5 +171,14 @@
</select>
<select id="queryInsuranceSchemeDetailList" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_scheme_detail t
WHERE t.primary_id = #{primaryId}
AND t.is_payment = #{isPayment}
AND delete_type = 0
</select>
</mapper>

View File

@ -56,4 +56,8 @@ public interface InsuranceSchemeMapper {
* @return
*/
String querySchemeName(@Param("schemeId") Long schemeId);
List<InsuranceSchemePO> listByWelfareType(@Param("welfareType")Integer welfareType);
}

View File

@ -115,4 +115,15 @@
</update>
<select id="listByWelfareType" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_social_security_scheme t
WHERE t.delete_type = 0
<if test="welfareType != null and welfareType != ''">
AND
t.welfare_type = #{welfareType}
</if>
</select>
</mapper>

View File

@ -1,6 +1,9 @@
package com.engine.salary.service;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.util.page.PageInfo;
import java.util.List;
import java.util.Map;
@ -32,4 +35,11 @@ public interface SISchemeService {
* @return Map
*/
Map<Long, String> getSchemeIdNameMap();
/**
* 获取方案列表
* @param param
* @return
*/
PageInfo<InsuranceSchemeListDTO> list(InsuranceSchemeParam param);
}

View File

@ -284,7 +284,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
public void commonAccount(SaveCommonAccountParam param) {
Long employeeId = (long)user.getUID();
ValidUtil.doValidator(param);
siAccountBiz.saveCommonAccount(param,employeeId);
String currentUserName = user.getLastname();
siAccountBiz.saveCommonAccount(param,employeeId,currentUserName);
}
@Override
@ -296,25 +297,30 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
@Override
public void saveCommonAccount(SaveCommonAccountParam accountParam) {
Long employeeId = (long)user.getUID();
siAccountBiz.saveCommonAccount(accountParam,employeeId);
String currentUserName = user.getLastname();
siAccountBiz.saveCommonAccount(accountParam,employeeId,currentUserName);
}
@Override
public void saveSupplementaryAccount(SaveSupplementaryAccountParam saveSupplementaryAccountParam) {
Long employeeId = (long)user.getUID();
siAccountBiz.saveSupplementaryAccount(saveSupplementaryAccountParam,employeeId);
String currentUserName = user.getLastname();
siAccountBiz.saveSupplementaryAccount(saveSupplementaryAccountParam,employeeId,currentUserName);
}
@Override
public void deleteCommonAccount(SaveCommonAccountParam param) {
Long employeeId = (long)user.getUID();
siAccountBiz.deleteCommonAccount(param,employeeId);
String currentUserName = user.getLastname();
siAccountBiz.deleteCommonAccount(param,employeeId,currentUserName);
}
@Override
public void deleteSummplementaryAccount(List<SupplementAccountBaseParam> supplementAccountBaseParams) {
Long employeeId = (long)user.getUID();
siAccountBiz.deleteSupplementaryAccount(supplementAccountBaseParams,employeeId);
String currentUserName = user.getLastname();
siAccountBiz.deleteSupplementaryAccount(supplementAccountBaseParams,employeeId,currentUserName);
}
@Override
@ -447,7 +453,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
public void accountInspect(InspectAccountParam param) {
Long employeeId = (long)user.getUID();
ValidUtil.doValidator(param);
siAccountBiz.accountInspect(param.getIds(),param.getBillMonth(),employeeId);
String currentUserName = user.getLastname();
siAccountBiz.accountInspect(param.getIds(),param.getBillMonth(),employeeId,currentUserName);
}
@Override
@ -516,9 +523,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<SearchConditionItem> conditionItems = new ArrayList<>();
List<SearchConditionItem> conditionItem = new ArrayList<>();
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "对象", "require", "17", "includes");
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 12, 2, true, "对象", "require", "17", "includes");
conditionItems.add(includes);
SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "选择人员", "require", "17", "excludes");
SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 12, 2, true, "选择人员", "require", "17", "excludes");
conditionItem.add(excludes);
addGroups.add(new SearchConditionGroup("人员范围",true,conditionItems));
addGroups.add(new SearchConditionGroup("人员范围排除",true,conditionItem));
@ -553,9 +560,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
billMonthList.setMultiple(false);
condition.add(billProjects);
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 6, 3, true, "对象", "require", "17", "includes");
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 6, 3, true, "对象", "required", "17", "includes");
conditionItems.add(includes);
SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "选择人员", "require", "17", "excludes");
SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "选择人员", "required", "17", "excludes");
conditionItem.add(excludes);
addGroups.add(new SearchConditionGroup("基础信息",true,condition));
addGroups.add(new SearchConditionGroup("人员范围",true,conditionItems));
@ -573,6 +580,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
public List<SearchConditionOption> buildBillProjectsOptions() {
List<SearchConditionOption> options = new ArrayList<>();
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.ALL.getValue()),
@ -592,4 +600,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}

View File

@ -3,16 +3,28 @@ package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SISchemeBiz;
import com.engine.salary.cmd.sischeme.*;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.sicategory.IsPaymentEnum;
import com.engine.salary.enums.sicategory.PaymentTypeEnum;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.PageUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -67,4 +79,56 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
return result;
}
@Override
public PageInfo<InsuranceSchemeListDTO> list(InsuranceSchemeParam queryParam) {
SalaryAssert.notNull(queryParam.getWelfareTypeEnum(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<InsuranceSchemePO> insuranceSchemePOS = MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
List<InsuranceSchemeListDTO> collect = insuranceSchemePOS.stream().map(item ->
InsuranceSchemeListDTO.builder()
.id(item.getId())
.paymentType(SalaryI18nUtil.getI18nLabel( buildPaymentTypeEnum(item.getPaymentType()).getLabelId(),
buildPaymentTypeEnum(item.getPaymentType()).getDefaultLabel()))
.schemeName(item.getSchemeName())
.paymentArea(item.getPaymentArea())
.paymentScope(buildPaymentScope(item.getId()))
.remarks(item.getRemarks())
.build()
).collect(Collectors.toList());
PageInfo<InsuranceSchemeListDTO> pageInfo = new PageInfo<>(collect,InsuranceSchemeListDTO.class);
return pageInfo;
}
public PaymentTypeEnum buildPaymentTypeEnum(Integer value) {
return SalaryEnumUtil.enumMatchByValue(value, PaymentTypeEnum.values(), PaymentTypeEnum.class);
}
/**
* 组装社保福利方案列表页缴纳范围
* 1到福利方案明细表查询该方案id下面有哪些福利
* 2去重福利是分个人和公司的明细表中查询出来的福利id会重复
* 3根据查询出来的福利id去福利表里面查询福利的名称
* 4组装分割
*
* @param id 福利方案主表id
* @return result
*/
public String buildPaymentScope(Long id) {
List<String> collect = queryInsuranceSchemeDetailList(id).stream().map(InsuranceSchemeDetailPO::getInsuranceId).distinct().collect(Collectors.toList())
.stream().map(this::queryInsuranceName).collect(Collectors.toList());
return StringUtils.join(collect, "");
}
public Collection<InsuranceSchemeDetailPO> queryInsuranceSchemeDetailList(Long id) {
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryInsuranceSchemeDetailList(id, IsPaymentEnum.YES.getValue());
return insuranceSchemeDetailPOS;
}
public String queryInsuranceName(Long id) {
ICategoryPO insuranceCategoryPO = MapperProxyFactory.getProxy(ICategoryMapper.class).getById(id);
return insuranceCategoryPO == null ? "" : Objects.isNull(insuranceCategoryPO.getInsuranceName()) ? "" : insuranceCategoryPO.getInsuranceName();
}
}

View File

@ -2,12 +2,15 @@ package com.engine.salary.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeDTO;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeReqParam;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SISchemeWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@ -19,7 +22,6 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
/**
* @Author weaver_cl
@ -33,6 +35,10 @@ public class SISchemeController {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
private SISchemeWrapper getSISchemeWrapper(User user) {
return ServiceUtil.getService(SISchemeWrapper.class,user);
}
/**
* 查询福利方案表单
@ -59,18 +65,26 @@ public class SISchemeController {
* @param response
* @return
*/
@GET
// @GET
// @Path("/getTable")
// @Produces(MediaType.APPLICATION_JSON)
// public String getTable(@Context HttpServletRequest request, @Context HttpServletResponse response,
// @QueryParam("searchCondition") String searchCondition, @QueryParam("welfareTypeEnum") WelfareTypeEnum welfareTypeEnum ) {
// User user = HrmUserVarify.getUser(request, response);
// InsuranceSchemeDTO insuranceSchemeDTO = InsuranceSchemeDTO.builder().welfareType(welfareTypeEnum).build();
// Integer welfareType = insuranceSchemeDTO.getWelfareType().getValue();
// Map<String, Object> map = ParamUtil.request2Map(request);
// map.put("searchCondition",searchCondition);
// map.put("welfareType",welfareType);
// return ResponseResult.run(getService(user)::listPage, map);
// }
@POST
@Path("/getTable")
@Produces(MediaType.APPLICATION_JSON)
public String getTable(@Context HttpServletRequest request, @Context HttpServletResponse response,
@QueryParam("searchCondition") String searchCondition, @QueryParam("welfareTypeEnum") WelfareTypeEnum welfareTypeEnum ) {
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceSchemeParam insuranceSchemeParam) {
User user = HrmUserVarify.getUser(request, response);
InsuranceSchemeDTO insuranceSchemeDTO = InsuranceSchemeDTO.builder().welfareType(welfareTypeEnum).build();
Integer welfareType = insuranceSchemeDTO.getWelfareType().getValue();
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("searchCondition",searchCondition);
map.put("welfareType",welfareType);
return ResponseResult.run(getService(user)::listPage, map);
return new ResponseResult<InsuranceSchemeParam, PageInfo<InsuranceSchemeListDTO>>().run(getSISchemeWrapper(user)::listPage, insuranceSchemeParam);
}

View File

@ -0,0 +1,28 @@
package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.page.PageInfo;
import weaver.hrm.User;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/22
* @Version V1.0
**/
public class SISchemeWrapper extends Service {
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
public PageInfo<InsuranceSchemeListDTO> listPage(InsuranceSchemeParam param) {
return getSISchemeService(user).list(param);
}
}