jg-waiwang-pro
胡川虎 4 months ago
parent a2e1162e9f
commit 36d0e5cdc5

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-06-06
* 2024-06-24
*/
public interface PaymentApplicationMapper extends BaseMapper<PaymentApplicationEntity> {

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.PaymentapplicationsettlementEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* PaymentApplication
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-06-24
*/
public interface PaymentapplicationsettlementMapper extends BaseMapper<PaymentapplicationsettlementEntity> {
}

@ -2,8 +2,6 @@ package jnpf.service;
import jnpf.model.paymentapplication.*;
import jnpf.entity.*;
import java.io.IOException;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -13,7 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-06-06
* 2024-06-24
*/
public interface PaymentApplicationService extends IService<PaymentApplicationEntity> {
List<PaymentApplicationEntity> getList(PaymentApplicationPagination paymentApplicationPagination);
@ -29,10 +27,13 @@ public interface PaymentApplicationService extends IService<PaymentApplicationEn
boolean update(String id, PaymentApplicationEntity entity);
//子表方法
List<PaymentapplicationsettlementEntity> getPaymentapplicationsettlementList(String id,PaymentApplicationPagination paymentApplicationPagination);
List<PaymentapplicationsettlementEntity> getPaymentapplicationsettlementList(String id);
//副表数据方法
String checkForm(PaymentApplicationForm form,int i);
void saveOrUpdate(PaymentApplicationForm paymentApplicationForm,String id, boolean isSave) throws Exception;
void getPaymentDocPdf(String id) throws IOException;
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.paymentapplication.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* PaymentApplication
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-06-24
*/
public interface PaymentapplicationsettlementService extends IService<PaymentapplicationsettlementEntity> {
QueryWrapper<PaymentapplicationsettlementEntity> getChild(PaymentApplicationPagination pagination,QueryWrapper<PaymentapplicationsettlementEntity> paymentapplicationsettlementQueryWrapper);
}

@ -446,6 +446,22 @@ public class CwsettlementServiceImpl extends ServiceImpl<CwsettlementMapper, Cws
cwsettlementQueryWrapper.lambda().like(CwsettlementEntity::getSettlementSubjectName,value);
}
if(cwsettlementPagination.getExcludeIdList() != null && cwsettlementPagination.getExcludeIdList().size() > 0){
cwsettlementNum++;
cwsettlementQueryWrapper.notIn("id",cwsettlementPagination.getExcludeIdList());
}
if(ObjectUtil.isNotEmpty(cwsettlementPagination.getSubjectId())){
cwsettlementNum++;
cwsettlementQueryWrapper.inSql("id", "SELECT settlement_id FROM jg_cw_settlement_subject WHERE subject_id = " + cwsettlementPagination.getSubjectId());
}
if(ObjectUtil.isNotEmpty(cwsettlementPagination.getContractId())){
cwsettlementNum++;
cwsettlementQueryWrapper.inSql("id", "SELECT settlement_id FROM jg_cw_settlement_contract WHERE contract_id = " + cwsettlementPagination.getContractId());
}
}
if(cwsettlementaccountNum>0){
@ -548,6 +564,9 @@ public class CwsettlementServiceImpl extends ServiceImpl<CwsettlementMapper, Cws
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<CwsettlementEntity> page=new Page<>(cwsettlementPagination.getCurrentPage(), cwsettlementPagination.getPageSize());
if("1".equals(cwsettlementPagination.getQueryFlowTaskPass())){
cwsettlementQueryWrapper.inSql("id", "SELECT f_process_id FROM flow_task WHERE f_status = '2'");
}
IPage<CwsettlementEntity> userIPage=this.page(page, cwsettlementQueryWrapper);
return cwsettlementPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{

@ -1,28 +1,10 @@
package jnpf.service.impl;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import jnpf.base.ActionResult;
import jnpf.engine.controller.FlowBeforeController;
import jnpf.engine.model.flowbefore.FlowBeforeInfoVO;
import jnpf.engine.model.flowbefore.FlowTaskOperatorRecordModel;
import jnpf.engine.model.flowengine.FlowModel;
import jnpf.entity.*;
import jnpf.exception.WorkFlowException;
import jnpf.mapper.CwpaymentreceiptMapper;
import jnpf.mapper.PaymentApplicationMapper;
import jnpf.model.cwpaymentreceipt.PaymentdocMessage;
import jnpf.permission.entity.OrganizeEntity;
import jnpf.permission.service.OrganizeService;
import jnpf.permission.service.UserService;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.paymentapplication.*;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
@ -32,13 +14,10 @@ import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.net.URLEncoder;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import jnpf.util.context.SpringContext;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
@ -51,16 +30,13 @@ import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
import javax.servlet.http.HttpServletResponse;
/**
*
* PaymentApplication
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-06-06
* 2024-06-24
*/
@Service
public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicationMapper, PaymentApplicationEntity> implements PaymentApplicationService{
@ -69,16 +45,9 @@ public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicatio
@Autowired
private UserProvider userProvider;
@Autowired
private CwpaymentreceiptMapper cwpaymentreceiptMapper;
@Autowired
private OrganizeService organizeService;
@Autowired
private UserService userService;
@Autowired
private SubjectbasicService subjectbasicService;
@Autowired
private PaymentapplicationsettlementService paymentapplicationsettlementService;
@Override
public List<PaymentApplicationEntity> getList(PaymentApplicationPagination paymentApplicationPagination){
return getTypeList(paymentApplicationPagination,paymentApplicationPagination.getDataType());
@ -97,6 +66,9 @@ public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicatio
int total=0;
int paymentApplicationNum =0;
QueryWrapper<PaymentApplicationEntity> paymentApplicationQueryWrapper=new QueryWrapper<>();
int paymentapplicationsettlementNum =0;
QueryWrapper<PaymentapplicationsettlementEntity> paymentapplicationsettlementQueryWrapper=new QueryWrapper<>();
long paymentapplicationsettlementcount = paymentapplicationsettlementService.count();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(paymentApplicationPagination.getSuperQueryJson())){
@ -114,6 +86,14 @@ public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicatio
intersectionSuperList.add(paymentApplicationList);
superNum++;
}
String paymentapplicationsettlementTable = "jg_cw_payment_application_settlement";
boolean paymentapplicationsettlementHasSql = queryJson.contains(paymentapplicationsettlementTable);
List<String> paymentapplicationsettlementList = generaterSwapUtil.selectIdsByChildCondition(PaymentApplicationConstant.getTableList(), paymentapplicationsettlementTable , queryJson, null);
if (paymentapplicationsettlementHasSql){
allSuperList.addAll(paymentapplicationsettlementList);
intersectionSuperList.add(paymentapplicationsettlementList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
@ -138,6 +118,14 @@ public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicatio
intersectionRuleList.add(paymentApplicationList);
ruleNum++;
}
String paymentapplicationsettlementTable = "jg_cw_payment_application_settlement";
boolean paymentapplicationsettlementHasSql = ruleJson.contains(paymentapplicationsettlementTable);
List<String> paymentapplicationsettlementList = generaterSwapUtil.selectIdsByChildCondition(PaymentApplicationConstant.getTableList(), paymentapplicationsettlementTable , ruleJson, null);
if (paymentapplicationsettlementHasSql){
allRuleList.addAll(paymentapplicationsettlementList);
intersectionRuleList.add(paymentapplicationsettlementList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
@ -146,79 +134,115 @@ public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicatio
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = true;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object paymentApplicationObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentApplicationQueryWrapper,PaymentApplicationEntity.class,paymentApplicationPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(paymentApplicationObj)){
return new ArrayList<>();
} else {
paymentApplicationQueryWrapper = (QueryWrapper<PaymentApplicationEntity>)paymentApplicationObj;
if( paymentApplicationQueryWrapper.getExpression().getNormal().size()>0){
paymentApplicationNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object paymentApplicationObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentApplicationQueryWrapper,PaymentApplicationEntity.class,paymentApplicationPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(paymentApplicationObj)){
return new ArrayList<>();
} else {
paymentApplicationQueryWrapper = (QueryWrapper<PaymentApplicationEntity>)paymentApplicationObj;
if( paymentApplicationQueryWrapper.getExpression().getNormal().size()>0){
paymentApplicationNum++;
}
boolean pcPermission = true;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object paymentApplicationObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentApplicationQueryWrapper,PaymentApplicationEntity.class,paymentApplicationPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(paymentApplicationObj)){
return new ArrayList<>();
} else {
paymentApplicationQueryWrapper = (QueryWrapper<PaymentApplicationEntity>)paymentApplicationObj;
if( paymentApplicationQueryWrapper.getExpression().getNormal().size()>0){
paymentApplicationNum++;
}
}
Object paymentapplicationsettlementObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentapplicationsettlementQueryWrapper,PaymentapplicationsettlementEntity.class,paymentApplicationPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(paymentapplicationsettlementObj)){
return new ArrayList<>();
} else {
paymentapplicationsettlementQueryWrapper = (QueryWrapper<PaymentapplicationsettlementEntity>)paymentapplicationsettlementObj;
if( paymentapplicationsettlementQueryWrapper.getExpression().getNormal().size()>0){
paymentapplicationsettlementNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object paymentApplicationObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentApplicationQueryWrapper,PaymentApplicationEntity.class,paymentApplicationPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(paymentApplicationObj)){
return new ArrayList<>();
} else {
paymentApplicationQueryWrapper = (QueryWrapper<PaymentApplicationEntity>)paymentApplicationObj;
if( paymentApplicationQueryWrapper.getExpression().getNormal().size()>0){
paymentApplicationNum++;
}
}
}
}
Object paymentapplicationsettlementObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentapplicationsettlementQueryWrapper,PaymentapplicationsettlementEntity.class,paymentApplicationPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(paymentapplicationsettlementObj)){
return new ArrayList<>();
} else {
paymentapplicationsettlementQueryWrapper = (QueryWrapper<PaymentapplicationsettlementEntity>)paymentapplicationsettlementObj;
if( paymentapplicationsettlementQueryWrapper.getExpression().getNormal().size()>0){
paymentapplicationsettlementNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(paymentApplicationPagination.getCode())){
paymentApplicationNum++;
paymentApplicationNum++;
String value = paymentApplicationPagination.getCode() instanceof List ?
JsonUtil.getObjectToString(paymentApplicationPagination.getCode()) :
String.valueOf(paymentApplicationPagination.getCode());
JsonUtil.getObjectToString(paymentApplicationPagination.getCode()) :
String.valueOf(paymentApplicationPagination.getCode());
paymentApplicationQueryWrapper.lambda().like(PaymentApplicationEntity::getCode,value);
}
if(ObjectUtil.isNotEmpty(paymentApplicationPagination.getPreparationTime())){
paymentApplicationNum++;
List PreparationTimeList = JsonUtil.getJsonToList(paymentApplicationPagination.getPreparationTime(),String.class);
Long fir = Long.valueOf(String.valueOf(PreparationTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(PreparationTimeList.get(1)));
paymentApplicationQueryWrapper.ge("f_creator_time", new Date(fir))
.le("f_creator_time", DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(ObjectUtil.isNotEmpty(paymentApplicationPagination.getPayee())){
paymentApplicationNum++;
paymentApplicationNum++;
String value = paymentApplicationPagination.getPayee() instanceof List ?
JsonUtil.getObjectToString(paymentApplicationPagination.getPayee()) :
String.valueOf(paymentApplicationPagination.getPayee());
JsonUtil.getObjectToString(paymentApplicationPagination.getPayee()) :
String.valueOf(paymentApplicationPagination.getPayee());
paymentApplicationQueryWrapper.lambda().like(PaymentApplicationEntity::getPayee,value);
}
if(ObjectUtil.isNotEmpty(paymentApplicationPagination.getPayer())){
paymentApplicationNum++;
paymentApplicationNum++;
String value = paymentApplicationPagination.getPayer() instanceof List ?
JsonUtil.getObjectToString(paymentApplicationPagination.getPayer()) :
String.valueOf(paymentApplicationPagination.getPayer());
JsonUtil.getObjectToString(paymentApplicationPagination.getPayer()) :
String.valueOf(paymentApplicationPagination.getPayer());
paymentApplicationQueryWrapper.lambda().like(PaymentApplicationEntity::getPayer,value);
}
if(ObjectUtil.isNotEmpty(paymentApplicationPagination.getPaymentState())){
paymentApplicationNum++;
String value = paymentApplicationPagination.getPaymentState() instanceof List ?
JsonUtil.getObjectToString(paymentApplicationPagination.getPaymentState()) :
String.valueOf(paymentApplicationPagination.getPaymentState());
paymentApplicationQueryWrapper.lambda().like(PaymentApplicationEntity::getPaymentState,value);
}
if(ObjectUtil.isNotEmpty(paymentApplicationPagination.getDocState())){
paymentApplicationNum++;
String value = paymentApplicationPagination.getDocState() instanceof List ?
JsonUtil.getObjectToString(paymentApplicationPagination.getDocState()) :
String.valueOf(paymentApplicationPagination.getDocState());
paymentApplicationQueryWrapper.lambda().like(PaymentApplicationEntity::getDocState,value);
}
}
if(paymentapplicationsettlementNum>0){
List<String> paymentapplicationsettlementIdList = paymentapplicationsettlementService.list(paymentapplicationsettlementQueryWrapper).stream().filter(t->StringUtil.isNotEmpty(t.getPaymentApplicationId())).map(t->t.getPaymentApplicationId()).collect(Collectors.toList());
long count = paymentapplicationsettlementService.count();
if (count>0){
intersectionList.add(paymentapplicationsettlementIdList);
}
AllIdList.addAll(paymentapplicationsettlementIdList);
}
total+=paymentapplicationsettlementNum;
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
@ -226,7 +250,7 @@ public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicatio
}
paymentApplicationQueryWrapper.lambda().in(PaymentApplicationEntity::getId, intersection);
}
//是否有高级查询
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
@ -234,7 +258,7 @@ public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicatio
List<String> finalAllSuperIDlist = allSuperIDlist;
paymentApplicationQueryWrapper.lambda().and(t->t.in(PaymentApplicationEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
@ -295,6 +319,27 @@ public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicatio
this.removeById(entity.getId());
}
}
/** Paymentapplicationsettlement子表方法 */
@Override
public List<PaymentapplicationsettlementEntity> getPaymentapplicationsettlementList(String id,PaymentApplicationPagination paymentApplicationPagination){
Map<String, Object> newtabMap=PaymentApplicationConstant.TABLEFIELDKEY.entrySet()
.stream().collect( Collectors.toMap(e->e.getValue(),e->e.getKey()));
String tableName="paymentapplicationsettlement";
tableName=newtabMap.get(tableName)==null?tableName:newtabMap.get(tableName).toString();
QueryWrapper<PaymentapplicationsettlementEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = paymentapplicationsettlementService.getChild(paymentApplicationPagination,queryWrapper);
queryWrapper.lambda().eq(PaymentapplicationsettlementEntity::getPaymentApplicationId, id);
generaterSwapUtil.wrapperHandle(PaymentApplicationConstant.getColumnData(), PaymentApplicationConstant.getAppColumnData(), queryWrapper,PaymentapplicationsettlementEntity.class,"sub",tableName);
return paymentapplicationsettlementService.list(queryWrapper);
}
/** Paymentapplicationsettlement子表方法 */
@Override
public List<PaymentapplicationsettlementEntity> getPaymentapplicationsettlementList(String id){
QueryWrapper<PaymentapplicationsettlementEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(PaymentapplicationsettlementEntity::getPaymentApplicationId, id);
return paymentapplicationsettlementService.list(queryWrapper);
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(PaymentApplicationForm form,int i) {
@ -305,174 +350,74 @@ public class PaymentApplicationServiceImpl extends ServiceImpl<PaymentApplicatio
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getPayee())){
return "收款方不能为空";
}
if(StringUtil.isEmpty(form.getPayer())){
return "付款方不能为空";
}
if(StringUtil.isEmpty(form.getPayee())){
return "收款方不能为空";
}
if(StringUtil.isEmpty(form.getPayer())){
return "付款方不能为空";
}
/*if(StringUtil.isNotEmpty(form.getPayer())){
form.setPayer(form.getPayer().trim());
QueryWrapper<PaymentApplicationEntity> payerWrapper=new QueryWrapper<>();
payerWrapper.lambda().eq(PaymentApplicationEntity::getPayer,form.getPayer());
//假删除标志
payerWrapper.lambda().isNull(PaymentApplicationEntity::getDeleteMark);
if (isUp){
payerWrapper.lambda().ne(PaymentApplicationEntity::getId, id);
}
if((int) this.count(payerWrapper)>0){
countRecover = "付款方不能重复";
}
}*/
//子表字段验证
if (form.getPaymentapplicationsettlementList()!=null){
}
return countRecover;
}
/**
* ()
* @param id
* @param paymentApplicationForm
* @return
*/
* ()
* @param id
* @param paymentApplicationForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(PaymentApplicationForm paymentApplicationForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
paymentApplicationForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(PaymentApplicationConstant.getFormData(),paymentApplicationForm),PaymentApplicationForm.class);
generaterSwapUtil.swapDatetime(PaymentApplicationConstant.getFormData(),paymentApplicationForm),PaymentApplicationForm.class);
PaymentApplicationEntity entity = JsonUtil.getJsonToBean(paymentApplicationForm, PaymentApplicationEntity.class);
if(isSave){
String mainId = id ;
entity.setCode(generaterSwapUtil.getBillNumber("FKSQ", false));
String mainId = RandomUtil.uuId() ;
entity.setCode(generaterSwapUtil.getBillNumber("FKSQ", false));
entity.setId(mainId);
entity.setFlowId(paymentApplicationForm.getFlowId());
entity.setVersion(0);
}else{
entity.setCode(generaterSwapUtil.getBillNumber("FKSQ", false));
entity.setFlowId(paymentApplicationForm.getFlowId());
entity.setCode(generaterSwapUtil.getBillNumber("FKSQ", false));
}
this.saveOrUpdate(entity);
}
@Override
public void getPaymentDocPdf(String id) throws IOException {
List<Map<String, Object>> paymentDocNodeInfo = cwpaymentreceiptMapper.getPaymentDocNodeInfo(id);
String stringtime = null;
if (paymentDocNodeInfo != null && paymentDocNodeInfo.size() > 0) {
System.out.println( paymentDocNodeInfo.get(0).get("handleTime"));
stringtime=paymentDocNodeInfo.get(0).get("handleTime").toString();
}
PaymentdocMessage paymentdocMessage =new PaymentdocMessage();
PaymentApplicationEntity paymentApplicationEntity = this.getById(id);
SubjectbasicEntity subjectbasicEntity = subjectbasicService.getById(paymentApplicationEntity.getSubjectId());
UserEntity userEntity = userService.getInfo(paymentApplicationEntity.getCreatorUserId());
paymentdocMessage.setRealName(userEntity.getRealName());
paymentdocMessage.setMobilePhone(userEntity.getAccount());
paymentdocMessage.setNowTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(paymentApplicationEntity.getCreatorTime()));
OrganizeEntity companyEntity = organizeService.getById(paymentApplicationEntity.getCompanyId());
if(companyEntity == null){
companyEntity = new OrganizeEntity();
}
paymentdocMessage.setCustomerName(companyEntity.getFullName() + "请示");
paymentdocMessage.setDocumentNo(paymentApplicationEntity.getCode());
paymentdocMessage.setSupplierName(paymentApplicationEntity.getPayee());
paymentdocMessage.setRamout(paymentApplicationEntity.getApplyAmount().toString());
paymentdocMessage.setPaymentAmout("");
paymentdocMessage.setCollectionAccout(subjectbasicEntity.getBankAccount());
paymentdocMessage.setColletionBank(subjectbasicEntity.getBankBranchName());
paymentdocMessage.setRemark(paymentApplicationEntity.getRemark());
paymentdocMessage.setEnclosure(paymentApplicationEntity.getAnnex());
paymentdocMessage.setPayType("货款");
OrganizeEntity departmentEntity = organizeService.getById(paymentApplicationEntity.getDepartmentId());
if(departmentEntity == null){
departmentEntity = new OrganizeEntity();
}
paymentdocMessage.setFullName(companyEntity.getFullName() + "/" + departmentEntity.getFullName());
StringBuilder payEnclosureStr = new StringBuilder();
if (paymentdocMessage.getEnclosure() != null) {//附件不为空
String enclosure = paymentdocMessage.getEnclosure();
JSONArray jsonToJsonArray = JsonUtil.getJsonToJsonArray(enclosure);
for (int i = 0; i < jsonToJsonArray.size(); i++) {
Map o = (Map) jsonToJsonArray.get(i);
Object name = o.get("name");
if (i == 0) {
payEnclosureStr.append(name);
} else {
payEnclosureStr.append("<br/>" + name);
}
}
paymentdocMessage.setEnclosure(payEnclosureStr.toString());
if(paymentApplicationForm.getPaymentapplicationsettlementList()!=null && paymentApplicationForm.getPaymentapplicationsettlementList().size()>0){
//entity.set
}
this.saveOrUpdate(entity);
// StringUtil.indexOf()
// String templateFilePath = configValueUtil.getTemplateFilePath() +"paymentDocPdf//";
Map<String, Object> map = JsonUtil.stringToMap(JSONUtil.toJsonStr(paymentdocMessage));
map.put("substring", companyEntity.getFullName());
map.put("substring1", departmentEntity.getFullName());
// map.put("reportList",paymentDocNodeInfo);
FlowBeforeController bean = SpringContext.getBean(FlowBeforeController.class);
ActionResult info = null;
try {
info = bean.info(id, new FlowModel());
} catch (WorkFlowException e) {
throw new RuntimeException(e);
}
FlowBeforeInfoVO data = (FlowBeforeInfoVO) info.getData();
List<FlowTaskOperatorRecordModel> recordList = data.getFlowTaskOperatorRecordList();
List<Map<String, Object>> maps = new ArrayList<>();
for (int i = 0; i < recordList.size(); i++) {
Map<String, Object> map1 = new HashMap<String, Object>();
FlowTaskOperatorRecordModel model = recordList.get(i);
Map<String, Object> map2 = paymentDocNodeInfo.get(i);
map1.put("realName", model.getUserName());
map1.put("nodeName", model.getNodeName());
map1.put("handleOpinion", model.getHandleOpinion());
map1.put("handleTime", DateUtil.daFormat(model.getHandleTime()));
map1.put("node", map2.get("node"));
maps.add(map1);
//Paymentapplicationsettlement子表数据新增修改
if(!isSave){
QueryWrapper<PaymentapplicationsettlementEntity> PaymentapplicationsettlementqueryWrapper = new QueryWrapper<>();
PaymentapplicationsettlementqueryWrapper.lambda().eq(PaymentapplicationsettlementEntity::getPaymentApplicationId, entity.getId());
paymentapplicationsettlementService.remove(PaymentapplicationsettlementqueryWrapper);
}
ArrayList<Map<String, Object>> maps1 = new ArrayList<Map<String, Object>>();
int num = 6;
if (maps.size() > num) {
for (int i = 0; i < maps.size(); i++) {
Map<String, Object> map1 = maps.get(i);
if (i >= num) {
maps1.add(map1);
if (paymentApplicationForm.getPaymentapplicationsettlementList()!=null){
List<PaymentapplicationsettlementEntity> tableField113 = JsonUtil.getJsonToList(paymentApplicationForm.getPaymentapplicationsettlementList(),PaymentapplicationsettlementEntity.class);
for(PaymentapplicationsettlementEntity entitys : tableField113){
entitys.setId(RandomUtil.uuId());
entitys.setPaymentApplicationId(entity.getId());
if(isSave){
}else{
}
paymentapplicationsettlementService.saveOrUpdate(entitys);
}
while (maps.size() > num) {
maps.remove(num);
}
}
map.put("reportList", maps);
map.put("reportList1", maps1);
byte[] bytes = null;
ByteArrayOutputStream out = null;
ExportPdf exportPdf = new ExportPdf();
// word模板
try {
out = exportPdf.createPdf(map, "paymentDoc.ftl", "/templates/export");
bytes = out.toByteArray();
out.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
String fileName = paymentdocMessage.getCustomerName() == null ? companyEntity.getFullName() + "请示.pdf" : companyEntity.getFullName() + "请示(" + paymentdocMessage.getCustomerName() + ").pdf";
HttpServletResponse response = ServletUtil.getResponse();
response.reset();
String excelTitle = fileName;
String filen = null;
try {
filen = URLEncoder.encode(excelTitle, "UTF-8").replaceAll("\\+", "%20");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
// 设置response的Header
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + filen);
response.setContentType("application/x-download;charset=utf-8");
BufferedOutputStream toClient = null;
try {
toClient = new BufferedOutputStream(response.getOutputStream());
toClient.write(out.toByteArray());
toClient.flush();
toClient.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
log.warn("pdf文件生成成功");
}
}

@ -0,0 +1,59 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.PaymentapplicationsettlementMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.paymentapplication.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* PaymentApplication
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-06-24
*/
@Service
public class PaymentapplicationsettlementServiceImpl extends ServiceImpl<PaymentapplicationsettlementMapper, PaymentapplicationsettlementEntity> implements PaymentapplicationsettlementService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<PaymentapplicationsettlementEntity> getChild(PaymentApplicationPagination pagination, QueryWrapper<PaymentapplicationsettlementEntity> paymentapplicationsettlementQueryWrapper){
boolean pcPermission = true;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?PaymentApplicationConstant.getColumnData():PaymentApplicationConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
return paymentapplicationsettlementQueryWrapper;
}
}

@ -8,6 +8,7 @@ import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.service.UserService;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
@ -15,8 +16,6 @@ import jnpf.model.paymentapplication.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
@ -36,7 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-06-06
* @ 2024-06-24
*/
@Slf4j
@RestController
@ -53,24 +52,31 @@ public class PaymentApplicationController {
@Autowired
private PaymentApplicationService paymentApplicationService;
@Autowired
private PaymentapplicationsettlementService paymentapplicationsettlementService;
@Autowired
private UserService userService;
/**
*
*
* @param paymentApplicationPagination
* @return
*/
*
*
* @param paymentApplicationPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody PaymentApplicationPagination paymentApplicationPagination)throws IOException{
List<PaymentApplicationEntity> list= paymentApplicationService.getList(paymentApplicationPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (PaymentApplicationEntity entity : list) {
Map<String, Object> paymentApplicationMap=JsonUtil.entityToMap(entity);
paymentApplicationMap.put("id", paymentApplicationMap.get("id"));
//副表数据
//子表数据
UserEntity userEntity = userService.getById(entity.getCreatorUserId());
entity.setCreatorUserName(userEntity.getRealName());
Map<String, Object> paymentApplicationMap=JsonUtil.entityToMap(entity);
paymentApplicationMap.put("id", paymentApplicationMap.get("id"));
//副表数据
//子表数据
List<PaymentapplicationsettlementEntity> paymentapplicationsettlementList = paymentApplicationService.getPaymentapplicationsettlementList(entity.getId(),paymentApplicationPagination);
paymentApplicationMap.put("tableField113",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(paymentapplicationsettlementList)));
realList.add(paymentApplicationMap);
}
//数据转换
@ -104,11 +110,11 @@ public class PaymentApplicationController {
return ActionResult.success(vo);
}
/**
*
*
* @param paymentApplicationForm
* @return
*/
*
*
* @param paymentApplicationForm
* @return
*/
@PostMapping("/{id}")
@Operation(summary = "创建")
public ActionResult create(@PathVariable("id") String id, @RequestBody @Valid PaymentApplicationForm paymentApplicationForm) {
@ -124,15 +130,15 @@ public class PaymentApplicationController {
return ActionResult.success("创建成功");
}
/**
*
* @param id
* @param paymentApplicationForm
* @return
*/
*
* @param id
* @param paymentApplicationForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid PaymentApplicationForm paymentApplicationForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
@RequestParam(value = "isImport", required = false) boolean isImport){
paymentApplicationForm.setId(id);
if (!isImport) {
String b = paymentApplicationService.checkForm(paymentApplicationForm,1);
@ -153,10 +159,10 @@ public class PaymentApplicationController {
}
}
/**
*
* @param id
* @return
*/
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
@ -178,11 +184,11 @@ public class PaymentApplicationController {
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
@ -194,15 +200,17 @@ public class PaymentApplicationController {
paymentApplicationMap.put("id", paymentApplicationMap.get("id"));
//副表数据
//子表数据
List<PaymentapplicationsettlementEntity> paymentapplicationsettlementList = paymentApplicationService.getPaymentapplicationsettlementList(entity.getId());
paymentApplicationMap.put("tableField113",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(paymentapplicationsettlementList)));
paymentApplicationMap = generaterSwapUtil.swapDataDetail(paymentApplicationMap,PaymentApplicationConstant.getFormData(),"568458500523427653",false);
return ActionResult.success(paymentApplicationMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
@ -214,17 +222,26 @@ public class PaymentApplicationController {
paymentApplicationMap.put("id", paymentApplicationMap.get("id"));
//副表数据
//子表数据
List<PaymentapplicationsettlementEntity> paymentapplicationsettlementList = paymentApplicationService.getPaymentapplicationsettlementList(entity.getId());
paymentApplicationMap.put("paymentapplicationsettlementList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(paymentapplicationsettlementList)));
paymentApplicationMap = generaterSwapUtil.swapDataForm(paymentApplicationMap,PaymentApplicationConstant.getFormData(),PaymentApplicationConstant.TABLEFIELDKEY,PaymentApplicationConstant.TABLERENAMES);
return ActionResult.success(paymentApplicationMap);
}
/**
*
* @param id id
* @throws Exception
*
* @param id
* @return
*/
@GetMapping(value = "/downloadPdf/{id}/{token}")
public void downloadPdf(HttpServletResponse response, @PathVariable("id") String id, @PathVariable("token")String token) throws IOException {
paymentApplicationService.getPaymentDocPdf(id);
@Operation(summary = "结案")
@GetMapping("closeCase/{id}")
@Transactional
public ActionResult closeCase(@PathVariable("id") String id){
PaymentApplicationEntity entity= paymentApplicationService.getInfo(id);
if(entity!=null){
entity.setDocState("2");//已完成
paymentApplicationService.update(id,entity);
}
return ActionResult.success("结案成功");
}
}

@ -110,4 +110,25 @@ public class PaymentApplicationEntity {
private BigDecimal addAmount;
@TableField(value = "upward_floating_amount" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal upwardFloatingAmount;
@TableField(value = "transaction_type" , updateStrategy = FieldStrategy.IGNORED)
private String transactionType;
@TableField(value = "apply_weight" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal applyWeight;
@TableField(value = "bfs_flag" , updateStrategy = FieldStrategy.IGNORED)
private String bfsFlag;
@TableField(value = "bfs_message" , updateStrategy = FieldStrategy.IGNORED)
private String bfsMessage;
@TableField(value = "payment_amount" , updateStrategy = FieldStrategy.IGNORED)
private String paymentAmount;
@TableField(value = "payment_state" , updateStrategy = FieldStrategy.IGNORED)
private String paymentState;
@TableField(value = "doc_state" , updateStrategy = FieldStrategy.IGNORED)
private String docState;
@TableField(value = "settlement_state" , updateStrategy = FieldStrategy.IGNORED)
private String settlementState;
@TableField(exist = false)
private String creatorUserName;
}

@ -0,0 +1,60 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-06-24
*/
@Data
@TableName("jg_cw_payment_application_settlement")
public class PaymentapplicationsettlementEntity {
@TableId(value ="ID" )
private String id;
@TableField("PAYMENT_APPLICATION_ID")
private String paymentApplicationId;
@TableField("PAYMENT_APPLICATION_CODE")
private String paymentApplicationCode;
@TableField(value = "SETTLEMENT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String settlementId;
@TableField(value = "SETTLEMENT_CODE" , updateStrategy = FieldStrategy.IGNORED)
private String settlementCode;
@TableField(value = "SETTLEMENT_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal settlementAmount;
@TableField(value = "ORDER_CODE" , updateStrategy = FieldStrategy.IGNORED)
private String orderCode;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_VERSION")
private Integer version;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
@TableField("F_FLOW_TASK_ID")
private String flowTaskId;
}

@ -40,4 +40,13 @@ public class CwsettlementPagination extends Pagination {
private Object settlementSubjectName;
@JsonProperty("preparationTime")
private Object preparationTime;
@JsonProperty("subjectId")
private String subjectId;
@JsonProperty("contractId")
private String contractId;
@JsonProperty("excludeIdList")
private List<String> excludeIdList;
@JsonProperty("queryFlowTaskPass")
private String queryFlowTaskPass;
}

@ -20,6 +20,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class PaymentApplicationForm {
/** 主键 */
private String id;
/** 子表数据 **/
@JsonProperty("paymentapplicationsettlementList")
private List<PaymentapplicationsettlementModel> paymentapplicationsettlementList;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
@ -82,4 +85,15 @@ public class PaymentApplicationForm {
private BigDecimal planAvailableAmount;
private BigDecimal addAmount;
private BigDecimal upwardFloatingAmount;
private String transactionType;
private BigDecimal applyWeight;
private String bfsFlag;
private String bfsMessage;
private String paymentAmount;
private String paymentState;
private String docState;
private String settlementState;
}

@ -11,7 +11,7 @@ import java.util.List;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-06-06
* @ 2024-06-24
*/
@Data
public class PaymentApplicationPagination extends Pagination {
@ -36,6 +36,9 @@ public class PaymentApplicationPagination extends Pagination {
/** 付款方 */
@JsonProperty("payer")
private Object payer;
@JsonProperty("preparationTime")
private Object preparationTime;
@JsonProperty("payment_state")
private Object paymentState;
@JsonProperty("doc_state")
private Object docState;
}

@ -0,0 +1,33 @@
package jnpf.model.paymentapplication;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* PaymentApplication
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-06-24
*/
@Data
public class PaymentapplicationsettlementModel {
/** 结算单id **/
@JSONField(name = "settlementId")
private String settlementId;
/** 结算单编号 **/
@JSONField(name = "settlementCode")
private String settlementCode;
/** 结算金额 **/
@JSONField(name = "settlementAmount")
private String settlementAmount;
/** 订单编号 **/
@JSONField(name = "orderCode")
private String orderCode;
}
Loading…
Cancel
Save