From c2c7d2dee5e74184e2130c2688e16111957958cb Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Fri, 22 Apr 2022 15:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B9=E6=A1=88=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 54 +++++++------- .../sischeme/dto/InsuranceSchemeListDTO.java | 63 +++++++++++++++++ .../sischeme/param/InsuranceSchemeParam.java | 28 ++++++++ .../InsuranceAccountBatchMapper.java | 2 +- .../sischeme/InsuranceSchemeDetailMapper.java | 3 + .../sischeme/InsuranceSchemeDetailMapper.xml | 9 +++ .../sischeme/InsuranceSchemeMapper.java | 4 ++ .../mapper/sischeme/InsuranceSchemeMapper.xml | 11 +++ .../salary/service/SISchemeService.java | 10 +++ .../service/impl/SIAccountServiceImpl.java | 31 +++++--- .../service/impl/SISchemeServiceImpl.java | 70 ++++++++++++++++++- .../engine/salary/web/SISchemeController.java | 36 +++++++--- .../salary/wrapper/SISchemeWrapper.java | 28 ++++++++ 13 files changed, 300 insertions(+), 49 deletions(-) create mode 100644 src/com/engine/salary/entity/sischeme/dto/InsuranceSchemeListDTO.java create mode 100644 src/com/engine/salary/entity/sischeme/param/InsuranceSchemeParam.java create mode 100644 src/com/engine/salary/wrapper/SISchemeWrapper.java diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index b02176a56..1bea2de72 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -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 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 employeeIds = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(billMonth)); if (CollectionUtils.isEmpty(employeeIds)) { List 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 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 ids, String billMonth, Long employeeId, String tenantKey) { + private void handleData(List 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 insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(billMonth); Map> 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 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 param, Long employeeId) { + public void deleteSupplementaryAccount(List 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 ids, String billMonth, Long employeeId) { + public void accountInspect(Collection ids, String billMonth, Long employeeId,String currentUserName) { List insuranceAccountInspectPOS = allInspects(ids, billMonth); SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel( 100515, "无核算数据")); List 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)) { diff --git a/src/com/engine/salary/entity/sischeme/dto/InsuranceSchemeListDTO.java b/src/com/engine/salary/entity/sischeme/dto/InsuranceSchemeListDTO.java new file mode 100644 index 000000000..d5d0d97bb --- /dev/null +++ b/src/com/engine/salary/entity/sischeme/dto/InsuranceSchemeListDTO.java @@ -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;*/ + +} diff --git a/src/com/engine/salary/entity/sischeme/param/InsuranceSchemeParam.java b/src/com/engine/salary/entity/sischeme/param/InsuranceSchemeParam.java new file mode 100644 index 000000000..aac9630f2 --- /dev/null +++ b/src/com/engine/salary/entity/sischeme/param/InsuranceSchemeParam.java @@ -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; + + +} diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.java index 899bffd0a..11369fd63 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.java @@ -48,7 +48,7 @@ public interface InsuranceAccountBatchMapper { * 更新 * @param pos */ - void updateById(@Param("pos") InsuranceAccountBatchPO pos); + void updateById(InsuranceAccountBatchPO pos); /** * diff --git a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.java b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.java index 1bcc9a90d..273d84ca8 100644 --- a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.java +++ b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.java @@ -66,4 +66,7 @@ public interface InsuranceSchemeDetailMapper { List queryListByPrimaryIdIsPayment(@Param("primaryId") Long primaryId, @Param("isPayment") Integer isPayment, @Param("welfareType") Integer welfareType); + + List queryInsuranceSchemeDetailList(@Param("primaryId") Long primaryId, @Param("isPayment") Integer isPayment); + } diff --git a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml index ca8bdf67b..264d447b6 100644 --- a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml +++ b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml @@ -171,5 +171,14 @@ + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeMapper.java b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeMapper.java index ff49885dc..e05f2420e 100644 --- a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeMapper.java +++ b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeMapper.java @@ -56,4 +56,8 @@ public interface InsuranceSchemeMapper { * @return */ String querySchemeName(@Param("schemeId") Long schemeId); + + + + List listByWelfareType(@Param("welfareType")Integer welfareType); } diff --git a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeMapper.xml b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeMapper.xml index 86fbdc683..2476310a5 100644 --- a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeMapper.xml +++ b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeMapper.xml @@ -115,4 +115,15 @@ + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SISchemeService.java b/src/com/engine/salary/service/SISchemeService.java index d74672a9f..0476e5fc0 100644 --- a/src/com/engine/salary/service/SISchemeService.java +++ b/src/com/engine/salary/service/SISchemeService.java @@ -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 getSchemeIdNameMap(); + + /** + * 获取方案列表 + * @param param + * @return + */ + PageInfo list(InsuranceSchemeParam param); } diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 178c6da3e..006bd0ee3 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -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 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 conditionItems = new ArrayList<>(); List 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 buildBillProjectsOptions() { List options = new ArrayList<>(); options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.ALL.getValue()), @@ -592,4 +600,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { + + + } diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index 6c63c05a7..2fedb57de 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -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 list(InsuranceSchemeParam queryParam) { + SalaryAssert.notNull(queryParam.getWelfareTypeEnum(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误")); + PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List insuranceSchemePOS = MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).listByWelfareType(queryParam.getWelfareTypeEnum().getValue()); + List 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 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 collect = queryInsuranceSchemeDetailList(id).stream().map(InsuranceSchemeDetailPO::getInsuranceId).distinct().collect(Collectors.toList()) + .stream().map(this::queryInsuranceName).collect(Collectors.toList()); + return StringUtils.join(collect, "、"); + } + + public Collection queryInsuranceSchemeDetailList(Long id) { + List 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(); + } } diff --git a/src/com/engine/salary/web/SISchemeController.java b/src/com/engine/salary/web/SISchemeController.java index ae8f525a5..19935bb8b 100644 --- a/src/com/engine/salary/web/SISchemeController.java +++ b/src/com/engine/salary/web/SISchemeController.java @@ -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 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 map = ParamUtil.request2Map(request); - map.put("searchCondition",searchCondition); - map.put("welfareType",welfareType); - return ResponseResult.run(getService(user)::listPage, map); + return new ResponseResult>().run(getSISchemeWrapper(user)::listPage, insuranceSchemeParam); } diff --git a/src/com/engine/salary/wrapper/SISchemeWrapper.java b/src/com/engine/salary/wrapper/SISchemeWrapper.java new file mode 100644 index 000000000..975cece47 --- /dev/null +++ b/src/com/engine/salary/wrapper/SISchemeWrapper.java @@ -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 listPage(InsuranceSchemeParam param) { + return getSISchemeService(user).list(param); + } +}