From 91b92422716cb4c5d0433f77fd2d6d45a69639c4 Mon Sep 17 00:00:00 2001 From: jiaosong <jiaosong6760@dingtalk.com> Date: 星期二, 15 八月 2023 18:35:17 +0800 Subject: [PATCH] # 工资表配置表 联调修改 --- server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 47 insertions(+), 11 deletions(-) diff --git a/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java b/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java index 95da0cb..38e3017 100644 --- a/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java +++ b/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java @@ -29,10 +29,8 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.multipart.MultipartFile; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Objects; +import java.math.BigDecimal; +import java.util.*; /** * 璁剧疆绫�-缁╂晥宸ヨ祫閰嶇疆琛⊿ervice瀹炵幇 @@ -56,6 +54,8 @@ @Override public Integer create(SalaryParam salaryParam) { + + LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); SalaryParam insert = new SalaryParam(); @@ -180,7 +180,7 @@ || Objects.isNull(s.getDepartName()) || Objects.isNull(s.getMaterialCode()) || Objects.isNull(s.getProcedureName()) - || Objects.isNull(s.getNUM())){ + || Objects.isNull(s.getNum())){ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵煎叆鏁版嵁鍐呭鏈夎锛�"); } }); @@ -216,7 +216,7 @@ proceduresWrapper.lambda() .eq(Procedures::getName,salaryParamImportDTO.getProcedureName()) .eq(Procedures::getRootDepartId,department.getRootId()) - .eq(Procedures::getDepartId,department.getId()) + .eq(Procedures::getOrgId,department.getId()) .last("limit 1"); Procedures procedures = proceduresMapper.selectOne(proceduresWrapper); if (Objects.isNull(procedures)){ @@ -228,13 +228,49 @@ salaryParam.setProcedureId(procedures.getId()); salaryParam.setMaterialId(material.getId()); salaryParam.setSalary(salaryParamImportDTO.getSalary()); - salaryParam.setNum(salaryParamImportDTO.getNUM()); - //todo -// salaryParam.setTimes(); -// salaryParam.setUnqualified(salaryParamImportDTO.getUnqualified() ); -// salaryParam.setType(salaryParamImportDTO.getType()); + salaryParam.setNum(new BigDecimal(salaryParamImportDTO.getNum())); + salaryParam.setTimes(getIntegerTimes(salaryParamImportDTO.getTimesName())); + Integer unqualified = Optional.ofNullable(salaryParamImportDTO.getUnqualified()).map(s -> { + if ("鍚�".equals(s)) { + return 0; + } else { + return 1; + } + }).orElse(0); + salaryParam.setUnqualified(unqualified); + + Integer type = Optional.ofNullable(salaryParamImportDTO.getUnqualified()).map(s -> { + if ("璁′欢".equals(s)) { + return 0; + } else { + return 1; + } + }).orElse(0); + salaryParam.setType(type); create(salaryParam); } } + + private Integer getIntegerTimes(String a) { + int h =0,m=0,s=0; + try{ + int hIndex =a.lastIndexOf("灏忔椂"); + int mIndex=a.lastIndexOf("鍒嗛挓"); + int sIndex =a.lastIndexOf("绉�"); + if( hIndex>0){ + h = Integer.parseInt(a.substring(0,hIndex)); + } + if(mIndex > hIndex){ + m = Integer.parseInt(a.substring(hIndex >=0?hIndex+2:0,mIndex)); + } + if(sIndex > mIndex){ + s = Integer.parseInt(a.substring(mIndex >= 0 ? mIndex+2 : 0, sIndex)); + } + return h*3600+m*60+s; + }catch (Exception e){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鏃堕暱銆�"+a+"銆戞牸寮忎笉姝g‘锛�" ); + } + + } } -- Gitblit v1.9.3