修改人员上传
This commit is contained in:
parent
48afdd77c1
commit
4560c9e327
|
|
@ -1,8 +1,12 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.vo.PayFailVo;
|
||||
import com.bonus.bmw.domain.vo.ProMonthTable;
|
||||
import com.bonus.bmw.service.PayFailService;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.utils.json.FastJsonHelper;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -56,14 +60,28 @@ public class PayFailController extends BaseController {
|
|||
|
||||
@PostMapping("/addData")
|
||||
@SysLog(title = "新增发放失败", businessType = OperaType.INSERT, module = "支付失败登记->新增记录", details = "新增发放失败数据")
|
||||
public AjaxResult addData(@RequestPart(value = "file",required = false) MultipartFile[] file,@Validated PayFailVo vo) {
|
||||
return service.addData(file,vo);
|
||||
public AjaxResult addData(@RequestPart(value = "file",required = false) MultipartFile[] file,@RequestParam(value = "params") String params) {
|
||||
try{
|
||||
params= Sm4Utils.decrypt(params);
|
||||
PayFailVo vo = FastJsonHelper.jsonStrToBean(params, PayFailVo.class);
|
||||
return service.addData(file,vo);
|
||||
}catch (Exception e){
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.error("请求参数异常");
|
||||
}
|
||||
|
||||
@PostMapping("/updateData")
|
||||
@SysLog(title = "修改发放失败", businessType = OperaType.INSERT, module = "支付失败登记->修改记录", details = "修改发放失败数据")
|
||||
public AjaxResult updateData(@RequestPart(value = "file",required = false) MultipartFile[] file,@Validated PayFailVo vo) {
|
||||
return service.updateData(file,vo);
|
||||
public AjaxResult updateData(@RequestPart(value = "file",required = false) MultipartFile[] file,@RequestParam(value = "params") String params) {
|
||||
try{
|
||||
params= Sm4Utils.decrypt(params);
|
||||
PayFailVo vo = FastJsonHelper.jsonStrToBean(params, PayFailVo.class);
|
||||
return service.updateData(file,vo);
|
||||
}catch (Exception e){
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.error("请求参数异常");
|
||||
}
|
||||
@PostMapping("/delData")
|
||||
@SysLog(title = "删除记录", businessType = OperaType.INSERT, module = "支付失败登记->删除记录", details = "删除记录")
|
||||
|
|
|
|||
|
|
@ -65,10 +65,9 @@ public class PayFailVo {
|
|||
/**
|
||||
* 金额
|
||||
*/
|
||||
@NotNull(message = "金额不能为空") // 核心:校验BigDecimal非null
|
||||
@DecimalMin(value = "0.00", message = "金额不能为负数")
|
||||
@NotBlank(message = "金额不能为空") // 核心:校验BigDecimal非null
|
||||
@Excel(name = "应发金额", sort = 7)
|
||||
private BigDecimal money;
|
||||
private String money;
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -108,6 +108,10 @@ public class PayFailServiceImpl implements PayFailService {
|
|||
@Override
|
||||
public AjaxResult addData(MultipartFile[] file, PayFailVo vo) {
|
||||
try{
|
||||
AjaxResult result= ifIsEmpty(vo);
|
||||
if(result!=null){
|
||||
return result;
|
||||
}
|
||||
String userId= SecurityUtils.getUserId()+"";
|
||||
vo.setUpdateUser(userId);
|
||||
vo.setCreateUser(userId);
|
||||
|
|
@ -141,6 +145,11 @@ public class PayFailServiceImpl implements PayFailService {
|
|||
@Override
|
||||
public AjaxResult updateData(MultipartFile[] file, PayFailVo vo) {
|
||||
try{
|
||||
AjaxResult result= ifIsEmpty(vo);
|
||||
if(result!=null){
|
||||
return result;
|
||||
}
|
||||
|
||||
String userId= SecurityUtils.getUserId()+"";
|
||||
vo.setUpdateUser(userId);
|
||||
vo.setIsImport(0);
|
||||
|
|
@ -168,6 +177,33 @@ public class PayFailServiceImpl implements PayFailService {
|
|||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
|
||||
private AjaxResult ifIsEmpty(PayFailVo vo) {
|
||||
if (StringUtils.isEmpty(vo.getUserName())) {
|
||||
return AjaxResult.error("用户名不能为空");
|
||||
}
|
||||
// 校验身份证
|
||||
if (StringUtils.isEmpty(vo.getIdCard())) {
|
||||
return AjaxResult.error("身份证号码不能为空");
|
||||
}
|
||||
// 校验工程名称
|
||||
if (StringUtils.isEmpty(vo.getProName())) {
|
||||
return AjaxResult.error("工程名称不能为空");
|
||||
}
|
||||
// 校验分包单位
|
||||
if (StringUtils.isEmpty(vo.getSubName())) {
|
||||
return AjaxResult.error("分包单位不能为空");
|
||||
}
|
||||
// 校验应发月份
|
||||
if (StringUtils.isEmpty(vo.getFailMonth())) {
|
||||
return AjaxResult.error("应发月份不能为空");
|
||||
}
|
||||
// 校验应发金额
|
||||
if (StringUtils.isEmpty(vo.getMoney())) {
|
||||
return AjaxResult.error("应发金额不能为空");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param vo
|
||||
|
|
@ -247,7 +283,7 @@ public class PayFailServiceImpl implements PayFailService {
|
|||
hasError = true;
|
||||
}
|
||||
// 校验应发金额
|
||||
if (isMoneyEmpty(vo.getMoney())) {
|
||||
if (StringUtils.isEmpty(vo.getMoney())) {
|
||||
singleError.append("应发金额为空、");
|
||||
hasError = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue