|
|
|
@ -1,40 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package jnpf.payment.controller;
|
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import jdk.nashorn.internal.ir.IfNode;
|
|
|
|
|
import jnpf.base.ActionResult;
|
|
|
|
|
import jnpf.base.UserInfo;
|
|
|
|
|
import jnpf.base.vo.DownloadVO;
|
|
|
|
|
import jnpf.base.vo.PageListVO;
|
|
|
|
|
import jnpf.base.vo.PaginationVO;
|
|
|
|
|
import jnpf.base.UserInfo;
|
|
|
|
|
import jnpf.base.vo.DownloadVO;
|
|
|
|
|
import jnpf.collection.model.collection.Collection_item0Model;
|
|
|
|
|
import jnpf.config.ConfigValueUtil;
|
|
|
|
|
import jnpf.exception.DataException;
|
|
|
|
|
import jnpf.payment.entity.PaymentEntity;
|
|
|
|
|
import jnpf.paymentdoc.entity.Paymentdoc_item0Entity;
|
|
|
|
|
import jnpf.paymentdoc.service.Paymentdoc_item0Service;
|
|
|
|
|
import jnpf.purchaseback.entity.PurchaseorderEntity;
|
|
|
|
|
import jnpf.purchaseback.service.PurchaseorderService;
|
|
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import jnpf.base.entity.ProvinceEntity;
|
|
|
|
|
import jnpf.payment.model.payment.*;
|
|
|
|
|
import jnpf.payment.service.PaymentService;
|
|
|
|
|
import jnpf.payment.model.payment.PaymentPagination;
|
|
|
|
|
import jnpf.payment.entity.*;
|
|
|
|
|
import jnpf.payment.entity.Payment_item0Entity;
|
|
|
|
|
import jnpf.util.*;
|
|
|
|
|
import jnpf.util.enums.FileTypeEnum;
|
|
|
|
|
import jnpf.util.file.UploadUtil;
|
|
|
|
|
import lombok.Cleanup;
|
|
|
|
|
import jnpf.base.util.*;
|
|
|
|
|
import jnpf.base.vo.ListVO;
|
|
|
|
|
import jnpf.util.context.SpringContext;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import lombok.Cleanup;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import jnpf.payment.entity.PaymentEntity;
|
|
|
|
|
import jnpf.payment.service.PaymentService;
|
|
|
|
|
import jnpf.payment.entity.Payment_item0Entity;
|
|
|
|
|
import jnpf.payment.service.Payment_item0Service;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import jnpf.util.GeneraterSwapUtil;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import jnpf.util.file.UploadUtil;
|
|
|
|
|
import jnpf.util.enums.FileTypeEnum;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
@ -42,12 +64,12 @@ import java.util.Map;
|
|
|
|
|
* @版本: V3.2.0
|
|
|
|
|
* @版权: LINKAGE-BOOT
|
|
|
|
|
* @作者: LINKAGE-BOOT研发团队
|
|
|
|
|
* @日期: 2023-01-11
|
|
|
|
|
* @日期: 2023-02-10
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RestController
|
|
|
|
|
@Api(tags = "payment" , value = "example")
|
|
|
|
|
@RequestMapping("/api/example/Payment")
|
|
|
|
|
@Api(tags = "payment" , value = "payment")
|
|
|
|
|
@RequestMapping("/api/payment/Payment")
|
|
|
|
|
public class PaymentController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@ -62,9 +84,43 @@ public class PaymentController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private PaymentService paymentService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Payment_item0Service payment_item0Service;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Paymentdoc_item0Service paymentdoc_item0Service;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PurchaseorderService purchaseorderService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/confirmprice")
|
|
|
|
|
@Transactional
|
|
|
|
|
public ActionResult confirmPrice(@RequestBody PaymentListVO paymentListVO) {
|
|
|
|
|
PaymentEntity paymentEntity = paymentService.getInfo(paymentListVO.getId());
|
|
|
|
|
if (!paymentEntity.getStatus().equals("2")){
|
|
|
|
|
return ActionResult.fail("审核中,请先通过审核");
|
|
|
|
|
}
|
|
|
|
|
QueryWrapper<Payment_item0Entity> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.lambda().eq(Payment_item0Entity::getPaymentId,paymentListVO.getId());
|
|
|
|
|
List<Payment_item0Entity> dList = payment_item0Service.list(queryWrapper);
|
|
|
|
|
for (Payment_item0Entity payment_item0Entity : dList){
|
|
|
|
|
Paymentdoc_item0Entity paymentdoc_item0Entity = paymentdoc_item0Service.getById(payment_item0Entity.getPaymentdocitemId());
|
|
|
|
|
PurchaseorderEntity purchaseorderEntity = purchaseorderService.getById(paymentdoc_item0Entity.getPurchaseorderId());
|
|
|
|
|
if (purchaseorderEntity.getPayPrice().equals(purchaseorderEntity.getAmount())){
|
|
|
|
|
return ActionResult.fail("回款金额等于金额");
|
|
|
|
|
}
|
|
|
|
|
BigDecimal sum = purchaseorderEntity.getPayPrice().add(payment_item0Entity.getAmount());
|
|
|
|
|
if (sum.compareTo(purchaseorderEntity.getAmount()) > 0){
|
|
|
|
|
return ActionResult.fail("总回款金额大于金额");
|
|
|
|
|
}
|
|
|
|
|
purchaseorderEntity.setPayPrice(sum);
|
|
|
|
|
purchaseorderEntity.setStatus("1");
|
|
|
|
|
purchaseorderService.updateById(purchaseorderEntity);
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("认款成功");
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 列表
|
|
|
|
|
*
|
|
|
|
@ -76,12 +132,6 @@ public class PaymentController {
|
|
|
|
|
List<PaymentEntity> list= paymentService.getList(paymentPagination);
|
|
|
|
|
//处理id字段转名称,若无需转或者为空可删除
|
|
|
|
|
for(PaymentEntity entity:list){
|
|
|
|
|
entity.setCreatorUserId(generaterSwapUtil.comSelectValue(entity.getCreatorUserId(), "last"));
|
|
|
|
|
entity.setCreatorUserName(generaterSwapUtil.userSelectValue(entity.getCreatorUserName()));
|
|
|
|
|
entity.setLastModifyUserId(generaterSwapUtil.userSelectValue(entity.getLastModifyUserId()));
|
|
|
|
|
entity.setLastModifyUserName(generaterSwapUtil.userSelectValue(entity.getLastModifyUserName()));
|
|
|
|
|
entity.setDepartmentId(generaterSwapUtil.posSelectValue(entity.getDepartmentId()));
|
|
|
|
|
entity.setOrgnizeId(generaterSwapUtil.posSelectValue(entity.getOrgnizeId()));
|
|
|
|
|
}
|
|
|
|
|
List<PaymentListVO> listVO=JsonUtil.getJsonToList(list,PaymentListVO.class);
|
|
|
|
|
for(PaymentListVO paymentVO:listVO){
|
|
|
|
@ -107,18 +157,17 @@ public class PaymentController {
|
|
|
|
|
public ActionResult create(@RequestBody @Valid PaymentCrForm paymentCrForm) throws DataException {
|
|
|
|
|
String mainId =RandomUtil.uuId();
|
|
|
|
|
UserInfo userInfo=userProvider.get();
|
|
|
|
|
paymentCrForm.setCreatorUserId(StringUtil.isEmpty(userInfo.getDepartmentId()) ? userInfo.getOrganizeId() : userInfo.getDepartmentId());
|
|
|
|
|
paymentCrForm.setCreatorUserName(userInfo.getUserId());
|
|
|
|
|
paymentCrForm.setCreatorTime(DateUtil.getNow());
|
|
|
|
|
if(userInfo.getPositionIds()!=null&&userInfo.getPositionIds().length>0){
|
|
|
|
|
paymentCrForm.setDepartmentId(userInfo.getPositionIds()[0]);
|
|
|
|
|
}
|
|
|
|
|
if(userInfo.getPositionIds()!=null&&userInfo.getPositionIds().length>0){
|
|
|
|
|
paymentCrForm.setOrgnizeId(userInfo.getPositionIds()[0]);
|
|
|
|
|
}
|
|
|
|
|
paymentCrForm.setDocumentno(generaterSwapUtil.getBillNumber("payment", false));
|
|
|
|
|
PaymentEntity entity = JsonUtil.getJsonToBean(paymentCrForm, PaymentEntity.class);
|
|
|
|
|
entity.setId(mainId);
|
|
|
|
|
paymentService.save(entity);
|
|
|
|
|
List<Payment_item0Entity> Payment_item0List = JsonUtil.getJsonToList(paymentCrForm.getPayment_item0List(),Payment_item0Entity.class);
|
|
|
|
|
for(Payment_item0Entity entitys : Payment_item0List){
|
|
|
|
|
entitys.setId(RandomUtil.uuId());
|
|
|
|
|
entitys.setPaymentId(entity.getId());
|
|
|
|
|
payment_item0Service.save(entitys);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ActionResult.success("创建成功");
|
|
|
|
@ -159,12 +208,6 @@ public class PaymentController {
|
|
|
|
|
List<PaymentEntity> list= paymentService.getTypeList(paymentPagination,paymentPaginationExportModel.getDataType());
|
|
|
|
|
//处理id字段转名称,若无需转或者为空可删除
|
|
|
|
|
for(PaymentEntity entity:list){
|
|
|
|
|
entity.setCreatorUserId(generaterSwapUtil.comSelectValue(entity.getCreatorUserId(), "last"));
|
|
|
|
|
entity.setCreatorUserName(generaterSwapUtil.userSelectValue(entity.getCreatorUserName()));
|
|
|
|
|
entity.setLastModifyUserId(generaterSwapUtil.userSelectValue(entity.getLastModifyUserId()));
|
|
|
|
|
entity.setLastModifyUserName(generaterSwapUtil.userSelectValue(entity.getLastModifyUserName()));
|
|
|
|
|
entity.setDepartmentId(generaterSwapUtil.posSelectValue(entity.getDepartmentId()));
|
|
|
|
|
entity.setOrgnizeId(generaterSwapUtil.posSelectValue(entity.getOrgnizeId()));
|
|
|
|
|
}
|
|
|
|
|
List<PaymentListVO> listVO=JsonUtil.getJsonToList(list,PaymentListVO.class);
|
|
|
|
|
for(PaymentListVO paymentVO:listVO){
|
|
|
|
@ -184,20 +227,14 @@ public class PaymentController {
|
|
|
|
|
if(keys.length>0){
|
|
|
|
|
for(String key:keys){
|
|
|
|
|
switch(key){
|
|
|
|
|
case "businessdate" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("业务日期" ,"businessdate"));
|
|
|
|
|
break;
|
|
|
|
|
case "documentno" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("单据编号" ,"documentno"));
|
|
|
|
|
break;
|
|
|
|
|
case "suppliername" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("客户" ,"suppliername"));
|
|
|
|
|
break;
|
|
|
|
|
case "currency" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("币别" ,"currency"));
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商" ,"suppliername"));
|
|
|
|
|
break;
|
|
|
|
|
case "paymentamount" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("付款金额" ,"paymentamount"));
|
|
|
|
|
case "paymenttype" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("付款类型" ,"paymenttype"));
|
|
|
|
|
break;
|
|
|
|
|
case "paymentaccount" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("付款账户" ,"paymentaccount"));
|
|
|
|
@ -205,38 +242,35 @@ public class PaymentController {
|
|
|
|
|
case "paymentbank" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("付款银行" ,"paymentbank"));
|
|
|
|
|
break;
|
|
|
|
|
case "paymenttype" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("付款类型" ,"paymenttype"));
|
|
|
|
|
case "paymentamount" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("付款金额" ,"paymentamount"));
|
|
|
|
|
break;
|
|
|
|
|
case "settlementtype" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("结算类型" ,"settlementtype"));
|
|
|
|
|
case "collectionaccount" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("收款账户" ,"collectionaccount"));
|
|
|
|
|
break;
|
|
|
|
|
case "status" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("单据状态" ,"status"));
|
|
|
|
|
break;
|
|
|
|
|
case "creatorUserId" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("创建人id" ,"creatorUserId"));
|
|
|
|
|
case "collectionbank" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("收款银行" ,"collectionbank"));
|
|
|
|
|
break;
|
|
|
|
|
case "creatorUserName" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("创建人名称" ,"creatorUserName"));
|
|
|
|
|
case "requestedamount" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("申请金额" ,"requestedamount"));
|
|
|
|
|
break;
|
|
|
|
|
case "creatorTime" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("创建时间" ,"creatorTime"));
|
|
|
|
|
case "duedate" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("应付日期" ,"duedate"));
|
|
|
|
|
break;
|
|
|
|
|
case "lastModifyUserId" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("修改人id" ,"lastModifyUserId"));
|
|
|
|
|
case "currency" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("币别 " ,"currency"));
|
|
|
|
|
break;
|
|
|
|
|
case "lastModifyUserName" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("修改人名称" ,"lastModifyUserName"));
|
|
|
|
|
case "settlementtype" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("结算类型" ,"settlementtype"));
|
|
|
|
|
break;
|
|
|
|
|
case "lastModifyTime" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("修改时间" ,"lastModifyTime"));
|
|
|
|
|
case "paymentno" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("来源单号" ,"paymentno"));
|
|
|
|
|
break;
|
|
|
|
|
case "departmentId" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("部门id" ,"departmentId"));
|
|
|
|
|
case "remark" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("备注" ,"remark"));
|
|
|
|
|
break;
|
|
|
|
|
case "orgnizeId" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("组织id" ,"orgnizeId"));
|
|
|
|
|
case "status" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("单据状态" ,"status"));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
@ -269,6 +303,28 @@ public class PaymentController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量删除
|
|
|
|
|
*
|
|
|
|
|
* @param ids
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@DeleteMapping("/batchRemove/{ids}")
|
|
|
|
|
@Transactional
|
|
|
|
|
public ActionResult batchRemove(@PathVariable("ids") String ids){
|
|
|
|
|
String[] idList = ids.split(",");
|
|
|
|
|
int i =0;
|
|
|
|
|
for (String allId : idList){
|
|
|
|
|
this.delete(allId);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
if (i == 0 ){
|
|
|
|
|
return ActionResult.fail("删除失败");
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("删除成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 信息
|
|
|
|
|
*
|
|
|
|
@ -279,20 +335,27 @@ public class PaymentController {
|
|
|
|
|
public ActionResult<PaymentInfoVO> info(@PathVariable("id") String id){
|
|
|
|
|
PaymentEntity entity= paymentService.getInfo(id);
|
|
|
|
|
PaymentInfoVO vo=JsonUtil.getJsonToBean(entity, PaymentInfoVO.class);
|
|
|
|
|
vo.setCreatorUserId(generaterSwapUtil.comSelectValue(vo.getCreatorUserId(), "last"));
|
|
|
|
|
vo.setCreatorUserName(generaterSwapUtil.userSelectValue(vo.getCreatorUserName()));
|
|
|
|
|
if(vo.getCreatorTime()!=null){
|
|
|
|
|
vo.setCreatorTime(vo.getCreatorTime());
|
|
|
|
|
}
|
|
|
|
|
vo.setLastModifyUserId(generaterSwapUtil.userSelectValue(vo.getLastModifyUserId()));
|
|
|
|
|
vo.setLastModifyUserName(generaterSwapUtil.userSelectValue(vo.getLastModifyUserName()));
|
|
|
|
|
if(vo.getLastModifyTime()!=null){
|
|
|
|
|
vo.setLastModifyTime(vo.getLastModifyTime());
|
|
|
|
|
}
|
|
|
|
|
vo.setDepartmentId(generaterSwapUtil.posSelectValue(vo.getDepartmentId()));
|
|
|
|
|
vo.setOrgnizeId(generaterSwapUtil.posSelectValue(vo.getOrgnizeId()));
|
|
|
|
|
|
|
|
|
|
//子表
|
|
|
|
|
List<Payment_item0Entity> Payment_item0List = paymentService.GetPayment_item0List(id);
|
|
|
|
|
List<Payment_item0Model> payment_item0Models = new ArrayList<>();
|
|
|
|
|
Payment_item0Model payment_item0Model = new Payment_item0Model();
|
|
|
|
|
for(Payment_item0Entity payment_item0Entity : Payment_item0List){
|
|
|
|
|
Paymentdoc_item0Entity paymentdoc_item0Entity = paymentdoc_item0Service.getById(payment_item0Entity.getPaymentdocitemId());
|
|
|
|
|
PurchaseorderEntity purchaseorderEntity = purchaseorderService.getById(paymentdoc_item0Entity.getPurchaseorderId());
|
|
|
|
|
payment_item0Model.setAmount(String.valueOf(payment_item0Entity.getAmount()));
|
|
|
|
|
// payment_item0Model.setAmount(String.valueOf(purchaseorderEntity.getAmount()));
|
|
|
|
|
// payment_item0Model.setAmount(String.valueOf(purchaseorderEntity.getAmount()));
|
|
|
|
|
payment_item0Model.setPayPrice(String.valueOf(purchaseorderEntity.getPayPrice()));
|
|
|
|
|
payment_item0Model.setDocumentNo(String.valueOf(purchaseorderEntity.getDocumentNo()));
|
|
|
|
|
payment_item0Model.setContractCode(String.valueOf(purchaseorderEntity.getContractCode()));
|
|
|
|
|
payment_item0Model.setNum(String.valueOf(purchaseorderEntity.getNum()));
|
|
|
|
|
payment_item0Model.setAdvanceAmount(String.valueOf(purchaseorderEntity.getAdvanceAmount()));
|
|
|
|
|
payment_item0Model.setRate(String.valueOf(purchaseorderEntity.getRate()));
|
|
|
|
|
payment_item0Model.setNotAmount(String.valueOf(purchaseorderEntity.getNotAmount()));
|
|
|
|
|
payment_item0Models.add(payment_item0Model);
|
|
|
|
|
}
|
|
|
|
|
vo.setPayment_item0List(payment_item0Models);
|
|
|
|
|
//副表
|
|
|
|
|
return ActionResult.success(vo);
|
|
|
|
|
}
|
|
|
|
@ -309,16 +372,15 @@ public class PaymentController {
|
|
|
|
|
PaymentInfoVO vo=JsonUtil.getJsonToBean(entity, PaymentInfoVO.class);
|
|
|
|
|
|
|
|
|
|
//子表数据转换
|
|
|
|
|
List<Payment_item0Entity> jg_payment_item0List = paymentService.GetPayment_item0List(id);
|
|
|
|
|
List<Payment_item0Model> jg_payment_item0ModelList = JsonUtil.getJsonToList(jg_payment_item0List,Payment_item0Model.class);
|
|
|
|
|
for(Payment_item0Model jg_payment_item0Model : jg_payment_item0ModelList){
|
|
|
|
|
}
|
|
|
|
|
vo.setPayment_item0List(jg_payment_item0ModelList);
|
|
|
|
|
|
|
|
|
|
//附表数据转换
|
|
|
|
|
|
|
|
|
|
//添加到详情表单对象中
|
|
|
|
|
vo.setCreatorUserId(generaterSwapUtil.comSelectValue(vo.getCreatorUserId(), "last"));
|
|
|
|
|
vo.setCreatorUserName(generaterSwapUtil.userSelectValue(vo.getCreatorUserName()));
|
|
|
|
|
vo.setLastModifyUserId(generaterSwapUtil.userSelectValue(vo.getLastModifyUserId()));
|
|
|
|
|
vo.setLastModifyUserName(generaterSwapUtil.userSelectValue(vo.getLastModifyUserName()));
|
|
|
|
|
vo.setDepartmentId(generaterSwapUtil.posSelectValue(vo.getDepartmentId()));
|
|
|
|
|
vo.setOrgnizeId(generaterSwapUtil.posSelectValue(vo.getOrgnizeId()));
|
|
|
|
|
|
|
|
|
|
return ActionResult.success(vo);
|
|
|
|
|
}
|
|
|
|
@ -336,26 +398,29 @@ public class PaymentController {
|
|
|
|
|
@Transactional
|
|
|
|
|
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid PaymentUpForm paymentUpForm) throws DataException {
|
|
|
|
|
UserInfo userInfo=userProvider.get();
|
|
|
|
|
|
|
|
|
|
PaymentEntity entity= paymentService.getInfo(id);
|
|
|
|
|
if (entity.getStatus().equals("2")){
|
|
|
|
|
return ActionResult.fail("已审核,不允许编辑");
|
|
|
|
|
}
|
|
|
|
|
if(entity!=null){
|
|
|
|
|
|
|
|
|
|
// paymentCrForm.setCreatorUserId(StringUtil.isEmpty(userInfo.getDepartmentId()) ? userInfo.getOrganizeId() : userInfo.getDepartmentId());
|
|
|
|
|
// paymentCrForm.setCreatorUserName(userInfo.getUserId());
|
|
|
|
|
|
|
|
|
|
paymentUpForm.setCreatorUserId(entity.getCreatorUserId());
|
|
|
|
|
paymentUpForm.setLastModifyUserId(userInfo.getUserId());
|
|
|
|
|
paymentUpForm.setLastModifyUserName(userInfo.getUserId());
|
|
|
|
|
paymentUpForm.setLastModifyTime(DateUtil.getNow());
|
|
|
|
|
paymentUpForm.setDepartmentId(entity.getDepartmentId());
|
|
|
|
|
paymentUpForm.setOrgnizeId(entity.getOrgnizeId());
|
|
|
|
|
PaymentEntity subentity=JsonUtil.getJsonToBean(paymentUpForm, PaymentEntity.class);
|
|
|
|
|
subentity.setCreatorUserName(entity.getCreatorUserName());
|
|
|
|
|
subentity.setCreatorTime(entity.getCreatorTime());
|
|
|
|
|
paymentService.update(id, subentity);
|
|
|
|
|
System.out.println("#################");
|
|
|
|
|
System.out.println(subentity);
|
|
|
|
|
System.out.println(userInfo);
|
|
|
|
|
|
|
|
|
|
QueryWrapper<Payment_item0Entity> Payment_item0queryWrapper = new QueryWrapper<>();
|
|
|
|
|
Payment_item0queryWrapper.lambda().eq(Payment_item0Entity::getPaymentId, entity.getId());
|
|
|
|
|
List<Payment_item0Entity> list = payment_item0Service.list(Payment_item0queryWrapper);
|
|
|
|
|
payment_item0Service.remove(Payment_item0queryWrapper);
|
|
|
|
|
|
|
|
|
|
List<Payment_item0Entity> Payment_item0List = JsonUtil.getJsonToList(paymentUpForm.getPayment_item0List(),Payment_item0Entity.class);
|
|
|
|
|
for(Payment_item0Entity entitys : Payment_item0List){
|
|
|
|
|
entitys.setId(RandomUtil.uuId());
|
|
|
|
|
entitys.setPaymentId(entity.getId());
|
|
|
|
|
for (Payment_item0Entity payment_item0Entity : list) {
|
|
|
|
|
entitys.setPaymentdocitemId(payment_item0Entity.getPaymentdocitemId());
|
|
|
|
|
}
|
|
|
|
|
payment_item0Service.save(entitys);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ActionResult.success("更新成功");
|
|
|
|
|
}else{
|
|
|
|
|
return ActionResult.fail("更新失败,数据不存在");
|
|
|
|
@ -376,6 +441,9 @@ public class PaymentController {
|
|
|
|
|
PaymentEntity entity= paymentService.getInfo(id);
|
|
|
|
|
if(entity!=null){
|
|
|
|
|
paymentService.delete(entity);
|
|
|
|
|
QueryWrapper<Payment_item0Entity> queryWrapperPayment_item0=new QueryWrapper<>();
|
|
|
|
|
queryWrapperPayment_item0.lambda().eq(Payment_item0Entity::getPaymentId,entity.getId());
|
|
|
|
|
payment_item0Service.remove(queryWrapperPayment_item0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("删除成功");
|
|
|
|
|