Commit ff973d2d authored by hongguangwu's avatar hongguangwu

优化sonar

parent d9a0036b
package com.yifu.cloud.plus.v1.yifu.salary.controller; package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.service.SalaryUploadService; import com.yifu.cloud.plus.v1.yifu.salary.service.SalaryUploadService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryDetailVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryDetailVo;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
...@@ -46,23 +40,9 @@ public class SalaryUploadController { ...@@ -46,23 +40,9 @@ public class SalaryUploadController {
@Operation(description = "上传:jsonString:表格json;settleDepart:结算主体id;configId:工资配置结算月等信息的id;salaryType:工资类型") @Operation(description = "上传:jsonString:表格json;settleDepart:结算主体id;configId:工资配置结算月等信息的id;salaryType:工资类型")
@SysLog("上传薪资表") @SysLog("上传薪资表")
@PostMapping("/upload") @PostMapping("/upload")
public R upload(@RequestBody String jsonString, @RequestParam String settleDepart, @RequestParam(required = false) String configId public R<List<ErrorMessage>> upload(@RequestBody String jsonString, @RequestParam String settleDepart, @RequestParam(required = false) String configId
, @RequestParam String salaryType, @RequestParam(required = false) String orderId) { , @RequestParam String salaryType, @RequestParam(required = false) String orderId) {
return salaryUploadService.salaryUpload(jsonString, settleDepart, configId, salaryType,orderId); return salaryUploadService.salaryUpload(jsonString, settleDepart, configId, salaryType, orderId);
}
/**
* @param savList 工资表volist
* @Description: 保存并提交报账表
* @Author: hgw
* @Date: 2019/9/18 18:17
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Operation(description = "保存并提交")
@SysLog("保存并提交薪资表")
@PostMapping("/saveAndSubmit")
public R saveAndSubmit(@RequestBody List<TSalaryAccountVo> savList, @RequestParam(required = false)String orderId) {
return salaryUploadService.saveAndSubmit(savList,orderId);
} }
@Operation(description = "打开结算单") @Operation(description = "打开结算单")
...@@ -72,11 +52,4 @@ public class SalaryUploadController { ...@@ -72,11 +52,4 @@ public class SalaryUploadController {
return salaryUploadService.getBill(salaryFormId); return salaryUploadService.getBill(salaryFormId);
} }
@Operation(description = "获取缴费库-测试使用")
@SysLog("获取缴费库-测试使用")
@PostMapping("/getForecast")
public List<TPaymentBySalaryVo> openBill(@RequestParam String deptId, @RequestParam String createMonth) {
return salaryUploadService.getForecast(deptId, createMonth);
}
} }
package com.yifu.cloud.plus.v1.yifu.salary.service; package com.yifu.cloud.plus.v1.yifu.salary.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryDetailVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryDetailVo;
import java.util.List; import java.util.List;
...@@ -26,20 +25,8 @@ public interface SalaryUploadService extends IService<TSalaryStandard> { ...@@ -26,20 +25,8 @@ public interface SalaryUploadService extends IService<TSalaryStandard> {
* @Date: 2019/9/4 15:58 * @Date: 2019/9/4 15:58
* @return: com.yifu.cloud.v1.common.core.util.R * @return: com.yifu.cloud.v1.common.core.util.R
**/ **/
R salaryUpload(String jsonString, String settleDepart, String configId, String formType, String orderId); R<List<ErrorMessage>> salaryUpload(String jsonString, String settleDepart, String configId, String formType, String orderId);
/**
* @param savList
* @param orderId
* @Description: 保存并提交报账表
* @Author: hgw
* @Date: 2019/9/18 18:42
* @return: com.yifu.cloud.v1.common.core.util.R
**/
R<String> saveAndSubmit(List<TSalaryAccountVo> savList, String orderId);
R<TSalaryDetailVo> getBill(String salaryFormId); R<TSalaryDetailVo> getBill(String salaryFormId);
List<TPaymentBySalaryVo> getForecast(String deptId, String createMonth);
} }
...@@ -65,7 +65,7 @@ public class SalaryAccountUtil implements Serializable { ...@@ -65,7 +65,7 @@ public class SalaryAccountUtil implements Serializable {
public void getJsonStringToList(YifuUser user, String jsonStr, TSettleDomainSelectVo dept public void getJsonStringToList(YifuUser user, String jsonStr, TSettleDomainSelectVo dept
, TConfigSalary configSalary, Map<String, TSalaryConfigStandard> salaryConfigMap, Map<String, Boolean> isMustMap , TConfigSalary configSalary, Map<String, TSalaryConfigStandard> salaryConfigMap, Map<String, Boolean> isMustMap
, Map<String, TSalaryEmployee> empIdCardMap, Map<String, TSalaryEmployee> empNameMap, boolean isDuplicateName , Map<String, TSalaryEmployee> empIdCardMap, Map<String, TSalaryEmployee> empNameMap, boolean isDuplicateName
, String salaryType, List<String> checkListY,String invoiceTitle, TSalaryEmployeeService tSalaryEmployeeService , String salaryType, List<String> checkListY, String invoiceTitle, TSalaryEmployeeService tSalaryEmployeeService
, Map<String, Integer> checkMap, Map<String, BigDecimal> specialMap, Map<String, Integer> ownEmployeeMap , Map<String, Integer> checkMap, Map<String, BigDecimal> specialMap, Map<String, Integer> ownEmployeeMap
, Map<String, Integer> ownDeptMap, TSalaryAccountService tSalaryAccountService) { , Map<String, Integer> ownDeptMap, TSalaryAccountService tSalaryAccountService) {
List<TSalaryAccountVo> tList = new ArrayList<>(); List<TSalaryAccountVo> tList = new ArrayList<>();
...@@ -92,7 +92,7 @@ public class SalaryAccountUtil implements Serializable { ...@@ -92,7 +92,7 @@ public class SalaryAccountUtil implements Serializable {
} }
String error; //校验字段是否符合要求 返回错误信息 String error; //校验字段是否符合要求 返回错误信息
TSalaryAccountVo entity; // 从第1行开始取数据 TSalaryAccountVo entity; // 从第1行开始取数据
HashMap temp; // 得到一行中的所有单元格对象. HashMap<String, Object> temp; // 得到一行中的所有单元格对象.
ExcelAttribute attr; //获取属性对应的注解属性 ExcelAttribute attr; //获取属性对应的注解属性
Object cellValueObj; //单元格值 Object cellValueObj; //单元格值
String cellValueStr; //单元格字符串值 String cellValueStr; //单元格字符串值
...@@ -132,7 +132,6 @@ public class SalaryAccountUtil implements Serializable { ...@@ -132,7 +132,6 @@ public class SalaryAccountUtil implements Serializable {
boolean annualBonusFlag; boolean annualBonusFlag;
for (int i = 0; i < rows; i++) { for (int i = 0; i < rows; i++) {
annualBonusFlag = false; annualBonusFlag = false;
error = "";
errorFlag = true; errorFlag = true;
temp = list.get(i); temp = list.get(i);
entity = new TSalaryAccountVo(); entity = new TSalaryAccountVo();
...@@ -283,7 +282,6 @@ public class SalaryAccountUtil implements Serializable { ...@@ -283,7 +282,6 @@ public class SalaryAccountUtil implements Serializable {
if (null != error) { if (null != error) {
errorFlag = false; errorFlag = false;
errorList.add(new ErrorMessage((i + 2), error)); errorList.add(new ErrorMessage((i + 2), error));
continue;
} }
} }
} }
...@@ -580,22 +578,22 @@ public class SalaryAccountUtil implements Serializable { ...@@ -580,22 +578,22 @@ public class SalaryAccountUtil implements Serializable {
entity.setEmpPhone(emp.getEmpPhone()); entity.setEmpPhone(emp.getEmpPhone());
if (SalaryConstants.SALARY_STYLE_BANK.equals(salaryStyle) && salaryGiveTimeFlag) { if (SalaryConstants.SALARY_STYLE_BANK.equals(salaryStyle) && salaryGiveTimeFlag) {
if (Common.isEmpty(emp.getBankName())) { if (Common.isEmpty(emp.getBankName())) {
error = "第" + (i + 2) + "行:员工:" + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行-为空,请去薪酬人员查询处更新!"; error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error)); errorList.add(new ErrorMessage((i + 2), error));
continue; continue;
} }
if (Common.isEmpty(emp.getBankNo())) { if (Common.isEmpty(emp.getBankNo())) {
error = "第" + (i + 2) + "行:员工:" + emp.getEmpIdcard() + "-发放方式为银行发放,但是-银行卡号-为空,请去薪酬人员查询处更新!"; error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-银行卡号-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error)); errorList.add(new ErrorMessage((i + 2), error));
continue; continue;
} }
if (Common.isEmpty(emp.getBankProvince())) { if (Common.isEmpty(emp.getBankProvince())) {
error = "第" + (i + 2) + "行:员工:" + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行省-为空,请去薪酬人员查询处更新!"; error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行省-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error)); errorList.add(new ErrorMessage((i + 2), error));
continue; continue;
} }
if (Common.isEmpty(emp.getBankCity())) { if (Common.isEmpty(emp.getBankCity())) {
error = "第" + (i + 2) + "行:员工:" + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行市-为空,请去薪酬人员查询处更新!"; error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行市-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error)); errorList.add(new ErrorMessage((i + 2), error));
continue; continue;
} }
...@@ -746,7 +744,7 @@ public class SalaryAccountUtil implements Serializable { ...@@ -746,7 +744,7 @@ public class SalaryAccountUtil implements Serializable {
* @param hashMap * @param hashMap
* @return * @return
*/ */
private static Object getFieldValueByName(String fieldName, HashMap hashMap) { private static Object getFieldValueByName(String fieldName, HashMap<String, Object> hashMap) {
try { try {
return hashMap.get(fieldName); return hashMap.get(fieldName);
} catch (Exception e) { } catch (Exception e) {
...@@ -826,7 +824,7 @@ public class SalaryAccountUtil implements Serializable { ...@@ -826,7 +824,7 @@ public class SalaryAccountUtil implements Serializable {
//最小值校验 //最小值校验
if (attr.min() > 0) { if (attr.min() > 0) {
if (Common.isNumber(c)) { if (Common.isNumber(c)) {
if (Integer.valueOf(c).intValue() > attr.maxLength()) { if (Integer.parseInt(c) > attr.maxLength()) {
return errorInfo(attr, "_小于最小值", i); return errorInfo(attr, "_小于最小值", i);
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment