客户信用规则配置

jg-waiwang-pro
胡川虎 9 months ago
parent ac3dbe1c10
commit 7424aabf39

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

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

@ -1,16 +1,16 @@
package jnpf.mapper;
import jnpf.entity.SubjectCreditRatingEntity;
import jnpf.entity.SubjectcreditrulesEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* SubjectCreditRating
* Subjectcreditrules
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-30
* 2024-02-01
*/
public interface SubjectCreditRatingMapper extends BaseMapper<SubjectCreditRatingEntity> {
public interface SubjectcreditrulesMapper extends BaseMapper<SubjectcreditrulesEntity> {
}

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

@ -1,35 +0,0 @@
package jnpf.service;
import jnpf.model.subjectcreditrating.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* SubjectCreditRating
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-30
*/
public interface SubjectCreditRatingService extends IService<SubjectCreditRatingEntity> {
List<SubjectCreditRatingEntity> getList(SubjectCreditRatingPagination subjectCreditRatingPagination);
List<SubjectCreditRatingEntity> getTypeList(SubjectCreditRatingPagination subjectCreditRatingPagination,String dataType);
SubjectCreditRatingEntity getInfo(String id);
void delete(SubjectCreditRatingEntity entity);
void create(SubjectCreditRatingEntity entity);
boolean update(String id, SubjectCreditRatingEntity entity);
//子表方法
//副表数据方法
String checkForm(SubjectCreditRatingForm form,int i);
void saveOrUpdate(SubjectCreditRatingForm subjectCreditRatingForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.subjectcreditratingno.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* Subjectcreditratingno
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-01
*/
public interface SubjectcreditratingService extends IService<SubjectcreditratingEntity> {
QueryWrapper<SubjectcreditratingEntity> getChild(SubjectcreditratingnoPagination pagination,QueryWrapper<SubjectcreditratingEntity> subjectcreditratingQueryWrapper);
}

@ -0,0 +1,39 @@
package jnpf.service;
import jnpf.model.subjectcreditratingno.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* Subjectcreditratingno
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-01
*/
public interface SubjectcreditratingnoService extends IService<SubjectcreditratingnoEntity> {
List<SubjectcreditratingnoEntity> getList(SubjectcreditratingnoPagination subjectcreditratingnoPagination);
List<SubjectcreditratingnoEntity> getTypeList(SubjectcreditratingnoPagination subjectcreditratingnoPagination,String dataType);
SubjectcreditratingnoEntity getInfo(String id);
void delete(SubjectcreditratingnoEntity entity);
void create(SubjectcreditratingnoEntity entity);
boolean update(String id, SubjectcreditratingnoEntity entity);
//子表方法
List<SubjectcreditratingEntity> getSubjectcreditratingList(String id,SubjectcreditratingnoPagination subjectcreditratingnoPagination);
List<SubjectcreditratingEntity> getSubjectcreditratingList(String id);
//副表数据方法
String checkForm(SubjectcreditratingnoForm form,int i);
void saveOrUpdate(SubjectcreditratingnoForm subjectcreditratingnoForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,39 @@
package jnpf.service;
import jnpf.model.subjectcreditrules.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* Subjectcreditrules
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-01
*/
public interface SubjectcreditrulesService extends IService<SubjectcreditrulesEntity> {
List<SubjectcreditrulesEntity> getList(SubjectcreditrulesPagination subjectcreditrulesPagination);
List<SubjectcreditrulesEntity> getTypeList(SubjectcreditrulesPagination subjectcreditrulesPagination,String dataType);
SubjectcreditrulesEntity getInfo(String id);
void delete(SubjectcreditrulesEntity entity);
void create(SubjectcreditrulesEntity entity);
boolean update(String id, SubjectcreditrulesEntity entity);
//子表方法
List<SubjectcreditrulesscoreEntity> getSubjectcreditrulesscoreList(String id,SubjectcreditrulesPagination subjectcreditrulesPagination);
List<SubjectcreditrulesscoreEntity> getSubjectcreditrulesscoreList(String id);
//副表数据方法
String checkForm(SubjectcreditrulesForm form,int i);
void saveOrUpdate(SubjectcreditrulesForm subjectcreditrulesForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.subjectcreditrules.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* Subjectcreditrules
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-01
*/
public interface SubjectcreditrulesscoreService extends IService<SubjectcreditrulesscoreEntity> {
QueryWrapper<SubjectcreditrulesscoreEntity> getChild(SubjectcreditrulesPagination pagination,QueryWrapper<SubjectcreditrulesscoreEntity> subjectcreditrulesscoreQueryWrapper);
}

@ -1,308 +0,0 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.SubjectCreditRatingMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.subjectcreditrating.*;
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;
/**
*
* SubjectCreditRating
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-30
*/
@Service
public class SubjectCreditRatingServiceImpl extends ServiceImpl<SubjectCreditRatingMapper, SubjectCreditRatingEntity> implements SubjectCreditRatingService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<SubjectCreditRatingEntity> getList(SubjectCreditRatingPagination subjectCreditRatingPagination){
return getTypeList(subjectCreditRatingPagination,subjectCreditRatingPagination.getDataType());
}
/** 列表查询 */
@Override
public List<SubjectCreditRatingEntity> getTypeList(SubjectCreditRatingPagination subjectCreditRatingPagination,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 ? SubjectCreditRatingConstant.getAppColumnData() : SubjectCreditRatingConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int subjectCreditRatingNum =0;
QueryWrapper<SubjectCreditRatingEntity> subjectCreditRatingQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(subjectCreditRatingPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = subjectCreditRatingPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<SubjectCreditRatingEntity> subjectCreditRatingSuperWrapper = new QueryWrapper<>();
subjectCreditRatingSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(subjectCreditRatingSuperWrapper,SubjectCreditRatingEntity.class,queryJson,"0"));
int subjectCreditRatingNum1 = subjectCreditRatingSuperWrapper.getExpression().getNormal().size();
if (subjectCreditRatingNum1>0){
List<String> subjectCreditRatingList =this.list(subjectCreditRatingSuperWrapper).stream().map(SubjectCreditRatingEntity::getId).collect(Collectors.toList());
allSuperList.addAll(subjectCreditRatingList);
intersectionSuperList.add(subjectCreditRatingList);
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<SubjectCreditRatingEntity> subjectCreditRatingSuperWrapper = new QueryWrapper<>();
subjectCreditRatingSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(subjectCreditRatingSuperWrapper,SubjectCreditRatingEntity.class,ruleJson,"0"));
int subjectCreditRatingNum1 = subjectCreditRatingSuperWrapper.getExpression().getNormal().size();
if (subjectCreditRatingNum1>0){
List<String> subjectCreditRatingList =this.list(subjectCreditRatingSuperWrapper).stream().map(SubjectCreditRatingEntity::getId).collect(Collectors.toList());
allRuleList.addAll(subjectCreditRatingList);
intersectionRuleList.add(subjectCreditRatingList);
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 subjectCreditRatingObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectCreditRatingQueryWrapper,SubjectCreditRatingEntity.class,subjectCreditRatingPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectCreditRatingObj)){
return new ArrayList<>();
} else {
subjectCreditRatingQueryWrapper = (QueryWrapper<SubjectCreditRatingEntity>)subjectCreditRatingObj;
if( subjectCreditRatingQueryWrapper.getExpression().getNormal().size()>0){
subjectCreditRatingNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object subjectCreditRatingObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectCreditRatingQueryWrapper,SubjectCreditRatingEntity.class,subjectCreditRatingPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectCreditRatingObj)){
return new ArrayList<>();
} else {
subjectCreditRatingQueryWrapper = (QueryWrapper<SubjectCreditRatingEntity>)subjectCreditRatingObj;
if( subjectCreditRatingQueryWrapper.getExpression().getNormal().size()>0){
subjectCreditRatingNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(subjectCreditRatingPagination.getCreditRating())){
subjectCreditRatingNum++;
List<String> idList = new ArrayList<>();
try {
String[][] creditRating = JsonUtil.getJsonToBean(subjectCreditRatingPagination.getCreditRating(),String[][].class);
for(int i=0;i<creditRating.length;i++){
if(creditRating[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(creditRating[i])));
}
}
}catch (Exception e1){
try {
List<String> creditRating = JsonUtil.getJsonToList(subjectCreditRatingPagination.getCreditRating(),String.class);
if(creditRating.size()>0){
idList.addAll(creditRating);
}
}catch (Exception e2){
idList.add(String.valueOf(subjectCreditRatingPagination.getCreditRating()));
}
}
subjectCreditRatingQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(SubjectCreditRatingEntity::getCreditRating, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(subjectCreditRatingPagination.getScoreDown())){
subjectCreditRatingNum++;
String value = subjectCreditRatingPagination.getScoreDown() instanceof List ?
JsonUtil.getObjectToString(subjectCreditRatingPagination.getScoreDown()) :
String.valueOf(subjectCreditRatingPagination.getScoreDown());
subjectCreditRatingQueryWrapper.lambda().like(SubjectCreditRatingEntity::getScoreDown,value);
}
if(ObjectUtil.isNotEmpty(subjectCreditRatingPagination.getScoreUpper())){
subjectCreditRatingNum++;
String value = subjectCreditRatingPagination.getScoreUpper() instanceof List ?
JsonUtil.getObjectToString(subjectCreditRatingPagination.getScoreUpper()) :
String.valueOf(subjectCreditRatingPagination.getScoreUpper());
subjectCreditRatingQueryWrapper.lambda().like(SubjectCreditRatingEntity::getScoreUpper,value);
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
subjectCreditRatingQueryWrapper.lambda().in(SubjectCreditRatingEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
subjectCreditRatingQueryWrapper.lambda().and(t->t.in(SubjectCreditRatingEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
subjectCreditRatingQueryWrapper.lambda().and(t->t.in(SubjectCreditRatingEntity::getId, finalAllRuleIDlist));
}
//假删除标志
subjectCreditRatingQueryWrapper.lambda().isNull(SubjectCreditRatingEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(subjectCreditRatingPagination.getSidx())){
subjectCreditRatingQueryWrapper.lambda().orderByDesc(SubjectCreditRatingEntity::getId);
}else{
try {
String sidx = subjectCreditRatingPagination.getSidx();
String[] strs= sidx.split("_name");
SubjectCreditRatingEntity subjectCreditRatingEntity = new SubjectCreditRatingEntity();
Field declaredField = subjectCreditRatingEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
subjectCreditRatingQueryWrapper="asc".equals(subjectCreditRatingPagination.getSort().toLowerCase())?subjectCreditRatingQueryWrapper.orderByAsc(value):subjectCreditRatingQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<SubjectCreditRatingEntity> page=new Page<>(subjectCreditRatingPagination.getCurrentPage(), subjectCreditRatingPagination.getPageSize());
IPage<SubjectCreditRatingEntity> userIPage=this.page(page, subjectCreditRatingQueryWrapper);
return subjectCreditRatingPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<SubjectCreditRatingEntity> list = new ArrayList();
return subjectCreditRatingPagination.setData(list, list.size());
}
}else{
return this.list(subjectCreditRatingQueryWrapper);
}
}
@Override
public SubjectCreditRatingEntity getInfo(String id){
QueryWrapper<SubjectCreditRatingEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(SubjectCreditRatingEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(SubjectCreditRatingEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, SubjectCreditRatingEntity entity){
return this.updateById(entity);
}
@Override
public void delete(SubjectCreditRatingEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(SubjectCreditRatingForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
return countRecover;
}
/**
* ()
* @param id
* @param subjectCreditRatingForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(SubjectCreditRatingForm subjectCreditRatingForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
subjectCreditRatingForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(SubjectCreditRatingConstant.getFormData(),subjectCreditRatingForm),SubjectCreditRatingForm.class);
SubjectCreditRatingEntity entity = JsonUtil.getJsonToBean(subjectCreditRatingForm, SubjectCreditRatingEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setId(mainId);
}else{
}
this.saveOrUpdate(entity);
}
}

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

@ -0,0 +1,391 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.SubjectcreditratingnoMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.subjectcreditratingno.*;
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;
/**
*
* Subjectcreditratingno
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-01
*/
@Service
public class SubjectcreditratingnoServiceImpl extends ServiceImpl<SubjectcreditratingnoMapper, SubjectcreditratingnoEntity> implements SubjectcreditratingnoService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private SubjectcreditratingService subjectcreditratingService;
@Override
public List<SubjectcreditratingnoEntity> getList(SubjectcreditratingnoPagination subjectcreditratingnoPagination){
return getTypeList(subjectcreditratingnoPagination,subjectcreditratingnoPagination.getDataType());
}
/** 列表查询 */
@Override
public List<SubjectcreditratingnoEntity> getTypeList(SubjectcreditratingnoPagination subjectcreditratingnoPagination,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 ? SubjectcreditratingnoConstant.getAppColumnData() : SubjectcreditratingnoConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int subjectcreditratingnoNum =0;
QueryWrapper<SubjectcreditratingnoEntity> subjectcreditratingnoQueryWrapper=new QueryWrapper<>();
int subjectcreditratingNum =0;
QueryWrapper<SubjectcreditratingEntity> subjectcreditratingQueryWrapper=new QueryWrapper<>();
long subjectcreditratingcount = subjectcreditratingService.count();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(subjectcreditratingnoPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = subjectcreditratingnoPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<SubjectcreditratingnoEntity> subjectcreditratingnoSuperWrapper = new QueryWrapper<>();
subjectcreditratingnoSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(subjectcreditratingnoSuperWrapper,SubjectcreditratingnoEntity.class,queryJson,"0"));
int subjectcreditratingnoNum1 = subjectcreditratingnoSuperWrapper.getExpression().getNormal().size();
if (subjectcreditratingnoNum1>0){
List<String> subjectcreditratingnoList =this.list(subjectcreditratingnoSuperWrapper).stream().map(SubjectcreditratingnoEntity::getId).collect(Collectors.toList());
allSuperList.addAll(subjectcreditratingnoList);
intersectionSuperList.add(subjectcreditratingnoList);
superNum++;
}
String SubjectcreditratingTable = "jg_subject_credit_rating";
boolean SubjectcreditratingHasSql = queryJson.contains(SubjectcreditratingTable);
List<String> subjectcreditratingList = generaterSwapUtil.selectIdsByChildCondition(SubjectcreditratingnoConstant.getTableList(), SubjectcreditratingTable , queryJson, null);
if (SubjectcreditratingHasSql){
allSuperList.addAll(subjectcreditratingList);
intersectionSuperList.add(subjectcreditratingList);
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<SubjectcreditratingnoEntity> subjectcreditratingnoSuperWrapper = new QueryWrapper<>();
subjectcreditratingnoSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(subjectcreditratingnoSuperWrapper,SubjectcreditratingnoEntity.class,ruleJson,"0"));
int subjectcreditratingnoNum1 = subjectcreditratingnoSuperWrapper.getExpression().getNormal().size();
if (subjectcreditratingnoNum1>0){
List<String> subjectcreditratingnoList =this.list(subjectcreditratingnoSuperWrapper).stream().map(SubjectcreditratingnoEntity::getId).collect(Collectors.toList());
allRuleList.addAll(subjectcreditratingnoList);
intersectionRuleList.add(subjectcreditratingnoList);
ruleNum++;
}
String SubjectcreditratingTable = "jg_subject_credit_rating";
boolean SubjectcreditratingHasSql = ruleJson.contains(SubjectcreditratingTable);
List<String> subjectcreditratingList = generaterSwapUtil.selectIdsByChildCondition(SubjectcreditratingnoConstant.getTableList(), SubjectcreditratingTable , ruleJson, null);
if (SubjectcreditratingHasSql){
allRuleList.addAll(subjectcreditratingList);
intersectionRuleList.add(subjectcreditratingList);
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 subjectcreditratingnoObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectcreditratingnoQueryWrapper,SubjectcreditratingnoEntity.class,subjectcreditratingnoPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectcreditratingnoObj)){
return new ArrayList<>();
} else {
subjectcreditratingnoQueryWrapper = (QueryWrapper<SubjectcreditratingnoEntity>)subjectcreditratingnoObj;
if( subjectcreditratingnoQueryWrapper.getExpression().getNormal().size()>0){
subjectcreditratingnoNum++;
}
}
Object subjectcreditratingObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectcreditratingQueryWrapper,SubjectcreditratingEntity.class,subjectcreditratingnoPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectcreditratingObj)){
return new ArrayList<>();
} else {
subjectcreditratingQueryWrapper = (QueryWrapper<SubjectcreditratingEntity>)subjectcreditratingObj;
if( subjectcreditratingQueryWrapper.getExpression().getNormal().size()>0){
subjectcreditratingNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object subjectcreditratingnoObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectcreditratingnoQueryWrapper,SubjectcreditratingnoEntity.class,subjectcreditratingnoPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectcreditratingnoObj)){
return new ArrayList<>();
} else {
subjectcreditratingnoQueryWrapper = (QueryWrapper<SubjectcreditratingnoEntity>)subjectcreditratingnoObj;
if( subjectcreditratingnoQueryWrapper.getExpression().getNormal().size()>0){
subjectcreditratingnoNum++;
}
}
Object subjectcreditratingObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectcreditratingQueryWrapper,SubjectcreditratingEntity.class,subjectcreditratingnoPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectcreditratingObj)){
return new ArrayList<>();
} else {
subjectcreditratingQueryWrapper = (QueryWrapper<SubjectcreditratingEntity>)subjectcreditratingObj;
if( subjectcreditratingQueryWrapper.getExpression().getNormal().size()>0){
subjectcreditratingNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(subjectcreditratingnoPagination.getBusinessNo())){
subjectcreditratingnoNum++;
String value = subjectcreditratingnoPagination.getBusinessNo() instanceof List ?
JsonUtil.getObjectToString(subjectcreditratingnoPagination.getBusinessNo()) :
String.valueOf(subjectcreditratingnoPagination.getBusinessNo());
subjectcreditratingnoQueryWrapper.lambda().like(SubjectcreditratingnoEntity::getBusinessNo,value);
}
if(ObjectUtil.isNotEmpty(subjectcreditratingnoPagination.getBusinessType())){
subjectcreditratingnoNum++;
String value = subjectcreditratingnoPagination.getBusinessType() instanceof List ?
JsonUtil.getObjectToString(subjectcreditratingnoPagination.getBusinessType()) :
String.valueOf(subjectcreditratingnoPagination.getBusinessType());
subjectcreditratingnoQueryWrapper.lambda().like(SubjectcreditratingnoEntity::getBusinessType,value);
}
}
if(subjectcreditratingNum>0){
List<String> subjectcreditratingIdList = subjectcreditratingService.list(subjectcreditratingQueryWrapper).stream().filter(t->StringUtil.isNotEmpty(t.getNoId())).map(t->t.getNoId()).collect(Collectors.toList());
long count = subjectcreditratingService.count();
if (count>0){
intersectionList.add(subjectcreditratingIdList);
}
AllIdList.addAll(subjectcreditratingIdList);
}
total+=subjectcreditratingNum;
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
subjectcreditratingnoQueryWrapper.lambda().in(SubjectcreditratingnoEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
subjectcreditratingnoQueryWrapper.lambda().and(t->t.in(SubjectcreditratingnoEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
subjectcreditratingnoQueryWrapper.lambda().and(t->t.in(SubjectcreditratingnoEntity::getId, finalAllRuleIDlist));
}
//假删除标志
subjectcreditratingnoQueryWrapper.lambda().isNull(SubjectcreditratingnoEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(subjectcreditratingnoPagination.getSidx())){
subjectcreditratingnoQueryWrapper.lambda().orderByDesc(SubjectcreditratingnoEntity::getId);
}else{
try {
String sidx = subjectcreditratingnoPagination.getSidx();
String[] strs= sidx.split("_name");
SubjectcreditratingnoEntity subjectcreditratingnoEntity = new SubjectcreditratingnoEntity();
Field declaredField = subjectcreditratingnoEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
subjectcreditratingnoQueryWrapper="asc".equals(subjectcreditratingnoPagination.getSort().toLowerCase())?subjectcreditratingnoQueryWrapper.orderByAsc(value):subjectcreditratingnoQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<SubjectcreditratingnoEntity> page=new Page<>(subjectcreditratingnoPagination.getCurrentPage(), subjectcreditratingnoPagination.getPageSize());
IPage<SubjectcreditratingnoEntity> userIPage=this.page(page, subjectcreditratingnoQueryWrapper);
return subjectcreditratingnoPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<SubjectcreditratingnoEntity> list = new ArrayList();
return subjectcreditratingnoPagination.setData(list, list.size());
}
}else{
return this.list(subjectcreditratingnoQueryWrapper);
}
}
@Override
public SubjectcreditratingnoEntity getInfo(String id){
QueryWrapper<SubjectcreditratingnoEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(SubjectcreditratingnoEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(SubjectcreditratingnoEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, SubjectcreditratingnoEntity entity){
return this.updateById(entity);
}
@Override
public void delete(SubjectcreditratingnoEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** Subjectcreditrating子表方法 */
@Override
public List<SubjectcreditratingEntity> getSubjectcreditratingList(String id,SubjectcreditratingnoPagination subjectcreditratingnoPagination){
Map<String, Object> newtabMap=SubjectcreditratingnoConstant.TABLEFIELDKEY.entrySet()
.stream().collect( Collectors.toMap(e->e.getValue(),e->e.getKey()));
String tableName="subjectcreditrating";
tableName=newtabMap.get(tableName)==null?tableName:newtabMap.get(tableName).toString();
QueryWrapper<SubjectcreditratingEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = subjectcreditratingService.getChild(subjectcreditratingnoPagination,queryWrapper);
queryWrapper.lambda().eq(SubjectcreditratingEntity::getNoId, id);
generaterSwapUtil.wrapperHandle(SubjectcreditratingnoConstant.getColumnData(), SubjectcreditratingnoConstant.getAppColumnData(), queryWrapper,SubjectcreditratingEntity.class,"sub",tableName);
return subjectcreditratingService.list(queryWrapper);
}
/** Subjectcreditrating子表方法 */
@Override
public List<SubjectcreditratingEntity> getSubjectcreditratingList(String id){
QueryWrapper<SubjectcreditratingEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SubjectcreditratingEntity::getNoId, id);
return subjectcreditratingService.list(queryWrapper);
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(SubjectcreditratingnoForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
//子表字段验证
if (form.getSubjectcreditratingList()!=null){
for(SubjectcreditratingModel t : form.getSubjectcreditratingList()){
if(StringUtil.isNotEmpty(t.getScoreDown())){
t.setScoreDown(t.getScoreDown().trim());
}
else{
return "设计子表-评定分数最低不能为空";
}
}
for(SubjectcreditratingModel t : form.getSubjectcreditratingList()){
if(StringUtil.isNotEmpty(t.getScoreUpper())){
t.setScoreUpper(t.getScoreUpper().trim());
}
else{
return "设计子表-评定分数最高不能为空";
}
}
}
return countRecover;
}
/**
* ()
* @param id
* @param subjectcreditratingnoForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(SubjectcreditratingnoForm subjectcreditratingnoForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
subjectcreditratingnoForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(SubjectcreditratingnoConstant.getFormData(),subjectcreditratingnoForm),SubjectcreditratingnoForm.class);
SubjectcreditratingnoEntity entity = JsonUtil.getJsonToBean(subjectcreditratingnoForm, SubjectcreditratingnoEntity.class);
if(isSave){
String mainId = id ;
entity.setBusinessNo(generaterSwapUtil.getBillNumber("xinyongdengji", false));
entity.setId(mainId);
entity.setFlowId(subjectcreditratingnoForm.getFlowId());
entity.setVersion(0);
}else{
entity.setBusinessNo(generaterSwapUtil.getBillNumber("xinyongdengji", false));
entity.setFlowId(subjectcreditratingnoForm.getFlowId());
}
this.saveOrUpdate(entity);
//Subjectcreditrating子表数据新增修改
if(!isSave){
QueryWrapper<SubjectcreditratingEntity> SubjectcreditratingqueryWrapper = new QueryWrapper<>();
SubjectcreditratingqueryWrapper.lambda().eq(SubjectcreditratingEntity::getNoId, entity.getId());
subjectcreditratingService.remove(SubjectcreditratingqueryWrapper);
}
if (subjectcreditratingnoForm.getSubjectcreditratingList()!=null){
List<SubjectcreditratingEntity> tableField102 = JsonUtil.getJsonToList(subjectcreditratingnoForm.getSubjectcreditratingList(),SubjectcreditratingEntity.class);
for(SubjectcreditratingEntity entitys : tableField102){
entitys.setId(RandomUtil.uuId());
entitys.setNoId(entity.getId());
if(isSave){
}else{
}
subjectcreditratingService.saveOrUpdate(entitys);
}
}
}
}

@ -0,0 +1,463 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.SubjectcreditrulesMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.subjectcreditrules.*;
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;
/**
*
* Subjectcreditrules
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-01
*/
@Service
public class SubjectcreditrulesServiceImpl extends ServiceImpl<SubjectcreditrulesMapper, SubjectcreditrulesEntity> implements SubjectcreditrulesService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private SubjectcreditrulesscoreService subjectcreditrulesscoreService;
@Override
public List<SubjectcreditrulesEntity> getList(SubjectcreditrulesPagination subjectcreditrulesPagination){
return getTypeList(subjectcreditrulesPagination,subjectcreditrulesPagination.getDataType());
}
/** 列表查询 */
@Override
public List<SubjectcreditrulesEntity> getTypeList(SubjectcreditrulesPagination subjectcreditrulesPagination,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 ? SubjectcreditrulesConstant.getAppColumnData() : SubjectcreditrulesConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int subjectcreditrulesNum =0;
QueryWrapper<SubjectcreditrulesEntity> subjectcreditrulesQueryWrapper=new QueryWrapper<>();
int subjectcreditrulesscoreNum =0;
QueryWrapper<SubjectcreditrulesscoreEntity> subjectcreditrulesscoreQueryWrapper=new QueryWrapper<>();
long subjectcreditrulesscorecount = subjectcreditrulesscoreService.count();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(subjectcreditrulesPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = subjectcreditrulesPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<SubjectcreditrulesEntity> subjectcreditrulesSuperWrapper = new QueryWrapper<>();
subjectcreditrulesSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(subjectcreditrulesSuperWrapper,SubjectcreditrulesEntity.class,queryJson,"0"));
int subjectcreditrulesNum1 = subjectcreditrulesSuperWrapper.getExpression().getNormal().size();
if (subjectcreditrulesNum1>0){
List<String> subjectcreditrulesList =this.list(subjectcreditrulesSuperWrapper).stream().map(SubjectcreditrulesEntity::getId).collect(Collectors.toList());
allSuperList.addAll(subjectcreditrulesList);
intersectionSuperList.add(subjectcreditrulesList);
superNum++;
}
String SubjectcreditrulesscoreTable = "jg_subject_credit_rules_score";
boolean SubjectcreditrulesscoreHasSql = queryJson.contains(SubjectcreditrulesscoreTable);
List<String> subjectcreditrulesscoreList = generaterSwapUtil.selectIdsByChildCondition(SubjectcreditrulesConstant.getTableList(), SubjectcreditrulesscoreTable , queryJson, null);
if (SubjectcreditrulesscoreHasSql){
allSuperList.addAll(subjectcreditrulesscoreList);
intersectionSuperList.add(subjectcreditrulesscoreList);
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<SubjectcreditrulesEntity> subjectcreditrulesSuperWrapper = new QueryWrapper<>();
subjectcreditrulesSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(subjectcreditrulesSuperWrapper,SubjectcreditrulesEntity.class,ruleJson,"0"));
int subjectcreditrulesNum1 = subjectcreditrulesSuperWrapper.getExpression().getNormal().size();
if (subjectcreditrulesNum1>0){
List<String> subjectcreditrulesList =this.list(subjectcreditrulesSuperWrapper).stream().map(SubjectcreditrulesEntity::getId).collect(Collectors.toList());
allRuleList.addAll(subjectcreditrulesList);
intersectionRuleList.add(subjectcreditrulesList);
ruleNum++;
}
String SubjectcreditrulesscoreTable = "jg_subject_credit_rules_score";
boolean SubjectcreditrulesscoreHasSql = ruleJson.contains(SubjectcreditrulesscoreTable);
List<String> subjectcreditrulesscoreList = generaterSwapUtil.selectIdsByChildCondition(SubjectcreditrulesConstant.getTableList(), SubjectcreditrulesscoreTable , ruleJson, null);
if (SubjectcreditrulesscoreHasSql){
allRuleList.addAll(subjectcreditrulesscoreList);
intersectionRuleList.add(subjectcreditrulesscoreList);
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 subjectcreditrulesObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectcreditrulesQueryWrapper,SubjectcreditrulesEntity.class,subjectcreditrulesPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectcreditrulesObj)){
return new ArrayList<>();
} else {
subjectcreditrulesQueryWrapper = (QueryWrapper<SubjectcreditrulesEntity>)subjectcreditrulesObj;
if( subjectcreditrulesQueryWrapper.getExpression().getNormal().size()>0){
subjectcreditrulesNum++;
}
}
Object subjectcreditrulesscoreObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectcreditrulesscoreQueryWrapper,SubjectcreditrulesscoreEntity.class,subjectcreditrulesPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectcreditrulesscoreObj)){
return new ArrayList<>();
} else {
subjectcreditrulesscoreQueryWrapper = (QueryWrapper<SubjectcreditrulesscoreEntity>)subjectcreditrulesscoreObj;
if( subjectcreditrulesscoreQueryWrapper.getExpression().getNormal().size()>0){
subjectcreditrulesscoreNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object subjectcreditrulesObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectcreditrulesQueryWrapper,SubjectcreditrulesEntity.class,subjectcreditrulesPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectcreditrulesObj)){
return new ArrayList<>();
} else {
subjectcreditrulesQueryWrapper = (QueryWrapper<SubjectcreditrulesEntity>)subjectcreditrulesObj;
if( subjectcreditrulesQueryWrapper.getExpression().getNormal().size()>0){
subjectcreditrulesNum++;
}
}
Object subjectcreditrulesscoreObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(subjectcreditrulesscoreQueryWrapper,SubjectcreditrulesscoreEntity.class,subjectcreditrulesPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(subjectcreditrulesscoreObj)){
return new ArrayList<>();
} else {
subjectcreditrulesscoreQueryWrapper = (QueryWrapper<SubjectcreditrulesscoreEntity>)subjectcreditrulesscoreObj;
if( subjectcreditrulesscoreQueryWrapper.getExpression().getNormal().size()>0){
subjectcreditrulesscoreNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(subjectcreditrulesPagination.getBusinessType())){
subjectcreditrulesNum++;
String value = subjectcreditrulesPagination.getBusinessType() instanceof List ?
JsonUtil.getObjectToString(subjectcreditrulesPagination.getBusinessType()) :
String.valueOf(subjectcreditrulesPagination.getBusinessType());
subjectcreditrulesQueryWrapper.lambda().like(SubjectcreditrulesEntity::getBusinessType,value);
}
if(ObjectUtil.isNotEmpty(subjectcreditrulesPagination.getBusinessNo())){
subjectcreditrulesNum++;
String value = subjectcreditrulesPagination.getBusinessNo() instanceof List ?
JsonUtil.getObjectToString(subjectcreditrulesPagination.getBusinessNo()) :
String.valueOf(subjectcreditrulesPagination.getBusinessNo());
subjectcreditrulesQueryWrapper.lambda().like(SubjectcreditrulesEntity::getBusinessNo,value);
}
if(ObjectUtil.isNotEmpty(subjectcreditrulesPagination.getCategoryName())){
subjectcreditrulesNum++;
List<String> idList = new ArrayList<>();
try {
String[][] categoryName = JsonUtil.getJsonToBean(subjectcreditrulesPagination.getCategoryName(),String[][].class);
for(int i=0;i<categoryName.length;i++){
if(categoryName[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(categoryName[i])));
}
}
}catch (Exception e1){
try {
List<String> categoryName = JsonUtil.getJsonToList(subjectcreditrulesPagination.getCategoryName(),String.class);
if(categoryName.size()>0){
idList.addAll(categoryName);
}
}catch (Exception e2){
idList.add(String.valueOf(subjectcreditrulesPagination.getCategoryName()));
}
}
subjectcreditrulesQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(SubjectcreditrulesEntity::getCategoryName, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(subjectcreditrulesPagination.getProjectName())){
subjectcreditrulesNum++;
List<String> idList = new ArrayList<>();
try {
String[][] projectName = JsonUtil.getJsonToBean(subjectcreditrulesPagination.getProjectName(),String[][].class);
for(int i=0;i<projectName.length;i++){
if(projectName[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(projectName[i])));
}
}
}catch (Exception e1){
try {
List<String> projectName = JsonUtil.getJsonToList(subjectcreditrulesPagination.getProjectName(),String.class);
if(projectName.size()>0){
idList.addAll(projectName);
}
}catch (Exception e2){
idList.add(String.valueOf(subjectcreditrulesPagination.getProjectName()));
}
}
subjectcreditrulesQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(SubjectcreditrulesEntity::getProjectName, tt).or();
});
});
}
}
if(subjectcreditrulesscoreNum>0){
List<String> subjectcreditrulesscoreIdList = subjectcreditrulesscoreService.list(subjectcreditrulesscoreQueryWrapper).stream().filter(t->StringUtil.isNotEmpty(t.getSubjectCreditRulesId())).map(t->t.getSubjectCreditRulesId()).collect(Collectors.toList());
long count = subjectcreditrulesscoreService.count();
if (count>0){
intersectionList.add(subjectcreditrulesscoreIdList);
}
AllIdList.addAll(subjectcreditrulesscoreIdList);
}
total+=subjectcreditrulesscoreNum;
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
subjectcreditrulesQueryWrapper.lambda().in(SubjectcreditrulesEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
subjectcreditrulesQueryWrapper.lambda().and(t->t.in(SubjectcreditrulesEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
subjectcreditrulesQueryWrapper.lambda().and(t->t.in(SubjectcreditrulesEntity::getId, finalAllRuleIDlist));
}
//假删除标志
subjectcreditrulesQueryWrapper.lambda().isNull(SubjectcreditrulesEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(subjectcreditrulesPagination.getSidx())){
subjectcreditrulesQueryWrapper.lambda().orderByDesc(SubjectcreditrulesEntity::getId);
}else{
try {
String sidx = subjectcreditrulesPagination.getSidx();
String[] strs= sidx.split("_name");
SubjectcreditrulesEntity subjectcreditrulesEntity = new SubjectcreditrulesEntity();
Field declaredField = subjectcreditrulesEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
subjectcreditrulesQueryWrapper="asc".equals(subjectcreditrulesPagination.getSort().toLowerCase())?subjectcreditrulesQueryWrapper.orderByAsc(value):subjectcreditrulesQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<SubjectcreditrulesEntity> page=new Page<>(subjectcreditrulesPagination.getCurrentPage(), subjectcreditrulesPagination.getPageSize());
IPage<SubjectcreditrulesEntity> userIPage=this.page(page, subjectcreditrulesQueryWrapper);
return subjectcreditrulesPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<SubjectcreditrulesEntity> list = new ArrayList();
return subjectcreditrulesPagination.setData(list, list.size());
}
}else{
return this.list(subjectcreditrulesQueryWrapper);
}
}
@Override
public SubjectcreditrulesEntity getInfo(String id){
QueryWrapper<SubjectcreditrulesEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(SubjectcreditrulesEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(SubjectcreditrulesEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, SubjectcreditrulesEntity entity){
return this.updateById(entity);
}
@Override
public void delete(SubjectcreditrulesEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** Subjectcreditrulesscore子表方法 */
@Override
public List<SubjectcreditrulesscoreEntity> getSubjectcreditrulesscoreList(String id,SubjectcreditrulesPagination subjectcreditrulesPagination){
Map<String, Object> newtabMap=SubjectcreditrulesConstant.TABLEFIELDKEY.entrySet()
.stream().collect( Collectors.toMap(e->e.getValue(),e->e.getKey()));
String tableName="subjectcreditrulesscore";
tableName=newtabMap.get(tableName)==null?tableName:newtabMap.get(tableName).toString();
QueryWrapper<SubjectcreditrulesscoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = subjectcreditrulesscoreService.getChild(subjectcreditrulesPagination,queryWrapper);
queryWrapper.lambda().eq(SubjectcreditrulesscoreEntity::getSubjectCreditRulesId, id);
generaterSwapUtil.wrapperHandle(SubjectcreditrulesConstant.getColumnData(), SubjectcreditrulesConstant.getAppColumnData(), queryWrapper,SubjectcreditrulesscoreEntity.class,"sub",tableName);
return subjectcreditrulesscoreService.list(queryWrapper);
}
/** Subjectcreditrulesscore子表方法 */
@Override
public List<SubjectcreditrulesscoreEntity> getSubjectcreditrulesscoreList(String id){
QueryWrapper<SubjectcreditrulesscoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SubjectcreditrulesscoreEntity::getSubjectCreditRulesId, id);
return subjectcreditrulesscoreService.list(queryWrapper);
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(SubjectcreditrulesForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
//子表字段验证
if (form.getSubjectcreditrulesscoreList()!=null){
for(SubjectcreditrulesscoreModel t : form.getSubjectcreditrulesscoreList()){
if(StringUtil.isNotEmpty(t.getScoreDown())){
t.setScoreDown(t.getScoreDown().trim());
}
if(StringUtil.isNotEmpty(t.getScoreDown())){
if(!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(t.getScoreDown())).matches()){
return "请输入正确的金额";
}
}
}
for(SubjectcreditrulesscoreModel t : form.getSubjectcreditrulesscoreList()){
if(StringUtil.isNotEmpty(t.getScoreUpper())){
t.setScoreUpper(t.getScoreUpper().trim());
}
if(StringUtil.isNotEmpty(t.getScoreUpper())){
if(!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(t.getScoreUpper())).matches()){
return "请输入正确的金额";
}
}
}
for(SubjectcreditrulesscoreModel t : form.getSubjectcreditrulesscoreList()){
if(StringUtil.isNotEmpty(t.getScore())){
t.setScore(t.getScore().trim());
}
if(StringUtil.isNotEmpty(t.getScore())){
if(!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(t.getScore())).matches()){
return "请输入正确的金额";
}
}
}
}
return countRecover;
}
/**
* ()
* @param id
* @param subjectcreditrulesForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(SubjectcreditrulesForm subjectcreditrulesForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
subjectcreditrulesForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(SubjectcreditrulesConstant.getFormData(),subjectcreditrulesForm),SubjectcreditrulesForm.class);
SubjectcreditrulesEntity entity = JsonUtil.getJsonToBean(subjectcreditrulesForm, SubjectcreditrulesEntity.class);
if(isSave){
String mainId = id ;
entity.setBusinessNo(generaterSwapUtil.getBillNumber("xygz", false));
entity.setId(mainId);
entity.setFlowId(subjectcreditrulesForm.getFlowId());
entity.setVersion(0);
}else{
entity.setBusinessNo(generaterSwapUtil.getBillNumber("xygz", false));
entity.setFlowId(subjectcreditrulesForm.getFlowId());
}
this.saveOrUpdate(entity);
//Subjectcreditrulesscore子表数据新增修改
if(!isSave){
QueryWrapper<SubjectcreditrulesscoreEntity> SubjectcreditrulesscorequeryWrapper = new QueryWrapper<>();
SubjectcreditrulesscorequeryWrapper.lambda().eq(SubjectcreditrulesscoreEntity::getSubjectCreditRulesId, entity.getId());
subjectcreditrulesscoreService.remove(SubjectcreditrulesscorequeryWrapper);
}
if (subjectcreditrulesForm.getSubjectcreditrulesscoreList()!=null){
List<SubjectcreditrulesscoreEntity> tableField107 = JsonUtil.getJsonToList(subjectcreditrulesForm.getSubjectcreditrulesscoreList(),SubjectcreditrulesscoreEntity.class);
for(SubjectcreditrulesscoreEntity entitys : tableField107){
entitys.setId(RandomUtil.uuId());
entitys.setSubjectCreditRulesId(entity.getId());
if(isSave){
}else{
}
subjectcreditrulesscoreService.saveOrUpdate(entitys);
}
}
}
}

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

@ -0,0 +1,425 @@
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.subjectcreditratingno.*;
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;
/**
* Subjectcreditratingno
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-01
*/
@Slf4j
@RestController
@Tag(name = "Subjectcreditratingno" , description = "scm")
@RequestMapping("/api/scm/Subjectcreditratingno")
public class SubjectcreditratingnoController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private SubjectcreditratingnoService subjectcreditratingnoService;
@Autowired
private SubjectcreditratingService subjectcreditratingService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param subjectcreditratingnoPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody SubjectcreditratingnoPagination subjectcreditratingnoPagination)throws IOException{
List<SubjectcreditratingnoEntity> list= subjectcreditratingnoService.getList(subjectcreditratingnoPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (SubjectcreditratingnoEntity entity : list) {
Map<String, Object> subjectcreditratingnoMap=JsonUtil.entityToMap(entity);
subjectcreditratingnoMap.put("id", subjectcreditratingnoMap.get("id"));
//副表数据
//子表数据
List<SubjectcreditratingEntity> subjectcreditratingList = subjectcreditratingnoService.getSubjectcreditratingList(entity.getId(),subjectcreditratingnoPagination);
subjectcreditratingnoMap.put("tableField102",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(subjectcreditratingList)));
realList.add(subjectcreditratingnoMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, SubjectcreditratingnoConstant.getFormData(), SubjectcreditratingnoConstant.getColumnData(), subjectcreditratingnoPagination.getModuleId(),false);
//流程状态添加
for(Map<String, Object> vo:realList){
FlowTaskEntity flowTaskEntity = generaterSwapUtil.getInfoSubmit(String.valueOf(vo.get("id")), FlowTaskEntity::getStatus);
if (flowTaskEntity!=null){
vo.put("flowState",flowTaskEntity.getStatus());
}else{
vo.put("flowState",null);
}
//添加流程id
String flowId="";
if(vo.get("flowid")!=null){
flowId = String.valueOf(vo.get("flowid"));
}
if(vo.get("flowid".toUpperCase())!=null){
flowId = String.valueOf(vo.get("flowid".toUpperCase()));
}
if(StringUtil.isNotEmpty(flowId)){
vo.put("flowId" ,flowId);
}
}
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(subjectcreditratingnoPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param subjectcreditratingnoForm
* @return
*/
@PostMapping("/{id}")
@Operation(summary = "创建")
public ActionResult create(@PathVariable("id") String id, @RequestBody @Valid SubjectcreditratingnoForm subjectcreditratingnoForm) {
String b = subjectcreditratingnoService.checkForm(subjectcreditratingnoForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
subjectcreditratingnoService.saveOrUpdate(subjectcreditratingnoForm, id ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody SubjectcreditratingnoPagination subjectcreditratingnoPagination) throws IOException {
if (StringUtil.isEmpty(subjectcreditratingnoPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<SubjectcreditratingnoEntity> list= subjectcreditratingnoService.getList(subjectcreditratingnoPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (SubjectcreditratingnoEntity entity : list) {
Map<String, Object> subjectcreditratingnoMap=JsonUtil.entityToMap(entity);
subjectcreditratingnoMap.put("id", subjectcreditratingnoMap.get("id"));
//副表数据
//子表数据
List<SubjectcreditratingEntity> subjectcreditratingList = subjectcreditratingnoService.getSubjectcreditratingList(entity.getId(),subjectcreditratingnoPagination);
subjectcreditratingnoMap.put("tableField102",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(subjectcreditratingList)));
realList.add(subjectcreditratingnoMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, SubjectcreditratingnoConstant.getFormData(), SubjectcreditratingnoConstant.getColumnData(), subjectcreditratingnoPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(subjectcreditratingnoPagination.getSelectKey())?subjectcreditratingnoPagination.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){
ExcelExportEntity tableField102ExcelEntity = new ExcelExportEntity("设计子表","tableField102");
List<ExcelExportEntity> tableField102List = new ArrayList<>();
for(String key:keys){
switch(key){
case "businessNo" :
entitys.add(new ExcelExportEntity("单据号" ,"businessNo"));
break;
case "businessType" :
entitys.add(new ExcelExportEntity("业务类型" ,"businessType"));
break;
case "tableField102-creditRating":
tableField102List.add(new ExcelExportEntity("信用级别" ,"creditRating"));
break;
case "tableField102-scoreDown":
tableField102List.add(new ExcelExportEntity("评定分数最低" ,"scoreDown"));
break;
case "tableField102-scoreUpper":
tableField102List.add(new ExcelExportEntity("评定分数最高" ,"scoreUpper"));
break;
case "tableField102-startTime":
tableField102List.add(new ExcelExportEntity("开始时间" ,"startTime"));
break;
case "tableField102-endTime":
tableField102List.add(new ExcelExportEntity("结束时间" ,"endTime"));
break;
case "tableField102-levelDescription":
tableField102List.add(new ExcelExportEntity("级别说明" ,"levelDescription"));
break;
case "tableField102-annex":
tableField102List.add(new ExcelExportEntity("附件" ,"annex"));
break;
default:
break;
}
}
if(tableField102List.size() > 0){
tableField102ExcelEntity.setList(tableField102List);
entitys.add(tableField102ExcelEntity);
}
}
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(SubjectcreditratingnoConstant.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);
List<String> columnIdList = new ArrayList<>(20);
int i =0;
String errInfo = "";
for (String allId : idList){
FlowTaskEntity taskEntity = generaterSwapUtil.getInfoSubmit(allId, FlowTaskEntity::getId, FlowTaskEntity::getStatus);
if (taskEntity==null){
columnIdList.add(allId);
this.delete(allId);
}else if (taskEntity.getStatus().equals(0) || taskEntity.getStatus().equals(4)){
try {
generaterSwapUtil.deleteFlowTask(taskEntity);
columnIdList.add(allId);
this.delete(allId);
i++;
} catch (WorkFlowException e) {
errInfo = e.getMessage();
e.printStackTrace();
}
}
}
if (i == 0 && columnIdList.size()==0){
return ActionResult.fail("流程已发起,无法删除");
}
if (StringUtil.isNotEmpty(errInfo)){
return ActionResult.fail(errInfo);
}
return ActionResult.success("删除成功");
}
/**
*
* @param id
* @param subjectcreditratingnoForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid SubjectcreditratingnoForm subjectcreditratingnoForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
subjectcreditratingnoForm.setId(id);
if (!isImport) {
String b = subjectcreditratingnoService.checkForm(subjectcreditratingnoForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
SubjectcreditratingnoEntity entity= subjectcreditratingnoService.getInfo(id);
if(entity!=null){
try{
subjectcreditratingnoService.saveOrUpdate(subjectcreditratingnoForm,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){
SubjectcreditratingnoEntity entity= subjectcreditratingnoService.getInfo(id);
if(entity!=null){
FlowTaskEntity taskEntity = generaterSwapUtil.getInfoSubmit(id, FlowTaskEntity::getId, FlowTaskEntity::getStatus);
if (taskEntity != null) {
try {
generaterSwapUtil.deleteFlowTask(taskEntity);
} catch (WorkFlowException e) {
e.printStackTrace();
}
}
//假删除
entity.setDeleteMark(1);
subjectcreditratingnoService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
SubjectcreditratingnoEntity entity= subjectcreditratingnoService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> subjectcreditratingnoMap=JsonUtil.entityToMap(entity);
subjectcreditratingnoMap.put("id", subjectcreditratingnoMap.get("id"));
//副表数据
//子表数据
List<SubjectcreditratingEntity> subjectcreditratingList = subjectcreditratingnoService.getSubjectcreditratingList(entity.getId());
subjectcreditratingnoMap.put("tableField102",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(subjectcreditratingList)));
subjectcreditratingnoMap = generaterSwapUtil.swapDataDetail(subjectcreditratingnoMap,SubjectcreditratingnoConstant.getFormData(),"522005775749488005",false);
return ActionResult.success(subjectcreditratingnoMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
SubjectcreditratingnoEntity entity= subjectcreditratingnoService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> subjectcreditratingnoMap=JsonUtil.entityToMap(entity);
subjectcreditratingnoMap.put("id", subjectcreditratingnoMap.get("id"));
//副表数据
//子表数据
List<SubjectcreditratingEntity> subjectcreditratingList = subjectcreditratingnoService.getSubjectcreditratingList(entity.getId());
subjectcreditratingnoMap.put("subjectcreditratingList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(subjectcreditratingList)));
subjectcreditratingnoMap = generaterSwapUtil.swapDataForm(subjectcreditratingnoMap,SubjectcreditratingnoConstant.getFormData(),SubjectcreditratingnoConstant.TABLEFIELDKEY,SubjectcreditratingnoConstant.TABLERENAMES);
return ActionResult.success(subjectcreditratingnoMap);
}
}

@ -11,7 +11,7 @@ import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.subjectcreditrating.*;
import jnpf.model.subjectcreditrules.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -50,17 +50,17 @@ import jnpf.base.util.VisualUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* SubjectCreditRating
* Subjectcreditrules
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-30
* @ 2024-02-01
*/
@Slf4j
@RestController
@Tag(name = "SubjectCreditRating" , description = "scm")
@RequestMapping("/api/scm/SubjectCreditRating")
public class SubjectCreditRatingController {
@Tag(name = "Subjectcreditrules" , description = "scm")
@RequestMapping("/api/scm/Subjectcreditrules")
public class SubjectcreditrulesController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@ -69,8 +69,10 @@ public class SubjectCreditRatingController {
private UserProvider userProvider;
@Autowired
private SubjectCreditRatingService subjectCreditRatingService;
private SubjectcreditrulesService subjectcreditrulesService;
@Autowired
private SubjectcreditrulesscoreService subjectcreditrulesscoreService;
@Autowired
@ -79,46 +81,68 @@ public class SubjectCreditRatingController {
/**
*
*
* @param subjectCreditRatingPagination
* @param subjectcreditrulesPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody SubjectCreditRatingPagination subjectCreditRatingPagination)throws IOException{
List<SubjectCreditRatingEntity> list= subjectCreditRatingService.getList(subjectCreditRatingPagination);
public ActionResult list(@RequestBody SubjectcreditrulesPagination subjectcreditrulesPagination)throws IOException{
List<SubjectcreditrulesEntity> list= subjectcreditrulesService.getList(subjectcreditrulesPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (SubjectCreditRatingEntity entity : list) {
Map<String, Object> subjectCreditRatingMap=JsonUtil.entityToMap(entity);
subjectCreditRatingMap.put("id", subjectCreditRatingMap.get("id"));
for (SubjectcreditrulesEntity entity : list) {
Map<String, Object> subjectcreditrulesMap=JsonUtil.entityToMap(entity);
subjectcreditrulesMap.put("id", subjectcreditrulesMap.get("id"));
//副表数据
//子表数据
realList.add(subjectCreditRatingMap);
List<SubjectcreditrulesscoreEntity> subjectcreditrulesscoreList = subjectcreditrulesService.getSubjectcreditrulesscoreList(entity.getId(),subjectcreditrulesPagination);
subjectcreditrulesMap.put("tableField107",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(subjectcreditrulesscoreList)));
realList.add(subjectcreditrulesMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, SubjectCreditRatingConstant.getFormData(), SubjectCreditRatingConstant.getColumnData(), subjectCreditRatingPagination.getModuleId(),false);
realList = generaterSwapUtil.swapDataList(realList, SubjectcreditrulesConstant.getFormData(), SubjectcreditrulesConstant.getColumnData(), subjectcreditrulesPagination.getModuleId(),false);
//流程状态添加
for(Map<String, Object> vo:realList){
FlowTaskEntity flowTaskEntity = generaterSwapUtil.getInfoSubmit(String.valueOf(vo.get("id")), FlowTaskEntity::getStatus);
if (flowTaskEntity!=null){
vo.put("flowState",flowTaskEntity.getStatus());
}else{
vo.put("flowState",null);
}
//添加流程id
String flowId="";
if(vo.get("flowid")!=null){
flowId = String.valueOf(vo.get("flowid"));
}
if(vo.get("flowid".toUpperCase())!=null){
flowId = String.valueOf(vo.get("flowid".toUpperCase()));
}
if(StringUtil.isNotEmpty(flowId)){
vo.put("flowId" ,flowId);
}
}
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(subjectCreditRatingPagination, PaginationVO.class);
PaginationVO page = JsonUtil.getJsonToBean(subjectcreditrulesPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param subjectCreditRatingForm
* @param subjectcreditrulesForm
* @return
*/
@PostMapping()
@PostMapping("/{id}")
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid SubjectCreditRatingForm subjectCreditRatingForm) {
String b = subjectCreditRatingService.checkForm(subjectCreditRatingForm,0);
public ActionResult create(@PathVariable("id") String id, @RequestBody @Valid SubjectcreditrulesForm subjectcreditrulesForm) {
String b = subjectcreditrulesService.checkForm(subjectcreditrulesForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
subjectCreditRatingService.saveOrUpdate(subjectCreditRatingForm, null ,true);
subjectcreditrulesService.saveOrUpdate(subjectcreditrulesForm, id ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
@ -131,22 +155,24 @@ public class SubjectCreditRatingController {
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody SubjectCreditRatingPagination subjectCreditRatingPagination) throws IOException {
if (StringUtil.isEmpty(subjectCreditRatingPagination.getSelectKey())){
public ActionResult Export(@RequestBody SubjectcreditrulesPagination subjectcreditrulesPagination) throws IOException {
if (StringUtil.isEmpty(subjectcreditrulesPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<SubjectCreditRatingEntity> list= subjectCreditRatingService.getList(subjectCreditRatingPagination);
List<SubjectcreditrulesEntity> list= subjectcreditrulesService.getList(subjectcreditrulesPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (SubjectCreditRatingEntity entity : list) {
Map<String, Object> subjectCreditRatingMap=JsonUtil.entityToMap(entity);
subjectCreditRatingMap.put("id", subjectCreditRatingMap.get("id"));
for (SubjectcreditrulesEntity entity : list) {
Map<String, Object> subjectcreditrulesMap=JsonUtil.entityToMap(entity);
subjectcreditrulesMap.put("id", subjectcreditrulesMap.get("id"));
//副表数据
//子表数据
realList.add(subjectCreditRatingMap);
List<SubjectcreditrulesscoreEntity> subjectcreditrulesscoreList = subjectcreditrulesService.getSubjectcreditrulesscoreList(entity.getId(),subjectcreditrulesPagination);
subjectcreditrulesMap.put("tableField107",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(subjectcreditrulesscoreList)));
realList.add(subjectcreditrulesMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, SubjectCreditRatingConstant.getFormData(), SubjectCreditRatingConstant.getColumnData(), subjectCreditRatingPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(subjectCreditRatingPagination.getSelectKey())?subjectCreditRatingPagination.getSelectKey():new String[0];
realList = generaterSwapUtil.swapDataList(realList, SubjectcreditrulesConstant.getFormData(), SubjectcreditrulesConstant.getColumnData(), subjectcreditrulesPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(subjectcreditrulesPagination.getSelectKey())?subjectcreditrulesPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
return ActionResult.success(vo);
@ -159,21 +185,45 @@ public class SubjectCreditRatingController {
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
ExcelExportEntity tableField107ExcelEntity = new ExcelExportEntity("计分明细","tableField107");
List<ExcelExportEntity> tableField107List = new ArrayList<>();
for(String key:keys){
switch(key){
case "creditRating" :
entitys.add(new ExcelExportEntity("信用级别" ,"creditRating"));
case "businessNo" :
entitys.add(new ExcelExportEntity("单据号" ,"businessNo"));
break;
case "businessType" :
entitys.add(new ExcelExportEntity("业务类型" ,"businessType"));
break;
case "categoryName" :
entitys.add(new ExcelExportEntity("类目" ,"categoryName"));
break;
case "projectName" :
entitys.add(new ExcelExportEntity("项目" ,"projectName"));
break;
case "ruleDescription" :
entitys.add(new ExcelExportEntity("规则说明" ,"ruleDescription"));
break;
case "annex" :
entitys.add(new ExcelExportEntity("附件" ,"annex"));
break;
case "scoreDown" :
entitys.add(new ExcelExportEntity("评定分数最低" ,"scoreDown"));
case "tableField107-scoreDown":
tableField107List.add(new ExcelExportEntity("范围最低" ,"scoreDown"));
break;
case "scoreUpper" :
entitys.add(new ExcelExportEntity("评定分数最高" ,"scoreUpper"));
case "tableField107-scoreUpper":
tableField107List.add(new ExcelExportEntity("范围最高" ,"scoreUpper"));
break;
case "tableField107-score":
tableField107List.add(new ExcelExportEntity("分数" ,"score"));
break;
default:
break;
}
}
if(tableField107List.size() > 0){
tableField107ExcelEntity.setList(tableField107List);
entitys.add(tableField107ExcelEntity);
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
@ -214,7 +264,7 @@ public class SubjectCreditRatingController {
}
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(SubjectCreditRatingConstant.getColumnData(), ColumnDataModel.class);
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(SubjectcreditrulesConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
@ -244,38 +294,56 @@ public class SubjectCreditRatingController {
@Transactional
@Operation(summary = "批量删除")
public ActionResult batchRemove(@RequestBody String ids){
List<String> idList = JsonUtil.getJsonToList(ids, String.class);
int i =0;
for (String allId : idList){
List<String> idList = JsonUtil.getJsonToList(ids, String.class);
List<String> columnIdList = new ArrayList<>(20);
int i =0;
String errInfo = "";
for (String allId : idList){
FlowTaskEntity taskEntity = generaterSwapUtil.getInfoSubmit(allId, FlowTaskEntity::getId, FlowTaskEntity::getStatus);
if (taskEntity==null){
columnIdList.add(allId);
this.delete(allId);
i++;
}
if (i == 0 ){
return ActionResult.fail("删除失败");
}else if (taskEntity.getStatus().equals(0) || taskEntity.getStatus().equals(4)){
try {
generaterSwapUtil.deleteFlowTask(taskEntity);
columnIdList.add(allId);
this.delete(allId);
i++;
} catch (WorkFlowException e) {
errInfo = e.getMessage();
e.printStackTrace();
}
}
return ActionResult.success("删除成功");
}
if (i == 0 && columnIdList.size()==0){
return ActionResult.fail("流程已发起,无法删除");
}
if (StringUtil.isNotEmpty(errInfo)){
return ActionResult.fail(errInfo);
}
return ActionResult.success("删除成功");
}
/**
*
* @param id
* @param subjectCreditRatingForm
* @param subjectcreditrulesForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid SubjectCreditRatingForm subjectCreditRatingForm,
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid SubjectcreditrulesForm subjectcreditrulesForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
subjectCreditRatingForm.setId(id);
subjectcreditrulesForm.setId(id);
if (!isImport) {
String b = subjectCreditRatingService.checkForm(subjectCreditRatingForm,1);
String b = subjectcreditrulesService.checkForm(subjectcreditrulesForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
SubjectCreditRatingEntity entity= subjectCreditRatingService.getInfo(id);
SubjectcreditrulesEntity entity= subjectcreditrulesService.getInfo(id);
if(entity!=null){
try{
subjectCreditRatingService.saveOrUpdate(subjectCreditRatingForm,id,false);
subjectcreditrulesService.saveOrUpdate(subjectcreditrulesForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
@ -293,11 +361,19 @@ public class SubjectCreditRatingController {
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
SubjectCreditRatingEntity entity= subjectCreditRatingService.getInfo(id);
SubjectcreditrulesEntity entity= subjectcreditrulesService.getInfo(id);
if(entity!=null){
FlowTaskEntity taskEntity = generaterSwapUtil.getInfoSubmit(id, FlowTaskEntity::getId, FlowTaskEntity::getStatus);
if (taskEntity != null) {
try {
generaterSwapUtil.deleteFlowTask(taskEntity);
} catch (WorkFlowException e) {
e.printStackTrace();
}
}
//假删除
entity.setDeleteMark(1);
subjectCreditRatingService.update(id,entity);
subjectcreditrulesService.update(id,entity);
}
return ActionResult.success("删除成功");
}
@ -310,16 +386,18 @@ public class SubjectCreditRatingController {
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
SubjectCreditRatingEntity entity= subjectCreditRatingService.getInfo(id);
SubjectcreditrulesEntity entity= subjectcreditrulesService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> subjectCreditRatingMap=JsonUtil.entityToMap(entity);
subjectCreditRatingMap.put("id", subjectCreditRatingMap.get("id"));
Map<String, Object> subjectcreditrulesMap=JsonUtil.entityToMap(entity);
subjectcreditrulesMap.put("id", subjectcreditrulesMap.get("id"));
//副表数据
//子表数据
subjectCreditRatingMap = generaterSwapUtil.swapDataDetail(subjectCreditRatingMap,SubjectCreditRatingConstant.getFormData(),"522005775749488005",false);
return ActionResult.success(subjectCreditRatingMap);
List<SubjectcreditrulesscoreEntity> subjectcreditrulesscoreList = subjectcreditrulesService.getSubjectcreditrulesscoreList(entity.getId());
subjectcreditrulesMap.put("tableField107",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(subjectcreditrulesscoreList)));
subjectcreditrulesMap = generaterSwapUtil.swapDataDetail(subjectcreditrulesMap,SubjectcreditrulesConstant.getFormData(),"522736258103914309",false);
return ActionResult.success(subjectcreditrulesMap);
}
/**
* ()
@ -330,16 +408,18 @@ public class SubjectCreditRatingController {
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
SubjectCreditRatingEntity entity= subjectCreditRatingService.getInfo(id);
SubjectcreditrulesEntity entity= subjectcreditrulesService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> subjectCreditRatingMap=JsonUtil.entityToMap(entity);
subjectCreditRatingMap.put("id", subjectCreditRatingMap.get("id"));
Map<String, Object> subjectcreditrulesMap=JsonUtil.entityToMap(entity);
subjectcreditrulesMap.put("id", subjectcreditrulesMap.get("id"));
//副表数据
//子表数据
subjectCreditRatingMap = generaterSwapUtil.swapDataForm(subjectCreditRatingMap,SubjectCreditRatingConstant.getFormData(),SubjectCreditRatingConstant.TABLEFIELDKEY,SubjectCreditRatingConstant.TABLERENAMES);
return ActionResult.success(subjectCreditRatingMap);
List<SubjectcreditrulesscoreEntity> subjectcreditrulesscoreList = subjectcreditrulesService.getSubjectcreditrulesscoreList(entity.getId());
subjectcreditrulesMap.put("subjectcreditrulesscoreList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(subjectcreditrulesscoreList)));
subjectcreditrulesMap = generaterSwapUtil.swapDataForm(subjectcreditrulesMap,SubjectcreditrulesConstant.getFormData(),SubjectcreditrulesConstant.TABLEFIELDKEY,SubjectcreditrulesConstant.TABLERENAMES);
return ActionResult.success(subjectcreditrulesMap);
}
}

@ -9,30 +9,30 @@ import java.util.Date;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-30
* @ 2024-02-01
*/
@Data
@TableName("jg_subject_credit_rating")
public class SubjectCreditRatingEntity {
public class SubjectcreditratingEntity {
@TableId(value ="ID" )
private String id;
@TableField("SUBJECT_BASIC_TYPE")
private String subjectBasicType;
@TableField("NO_ID")
private String noId;
@TableField(value = "CREDIT_RATING" , updateStrategy = FieldStrategy.IGNORED)
private String creditRating;
@TableField(value = "SCORE_DOWN" , updateStrategy = FieldStrategy.IGNORED)
private String scoreDown;
@TableField(value = "SCORE_UPPER" , updateStrategy = FieldStrategy.IGNORED)
private String scoreUpper;
@TableField("LEVEL_DESCRIPTION")
@TableField(value = "LEVEL_DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String levelDescription;
@TableField("START_TIME")
@TableField(value = "START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date startTime;
@TableField("END_TIME")
@TableField(value = "END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date endTime;
@TableField("REMARK")
private String remark;
@TableField("ANNEX")
@TableField(value = "ANNEX" , updateStrategy = FieldStrategy.IGNORED)
private String annex;
@TableField(value = "f_creator_time" , fill = FieldFill.INSERT)
private Date creatorTime;
@ -50,13 +50,8 @@ public class SubjectCreditRatingEntity {
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("F_FLOW_ID")
private String flowId;
@TableField(value = "company_id" , fill = FieldFill.INSERT)
@TableField(value = "COMPANY_ID" , fill = FieldFill.INSERT)
private String companyId;
@TableField(value = "department_id" , fill = FieldFill.INSERT)
@TableField(value = "DEPARTMENT_ID" , fill = FieldFill.INSERT)
private String departmentId;
}

@ -0,0 +1,49 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-01
*/
@Data
@TableName("jg_subject_credit_rating_no")
public class SubjectcreditratingnoEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "BUSINESS_NO" , updateStrategy = FieldStrategy.IGNORED)
private String businessNo;
@TableField(value = "BUSINESS_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String businessType;
@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_FLOW_ID")
private String flowId;
@TableField(value = "COMPANY_ID" , fill = FieldFill.INSERT)
private String companyId;
@TableField(value = "DEPARTMENT_ID" , fill = FieldFill.INSERT)
private String departmentId;
@TableField("F_FLOW_TASK_ID")
private String flowTaskId;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,57 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-01
*/
@Data
@TableName("jg_subject_credit_rules")
public class SubjectcreditrulesEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "BUSINESS_NO" , updateStrategy = FieldStrategy.IGNORED)
private String businessNo;
@TableField(value = "BUSINESS_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String businessType;
@TableField(value = "CATEGORY_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String categoryName;
@TableField(value = "PROJECT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String projectName;
@TableField(value = "RULE_DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String ruleDescription;
@TableField(value = "ANNEX" , updateStrategy = FieldStrategy.IGNORED)
private String annex;
@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(value = "COMPANY_ID" , fill = FieldFill.INSERT)
private String companyId;
@TableField(value = "DEPARTMENT_ID" , fill = FieldFill.INSERT)
private String departmentId;
@TableField("F_FLOW_TASK_ID")
private String flowTaskId;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,47 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-01
*/
@Data
@TableName("jg_subject_credit_rules_score")
public class SubjectcreditrulesscoreEntity {
@TableId(value ="ID" )
private String id;
@TableField("SUBJECT_CREDIT_RULES_ID")
private String subjectCreditRulesId;
@TableField(value = "SCORE_DOWN" , updateStrategy = FieldStrategy.IGNORED)
private String scoreDown;
@TableField(value = "SCORE_UPPER" , updateStrategy = FieldStrategy.IGNORED)
private String scoreUpper;
@TableField(value = "SCORE" , updateStrategy = FieldStrategy.IGNORED)
private String score;
@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(value = "COMPANY_ID" , fill = FieldFill.INSERT)
private String companyId;
@TableField(value = "DEPARTMENT_ID" , fill = FieldFill.INSERT)
private String departmentId;
}

@ -1,29 +0,0 @@
package jnpf.model.subjectcreditrating;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* SubjectCreditRating
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-30
*/
@Data
public class SubjectCreditRatingForm {
/** 主键 */
private String id;
/** 信用级别 **/
@JsonProperty("creditRating")
private Object creditRating;
/** 评定分数最低 **/
@JsonProperty("scoreDown")
private String scoreDown;
/** 评定分数最高 **/
@JsonProperty("scoreUpper")
private String scoreUpper;
}

@ -0,0 +1,46 @@
package jnpf.model.subjectcreditratingno;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* Subjectcreditratingno
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-02-01
*/
@Data
public class SubjectcreditratingModel {
/** 信用级别 **/
@JSONField(name = "creditRating")
private Object creditRating;
/** 评定分数最低 **/
@JSONField(name = "scoreDown")
private String scoreDown;
/** 评定分数最高 **/
@JSONField(name = "scoreUpper")
private String scoreUpper;
/** 开始时间 **/
@JSONField(name = "startTime")
private Long startTime;
/** 结束时间 **/
@JSONField(name = "endTime")
private Long endTime;
/** 级别说明 **/
@JSONField(name = "levelDescription")
private String levelDescription;
/** 附件 **/
@JSONField(name = "annex")
private Object annex;
}

@ -0,0 +1,35 @@
package jnpf.model.subjectcreditratingno;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Subjectcreditratingno
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-01
*/
@Data
public class SubjectcreditratingnoForm {
/** 主键 */
private String id;
/** 子表数据 **/
@JsonProperty("subjectcreditratingList")
private List<SubjectcreditratingModel> subjectcreditratingList;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 流程id **/
@JsonProperty("flowId")
private String flowId;
/** 单据号 **/
@JsonProperty("businessNo")
private String businessNo;
/** 业务类型 **/
@JsonProperty("businessType")
private String businessType;
}

@ -1,4 +1,4 @@
package jnpf.model.subjectcreditrating;
package jnpf.model.subjectcreditratingno;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@ -7,14 +7,14 @@ import java.util.List;
/**
*
* SubjectCreditRating
* Subjectcreditratingno
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-30
* @ 2024-02-01
*/
@Data
public class SubjectCreditRatingPagination extends Pagination {
public class SubjectcreditratingnoPagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
@ -27,13 +27,10 @@ public class SubjectCreditRatingPagination extends Pagination {
private String moduleId;
/** 菜单id */
private String menuId;
/** 信用级别 */
@JsonProperty("creditRating")
private Object creditRating;
/** 评定分数最低 */
@JsonProperty("scoreDown")
private Object scoreDown;
/** 评定分数最高 */
@JsonProperty("scoreUpper")
private Object scoreUpper;
/** 单据号 */
@JsonProperty("businessNo")
private Object businessNo;
/** 业务类型 */
@JsonProperty("businessType")
private Object businessType;
}

@ -0,0 +1,47 @@
package jnpf.model.subjectcreditrules;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Subjectcreditrules
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-01
*/
@Data
public class SubjectcreditrulesForm {
/** 主键 */
private String id;
/** 子表数据 **/
@JsonProperty("subjectcreditrulesscoreList")
private List<SubjectcreditrulesscoreModel> subjectcreditrulesscoreList;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 流程id **/
@JsonProperty("flowId")
private String flowId;
/** 单据号 **/
@JsonProperty("businessNo")
private String businessNo;
/** 业务类型 **/
@JsonProperty("businessType")
private String businessType;
/** 类目 **/
@JsonProperty("categoryName")
private Object categoryName;
/** 项目 **/
@JsonProperty("projectName")
private Object projectName;
/** 规则说明 **/
@JsonProperty("ruleDescription")
private String ruleDescription;
/** 附件 **/
@JsonProperty("annex")
private Object annex;
}

@ -0,0 +1,42 @@
package jnpf.model.subjectcreditrules;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* Subjectcreditrules
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-01
*/
@Data
public class SubjectcreditrulesPagination 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("businessType")
private Object businessType;
/** 单据号 */
@JsonProperty("businessNo")
private Object businessNo;
/** 类目 */
@JsonProperty("categoryName")
private Object categoryName;
/** 项目 */
@JsonProperty("projectName")
private Object projectName;
}

@ -0,0 +1,30 @@
package jnpf.model.subjectcreditrules;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* Subjectcreditrules
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-02-01
*/
@Data
public class SubjectcreditrulesscoreModel {
/** 范围最低 **/
@JSONField(name = "scoreDown")
private String scoreDown;
/** 范围最高 **/
@JSONField(name = "scoreUpper")
private String scoreUpper;
/** 分数 **/
@JSONField(name = "score")
private String score;
}

@ -0,0 +1,2 @@
const columnList = [{"jnpfKey":"billRule","fullName":"单据号","label":"单据号","sortable":false,"align":"left","__config__":{"formId":101,"visibility":["pc","app"],"jnpfKey":"billRule","defaultValue":null,"noShow":false,"tipLabel":"","dragDisabled":false,"rule":"xinyongdengji","className":[],"label":"单据号","trigger":"change","showLabel":true,"required":false,"tableName":"jg_subject_credit_rating_no","renderKey":1706762675582,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-documents","ruleName":"信用规则配置-信用等级","tag":"JnpfInput","span":24},"readonly":true,"prop":"businessNo","width":0,"__vModel__":"businessNo","fixed":"none","style":{"width":"100%"},"id":"businessNo","placeholder":"系统自动生成"}]
export default columnList

@ -0,0 +1,564 @@
<template>
<div :style="{margin: '0 auto',width:'100%'}">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right"
:disabled="setting.readonly">
<template v-if="!loading && formOperates">
<!-- 具体表单 -->
<el-col :span="24" v-if="judgeShow('businessNo')">
<jnpf-form-tip-item label="单据号" v-if="judgeShow('businessNo')" prop="businessNo">
<JnpfInput v-model="dataForm.businessNo" @change="changeData('businessNo',-1)" placeholder="系统自动生成"
:disabled="judgeWrite('businessNo')" readonly :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<!-- <el-col :span="24" v-if="judgeShow('businessType')" >
<jnpf-form-tip-item
label="业务类型" v-if="judgeShow('businessType')" prop="businessType" >
<JnpfInput v-model="dataForm.businessType" @change="changeData('businessType',-1)"
placeholder="请输入" :disabled="judgeWrite('businessType')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col> -->
<el-col :span="24" v-if="judgeShow('-${html.relationField}')">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>设计子表</h2>
</div>
<el-table :data="dataForm.subjectcreditratingList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="信用级别" v-if="judgeShow('subjectcreditrating-creditRating')" prop="creditRating">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('subjectcreditratingList-creditRating')">*</span>信用级别
</template>
<template slot-scope="scope">
<JnpfSelect v-model="scope.row.creditRating"
@change="changeData('subjectcreditrating-creditRating',scope.$index)" placeholder="请选择"
:disabled="judgeWrite('subjectcreditratingList')||judgeWrite('subjectcreditratingList-creditRating')"
clearable :style='{"width":"100%"}' :options="subjectcreditratingcreditRatingOptions"
:props="subjectcreditratingcreditRatingProps">
</JnpfSelect>
</template>
</el-table-column>
<el-table-column label="评定分数最低" v-if="judgeShow('subjectcreditrating-scoreDown')" prop="scoreDown">
<template slot="header">
<span class="required-sign" v-if="judgeRequired('subjectcreditratingList-scoreDown')">*</span>
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.scoreDown"
@change="changeData('subjectcreditrating-scoreDown',scope.$index)" placeholder="请输入"
:disabled="judgeWrite('subjectcreditratingList')||judgeWrite('subjectcreditratingList-scoreDown')"
addonAfter="分" clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="评定分数最高" v-if="judgeShow('subjectcreditrating-scoreUpper')" prop="scoreUpper">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('subjectcreditratingList-scoreUpper')">*</span>评定分数最高
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.scoreUpper"
@change="changeData('subjectcreditrating-scoreUpper',scope.$index)" placeholder="请输入"
:disabled="judgeWrite('subjectcreditratingList')||judgeWrite('subjectcreditratingList-scoreUpper')"
addonAfter="分" clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="开始时间" v-if="judgeShow('subjectcreditrating-startTime')" prop="startTime">
<template slot="header">
<span class="required-sign" v-if="judgeRequired('subjectcreditratingList-startTime')">*</span>
</template>
<template slot-scope="scope">
<JnpfDatePicker v-model="scope.row.startTime"
@change="changeData('subjectcreditrating-startTime',scope.$index)"
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" placeholder="请选择"
:disabled="judgeWrite('subjectcreditratingList')||judgeWrite('subjectcreditratingList-startTime')"
clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd">
</JnpfDatePicker>
</template>
</el-table-column>
<el-table-column label="结束时间" v-if="judgeShow('subjectcreditrating-endTime')" prop="endTime">
<template slot="header">
<span class="required-sign" v-if="judgeRequired('subjectcreditratingList-endTime')">*</span>
</template>
<template slot-scope="scope">
<JnpfDatePicker v-model="scope.row.endTime"
@change="changeData('subjectcreditrating-endTime',scope.$index)"
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" placeholder="请选择"
:disabled="judgeWrite('subjectcreditratingList')||judgeWrite('subjectcreditratingList-endTime')"
clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd">
</JnpfDatePicker>
</template>
</el-table-column>
<el-table-column label="级别说明" v-if="judgeShow('subjectcreditrating-levelDescription')"
prop="levelDescription">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('subjectcreditratingList-levelDescription')">*</span>级别说明
</template>
<template slot-scope="scope">
<JnpfTextarea v-model="scope.row.levelDescription"
@change="changeData('subjectcreditrating-levelDescription',scope.$index)" placeholder="请输入"
:disabled="judgeWrite('subjectcreditratingList')||judgeWrite('subjectcreditratingList-levelDescription')"
:style='{"width":"100%"}' true type="textarea" :autosize='{"minRows":4,"maxRows":4}'>
</JnpfTextarea>
</template>
</el-table-column>
<el-table-column label="附件" v-if="judgeShow('subjectcreditrating-annex')" prop="annex">
<template slot="header">
<span class="required-sign" v-if="judgeRequired('subjectcreditratingList-annex')">*</span>
</template>
<template slot-scope="scope">
<JnpfUploadFile v-model="scope.row.annex"
@change="changeData('subjectcreditrating-annex',scope.$index)"
:disabled="judgeWrite('subjectcreditratingList')||judgeWrite('subjectcreditratingList-annex')"
tipText="支持格式:.rar .zip .doc .docx .pdf 单个文件不能超过20MB" :fileSize="10" sizeUnit="MB" :limit="9"
pathType="defaultPath" :isAccount="0" buttonText="点击上传">
</JnpfUploadFile>
</template>
</el-table-column>
<el-table-column label="操作" width="50" v-if="!judgeWrite('subjectcreditratingList')">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delsubjectcreditratingList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addsubjectcreditratingList()"
v-if="!judgeWrite('subjectcreditratingList')">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible=false" />
</el-form>
</el-row>
<UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
</div>
</template>
<script>
import request from '@/utils/request'
import {
mapGetters
} from "vuex";
import {
getFormById
} from '@/api/workFlow/FormDesign'
import comMixin from '@/views/workFlow/workFlowForm/mixin';
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 {
mixins: [comMixin],
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: {
subjectcreditratingList: {
"popupType": "dialog",
"hasPage": true,
"popupTitle": "选择数据",
"pageSize": 20,
"columnOptions": [],
"interfaceId": "",
"interfaceName": "",
"relationOptions": [],
"templateJson": [],
"popupWidth": "800px"
},
},
//
ableAll: {},
tableRows: {
subjectcreditratingList: {
creditRatingOptions: [],
scoreDown: '',
scoreDownOptions: [],
scoreUpper: '',
scoreUpperOptions: [],
startTime: '',
startTimeOptions: [],
endTime: '',
endTimeOptions: [],
levelDescription: '',
levelDescriptionOptions: [],
annex: [],
annexOptions: [],
enabledmark: undefined
},
},
Vmodel: "",
currVmodel: "",
dataForm: {
businessNo: undefined,
businessType: "1",
subjectcreditratingList: [],
version: 0,
},
tableRequiredData: {},
dataRule: {},
subjectcreditratingcreditRatingOptions: [],
subjectcreditratingcreditRatingProps: {
"label": "fullName",
"value": "id"
},
childIndex: -1,
isEdit: false,
interfaceRes: {
businessNo: [],
businessType: [],
subjectcreditratingcreditRating: [],
subjectcreditratingscoreDown: [],
subjectcreditratingscoreUpper: [],
subjectcreditratingstartTime: [],
subjectcreditratingendTime: [],
subjectcreditratinglevelDescription: [],
subjectcreditratingannex: [],
},
}
},
computed: {
formOperates() {
return this.setting.formOperates
}
},
watch: {},
created() {
this.getFormById()
if (this.dataForm.id == null || this.dataForm.id == '' && this.dataForm.id == undefined || this.dataForm.id ==
0) {
this.initDefaultData()
}
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() {},
methods: {
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if (this[options]) {
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model, index, defaultValue) {
if (!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll() {
this.getsubjectcreditratingcreditRatingOptions();
},
selfGetInfo(dataForm) {
this.dataInfo(dataForm)
},
beforeSubmit() {
const _data = this.dataList()
return _data
},
selfInit() {
this.dataAll()
},
getFormById() {
getFormById("522005775749488005").then(res => {
this.dataForm.flowId = res.data && res.data.flowId
// this.encode = res.data&&res.data.encode
})
},
exist() {
let isOk = true
for (let key in this.tableRequiredData) {
if (this.dataForm[key] && Array.isArray(this.dataForm[key])) {
for (let i = 0; i < this.dataForm[key].length; i++) {
let item = this.dataForm[key][i]
inner: for (let id in item) {
let arr = this.tableRequiredData[key].filter(o => o.id === id) || []
if (!arr.length) continue inner
if (arr[0].required) {
let msg = `${arr[0].name}不能为空`
let boo = true
if (arr[0].dataType === 'array') {
boo = !this.jnpf.isEmptyArray(item[id])
} else {
boo = !this.jnpf.isEmpty(item[id])
}
if (!boo) {
this.$message({
message: msg,
type: 'error',
duration: 1000
})
isOk = false
break
}
}
}
}
}
}
if (!this.subjectcreditratingExist()) return
return isOk
},
subjectcreditratingExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.subjectcreditratingList.length; i++) {
const e = this.dataForm.subjectcreditratingList[i];
if (!e.creditRating) {
this.$message({
message: '信用级别不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.scoreDown) {
this.$message({
message: '评定分数最低不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.scoreUpper) {
this.$message({
message: '评定分数最高不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.startTime) {
this.$message({
message: '开始时间不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.endTime) {
this.$message({
message: '结束时间不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
}
return isOk;
},
getsubjectcreditratingcreditRatingOptions() {
getDictionaryDataSelector('517682237588636677').then(res => {
this.subjectcreditratingcreditRatingOptions = res.data.list
})
},
goBack() {
this.$emit('refresh')
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
//
initDefaultData() {
},
addsubjectcreditratingList() {
let item = {
creditRating: '',
creditRatingOptions: [],
scoreDown: undefined,
scoreUpper: undefined,
startTime: undefined,
endTime: undefined,
levelDescription: undefined,
annex: [],
}
this.getsubjectcreditratingList(item)
},
delsubjectcreditratingList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.subjectcreditratingList.splice(index, 1);
}).catch(() => {});
},
getsubjectcreditratingList(value) {
let item = {
...this.tableRows.subjectcreditratingList,
...value
}
this.dataForm.subjectcreditratingList.push(item)
this.childIndex = this.dataForm.subjectcreditratingList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
},
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()
for (let i = 0; i < _dataAll.subjectcreditratingList.length; i++) {
this.childIndex = i
}
this.childIndex = -1
},
},
}
</script>

@ -0,0 +1,581 @@
<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.businessNo" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<!-- <el-col :span="6">
<el-form-item label="业务类型">
<el-input v-model="query.businessType" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col> -->
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"></el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"></el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" v-has="'btn_add'" @click="addOrUpdateHandle()">
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-download" @click="exportData()" v-has="'btn_download'">
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-clearn" @click="handleBatchRemoveDel()"
v-has="'btn_batchRemove'">批量删除
</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="businessNo" label="单据号" align="left">
</el-table-column>
<el-table-column prop="flowState" label="状态" width="100">
<template slot-scope="scope" v-if="!scope.row.top">
<el-tag v-if="scope.row.flowState==1"></el-tag>
<el-tag type="success" v-else-if="scope.row.flowState==2">审核通过</el-tag>
<el-tag type="danger" v-else-if="scope.row.flowState==3">审核驳回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState==4">流程撤回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState==5">审核终止</el-tag>
<el-tag type="warning" v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" :disabled="[1,2,4,5].indexOf(scope.row.flowState)>-1"
@click="updateHandle(scope.row)" v-has="'btn_edit'">编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn" :disabled="[1,2,3,5].indexOf(scope.row.flowState)>-1"
v-has="'btn_remove'" @click="handleDel(scope.row.id)">删除
</el-button>
<el-button size="mini" type="text" :disabled="!scope.row.flowState"
@click="updateHandle(scope.row,scope.row.flowState)">详情</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" />
<FlowBox v-if="flowVisible" ref="FlowBox" @close="colseFlow" />
<el-dialog title="请选择流程" :close-on-click-modal="false" append-to-body :visible.sync="flowListVisible"
class="JNPF-dialog template-dialog JNPF-dialog_center" lock-scroll width="400px">
<el-scrollbar class="template-list">
<div class="template-item" v-for="item in flowList" :key="item.id" @click="selectFlow(item)">{{item.fullName}}
</div>
</el-scrollbar>
</el-dialog>
<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 {
getFormById
} from '@/api/workFlow/FormDesign'
import {
getFlowList
} from '@/api/workFlow/FlowEngine'
import FlowBox from '@/views/workFlow/components/FlowBox'
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: {
FlowBox,
ExportBox,
ToFormDetail,
SuperQuery
},
data() {
return {
keyword: '',
expandsTree: true,
refreshTree: true,
toFormDetailVisible: false,
expandObj: {},
columnOptions: [],
mergeList: [],
exportList: [],
columnList,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
businessNo: undefined,
businessType: 1,
},
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,
tableField102_creditRatingOptions: [],
tableField102_creditRatingProps: {
"label": "fullName",
"value": "id"
},
interfaceRes: {},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
getFormById("522005775749488005").then(res1 => {
let flowId = res1.data && res1.data.id
getFlowList(flowId, '1').then(res2 => {
this.flowList = res2.data
this.getColumnList(),
this.initSearchDataAndListData()
this.queryData = JSON.parse(JSON.stringify(this.query))
}).catch((e) => {
this.$message({
type: 'error',
message: e.message
});
this.$router.push('/404');
})
})
},
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: '522005775749488005',
type: 1,
};
request({
url: `/api/scm/Subjectcreditratingno/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/Subjectcreditratingno/${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/Subjectcreditratingno")
})
},
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/Subjectcreditratingno/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, flowState) {
if (!row) {
this.addHandle();
} else {
this.updateHandle(row, flowState)
}
},
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/Subjectcreditratingno/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()
},
//
updateHandle(row, flowState) {
let data = {
id: row.id,
flowId: row.flowId || this.flowList[0].id,
opType: flowState ? 0 : '-1',
status: flowState
}
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
toApprovalDetail(row) {
let data = {
id: row.id,
flowId: row.flowId,
opType: 0,
status: row.currentState
}
this.formVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
addHandle() {
if (!this.flowList.length) {
this.$message({
type: 'error',
message: '流程不存在'
});
} else if (this.flowList.length === 1) {
this.selectFlow(this.flowList[0])
} else {
this.flowListVisible = true
}
},
//
selectFlow(item) {
let data = {
id: '',
formType: 1,
flowId: item.id,
opType: '-1'
}
this.flowListVisible = false
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
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

File diff suppressed because one or more lines are too long

@ -0,0 +1,561 @@
<template>
<div :style="{margin: '0 auto',width:'100%'}">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right"
:disabled="setting.readonly">
<template v-if="!loading && formOperates">
<!-- 具体表单 -->
<el-col :span="24" v-if="judgeShow('businessNo')">
<jnpf-form-tip-item label="单据号" v-if="judgeShow('businessNo')" prop="businessNo">
<JnpfInput v-model="dataForm.businessNo" @change="changeData('businessNo',-1)" placeholder="系统自动生成"
:disabled="judgeWrite('businessNo')" readonly :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<!-- <el-col :span="24" v-if="judgeShow('businessType')">
<jnpf-form-tip-item label="业务类型" v-if="judgeShow('businessType')" prop="businessType">
<JnpfInput v-model="dataForm.businessType" @change="changeData('businessType',-1)" placeholder="请输入"
:disabled="judgeWrite('businessType')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col> -->
<el-col :span="24" v-if="judgeShow('categoryName')">
<jnpf-form-tip-item label="类目" v-if="judgeShow('categoryName')" prop="categoryName">
<JnpfSelect v-model="dataForm.categoryName" @change="changeData('categoryName',-1)" placeholder="请选择"
:disabled="judgeWrite('categoryName')" clearable :style='{"width":"100%"}'
:options="categoryNameOptions" :props="categoryNameProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('projectName')">
<jnpf-form-tip-item label="项目" v-if="judgeShow('projectName')" prop="projectName">
<JnpfSelect v-model="dataForm.projectName" @change="changeData('projectName',-1)" placeholder="请选择"
:disabled="judgeWrite('projectName')" clearable :style='{"width":"100%"}' :options="projectNameOptions"
:props="projectNameProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('ruleDescription')">
<jnpf-form-tip-item label="规则说明" v-if="judgeShow('ruleDescription')" prop="ruleDescription">
<JnpfTextarea v-model="dataForm.ruleDescription" @change="changeData('ruleDescription',-1)"
placeholder="请输入" :disabled="judgeWrite('ruleDescription')" :style='{"width":"100%"}' true
type="textarea" :autosize='{"minRows":4,"maxRows":4}'>
</JnpfTextarea>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('annex')">
<jnpf-form-tip-item label="附件" v-if="judgeShow('annex')" prop="annex">
<JnpfUploadFile v-model="dataForm.annex" @change="changeData('annex',-1)" :disabled="judgeWrite('annex')"
:fileSize="10" sizeUnit="MB" :limit="9" pathType="defaultPath" :isAccount="0" buttonText="点击上传">
</JnpfUploadFile>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('-${html.relationField}')">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>计分明细</h2>
</div>
<el-table :data="dataForm.subjectcreditrulesscoreList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="范围最低" v-if="judgeShow('subjectcreditrulesscore-scoreDown')" prop="scoreDown">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('subjectcreditrulesscoreList-scoreDown')">*</span>范围最低
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.scoreDown"
@change="changeData('subjectcreditrulesscore-scoreDown',scope.$index)" placeholder="请输入"
:disabled="judgeWrite('subjectcreditrulesscoreList')||judgeWrite('subjectcreditrulesscoreList-scoreDown')"
clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="范围最高" v-if="judgeShow('subjectcreditrulesscore-scoreUpper')" prop="scoreUpper">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('subjectcreditrulesscoreList-scoreUpper')">*</span>范围最高
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.scoreUpper"
@change="changeData('subjectcreditrulesscore-scoreUpper',scope.$index)" placeholder="请输入"
:disabled="judgeWrite('subjectcreditrulesscoreList')||judgeWrite('subjectcreditrulesscoreList-scoreUpper')"
clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="分数" v-if="judgeShow('subjectcreditrulesscore-score')" prop="score">
<template slot="header">
<span class="required-sign" v-if="judgeRequired('subjectcreditrulesscoreList-score')">*</span>
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.score"
@change="changeData('subjectcreditrulesscore-score',scope.$index)" placeholder="请输入"
:disabled="judgeWrite('subjectcreditrulesscoreList')||judgeWrite('subjectcreditrulesscoreList-score')"
clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50" v-if="!judgeWrite('subjectcreditrulesscoreList')">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delsubjectcreditrulesscoreList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addsubjectcreditrulesscoreList()"
v-if="!judgeWrite('subjectcreditrulesscoreList')">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible=false" />
</el-form>
</el-row>
<UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
</div>
</template>
<script>
import request from '@/utils/request'
import {
mapGetters
} from "vuex";
import {
getFormById
} from '@/api/workFlow/FormDesign'
import comMixin from '@/views/workFlow/workFlowForm/mixin';
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 {
mixins: [comMixin],
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: {
subjectcreditrulesscoreList: {
"popupType": "dialog",
"hasPage": true,
"popupTitle": "选择数据",
"pageSize": 20,
"columnOptions": [],
"interfaceId": "",
"interfaceName": "",
"relationOptions": [],
"templateJson": [],
"popupWidth": "800px"
},
},
//
ableAll: {},
tableRows: {
subjectcreditrulesscoreList: {
scoreDown: '',
scoreDownOptions: [],
scoreUpper: '',
scoreUpperOptions: [],
score: '',
scoreOptions: [],
enabledmark: undefined
},
},
Vmodel: "",
currVmodel: "",
dataForm: {
businessNo: undefined,
businessType: "1",
categoryName: undefined,
projectName: undefined,
ruleDescription: undefined,
annex: [],
subjectcreditrulesscoreList: [],
version: 0,
},
tableRequiredData: {},
dataRule: {
categoryName: [{
required: true,
message: '请选择',
trigger: 'change'
}, ],
projectName: [{
required: true,
message: '请选择',
trigger: 'change'
}, ],
},
categoryNameOptions: [],
categoryNameProps: {
"label": "fullName",
"value": "enCode"
},
projectNameOptions: [],
projectNameProps: {
"label": "fullName",
"value": "enCode"
},
childIndex: -1,
isEdit: false,
interfaceRes: {
businessNo: [],
businessType: [],
categoryName: [],
projectName: [],
ruleDescription: [],
annex: [],
subjectcreditrulesscorescoreDown: [],
subjectcreditrulesscorescoreUpper: [],
subjectcreditrulesscorescore: [],
},
}
},
computed: {
formOperates() {
return this.setting.formOperates
}
},
watch: {},
created() {
this.getFormById()
if (this.dataForm.id == null || this.dataForm.id == '' && this.dataForm.id == undefined || this.dataForm.id ==
0) {
this.initDefaultData()
}
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() {},
methods: {
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if (this[options]) {
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model, index, defaultValue) {
if (!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll() {
this.getcategoryNameOptions();
this.getprojectNameOptions();
},
selfGetInfo(dataForm) {
this.dataInfo(dataForm)
},
beforeSubmit() {
const _data = this.dataList()
return _data
},
selfInit() {
this.dataAll()
},
getFormById() {
getFormById("522736258103914309").then(res => {
this.dataForm.flowId = res.data && res.data.flowId
// this.encode = res.data&&res.data.encode
})
},
exist() {
let isOk = true
for (let key in this.tableRequiredData) {
if (this.dataForm[key] && Array.isArray(this.dataForm[key])) {
for (let i = 0; i < this.dataForm[key].length; i++) {
let item = this.dataForm[key][i]
inner: for (let id in item) {
let arr = this.tableRequiredData[key].filter(o => o.id === id) || []
if (!arr.length) continue inner
if (arr[0].required) {
let msg = `${arr[0].name}不能为空`
let boo = true
if (arr[0].dataType === 'array') {
boo = !this.jnpf.isEmptyArray(item[id])
} else {
boo = !this.jnpf.isEmpty(item[id])
}
if (!boo) {
this.$message({
message: msg,
type: 'error',
duration: 1000
})
isOk = false
break
}
}
}
}
}
}
if (!this.subjectcreditrulesscoreExist()) return
return isOk
},
subjectcreditrulesscoreExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.subjectcreditrulesscoreList.length; i++) {
const e = this.dataForm.subjectcreditrulesscoreList[i];
if (e.scoreDown) {
var regPos = [{
"pattern": "/^([1-9][\\d]*|0)(\\.[\\d]+)?$/",
"message": "请输入正确的金额"
}]
for (let i = 0; i < regPos.length; i++) {
const element = regPos[i];
if (element.pattern && !eval(element.pattern).test(e.scoreDown)) {
this.$message({
message: element.message,
type: 'error',
duration: 1000
});
isOk = false
break;
}
}
}
if (e.scoreUpper) {
var regPos = [{
"pattern": "/^([1-9][\\d]*|0)(\\.[\\d]+)?$/",
"message": "请输入正确的金额"
}]
for (let i = 0; i < regPos.length; i++) {
const element = regPos[i];
if (element.pattern && !eval(element.pattern).test(e.scoreUpper)) {
this.$message({
message: element.message,
type: 'error',
duration: 1000
});
isOk = false
break;
}
}
}
if (e.score) {
var regPos = [{
"pattern": "/^([1-9][\\d]*|0)(\\.[\\d]+)?$/",
"message": "请输入正确的金额"
}]
for (let i = 0; i < regPos.length; i++) {
const element = regPos[i];
if (element.pattern && !eval(element.pattern).test(e.score)) {
this.$message({
message: element.message,
type: 'error',
duration: 1000
});
isOk = false
break;
}
}
}
}
return isOk;
},
getcategoryNameOptions() {
getDictionaryDataSelector('522733511912730437').then(res => {
this.categoryNameOptions = res.data.list
})
},
getprojectNameOptions() {
getDictionaryDataSelector('522733676014874437').then(res => {
this.projectNameOptions = res.data.list
})
},
goBack() {
this.$emit('refresh')
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
//
initDefaultData() {
},
addsubjectcreditrulesscoreList() {
let item = {
scoreDown: undefined,
scoreUpper: undefined,
score: undefined,
}
this.getsubjectcreditrulesscoreList(item)
},
delsubjectcreditrulesscoreList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.subjectcreditrulesscoreList.splice(index, 1);
}).catch(() => {});
},
getsubjectcreditrulesscoreList(value) {
let item = {
...this.tableRows.subjectcreditrulesscoreList,
...value
}
this.dataForm.subjectcreditrulesscoreList.push(item)
this.childIndex = this.dataForm.subjectcreditrulesscoreList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
},
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()
for (let i = 0; i < _dataAll.subjectcreditrulesscoreList.length; i++) {
this.childIndex = i
}
this.childIndex = -1
},
},
}
</script>

@ -0,0 +1,630 @@
<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.businessType" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col> -->
<el-col :span="6">
<el-form-item label="单据号">
<el-input v-model="query.businessNo" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="类目">
<JnpfSelect v-model="query.categoryName" placeholder="请选择" clearable :options="categoryNameOptions"
:props="categoryNameProps" multiple>
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="项目">
<JnpfSelect v-model="query.projectName" placeholder="请选择" clearable :options="projectNameOptions"
:props="projectNameProps" multiple>
</JnpfSelect>
</el-form-item>
</el-col>
<template v-if="showAll">
</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" v-has="'btn_add'" @click="addOrUpdateHandle()">
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-download" @click="exportData()" v-has="'btn_download'">
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-clearn" @click="handleBatchRemoveDel()"
v-has="'btn_batchRemove'">批量删除
</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="businessNo" label="单据号" align="left">
</el-table-column>
<el-table-column prop="categoryName" label="类目" align="left">
</el-table-column>
<el-table-column prop="projectName" label="项目" align="left">
</el-table-column>
<el-table-column prop="ruleDescription" label="规则说明" align="left">
</el-table-column>
<el-table-column prop="flowState" label="状态" width="100">
<template slot-scope="scope" v-if="!scope.row.top">
<el-tag v-if="scope.row.flowState==1"></el-tag>
<el-tag type="success" v-else-if="scope.row.flowState==2">审核通过</el-tag>
<el-tag type="danger" v-else-if="scope.row.flowState==3">审核驳回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState==4">流程撤回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState==5">审核终止</el-tag>
<el-tag type="warning" v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" :disabled="[1,2,4,5].indexOf(scope.row.flowState)>-1"
@click="updateHandle(scope.row)" v-has="'btn_edit'">编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn" :disabled="[1,2,3,5].indexOf(scope.row.flowState)>-1"
v-has="'btn_remove'" @click="handleDel(scope.row.id)">删除
</el-button>
<el-button size="mini" type="text" :disabled="!scope.row.flowState"
@click="updateHandle(scope.row,scope.row.flowState)">详情</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" />
<FlowBox v-if="flowVisible" ref="FlowBox" @close="colseFlow" />
<el-dialog title="请选择流程" :close-on-click-modal="false" append-to-body :visible.sync="flowListVisible"
class="JNPF-dialog template-dialog JNPF-dialog_center" lock-scroll width="400px">
<el-scrollbar class="template-list">
<div class="template-item" v-for="item in flowList" :key="item.id" @click="selectFlow(item)">{{item.fullName}}
</div>
</el-scrollbar>
</el-dialog>
<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 {
getFormById
} from '@/api/workFlow/FormDesign'
import {
getFlowList
} from '@/api/workFlow/FlowEngine'
import FlowBox from '@/views/workFlow/components/FlowBox'
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: {
FlowBox,
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: {
businessType: 1,
businessNo: undefined,
categoryName: undefined,
projectName: 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,
categoryNameOptions: [],
categoryNameProps: {
"label": "fullName",
"value": "enCode"
},
projectNameOptions: [],
projectNameProps: {
"label": "fullName",
"value": "enCode"
},
interfaceRes: {},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
getFormById("522736258103914309").then(res1 => {
let flowId = res1.data && res1.data.id
getFlowList(flowId, '1').then(res2 => {
this.flowList = res2.data
this.getColumnList(),
this.initSearchDataAndListData()
this.getcategoryNameOptions();
this.getprojectNameOptions();
this.queryData = JSON.parse(JSON.stringify(this.query))
}).catch((e) => {
this.$message({
type: 'error',
message: e.message
});
this.$router.push('/404');
})
})
},
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
},
getcategoryNameOptions() {
getDictionaryDataSelector('522733511912730437').then(res => {
this.categoryNameOptions = res.data.list
})
},
getprojectNameOptions() {
getDictionaryDataSelector('522733676014874437').then(res => {
this.projectNameOptions = res.data.list
})
},
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: '522736258103914309',
type: 1,
};
request({
url: `/api/scm/Subjectcreditrules/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/Subjectcreditrules/${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/Subjectcreditrules")
})
},
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/Subjectcreditrules/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, flowState) {
if (!row) {
this.addHandle();
} else {
this.updateHandle(row, flowState)
}
},
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/Subjectcreditrules/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()
},
//
updateHandle(row, flowState) {
let data = {
id: row.id,
flowId: row.flowId || this.flowList[0].id,
opType: flowState ? 0 : '-1',
status: flowState
}
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
toApprovalDetail(row) {
let data = {
id: row.id,
flowId: row.flowId,
opType: 0,
status: row.currentState
}
this.formVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
addHandle() {
if (!this.flowList.length) {
this.$message({
type: 'error',
message: '流程不存在'
});
} else if (this.flowList.length === 1) {
this.selectFlow(this.flowList[0])
} else {
this.flowListVisible = true
}
},
//
selectFlow(item) {
let data = {
id: '',
formType: 1,
flowId: item.id,
opType: '-1'
}
this.flowListVisible = false
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
refresh(isrRefresh) {
this.formVisible = false
if (isrRefresh) this.reset()
},
reset() {
this.query = JSON.parse(JSON.stringify(this.queryData))
this.search()
},
colseFlow(isrRefresh) {
this.flowVisible = false
if (isrRefresh) this.reset()
},
}
}
</script>

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