添加新菜单

master
CJYXTX\27961 7 months ago
parent f8fad417a8
commit da7247455d

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.mapper.NxWalletMapper">
</mapper>

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

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.nxwallet.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* nxWallet
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-03-25
*/
public interface NxWalletService extends IService<NxWalletEntity> {
List<NxWalletEntity> getList(NxWalletPagination nxWalletPagination);
List<NxWalletEntity> getTypeList(NxWalletPagination nxWalletPagination,String dataType);
NxWalletEntity getInfo(String id);
void delete(NxWalletEntity entity);
void create(NxWalletEntity entity);
boolean update(String id, NxWalletEntity entity);
//子表方法
//副表数据方法
String checkForm(NxWalletForm form,int i);
void saveOrUpdate(NxWalletForm nxWalletForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,334 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.NxWalletMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.nxwallet.*;
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;
/**
*
* nxWallet
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-03-25
*/
@Service
public class NxWalletServiceImpl extends ServiceImpl<NxWalletMapper, NxWalletEntity> implements NxWalletService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<NxWalletEntity> getList(NxWalletPagination nxWalletPagination){
return getTypeList(nxWalletPagination,nxWalletPagination.getDataType());
}
/** 列表查询 */
@Override
public List<NxWalletEntity> getTypeList(NxWalletPagination nxWalletPagination,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 ? NxWalletConstant.getAppColumnData() : NxWalletConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int nxWalletNum =0;
QueryWrapper<NxWalletEntity> nxWalletQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(nxWalletPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = nxWalletPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<NxWalletEntity> nxWalletSuperWrapper = new QueryWrapper<>();
nxWalletSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(nxWalletSuperWrapper,NxWalletEntity.class,queryJson,"0"));
int nxWalletNum1 = nxWalletSuperWrapper.getExpression().getNormal().size();
if (nxWalletNum1>0){
List<String> nxWalletList =this.list(nxWalletSuperWrapper).stream().map(NxWalletEntity::getId).collect(Collectors.toList());
allSuperList.addAll(nxWalletList);
intersectionSuperList.add(nxWalletList);
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<NxWalletEntity> nxWalletSuperWrapper = new QueryWrapper<>();
nxWalletSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(nxWalletSuperWrapper,NxWalletEntity.class,ruleJson,"0"));
int nxWalletNum1 = nxWalletSuperWrapper.getExpression().getNormal().size();
if (nxWalletNum1>0){
List<String> nxWalletList =this.list(nxWalletSuperWrapper).stream().map(NxWalletEntity::getId).collect(Collectors.toList());
allRuleList.addAll(nxWalletList);
intersectionRuleList.add(nxWalletList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = true;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object nxWalletObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(nxWalletQueryWrapper,NxWalletEntity.class,nxWalletPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(nxWalletObj)){
return new ArrayList<>();
} else {
nxWalletQueryWrapper = (QueryWrapper<NxWalletEntity>)nxWalletObj;
if( nxWalletQueryWrapper.getExpression().getNormal().size()>0){
nxWalletNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object nxWalletObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(nxWalletQueryWrapper,NxWalletEntity.class,nxWalletPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(nxWalletObj)){
return new ArrayList<>();
} else {
nxWalletQueryWrapper = (QueryWrapper<NxWalletEntity>)nxWalletObj;
if( nxWalletQueryWrapper.getExpression().getNormal().size()>0){
nxWalletNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(nxWalletPagination.getCode())){
nxWalletNum++;
String value = nxWalletPagination.getCode() instanceof List ?
JsonUtil.getObjectToString(nxWalletPagination.getCode()) :
String.valueOf(nxWalletPagination.getCode());
nxWalletQueryWrapper.lambda().like(NxWalletEntity::getCode,value);
}
if(ObjectUtil.isNotEmpty(nxWalletPagination.getWalletType())){
nxWalletNum++;
nxWalletQueryWrapper.lambda().eq(NxWalletEntity::getWalletType,nxWalletPagination.getWalletType());
}
if(ObjectUtil.isNotEmpty(nxWalletPagination.getApplyTime())){
nxWalletNum++;
List ApplyTimeList = JsonUtil.getJsonToList(nxWalletPagination.getApplyTime(),String.class);
Long fir = Long.valueOf(String.valueOf(ApplyTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(ApplyTimeList.get(1)));
nxWalletQueryWrapper.lambda().ge(NxWalletEntity::getApplyTime, new Date(fir))
.le(NxWalletEntity::getApplyTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(ObjectUtil.isNotEmpty(nxWalletPagination.getRechargeStatus())){
nxWalletNum++;
nxWalletQueryWrapper.lambda().eq(NxWalletEntity::getRechargeStatus,nxWalletPagination.getRechargeStatus());
}
if(ObjectUtil.isNotEmpty(nxWalletPagination.getCreatorUserId())){
nxWalletNum++;
nxWalletQueryWrapper.lambda().eq(NxWalletEntity::getCreatorUserId,nxWalletPagination.getCreatorUserId());
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
nxWalletQueryWrapper.lambda().in(NxWalletEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
nxWalletQueryWrapper.lambda().and(t->t.in(NxWalletEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
nxWalletQueryWrapper.lambda().and(t->t.in(NxWalletEntity::getId, finalAllRuleIDlist));
}
//排序
if(StringUtil.isEmpty(nxWalletPagination.getSidx())){
nxWalletQueryWrapper.lambda().orderByDesc(NxWalletEntity::getId);
}else{
try {
String sidx = nxWalletPagination.getSidx();
String[] strs= sidx.split("_name");
NxWalletEntity nxWalletEntity = new NxWalletEntity();
Field declaredField = nxWalletEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
nxWalletQueryWrapper="asc".equals(nxWalletPagination.getSort().toLowerCase())?nxWalletQueryWrapper.orderByAsc(value):nxWalletQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<NxWalletEntity> page=new Page<>(nxWalletPagination.getCurrentPage(), nxWalletPagination.getPageSize());
IPage<NxWalletEntity> userIPage=this.page(page, nxWalletQueryWrapper);
return nxWalletPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<NxWalletEntity> list = new ArrayList();
return nxWalletPagination.setData(list, list.size());
}
}else{
return this.list(nxWalletQueryWrapper);
}
}
@Override
public NxWalletEntity getInfo(String id){
QueryWrapper<NxWalletEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(NxWalletEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(NxWalletEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, NxWalletEntity entity){
return this.updateById(entity);
}
@Override
public void delete(NxWalletEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(NxWalletForm 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.getBuinessId())){
return "申请单位id不能为空";
}
if(StringUtil.isEmpty(form.getDescription())){
return "备注不能为空";
}
if(form.getRechargeStatus().equals("2")){
System.out.println(form.getPhoto().toString());
if(form.getPhoto()==null||form.getPhoto().toString().equals("[]")){
return "上传凭证不能为空";
}
if(form.getFile()==null||form.getFile().toString().equals("[]")){
return "上传附件不能为空";
}
}
return countRecover;
}
/**
* ()
* @param id
* @param nxWalletForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(NxWalletForm nxWalletForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
nxWalletForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(NxWalletConstant.getFormData(),nxWalletForm),NxWalletForm.class);
NxWalletEntity entity = JsonUtil.getJsonToBean(nxWalletForm, NxWalletEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setCode(generaterSwapUtil.getBillNumber("walletCode", false));
if (nxWalletForm.getWalletType().equals("1")){
entity.setOrderCode(generaterSwapUtil.getBillNumber("walletCZ", false));
}else if (nxWalletForm.getWalletType().equals("2")){
entity.setOrderCode(generaterSwapUtil.getBillNumber("walletTK", false));
}
entity.setCreatorUserId(userInfo.getUserId());
entity.setCreatorTime(DateUtil.getNowDate());
entity.setLastModifyUserId(null);
entity.setLastModifyTime(null);
entity.setId(mainId);
entity.setVersion(0);
}else{
entity.setCode(generaterSwapUtil.getBillNumber("walletCode", false));
entity.setCreatorUserId(userInfo.getUserId());
entity.setCreatorTime(DateUtil.getNowDate());
entity.setLastModifyUserId(null);
entity.setLastModifyTime(null);
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,408 @@
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.nxwallet.*;
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.web.multipart.MultipartFile;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
import jnpf.onlinedev.model.OnlineImport.ExcelImportModel;
import jnpf.onlinedev.model.OnlineImport.VisualImportModel;
import cn.xuyanwu.spring.file.storage.FileInfo;
import lombok.Cleanup;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* nxWallet
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-03-25
*/
@Slf4j
@RestController
@Tag(name = "nxWallet" , description = "scm")
@RequestMapping("/api/scm/NxWallet")
public class NxWalletController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private NxWalletService nxWalletService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param nxWalletPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody NxWalletPagination nxWalletPagination)throws IOException{
List<NxWalletEntity> list= nxWalletService.getList(nxWalletPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (NxWalletEntity entity : list) {
Map<String, Object> nxWalletMap=JsonUtil.entityToMap(entity);
nxWalletMap.put("id", nxWalletMap.get("id"));
//副表数据
//子表数据
realList.add(nxWalletMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, NxWalletConstant.getFormData(), NxWalletConstant.getColumnData(), nxWalletPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(nxWalletPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param nxWalletForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid NxWalletForm nxWalletForm) {
String b = nxWalletService.checkForm(nxWalletForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
nxWalletService.saveOrUpdate(nxWalletForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody NxWalletPagination nxWalletPagination) throws IOException {
if (StringUtil.isEmpty(nxWalletPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<NxWalletEntity> list= nxWalletService.getList(nxWalletPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (NxWalletEntity entity : list) {
Map<String, Object> nxWalletMap=JsonUtil.entityToMap(entity);
nxWalletMap.put("id", nxWalletMap.get("id"));
//副表数据
//子表数据
realList.add(nxWalletMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, NxWalletConstant.getFormData(), NxWalletConstant.getColumnData(), nxWalletPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(nxWalletPagination.getSelectKey())?nxWalletPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "code" :
entitys.add(new ExcelExportEntity("流水编号" ,"code"));
break;
case "walletType" :
entitys.add(new ExcelExportEntity("单据类型" ,"walletType"));
break;
case "buinessId" :
entitys.add(new ExcelExportEntity("申请单位id" ,"buinessId"));
break;
case "applyTime" :
entitys.add(new ExcelExportEntity("申请时间" ,"applyTime"));
break;
case "description" :
entitys.add(new ExcelExportEntity("备注" ,"description"));
break;
case "expenseType" :
entitys.add(new ExcelExportEntity("费用项目" ,"expenseType"));
break;
case "rechargeStatus" :
entitys.add(new ExcelExportEntity("充值状态" ,"rechargeStatus"));
break;
case "priceStar" :
entitys.add(new ExcelExportEntity("金额" ,"priceStar"));
break;
case "photo" :
entitys.add(new ExcelExportEntity("上传凭证图片" ,"photo"));
break;
case "file" :
entitys.add(new ExcelExportEntity("上传附件" ,"file"));
break;
case "creatorUserId" :
entitys.add(new ExcelExportEntity("创建用户" ,"creatorUserId"));
break;
case "creatorTime" :
entitys.add(new ExcelExportEntity("创建时间" ,"creatorTime"));
break;
case "lastModifyUserId" :
entitys.add(new ExcelExportEntity("修改用户" ,"lastModifyUserId"));
break;
case "lastModifyTime" :
entitys.add(new ExcelExportEntity("修改时间" ,"lastModifyTime"));
break;
default:
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
list.add(new HashMap<>());
}
//去除空数据
List<Map<String, Object>> dataList = new ArrayList<>();
for (Map<String, Object> map : list) {
int i = 0;
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" ));
String field = key.substring(key.indexOf("-" ) + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
for (Map<String, Object> childMap : childList) {
if (childMap.get(field) != null) {
i++;
}
}
}
} else {
Object o = map.get(key);
if (o != null) {
i++;
}
}
}
if (i > 0) {
dataList.add(map);
}
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(NxWalletConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
}
String fileName = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return vo;
}
/**
*
* @param ids
* @return
*/
@DeleteMapping("/batchRemove")
@Transactional
@Operation(summary = "批量删除")
public ActionResult batchRemove(@RequestBody String ids){
List<String> idList = JsonUtil.getJsonToList(ids, String.class);
int i =0;
for (String allId : idList){
this.delete(allId);
i++;
}
if (i == 0 ){
return ActionResult.fail("删除失败");
}
return ActionResult.success("删除成功");
}
/**
*
* @param id
* @param nxWalletForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid NxWalletForm nxWalletForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
nxWalletForm.setId(id);
if (!isImport) {
String b = nxWalletService.checkForm(nxWalletForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
NxWalletEntity entity= nxWalletService.getInfo(id);
if(entity!=null){
try{
nxWalletService.saveOrUpdate(nxWalletForm,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){
NxWalletEntity entity= nxWalletService.getInfo(id);
if(entity!=null){
//主表数据删除
nxWalletService.delete(entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
NxWalletEntity entity= nxWalletService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> nxWalletMap=JsonUtil.entityToMap(entity);
nxWalletMap.put("id", nxWalletMap.get("id"));
//副表数据
//子表数据
nxWalletMap = generaterSwapUtil.swapDataDetail(nxWalletMap,NxWalletConstant.getFormData(),"541901233368085509",false);
return ActionResult.success(nxWalletMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
NxWalletEntity entity= nxWalletService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> nxWalletMap=JsonUtil.entityToMap(entity);
nxWalletMap.put("id", nxWalletMap.get("id"));
//副表数据
//子表数据
nxWalletMap = generaterSwapUtil.swapDataForm(nxWalletMap,NxWalletConstant.getFormData(),NxWalletConstant.TABLEFIELDKEY,NxWalletConstant.TABLERENAMES);
return ActionResult.success(nxWalletMap);
}
/**
*
* @param id
* @param
* @return
*/
@PostMapping("/closestatus/{id}/{status}")
@Operation(summary = "更新状态")
public ActionResult updateStatus(@PathVariable("id") String id,@PathVariable("status") String status){
NxWalletEntity entity= nxWalletService.getInfo(id);
if(entity!=null){
try{
if (entity.getRechargeStatus().equals("1")){
entity.setRechargeStatus(status);
nxWalletService.update(id, entity);
}else if (entity.getRechargeStatus().equals("2")){
entity.setOrderStatus(status);
nxWalletService.update(id, entity);
}
}catch(Exception e){
return ActionResult.fail("修改数据状态失败");
}
return ActionResult.success("状态更新成功");
}else{
return ActionResult.fail("更新状态失败,数据不存在");
}
}
}

@ -0,0 +1,70 @@
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-03-25
*/
@Data
@TableName("nx_wallet")
public class NxWalletEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "BUINESS_ID" , updateStrategy = FieldStrategy.IGNORED)
private String buinessId;
@TableField(value = "CODE" , updateStrategy = FieldStrategy.IGNORED)
private String code;
@TableField("ORDER_CODE")
private String orderCode;
@TableField(value = "WALLET_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String walletType;
@TableField(value = "APPLY_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date applyTime;
@TableField(value = "DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String description;
@TableField(value = "EXPENSE_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String expenseType;
@TableField("ORDER_STATUS")
private String orderStatus;
@TableField(value = "RECHARGE_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String rechargeStatus;
@TableField(value = "PRICE_STAR" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal priceStar;
@TableField(value = "PHOTO" , updateStrategy = FieldStrategy.IGNORED)
private String photo;
@TableField(value = "FILE" , updateStrategy = FieldStrategy.IGNORED)
private String file;
@TableField(value = "f_creator_time" , fill = FieldFill.INSERT)
private Date creatorTime;
@TableField(value = "f_creator_user_id" , fill = FieldFill.INSERT)
private String creatorUserId;
@TableField(value = "f_last_modify_time" , fill = FieldFill.INSERT_UPDATE)
private Date lastModifyTime;
@TableField(value = "f_last_modify_user_id" , fill = FieldFill.INSERT_UPDATE)
private String lastModifyUserId;
@TableField(value = "f_delete_time" , fill = FieldFill.UPDATE)
private Date deleteTime;
@TableField(value = "f_delete_user_id" , fill = FieldFill.UPDATE)
private String deleteUserId;
@TableField(value = "f_delete_mark" , updateStrategy = FieldStrategy.IGNORED)
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("F_VERSION")
private Integer version;
@TableField(value = "company_id" , fill = FieldFill.INSERT)
private String companyId;
@TableField(value = "department_id" , fill = FieldFill.INSERT)
private String departmentId;
@TableField(value = "organize_json_id" , fill = FieldFill.INSERT)
private String organizeJsonId;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -0,0 +1,65 @@
package jnpf.model.nxwallet;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* nxWallet
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-03-25
*/
@Data
public class NxWalletForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 流水编号 **/
@JsonProperty("code")
private String code;
/** 单据类型 **/
@JsonProperty("walletType")
private String walletType;
/** 申请单位id **/
@JsonProperty("buinessId")
private String buinessId;
/** 申请时间 **/
@JsonProperty("applyTime")
private String applyTime;
/** 备注 **/
@JsonProperty("description")
private String description;
/** 费用项目 **/
@JsonProperty("expenseType")
private Object expenseType;
/** 充值状态 **/
@JsonProperty("rechargeStatus")
private String rechargeStatus;
/** 金额 **/
@JsonProperty("priceStar")
private BigDecimal priceStar;
/** 上传凭证图片 **/
@JsonProperty("photo")
private Object photo;
/** 上传附件 **/
@JsonProperty("file")
private Object file;
/** 创建用户 **/
@JsonProperty("creatorUserId")
private String creatorUserId;
/** 创建时间 **/
@JsonProperty("creatorTime")
private String creatorTime;
/** 修改用户 **/
@JsonProperty("lastModifyUserId")
private String lastModifyUserId;
/** 修改时间 **/
@JsonProperty("lastModifyTime")
private String lastModifyTime;
}

@ -0,0 +1,45 @@
package jnpf.model.nxwallet;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* nxWallet
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-03-25
*/
@Data
public class NxWalletPagination 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("code")
private Object code;
/** 单据类型 */
@JsonProperty("walletType")
private Object walletType;
/** 申请时间 */
@JsonProperty("applyTime")
private Object applyTime;
/** 充值状态 */
@JsonProperty("rechargeStatus")
private Object rechargeStatus;
/** 创建用户 */
@JsonProperty("creatorUserId")
private Object creatorUserId;
}

@ -1,14 +1,8 @@
<template>
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<div class="JNPF-common-page-header">
<el-page-header
@back="goBack"
:content="!dataForm.id ? '新建' : '编辑'"
/>
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
<div class="options">
<el-dropdown class="dropdown" placement="bottom">
<el-button style="width: 70px">
@ -23,42 +17,21 @@
{{ "下一条" }}
</el-dropdown-item>
</template>
<el-dropdown-item
type="primary"
@click.native="dataFormSubmit(2)"
:loading="continueBtnLoading"
:disabled="btnLoading"
>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)" :loading="continueBtnLoading"
:disabled="btnLoading">
{{
!dataForm.id ? "确定并新增" : "确定并继续"
}}</el-dropdown-item
>
!dataForm.id ? "确定并新增" : "确定并继续"
}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button
type="primary"
@click="dataFormSubmit()"
:loading="btnLoading"
:disabled="continueBtnLoading"
>
</el-button
>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" :disabled="continueBtnLoading">
</el-button>
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row
:gutter="15"
class="main"
:style="{ margin: '0 auto', width: '100%' }"
>
<el-form
ref="formRef"
:model="dataForm"
:rules="dataRule"
size="small"
label-width="100px"
label-position="right"
>
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '100%' }">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
label-position="right">
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="24">
@ -69,13 +42,8 @@
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="价格编号" prop="priceCode">
<JnpfInput
v-model="dataForm.priceCode"
@change="changeData('priceCode', -1)"
placeholder="系统自动生成"
readonly
:style="{ width: '100%' }"
>
<JnpfInput v-model="dataForm.priceCode" @change="changeData('priceCode', -1)" placeholder="系统自动生成"
readonly :style="{ width: '100%' }">
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
@ -96,31 +64,16 @@
<el-col :span="8">
<jnpf-form-tip-item label="报价方" prop="buinessId">
<JnpfDepSelect
v-model="dataForm.buinessId"
@change="changeData('buinessId', -1)"
placeholder="请选择"
selectType="all"
:ableIds="ableAll.buinessId"
clearable
disabled="true"
:style="{ width: '100%' }"
>
<JnpfDepSelect v-model="dataForm.buinessId" @change="changeData('buinessId', -1)" placeholder="请选择"
selectType="all" :ableIds="ableAll.buinessId" clearable disabled="true" :style="{ width: '100%' }">
</JnpfDepSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="价格类型" prop="priceType">
<JnpfSelect
v-model="dataForm.priceType"
@change="changeData('priceType', -1)"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="priceTypeOptions"
:props="priceTypeProps"
>
<JnpfSelect v-model="dataForm.priceType" @change="changeData('priceType', -1)" placeholder="请选择"
clearable :style="{ width: '100%' }" :options="priceTypeOptions" :props="priceTypeProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
@ -136,37 +89,18 @@
<h2></h2>
</div>
<el-table :data="dataForm.nxPriceProductList" size="mini">
<el-table-column
type="index"
width="50"
label="序号"
align="center"
/>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="商品名称" prop="productId">
<template slot="header" v-if="true">
<span class="required-sign">*</span>商品名称
</template>
<template slot-scope="scope">
<JnpfPopupSelect
v-model="scope.row.productId"
@change="changeProduct"
:rowIndex="scope.$index"
:formData="dataForm"
:templateJson="interfaceRes.nxpriceproductproductId"
placeholder="请选择"
hasPage
propsValue="id"
popupWidth="800px"
popupTitle="选择数据"
popupType="dialog"
relationField="name"
:field="'productId' + scope.$index"
interfaceId="534687918480949765"
:pageSize="20"
:columnOptions="nxpriceproductproductIdcolumnOptions"
clearable
:style="{ width: '100%' }"
>
<JnpfPopupSelect v-model="scope.row.productId" @change="changeProduct" :rowIndex="scope.$index"
:formData="dataForm" :templateJson="interfaceRes.nxpriceproductproductId" placeholder="请选择"
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
relationField="name" :field="'productId' + scope.$index" interfaceId="534687918480949765"
:pageSize="20" :columnOptions="nxpriceproductproductIdcolumnOptions" clearable
:style="{ width: '100%' }">
</JnpfPopupSelect>
</template>
</el-table-column>
@ -176,16 +110,9 @@
<span class="required-sign"></span>单位
</template>
<template slot-scope="scope">
<JnpfInput
v-model="scope.row.unit"
disabled
@change="
changeData('nxpriceproduct-units', scope.$index)
"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
<JnpfInput v-model="scope.row.unit" disabled @change="
changeData('nxpriceproduct-units', scope.$index)
" placeholder="请输入" clearable :style="{ width: '100%' }">
</JnpfInput>
</template>
</el-table-column>
@ -195,18 +122,12 @@
<span class="required-sign">*</span>回收价
</template>
<template slot-scope="scope">
<JnpfInput
v-model="scope.row.recoveryPrice"
@change="
changeData(
'nxpriceproduct-recoveryPrice',
scope.$index
)
"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
<JnpfInput v-model="scope.row.recoveryPrice" @change="
changeData(
'nxpriceproduct-recoveryPrice',
scope.$index
)
" placeholder="请输入" clearable :style="{ width: '100%' }">
</JnpfInput>
</template>
</el-table-column>
@ -215,30 +136,19 @@
<span class="required-sign">*</span>赠送积分
</template>
<template slot-scope="scope">
<JnpfInput
v-model="scope.row.rewardPoints"
@change="
changeData(
'nxpriceproduct-rewardPoints',
scope.$index
)
"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
<JnpfInput v-model="scope.row.rewardPoints" @change="
changeData(
'nxpriceproduct-rewardPoints',
scope.$index
)
" placeholder="请输入" clearable :style="{ width: '100%' }">
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
class="JNPF-table-delBtn"
@click="delnxpriceproductList(scope.$index)"
>删除</el-button
>
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delnxpriceproductList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -263,51 +173,26 @@
<h2></h2>
</div>
<el-table :data="dataForm.nxPriceRecycleList" size="mini">
<el-table-column
type="index"
width="50"
label="序号"
align="center"
/>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="回收站" prop="recycleId">
<template slot="header" v-if="true">
<span class="required-sign">*</span>回收站
</template>
<template slot-scope="scope">
<JnpfPopupSelect
v-model="scope.row.recycleId"
@change="
changeData('nxpricerecycle-recycleId', scope.$index)
"
:rowIndex="scope.$index"
:formData="dataForm"
:templateJson="interfaceRes.nxpricerecyclerecycleId"
placeholder="请选择"
hasPage
propsValue="id"
popupWidth="800px"
popupTitle="选择数据"
popupType="dialog"
relationField="station_name"
:field="'recycleId' + scope.$index"
interfaceId="534688845753483781"
:pageSize="20"
:columnOptions="nxpricerecyclerecycleIdcolumnOptions"
clearable
:style="{ width: '100%' }"
>
<JnpfPopupSelect v-model="scope.row.recycleId" @change="
changeData('nxpricerecycle-recycleId', scope.$index)
" :rowIndex="scope.$index" :formData="dataForm"
:templateJson="interfaceRes.nxpricerecyclerecycleId" placeholder="请选择" hasPage propsValue="id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField="station_name"
:field="'recycleId' + scope.$index" interfaceId="534688845753483781" :pageSize="20"
:columnOptions="nxpricerecyclerecycleIdcolumnOptions" clearable :style="{ width: '100%' }">
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
class="JNPF-table-delBtn"
@click="delnxpricerecycleList(scope.$index)"
>删除</el-button
>
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delnxpricerecycleList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -318,34 +203,19 @@
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remak">
<JnpfInput
v-model="dataForm.remak"
@change="changeData('remak', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
<JnpfInput v-model="dataForm.remak" @change="changeData('remak', -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"
/>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible = false" />
</el-row>
<ProductBox
v-if="productBoxxVisible"
ref="ProductBoxs"
@refreshDataList="initList"
/>
<ProductBox v-if="productBoxxVisible" ref="ProductBoxs" @refreshDataList="initList" />
</div>
</transition>
</template>
@ -519,7 +389,7 @@ export default {
this.initDefaultData();
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm));
},
mounted() {},
mounted() { },
methods: {
prev() {
this.index--;
@ -609,7 +479,7 @@ export default {
}
}
},
dataAll() {},
dataAll() { },
nxpriceproductExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.nxPriceProductList.length; i++) {
@ -815,7 +685,7 @@ export default {
.then(() => {
this.dataForm.nxPriceProductList.splice(index, 1);
})
.catch(() => {});
.catch(() => { });
},
getnxpriceproductList(value) {
let item = { ...this.tableRows.nxPriceProductList, ...value };
@ -838,7 +708,7 @@ export default {
.then(() => {
this.dataForm.nxPriceRecycleList.splice(index, 1);
})
.catch(() => {});
.catch(() => { });
},
getnxpricerecycleList(value) {
let item = { ...this.tableRows.nxPriceRecycleList, ...value };

@ -0,0 +1,193 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
<div class="JNPF-common-page-header">
<el-page-header @back="goBack"
content="详情"/>
<div class="options">
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{margin: '0 auto',width: '100%'}">
<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-width="0">
<JnpfGroupTitle
contentPosition="left" :closable= "false" content ="基础信息" >
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="流水编号"
prop="code" >
<p>{{dataForm.code}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="单据类型"
prop="walletType" >
<p>{{ dataForm.walletType }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="申请单位id"
prop="buinessId" >
<p>{{dataForm.buinessId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="申请时间"
prop="applyTime" >
<p>{{dataForm.applyTime}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="备注"
prop="description" >
<p>{{dataForm.description}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label-width="0">
<JnpfGroupTitle
contentPosition="left" :closable= "false" content ="费用信息" >
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="费用项目"
prop="expenseType" >
<p>{{ dataForm.expenseType }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="充值状态"
prop="rechargeStatus" >
<p>{{ dataForm.rechargeStatus }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="金额"
prop="priceStar" >
<JnpfNumber v-model="dataForm.priceStar"
placeholder="数字文本" disabled
:step="1" >
</JnpfNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="上传凭证图片"
prop="photo" >
<JnpfUploadImg v-model="dataForm.photo"
disabled
detailed :fileSize="10" sizeUnit="MB" :limit="1" pathType="defaultPath" :isAccount="0" >
</JnpfUploadImg>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="上传附件"
prop="file" >
<JnpfUploadFile v-model="dataForm.file"
disabled
detailed :fileSize="10" sizeUnit="MB" :limit="1" pathType="defaultPath" :isAccount="0" buttonText="点击上传" >
</JnpfUploadFile>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
</div>
</transition>
</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 :'',
code : '',
walletType : "1",
buinessId : '',
applyTime : '',
description : '',
expenseType : "1",
rechargeStatus : '',
priceStar : '',
photo : [],
file : [],
creatorUserId : "",
creatorTime : "",
lastModifyUserId : "",
lastModifyTime : "",
},
walletTypeOptions:[{"fullName":"充值订单","id":"1"},{"fullName":"提款订单","id":"2"}],
walletTypeProps:{"label":"fullName","value":"id" },
expenseTypeOptions:[{"fullName":"预存款","id":"1"}],
expenseTypeProps:{"label":"fullName","value":"id" },
rechargeStatusOptions:[{"fullName":"未充值","id":"1"},{"fullName":"已出账","id":"2"}],
rechargeStatusProps:{"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
},
goBack() {
this.$emit('refresh')
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/NxWallet/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,585 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">s
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
<div class="options">
<el-dropdown class="dropdown" placement="bottom">
<el-button style="width:70px">
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<template v-if="dataForm.id">
<el-dropdown-item @click.native="prev" :disabled='prevDis'>
{{ '上一条' }}
</el-dropdown-item>
<el-dropdown-item @click.native="next" :disabled='nextDis'>
{{ '下一条' }}
</el-dropdown-item>
</template>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)"
:loading="continueBtnLoading" :disabled='btnLoading'>
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"
:disabled='continueBtnLoading'>
</el-button>
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{ margin: '0 auto', width: '100%' }">
<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>
<JnpfGroupTitle content="基础信息" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="流水编号" prop="code">
<JnpfInput v-model="dataForm.code" @change="changeData('code', -1)" placeholder="系统自动生成"
readonly :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="单据类型" prop="walletType">
<JnpfRadio v-model="dataForm.walletType" @change="changeData('walletType', -1)"
optionType="default" direction="horizontal" size="small"
:options="walletTypeOptions" :props="walletTypeProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<!-- <el-col :span="8">
<jnpf-form-tip-item label="申请单位id" prop="buinessId">
<JnpfInput v-model="dataForm.buinessId" @change="changeData('buinessId', -1)"
placeholder="请输入" disabled clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col> -->
<el-col :span="8">
<jnpf-form-tip-item label="申请单位" prop="buinessId">
<JnpfDepSelect v-model="dataForm.buinessId" @change="changeData('buinessId', -1)"
placeholder="请选择" selectType="all" :ableIds="ableAll.buinessId" clearable
disabled="true" :style="{ width: '100%' }">
</JnpfDepSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="申请时间" prop="applyTime">
<JnpfDatePicker v-model="dataForm.applyTime" @change="changeData('applyTime', -1)"
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')"
placeholder="请选择" clearable :style='{ "width": "100%" }' type="date"
format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="description">
<JnpfInput v-model="dataForm.description" @change="changeData('description', -1)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="费用信息" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="费用项目" prop="expenseType">
<JnpfSelect v-model="dataForm.expenseType" @change="changeData('expenseType', -1)"
placeholder="请选择" disabled clearable :style='{ "width": "100%" }'
:options="expenseTypeOptions" :props="expenseTypeProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="充值状态" prop="rechargeStatus">
<JnpfRadio v-model="dataForm.rechargeStatus" @change="changeData('rechargeStatus', -1)"
optionType="default" direction="horizontal" size="small"
:options="rechargeStatusOptions" :props="rechargeStatusProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="金额" prop="priceStar">
<JnpfInputNumber v-model="dataForm.priceStar" @change="changeData('priceStar', -1)"
placeholder="数字文本" :step="1">
</JnpfInputNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="上传凭证图片" prop="photo">
<JnpfUploadImg v-model="dataForm.photo" @change="changeData('photo', -1)" :fileSize="10"
sizeUnit="MB" :limit="1" pathType="defaultPath" :isAccount="0">
</JnpfUploadImg>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="上传附件" prop="file">
<JnpfUploadFile v-model="dataForm.file" @change="changeData('file', -1)" :fileSize="10"
sizeUnit="MB" :limit="1" pathType="defaultPath" :isAccount="0" buttonText="点击上传">
</JnpfUploadFile>
</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>
</div>
</transition>
</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: {
code: undefined,
walletType: "1",
buinessId: undefined,
applyTime: undefined,
description: undefined,
expenseType: "1",
rechargeStatus: undefined,
priceStar: undefined,
photo: [],
file: [],
creatorUserId: undefined,
creatorTime: undefined,
lastModifyUserId: undefined,
lastModifyTime: undefined,
version: 0,
},
tableRequiredData: {},
dataRule:
{
walletType: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
buinessId: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
applyTime: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
description: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
expenseType: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
rechargeStatus: [
{
required: true,
message: '不能为空',
trigger: 'change'
},
],
priceStar: [
{
required: true,
message: '数字文本',
trigger: ["blur", "change"]
},
],
},
walletTypeOptions: [{ "fullName": "充值订单", "id": "1" }, { "fullName": "提款订单", "id": "2" }],
walletTypeProps: { "label": "fullName", "value": "id" },
expenseTypeOptions: [{ "fullName": "预存款", "id": "1" }],
expenseTypeProps: { "label": "fullName", "value": "id" },
rechargeStatusOptions: [{ "fullName": "未充值", "id": "1" }, { "fullName": "已充值", "id": "2" }],
rechargeStatusProps: { "label": "fullName", "value": "id" },
childIndex: -1,
isEdit: false,
interfaceRes: {
code: [],
walletType: [],
buinessId: [],
applyTime: [],
description: [],
expenseType: [],
rechargeStatus: [],
priceStar: [],
photo: [],
file: [],
creatorUserId: [],
creatorTime: [],
lastModifyUserId: [],
lastModifyTime: [],
},
}
},
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/NxWallet/' + 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() {
},
goBack() {
this.$emit('refresh')
},
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/NxWallet/' + 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() {
if (
this.userInfo.organizeIdList instanceof Array &&
this.userInfo.organizeIdList.length > 0
) {
this.dataForm.buinessId = this.userInfo.organizeIdList;
}
this.dataForm.firstContactPerson = this.userInfo.userId;
if (
this.$store.getters.userInfo.organizeId &&
this.$store.getters.userInfo.organizeId != null
) {
this.dataForm.buinessId = this.$store.getters.userInfo.organizeId;
}
},
//
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/NxWallet',
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/NxWallet/' + 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,569 @@
<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.code" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="单据类型">
<JnpfSelect v-model="query.walletType" placeholder="请选择" clearable
:options="walletTypeOptions" :props="walletTypeProps">
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="申请时间">
<JnpfDateRangePicker v-model="query.applyTime" format="yyyy-MM-dd" startPlaceholder="开始日期"
endPlaceholder="结束日期">
</JnpfDateRangePicker>
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<el-form-item label="充值状态">
<JnpfSelect v-model="query.rechargeStatus" placeholder="请选择" clearable
:options="rechargeStatusOptions" :props="rechargeStatusProps">
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="创建用户">
<JnpfUserSelect v-model="query.creatorUserId" placeholder="请选择" />
</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>
<el-button type="text" icon="icon-ym icon-ym-btn-download" @click="exportData()">
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-clearn" @click="handleBatchRemoveDel()">
</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' has-c
@selection-change="handleSelectionChange" :span-method="arraySpanMethod">
<el-table-column prop="code" label="流水编号" align="left">
</el-table-column>
<el-table-column label="单据类型" prop="walletType" align="left">
<template slot-scope="scope">
{{ scope.row.walletType }}
</template>
</el-table-column>
<el-table-column prop="orderCode" label="订单编号" align="left">
</el-table-column>
<el-table-column prop="applyTime" 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 label="充值状态" prop="rechargeStatus" algin="left">
<template slot-scope="scope">
{{ scope.row.rechargeStatus }}
</template>
</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 prop="priceStar" label="金额" align="left">
<template slot-scope="scope" v-if="scope.row.priceStar">
<JnpfNumber v-model="scope.row.priceStar" :thousands="false" />
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button v-if="scope.row.rechargeStatus == ''" type="text" class="JNPF-table-delBtn"
@click="addA(scope.row.id)">已支付
</el-button>
<el-button v-if="scope.row.rechargeStatus == '' && scope.row.orderStatus == ''"
type="text" @click="addA(scope.row.id)">确认已收款
</el-button>
<!-- <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: {
code: undefined,
walletType: undefined,
applyTime: undefined,
rechargeStatus: undefined,
creatorUserId: undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf'
},
list: [],
listLoading: true,
multipleSelection: [], total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
walletTypeOptions: [{ "fullName": "充值订单", "id": "1" }, { "fullName": "提款订单", "id": "2" }],
walletTypeProps: { "label": "fullName", "value": "id" },
expenseTypeOptions: [{ "fullName": "预存款", "id": "1" }],
expenseTypeProps: { "label": "fullName", "value": "id" },
rechargeStatusOptions: [{ "fullName": "未充值", "id": "1" }, { "fullName": "已充值", "id": "2" }],
rechargeStatusProps: { "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: '541901233368085509',
type: 1,
};
request({
url: `/api/scm/NxWallet/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/NxWallet/${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/NxWallet")
})
},
handleSelectionChange(val) {
const res = val.map(item => item.id)
this.multipleSelection = res
},
handleBatchRemoveDel() {
if (!this.multipleSelection.length) {
this.$message({
type: 'error',
message: '请选择一条数据',
duration: 1500,
})
return
}
const ids = this.multipleSelection
this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/scm/NxWallet/batchRemove`,
data: ids,
method: 'DELETE'
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
}
});
})
}).catch(() => {
})
},
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)
})
},
addA(id, status) {
this.$confirm("此操作将修改, 是否继续?", "提示", {
type: "warning",
})
.then(() => {
status = '2',
request({
url: `/api/scm/NxWallet/closestatus/${id}/${status}`,
method: "Post",
}).then((res) => {
this.$message({
type: "success",
message: res.msg,
onClose: () => {
this.initData();
},
});
});
})
.catch(() => { });
},
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/NxWallet/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,16 @@
package jnpf.mapper;
import jnpf.entity.NxWalletEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* nxWallet
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-03-25
*/
public interface NxWalletMapper extends BaseMapper<NxWalletEntity> {
}

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.nxwallet.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* nxWallet
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-03-25
*/
public interface NxWalletService extends IService<NxWalletEntity> {
List<NxWalletEntity> getList(NxWalletPagination nxWalletPagination);
List<NxWalletEntity> getTypeList(NxWalletPagination nxWalletPagination,String dataType);
NxWalletEntity getInfo(String id);
void delete(NxWalletEntity entity);
void create(NxWalletEntity entity);
boolean update(String id, NxWalletEntity entity);
//子表方法
//副表数据方法
String checkForm(NxWalletForm form,int i);
void saveOrUpdate(NxWalletForm nxWalletForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,318 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.NxWalletMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.nxwallet.*;
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;
/**
*
* nxWallet
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-03-25
*/
@Service
public class NxWalletServiceImpl extends ServiceImpl<NxWalletMapper, NxWalletEntity> implements NxWalletService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<NxWalletEntity> getList(NxWalletPagination nxWalletPagination){
return getTypeList(nxWalletPagination,nxWalletPagination.getDataType());
}
/** 列表查询 */
@Override
public List<NxWalletEntity> getTypeList(NxWalletPagination nxWalletPagination,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 ? NxWalletConstant.getAppColumnData() : NxWalletConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int nxWalletNum =0;
QueryWrapper<NxWalletEntity> nxWalletQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(nxWalletPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = nxWalletPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<NxWalletEntity> nxWalletSuperWrapper = new QueryWrapper<>();
nxWalletSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(nxWalletSuperWrapper,NxWalletEntity.class,queryJson,"0"));
int nxWalletNum1 = nxWalletSuperWrapper.getExpression().getNormal().size();
if (nxWalletNum1>0){
List<String> nxWalletList =this.list(nxWalletSuperWrapper).stream().map(NxWalletEntity::getId).collect(Collectors.toList());
allSuperList.addAll(nxWalletList);
intersectionSuperList.add(nxWalletList);
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<NxWalletEntity> nxWalletSuperWrapper = new QueryWrapper<>();
nxWalletSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(nxWalletSuperWrapper,NxWalletEntity.class,ruleJson,"0"));
int nxWalletNum1 = nxWalletSuperWrapper.getExpression().getNormal().size();
if (nxWalletNum1>0){
List<String> nxWalletList =this.list(nxWalletSuperWrapper).stream().map(NxWalletEntity::getId).collect(Collectors.toList());
allRuleList.addAll(nxWalletList);
intersectionRuleList.add(nxWalletList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = true;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object nxWalletObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(nxWalletQueryWrapper,NxWalletEntity.class,nxWalletPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(nxWalletObj)){
return new ArrayList<>();
} else {
nxWalletQueryWrapper = (QueryWrapper<NxWalletEntity>)nxWalletObj;
if( nxWalletQueryWrapper.getExpression().getNormal().size()>0){
nxWalletNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object nxWalletObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(nxWalletQueryWrapper,NxWalletEntity.class,nxWalletPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(nxWalletObj)){
return new ArrayList<>();
} else {
nxWalletQueryWrapper = (QueryWrapper<NxWalletEntity>)nxWalletObj;
if( nxWalletQueryWrapper.getExpression().getNormal().size()>0){
nxWalletNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(nxWalletPagination.getCode())){
nxWalletNum++;
String value = nxWalletPagination.getCode() instanceof List ?
JsonUtil.getObjectToString(nxWalletPagination.getCode()) :
String.valueOf(nxWalletPagination.getCode());
nxWalletQueryWrapper.lambda().like(NxWalletEntity::getCode,value);
}
if(ObjectUtil.isNotEmpty(nxWalletPagination.getWalletType())){
nxWalletNum++;
nxWalletQueryWrapper.lambda().eq(NxWalletEntity::getWalletType,nxWalletPagination.getWalletType());
}
if(ObjectUtil.isNotEmpty(nxWalletPagination.getApplyTime())){
nxWalletNum++;
List ApplyTimeList = JsonUtil.getJsonToList(nxWalletPagination.getApplyTime(),String.class);
Long fir = Long.valueOf(String.valueOf(ApplyTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(ApplyTimeList.get(1)));
nxWalletQueryWrapper.lambda().ge(NxWalletEntity::getApplyTime, new Date(fir))
.le(NxWalletEntity::getApplyTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(ObjectUtil.isNotEmpty(nxWalletPagination.getRechargeStatus())){
nxWalletNum++;
nxWalletQueryWrapper.lambda().eq(NxWalletEntity::getRechargeStatus,nxWalletPagination.getRechargeStatus());
}
if(ObjectUtil.isNotEmpty(nxWalletPagination.getCreatorUserId())){
nxWalletNum++;
nxWalletQueryWrapper.lambda().eq(NxWalletEntity::getCreatorUserId,nxWalletPagination.getCreatorUserId());
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
nxWalletQueryWrapper.lambda().in(NxWalletEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
nxWalletQueryWrapper.lambda().and(t->t.in(NxWalletEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
nxWalletQueryWrapper.lambda().and(t->t.in(NxWalletEntity::getId, finalAllRuleIDlist));
}
//排序
if(StringUtil.isEmpty(nxWalletPagination.getSidx())){
nxWalletQueryWrapper.lambda().orderByDesc(NxWalletEntity::getId);
}else{
try {
String sidx = nxWalletPagination.getSidx();
String[] strs= sidx.split("_name");
NxWalletEntity nxWalletEntity = new NxWalletEntity();
Field declaredField = nxWalletEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
nxWalletQueryWrapper="asc".equals(nxWalletPagination.getSort().toLowerCase())?nxWalletQueryWrapper.orderByAsc(value):nxWalletQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<NxWalletEntity> page=new Page<>(nxWalletPagination.getCurrentPage(), nxWalletPagination.getPageSize());
IPage<NxWalletEntity> userIPage=this.page(page, nxWalletQueryWrapper);
return nxWalletPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<NxWalletEntity> list = new ArrayList();
return nxWalletPagination.setData(list, list.size());
}
}else{
return this.list(nxWalletQueryWrapper);
}
}
@Override
public NxWalletEntity getInfo(String id){
QueryWrapper<NxWalletEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(NxWalletEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(NxWalletEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, NxWalletEntity entity){
return this.updateById(entity);
}
@Override
public void delete(NxWalletEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(NxWalletForm 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.getBuinessId())){
return "申请单位id不能为空";
}
if(StringUtil.isEmpty(form.getDescription())){
return "备注不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param nxWalletForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(NxWalletForm nxWalletForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
nxWalletForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(NxWalletConstant.getFormData(),nxWalletForm),NxWalletForm.class);
NxWalletEntity entity = JsonUtil.getJsonToBean(nxWalletForm, NxWalletEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setCode(generaterSwapUtil.getBillNumber("walletCode", false));
entity.setCreatorUserId(userInfo.getUserId());
entity.setCreatorTime(DateUtil.getNowDate());
entity.setLastModifyUserId(null);
entity.setLastModifyTime(null);
entity.setId(mainId);
entity.setVersion(0);
}else{
entity.setCode(generaterSwapUtil.getBillNumber("walletCode", false));
entity.setCreatorUserId(userInfo.getUserId());
entity.setCreatorTime(DateUtil.getNowDate());
entity.setLastModifyUserId(null);
entity.setLastModifyTime(null);
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,377 @@
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.nxwallet.*;
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.web.multipart.MultipartFile;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
import jnpf.onlinedev.model.OnlineImport.ExcelImportModel;
import jnpf.onlinedev.model.OnlineImport.VisualImportModel;
import cn.xuyanwu.spring.file.storage.FileInfo;
import lombok.Cleanup;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* nxWallet
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-03-25
*/
@Slf4j
@RestController
@Tag(name = "nxWallet" , description = "scm")
@RequestMapping("/api/scm/NxWallet")
public class NxWalletController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private NxWalletService nxWalletService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param nxWalletPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody NxWalletPagination nxWalletPagination)throws IOException{
List<NxWalletEntity> list= nxWalletService.getList(nxWalletPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (NxWalletEntity entity : list) {
Map<String, Object> nxWalletMap=JsonUtil.entityToMap(entity);
nxWalletMap.put("id", nxWalletMap.get("id"));
//副表数据
//子表数据
realList.add(nxWalletMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, NxWalletConstant.getFormData(), NxWalletConstant.getColumnData(), nxWalletPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(nxWalletPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param nxWalletForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid NxWalletForm nxWalletForm) {
String b = nxWalletService.checkForm(nxWalletForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
nxWalletService.saveOrUpdate(nxWalletForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody NxWalletPagination nxWalletPagination) throws IOException {
if (StringUtil.isEmpty(nxWalletPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<NxWalletEntity> list= nxWalletService.getList(nxWalletPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (NxWalletEntity entity : list) {
Map<String, Object> nxWalletMap=JsonUtil.entityToMap(entity);
nxWalletMap.put("id", nxWalletMap.get("id"));
//副表数据
//子表数据
realList.add(nxWalletMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, NxWalletConstant.getFormData(), NxWalletConstant.getColumnData(), nxWalletPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(nxWalletPagination.getSelectKey())?nxWalletPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "code" :
entitys.add(new ExcelExportEntity("流水编号" ,"code"));
break;
case "walletType" :
entitys.add(new ExcelExportEntity("单据类型" ,"walletType"));
break;
case "buinessId" :
entitys.add(new ExcelExportEntity("申请单位id" ,"buinessId"));
break;
case "applyTime" :
entitys.add(new ExcelExportEntity("申请时间" ,"applyTime"));
break;
case "description" :
entitys.add(new ExcelExportEntity("备注" ,"description"));
break;
case "expenseType" :
entitys.add(new ExcelExportEntity("费用项目" ,"expenseType"));
break;
case "rechargeStatus" :
entitys.add(new ExcelExportEntity("充值状态" ,"rechargeStatus"));
break;
case "priceStar" :
entitys.add(new ExcelExportEntity("金额" ,"priceStar"));
break;
case "photo" :
entitys.add(new ExcelExportEntity("上传凭证图片" ,"photo"));
break;
case "file" :
entitys.add(new ExcelExportEntity("上传附件" ,"file"));
break;
case "creatorUserId" :
entitys.add(new ExcelExportEntity("创建用户" ,"creatorUserId"));
break;
case "creatorTime" :
entitys.add(new ExcelExportEntity("创建时间" ,"creatorTime"));
break;
case "lastModifyUserId" :
entitys.add(new ExcelExportEntity("修改用户" ,"lastModifyUserId"));
break;
case "lastModifyTime" :
entitys.add(new ExcelExportEntity("修改时间" ,"lastModifyTime"));
break;
default:
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
list.add(new HashMap<>());
}
//去除空数据
List<Map<String, Object>> dataList = new ArrayList<>();
for (Map<String, Object> map : list) {
int i = 0;
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" ));
String field = key.substring(key.indexOf("-" ) + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
for (Map<String, Object> childMap : childList) {
if (childMap.get(field) != null) {
i++;
}
}
}
} else {
Object o = map.get(key);
if (o != null) {
i++;
}
}
}
if (i > 0) {
dataList.add(map);
}
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(NxWalletConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
}
String fileName = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return vo;
}
/**
*
* @param ids
* @return
*/
@DeleteMapping("/batchRemove")
@Transactional
@Operation(summary = "批量删除")
public ActionResult batchRemove(@RequestBody String ids){
List<String> idList = JsonUtil.getJsonToList(ids, String.class);
int i =0;
for (String allId : idList){
this.delete(allId);
i++;
}
if (i == 0 ){
return ActionResult.fail("删除失败");
}
return ActionResult.success("删除成功");
}
/**
*
* @param id
* @param nxWalletForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid NxWalletForm nxWalletForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
nxWalletForm.setId(id);
if (!isImport) {
String b = nxWalletService.checkForm(nxWalletForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
NxWalletEntity entity= nxWalletService.getInfo(id);
if(entity!=null){
try{
nxWalletService.saveOrUpdate(nxWalletForm,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){
NxWalletEntity entity= nxWalletService.getInfo(id);
if(entity!=null){
//主表数据删除
nxWalletService.delete(entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
NxWalletEntity entity= nxWalletService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> nxWalletMap=JsonUtil.entityToMap(entity);
nxWalletMap.put("id", nxWalletMap.get("id"));
//副表数据
//子表数据
nxWalletMap = generaterSwapUtil.swapDataDetail(nxWalletMap,NxWalletConstant.getFormData(),"541901233368085509",false);
return ActionResult.success(nxWalletMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
NxWalletEntity entity= nxWalletService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> nxWalletMap=JsonUtil.entityToMap(entity);
nxWalletMap.put("id", nxWalletMap.get("id"));
//副表数据
//子表数据
nxWalletMap = generaterSwapUtil.swapDataForm(nxWalletMap,NxWalletConstant.getFormData(),NxWalletConstant.TABLEFIELDKEY,NxWalletConstant.TABLERENAMES);
return ActionResult.success(nxWalletMap);
}
}

@ -0,0 +1,70 @@
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-03-25
*/
@Data
@TableName("nx_wallet")
public class NxWalletEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "BUINESS_ID" , updateStrategy = FieldStrategy.IGNORED)
private String buinessId;
@TableField(value = "CODE" , updateStrategy = FieldStrategy.IGNORED)
private String code;
@TableField("ORDER_CODE")
private String orderCode;
@TableField(value = "WALLET_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String walletType;
@TableField(value = "APPLY_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date applyTime;
@TableField(value = "DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String description;
@TableField(value = "EXPENSE_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String expenseType;
@TableField("ORDER_STATUS")
private String orderStatus;
@TableField(value = "RECHARGE_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String rechargeStatus;
@TableField(value = "PRICE_STAR" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal priceStar;
@TableField(value = "PHOTO" , updateStrategy = FieldStrategy.IGNORED)
private String photo;
@TableField(value = "FILE" , updateStrategy = FieldStrategy.IGNORED)
private String file;
@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;
@TableField("F_FLOW_ID")
private String flowId;
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,65 @@
package jnpf.model.jnpf;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* nxWallet
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-03-25
*/
@Data
public class NxWalletForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 流水编号 **/
@JsonProperty("code")
private String code;
/** 单据类型 **/
@JsonProperty("walletType")
private String walletType;
/** 申请单位id **/
@JsonProperty("buinessId")
private String buinessId;
/** 申请时间 **/
@JsonProperty("applyTime")
private String applyTime;
/** 备注 **/
@JsonProperty("description")
private String description;
/** 费用项目 **/
@JsonProperty("expenseType")
private Object expenseType;
/** 充值状态 **/
@JsonProperty("rechargeStatus")
private String rechargeStatus;
/** 金额 **/
@JsonProperty("priceStar")
private BigDecimal priceStar;
/** 上传凭证图片 **/
@JsonProperty("photo")
private Object photo;
/** 上传附件 **/
@JsonProperty("file")
private Object file;
/** 创建用户 **/
@JsonProperty("creatorUserId")
private String creatorUserId;
/** 创建时间 **/
@JsonProperty("creatorTime")
private String creatorTime;
/** 修改用户 **/
@JsonProperty("lastModifyUserId")
private String lastModifyUserId;
/** 修改时间 **/
@JsonProperty("lastModifyTime")
private String lastModifyTime;
}

@ -0,0 +1,45 @@
package jnpf.model.nxwallet;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* nxWallet
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-03-25
*/
@Data
public class NxWalletPagination 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("code")
private Object code;
/** 单据类型 */
@JsonProperty("walletType")
private Object walletType;
/** 申请时间 */
@JsonProperty("applyTime")
private Object applyTime;
/** 充值状态 */
@JsonProperty("rechargeStatus")
private Object rechargeStatus;
/** 创建用户 */
@JsonProperty("creatorUserId")
private Object creatorUserId;
}
Loading…
Cancel
Save