充值功能 init

master
guochaojie 3 months ago
parent 410ae883b1
commit cc836a7cd5

@ -0,0 +1,25 @@
-----BEGIN CERTIFICATE-----
MIIELjCCAxagAwIBAgIUL3BGpENxaOOyw7pbzx/5QVJq1N0wDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
Q0EwHhcNMjQwMzExMDkwMjA4WhcNMjkwMzEwMDkwMjA4WjCBhzETMBEGA1UEAwwK
MTY2ODUyNzk1MzEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMTMwMQYDVQQL
DCrkuIrmtbfplb/msZ/kupHmga/mlbDlrZfnp5HmioDmnInpmZDlhazlj7gxCzAJ
BgNVBAYTAkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcNAQEBBQAD
ggEPADCCAQoCggEBAOKEZU4HFlimKzHLOgEV8lwJxkJrifWYSSo6l8SbNcv4lEgZ
mXha5y3a2XqzCAX3DIfXb5KiV1LP/QyWSAgsTV+g7ryyyP5i9JWvTiyWC8tHLGj5
cp58V7ifq6UrXIWSeSt81r33ZHnngDIWYTtHPy3DfU+1+yLlKP3t+5UCWRp7w+DC
UZKen9ygAMW9ZXSIB/LasAu6d3h9CVZQd/cVG7pslvO/Iedf1jvVATNx5d08XLSY
bQGgenNpRrAIgnWzapa2fiBlHR7vmTI8GimmXEkHXLBy6GUbwrMOuLJ/qVWNtgGs
OZ5QKYyAufWfp8nf4ZibU0Mk/ZELr3iWAiJap1UCAwEAAaOBuTCBtjAJBgNVHRME
AjAAMAsGA1UdDwQEAwID+DCBmwYDVR0fBIGTMIGQMIGNoIGKoIGHhoGEaHR0cDov
L2V2Y2EuaXRydXMuY29tLmNuL3B1YmxpYy9pdHJ1c2NybD9DQT0xQkQ0MjIwRTUw
REJDMDRCMDZBRDM5NzU0OTg0NkMwMUMzRThFQkQyJnNnPUhBQ0M0NzFCNjU0MjJF
MTJCMjdBOUQzM0E4N0FEMUNERjU5MjZFMTQwMzcxMA0GCSqGSIb3DQEBCwUAA4IB
AQCt9QtqT/i2d6aJx4TNjuh3CF6WKjphFVAKqnse+3qr6PQR4D8NzgdbAECdBbJt
U0R20n4UGMZNijoIy1CaOqJCuLavuU+wZxvQnzFJihjCKWmn8NRs9vYtDaDpbns5
X+9Dt/uw1tuvXZbRqg0X+bfPNBDUU/WBFqwQ2XpawVa2v5+BIvYovuOeI01VxuiF
MXqs6Lteg3FiMnOFgTYSPq5jcFZK/FvhPGVu8pmPkmDeRoc0jPPNDryvhVeR91cQ
kdEgYktuprSWJlXGP+Og4S7DLOBenLnwoB2MzN/E/jE2gHwxfff/ckyGVZ5nC2CJ
za+em1H7eL+LTMqdqHRckg0N
-----END CERTIFICATE-----

@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDihGVOBxZYpisx
yzoBFfJcCcZCa4n1mEkqOpfEmzXL+JRIGZl4Wuct2tl6swgF9wyH12+SoldSz/0M
lkgILE1foO68ssj+YvSVr04slgvLRyxo+XKefFe4n6ulK1yFknkrfNa992R554Ay
FmE7Rz8tw31Ptfsi5Sj97fuVAlkae8PgwlGSnp/coADFvWV0iAfy2rALund4fQlW
UHf3FRu6bJbzvyHnX9Y71QEzceXdPFy0mG0BoHpzaUawCIJ1s2qWtn4gZR0e75ky
PBopplxJB1ywcuhlG8KzDriyf6lVjbYBrDmeUCmMgLn1n6fJ3+GYm1NDJP2RC694
lgIiWqdVAgMBAAECggEAMY2nH8+7Gr+XWXhNAynK8EmPHr6p2plrABr7Up5lwW5q
+e7nvQWd51EmHIqH6c4m5pzBosFy+wHXKObDcU5HyvDI6WzvPX9mZEyKfISCpgC2
/Wv8oCExi4kaorJ+thXZ/iJ8U+iICYcUa2Cr+qzWbGuEwWhdPUAGnK5wSCPQXFNn
oAuC86dD/IWsDgT5UreofNl0Sd4aepq3gNzAqpCKG16golkwMD0vybpaPc4uiwKv
CZt06GRfgwOzI4S5kqM/HYptgBQiO6+SKbiS2MKVmamadsN/NIpd/24xH6IYaiMX
sXYVd1gYxE8bQ79XdZ6xthLYoLGspGPfYWabym2CLQKBgQD1jITwJ+oVHyDscBan
TEJhOaVv7n1dMFka9JAouYYJrhTF2LAwSTmqf3Yp0YrY/ucv9WXRpzO6YBN2bWO+
9PCgqgCEFirBEftfaC0CA2D2bpED5iBe6Y09ueJBIWSgzCFDiMlDhVKy0+ZraUZ3
WkYNW9CEd3LnhQMnIiEEhsdMywKBgQDsKIIbog39E0hAY/02edH+tVEDjyJrdb2m
kqv65sH3NmFsWGWEeZLS0KJomgQdCuEOmdWWFqOIrfs6Ugmu/3g1hzC8O01xJEJr
XrI3Nnn+sghsdgHvorRYsb8pRZbPQD24p2MmbQcanPbO2HB8ydeD6G5WYju7Me6l
RvnjgHJ4XwKBgFEYE19tDzXijfEII7Mk0Fdjvmt1DBoWuZbZZjLM8qOHxnyAz89i
n5Tbe57cAUshBCEmnnXbDo5i5IqcHfEW29Fz06/L0lrpIWek9BhSHVfFtEbhXZd6
8paMKVjxOlaQk/vF1RJjmahNqy+WGRuZyMDorbjR6jTkDOKDtvvTt0Z5AoGABPC4
ABH8zu2HVmmBE5Gq1fQ/FJ767lqRNBnfZSlMp3pIwXZ78TCF5MkejKekLGNc3+xR
7ojctPBG0CqFL1cC0cPZPibTcOl8Rji966/FD5Hz4Sj602OI+E4HnLpq9Dz4zZMa
3OPtAR6Ff0BB4ipqysSjAkWd0EW0I1r/wUWfn2sCgYEA3OZ6OBEZ/sTJMGke9/CL
3k2mS9jKpqJTZfIUbNtwwhPah/vL13zVfT2srOzL0IPX7SIQGowHhg6NjxUTOayd
AGDQs65NfKkyt9+8bf4F93afo9fFQAxcRJ1rqXranscqDRfzdJFCubGIkYq9cN0J
6kUN10GoZtQZnCvSdMB8SSs=
-----END PRIVATE KEY-----

