| | |
| | | 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.*; |
| | | |
| | | /** |
| | | * 设置类-绩效工资配置表Service实现 |
| | |
| | | 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,mIndex)); |
| | | } |
| | | return h*3600+m*60+s; |
| | | }catch (Exception e){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,时长【"+a+"】格式不正确!" ); |
| | | } |
| | | |
| | | } |
| | | } |