@ -0,0 +1,24 @@
-----BEGIN CERTIFICATE-----
MIIEFDCCAvygAwIBAgIUNon6eDh9zWbnHpoqqgjkYsyCPAowDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
Q0EwHhcNMjQwMzA4MDcxMDU3WhcNMjkwMzA3MDcxMDU3WjBuMRgwFgYDVQQDDA9U
ZW5wYXkuY29tIHNpZ24xEzARBgNVBAoMClRlbnBheS5jb20xHTAbBgNVBAsMFFRl
bnBheS5jb20gQ0EgQ2VudGVyMQswCQYDVQQGEwJDTjERMA8GA1UEBwwIU2hlblpo
ZW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDJUqXCOnWQmrpqLyy6
0HfdYezdBfe66CPyAIeqV7sTReRNZvYVONjkhOzVlZ88d0+PmPADGmPskPCrhFCX
K5sN5TBfCog+FZPQJ+Ol0JAZKvQkK+smPt2pmVfBth020DCKlc8U0LPAE0nxqF0E
30b9NQLdoD77kE0duIpK/b9ASb9UPlR2vcQobXXehzaZph6Wd3ys2rHI2ZbKNicP
XqSXtTb86+x734ufKbeGQd0MrV/+LaMc1qNdjx3pjpvbw9WDSQH99nwjGoqOFvU7
IhHz5KzIKnJf4ZqLBvkRzK/L5r4MUxrOfWPS3x6yvDNBRqO5d2rCoXAtdAl9LefA
G1jDAgMBAAGjgbkwgbYwCQYDVR0TBAIwADALBgNVHQ8EBAMCA/gwgZsGA1UdHwSB
kzCBkDCBjaCBiqCBh4aBhGh0dHA6Ly9ldmNhLml0cnVzLmNvbS5jbi9wdWJsaWMv
aXRydXNjcmw/Q0E9MUJENDIyMEU1MERCQzA0QjA2QUQzOTc1NDk4NDZDMDFDM0U4
RUJEMiZzZz1IQUNDNDcxQjY1NDIyRTEyQjI3QTlEMzNBODdBRDFDREY1OTI2RTE0
MDM3MTANBgkqhkiG9w0BAQsFAAOCAQEATvBq6b8Zvvz+ld8MZ3VFy61DY5iUALlN
Nn2IAan0iVP3bb1FCeYdFJsgGo3hc1C3o2mPbq5FPTO6qYW3fP3bKYlmivNL/tQW
IGAWDI1ynhAs/RZZD5ASrzpcJigfXrkh7imMxJO55dEXP2XQfFRMvbeYlcvEIrMt
I48TESeHB59/TGI2GTUwt51bXk3k3QJd8iji0w6ZKLtk1Pu0Jx3o2KOw9GEJX47/
CkQDl/1i73Q4UPA1GpfR+2X9WPOIHnmznvUzTJATZHwUfJaIrlaY7ky7x20S43xZ
YXWK6++q9Pf62QixKUE7WvxtGDnYYWGh7xrAu/aENZ/OxcqieQMeKA==
-----END CERTIFICATE-----

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

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

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.paymentlog.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
*
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-24
*/
public interface PaymentLogService extends IService<PaymentLogEntity> {
List<PaymentLogEntity> getList(PaymentLogPagination paymentLogPagination);
List<PaymentLogEntity> getTypeList(PaymentLogPagination paymentLogPagination,String dataType);
PaymentLogEntity getInfo(String id);
void delete(PaymentLogEntity entity);
void create(PaymentLogEntity entity);
boolean update(String id, PaymentLogEntity entity);
//子表方法
//副表数据方法
String checkForm(PaymentLogForm form,int i);
void saveOrUpdate(PaymentLogForm paymentLogForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,39 @@
package jnpf.service;
import jnpf.model.payment.*;
import jnpf.entity.*;
import java.math.BigDecimal;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
*
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-24
*/
public interface PaymentService extends IService<PaymentEntity> {
List<PaymentEntity> getList(PaymentPagination paymentPagination);
List<PaymentEntity> getTypeList(PaymentPagination paymentPagination,String dataType);
PaymentEntity getInfo(String id);
void delete(PaymentEntity entity);
void create(PaymentEntity entity);
boolean update(String id, PaymentEntity entity);
//子表方法
//副表数据方法
String checkForm(PaymentForm form,int i);
void saveOrUpdate(PaymentForm paymentForm,String id, boolean isSave) throws Exception;
PaymentEntity getUsablePayment(String enterpriseId, BigDecimal amount);
List<PaymentEntity> getTimeoutPayment(String enterpriseId, BigDecimal amount);
}

@ -0,0 +1,301 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.PaymentLogMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.paymentlog.*;
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 java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
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;
/**
*
*
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-24
*/
@Service
public class PaymentLogServiceImpl extends ServiceImpl<PaymentLogMapper, PaymentLogEntity> implements PaymentLogService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<PaymentLogEntity> getList(PaymentLogPagination paymentLogPagination){
return getTypeList(paymentLogPagination,paymentLogPagination.getDataType());
}
/** 列表查询 */
@Override
public List<PaymentLogEntity> getTypeList(PaymentLogPagination paymentLogPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? PaymentLogConstant.getAppColumnData() : PaymentLogConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int paymentLogNum =0;
QueryWrapper<PaymentLogEntity> paymentLogQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(paymentLogPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = paymentLogPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<PaymentLogEntity> paymentLogSuperWrapper = new QueryWrapper<>();
paymentLogSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(paymentLogSuperWrapper,PaymentLogEntity.class,queryJson,"0"));
int paymentLogNum1 = paymentLogSuperWrapper.getExpression().getNormal().size();
if (paymentLogNum1>0){
List<String> paymentLogList =this.list(paymentLogSuperWrapper).stream().map(PaymentLogEntity::getId).collect(Collectors.toList());
allSuperList.addAll(paymentLogList);
intersectionSuperList.add(paymentLogList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<PaymentLogEntity> paymentLogSuperWrapper = new QueryWrapper<>();
paymentLogSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(paymentLogSuperWrapper,PaymentLogEntity.class,ruleJson,"0"));
int paymentLogNum1 = paymentLogSuperWrapper.getExpression().getNormal().size();
if (paymentLogNum1>0){
List<String> paymentLogList =this.list(paymentLogSuperWrapper).stream().map(PaymentLogEntity::getId).collect(Collectors.toList());
allRuleList.addAll(paymentLogList);
intersectionRuleList.add(paymentLogList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object paymentLogObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentLogQueryWrapper,PaymentLogEntity.class,paymentLogPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(paymentLogObj)){
return new ArrayList<>();
} else {
paymentLogQueryWrapper = (QueryWrapper<PaymentLogEntity>)paymentLogObj;
if( paymentLogQueryWrapper.getExpression().getNormal().size()>0){
paymentLogNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object paymentLogObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentLogQueryWrapper,PaymentLogEntity.class,paymentLogPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(paymentLogObj)){
return new ArrayList<>();
} else {
paymentLogQueryWrapper = (QueryWrapper<PaymentLogEntity>)paymentLogObj;
if( paymentLogQueryWrapper.getExpression().getNormal().size()>0){
paymentLogNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(paymentLogPagination.getOrderNo())){
paymentLogNum++;
String value = paymentLogPagination.getOrderNo() instanceof List ?
JsonUtil.getObjectToString(paymentLogPagination.getOrderNo()) :
String.valueOf(paymentLogPagination.getOrderNo());
paymentLogQueryWrapper.lambda().like(PaymentLogEntity::getOrderNo,value);
}
if(ObjectUtil.isNotEmpty(paymentLogPagination.getTradeState())){
paymentLogNum++;
List<String> idList = new ArrayList<>();
try {
String[][] tradeState = JsonUtil.getJsonToBean(paymentLogPagination.getTradeState(),String[][].class);
for(int i=0;i<tradeState.length;i++){
if(tradeState[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(tradeState[i])));
}
}
}catch (Exception e1){
try {
List<String> tradeState = JsonUtil.getJsonToList(paymentLogPagination.getTradeState(),String.class);
if(tradeState.size()>0){
idList.addAll(tradeState);
}
}catch (Exception e2){
idList.add(String.valueOf(paymentLogPagination.getTradeState()));
}
}
paymentLogQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(PaymentLogEntity::getTradeState, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
paymentLogQueryWrapper.lambda().in(PaymentLogEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
paymentLogQueryWrapper.lambda().and(t->t.in(PaymentLogEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
paymentLogQueryWrapper.lambda().and(t->t.in(PaymentLogEntity::getId, finalAllRuleIDlist));
}
//排序
if(StringUtil.isEmpty(paymentLogPagination.getSidx())){
paymentLogQueryWrapper.lambda().orderByDesc(PaymentLogEntity::getId);
}else{
try {
String sidx = paymentLogPagination.getSidx();
String[] strs= sidx.split("_name");
PaymentLogEntity paymentLogEntity = new PaymentLogEntity();
Field declaredField = paymentLogEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
paymentLogQueryWrapper="asc".equals(paymentLogPagination.getSort().toLowerCase())?paymentLogQueryWrapper.orderByAsc(value):paymentLogQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<PaymentLogEntity> page=new Page<>(paymentLogPagination.getCurrentPage(), paymentLogPagination.getPageSize());
IPage<PaymentLogEntity> userIPage=this.page(page, paymentLogQueryWrapper);
return paymentLogPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<PaymentLogEntity> list = new ArrayList();
return paymentLogPagination.setData(list, list.size());
}
}else{
return this.list(paymentLogQueryWrapper);
}
}
@Override
public PaymentLogEntity getInfo(String id){
QueryWrapper<PaymentLogEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(PaymentLogEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(PaymentLogEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, PaymentLogEntity entity){
return this.updateById(entity);
}
@Override
public void delete(PaymentLogEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(PaymentLogForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
if(StringUtil.isNotEmpty(form.getPayerTotal())){
if(!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getPayerTotal())).matches()){
return "请输入正确的金额";
}
}
return countRecover;
}
/**
* ()
* @param id
* @param paymentLogForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(PaymentLogForm paymentLogForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
paymentLogForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(PaymentLogConstant.getFormData(),paymentLogForm),PaymentLogForm.class);
PaymentLogEntity entity = JsonUtil.getJsonToBean(paymentLogForm, PaymentLogEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setId(mainId);
}else{
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,423 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.PaymentMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.payment.*;
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 java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
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;
/**
*
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-24
*/
@Service
public class PaymentServiceImpl extends ServiceImpl<PaymentMapper, PaymentEntity> implements PaymentService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<PaymentEntity> getList(PaymentPagination paymentPagination) {
return getTypeList(paymentPagination, paymentPagination.getDataType());
}
/**
*
*/
@Override
public List<PaymentEntity> getTypeList(PaymentPagination paymentPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? PaymentConstant.getAppColumnData() : PaymentConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total = 0;
int paymentNum = 0;
QueryWrapper<PaymentEntity> paymentQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp = "";
if (ObjectUtil.isNotEmpty(paymentPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = paymentPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<PaymentEntity> paymentSuperWrapper = new QueryWrapper<>();
paymentSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(paymentSuperWrapper, PaymentEntity.class, queryJson, "0"));
int paymentNum1 = paymentSuperWrapper.getExpression().getNormal().size();
if (paymentNum1 > 0) {
List<String> paymentList = this.list(paymentSuperWrapper).stream().map(PaymentEntity::getId).collect(Collectors.toList());
allSuperList.addAll(paymentList);
intersectionSuperList.add(paymentList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<PaymentEntity> paymentSuperWrapper = new QueryWrapper<>();
paymentSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(paymentSuperWrapper, PaymentEntity.class, ruleJson, "0"));
int paymentNum1 = paymentSuperWrapper.getExpression().getNormal().size();
if (paymentNum1 > 0) {
List<String> paymentList = this.list(paymentSuperWrapper).stream().map(PaymentEntity::getId).collect(Collectors.toList());
allRuleList.addAll(paymentList);
intersectionRuleList.add(paymentList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object paymentObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentQueryWrapper, PaymentEntity.class, paymentPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(paymentObj)) {
return new ArrayList<>();
} else {
paymentQueryWrapper = (QueryWrapper<PaymentEntity>) paymentObj;
if (paymentQueryWrapper.getExpression().getNormal().size() > 0) {
paymentNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object paymentObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(paymentQueryWrapper, PaymentEntity.class, paymentPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(paymentObj)) {
return new ArrayList<>();
} else {
paymentQueryWrapper = (QueryWrapper<PaymentEntity>) paymentObj;
if (paymentQueryWrapper.getExpression().getNormal().size() > 0) {
paymentNum++;
}
}
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(paymentPagination.getEnterpriseId())) {
paymentNum++;
List<String> idList = new ArrayList<>();
try {
String[][] enterpriseId = JsonUtil.getJsonToBean(paymentPagination.getEnterpriseId(), String[][].class);
for (int i = 0; i < enterpriseId.length; i++) {
if (enterpriseId[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(enterpriseId[i])));
}
}
} catch (Exception e1) {
try {
List<String> enterpriseId = JsonUtil.getJsonToList(paymentPagination.getEnterpriseId(), String.class);
if (enterpriseId.size() > 0) {
idList.addAll(enterpriseId);
}
} catch (Exception e2) {
idList.add(String.valueOf(paymentPagination.getEnterpriseId()));
}
}
paymentQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(PaymentEntity::getEnterpriseId, tt).or();
});
});
}
if (ObjectUtil.isNotEmpty(paymentPagination.getOrderNo())) {
paymentNum++;
String value = paymentPagination.getOrderNo() instanceof List ?
JsonUtil.getObjectToString(paymentPagination.getOrderNo()) :
String.valueOf(paymentPagination.getOrderNo());
paymentQueryWrapper.lambda().like(PaymentEntity::getOrderNo, value);
}
if (ObjectUtil.isNotEmpty(paymentPagination.getOrderStatus())) {
paymentNum++;
List<String> idList = new ArrayList<>();
try {
String[][] orderStatus = JsonUtil.getJsonToBean(paymentPagination.getOrderStatus(), String[][].class);
for (int i = 0; i < orderStatus.length; i++) {
if (orderStatus[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(orderStatus[i])));
}
}
} catch (Exception e1) {
try {
List<String> orderStatus = JsonUtil.getJsonToList(paymentPagination.getOrderStatus(), String.class);
if (orderStatus.size() > 0) {
idList.addAll(orderStatus);
}
} catch (Exception e2) {
idList.add(String.valueOf(paymentPagination.getOrderStatus()));
}
}
paymentQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(PaymentEntity::getOrderStatus, tt).or();
});
});
}
if (ObjectUtil.isNotEmpty(paymentPagination.getOrderTypeId())) {
paymentNum++;
List<String> idList = new ArrayList<>();
try {
String[][] orderTypeId = JsonUtil.getJsonToBean(paymentPagination.getOrderTypeId(), String[][].class);
for (int i = 0; i < orderTypeId.length; i++) {
if (orderTypeId[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(orderTypeId[i])));
}
}
} catch (Exception e1) {
try {
List<String> orderTypeId = JsonUtil.getJsonToList(paymentPagination.getOrderTypeId(), String.class);
if (orderTypeId.size() > 0) {
idList.addAll(orderTypeId);
}
} catch (Exception e2) {
idList.add(String.valueOf(paymentPagination.getOrderTypeId()));
}
}
paymentQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(PaymentEntity::getOrderTypeId, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
paymentQueryWrapper.lambda().in(PaymentEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
paymentQueryWrapper.lambda().and(t -> t.in(PaymentEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
paymentQueryWrapper.lambda().and(t -> t.in(PaymentEntity::getId, finalAllRuleIDlist));
}
//假删除标志
paymentQueryWrapper.lambda().isNull(PaymentEntity::getDeleteMark);
//排序
if (StringUtil.isEmpty(paymentPagination.getSidx())) {
paymentQueryWrapper.lambda().orderByDesc(PaymentEntity::getId);
} else {
try {
String sidx = paymentPagination.getSidx();
String[] strs = sidx.split("_name");
PaymentEntity paymentEntity = new PaymentEntity();
Field declaredField = paymentEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
paymentQueryWrapper = "asc".equals(paymentPagination.getSort().toLowerCase()) ? paymentQueryWrapper.orderByAsc(value) : paymentQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<PaymentEntity> page = new Page<>(paymentPagination.getCurrentPage(), paymentPagination.getPageSize());
IPage<PaymentEntity> userIPage = this.page(page, paymentQueryWrapper);
return paymentPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<PaymentEntity> list = new ArrayList();
return paymentPagination.setData(list, list.size());
}
} else {
return this.list(paymentQueryWrapper);
}
}
@Override
public PaymentEntity getInfo(String id) {
QueryWrapper<PaymentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(PaymentEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(PaymentEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, PaymentEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(PaymentEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/**
* i-0-1
*/
@Override
public String checkForm(PaymentForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp) {
id = form.getId();
}
//主表字段验证
if (StringUtil.isEmpty(form.getOrderNo())) {
return "订单编号不能为空";
}
if (StringUtil.isEmpty(form.getAmount())) {
return "金额不能为空";
}
if (StringUtil.isNotEmpty(form.getAmount())) {
if (!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getAmount())).matches()) {
return "请输入正确的金额";
}
}
return countRecover;
}
/**
* ()
*
* @param id
* @param paymentForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(PaymentForm paymentForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
paymentForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(PaymentConstant.getFormData(), paymentForm), PaymentForm.class);
PaymentEntity entity = JsonUtil.getJsonToBean(paymentForm, PaymentEntity.class);
if (isSave) {
String mainId = RandomUtil.uuId();
entity.setCreatorUserId(userInfo.getUserId());
entity.setCreatorTime(DateUtil.getNowDate());
entity.setId(mainId);
entity.setVersion(0);
} else {
entity.setLastModifyUserId(userInfo.getUserId());
entity.setLastModifyTime(DateUtil.getNowDate());
}
this.saveOrUpdate(entity);
}
//是否已有订单未支付
@Override
public PaymentEntity getUsablePayment(String enterpriseId, BigDecimal amount) {
QueryWrapper<PaymentEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(PaymentEntity::getEnterpriseId, enterpriseId)
.eq(PaymentEntity::getAmount, amount)
.eq(PaymentEntity::getOrderStatus, "NOTPAY")
.isNull(PaymentEntity::getDeleteMark)
.lt(PaymentEntity::getCreatorTime, DateUtil.dateAddMinutes(DateUtil.getNowDate(), 10))
.orderByDesc(PaymentEntity::getCreatorTime)
.last("limit 1");
return this.getOne(wrapper);
}
@Override
public List<PaymentEntity> getTimeoutPayment(String enterpriseId, BigDecimal amount) {
QueryWrapper<PaymentEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(PaymentEntity::getEnterpriseId, enterpriseId)
.eq(PaymentEntity::getAmount, amount)
.eq(PaymentEntity::getOrderStatus, "NOTPAY")
.isNull(PaymentEntity::getDeleteMark)
.gt(PaymentEntity::getCreatorTime, DateUtil.dateAddMinutes(DateUtil.getNowDate(), 10))
.orderByDesc(PaymentEntity::getCreatorTime);
return this.list(wrapper);
}
}

@ -40,5 +40,11 @@
<artifactId>org.eclipse.paho.mqttv5.client</artifactId>
<version>1.2.5</version>
</dependency>
<!-- 微信支付 -->
<dependency>
<groupId>com.github.javen205</groupId>
<artifactId>IJPay-All</artifactId>
<version>2.9.11</version>
</dependency>
</dependencies>
</project>

@ -0,0 +1,42 @@
package jnpf.config;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.ijpay.core.kit.PayKit;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.security.cert.X509Certificate;
/**
*
*/
@Data
@Slf4j
@Configuration
@ConfigurationProperties(prefix = "wx.pay.v3")
public class WxPayProperties {
private String appId;//小程序id
private String mchId;//商户号
private String mchSerialNo;//api证书序列号
private String keyPath;//商户私钥
private String certPath;//商户公钥 给别人用的
private String platformSerialNo;//微信平台 序列号
private String platformCertPath;//微信平台 公钥
private String apiKey3;//v3秘钥
private String notify;//支付回调地址
public String getSerialNumber() {
X509Certificate certificate = PayKit.getCertificate(this.getCertPath());
if (certificate == null) {
throw new RuntimeException("商户证书序列号获取失败!");
}
String serialNo = certificate.getSerialNumber().toString(16).toUpperCase();
// 提前两天检查证书是否有效
boolean isValid = PayKit.checkCertificateIsValid(certificate, this.mchId, -2);
log.info("证书是否可用 {} 证书有效期为 {}", isValid, DateUtil.format(certificate.getNotAfter(), DatePattern.NORM_DATETIME_PATTERN));
return serialNo;
}
}

@ -0,0 +1,396 @@
package jnpf.controller;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.ijpay.core.IJPayHttpResponse;
import com.ijpay.core.enums.RequestMethodEnum;
import com.ijpay.core.kit.HttpKit;
import com.ijpay.core.kit.WxPayKit;
import com.ijpay.wxpay.WxPayApi;
import com.ijpay.wxpay.enums.WxDomainEnum;
import com.ijpay.wxpay.enums.v3.BasePayApiEnum;
import com.ijpay.wxpay.model.v3.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.config.WxPayProperties;
import jnpf.entity.PaymentEntity;
import jnpf.model.payment.PaymentConstant;
import jnpf.model.payment.PaymentForm;
import jnpf.model.payment.PaymentPagination;
import jnpf.model.paymentlog.PaymentVO;
import jnpf.service.PaymentService;
import jnpf.util.*;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.*;
@Slf4j
@RestController
@RequestMapping("/api/scm/Payment")
@Tag(name = "微信支付", description = "微信支付")
public class PaymentController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private PaymentService paymentService;
@Resource
private WxPayProperties wxPayProperties;
/**
*
*
* @param paymentPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody PaymentPagination paymentPagination) throws IOException {
List<PaymentEntity> list = paymentService.getList(paymentPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (PaymentEntity entity : list) {
Map<String, Object> paymentMap = JsonUtil.entityToMap(entity);
paymentMap.put("id", paymentMap.get("id"));
//副表数据
//子表数据
realList.add(paymentMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, PaymentConstant.getFormData(), PaymentConstant.getColumnData(), paymentPagination.getModuleId(), false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(paymentPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param paymentForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid PaymentForm paymentForm) {
String b = paymentService.checkForm(paymentForm, 0);
if (StrUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
try {
paymentService.saveOrUpdate(paymentForm, null, true);
} catch (Exception e) {
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
*
*
* @param id
* @param paymentForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid PaymentForm paymentForm,
@RequestParam(value = "isImport", required = false) boolean isImport) {
paymentForm.setId(id);
if (!isImport) {
String b = paymentService.checkForm(paymentForm, 1);
if (StrUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
}
PaymentEntity entity = paymentService.getInfo(id);
if (entity != null) {
try {
paymentService.saveOrUpdate(paymentForm, id, false);
} catch (Exception e) {
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
} else {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id) {
PaymentEntity entity = paymentService.getInfo(id);
if (entity != null) {
//假删除
entity.setDeleteMark(1);
paymentService.update(id, entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id) {
PaymentEntity entity = paymentService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> paymentMap = JsonUtil.entityToMap(entity);
paymentMap.put("id", paymentMap.get("id"));
//副表数据
//子表数据
paymentMap = generaterSwapUtil.swapDataDetail(paymentMap, PaymentConstant.getFormData(), "585733504680074373", false);
return ActionResult.success(paymentMap);
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id) {
PaymentEntity entity = paymentService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> paymentMap = JsonUtil.entityToMap(entity);
paymentMap.put("id", paymentMap.get("id"));
//副表数据
//子表数据
paymentMap = generaterSwapUtil.swapDataForm(paymentMap, PaymentConstant.getFormData(), PaymentConstant.TABLEFIELDKEY, PaymentConstant.TABLERENAMES);
return ActionResult.success(paymentMap);
}
// 创建订单
@PostMapping("/create-order")
@Operation(description = "统一下单接口")
public ActionResult createOrder(@RequestBody PaymentVO paymentVO) {
//查询有没有未支付的订单
PaymentEntity payment = paymentService.getUsablePayment(paymentVO.getEnterpriseId(), paymentVO.getAmount());
if (null != payment) {
return ActionResult.success("下单成功,请支付!", payment);
}
String orderNo = generaterSwapUtil.getBillNumber("walletCZ", false);
log.info("统一下单接口开始,订单号:{}", orderNo);
// 创建订单
UserInfo userInfo = userProvider.get();
PaymentEntity pay = new PaymentEntity();
String id = RandomUtil.uuId();
pay.setId(id);
pay.setEnterpriseId(paymentVO.getEnterpriseId());
pay.setOrderNo(orderNo);
pay.setAmount(paymentVO.getAmount());
pay.setOrderTypeId("585052745690520133");//
pay.setOrderStatus("NOTPAY");
pay.setCreatorTime(DateUtil.getNowDate());
pay.setCreatorUserId(userInfo.getUserId());
pay.setVersion(1);
pay.setCompanyId(paymentVO.getEnterpriseId());
pay.setOrganizeJsonId(userInfo.getOrganizeId());
pay.setRemark("商户资金充值");
BigDecimal money = paymentVO.getAmount();
Integer fen = money.multiply(new BigDecimal(100)).setScale(0).intValue();
Amount amount = new Amount().setTotal(fen).setCurrency("CNY");
UnifiedOrderModel model = new UnifiedOrderModel();
model.setAppid(wxPayProperties.getAppId())
.setMchid(wxPayProperties.getMchId())
.setDescription("商户资金充值")
.setOut_trade_no(orderNo)
.setNotify_url(wxPayProperties.getNotify())
.setAmount(amount);
// 单品列表信息
Detail detail = new Detail();
detail.setCost_price(fen);
GoodsDetail goodsDetail = new GoodsDetail(orderNo, "", "充值资金", 1, fen);
detail.setGoods_detail(new ArrayList<>(Collections.singletonList(goodsDetail)));
model.setDetail(detail);
// 场景信息
SceneInfo sceneInfo = new SceneInfo();
sceneInfo.setDevice_id("DE001");//设备编码
sceneInfo.setPayer_client_ip("222.71.165.187");//设备IP
// 店铺信息
StoreInfo storeInfo = new StoreInfo();
storeInfo.setId("123");//店铺id
sceneInfo.setStore_info(storeInfo);
model.setScene_info(sceneInfo);
try {
IJPayHttpResponse response = WxPayApi.v3(
RequestMethodEnum.POST,
WxDomainEnum.CHINA.getDomain(),
BasePayApiEnum.NATIVE_PAY.toString(),
wxPayProperties.getMchId(),
wxPayProperties.getSerialNumber(),
wxPayProperties.getPlatformSerialNo(),//包含敏感信息时必填
wxPayProperties.getKeyPath(),
JSONUtil.toJsonStr(model));
int status = response.getStatus();
log.info("微信支付统一下单接口返回状态码:{}", status);
String body = response.getBody();
if (body != null) {
JSONObject jsonObject = JSONUtil.parseObj(body);
String codeUrl = jsonObject.getStr("code_url");
pay.setCodeUrl(codeUrl);
paymentService.save(pay);
return ActionResult.success("二维码生成成功!", pay);
} else {
return ActionResult.fail(400, "下单失败,请稍后再试!");
}
} catch (Exception e) {
e.printStackTrace();
return ActionResult.fail(400, "下单失败");
}
}
//发起支付
//支付通知
@PostMapping("/notify")
@Operation(description = "微信支付异步通知")
public String nativeNotify(HttpServletRequest request, HttpServletResponse response) {
log.info("微信支付异步通知");
Map<String, String> _feedback = new HashMap<>();
try {
/*
* serialNo
* body
* signature
* nonce
* timestamp
* key api
* certPath */
//验签
String timestamp = request.getHeader("Wechatpay-Timestamp"); //时间戳
String nonce = request.getHeader("Wechatpay-Nonce"); //随机字符串
String serialNo = request.getHeader("Wechatpay-Serial");//证书序列号
String signature = request.getHeader("Wechatpay-Signature");//签名
String result = HttpKit.readData(request);//消息体
log.info("支付通知密文 {}", result);
// 需要通过证书序列号查找对应的证书verifyNotify 中有验证证书的序列号
String plainText = WxPayKit.verifyNotify(serialNo, result, signature, nonce, timestamp,
wxPayProperties.getApiKey3(), wxPayProperties.getPlatformCertPath());
log.info("支付通知明文 {}", plainText);
if (StrUtil.isEmpty(plainText)) {
log.error("微信支付通知验签失败");
response.setStatus(500);
_feedback.put("code", "ERROR");
_feedback.put("message", "失败");
}
JSONObject body = JSONUtil.parseObj(plainText);
response.setStatus(200);
_feedback.put("code", "SUCCESS");
_feedback.put("message", "成功");
return JSONUtil.toJsonStr(_feedback);
} catch (Exception e) {
log.error("微信支付通知失败:{}", e.getMessage());
e.printStackTrace();
response.setStatus(500);
_feedback.put("code", "ERROR");
_feedback.put("message", "失败");
return JSONUtil.toJsonStr(_feedback);
}
}
//查询订单(外部订单查询)
@PostMapping("/query-order/{outTradeNo}")
@Operation(description = "查询订单(外部订单查询")
public String queryOrder(@PathVariable String outTradeNo) {
log.info("查询订单(外部订单查询) outTradeNo:{},transactionId:{}", outTradeNo);
String url = String.format(BasePayApiEnum.ORDER_QUERY_BY_OUT_TRADE_NO.getUrl(), outTradeNo);
Map<String, String> params = new HashMap<>();
params.put("mchid", wxPayProperties.getMchId());
try {
IJPayHttpResponse response = WxPayApi.v3(RequestMethodEnum.GET,
WxDomainEnum.CHINA.getDomain(),
url,
wxPayProperties.getMchId(),
wxPayProperties.getMchSerialNo(),
wxPayProperties.getPlatformSerialNo(),
wxPayProperties.getKeyPath(),
params
);
String body = response.getBody();
log.info("查询订单(外部订单查询) body:{}", body);
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
//关闭订单
@PostMapping("/cancel-order/{outTradeNo}")
@Operation(description = "关闭订单(外部订单号)")
public ActionResult cancelOrder(@PathVariable String outTradeNo) {
String url = String.format(BasePayApiEnum.CLOSE_ORDER_BY_OUT_TRADE_NO.getUrl(), outTradeNo);
try {
Map<String, String> param = new HashMap<>();
param.put("mchid", wxPayProperties.getMchId());
IJPayHttpResponse response = WxPayApi.v3(RequestMethodEnum.POST,
WxDomainEnum.CHINA.getDomain(),
url,
wxPayProperties.getMchId(),
wxPayProperties.getMchSerialNo(),
wxPayProperties.getPlatformSerialNo(),
wxPayProperties.getKeyPath(),
JSONUtil.toJsonStr(param)
);
int status = response.getStatus();
log.info("关闭订单 response:{} , status:{}", response, status);
return ActionResult.success("关闭订单成功");
} catch (Exception e) {
log.error("关闭订单失败:{}", e.getMessage());
e.printStackTrace();
return ActionResult.fail(400, "关闭订单失败");
}
}
}

@ -0,0 +1,190 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.paymentlog.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional;
/**
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-24
*/
@Slf4j
@RestController
@Tag(name = "微信支付日志" , description = "微信支付日志")
@RequestMapping("/api/scm/PaymentLog")
public class PaymentLogController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private PaymentLogService paymentLogService;
/**
*
*
* @param paymentLogPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody PaymentLogPagination paymentLogPagination)throws IOException{
List<PaymentLogEntity> list= paymentLogService.getList(paymentLogPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (PaymentLogEntity entity : list) {
Map<String, Object> paymentLogMap=JsonUtil.entityToMap(entity);
paymentLogMap.put("id", paymentLogMap.get("id"));
//副表数据
//子表数据
realList.add(paymentLogMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, PaymentLogConstant.getFormData(), PaymentLogConstant.getColumnData(), paymentLogPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(paymentLogPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param paymentLogForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid PaymentLogForm paymentLogForm) {
String b = paymentLogService.checkForm(paymentLogForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
paymentLogService.saveOrUpdate(paymentLogForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
*
* @param id
* @param paymentLogForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid PaymentLogForm paymentLogForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
paymentLogForm.setId(id);
if (!isImport) {
String b = paymentLogService.checkForm(paymentLogForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
PaymentLogEntity entity= paymentLogService.getInfo(id);
if(entity!=null){
try{
paymentLogService.saveOrUpdate(paymentLogForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
PaymentLogEntity entity= paymentLogService.getInfo(id);
if(entity!=null){
//主表数据删除
paymentLogService.delete(entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
PaymentLogEntity entity= paymentLogService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> paymentLogMap=JsonUtil.entityToMap(entity);
paymentLogMap.put("id", paymentLogMap.get("id"));
//副表数据
//子表数据
paymentLogMap = generaterSwapUtil.swapDataDetail(paymentLogMap,PaymentLogConstant.getFormData(),"585736863793290373",false);
return ActionResult.success(paymentLogMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
PaymentLogEntity entity= paymentLogService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> paymentLogMap=JsonUtil.entityToMap(entity);
paymentLogMap.put("id", paymentLogMap.get("id"));
//副表数据
//子表数据
paymentLogMap = generaterSwapUtil.swapDataForm(paymentLogMap,PaymentLogConstant.getFormData(),PaymentLogConstant.TABLEFIELDKEY,PaymentLogConstant.TABLERENAMES);
return ActionResult.success(paymentLogMap);
}
}

@ -0,0 +1,62 @@
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-07-24
*/
@Data
@TableName("nx_payment")
public class PaymentEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "ENTERPRISE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String enterpriseId;
@TableField(value = "ORDER_NO" , updateStrategy = FieldStrategy.IGNORED)
private String orderNo;
@TableField(value = "AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal amount;
@TableField(value = "ORDER_TYPE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String orderTypeId;
@TableField(value = "ORDER_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String orderStatus;
@TableField(value = "OPEN_ID" , updateStrategy = FieldStrategy.IGNORED)
private String openId;
@TableField("CODE_URL")
private String codeUrl;
@TableField(value = "REMARK" , updateStrategy = FieldStrategy.IGNORED)
private String remark;
@TableField("F_FLOW_ID")
private String flowId;
@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_VERSION")
private Integer version;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
}

@ -0,0 +1,61 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-24
*/
@Data
@TableName("nx_payment_log")
public class PaymentLogEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "ORDER_NO" , updateStrategy = FieldStrategy.IGNORED)
private String orderNo;
@TableField(value = "TRANSACTION_ID" , updateStrategy = FieldStrategy.IGNORED)
private String transactionId;
@TableField(value = "PAYMENT_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String paymentType;
@TableField(value = "TRADE_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String tradeType;
@TableField(value = "OPEN_ID" , updateStrategy = FieldStrategy.IGNORED)
private String openId;
@TableField(value = "TRADE_STATE" , updateStrategy = FieldStrategy.IGNORED)
private String tradeState;
@TableField(value = "PAYER_TOTAL" , updateStrategy = FieldStrategy.IGNORED)
private Integer payerTotal;
@TableField(value = "CONTENT" , updateStrategy = FieldStrategy.IGNORED)
private String content;
@TableField("F_FLOW_ID")
private String flowId;
@TableField(value = "F_CREATOR_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date creatorTime;
@TableField(value = "F_CREATOR_USER_ID" , updateStrategy = FieldStrategy.IGNORED)
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_VERSION")
private Integer version;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
}

@ -0,0 +1,50 @@
package jnpf.model.payment;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-24
*/
@Data
public class PaymentForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 公司名称 **/
@JsonProperty("enterpriseId")
private Object enterpriseId;
/** 订单编号 **/
@JsonProperty("orderNo")
private String orderNo;
/** 订单类型 **/
@JsonProperty("orderTypeId")
private Object orderTypeId;
/** 金额 **/
@JsonProperty("amount")
private String amount;
/** 订单状态 **/
@JsonProperty("orderStatus")
private Object orderStatus;
/** 交易人 **/
@JsonProperty("openId")
private String openId;
/** 备注 **/
@JsonProperty("remark")
private String remark;
/** 创建人 **/
@JsonProperty("creatorUserId")
private String creatorUserId;
/** 创建时间 **/
@JsonProperty("creatorTime")
private String creatorTime;
}

@ -0,0 +1,42 @@
package jnpf.model.payment;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-24
*/
@Data
public class PaymentPagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
private String moduleId;
/** 菜单id */
private String menuId;
/** 公司名称 */
@JsonProperty("enterpriseId")
private Object enterpriseId;
/** 订单编号 */
@JsonProperty("orderNo")
private Object orderNo;
/** 订单状态 */
@JsonProperty("orderStatus")
private Object orderStatus;
/** 订单类型 */
@JsonProperty("orderTypeId")
private Object orderTypeId;
}

@ -0,0 +1,50 @@
package jnpf.model.paymentlog;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-24
*/
@Data
public class PaymentLogForm {
/** 主键 */
private String id;
/** 订单编号 **/
@JsonProperty("orderNo")
private String orderNo;
/** 微信订单号 **/
@JsonProperty("transactionId")
private String transactionId;
/** 支付方式 **/
@JsonProperty("paymentType")
private Object paymentType;
/** 交易类型 **/
@JsonProperty("tradeType")
private Object tradeType;
/** 交易状态 **/
@JsonProperty("tradeState")
private Object tradeState;
/** 交易用户 **/
@JsonProperty("openId")
private String openId;
/** 交易金额(分) **/
@JsonProperty("payerTotal")
private String payerTotal;
/** 通知参数 **/
@JsonProperty("content")
private String content;
/** 创建用户 **/
@JsonProperty("creatorUserId")
private String creatorUserId;
/** 创建时间 **/
@JsonProperty("creatorTime")
private String creatorTime;
}

@ -0,0 +1,36 @@
package jnpf.model.paymentlog;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-24
*/
@Data
public class PaymentLogPagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
private String moduleId;
/** 菜单id */
private String menuId;
/** 订单编号 */
@JsonProperty("orderNo")
private Object orderNo;
/** 交易状态 */
@JsonProperty("tradeState")
private Object tradeState;
}

@ -0,0 +1,12 @@
package jnpf.model.paymentlog;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class PaymentVO {
private String enterpriseId;
private BigDecimal amount;
}

@ -0,0 +1,152 @@
<template>
<el-dialog title="详情"
:close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
width="600px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="24" >
<jnpf-form-tip-item label="公司名称"
prop="enterpriseId" >
<p>{{dataForm.enterpriseId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="订单编号"
prop="orderNo" >
<p>{{dataForm.orderNo}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="订单类型"
prop="orderTypeId" >
<p>{{ dataForm.orderTypeId }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="金额"
prop="amount" >
<p>{{dataForm.amount}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="订单状态"
prop="orderStatus" >
<p>{{ dataForm.orderStatus }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="交易人"
prop="openId" >
<p>{{dataForm.openId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="备注"
prop="remark" >
<p>{{dataForm.remark}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="创建人"
prop="creatorUserId" >
<p>{{dataForm.creatorUserId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="创建时间"
prop="creatorTime" >
<p>{{dataForm.creatorTime}}</p>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> </el-button>
</span>
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { getConfigData } from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { Detail},
props: [],
data() {
return {
visible: false,
detailVisible: false,
loading: false,
dataForm: {
id :'',
enterpriseId : "",
orderNo : '',
orderTypeId : "1",
amount : '',
orderStatus : "",
openId : '',
remark : '',
creatorUserId : "",
creatorTime : "",
},
enterpriseIdProps:{"label":"f_full_name","value":"f_id" },
orderTypeIdOptions:[{"fullName":"充值","id":"1"}],
orderTypeIdProps:{"label":"fullName","value":"id" },
orderStatusOptions:[{"fullName":"未支付","id":"NOTPAY"},{"fullName":"成功","id":"SUCCESS"},{"fullName":"已取消","id":"CLOSED"}],
orderStatusProps:{"label":"fullName","value":"id" },
}
},
computed: {},
watch: {},
created() {
},
mounted() {},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue)
})
})
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/Payment/detail/'+this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
})
}
})
},
},
}
</script>

File diff suppressed because one or more lines are too long

@ -0,0 +1,542 @@
<template>
<el-dialog :title="!dataForm.id ? '新建' :'编辑'"
:close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
width="600px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right" >
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="24" >
<jnpf-form-tip-item
label="公司名称" prop="enterpriseId" >
<JnpfSelect v-model="dataForm.enterpriseId" @change="changeData('enterpriseId',-1)"
placeholder="请选择" clearable :style='{"width":"100%"}' :options="enterpriseIdOptions" :props="enterpriseIdProps" >
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="订单编号" prop="orderNo" >
<JnpfInput v-model="dataForm.orderNo" @change="changeData('orderNo',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="订单类型" prop="orderTypeId" >
<JnpfSelect v-model="dataForm.orderTypeId" @change="changeData('orderTypeId',-1)"
placeholder="请选择" clearable :style='{"width":"100%"}' :options="orderTypeIdOptions" :props="orderTypeIdProps" >
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="金额" prop="amount" >
<JnpfInput v-model="dataForm.amount" @change="changeData('amount',-1)"
placeholder="请输入" addonAfter="元" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="订单状态" prop="orderStatus" >
<JnpfSelect v-model="dataForm.orderStatus" @change="changeData('orderStatus',-1)"
placeholder="请选择" clearable :style='{"width":"100%"}' :options="orderStatusOptions" :props="orderStatusProps" >
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="交易人" prop="openId" >
<JnpfInput v-model="dataForm.openId" @change="changeData('openId',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="备注" prop="remark" >
<JnpfInput v-model="dataForm.remark" @change="changeData('remark',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="创建人" prop="creatorUserId" >
<JnpfOpenData v-model="dataForm.creatorUserId" @change="changeData('creatorUserId',-1)"
placeholder="系统自动生成" readonly :style='{"width":"100%"}' type="currUser" >
</JnpfOpenData>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="创建时间" prop="creatorTime" >
<JnpfOpenData v-model="dataForm.creatorTime" @change="changeData('creatorTime',-1)"
placeholder="系统自动生成" readonly :style='{"width":"100%"}' type="currTime" >
</JnpfOpenData>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/>
</el-row>
<span slot="footer" class="dialog-footer">
<div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled='prevDis'>
{{'上一条'}}
</el-button>
<el-button @click="next" :disabled='nextDis'>
{{'下一条'}}
</el-button>
</div>
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading">
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-button>
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import {mapGetters} from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { },
props: [],
data() {
return {
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
setting:{},
eventType: '',
userBoxVisible:false,
selectDialogVisible: false,
currTableConf:{},
dataValueAll:{},
addTableConf:{
},
//
ableAll:{
},
tableRows:{
},
Vmodel:"",
currVmodel:"",
dataForm: {
enterpriseId : undefined,
orderNo : undefined,
orderTypeId : "1",
amount : undefined,
orderStatus : undefined,
openId : undefined,
remark : undefined,
creatorUserId : undefined,
creatorTime : undefined,
version: 0,
},
tableRequiredData: {},
dataRule:
{
enterpriseId: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
orderNo: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
orderTypeId: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
amount: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
{
pattern: /^([1-9][\d]*|0)(\.[\d]+)?$/,
message: '请输入正确的金额',
trigger: 'blur'
},
],
orderStatus: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
},
enterpriseIdOptions:[],
enterpriseIdProps:{"label":"f_full_name","value":"f_id" },
orderTypeIdOptions:[{"fullName":"充值","id":"1"}],
orderTypeIdProps:{"label":"fullName","value":"id" },
orderStatusOptions:[{"fullName":"未支付","id":"NOTPAY"},{"fullName":"成功","id":"SUCCESS"},{"fullName":"已取消","id":"CLOSED"}],
orderStatusProps:{"label":"fullName","value":"id" },
childIndex:-1,
isEdit:false,
interfaceRes: {
enterpriseId:[] ,
orderNo:[] ,
orderTypeId:[] ,
amount:[] ,
orderStatus:[] ,
openId:[] ,
remark:[] ,
creatorUserId:[] ,
creatorTime:[] ,
},
}
},
computed: {
...mapGetters(['userInfo'])
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() {},
methods: {
prev() {
this.index--
if (this.index === 0) {
this.prevDis = true
}
this.nextDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
next() {
this.index++
if (this.index === this.allList.length - 1) {
this.nextDis = true
}
this.prevDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
getInfo(id) {
request({
url: '/api/scm/Payment/'+ id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
});
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
},
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if(this[options]){
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model,index,defaultValue) {
if(!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll(){
this.getenterpriseIdOptions();
},
getenterpriseIdOptions() {
const index = this.childIndex
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes.enterpriseId))
for (let i = 0; i < templateJsonList.length; i++) {
let json = templateJsonList[i];
if(json.relationField){
let relationFieldAll = json.relationField.split("-");
let val = json.defaultValue;
if(relationFieldAll.length>1 && index>-1){
val = this.dataForm[relationFieldAll[0]+'List']&&this.dataForm[relationFieldAll[0]+'List'].length?this.dataForm[relationFieldAll[0]+'List'][index][relationFieldAll[1]]:''
}else {
val = this.dataForm[relationFieldAll]
}
json.defaultValue = val
}
}
let template ={
paramList:templateJsonList
}
getDataInterfaceRes('563326097714841605',template).then(res => {
let data = res.data
this.enterpriseIdOptions = data
this.changeDataFormData(1,'enterpriseId','enterpriseId',index,'')
})
},
clearData(){
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id,isDetail,allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/Payment/'+this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
});
}else{
this.clearData()
this.initDefaultData()
}
});
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
},
//
initDefaultData() {
},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0
this.$refs['formRef'].validate((valid) => {
if (valid) {
this.request()
}
})
},
request() {
let _data =this.dataList()
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
} else {
this.btnLoading = true
}
if (!this.dataForm.id) {
request({
url: '/api/scm/Payment',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData()
this.initDefaultData()
})
this.continueBtnLoading = false
return
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(()=>{
this.btnLoading = false
this.continueBtnLoading = false
})
}else{
request({
url: '/api/scm/Payment/'+this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(()=>{
this.btnLoading = false
this.continueBtnLoading = false
})
}
},
openSelectDialog(key) {
this.currTableConf=this.addTableConf[key]
this.currVmodel=key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if(this['get'+this.currVmodel]){
this['get'+this.currVmodel](t)
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
} else if (timeType == 4) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
}
} else if (timeType == 5) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
}
}
}
return timeDataValue;
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
} else {
timeDataValue = timeDataValue + ':00'
}
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
} else if (timeType == 4) {
let previousDate = '';
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
} else if (timeType == 5) {
let previousDate = '';
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
}
}
return timeDataValue;
},
dataList(){
var _data = this.dataForm;
return _data;
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
this.childIndex=-1
},
},
}
</script>

@ -0,0 +1,529 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="公司名称">
<JnpfSelect v-model="query.enterpriseId" placeholder="请选择" clearable
:options="enterpriseIdOptions"
:props="enterpriseIdProps" multiple >
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="订单编号">
<el-input v-model="query.orderNo" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="订单状态">
<JnpfSelect v-model="query.orderStatus" placeholder="请选择" clearable
:options="orderStatusOptions"
:props="orderStatusProps" multiple >
</JnpfSelect>
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<el-form-item label="订单类型">
<JnpfSelect v-model="query.orderTypeId" placeholder="请选择" clearable
:options="orderTypeIdOptions"
:props="orderTypeIdProps" multiple >
</JnpfSelect>
</el-form-item>
</el-col>
</template>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"></el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"></el-button>
<el-button type="text" icon="el-icon-arrow-down" @click="showAll=true" v-if="!showAll">
展开
</el-button>
<el-button type="text" icon="el-icon-arrow-up" @click="showAll=false" v-else>
收起
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">
</el-button>
</div>
<div class="JNPF-common-head-right">
<el-tooltip content="高级查询" placement="top" v-if="true">
<el-link icon="icon-ym icon-ym-filter JNPF-common-head-icon" :underline="false"
@click="openSuperQuery()" />
</el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange'
:span-method="arraySpanMethod"
>
<el-table-column
prop="enterpriseId"
label="公司名称" align="left"
>
</el-table-column>
<el-table-column
prop="orderNo"
label="订单编号" align="left"
>
</el-table-column>
<el-table-column label="订单类型" prop="orderTypeId" algin="left"
>
<template slot-scope="scope">
{{ scope.row.orderTypeId}}
</template>
</el-table-column>
<el-table-column
prop="amount"
label="金额" align="left"
>
</el-table-column>
<el-table-column label="订单状态" prop="orderStatus" algin="left"
>
<template slot-scope="scope">
{{ scope.row.orderStatus}}
</template>
</el-table-column>
<el-table-column
prop="openId"
label="交易人" align="left"
>
</el-table-column>
<el-table-column
prop="remark"
label="备注" align="left"
>
</el-table-column>
<el-table-column
prop="creatorUserId"
label="创建人" align="left"
>
</el-table-column>
<el-table-column
prop="creatorTime"
label="创建时间" align="left"
>
</el-table-column>
<el-table-column label="操作"
fixed="right" width="150" >
<template slot-scope="scope" >
<el-button type="text"
@click="addOrUpdateHandle(scope.row)" >编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">
</el-button>
<el-button type="text"
@click="goDetail(scope.row.id)">详情
</el-button>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData"/>
</div>
</div>
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
<ImportBox v-if="uploadBoxVisible" ref="UploadBox" @refresh="initData" />
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false"/>
<ToFormDetail v-if="toFormDetailVisible" ref="toFormDetail" @close="toFormDetailVisible = false" />
<SuperQuery v-if="superQueryVisible" ref="SuperQuery" :columnOptions="superQueryJson"
@superQuery="superQuery" />
</div>
</template>
<script>
import request from '@/utils/request'
import {mapGetters} from "vuex";
import {getDictionaryDataSelector} from '@/api/systemData/dictionary'
import JNPFForm from './form'
import Detail from './Detail'
import ExportBox from '@/components/ExportBox'
import ToFormDetail from '@/views/basic/dynamicModel/list/detail'
import {getDataInterfaceRes} from '@/api/systemData/dataInterface'
import { getConfigData } from '@/api/onlineDev/visualDev'
import { getDefaultCurrentValueUserIdAsync } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentIdAsync } from '@/api/permission/organize'
import columnList from './columnList'
import { thousandsFormat } from "@/components/Generator/utils/index"
import SuperQuery from '@/components/SuperQuery'
import superQueryJson from './superQueryJson'
export default {
components: {
JNPFForm,
Detail,
ExportBox,ToFormDetail , SuperQuery
},
data() {
return {
keyword:'',
expandsTree: true,
refreshTree: true,
toFormDetailVisible:false,
expandObj:{},
columnOptions: [],
mergeList: [],
exportList:[],
columnList,
showAll: false,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
enterpriseId:undefined,
orderNo:undefined,
orderStatus:undefined,
orderTypeId:undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf'
},
list: [],
listLoading: true,
total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
enterpriseIdOptions:[],
enterpriseIdProps:{"label":"f_full_name","value":"f_id" },
orderTypeIdOptions:[{"fullName":"充值","id":"1"}],
orderTypeIdProps:{"label":"fullName","value":"id" },
orderStatusOptions:[{"fullName":"未支付","id":"NOTPAY"},{"fullName":"成功","id":"SUCCESS"},{"fullName":"已取消","id":"CLOSED"}],
orderStatusProps:{"label":"fullName","value":"id" },
interfaceRes: {
},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.getenterpriseIdOptions();
this.queryData = JSON.parse(JSON.stringify(this.query))
},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.toFormDetailVisible = true
this.$nextTick(() => {
this.$refs.toFormDetail.init(formData, modelId, defaultValue)
})
})
},
toggleTreeExpand(expands) {
this.refreshTree = false
this.expandsTree = expands
this.$nextTick(() => {
this.refreshTree = true
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(null)
})
})
},
filterNode(value, data) {
if (!value) return true;
return data[this.treeProps.label].indexOf(value) !== -1;
},
loadNode(node, resolve) {
const nodeData = node.data
const config ={
treeInterfaceId:"",
treeTemplateJson:[]
}
if (config.treeInterfaceId) {
//
if (config.treeTemplateJson && config.treeTemplateJson.length) {
for (let i = 0; i < config.treeTemplateJson.length; i++) {
const element = config.treeTemplateJson[i];
element.defaultValue = nodeData[element.relationField] || ''
}
}
//
let query = {
paramList: config.treeTemplateJson || [],
}
//
getDataInterfaceRes(config.treeInterfaceId, query).then(res => {
let data = res.data
if (Array.isArray(data)) {
resolve(data);
} else {
resolve([]);
}
})
}
},
getColumnList() {
//
this.columnOptions = this.transformColumnList(this.columnList)
},
transformColumnList(columnList) {
let list = []
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e)
} else {
let prop = e.prop.split('-')[0]
let label = e.label.split('-')[0]
let vModel = e.prop.split('-')[1]
let newItem = {
align: "center",
jnpfKey: "table",
prop,
label,
children: []
}
e.vModel = vModel
if (!this.expandObj.hasOwnProperty(`${prop}Expand`)) this.$set(this.expandObj, `${prop}Expand`, false)
if (!list.some(o => o.prop === prop)) list.push(newItem)
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e)
break
}
}
}
}
this.getMergeList(list)
this.getExportList(list)
return list
},
arraySpanMethod({ column }) {
for (let i = 0; i < this.mergeList.length; i++) {
if (column.property == this.mergeList[i].prop) {
return [this.mergeList[i].rowspan, this.mergeList[i].colspan]
}
}
},
getMergeList(list) {
let newList = JSON.parse(JSON.stringify(list))
newList.forEach(item => {
if (item.children && item.children.length) {
let child = {
prop: item.prop + '-child-first'
}
item.children.unshift(child)
}
})
newList.forEach(item => {
if (item.children && item.children.length ) {
item.children.forEach((child, index) => {
if (index == 0) {
this.mergeList.push({
prop: child.prop,
rowspan: 1,
colspan: item.children.length
})
} else {
this.mergeList.push({
prop: child.prop,
rowspan: 0,
colspan: 0
})
}
})
} else {
this.mergeList.push({
prop: item.prop,
rowspan: 1,
colspan: 1
})
}
})
},
getExportList(list) {
let exportList = []
for (let i = 0; i < list.length; i++) {
if (list[i].jnpfKey === 'table') {
for (let j = 0; j < list[i].children.length; j++) {
exportList.push(list[i].children[j])
}
} else {
exportList.push(list[i])
}
}
this.exportList = exportList
},
getenterpriseIdOptions() {
getDataInterfaceRes('563326097714841605').then(res => {
let data = res.data
this.enterpriseIdOptions = data
})
},
goDetail(id){
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(id)
})
},
sortChange({column, prop, order}) {
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
this.listQuery.sidx = !order ? '' : prop
this.initData()
},
async initSearchDataAndListData() {
await this.initSearchData()
this.initData()
},
//
async initSearchData() {
},
initData() {
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
keyword: this.keyword,
dataType: 0,
menuId:this.menuId,
moduleId:'585733504680074373',
type:1,
};
request({
url: `/api/scm/Payment/getList`,
method: 'post',
data: _query
}).then(res => {
var _list =res.data.list;
this.list = _list.map(o => ({
...o,
...this.expandObj,
}))
this.total = res.data.pagination.total
this.listLoading = false
})
},
handleDel(id) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/scm/Payment/${id}`,
method: 'DELETE'
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
}
});
})
}).catch(() => {
});
},
handelUpload(){
this.uploadBoxVisible = true
this.$nextTick(() => {
this.$refs.UploadBox.init("","scm/Payment")
})
},
openSuperQuery() {
this.superQueryVisible = true
this.$nextTick(() => {
this.$refs.SuperQuery.init()
})
},
superQuery(queryJson) {
this.listQuery.superQueryJson = queryJson
this.listQuery.currentPage = 1
this.initData()
},
addOrUpdateHandle(row, isDetail) {
let id = row?row.id:""
this.formVisible = true
this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail,this.list)
})
},
exportData() {
this.exportBoxVisible = true
this.$nextTick(() => {
this.$refs.ExportBox.init(this.exportList)
})
},
download(data) {
let query = {...data, ...this.listQuery, ...this.query,menuId:this.menuId}
request({
url: `/api/scm/Payment/Actions/Export`,
method: 'post',
data: query
}).then(res => {
if (!res.data.url) return
this.jnpf.downloadFile(res.data.url)
this.$refs.ExportBox.visible = false
this.exportBoxVisible = false
})
},
search() {
this.listQuery.currentPage=1
this.listQuery.pageSize=20
this.listQuery.sort="desc"
this.listQuery.sidx=""
this.initData()
},
refresh(isrRefresh) {
this.formVisible = false
if (isrRefresh) this.reset()
},
reset() {
this.query = JSON.parse(JSON.stringify(this.queryData))
this.search()
},
colseFlow(isrRefresh) {
this.flowVisible = false
if (isrRefresh) this.reset()
},
}
}
</script>

File diff suppressed because one or more lines are too long

@ -0,0 +1,160 @@
<template>
<el-dialog title="详情"
:close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
width="600px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="24" >
<jnpf-form-tip-item label="订单编号"
prop="orderNo" >
<p>{{dataForm.orderNo}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="微信订单号"
prop="transactionId" >
<p>{{dataForm.transactionId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="支付方式"
prop="paymentType" >
<p>{{ dataForm.paymentType }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="交易类型"
prop="tradeType" >
<p>{{ dataForm.tradeType }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="交易状态"
prop="tradeState" >
<p>{{ dataForm.tradeState }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="交易用户"
prop="openId" >
<p>{{dataForm.openId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="交易金额(分)"
prop="payerTotal" >
<p>{{dataForm.payerTotal}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="通知参数"
prop="content" >
<p>{{dataForm.content}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="创建用户"
prop="creatorUserId" >
<p>{{dataForm.creatorUserId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="创建时间"
prop="creatorTime" >
<p>{{dataForm.creatorTime}}</p>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> </el-button>
</span>
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { getConfigData } from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { Detail},
props: [],
data() {
return {
visible: false,
detailVisible: false,
loading: false,
dataForm: {
id :'',
orderNo : '',
transactionId : '',
paymentType : "WXPAY",
tradeType : "NATIVE",
tradeState : "",
openId : '',
payerTotal : '',
content : '',
creatorUserId : '',
creatorTime : '',
},
paymentTypeOptions:[{"fullName":"微信支付","id":"WXPAY"}],
paymentTypeProps:{"label":"fullName","value":"id" },
tradeTypeOptions:[{"fullName":"扫码支付","id":"NATIVE"}],
tradeTypeProps:{"label":"fullName","value":"id" },
tradeStateOptions:[{"fullName":"成功","id":"SUCCESS"},{"fullName":"未支付","id":"NOTPAY"},{"fullName":"已关闭","id":"CLOSED"}],
tradeStateProps:{"label":"fullName","value":"id" },
}
},
computed: {},
watch: {},
created() {
},
mounted() {},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue)
})
})
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/PaymentLog/detail/'+this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
})
}
})
},
},
}
</script>

File diff suppressed because one or more lines are too long

@ -0,0 +1,492 @@
<template>
<el-dialog :title="!dataForm.id ? '新建' :'编辑'"
:close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
width="600px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right" >
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="24" >
<jnpf-form-tip-item
label="订单编号" prop="orderNo" >
<JnpfInput v-model="dataForm.orderNo" @change="changeData('orderNo',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="微信订单号" prop="transactionId" >
<JnpfInput v-model="dataForm.transactionId" @change="changeData('transactionId',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="支付方式" prop="paymentType" >
<JnpfSelect v-model="dataForm.paymentType" @change="changeData('paymentType',-1)"
placeholder="请选择" clearable :style='{"width":"100%"}' :options="paymentTypeOptions" :props="paymentTypeProps" >
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="交易类型" prop="tradeType" >
<JnpfSelect v-model="dataForm.tradeType" @change="changeData('tradeType',-1)"
placeholder="请选择" clearable :style='{"width":"100%"}' :options="tradeTypeOptions" :props="tradeTypeProps" >
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="交易状态" prop="tradeState" >
<JnpfSelect v-model="dataForm.tradeState" @change="changeData('tradeState',-1)"
placeholder="请选择" clearable :style='{"width":"100%"}' :options="tradeStateOptions" :props="tradeStateProps" >
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="交易用户" prop="openId" >
<JnpfInput v-model="dataForm.openId" @change="changeData('openId',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="交易金额(分)" prop="payerTotal" >
<JnpfInput v-model="dataForm.payerTotal" @change="changeData('payerTotal',-1)"
placeholder="请输入" addonAfter="分" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="通知参数" prop="content" >
<JnpfTextarea v-model="dataForm.content" @change="changeData('content',-1)"
placeholder="请输入" :style='{"width":"100%"}' true type="textarea" :autosize='{"minRows":4,"maxRows":4}' >
</JnpfTextarea>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="创建用户" prop="creatorUserId" >
<JnpfInput v-model="dataForm.creatorUserId" @change="changeData('creatorUserId',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="创建时间" prop="creatorTime" >
<JnpfInput v-model="dataForm.creatorTime" @change="changeData('creatorTime',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/>
</el-row>
<span slot="footer" class="dialog-footer">
<div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled='prevDis'>
{{'上一条'}}
</el-button>
<el-button @click="next" :disabled='nextDis'>
{{'下一条'}}
</el-button>
</div>
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading">
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-button>
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import {mapGetters} from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { },
props: [],
data() {
return {
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
setting:{},
eventType: '',
userBoxVisible:false,
selectDialogVisible: false,
currTableConf:{},
dataValueAll:{},
addTableConf:{
},
//
ableAll:{
},
tableRows:{
},
Vmodel:"",
currVmodel:"",
dataForm: {
orderNo : undefined,
transactionId : undefined,
paymentType : "WXPAY",
tradeType : "NATIVE",
tradeState : undefined,
openId : undefined,
payerTotal : undefined,
content : undefined,
creatorUserId : undefined,
creatorTime : undefined,
},
tableRequiredData: {},
dataRule:
{
payerTotal: [
{
pattern: /^([1-9][\d]*|0)(\.[\d]+)?$/,
message: '请输入正确的金额',
trigger: 'blur'
},
],
},
paymentTypeOptions:[{"fullName":"微信支付","id":"WXPAY"}],
paymentTypeProps:{"label":"fullName","value":"id" },
tradeTypeOptions:[{"fullName":"扫码支付","id":"NATIVE"}],
tradeTypeProps:{"label":"fullName","value":"id" },
tradeStateOptions:[{"fullName":"成功","id":"SUCCESS"},{"fullName":"未支付","id":"NOTPAY"},{"fullName":"已关闭","id":"CLOSED"}],
tradeStateProps:{"label":"fullName","value":"id" },
childIndex:-1,
isEdit:false,
interfaceRes: {
orderNo:[] ,
transactionId:[] ,
paymentType:[] ,
tradeType:[] ,
tradeState:[] ,
openId:[] ,
payerTotal:[] ,
content:[] ,
creatorUserId:[] ,
creatorTime:[] ,
},
}
},
computed: {
...mapGetters(['userInfo'])
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() {},
methods: {
prev() {
this.index--
if (this.index === 0) {
this.prevDis = true
}
this.nextDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
next() {
this.index++
if (this.index === this.allList.length - 1) {
this.nextDis = true
}
this.prevDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
getInfo(id) {
request({
url: '/api/scm/PaymentLog/'+ id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
});
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
},
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if(this[options]){
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model,index,defaultValue) {
if(!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll(){
},
clearData(){
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id,isDetail,allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/PaymentLog/'+this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
});
}else{
this.clearData()
this.initDefaultData()
}
});
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
},
//
initDefaultData() {
},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0
this.$refs['formRef'].validate((valid) => {
if (valid) {
this.request()
}
})
},
request() {
let _data =this.dataList()
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
} else {
this.btnLoading = true
}
if (!this.dataForm.id) {
request({
url: '/api/scm/PaymentLog',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData()
this.initDefaultData()
})
this.continueBtnLoading = false
return
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(()=>{
this.btnLoading = false
this.continueBtnLoading = false
})
}else{
request({
url: '/api/scm/PaymentLog/'+this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(()=>{
this.btnLoading = false
this.continueBtnLoading = false
})
}
},
openSelectDialog(key) {
this.currTableConf=this.addTableConf[key]
this.currVmodel=key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if(this['get'+this.currVmodel]){
this['get'+this.currVmodel](t)
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
} else if (timeType == 4) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
}
} else if (timeType == 5) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
}
}
}
return timeDataValue;
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
} else {
timeDataValue = timeDataValue + ':00'
}
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
} else if (timeType == 4) {
let previousDate = '';
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
} else if (timeType == 5) {
let previousDate = '';
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
}
}
return timeDataValue;
},
dataList(){
var _data = this.dataForm;
return _data;
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
this.childIndex=-1
},
},
}
</script>

@ -0,0 +1,501 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="订单编号">
<el-input v-model="query.orderNo" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="交易状态">
<JnpfSelect v-model="query.tradeState" placeholder="请选择" clearable
:options="tradeStateOptions"
:props="tradeStateProps" multiple >
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"></el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"></el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">
</el-button>
</div>
<div class="JNPF-common-head-right">
<el-tooltip content="高级查询" placement="top" v-if="true">
<el-link icon="icon-ym icon-ym-filter JNPF-common-head-icon" :underline="false"
@click="openSuperQuery()" />
</el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange'
:span-method="arraySpanMethod"
>
<el-table-column
prop="orderNo"
label="订单编号" align="left"
>
</el-table-column>
<el-table-column
prop="transactionId"
label="微信订单号" align="left"
>
</el-table-column>
<el-table-column label="支付方式" prop="paymentType" algin="left"
>
<template slot-scope="scope">
{{ scope.row.paymentType}}
</template>
</el-table-column>
<el-table-column label="交易类型" prop="tradeType" algin="left"
>
<template slot-scope="scope">
{{ scope.row.tradeType}}
</template>
</el-table-column>
<el-table-column label="交易状态" prop="tradeState" algin="left"
>
<template slot-scope="scope">
{{ scope.row.tradeState}}
</template>
</el-table-column>
<el-table-column
prop="openId"
label="交易用户" align="left"
>
</el-table-column>
<el-table-column
prop="payerTotal"
label="交易金额(分)" align="left"
>
</el-table-column>
<el-table-column
prop="content"
label="通知参数" align="left"
>
</el-table-column>
<el-table-column
prop="creatorUserId"
label="创建用户" align="left"
>
</el-table-column>
<el-table-column
prop="creatorTime"
label="创建时间" align="left"
>
</el-table-column>
<el-table-column label="操作"
fixed="right" width="150" >
<template slot-scope="scope" >
<el-button type="text"
@click="addOrUpdateHandle(scope.row)" >编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">
</el-button>
<el-button type="text"
@click="goDetail(scope.row.id)">详情
</el-button>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData"/>
</div>
</div>
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
<ImportBox v-if="uploadBoxVisible" ref="UploadBox" @refresh="initData" />
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false"/>
<ToFormDetail v-if="toFormDetailVisible" ref="toFormDetail" @close="toFormDetailVisible = false" />
<SuperQuery v-if="superQueryVisible" ref="SuperQuery" :columnOptions="superQueryJson"
@superQuery="superQuery" />
</div>
</template>
<script>
import request from '@/utils/request'
import {mapGetters} from "vuex";
import {getDictionaryDataSelector} from '@/api/systemData/dictionary'
import JNPFForm from './form'
import Detail from './Detail'
import ExportBox from '@/components/ExportBox'
import ToFormDetail from '@/views/basic/dynamicModel/list/detail'
import {getDataInterfaceRes} from '@/api/systemData/dataInterface'
import { getConfigData } from '@/api/onlineDev/visualDev'
import { getDefaultCurrentValueUserIdAsync } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentIdAsync } from '@/api/permission/organize'
import columnList from './columnList'
import { thousandsFormat } from "@/components/Generator/utils/index"
import SuperQuery from '@/components/SuperQuery'
import superQueryJson from './superQueryJson'
export default {
components: {
JNPFForm,
Detail,
ExportBox,ToFormDetail , SuperQuery
},
data() {
return {
keyword:'',
expandsTree: true,
refreshTree: true,
toFormDetailVisible:false,
expandObj:{},
columnOptions: [],
mergeList: [],
exportList:[],
columnList,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
orderNo:undefined,
tradeState:undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf'
},
list: [],
listLoading: true,
total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
paymentTypeOptions:[{"fullName":"微信支付","id":"WXPAY"}],
paymentTypeProps:{"label":"fullName","value":"id" },
tradeTypeOptions:[{"fullName":"扫码支付","id":"NATIVE"}],
tradeTypeProps:{"label":"fullName","value":"id" },
tradeStateOptions:[{"fullName":"成功","id":"SUCCESS"},{"fullName":"未支付","id":"NOTPAY"},{"fullName":"已关闭","id":"CLOSED"}],
tradeStateProps:{"label":"fullName","value":"id" },
interfaceRes: {
},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.queryData = JSON.parse(JSON.stringify(this.query))
},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.toFormDetailVisible = true
this.$nextTick(() => {
this.$refs.toFormDetail.init(formData, modelId, defaultValue)
})
})
},
toggleTreeExpand(expands) {
this.refreshTree = false
this.expandsTree = expands
this.$nextTick(() => {
this.refreshTree = true
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(null)
})
})
},
filterNode(value, data) {
if (!value) return true;
return data[this.treeProps.label].indexOf(value) !== -1;
},
loadNode(node, resolve) {
const nodeData = node.data
const config ={
treeInterfaceId:"",
treeTemplateJson:[]
}
if (config.treeInterfaceId) {
//
if (config.treeTemplateJson && config.treeTemplateJson.length) {
for (let i = 0; i < config.treeTemplateJson.length; i++) {
const element = config.treeTemplateJson[i];
element.defaultValue = nodeData[element.relationField] || ''
}
}
//
let query = {
paramList: config.treeTemplateJson || [],
}
//
getDataInterfaceRes(config.treeInterfaceId, query).then(res => {
let data = res.data
if (Array.isArray(data)) {
resolve(data);
} else {
resolve([]);
}
})
}
},
getColumnList() {
//
this.columnOptions = this.transformColumnList(this.columnList)
},
transformColumnList(columnList) {
let list = []
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e)
} else {
let prop = e.prop.split('-')[0]
let label = e.label.split('-')[0]
let vModel = e.prop.split('-')[1]
let newItem = {
align: "center",
jnpfKey: "table",
prop,
label,
children: []
}
e.vModel = vModel
if (!this.expandObj.hasOwnProperty(`${prop}Expand`)) this.$set(this.expandObj, `${prop}Expand`, false)
if (!list.some(o => o.prop === prop)) list.push(newItem)
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e)
break
}
}
}
}
this.getMergeList(list)
this.getExportList(list)
return list
},
arraySpanMethod({ column }) {
for (let i = 0; i < this.mergeList.length; i++) {
if (column.property == this.mergeList[i].prop) {
return [this.mergeList[i].rowspan, this.mergeList[i].colspan]
}
}
},
getMergeList(list) {
let newList = JSON.parse(JSON.stringify(list))
newList.forEach(item => {
if (item.children && item.children.length) {
let child = {
prop: item.prop + '-child-first'
}
item.children.unshift(child)
}
})
newList.forEach(item => {
if (item.children && item.children.length ) {
item.children.forEach((child, index) => {
if (index == 0) {
this.mergeList.push({
prop: child.prop,
rowspan: 1,
colspan: item.children.length
})
} else {
this.mergeList.push({
prop: child.prop,
rowspan: 0,
colspan: 0
})
}
})
} else {
this.mergeList.push({
prop: item.prop,
rowspan: 1,
colspan: 1
})
}
})
},
getExportList(list) {
let exportList = []
for (let i = 0; i < list.length; i++) {
if (list[i].jnpfKey === 'table') {
for (let j = 0; j < list[i].children.length; j++) {
exportList.push(list[i].children[j])
}
} else {
exportList.push(list[i])
}
}
this.exportList = exportList
},
goDetail(id){
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(id)
})
},
sortChange({column, prop, order}) {
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
this.listQuery.sidx = !order ? '' : prop
this.initData()
},
async initSearchDataAndListData() {
await this.initSearchData()
this.initData()
},
//
async initSearchData() {
},
initData() {
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
keyword: this.keyword,
dataType: 0,
menuId:this.menuId,
moduleId:'585736863793290373',
type:1,
};
request({
url: `/api/scm/PaymentLog/getList`,
method: 'post',
data: _query
}).then(res => {
var _list =res.data.list;
this.list = _list.map(o => ({
...o,
...this.expandObj,
}))
this.total = res.data.pagination.total
this.listLoading = false
})
},
handleDel(id) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/scm/PaymentLog/${id}`,
method: 'DELETE'
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
}
});
})
}).catch(() => {
});
},
handelUpload(){
this.uploadBoxVisible = true
this.$nextTick(() => {
this.$refs.UploadBox.init("","scm/PaymentLog")
})
},
openSuperQuery() {
this.superQueryVisible = true
this.$nextTick(() => {
this.$refs.SuperQuery.init()
})
},
superQuery(queryJson) {
this.listQuery.superQueryJson = queryJson
this.listQuery.currentPage = 1
this.initData()
},
addOrUpdateHandle(row, isDetail) {
let id = row?row.id:""
this.formVisible = true
this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail,this.list)
})
},
exportData() {
this.exportBoxVisible = true
this.$nextTick(() => {
this.$refs.ExportBox.init(this.exportList)
})
},
download(data) {
let query = {...data, ...this.listQuery, ...this.query,menuId:this.menuId}
request({
url: `/api/scm/PaymentLog/Actions/Export`,
method: 'post',
data: query
}).then(res => {
if (!res.data.url) return
this.jnpf.downloadFile(res.data.url)
this.$refs.ExportBox.visible = false
this.exportBoxVisible = false
})
},
search() {
this.listQuery.currentPage=1
this.listQuery.pageSize=20
this.listQuery.sort="desc"
this.listQuery.sidx=""
this.initData()
},
refresh(isrRefresh) {
this.formVisible = false
if (isrRefresh) this.reset()
},
reset() {
this.query = JSON.parse(JSON.stringify(this.queryData))
this.search()
},
colseFlow(isrRefresh) {
this.flowVisible = false
if (isrRefresh) this.reset()
},
}
}
</script>

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save