去除无用代码,新增主数据功能
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
package com.yunzhupaas.base.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.base.entity.MdmContractTypeEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* mdmContractType
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-30
|
||||
*/
|
||||
public interface MdmContractTypeMapper extends SuperMapper<MdmContractTypeEntity> {
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.yunzhupaas.base.service;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.base.model.bcmprojecttype.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
*/
|
||||
public interface BcmProjectTypeService extends SuperService<BcmProjectTypeEntity> {
|
||||
List<BcmProjectTypeEntity> getList(BcmProjectTypePagination bcmProjectTypePagination);
|
||||
|
||||
List<BcmProjectTypeEntity> getTypeList(BcmProjectTypePagination bcmProjectTypePagination,String dataType);
|
||||
|
||||
BcmProjectTypeEntity getInfo(String projecttypeid);
|
||||
|
||||
void delete(BcmProjectTypeEntity entity);
|
||||
|
||||
void create(BcmProjectTypeEntity entity);
|
||||
|
||||
boolean update(String projecttypeid, BcmProjectTypeEntity entity);
|
||||
|
||||
String checkForm(BcmProjectTypeForm form,int i);
|
||||
|
||||
void saveOrUpdate(BcmProjectTypeForm bcmProjectTypeForm,String id, boolean isSave) throws Exception;
|
||||
List<BcmProjectTypeEntity> getBcmprojecttypeList(BcmProjectTypePagination bcmProjectTypePagination);
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.yunzhupaas.base.service;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.base.model.mdmcompany.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
*/
|
||||
public interface MdmCompanyService extends SuperService<MdmCompanyEntity> {
|
||||
List<MdmCompanyEntity> getList(MdmCompanyPagination mdmCompanyPagination);
|
||||
|
||||
List<MdmCompanyEntity> getTypeList(MdmCompanyPagination mdmCompanyPagination,String dataType);
|
||||
|
||||
MdmCompanyEntity getInfo(String companyid);
|
||||
|
||||
void delete(MdmCompanyEntity entity);
|
||||
|
||||
void create(MdmCompanyEntity entity);
|
||||
|
||||
boolean update(String companyid, MdmCompanyEntity entity);
|
||||
|
||||
String checkForm(MdmCompanyForm form,int i);
|
||||
|
||||
void saveOrUpdate(MdmCompanyForm mdmCompanyForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.yunzhupaas.base.service;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.base.model.mdmcontracttype.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* mdmContractType
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-30
|
||||
*/
|
||||
public interface MdmContractTypeService extends SuperService<MdmContractTypeEntity> {
|
||||
List<MdmContractTypeEntity> getList(MdmContractTypePagination mdmContractTypePagination);
|
||||
|
||||
List<MdmContractTypeEntity> getTypeList(MdmContractTypePagination mdmContractTypePagination,String dataType);
|
||||
|
||||
MdmContractTypeEntity getInfo(String id);
|
||||
|
||||
void delete(MdmContractTypeEntity entity);
|
||||
|
||||
void create(MdmContractTypeEntity entity);
|
||||
|
||||
boolean update(String id, MdmContractTypeEntity entity);
|
||||
|
||||
String checkForm(MdmContractTypeForm form,int i);
|
||||
|
||||
void saveOrUpdate(MdmContractTypeForm mdmContractTypeForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.yunzhupaas.base.service;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.base.model.mdmproject.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 项目结构
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
*/
|
||||
public interface MdmProjectService extends SuperService<MdmProjectEntity> {
|
||||
List<MdmProjectEntity> getList(MdmProjectPagination mdmProjectPagination);
|
||||
|
||||
List<MdmProjectEntity> getTypeList(MdmProjectPagination mdmProjectPagination,String dataType);
|
||||
|
||||
MdmProjectEntity getInfo(String projectid);
|
||||
|
||||
void delete(MdmProjectEntity entity);
|
||||
|
||||
void create(MdmProjectEntity entity);
|
||||
|
||||
boolean update(String projectid, MdmProjectEntity entity);
|
||||
|
||||
String checkForm(MdmProjectForm form,int i);
|
||||
|
||||
void saveOrUpdate(MdmProjectForm mdmProjectForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -1,331 +0,0 @@
|
||||
|
||||
package com.yunzhupaas.base.service.impl;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.mapper.BcmProjectTypeMapper;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.base.model.bcmprojecttype.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import java.math.BigDecimal;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* 项目类型
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
*/
|
||||
@Service
|
||||
public class BcmProjectTypeServiceImpl extends SuperServiceImpl<BcmProjectTypeMapper, BcmProjectTypeEntity> implements BcmProjectTypeService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Override
|
||||
public List<BcmProjectTypeEntity> getList(BcmProjectTypePagination bcmProjectTypePagination){
|
||||
return getTypeList(bcmProjectTypePagination,bcmProjectTypePagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<BcmProjectTypeEntity> getTypeList(BcmProjectTypePagination bcmProjectTypePagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("bcm_project_type",BcmProjectTypeEntity.class);
|
||||
|
||||
MPJLambdaWrapper<BcmProjectTypeEntity> wrapper = JoinWrappers
|
||||
.lambda("bcm_project_type",BcmProjectTypeEntity.class)
|
||||
.selectAll(BcmProjectTypeEntity.class);
|
||||
MPJLambdaWrapper<BcmProjectTypeEntity> wrapper2 = JoinWrappers
|
||||
.lambda("bcm_project_type",BcmProjectTypeEntity.class)
|
||||
.distinct().select(BcmProjectTypeEntity::getProjectTypeId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(BcmProjectTypeConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? BcmProjectTypeConstant.getAppColumnData() : BcmProjectTypeConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(bcmProjectTypePagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = false;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(bcmProjectTypePagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(bcmProjectTypePagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(bcmProjectTypePagination, wrapper, isPc);
|
||||
otherConditions(bcmProjectTypePagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) bcmProjectTypePagination.getCurrentPage(), (int) bcmProjectTypePagination.getPageSize(), true);
|
||||
List<BcmProjectTypeEntity> userIPage = this.selectJoinList(BcmProjectTypeEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getProjectTypeId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(BcmProjectTypeEntity::getProjectTypeId,collect);
|
||||
}
|
||||
List<BcmProjectTypeEntity> result = this.selectJoinList(BcmProjectTypeEntity.class, wrapper);
|
||||
return bcmProjectTypePagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<BcmProjectTypeEntity> list = this.selectJoinList(BcmProjectTypeEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(bcmProjectTypePagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getProjectTypeId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(BcmProjectTypePagination bcmProjectTypePagination, MPJLambdaWrapper<BcmProjectTypeEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.isNull(BcmProjectTypeEntity::getDeleteMark);
|
||||
|
||||
wrapper.isNull(BcmProjectTypeEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(bcmProjectTypePagination.getYunzhupaasKeyword())){
|
||||
}
|
||||
//普通查询
|
||||
//排序
|
||||
if(StringUtil.isEmpty(bcmProjectTypePagination.getSidx())){
|
||||
wrapper.orderByDesc(BcmProjectTypeEntity::getProjectTypeId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = bcmProjectTypePagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
BcmProjectTypeEntity bcmProjectTypeEntity = new BcmProjectTypeEntity();
|
||||
String oderTableField = bcmProjectTypeEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = bcmProjectTypeEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public BcmProjectTypeEntity getInfo(String projecttypeid){
|
||||
MPJLambdaWrapper<BcmProjectTypeEntity> wrapper = JoinWrappers
|
||||
.lambda("bcm_project_type",BcmProjectTypeEntity.class)
|
||||
.selectAll(BcmProjectTypeEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(BcmProjectTypeEntity::getProjectTypeId, projecttypeid )
|
||||
.or().eq(BcmProjectTypeEntity::getFlowTaskId, projecttypeid)
|
||||
);
|
||||
return this.selectJoinOne(BcmProjectTypeEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(BcmProjectTypeEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String projecttypeid, BcmProjectTypeEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(BcmProjectTypeEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getProjectTypeId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(BcmProjectTypeForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getProjectTypeId()) && !form.getProjectTypeId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getProjectTypeId();
|
||||
}
|
||||
//验证业务主键
|
||||
String businessErr = checkBusinessKey(form, isUp ? id : null, null);
|
||||
if (StringUtil.isNotEmpty(businessErr)) {
|
||||
return businessErr;
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "项目类型编码";
|
||||
if(StringUtil.isEmpty(form.getProjectTypeCode())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getProjectTypeCode())){
|
||||
form.setProjectTypeCode(form.getProjectTypeCode().trim());
|
||||
QueryWrapper<BcmProjectTypeEntity> project_type_codeWrapper=new QueryWrapper<>();
|
||||
project_type_codeWrapper.lambda().eq(BcmProjectTypeEntity::getProjectTypeCode,form.getProjectTypeCode());
|
||||
project_type_codeWrapper.lambda().isNull(BcmProjectTypeEntity::getFlowId);
|
||||
//假删除标志
|
||||
project_type_codeWrapper.lambda().isNull(BcmProjectTypeEntity::getDeleteMark);
|
||||
if (isUp){
|
||||
project_type_codeWrapper.lambda().ne(BcmProjectTypeEntity::getProjectTypeId, id);
|
||||
}
|
||||
if((int) this.count(project_type_codeWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "项目类型名称";
|
||||
if(StringUtil.isEmpty(form.getProjectTypeName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getProjectTypeName())){
|
||||
form.setProjectTypeName(form.getProjectTypeName().trim());
|
||||
QueryWrapper<BcmProjectTypeEntity> project_type_nameWrapper=new QueryWrapper<>();
|
||||
project_type_nameWrapper.lambda().eq(BcmProjectTypeEntity::getProjectTypeName,form.getProjectTypeName());
|
||||
project_type_nameWrapper.lambda().isNull(BcmProjectTypeEntity::getFlowId);
|
||||
//假删除标志
|
||||
project_type_nameWrapper.lambda().isNull(BcmProjectTypeEntity::getDeleteMark);
|
||||
if (isUp){
|
||||
project_type_nameWrapper.lambda().ne(BcmProjectTypeEntity::getProjectTypeId, id);
|
||||
}
|
||||
if((int) this.count(project_type_nameWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "备注";
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 验证业务主键
|
||||
*/
|
||||
private String checkBusinessKey(BcmProjectTypeForm form, Object id, List<String> flowIds){
|
||||
QueryWrapper<BcmProjectTypeEntity> wrapper = new QueryWrapper<>();
|
||||
//修改
|
||||
if (id != null){
|
||||
wrapper.lambda().ne(BcmProjectTypeEntity::getProjectTypeId, id);
|
||||
}
|
||||
//是否流程
|
||||
if(flowIds == null){
|
||||
wrapper.lambda().isNull(BcmProjectTypeEntity::getFlowId);
|
||||
}else{
|
||||
wrapper.lambda().in(BcmProjectTypeEntity::getFlowId, flowIds);
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.lambda().isNull(BcmProjectTypeEntity::getDeleteMark);
|
||||
//项目类型编码字段判断
|
||||
if(form.getProjectTypeCode() == null || form.getProjectTypeCode().toString().trim().isEmpty()){
|
||||
wrapper.lambda().isNull(BcmProjectTypeEntity::getProjectTypeCode);
|
||||
}else{
|
||||
wrapper.lambda().eq(BcmProjectTypeEntity::getProjectTypeCode, form.getProjectTypeCode());
|
||||
}
|
||||
if((int) this.count(wrapper)>0){
|
||||
return "数据已存在,请勿重复提交!";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param bcmProjectTypeForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(BcmProjectTypeForm bcmProjectTypeForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
bcmProjectTypeForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(BcmProjectTypeConstant.getFormData(),bcmProjectTypeForm,BcmProjectTypeConstant.TABLERENAMES),BcmProjectTypeForm.class);
|
||||
BcmProjectTypeEntity entity = JsonUtil.getJsonToBean(bcmProjectTypeForm, BcmProjectTypeEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setProjectTypeId(mainUuid);
|
||||
entity.setVersion(0);
|
||||
} else {
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
if(!b){
|
||||
throw new DataException("当前表单原数据已被调整,请重新进入该页面编辑并提交数据");
|
||||
}
|
||||
BcmProjectTypeEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BcmProjectTypeEntity> getBcmprojecttypeList(BcmProjectTypePagination bcmProjectTypePagination) {
|
||||
List<BcmProjectTypeEntity> entities = this.baseMapper.selectList(new QueryWrapper<BcmProjectTypeEntity>().lambda());
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
package com.yunzhupaas.base.service.impl;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.mapper.MdmCompanyContactMapper;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.base.model.mdmcompany.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
/**
|
||||
*
|
||||
* 企业信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
*/
|
||||
@Service
|
||||
public class MdmCompanyContactServiceImpl extends SuperServiceImpl<MdmCompanyContactMapper, MdmCompanyContactEntity> implements MdmCompanyContactService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
}
|
||||
@@ -1,514 +0,0 @@
|
||||
|
||||
package com.yunzhupaas.base.service.impl;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.mapper.MdmCompanyMapper;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.base.model.mdmcompany.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import java.math.BigDecimal;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* mdm_company
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-27
|
||||
*/
|
||||
@Service
|
||||
public class MdmCompanyServiceImpl extends SuperServiceImpl<MdmCompanyMapper, MdmCompanyEntity> implements MdmCompanyService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Autowired
|
||||
private CrmCustomerService crmCustomerService;
|
||||
@Autowired
|
||||
private MdmCompanyContactService mdmCompanyContactService;
|
||||
@Autowired
|
||||
private MdmCompanyBankService mdmCompanyBankService;
|
||||
@Override
|
||||
public List<MdmCompanyEntity> getList(MdmCompanyPagination mdmCompanyPagination){
|
||||
return getTypeList(mdmCompanyPagination,mdmCompanyPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<MdmCompanyEntity> getTypeList(MdmCompanyPagination mdmCompanyPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_company",MdmCompanyEntity.class);
|
||||
tableClassMap.put("mdm_company_bank",MdmCompanyBankEntity.class);
|
||||
tableClassMap.put("mdm_company_contact",MdmCompanyContactEntity.class);
|
||||
tableClassMap.put("crm_customer",CrmCustomerEntity.class);
|
||||
|
||||
MPJLambdaWrapper<MdmCompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",MdmCompanyEntity.class)
|
||||
.selectCollection(MdmCompanyBankEntity.class,MdmCompanyEntity::getMdmCompanyBank)
|
||||
.leftJoin(MdmCompanyBankEntity.class,"mdm_company_bank",MdmCompanyBankEntity::getCompanyId,MdmCompanyEntity::getCompanyId)
|
||||
.selectCollection(MdmCompanyContactEntity.class,MdmCompanyEntity::getMdmCompanyContact)
|
||||
.leftJoin(MdmCompanyContactEntity.class,"mdm_company_contact",MdmCompanyContactEntity::getCompanyId,MdmCompanyEntity::getCompanyId)
|
||||
.selectAssociation(CrmCustomerEntity.class,MdmCompanyEntity::getCrmCustomer)
|
||||
.leftJoin(CrmCustomerEntity.class,"crm_customer",CrmCustomerEntity::getCompanyId,MdmCompanyEntity::getCompanyId)
|
||||
.selectAll(MdmCompanyEntity.class);
|
||||
MPJLambdaWrapper<MdmCompanyEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_company",MdmCompanyEntity.class)
|
||||
.leftJoin(MdmCompanyBankEntity.class,"mdm_company_bank",MdmCompanyBankEntity::getCompanyId,MdmCompanyEntity::getCompanyId)
|
||||
.leftJoin(MdmCompanyContactEntity.class,"mdm_company_contact",MdmCompanyContactEntity::getCompanyId,MdmCompanyEntity::getCompanyId)
|
||||
.leftJoin(CrmCustomerEntity.class,"crm_customer",CrmCustomerEntity::getCompanyId,MdmCompanyEntity::getCompanyId)
|
||||
.distinct().select(MdmCompanyEntity::getCompanyId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(MdmCompanyConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? MdmCompanyConstant.getAppColumnData() : MdmCompanyConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(mdmCompanyPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = false;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(mdmCompanyPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(mdmCompanyPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(mdmCompanyPagination, wrapper, isPc);
|
||||
otherConditions(mdmCompanyPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
Page<Object> objects = PageHelper.startPage((int) mdmCompanyPagination.getCurrentPage(), (int) mdmCompanyPagination.getPageSize(), true);
|
||||
List<MdmCompanyEntity> userIPage = this.selectJoinList(MdmCompanyEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getCompanyId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(MdmCompanyEntity::getCompanyId,collect);
|
||||
}
|
||||
List<MdmCompanyEntity> result = this.selectJoinList(MdmCompanyEntity.class, wrapper);
|
||||
return mdmCompanyPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<MdmCompanyEntity> list = this.selectJoinList(MdmCompanyEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(mdmCompanyPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getCompanyId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(MdmCompanyPagination mdmCompanyPagination, MPJLambdaWrapper<MdmCompanyEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.isNull(MdmCompanyEntity::getDeleteMark);
|
||||
|
||||
wrapper.isNull(MdmCompanyEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(mdmCompanyPagination.getYunzhupaasKeyword())){
|
||||
if(isPc){
|
||||
wrapper.and(t -> {
|
||||
t.like(MdmCompanyEntity::getCompanyName,mdmCompanyPagination.getYunzhupaasKeyword()).or();
|
||||
});
|
||||
}
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(mdmCompanyPagination.getCompanyName())){
|
||||
String value = mdmCompanyPagination.getCompanyName() instanceof List ?
|
||||
JsonUtil.getObjectToString(mdmCompanyPagination.getCompanyName()) :
|
||||
String.valueOf(mdmCompanyPagination.getCompanyName());
|
||||
wrapper.like(MdmCompanyEntity::getCompanyName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(mdmCompanyPagination.getEntityType())){
|
||||
wrapper.eq(MdmCompanyEntity::getEntityType,mdmCompanyPagination.getEntityType());
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(mdmCompanyPagination.getSidx())){
|
||||
wrapper.orderByDesc(MdmCompanyEntity::getCompanyId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = mdmCompanyPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
MdmCompanyEntity mdmCompanyEntity = new MdmCompanyEntity();
|
||||
String oderTableField = mdmCompanyEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = mdmCompanyEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public MdmCompanyEntity getInfo(String companyid){
|
||||
MPJLambdaWrapper<MdmCompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",MdmCompanyEntity.class)
|
||||
.selectCollection(MdmCompanyBankEntity.class,MdmCompanyEntity::getMdmCompanyBank)
|
||||
.leftJoin(MdmCompanyBankEntity.class,"mdm_company_bank",MdmCompanyBankEntity::getCompanyId,MdmCompanyEntity::getCompanyId)
|
||||
.selectCollection(MdmCompanyContactEntity.class,MdmCompanyEntity::getMdmCompanyContact)
|
||||
.leftJoin(MdmCompanyContactEntity.class,"mdm_company_contact",MdmCompanyContactEntity::getCompanyId,MdmCompanyEntity::getCompanyId)
|
||||
.selectAssociation(CrmCustomerEntity.class,MdmCompanyEntity::getCrmCustomer)
|
||||
.leftJoin(CrmCustomerEntity.class,"crm_customer",CrmCustomerEntity::getCompanyId,MdmCompanyEntity::getCompanyId)
|
||||
.selectAll(MdmCompanyEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(MdmCompanyEntity::getCompanyId, companyid )
|
||||
.or().eq(MdmCompanyEntity::getFlowTaskId, companyid)
|
||||
);
|
||||
return this.selectJoinOne(MdmCompanyEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(MdmCompanyEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String companyid, MdmCompanyEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(MdmCompanyEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getCompanyId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(MdmCompanyForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getCompanyId()) && !form.getCompanyId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getCompanyId();
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "企业编码";
|
||||
fieldTipName = "企业名称";
|
||||
if(StringUtil.isEmpty(form.getCompanyName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getCompanyName())){
|
||||
form.setCompanyName(form.getCompanyName().trim());
|
||||
QueryWrapper<MdmCompanyEntity> company_nameWrapper=new QueryWrapper<>();
|
||||
company_nameWrapper.lambda().eq(MdmCompanyEntity::getCompanyName,form.getCompanyName());
|
||||
company_nameWrapper.lambda().isNull(MdmCompanyEntity::getFlowId);
|
||||
//假删除标志
|
||||
company_nameWrapper.lambda().isNull(MdmCompanyEntity::getDeleteMark);
|
||||
if (isUp){
|
||||
company_nameWrapper.lambda().ne(MdmCompanyEntity::getCompanyId, id);
|
||||
}
|
||||
if((int) this.count(company_nameWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "简称/昵称";
|
||||
fieldTipName = "类型";
|
||||
fieldTipName = "社会信用代码";
|
||||
if(StringUtil.isEmpty(form.getCreditCode())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getCreditCode())){
|
||||
form.setCreditCode(form.getCreditCode().trim());
|
||||
QueryWrapper<MdmCompanyEntity> credit_codeWrapper=new QueryWrapper<>();
|
||||
credit_codeWrapper.lambda().eq(MdmCompanyEntity::getCreditCode,form.getCreditCode());
|
||||
credit_codeWrapper.lambda().isNull(MdmCompanyEntity::getFlowId);
|
||||
//假删除标志
|
||||
credit_codeWrapper.lambda().isNull(MdmCompanyEntity::getDeleteMark);
|
||||
if (isUp){
|
||||
credit_codeWrapper.lambda().ne(MdmCompanyEntity::getCompanyId, id);
|
||||
}
|
||||
if((int) this.count(credit_codeWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "企业范围";
|
||||
fieldTipName = "纳税人类别";
|
||||
fieldTipName = "企业规模";
|
||||
fieldTipName = "企业类型";
|
||||
fieldTipName = "行业代码";
|
||||
fieldTipName = "成立日期";
|
||||
fieldTipName = "注册资本";
|
||||
fieldTipName = "法定代表人";
|
||||
fieldTipName = "联系电话";
|
||||
if(StringUtil.isNotEmpty(form.getPhone())){
|
||||
if(!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getPhone())).matches()){
|
||||
return I18nUtil.getMessageStr("sys.validate.mobilePhone", "请输入正确的手机号码");
|
||||
}
|
||||
}
|
||||
fieldTipName = "邮箱";
|
||||
if(StringUtil.isNotEmpty(form.getEmail())){
|
||||
if(!Pattern.compile("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$").matcher(String.valueOf(form.getEmail())).matches()){
|
||||
return I18nUtil.getMessageStr("sys.validate.email", "请输入正确的邮箱");
|
||||
}
|
||||
}
|
||||
fieldTipName = "网站";
|
||||
fieldTipName = "地址";
|
||||
fieldTipName = "所属地区";
|
||||
fieldTipName = "经营范围";
|
||||
fieldTipName = "备注";
|
||||
//子表字段验证
|
||||
// if (form.getCrmCustomerList()!=null){
|
||||
//
|
||||
// fieldTipName = "设计子表"
|
||||
// + "-" + "客户负责人";
|
||||
//
|
||||
//
|
||||
// fieldTipName = "设计子表"
|
||||
// + "-" + "归属组织";
|
||||
//
|
||||
//
|
||||
// fieldTipName = "设计子表"
|
||||
// + "-" + "客户等级";
|
||||
//
|
||||
//
|
||||
// fieldTipName = "设计子表"
|
||||
// + "-" + "生命周期阶段";
|
||||
//
|
||||
//
|
||||
// fieldTipName = "设计子表"
|
||||
// + "-" + "是否公海客户";
|
||||
//
|
||||
//
|
||||
// fieldTipName = "设计子表"
|
||||
// + "-" + "最后一次跟进日期";
|
||||
//
|
||||
// }
|
||||
if (form.getMdmCompanyContactList()!=null){
|
||||
|
||||
fieldTipName = "联系人信息"
|
||||
+ "-" + "联系人";
|
||||
|
||||
|
||||
fieldTipName = "联系人信息"
|
||||
+ "-" + "联系人职务";
|
||||
|
||||
|
||||
fieldTipName = "联系人信息"
|
||||
+ "-" + "电话";
|
||||
|
||||
|
||||
fieldTipName = "联系人信息"
|
||||
+ "-" + "邮箱";
|
||||
|
||||
|
||||
fieldTipName = "联系人信息"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
if (form.getMdmCompanyBankList()!=null){
|
||||
|
||||
fieldTipName = "银行信息"
|
||||
+ "-" + "银行账号";
|
||||
|
||||
|
||||
fieldTipName = "银行信息"
|
||||
+ "-" + "开户行";
|
||||
|
||||
|
||||
fieldTipName = "银行信息"
|
||||
+ "-" + "账户名";
|
||||
|
||||
|
||||
fieldTipName = "银行信息"
|
||||
+ "-" + "开户行城市";
|
||||
|
||||
|
||||
fieldTipName = "银行信息"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
return countRecover;
|
||||
}
|
||||
private void setIfNotNull(Consumer<String> setter, Object value) {
|
||||
if (value != null && StringUtils.hasText(String.valueOf(value))) {
|
||||
setter.accept(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param mdmCompanyForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(MdmCompanyForm mdmCompanyForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
mdmCompanyForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(MdmCompanyConstant.getFormData(),mdmCompanyForm,MdmCompanyConstant.TABLERENAMES),MdmCompanyForm.class);
|
||||
MdmCompanyEntity entity = JsonUtil.getJsonToBean(mdmCompanyForm, MdmCompanyEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setCompanyId(mainUuid);
|
||||
entity.setVersion(0);
|
||||
} else {
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
if(!b){
|
||||
throw new DataException("当前表单原数据已被调整,请重新进入该页面编辑并提交数据");
|
||||
}
|
||||
MdmCompanyEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
//CrmCustomer子表数据新增修改
|
||||
QueryWrapper<CrmCustomerEntity> CrmCustomerqueryWrapper = new QueryWrapper<>();
|
||||
CrmCustomerqueryWrapper.lambda().eq(CrmCustomerEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !ObjectUtil.isNotEmpty(mdmCompanyForm.getOwnerId())){
|
||||
crmCustomerService.remove(CrmCustomerqueryWrapper);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(mdmCompanyForm.getOwnerId())){
|
||||
CrmCustomerEntity customer = new CrmCustomerEntity();
|
||||
// 必须赋值
|
||||
customer.setCompanyId(info.getCompanyId());
|
||||
// 下面全部 非null、非空字符串 才会设置
|
||||
setIfNotNull(customer::setOwnerId, mdmCompanyForm.getOwnerId());
|
||||
setIfNotNull(customer::setOrgId, mdmCompanyForm.getOrgId());
|
||||
setIfNotNull(customer::setCustomerLevel, mdmCompanyForm.getCustomerLevel());
|
||||
setIfNotNull(customer::setCustomerLifecycle, mdmCompanyForm.getCustomerLifecycle());
|
||||
setIfNotNull(customer::setIsPublic, mdmCompanyForm.getIsPublic());
|
||||
// //移除的数据
|
||||
if(StringUtil.isNotEmpty(customer.getCustomerId())){
|
||||
CrmCustomerqueryWrapper.lambda().eq(CrmCustomerEntity::getCustomerId,customer.getCustomerId());
|
||||
}
|
||||
crmCustomerService.remove(CrmCustomerqueryWrapper);
|
||||
// for(CrmCustomerEntity entitys : tableField798457){
|
||||
// entitys.setCompanyId(entity.getCompanyId());
|
||||
// if(entitys.getCustomerId()==null){
|
||||
// entitys.setCustomerId(RandomUtil.uuId());
|
||||
// }
|
||||
// crmCustomerService.saveOrUpdate(entitys);
|
||||
// }
|
||||
crmCustomerService.save(customer);
|
||||
}
|
||||
//MdmCompanyContact子表数据新增修改
|
||||
QueryWrapper<MdmCompanyContactEntity> MdmCompanyContactqueryWrapper = new QueryWrapper<>();
|
||||
MdmCompanyContactqueryWrapper.lambda().eq(MdmCompanyContactEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(mdmCompanyForm.getMdmCompanyContactList())){
|
||||
mdmCompanyContactService.remove(MdmCompanyContactqueryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(mdmCompanyForm.getMdmCompanyContactList())){
|
||||
List<MdmCompanyContactEntity> tableFieldc4fb23 = JsonUtil.getJsonToList(mdmCompanyForm.getMdmCompanyContactList(),MdmCompanyContactEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableFieldc4fb23.stream().filter(t->t.getContactId()!=null).map(MdmCompanyContactEntity::getContactId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
MdmCompanyContactqueryWrapper.lambda().notIn(MdmCompanyContactEntity::getContactId,childIds);
|
||||
}
|
||||
mdmCompanyContactService.remove(MdmCompanyContactqueryWrapper);
|
||||
for(MdmCompanyContactEntity entitys : tableFieldc4fb23){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(entitys.getContactId()==null){
|
||||
entitys.setContactId(RandomUtil.uuId());
|
||||
}
|
||||
mdmCompanyContactService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
//MdmCompanyBank子表数据新增修改
|
||||
QueryWrapper<MdmCompanyBankEntity> MdmCompanyBankqueryWrapper = new QueryWrapper<>();
|
||||
MdmCompanyBankqueryWrapper.lambda().eq(MdmCompanyBankEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(mdmCompanyForm.getMdmCompanyBankList())){
|
||||
mdmCompanyBankService.remove(MdmCompanyBankqueryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(mdmCompanyForm.getMdmCompanyBankList())){
|
||||
List<MdmCompanyBankEntity> tableFieldaafa82 = JsonUtil.getJsonToList(mdmCompanyForm.getMdmCompanyBankList(),MdmCompanyBankEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableFieldaafa82.stream().filter(t->t.getBankId()!=null).map(MdmCompanyBankEntity::getBankId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
MdmCompanyBankqueryWrapper.lambda().notIn(MdmCompanyBankEntity::getBankId,childIds);
|
||||
}
|
||||
mdmCompanyBankService.remove(MdmCompanyBankqueryWrapper);
|
||||
for(MdmCompanyBankEntity entitys : tableFieldaafa82){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(entitys.getBankId()==null){
|
||||
entitys.setBankId(RandomUtil.uuId());
|
||||
}
|
||||
mdmCompanyBankService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,364 +0,0 @@
|
||||
|
||||
package com.yunzhupaas.base.service.impl;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.mapper.MdmContractTypeMapper;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.base.model.mdmcontracttype.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import java.math.BigDecimal;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* mdmContractType
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-30
|
||||
*/
|
||||
@Service
|
||||
public class MdmContractTypeServiceImpl extends SuperServiceImpl<MdmContractTypeMapper, MdmContractTypeEntity> implements MdmContractTypeService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Override
|
||||
public List<MdmContractTypeEntity> getList(MdmContractTypePagination mdmContractTypePagination){
|
||||
return getTypeList(mdmContractTypePagination,mdmContractTypePagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<MdmContractTypeEntity> getTypeList(MdmContractTypePagination mdmContractTypePagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_contract_type",MdmContractTypeEntity.class);
|
||||
|
||||
MPJLambdaWrapper<MdmContractTypeEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_contract_type",MdmContractTypeEntity.class)
|
||||
.selectAll(MdmContractTypeEntity.class);
|
||||
MPJLambdaWrapper<MdmContractTypeEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_contract_type",MdmContractTypeEntity.class)
|
||||
.distinct().select(MdmContractTypeEntity::getId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(MdmContractTypeConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? MdmContractTypeConstant.getAppColumnData() : MdmContractTypeConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(mdmContractTypePagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = false;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(mdmContractTypePagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(mdmContractTypePagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(mdmContractTypePagination, wrapper, isPc);
|
||||
otherConditions(mdmContractTypePagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) mdmContractTypePagination.getCurrentPage(), (int) mdmContractTypePagination.getPageSize(), true);
|
||||
List<MdmContractTypeEntity> userIPage = this.selectJoinList(MdmContractTypeEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(MdmContractTypeEntity::getId,collect);
|
||||
}
|
||||
List<MdmContractTypeEntity> result = this.selectJoinList(MdmContractTypeEntity.class, wrapper);
|
||||
return mdmContractTypePagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<MdmContractTypeEntity> list = this.selectJoinList(MdmContractTypeEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(mdmContractTypePagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(MdmContractTypePagination mdmContractTypePagination, MPJLambdaWrapper<MdmContractTypeEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.isNull(MdmContractTypeEntity::getDeleteMark);
|
||||
|
||||
wrapper.isNull(MdmContractTypeEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(mdmContractTypePagination.getYunzhupaasKeyword())){
|
||||
if(isPc){
|
||||
wrapper.and(t -> {
|
||||
t.like(MdmContractTypeEntity::getContractTypeName,mdmContractTypePagination.getYunzhupaasKeyword()).or();
|
||||
});
|
||||
}
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(mdmContractTypePagination.getContractTypeCode())){
|
||||
String value = mdmContractTypePagination.getContractTypeCode() instanceof List ?
|
||||
JsonUtil.getObjectToString(mdmContractTypePagination.getContractTypeCode()) :
|
||||
String.valueOf(mdmContractTypePagination.getContractTypeCode());
|
||||
wrapper.like(MdmContractTypeEntity::getContractTypeCode,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(mdmContractTypePagination.getContractTypeName())){
|
||||
String value = mdmContractTypePagination.getContractTypeName() instanceof List ?
|
||||
JsonUtil.getObjectToString(mdmContractTypePagination.getContractTypeName()) :
|
||||
String.valueOf(mdmContractTypePagination.getContractTypeName());
|
||||
wrapper.like(MdmContractTypeEntity::getContractTypeName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(mdmContractTypePagination.getContractMode())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] contractMode = JsonUtil.getJsonToBean(mdmContractTypePagination.getContractMode(),String[][].class);
|
||||
for(int i=0;i<contractMode.length;i++){
|
||||
if(contractMode[i].length>0){
|
||||
idList.add(JsonUtil.getObjectToString(Arrays.asList(contractMode[i])));
|
||||
}
|
||||
}
|
||||
}catch (Exception e1){
|
||||
try {
|
||||
List<String> contractMode = JsonUtil.getJsonToList(mdmContractTypePagination.getContractMode(),String.class);
|
||||
if(contractMode.size()>0){
|
||||
idList.addAll(contractMode);
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(mdmContractTypePagination.getContractMode()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(MdmContractTypeEntity::getContractMode, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(mdmContractTypePagination.getProjectType())){
|
||||
String value = mdmContractTypePagination.getProjectType() instanceof List ?
|
||||
JsonUtil.getObjectToString(mdmContractTypePagination.getProjectType()) :
|
||||
String.valueOf(mdmContractTypePagination.getProjectType());
|
||||
wrapper.like(MdmContractTypeEntity::getProjectType,value);
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(mdmContractTypePagination.getSidx())){
|
||||
wrapper.orderByDesc(MdmContractTypeEntity::getId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = mdmContractTypePagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
MdmContractTypeEntity mdmContractTypeEntity = new MdmContractTypeEntity();
|
||||
String oderTableField = mdmContractTypeEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = mdmContractTypeEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public MdmContractTypeEntity getInfo(String id){
|
||||
MPJLambdaWrapper<MdmContractTypeEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_contract_type",MdmContractTypeEntity.class)
|
||||
.selectAll(MdmContractTypeEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(MdmContractTypeEntity::getId, id )
|
||||
.or().eq(MdmContractTypeEntity::getFlowTaskId, id)
|
||||
);
|
||||
return this.selectJoinOne(MdmContractTypeEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(MdmContractTypeEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String id, MdmContractTypeEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(MdmContractTypeEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(MdmContractTypeForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getId();
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "合同类型编码";
|
||||
if(StringUtil.isEmpty(form.getContractTypeCode())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getContractTypeCode())){
|
||||
form.setContractTypeCode(form.getContractTypeCode().trim());
|
||||
QueryWrapper<MdmContractTypeEntity> contract_type_codeWrapper=new QueryWrapper<>();
|
||||
contract_type_codeWrapper.lambda().eq(MdmContractTypeEntity::getContractTypeCode,form.getContractTypeCode());
|
||||
contract_type_codeWrapper.lambda().isNull(MdmContractTypeEntity::getFlowId);
|
||||
//假删除标志
|
||||
contract_type_codeWrapper.lambda().isNull(MdmContractTypeEntity::getDeleteMark);
|
||||
if (isUp){
|
||||
contract_type_codeWrapper.lambda().ne(MdmContractTypeEntity::getId, id);
|
||||
}
|
||||
if((int) this.count(contract_type_codeWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "合同类型名称";
|
||||
if(StringUtil.isEmpty(form.getContractTypeName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getContractTypeName())){
|
||||
form.setContractTypeName(form.getContractTypeName().trim());
|
||||
QueryWrapper<MdmContractTypeEntity> contract_type_nameWrapper=new QueryWrapper<>();
|
||||
contract_type_nameWrapper.lambda().eq(MdmContractTypeEntity::getContractTypeName,form.getContractTypeName());
|
||||
contract_type_nameWrapper.lambda().isNull(MdmContractTypeEntity::getFlowId);
|
||||
//假删除标志
|
||||
contract_type_nameWrapper.lambda().isNull(MdmContractTypeEntity::getDeleteMark);
|
||||
if (isUp){
|
||||
contract_type_nameWrapper.lambda().ne(MdmContractTypeEntity::getId, id);
|
||||
}
|
||||
if((int) this.count(contract_type_nameWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "项目类型";
|
||||
fieldTipName = "合同模式";
|
||||
fieldTipName = "材料清单";
|
||||
fieldTipName = "材料清单别名";
|
||||
fieldTipName = "材料清单顺序";
|
||||
fieldTipName = "租赁清单";
|
||||
fieldTipName = "租赁清单别名";
|
||||
fieldTipName = "租赁清单顺序";
|
||||
fieldTipName = "劳务清单";
|
||||
fieldTipName = "劳务清单别名";
|
||||
fieldTipName = "劳务清单顺序";
|
||||
fieldTipName = "工程量清单";
|
||||
fieldTipName = "工程量清单别名";
|
||||
fieldTipName = "工程量清单顺序";
|
||||
fieldTipName = "在线合同模板";
|
||||
fieldTipName = "工作流程";
|
||||
fieldTipName = "流程模板ID,关联流程模板表";
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param mdmContractTypeForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(MdmContractTypeForm mdmContractTypeForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
mdmContractTypeForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(MdmContractTypeConstant.getFormData(),mdmContractTypeForm,MdmContractTypeConstant.TABLERENAMES),MdmContractTypeForm.class);
|
||||
MdmContractTypeEntity entity = JsonUtil.getJsonToBean(mdmContractTypeForm, MdmContractTypeEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setId(mainUuid);
|
||||
entity.setVersion(0);
|
||||
} else {
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
if(!b){
|
||||
throw new DataException("当前表单原数据已被调整,请重新进入该页面编辑并提交数据");
|
||||
}
|
||||
MdmContractTypeEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,333 +0,0 @@
|
||||
|
||||
package com.yunzhupaas.base.service.impl;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.mapper.MdmProjectMapper;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.base.model.mdmproject.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import java.math.BigDecimal;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* 项目结构
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
*/
|
||||
@Service
|
||||
public class MdmProjectServiceImpl extends SuperServiceImpl<MdmProjectMapper, MdmProjectEntity> implements MdmProjectService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Override
|
||||
public List<MdmProjectEntity> getList(MdmProjectPagination mdmProjectPagination){
|
||||
return getTypeList(mdmProjectPagination,mdmProjectPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<MdmProjectEntity> getTypeList(MdmProjectPagination mdmProjectPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_project",MdmProjectEntity.class);
|
||||
|
||||
MPJLambdaWrapper<MdmProjectEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_project",MdmProjectEntity.class)
|
||||
.selectAll(MdmProjectEntity.class);
|
||||
MPJLambdaWrapper<MdmProjectEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_project",MdmProjectEntity.class)
|
||||
.distinct().select(MdmProjectEntity::getProjectId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(MdmProjectConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? MdmProjectConstant.getAppColumnData() : MdmProjectConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(mdmProjectPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = false;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(mdmProjectPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(mdmProjectPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(mdmProjectPagination, wrapper, isPc);
|
||||
otherConditions(mdmProjectPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) mdmProjectPagination.getCurrentPage(), (int) mdmProjectPagination.getPageSize(), true);
|
||||
List<MdmProjectEntity> userIPage = this.selectJoinList(MdmProjectEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getProjectId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(MdmProjectEntity::getProjectId,collect);
|
||||
}
|
||||
List<MdmProjectEntity> result = this.selectJoinList(MdmProjectEntity.class, wrapper);
|
||||
return mdmProjectPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<MdmProjectEntity> list = this.selectJoinList(MdmProjectEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(mdmProjectPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getProjectId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(MdmProjectPagination mdmProjectPagination, MPJLambdaWrapper<MdmProjectEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
wrapper.isNull(MdmProjectEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(mdmProjectPagination.getYunzhupaasKeyword())){
|
||||
if(isPc){
|
||||
wrapper.and(t -> {
|
||||
t.like(MdmProjectEntity::getProjectName,mdmProjectPagination.getYunzhupaasKeyword()).or();
|
||||
});
|
||||
}
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(mdmProjectPagination.getProjectName())){
|
||||
String value = mdmProjectPagination.getProjectName() instanceof List ?
|
||||
JsonUtil.getObjectToString(mdmProjectPagination.getProjectName()) :
|
||||
String.valueOf(mdmProjectPagination.getProjectName());
|
||||
wrapper.like(MdmProjectEntity::getProjectName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(mdmProjectPagination.getOrgId())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] orgId = JsonUtil.getJsonToBean(mdmProjectPagination.getOrgId(),String[][].class);
|
||||
for(int i=0;i<orgId.length;i++){
|
||||
if(orgId[i].length>0){
|
||||
idList.add(JsonUtil.getObjectToString(Arrays.asList(orgId[i])));
|
||||
}
|
||||
}
|
||||
}catch (Exception e1){
|
||||
try {
|
||||
List<String> orgId = JsonUtil.getJsonToList(mdmProjectPagination.getOrgId(),String.class);
|
||||
if(orgId.size()>0){
|
||||
idList.add(JsonUtil.getObjectToString(orgId));
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(mdmProjectPagination.getOrgId()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(MdmProjectEntity::getOrgId, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(mdmProjectPagination.getProjectStateId())){
|
||||
wrapper.eq(MdmProjectEntity::getProjectStateId,mdmProjectPagination.getProjectStateId());
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(mdmProjectPagination.getSidx())){
|
||||
wrapper.orderByDesc(MdmProjectEntity::getProjectId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = mdmProjectPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
MdmProjectEntity mdmProjectEntity = new MdmProjectEntity();
|
||||
String oderTableField = mdmProjectEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = mdmProjectEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public MdmProjectEntity getInfo(String projectid){
|
||||
MPJLambdaWrapper<MdmProjectEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_project",MdmProjectEntity.class)
|
||||
.selectAll(MdmProjectEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(MdmProjectEntity::getProjectId, projectid )
|
||||
.or().eq(MdmProjectEntity::getFlowTaskId, projectid)
|
||||
);
|
||||
return this.selectJoinOne(MdmProjectEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(MdmProjectEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String projectid, MdmProjectEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(MdmProjectEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getProjectId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(MdmProjectForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getProjectId()) && !form.getProjectId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getProjectId();
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "项目编码";
|
||||
if(StringUtil.isEmpty(form.getProjectCode())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getProjectCode())){
|
||||
form.setProjectCode(form.getProjectCode().trim());
|
||||
QueryWrapper<MdmProjectEntity> project_codeWrapper=new QueryWrapper<>();
|
||||
project_codeWrapper.lambda().eq(MdmProjectEntity::getProjectCode,form.getProjectCode());
|
||||
project_codeWrapper.lambda().isNull(MdmProjectEntity::getFlowId);
|
||||
if (isUp){
|
||||
project_codeWrapper.lambda().ne(MdmProjectEntity::getProjectId, id);
|
||||
}
|
||||
if((int) this.count(project_codeWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "项目名称";
|
||||
if(StringUtil.isEmpty(form.getProjectName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getProjectName())){
|
||||
form.setProjectName(form.getProjectName().trim());
|
||||
QueryWrapper<MdmProjectEntity> project_nameWrapper=new QueryWrapper<>();
|
||||
project_nameWrapper.lambda().eq(MdmProjectEntity::getProjectName,form.getProjectName());
|
||||
project_nameWrapper.lambda().isNull(MdmProjectEntity::getFlowId);
|
||||
if (isUp){
|
||||
project_nameWrapper.lambda().ne(MdmProjectEntity::getProjectId, id);
|
||||
}
|
||||
if((int) this.count(project_nameWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "上级项目";
|
||||
fieldTipName = "归属组织";
|
||||
fieldTipName = "项目类型";
|
||||
fieldTipName = "启动日期";
|
||||
fieldTipName = "项目状态";
|
||||
fieldTipName = "顺序号";
|
||||
fieldTipName = "备注";
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param mdmProjectForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(MdmProjectForm mdmProjectForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
mdmProjectForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(MdmProjectConstant.getFormData(),mdmProjectForm,MdmProjectConstant.TABLERENAMES),MdmProjectForm.class);
|
||||
MdmProjectEntity entity = JsonUtil.getJsonToBean(mdmProjectForm, MdmProjectEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setProjectId(mainUuid);
|
||||
} else {
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
MdmProjectEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.yunzhupaas.base.mapper;
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.base.entity.MdmProjectEntity;
|
||||
import com.yunzhupaas.mdm.entity.AssetEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 项目结构
|
||||
* 资产信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
* 日期: 2026-04-28
|
||||
*/
|
||||
public interface MdmProjectMapper extends SuperMapper<MdmProjectEntity> {
|
||||
public interface AssetMapper extends SuperMapper<AssetEntity> {
|
||||
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.yunzhupaas.base.mapper;
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.base.entity.BcmProjectTypeEntity;
|
||||
import com.yunzhupaas.mdm.entity.CompanyBankEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface BcmProjectTypeMapper extends SuperMapper<BcmProjectTypeEntity> {
|
||||
public interface CompanyBankMapper extends SuperMapper<CompanyBankEntity> {
|
||||
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.yunzhupaas.base.mapper;
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.base.entity.MdmCompanyContactEntity;
|
||||
import com.yunzhupaas.mdm.entity.CompanyInvoiceEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface MdmCompanyContactMapper extends SuperMapper<MdmCompanyContactEntity> {
|
||||
public interface CompanyInvoiceMapper extends SuperMapper<CompanyInvoiceEntity>, BaseMapper<CompanyInvoiceEntity> {
|
||||
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.yunzhupaas.base.mapper;
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.base.entity.MdmCompanyEntity;
|
||||
import com.yunzhupaas.mdm.entity.CompanyEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface MdmCompanyMapper extends SuperMapper<MdmCompanyEntity> {
|
||||
public interface CompanyMapper extends SuperMapper<CompanyEntity> {
|
||||
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.yunzhupaas.base.mapper;
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.base.entity.MdmCompanyBankEntity;
|
||||
import com.yunzhupaas.mdm.entity.CorporationEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface MdmCompanyBankMapper extends SuperMapper<MdmCompanyBankEntity> {
|
||||
public interface CorporationMapper extends SuperMapper<CorporationEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.mdm.entity.CustomerEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 客户信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface CustomersMapper extends SuperMapper<CustomerEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.mdm.entity.MaterialEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 物料信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-27
|
||||
*/
|
||||
public interface MaterialMapper extends SuperMapper<MaterialEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.mdm.entity.PanyInvoiceEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 供应商信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface PanyInvoiceMapper extends SuperMapper<PanyInvoiceEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.mdm.entity.ProductEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 商品信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-27
|
||||
*/
|
||||
public interface ProductsMapper extends SuperMapper<ProductEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.mdm.entity.SupplierEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 供应商信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface SupplierMapper extends SuperMapper<SupplierEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.mdm.model.asset.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 资产信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-28
|
||||
*/
|
||||
public interface AssetService extends SuperService<AssetEntity> {
|
||||
List<AssetEntity> getList(AssetPagination assetPagination);
|
||||
|
||||
List<AssetEntity> getTypeList(AssetPagination assetPagination,String dataType);
|
||||
|
||||
AssetEntity getInfo(String assetid);
|
||||
|
||||
void delete(AssetEntity entity);
|
||||
|
||||
void create(AssetEntity entity);
|
||||
|
||||
boolean update(String assetid, AssetEntity entity);
|
||||
|
||||
String checkForm(AssetForm form,int i);
|
||||
|
||||
void saveOrUpdate(AssetForm assetForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.yunzhupaas.base.service;
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface MdmCompanyBankService extends SuperService<MdmCompanyBankEntity> {
|
||||
public interface CompanyBankService extends SuperService<CompanyBankEntity> {
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.yunzhupaas.base.service;
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface MdmCompanyContactService extends SuperService<MdmCompanyContactEntity> {
|
||||
public interface CompanyInvoiceService extends SuperService<CompanyInvoiceEntity> {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.mdm.model.company.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface CompanyService extends SuperService<CompanyEntity> {
|
||||
List<CompanyEntity> getList(CompanyPagination companyPagination);
|
||||
|
||||
List<CompanyEntity> getTypeList(CompanyPagination companyPagination,String dataType);
|
||||
|
||||
CompanyEntity getInfo(String companyid);
|
||||
|
||||
void delete(CompanyEntity entity);
|
||||
|
||||
void create(CompanyEntity entity);
|
||||
|
||||
boolean update(String companyid, CompanyEntity entity);
|
||||
|
||||
String checkForm(CompanyForm form,int i);
|
||||
|
||||
void saveOrUpdate(CompanyForm companyForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
|
||||
/**
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface CorporationService extends SuperService<CorporationEntity> {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.mdm.model.custinfo.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 客户信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface CustinfoService extends SuperService<CompanyEntity> {
|
||||
List<CompanyEntity> getList(CustinfoPagination companyPagination);
|
||||
|
||||
List<CompanyEntity> getTypeList(CustinfoPagination companyPagination,String dataType);
|
||||
|
||||
CompanyEntity getInfo(String companyid);
|
||||
|
||||
void delete(CompanyEntity entity);
|
||||
|
||||
void create(CompanyEntity entity);
|
||||
|
||||
boolean update(String companyid, CompanyEntity entity);
|
||||
|
||||
String checkForm(CustinfoForm form,int i);
|
||||
|
||||
void saveOrUpdate(CustinfoForm companyForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
|
||||
/**
|
||||
* 客户信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface CustomerService extends SuperService<CustomerEntity> {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.mdm.model.lpc.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface LpcService extends SuperService<CompanyEntity> {
|
||||
List<CompanyEntity> getList(LpcPagination companyPagination);
|
||||
|
||||
List<CompanyEntity> getTypeList(LpcPagination companyPagination,String dataType);
|
||||
|
||||
CompanyEntity getInfo(String companyid);
|
||||
|
||||
void delete(CompanyEntity entity);
|
||||
|
||||
void create(CompanyEntity entity);
|
||||
|
||||
boolean update(String companyid, CompanyEntity entity);
|
||||
|
||||
String checkForm(LpcForm form,int i);
|
||||
|
||||
void saveOrUpdate(LpcForm companyForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.mdm.model.material.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 物料信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-27
|
||||
*/
|
||||
public interface MaterialService extends SuperService<MaterialEntity> {
|
||||
List<MaterialEntity> getList(MaterialPagination materialPagination);
|
||||
|
||||
List<MaterialEntity> getTypeList(MaterialPagination materialPagination,String dataType);
|
||||
|
||||
MaterialEntity getInfo(String materialid);
|
||||
|
||||
void delete(MaterialEntity entity);
|
||||
|
||||
void create(MaterialEntity entity);
|
||||
|
||||
boolean update(String materialid, MaterialEntity entity);
|
||||
|
||||
String checkForm(MaterialForm form,int i);
|
||||
|
||||
void saveOrUpdate(MaterialForm materialForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
|
||||
/**
|
||||
* 供应商信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface PanyInvoiceService extends SuperService<PanyInvoiceEntity> {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.mdm.model.product.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 商品信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-27
|
||||
*/
|
||||
public interface ProductsService extends SuperService<ProductEntity> {
|
||||
List<ProductEntity> getList(ProductPagination productPagination);
|
||||
|
||||
List<ProductEntity> getTypeList(ProductPagination productPagination,String dataType);
|
||||
|
||||
ProductEntity getInfo(String productid);
|
||||
|
||||
void delete(ProductEntity entity);
|
||||
|
||||
void create(ProductEntity entity);
|
||||
|
||||
boolean update(String productid, ProductEntity entity);
|
||||
|
||||
String checkForm(ProductForm form,int i);
|
||||
|
||||
void saveOrUpdate(ProductForm productForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.mdm.model.suppinfo.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 供应商信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface SuppinfoService extends SuperService<CompanyEntity> {
|
||||
List<CompanyEntity> getList(SuppinfoPagination companyPagination);
|
||||
|
||||
List<CompanyEntity> getTypeList(SuppinfoPagination companyPagination,String dataType);
|
||||
|
||||
CompanyEntity getInfo(String companyid);
|
||||
|
||||
void delete(CompanyEntity entity);
|
||||
|
||||
void create(CompanyEntity entity);
|
||||
|
||||
boolean update(String companyid, CompanyEntity entity);
|
||||
|
||||
String checkForm(SuppinfoForm form,int i);
|
||||
|
||||
void saveOrUpdate(SuppinfoForm companyForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
|
||||
/**
|
||||
* 供应商信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
public interface SupplierService extends SuperService<SupplierEntity> {
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.AssetMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.mdm.model.asset.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import java.math.BigDecimal;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* 资产信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-28
|
||||
*/
|
||||
@Service
|
||||
public class AssetServiceImpl extends SuperServiceImpl<AssetMapper, AssetEntity> implements AssetService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Override
|
||||
public List<AssetEntity> getList(AssetPagination assetPagination){
|
||||
return getTypeList(assetPagination,assetPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<AssetEntity> getTypeList(AssetPagination assetPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_asset",AssetEntity.class);
|
||||
|
||||
MPJLambdaWrapper<AssetEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_asset",AssetEntity.class)
|
||||
.selectAll(AssetEntity.class);
|
||||
MPJLambdaWrapper<AssetEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_asset",AssetEntity.class)
|
||||
.distinct().select(AssetEntity::getAssetId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(AssetConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? AssetConstant.getAppColumnData() : AssetConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(assetPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = true;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(assetPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(assetPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(assetPagination, wrapper, isPc);
|
||||
otherConditions(assetPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) assetPagination.getCurrentPage(), (int) assetPagination.getPageSize(), true);
|
||||
List<AssetEntity> userIPage = this.selectJoinList(AssetEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getAssetId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(AssetEntity::getAssetId,collect);
|
||||
}
|
||||
List<AssetEntity> result = this.selectJoinList(AssetEntity.class, wrapper);
|
||||
return assetPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<AssetEntity> list = this.selectJoinList(AssetEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(assetPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getAssetId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(AssetPagination assetPagination, MPJLambdaWrapper<AssetEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.isNull(AssetEntity::getDeleteMark);
|
||||
|
||||
wrapper.isNull(AssetEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(assetPagination.getYunzhupaasKeyword())){
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(assetPagination.getAssetCode())){
|
||||
String value = assetPagination.getAssetCode() instanceof List ?
|
||||
JsonUtil.getObjectToString(assetPagination.getAssetCode()) :
|
||||
String.valueOf(assetPagination.getAssetCode());
|
||||
wrapper.like(AssetEntity::getAssetCode,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(assetPagination.getAssetName())){
|
||||
String value = assetPagination.getAssetName() instanceof List ?
|
||||
JsonUtil.getObjectToString(assetPagination.getAssetName()) :
|
||||
String.valueOf(assetPagination.getAssetName());
|
||||
wrapper.like(AssetEntity::getAssetName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(assetPagination.getAssetStatus())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] assetStatus = JsonUtil.getJsonToBean(assetPagination.getAssetStatus(),String[][].class);
|
||||
for(int i=0;i<assetStatus.length;i++){
|
||||
if(assetStatus[i].length>0){
|
||||
idList.add(JsonUtil.getObjectToString(Arrays.asList(assetStatus[i])));
|
||||
}
|
||||
}
|
||||
}catch (Exception e1){
|
||||
try {
|
||||
List<String> assetStatus = JsonUtil.getJsonToList(assetPagination.getAssetStatus(),String.class);
|
||||
if(assetStatus.size()>0){
|
||||
idList.addAll(assetStatus);
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(assetPagination.getAssetStatus()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(AssetEntity::getAssetStatus, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(assetPagination.getPurchaseDate())){
|
||||
List PurchaseDateList = JsonUtil.getJsonToList(assetPagination.getPurchaseDate(),String.class);
|
||||
for(int i=0;i<PurchaseDateList.size();i++){
|
||||
String id = String.valueOf(PurchaseDateList.get(i));
|
||||
boolean idAll = StringUtil.isNotEmpty(id) && !id.equals("null");
|
||||
if(idAll){
|
||||
Object b= new Date(Long.valueOf(id));
|
||||
if(i==0){
|
||||
wrapper.ge(AssetEntity::getPurchaseDate,b);
|
||||
}else{
|
||||
wrapper.le(AssetEntity::getPurchaseDate,b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(assetPagination.getCommissioningDate())){
|
||||
List CommissioningDateList = JsonUtil.getJsonToList(assetPagination.getCommissioningDate(),String.class);
|
||||
for(int i=0;i<CommissioningDateList.size();i++){
|
||||
String id = String.valueOf(CommissioningDateList.get(i));
|
||||
boolean idAll = StringUtil.isNotEmpty(id) && !id.equals("null");
|
||||
if(idAll){
|
||||
Object b= new Date(Long.valueOf(id));
|
||||
if(i==0){
|
||||
wrapper.ge(AssetEntity::getCommissioningDate,b);
|
||||
}else{
|
||||
wrapper.le(AssetEntity::getCommissioningDate,b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(assetPagination.getAssetType())){
|
||||
wrapper.eq(AssetEntity::getAssetType,assetPagination.getAssetType());
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(assetPagination.getSidx())){
|
||||
wrapper.orderByDesc(AssetEntity::getAssetId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = assetPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
AssetEntity assetEntity = new AssetEntity();
|
||||
String oderTableField = assetEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = assetEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public AssetEntity getInfo(String assetid){
|
||||
MPJLambdaWrapper<AssetEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_asset",AssetEntity.class)
|
||||
.selectAll(AssetEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(AssetEntity::getAssetId, assetid )
|
||||
.or().eq(AssetEntity::getFlowTaskId, assetid)
|
||||
);
|
||||
return this.selectJoinOne(AssetEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(AssetEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String assetid, AssetEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(AssetEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getAssetId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(AssetForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getAssetId()) && !form.getAssetId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getAssetId();
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "资产编码";
|
||||
fieldTipName = "资产名称";
|
||||
if(StringUtil.isEmpty(form.getAssetName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
fieldTipName = "资产类型";
|
||||
fieldTipName = "资产分类";
|
||||
fieldTipName = "资产状态";
|
||||
fieldTipName = "资产位置";
|
||||
fieldTipName = "使用组织";
|
||||
fieldTipName = "保管用户";
|
||||
fieldTipName = "资产权属";
|
||||
fieldTipName = "单位";
|
||||
fieldTipName = "数量";
|
||||
fieldTipName = "购置日期";
|
||||
fieldTipName = "启用日期";
|
||||
fieldTipName = "预计使用年限";
|
||||
fieldTipName = "供应商";
|
||||
fieldTipName = "备注";
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param assetForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(AssetForm assetForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
assetForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(AssetConstant.getFormData(),assetForm,AssetConstant.TABLERENAMES),AssetForm.class);
|
||||
AssetEntity entity = JsonUtil.getJsonToBean(assetForm, AssetEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setAssetCode(generaterSwapUtil.getBillNumber("assetCode", false));
|
||||
entity.setAssetId(mainUuid);
|
||||
} else {
|
||||
if(StringUtil.isEmpty(entity.getAssetCode()) ){
|
||||
entity.setAssetCode(generaterSwapUtil.getBillNumber("assetCode", false));
|
||||
}
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
AssetEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.CompanyBankMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class CompanyBankServiceImpl extends SuperServiceImpl<CompanyBankMapper, CompanyBankEntity> implements CompanyBankService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.CompanyInvoiceMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class CompanyInvoiceServiceImpl extends SuperServiceImpl<CompanyInvoiceMapper, CompanyInvoiceEntity> implements CompanyInvoiceService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
}
|
||||
@@ -0,0 +1,485 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.CompanyMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.mdm.model.company.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import java.math.BigDecimal;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* 企业信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class CompanyServiceImpl extends SuperServiceImpl<CompanyMapper, CompanyEntity> implements CompanyService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Autowired
|
||||
private CompanyBankService mdmCompanyBankService;
|
||||
@Autowired
|
||||
private CompanyInvoiceService companyInvoiceService;
|
||||
@Override
|
||||
public List<CompanyEntity> getList(CompanyPagination companyPagination){
|
||||
return getTypeList(companyPagination,companyPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<CompanyEntity> getTypeList(CompanyPagination companyPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_company",CompanyEntity.class);
|
||||
tableClassMap.put("mdm_company_bank",CompanyBankEntity.class);
|
||||
tableClassMap.put("mdm_company_invoice",CompanyInvoiceEntity.class);
|
||||
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.selectCollection(CompanyBankEntity.class,CompanyEntity::getCompanyBank)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(CompanyInvoiceEntity.class,CompanyEntity::getCompanyInvoice)
|
||||
.leftJoin(CompanyInvoiceEntity.class,"mdm_company_invoice",CompanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAll(CompanyEntity.class);
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.leftJoin(CompanyInvoiceEntity.class,"mdm_company_invoice",CompanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.distinct().select(CompanyEntity::getCompanyId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(CompanyConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? CompanyConstant.getAppColumnData() : CompanyConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(companyPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = true;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(companyPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(companyPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(companyPagination, wrapper, isPc);
|
||||
otherConditions(companyPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) companyPagination.getCurrentPage(), (int) companyPagination.getPageSize(), true);
|
||||
List<CompanyEntity> userIPage = this.selectJoinList(CompanyEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getCompanyId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(CompanyEntity::getCompanyId,collect);
|
||||
}
|
||||
List<CompanyEntity> result = this.selectJoinList(CompanyEntity.class, wrapper);
|
||||
return companyPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<CompanyEntity> list = this.selectJoinList(CompanyEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(companyPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getCompanyId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(CompanyPagination companyPagination, MPJLambdaWrapper<CompanyEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
wrapper.isNull(CompanyEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getYunzhupaasKeyword())){
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getCompanyName())){
|
||||
String value = companyPagination.getCompanyName() instanceof List ?
|
||||
JsonUtil.getObjectToString(companyPagination.getCompanyName()) :
|
||||
String.valueOf(companyPagination.getCompanyName());
|
||||
wrapper.like(CompanyEntity::getCompanyName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getOrgId())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] orgId = JsonUtil.getJsonToBean(companyPagination.getOrgId(),String[][].class);
|
||||
for(int i=0;i<orgId.length;i++){
|
||||
if(orgId[i].length>0){
|
||||
idList.add(JsonUtil.getObjectToString(Arrays.asList(orgId[i])));
|
||||
}
|
||||
}
|
||||
}catch (Exception e1){
|
||||
try {
|
||||
List<String> orgId = JsonUtil.getJsonToList(companyPagination.getOrgId(),String.class);
|
||||
if(orgId.size()>0){
|
||||
idList.add(JsonUtil.getObjectToString(orgId));
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(companyPagination.getOrgId()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(CompanyEntity::getOrgId, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(companyPagination.getSidx())){
|
||||
wrapper.orderByDesc(CompanyEntity::getCompanyId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = companyPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
CompanyEntity companyEntity = new CompanyEntity();
|
||||
String oderTableField = companyEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = companyEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public CompanyEntity getInfo(String companyid){
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.selectCollection(CompanyBankEntity.class,CompanyEntity::getCompanyBank)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(CompanyInvoiceEntity.class,CompanyEntity::getCompanyInvoice)
|
||||
.leftJoin(CompanyInvoiceEntity.class,"mdm_company_invoice",CompanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAll(CompanyEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(CompanyEntity::getCompanyId, companyid )
|
||||
.or().eq(CompanyEntity::getFlowTaskId, companyid)
|
||||
);
|
||||
return this.selectJoinOne(CompanyEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(CompanyEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String companyid, CompanyEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(CompanyEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getCompanyId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(CompanyForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getCompanyId()) && !form.getCompanyId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getCompanyId();
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "企业编码";
|
||||
fieldTipName = "企业名称";
|
||||
if(StringUtil.isEmpty(form.getCompanyName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getCompanyName())){
|
||||
form.setCompanyName(form.getCompanyName().trim());
|
||||
QueryWrapper<CompanyEntity> company_nameWrapper=new QueryWrapper<>();
|
||||
company_nameWrapper.lambda().eq(CompanyEntity::getCompanyName,form.getCompanyName());
|
||||
company_nameWrapper.lambda().isNull(CompanyEntity::getFlowId);
|
||||
if (isUp){
|
||||
company_nameWrapper.lambda().ne(CompanyEntity::getCompanyId, id);
|
||||
}
|
||||
if((int) this.count(company_nameWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "简称/昵称";
|
||||
fieldTipName = "类型";
|
||||
fieldTipName = "社会信用代码";
|
||||
if(StringUtil.isEmpty(form.getCreditCode())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getCreditCode())){
|
||||
form.setCreditCode(form.getCreditCode().trim());
|
||||
QueryWrapper<CompanyEntity> credit_codeWrapper=new QueryWrapper<>();
|
||||
credit_codeWrapper.lambda().eq(CompanyEntity::getCreditCode,form.getCreditCode());
|
||||
credit_codeWrapper.lambda().isNull(CompanyEntity::getFlowId);
|
||||
if (isUp){
|
||||
credit_codeWrapper.lambda().ne(CompanyEntity::getCompanyId, id);
|
||||
}
|
||||
if((int) this.count(credit_codeWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "归属组织";
|
||||
fieldTipName = "所属地区";
|
||||
fieldTipName = "纳税人类别";
|
||||
fieldTipName = "企业规模";
|
||||
fieldTipName = "企业类型";
|
||||
fieldTipName = "行业代码";
|
||||
fieldTipName = "成立日期";
|
||||
fieldTipName = "注册资本";
|
||||
fieldTipName = "法定代表人";
|
||||
fieldTipName = "联系电话";
|
||||
if(StringUtil.isNotEmpty(form.getPhone())){
|
||||
if(!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getPhone())).matches()){
|
||||
return I18nUtil.getMessageStr("sys.validate.telephone", "请输入正确的电话号码");
|
||||
}
|
||||
}
|
||||
fieldTipName = "邮箱";
|
||||
if(StringUtil.isNotEmpty(form.getEmail())){
|
||||
if(!Pattern.compile("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$").matcher(String.valueOf(form.getEmail())).matches()){
|
||||
return I18nUtil.getMessageStr("sys.validate.email", "请输入正确的邮箱");
|
||||
}
|
||||
}
|
||||
fieldTipName = "网站";
|
||||
fieldTipName = "地址";
|
||||
fieldTipName = "经营范围";
|
||||
fieldTipName = "备注";
|
||||
//子表字段验证
|
||||
if (form.getMdmCompanyBankList()!=null){
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户行";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "账户名";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "银行账号";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户行城市";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
if (form.getCompanyInvoiceList()!=null){
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "发票抬头编码";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "发票抬头名称";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "纳税人识别号";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "纳税人类别";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "地址";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "电话";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户银行";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "银行账户";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "是否默认";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "是否有效";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(CompanyForm companyForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
companyForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(CompanyConstant.getFormData(),companyForm,CompanyConstant.TABLERENAMES),CompanyForm.class);
|
||||
CompanyEntity entity = JsonUtil.getJsonToBean(companyForm, CompanyEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setCompanyCode(generaterSwapUtil.getBillNumber("companyCode", false));
|
||||
entity.setCompanyId(mainUuid);
|
||||
} else {
|
||||
if(StringUtil.isEmpty(entity.getCompanyCode()) ){
|
||||
entity.setCompanyCode(generaterSwapUtil.getBillNumber("companyCode", false));
|
||||
}
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
CompanyEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
//MdmCompanyBank子表数据新增修改
|
||||
QueryWrapper<CompanyBankEntity> MdmCompanyBankqueryWrapper = new QueryWrapper<>();
|
||||
MdmCompanyBankqueryWrapper.lambda().eq(CompanyBankEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(companyForm.getMdmCompanyBankList())){
|
||||
mdmCompanyBankService.remove(MdmCompanyBankqueryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(companyForm.getMdmCompanyBankList())){
|
||||
List<CompanyBankEntity> tableFieldad9d92 = JsonUtil.getJsonToList(companyForm.getMdmCompanyBankList(),CompanyBankEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableFieldad9d92.stream().filter(t->t.getBankId()!=null).map(CompanyBankEntity::getBankId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
MdmCompanyBankqueryWrapper.lambda().notIn(CompanyBankEntity::getBankId,childIds);
|
||||
}
|
||||
mdmCompanyBankService.remove(MdmCompanyBankqueryWrapper);
|
||||
for(CompanyBankEntity entitys : tableFieldad9d92){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(entitys.getBankId()==null){
|
||||
entitys.setBankId(RandomUtil.uuId());
|
||||
}
|
||||
mdmCompanyBankService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
//CompanyInvoice子表数据新增修改
|
||||
QueryWrapper<CompanyInvoiceEntity> CompanyInvoicequeryWrapper = new QueryWrapper<>();
|
||||
CompanyInvoicequeryWrapper.lambda().eq(CompanyInvoiceEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(companyForm.getCompanyInvoiceList())){
|
||||
companyInvoiceService.remove(CompanyInvoicequeryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(companyForm.getCompanyInvoiceList())){
|
||||
List<CompanyInvoiceEntity> tableField46dc53 = JsonUtil.getJsonToList(companyForm.getCompanyInvoiceList(),CompanyInvoiceEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableField46dc53.stream().filter(t->t.getInvoiceId()!=null).map(CompanyInvoiceEntity::getInvoiceId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
CompanyInvoicequeryWrapper.lambda().notIn(CompanyInvoiceEntity::getInvoiceId,childIds);
|
||||
}
|
||||
companyInvoiceService.remove(CompanyInvoicequeryWrapper);
|
||||
for(CompanyInvoiceEntity entitys : tableField46dc53){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(isSave || entitys.getInvoiceId()==null){
|
||||
entitys.setTitleCode(generaterSwapUtil.getBillNumber("InvoiceTitleCode", false));
|
||||
}else{
|
||||
if(StringUtil.isEmpty(entitys.getTitleCode()) || entitys.getInvoiceId() == null ){
|
||||
entitys.setTitleCode(generaterSwapUtil.getBillNumber("InvoiceTitleCode", false));
|
||||
}
|
||||
}
|
||||
if(entitys.getInvoiceId()==null){
|
||||
entitys.setInvoiceId(RandomUtil.uuId());
|
||||
}
|
||||
companyInvoiceService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.CorporationMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class CorporationServiceImpl extends SuperServiceImpl<CorporationMapper, CorporationEntity> implements CorporationService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
}
|
||||
@@ -0,0 +1,509 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.CompanyMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.yunzhupaas.mdm.model.custinfo.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* 客户信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class CustinfoServiceImpl extends SuperServiceImpl<CompanyMapper, CompanyEntity> implements CustinfoService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Autowired
|
||||
private CustomerService customerService;
|
||||
@Autowired
|
||||
private CompanyInvoiceService companyInvoiceService;
|
||||
@Autowired
|
||||
private CompanyBankService companyBankService;
|
||||
@Override
|
||||
public List<CompanyEntity> getList(CustinfoPagination companyPagination){
|
||||
return getTypeList(companyPagination,companyPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<CompanyEntity> getTypeList(CustinfoPagination companyPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_company",CompanyEntity.class);
|
||||
tableClassMap.put("mdm_company_bank",CompanyBankEntity.class);
|
||||
tableClassMap.put("mdm_company_invoice",CompanyInvoiceEntity.class);
|
||||
tableClassMap.put("mdm_customer",CustomerEntity.class);
|
||||
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.selectCollection(CompanyBankEntity.class,CompanyEntity::getCompanyBank)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(CompanyInvoiceEntity.class,CompanyEntity::getCompanyInvoice)
|
||||
.leftJoin(CompanyInvoiceEntity.class,"mdm_company_invoice",CompanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAssociation(CustomerEntity.class,CompanyEntity::getCustomer)
|
||||
.leftJoin(CustomerEntity.class,"mdm_customer",CustomerEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAll(CompanyEntity.class);
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.leftJoin(CompanyInvoiceEntity.class,"mdm_company_invoice",CompanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.leftJoin(CustomerEntity.class,"mdm_customer",CustomerEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.distinct().select(CompanyEntity::getCompanyId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(CustinfoConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? CustinfoConstant.getAppColumnData() : CustinfoConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(companyPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = true;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(companyPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(companyPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(companyPagination, wrapper, isPc);
|
||||
otherConditions(companyPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) companyPagination.getCurrentPage(), (int) companyPagination.getPageSize(), true);
|
||||
List<CompanyEntity> userIPage = this.selectJoinList(CompanyEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getCompanyId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(CompanyEntity::getCompanyId,collect);
|
||||
}
|
||||
List<CompanyEntity> result = this.selectJoinList(CompanyEntity.class, wrapper);
|
||||
return companyPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<CompanyEntity> list = this.selectJoinList(CompanyEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(companyPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getCompanyId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(CustinfoPagination companyPagination, MPJLambdaWrapper<CompanyEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
wrapper.isNull(CompanyEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getYunzhupaasKeyword())){
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getCompanyName())){
|
||||
String value = companyPagination.getCompanyName() instanceof List ?
|
||||
JsonUtil.getObjectToString(companyPagination.getCompanyName()) :
|
||||
String.valueOf(companyPagination.getCompanyName());
|
||||
wrapper.like(CompanyEntity::getCompanyName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getOrgId())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] orgId = JsonUtil.getJsonToBean(companyPagination.getOrgId(),String[][].class);
|
||||
for(int i=0;i<orgId.length;i++){
|
||||
if(orgId[i].length>0){
|
||||
idList.add(JsonUtil.getObjectToString(Arrays.asList(orgId[i])));
|
||||
}
|
||||
}
|
||||
}catch (Exception e1){
|
||||
try {
|
||||
List<String> orgId = JsonUtil.getJsonToList(companyPagination.getOrgId(),String.class);
|
||||
if(orgId.size()>0){
|
||||
idList.add(JsonUtil.getObjectToString(orgId));
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(companyPagination.getOrgId()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(CompanyEntity::getOrgId, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(companyPagination.getSidx())){
|
||||
wrapper.orderByDesc(CompanyEntity::getCompanyId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = companyPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
CompanyEntity companyEntity = new CompanyEntity();
|
||||
String oderTableField = companyEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = companyEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public CompanyEntity getInfo(String companyid){
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.selectCollection(CompanyBankEntity.class,CompanyEntity::getCompanyBank)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(CompanyInvoiceEntity.class,CompanyEntity::getCompanyInvoice)
|
||||
.leftJoin(CompanyInvoiceEntity.class,"mdm_company_invoice",CompanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAssociation(CustomerEntity.class,CompanyEntity::getCustomer)
|
||||
.leftJoin(CustomerEntity.class,"mdm_customer",CustomerEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAll(CompanyEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(CompanyEntity::getCompanyId, companyid )
|
||||
.or().eq(CompanyEntity::getFlowTaskId, companyid)
|
||||
);
|
||||
return this.selectJoinOne(CompanyEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(CompanyEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String companyid, CompanyEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(CompanyEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getCompanyId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(CustinfoForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getCompanyId()) && !form.getCompanyId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getCompanyId();
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "客户编码";
|
||||
fieldTipName = "客户名称";
|
||||
if(StringUtil.isEmpty(form.getCompanyName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getCompanyName())){
|
||||
form.setCompanyName(form.getCompanyName().trim());
|
||||
QueryWrapper<CompanyEntity> company_nameWrapper=new QueryWrapper<>();
|
||||
company_nameWrapper.lambda().eq(CompanyEntity::getCompanyName,form.getCompanyName());
|
||||
company_nameWrapper.lambda().isNull(CompanyEntity::getFlowId);
|
||||
if (isUp){
|
||||
company_nameWrapper.lambda().ne(CompanyEntity::getCompanyId, id);
|
||||
}
|
||||
if((int) this.count(company_nameWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "简称/昵称";
|
||||
fieldTipName = "类型";
|
||||
fieldTipName = "社会信用代码";
|
||||
if(StringUtil.isEmpty(form.getCreditCode())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getCreditCode())){
|
||||
form.setCreditCode(form.getCreditCode().trim());
|
||||
QueryWrapper<CompanyEntity> credit_codeWrapper=new QueryWrapper<>();
|
||||
credit_codeWrapper.lambda().eq(CompanyEntity::getCreditCode,form.getCreditCode());
|
||||
credit_codeWrapper.lambda().isNull(CompanyEntity::getFlowId);
|
||||
if (isUp){
|
||||
credit_codeWrapper.lambda().ne(CompanyEntity::getCompanyId, id);
|
||||
}
|
||||
if((int) this.count(credit_codeWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "归属组织";
|
||||
fieldTipName = "所属地区";
|
||||
fieldTipName = "纳税人类别";
|
||||
fieldTipName = "企业规模";
|
||||
fieldTipName = "企业类型";
|
||||
fieldTipName = "行业代码";
|
||||
fieldTipName = "成立日期";
|
||||
fieldTipName = "注册资本";
|
||||
fieldTipName = "法定代表人";
|
||||
fieldTipName = "联系电话";
|
||||
if(StringUtil.isNotEmpty(form.getPhone())){
|
||||
if(!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getPhone())).matches()){
|
||||
return I18nUtil.getMessageStr("sys.validate.telephone", "请输入正确的电话号码");
|
||||
}
|
||||
}
|
||||
fieldTipName = "邮箱";
|
||||
if(StringUtil.isNotEmpty(form.getEmail())){
|
||||
if(!Pattern.compile("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$").matcher(String.valueOf(form.getEmail())).matches()){
|
||||
return I18nUtil.getMessageStr("sys.validate.email", "请输入正确的邮箱");
|
||||
}
|
||||
}
|
||||
fieldTipName = "网站";
|
||||
fieldTipName = "地址";
|
||||
fieldTipName = "经营范围";
|
||||
fieldTipName = "备注";
|
||||
//副表字段验证
|
||||
fieldTipName = "销售责任人";
|
||||
if( form.getYunzhupaas_customer_yunzhupaas_personId() == null ){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
fieldTipName = "客户级别";
|
||||
fieldTipName = "客户来源";
|
||||
//子表字段验证
|
||||
if (form.getCompanyInvoiceList()!=null){
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "发票抬头编码";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "发票抬头名称";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "纳税人识别号";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "纳税人类别";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "地址";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "电话";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户银行";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "银行账户";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "是否默认";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "是否有效";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
if (form.getCompanyBankList()!=null){
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户行";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "账户名";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "银行账号";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户行城市";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(CustinfoForm companyForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
companyForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(CustinfoConstant.getFormData(),companyForm,CustinfoConstant.TABLERENAMES),CustinfoForm.class);
|
||||
CompanyEntity entity = JsonUtil.getJsonToBean(companyForm, CompanyEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setCompanyCode(generaterSwapUtil.getBillNumber("companyCode", false));
|
||||
entity.setCompanyId(mainUuid);
|
||||
} else {
|
||||
if(StringUtil.isEmpty(entity.getCompanyCode()) ){
|
||||
entity.setCompanyCode(generaterSwapUtil.getBillNumber("companyCode", false));
|
||||
}
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
CompanyEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
//CompanyInvoice子表数据新增修改
|
||||
QueryWrapper<CompanyInvoiceEntity> CompanyInvoicequeryWrapper = new QueryWrapper<>();
|
||||
CompanyInvoicequeryWrapper.lambda().eq(CompanyInvoiceEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(companyForm.getCompanyInvoiceList())){
|
||||
companyInvoiceService.remove(CompanyInvoicequeryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(companyForm.getCompanyInvoiceList())){
|
||||
List<CompanyInvoiceEntity> tableField46dc53 = JsonUtil.getJsonToList(companyForm.getCompanyInvoiceList(),CompanyInvoiceEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableField46dc53.stream().filter(t->t.getInvoiceId()!=null).map(CompanyInvoiceEntity::getInvoiceId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
CompanyInvoicequeryWrapper.lambda().notIn(CompanyInvoiceEntity::getInvoiceId,childIds);
|
||||
}
|
||||
companyInvoiceService.remove(CompanyInvoicequeryWrapper);
|
||||
for(CompanyInvoiceEntity entitys : tableField46dc53){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(isSave || entitys.getInvoiceId()==null){
|
||||
entitys.setTitleCode(generaterSwapUtil.getBillNumber("InvoiceTitleCode", false));
|
||||
}else{
|
||||
if(StringUtil.isEmpty(entitys.getTitleCode()) || entitys.getInvoiceId() == null ){
|
||||
entitys.setTitleCode(generaterSwapUtil.getBillNumber("InvoiceTitleCode", false));
|
||||
}
|
||||
}
|
||||
if(entitys.getInvoiceId()==null){
|
||||
entitys.setInvoiceId(RandomUtil.uuId());
|
||||
}
|
||||
companyInvoiceService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
//CompanyBank子表数据新增修改
|
||||
QueryWrapper<CompanyBankEntity> CompanyBankqueryWrapper = new QueryWrapper<>();
|
||||
CompanyBankqueryWrapper.lambda().eq(CompanyBankEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(companyForm.getCompanyBankList())){
|
||||
companyBankService.remove(CompanyBankqueryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(companyForm.getCompanyBankList())){
|
||||
List<CompanyBankEntity> tableFieldad9d92 = JsonUtil.getJsonToList(companyForm.getCompanyBankList(),CompanyBankEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableFieldad9d92.stream().filter(t->t.getBankId()!=null).map(CompanyBankEntity::getBankId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
CompanyBankqueryWrapper.lambda().notIn(CompanyBankEntity::getBankId,childIds);
|
||||
}
|
||||
companyBankService.remove(CompanyBankqueryWrapper);
|
||||
for(CompanyBankEntity entitys : tableFieldad9d92){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(entitys.getBankId()==null){
|
||||
entitys.setBankId(RandomUtil.uuId());
|
||||
}
|
||||
companyBankService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
//mdm_customer副表数据新增修改
|
||||
Map<String, Object> CustomerMap = generaterSwapUtil.getMastTabelData(companyForm,"mdm_customer");
|
||||
CustomerEntity customerentity = JsonUtil.getJsonToBean(CustomerMap,CustomerEntity.class);
|
||||
//自动生成的字段
|
||||
if(isSave){
|
||||
customerentity.setCustomerId(RandomUtil.uuId());
|
||||
customerentity.setCompanyId(entity.getCompanyId());
|
||||
}else{
|
||||
QueryWrapper<CustomerEntity> queryWrapperCustomer =new QueryWrapper<>();
|
||||
queryWrapperCustomer.lambda().eq(CustomerEntity::getCompanyId,info.getCompanyId());
|
||||
CustomerEntity customerOneEntity= customerService.getOne(queryWrapperCustomer);
|
||||
customerentity.setCustomerId(customerOneEntity.getCustomerId());
|
||||
customerentity.setCompanyId(entity.getCompanyId());
|
||||
}
|
||||
|
||||
customerService.saveOrUpdate(customerentity);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
package com.yunzhupaas.base.service.impl;
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.base.mapper.MdmCompanyBankMapper;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.CustomersMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.base.model.mdmcompany.*;
|
||||
import com.yunzhupaas.mdm.model.custinfo.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -21,14 +21,14 @@ import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
/**
|
||||
*
|
||||
* 企业信息
|
||||
* 客户信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-26
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class MdmCompanyBankServiceImpl extends SuperServiceImpl<MdmCompanyBankMapper, MdmCompanyBankEntity> implements MdmCompanyBankService{
|
||||
public class CustomersServiceImpl extends SuperServiceImpl<CustomersMapper, CustomerEntity> implements CustomerService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
}
|
||||
@@ -0,0 +1,515 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.CompanyMapper;
|
||||
import com.yunzhupaas.mdm.model.companyInvoice.CompanyInvoiceModel;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.yunzhupaas.mdm.model.lpc.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class LcpServiceImpl extends SuperServiceImpl<CompanyMapper, CompanyEntity> implements LpcService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Autowired
|
||||
private CorporationService corporationService;
|
||||
@Autowired
|
||||
private CompanyInvoiceService companyInvoiceService;
|
||||
@Autowired
|
||||
private CompanyBankService companyBankService;
|
||||
@Override
|
||||
public List<CompanyEntity> getList(LpcPagination companyPagination){
|
||||
return getTypeList(companyPagination,companyPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<CompanyEntity> getTypeList(LpcPagination companyPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_company",CompanyEntity.class);
|
||||
tableClassMap.put("mdm_corporation",CorporationEntity.class);
|
||||
tableClassMap.put("mdm_company_bank",CompanyBankEntity.class);
|
||||
tableClassMap.put("mdm_companyInvoice",CompanyInvoiceEntity.class);
|
||||
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.selectAssociation(CorporationEntity.class,CompanyEntity::getCorporation)
|
||||
.leftJoin(CorporationEntity.class,"mdm_corporation",CorporationEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(CompanyBankEntity.class,CompanyEntity::getCompanyBank)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(CompanyInvoiceEntity.class,CompanyEntity::getCompanyInvoice)
|
||||
.leftJoin(CompanyInvoiceEntity.class,"mdm_companyInvoice",CompanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAll(CompanyEntity.class);
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.leftJoin(CorporationEntity.class,"mdm_corporation",CorporationEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.leftJoin(CompanyInvoiceEntity.class,"mdm_companyInvoice",CompanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.distinct().select(CompanyEntity::getCompanyId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(LpcConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? LpcConstant.getAppColumnData() : LpcConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(companyPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = true;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(companyPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(companyPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(companyPagination, wrapper, isPc);
|
||||
otherConditions(companyPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) companyPagination.getCurrentPage(), (int) companyPagination.getPageSize(), true);
|
||||
List<CompanyEntity> userIPage = this.selectJoinList(CompanyEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getCompanyId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(CompanyEntity::getCompanyId,collect);
|
||||
}
|
||||
List<CompanyEntity> result = this.selectJoinList(CompanyEntity.class, wrapper);
|
||||
return companyPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<CompanyEntity> list = this.selectJoinList(CompanyEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(companyPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getCompanyId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(LpcPagination companyPagination, MPJLambdaWrapper<CompanyEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.isNull(CompanyEntity::getDeleteMark);
|
||||
|
||||
wrapper.isNull(CompanyEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getYunzhupaasKeyword())){
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getOrgId())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] orgId = JsonUtil.getJsonToBean(companyPagination.getOrgId(),String[][].class);
|
||||
for(int i=0;i<orgId.length;i++){
|
||||
if(orgId[i].length>0){
|
||||
idList.add(JsonUtil.getObjectToString(Arrays.asList(orgId[i])));
|
||||
}
|
||||
}
|
||||
}catch (Exception e1){
|
||||
try {
|
||||
List<String> orgId = JsonUtil.getJsonToList(companyPagination.getOrgId(),String.class);
|
||||
if(orgId.size()>0){
|
||||
idList.add(JsonUtil.getObjectToString(orgId));
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(companyPagination.getOrgId()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(CompanyEntity::getOrgId, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getCompanyName())){
|
||||
String value = companyPagination.getCompanyName() instanceof List ?
|
||||
JsonUtil.getObjectToString(companyPagination.getCompanyName()) :
|
||||
String.valueOf(companyPagination.getCompanyName());
|
||||
wrapper.like(CompanyEntity::getCompanyName,value);
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(companyPagination.getSidx())){
|
||||
wrapper.orderByDesc(CompanyEntity::getCompanyId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = companyPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
CompanyEntity companyEntity = new CompanyEntity();
|
||||
String oderTableField = companyEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = companyEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public CompanyEntity getInfo(String companyid){
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.selectAssociation(CorporationEntity.class,CompanyEntity::getCorporation)
|
||||
.leftJoin(CorporationEntity.class,"mdm_corporation",CorporationEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(CompanyBankEntity.class,CompanyEntity::getCompanyBank)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(CompanyInvoiceEntity.class,CompanyEntity::getCompanyInvoice)
|
||||
.leftJoin(CompanyInvoiceEntity.class,"mdm_companyInvoice",CompanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAll(CompanyEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(CompanyEntity::getCompanyId, companyid )
|
||||
.or().eq(CompanyEntity::getFlowTaskId, companyid)
|
||||
);
|
||||
return this.selectJoinOne(CompanyEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(CompanyEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String companyid, CompanyEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(CompanyEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getCompanyId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(LpcForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getCompanyId()) && !form.getCompanyId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getCompanyId();
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "实体类型";
|
||||
fieldTipName = "企业编码";
|
||||
fieldTipName = "企业名称";
|
||||
if(StringUtil.isEmpty(form.getCompanyName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
fieldTipName = "简称/昵称";
|
||||
fieldTipName = "社会信用代码";
|
||||
if(StringUtil.isEmpty(form.getCreditCode())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getCreditCode())){
|
||||
form.setCreditCode(form.getCreditCode().trim());
|
||||
QueryWrapper<CompanyEntity> credit_codeWrapper=new QueryWrapper<>();
|
||||
credit_codeWrapper.lambda().eq(CompanyEntity::getCreditCode,form.getCreditCode());
|
||||
credit_codeWrapper.lambda().isNull(CompanyEntity::getFlowId);
|
||||
//假删除标志
|
||||
credit_codeWrapper.lambda().isNull(CompanyEntity::getDeleteMark);
|
||||
if (isUp){
|
||||
credit_codeWrapper.lambda().ne(CompanyEntity::getCompanyId, id);
|
||||
}
|
||||
if((int) this.count(credit_codeWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "纳税人类别";
|
||||
fieldTipName = "归属组织";
|
||||
fieldTipName = "所属地区";
|
||||
fieldTipName = "企业类型";
|
||||
fieldTipName = "行业代码";
|
||||
fieldTipName = "企业规模";
|
||||
fieldTipName = "成立日期";
|
||||
fieldTipName = "注册资本";
|
||||
fieldTipName = "法定代表人";
|
||||
fieldTipName = "联系电话";
|
||||
fieldTipName = "邮箱";
|
||||
fieldTipName = "网站";
|
||||
fieldTipName = "地址";
|
||||
fieldTipName = "经营范围";
|
||||
fieldTipName = "备注";
|
||||
//副表字段验证
|
||||
fieldTipName = "负责人";
|
||||
if( form.getYunzhupaas_corporation_yunzhupaas_majorPersonId() == null ){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
//子表字段验证
|
||||
if (form.getCompanyInvoiceList()!=null){
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "发票抬头编码";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "发票抬头名称";
|
||||
|
||||
for(CompanyInvoiceModel t : form.getCompanyInvoiceList()){
|
||||
if( StringUtil.isNotEmpty(t.getTitleName()) ){
|
||||
t.setTitleName(t.getTitleName().trim());
|
||||
}
|
||||
else{
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
}
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "纳税人识别号";
|
||||
|
||||
for(CompanyInvoiceModel t : form.getCompanyInvoiceList()){
|
||||
if( StringUtil.isNotEmpty(t.getCreditCode()) ){
|
||||
t.setCreditCode(t.getCreditCode().trim());
|
||||
}
|
||||
else{
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
}
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "纳税人类别";
|
||||
|
||||
for(CompanyInvoiceModel t : form.getCompanyInvoiceList()){
|
||||
if( t.getTaxType() != null ){
|
||||
t.setTaxType(t.getTaxType());
|
||||
}
|
||||
else{
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
}
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "地址";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "电话";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户银行";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "银行账户";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "是否默认抬头";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "是否有效";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
if (form.getCompanyBankList()!=null){
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户行";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "账户名";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "银行账号";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户行城市";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(LpcForm companyForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
companyForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(LpcConstant.getFormData(),companyForm,LpcConstant.TABLERENAMES),LpcForm.class);
|
||||
CompanyEntity entity = JsonUtil.getJsonToBean(companyForm, CompanyEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setCompanyCode(generaterSwapUtil.getBillNumber("companyCode", false));
|
||||
entity.setCompanyId(mainUuid);
|
||||
} else {
|
||||
if(StringUtil.isEmpty(entity.getCompanyCode()) ){
|
||||
entity.setCompanyCode(generaterSwapUtil.getBillNumber("companyCode", false));
|
||||
}
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
CompanyEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
//CompanyInvoice子表数据新增修改
|
||||
QueryWrapper<CompanyInvoiceEntity> CompanyInvoicequeryWrapper = new QueryWrapper<>();
|
||||
CompanyInvoicequeryWrapper.lambda().eq(CompanyInvoiceEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(companyForm.getCompanyInvoiceList())){
|
||||
companyInvoiceService.remove(CompanyInvoicequeryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(companyForm.getCompanyInvoiceList())){
|
||||
List<CompanyInvoiceEntity> tableField5ced3a = JsonUtil.getJsonToList(companyForm.getCompanyInvoiceList(),CompanyInvoiceEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableField5ced3a.stream().filter(t->t.getInvoiceId()!=null).map(CompanyInvoiceEntity::getInvoiceId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
CompanyInvoicequeryWrapper.lambda().notIn(CompanyInvoiceEntity::getInvoiceId,childIds);
|
||||
}
|
||||
companyInvoiceService.remove(CompanyInvoicequeryWrapper);
|
||||
for(CompanyInvoiceEntity entitys : tableField5ced3a){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(isSave || entitys.getInvoiceId()==null){
|
||||
entitys.setTitleCode(generaterSwapUtil.getBillNumber("InvoiceTitleCode", false));
|
||||
}else{
|
||||
if(StringUtil.isEmpty(entitys.getTitleCode()) || entitys.getInvoiceId() == null ){
|
||||
entitys.setTitleCode(generaterSwapUtil.getBillNumber("InvoiceTitleCode", false));
|
||||
}
|
||||
}
|
||||
if(entitys.getInvoiceId()==null){
|
||||
entitys.setInvoiceId(RandomUtil.uuId());
|
||||
}
|
||||
companyInvoiceService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
//CompanyBank子表数据新增修改
|
||||
QueryWrapper<CompanyBankEntity> CompanyBankqueryWrapper = new QueryWrapper<>();
|
||||
CompanyBankqueryWrapper.lambda().eq(CompanyBankEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(companyForm.getCompanyBankList())){
|
||||
companyBankService.remove(CompanyBankqueryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(companyForm.getCompanyBankList())){
|
||||
List<CompanyBankEntity> tableFieldbd0aa4 = JsonUtil.getJsonToList(companyForm.getCompanyBankList(),CompanyBankEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableFieldbd0aa4.stream().filter(t->t.getBankId()!=null).map(CompanyBankEntity::getBankId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
CompanyBankqueryWrapper.lambda().notIn(CompanyBankEntity::getBankId,childIds);
|
||||
}
|
||||
companyBankService.remove(CompanyBankqueryWrapper);
|
||||
for(CompanyBankEntity entitys : tableFieldbd0aa4){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(entitys.getBankId()==null){
|
||||
entitys.setBankId(RandomUtil.uuId());
|
||||
}
|
||||
companyBankService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
//mdm_corporation副表数据新增修改
|
||||
Map<String, Object> CorporationMap = generaterSwapUtil.getMastTabelData(companyForm,"mdm_corporation");
|
||||
CorporationEntity corporationentity = JsonUtil.getJsonToBean(CorporationMap,CorporationEntity.class);
|
||||
//自动生成的字段
|
||||
if(isSave){
|
||||
corporationentity.setCorporationId(RandomUtil.uuId());
|
||||
corporationentity.setCompanyId(entity.getCompanyId());
|
||||
}else{
|
||||
QueryWrapper<CorporationEntity> queryWrapperCorporation =new QueryWrapper<>();
|
||||
queryWrapperCorporation.lambda().eq(CorporationEntity::getCompanyId,info.getCompanyId());
|
||||
CorporationEntity corporationOneEntity= corporationService.getOne(queryWrapperCorporation);
|
||||
corporationentity.setCorporationId(corporationOneEntity.getCorporationId());
|
||||
corporationentity.setCompanyId(entity.getCompanyId());
|
||||
}
|
||||
|
||||
corporationService.saveOrUpdate(corporationentity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.MaterialMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.mdm.model.material.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import java.math.BigDecimal;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* 物料信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-27
|
||||
*/
|
||||
@Service
|
||||
public class MaterialServiceImpl extends SuperServiceImpl<MaterialMapper, MaterialEntity> implements MaterialService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Override
|
||||
public List<MaterialEntity> getList(MaterialPagination materialPagination){
|
||||
return getTypeList(materialPagination,materialPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<MaterialEntity> getTypeList(MaterialPagination materialPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_material",MaterialEntity.class);
|
||||
|
||||
MPJLambdaWrapper<MaterialEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_material",MaterialEntity.class)
|
||||
.selectAll(MaterialEntity.class);
|
||||
MPJLambdaWrapper<MaterialEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_material",MaterialEntity.class)
|
||||
.distinct().select(MaterialEntity::getMaterialId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(MaterialConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? MaterialConstant.getAppColumnData() : MaterialConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(materialPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = false;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(materialPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(materialPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(materialPagination, wrapper, isPc);
|
||||
otherConditions(materialPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) materialPagination.getCurrentPage(), (int) materialPagination.getPageSize(), true);
|
||||
List<MaterialEntity> userIPage = this.selectJoinList(MaterialEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getMaterialId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(MaterialEntity::getMaterialId,collect);
|
||||
}
|
||||
List<MaterialEntity> result = this.selectJoinList(MaterialEntity.class, wrapper);
|
||||
return materialPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<MaterialEntity> list = this.selectJoinList(MaterialEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(materialPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getMaterialId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(MaterialPagination materialPagination, MPJLambdaWrapper<MaterialEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.isNull(MaterialEntity::getDeleteMark);
|
||||
|
||||
wrapper.isNull(MaterialEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(materialPagination.getYunzhupaasKeyword())){
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(materialPagination.getMaterialName())){
|
||||
String value = materialPagination.getMaterialName() instanceof List ?
|
||||
JsonUtil.getObjectToString(materialPagination.getMaterialName()) :
|
||||
String.valueOf(materialPagination.getMaterialName());
|
||||
wrapper.like(MaterialEntity::getMaterialName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(materialPagination.getMaterialModel())){
|
||||
String value = materialPagination.getMaterialModel() instanceof List ?
|
||||
JsonUtil.getObjectToString(materialPagination.getMaterialModel()) :
|
||||
String.valueOf(materialPagination.getMaterialModel());
|
||||
wrapper.like(MaterialEntity::getMaterialModel,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(materialPagination.getMaterialCategory())){
|
||||
String value = materialPagination.getMaterialCategory() instanceof List ?
|
||||
JsonUtil.getObjectToString(materialPagination.getMaterialCategory()) :
|
||||
String.valueOf(materialPagination.getMaterialCategory());
|
||||
wrapper.like(MaterialEntity::getMaterialCategory,value);
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(materialPagination.getSidx())){
|
||||
wrapper.orderByDesc(MaterialEntity::getMaterialId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = materialPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
MaterialEntity materialEntity = new MaterialEntity();
|
||||
String oderTableField = materialEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = materialEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public MaterialEntity getInfo(String materialid){
|
||||
MPJLambdaWrapper<MaterialEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_material",MaterialEntity.class)
|
||||
.selectAll(MaterialEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(MaterialEntity::getMaterialId, materialid )
|
||||
.or().eq(MaterialEntity::getFlowTaskId, materialid)
|
||||
);
|
||||
return this.selectJoinOne(MaterialEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(MaterialEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String materialid, MaterialEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(MaterialEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getMaterialId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(MaterialForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getMaterialId()) && !form.getMaterialId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getMaterialId();
|
||||
}
|
||||
//验证业务主键
|
||||
String businessErr = checkBusinessKey(form, isUp ? id : null, null);
|
||||
if (StringUtil.isNotEmpty(businessErr)) {
|
||||
return businessErr;
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "物料编码";
|
||||
fieldTipName = "物料名称";
|
||||
fieldTipName = "物料分类";
|
||||
fieldTipName = "规格型号";
|
||||
fieldTipName = "单位名称";
|
||||
fieldTipName = "品牌";
|
||||
fieldTipName = "税率";
|
||||
fieldTipName = "税收分类";
|
||||
fieldTipName = "材质/纹理";
|
||||
fieldTipName = "质量标准";
|
||||
fieldTipName = "技术标准";
|
||||
fieldTipName = "验收标准";
|
||||
fieldTipName = "交付要求";
|
||||
fieldTipName = "储存条件";
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 验证业务主键
|
||||
*/
|
||||
private String checkBusinessKey(MaterialForm form, Object id, List<String> flowIds){
|
||||
QueryWrapper<MaterialEntity> wrapper = new QueryWrapper<>();
|
||||
//修改
|
||||
if (id != null){
|
||||
wrapper.lambda().ne(MaterialEntity::getMaterialId, id);
|
||||
}
|
||||
//是否流程
|
||||
if(flowIds == null){
|
||||
wrapper.lambda().isNull(MaterialEntity::getFlowId);
|
||||
}else{
|
||||
wrapper.lambda().in(MaterialEntity::getFlowId, flowIds);
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.lambda().isNull(MaterialEntity::getDeleteMark);
|
||||
//物料名称字段判断
|
||||
if(form.getMaterialName() == null || form.getMaterialName().toString().trim().isEmpty()){
|
||||
wrapper.lambda().isNull(MaterialEntity::getMaterialName);
|
||||
}else{
|
||||
wrapper.lambda().eq(MaterialEntity::getMaterialName, form.getMaterialName());
|
||||
}
|
||||
//物料分类字段判断
|
||||
if(form.getMaterialCategory() == null || form.getMaterialCategory().toString().trim().isEmpty()
|
||||
||(form.getMaterialCategory() instanceof List && ((List) form.getMaterialCategory()).size() == 0)){
|
||||
wrapper.lambda().isNull(MaterialEntity::getMaterialCategory);
|
||||
}else{
|
||||
Object obj = form.getMaterialCategory() instanceof List ?JsonUtil.getObjectToString(form.getMaterialCategory()):form.getMaterialCategory();
|
||||
wrapper.lambda().eq(MaterialEntity::getMaterialCategory, obj);
|
||||
}
|
||||
if((int) this.count(wrapper)>0){
|
||||
return "该物料分类下,该物料名称数据已存在,请勿重复提交!";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param materialForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(MaterialForm materialForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
materialForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(MaterialConstant.getFormData(),materialForm,MaterialConstant.TABLERENAMES),MaterialForm.class);
|
||||
MaterialEntity entity = JsonUtil.getJsonToBean(materialForm, MaterialEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setMaterialCode(generaterSwapUtil.getBillNumber("materialCode", false));
|
||||
entity.setMaterialId(mainUuid);
|
||||
entity.setVersion(0);
|
||||
} else {
|
||||
if(StringUtil.isEmpty(entity.getMaterialCode()) ){
|
||||
entity.setMaterialCode(generaterSwapUtil.getBillNumber("materialCode", false));
|
||||
}
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
if(!b){
|
||||
throw new DataException("当前表单原数据已被调整,请重新进入该页面编辑并提交数据");
|
||||
}
|
||||
MaterialEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.PanyInvoiceMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* 供应商信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class PanyInvoiceServiceImpl extends SuperServiceImpl<PanyInvoiceMapper, PanyInvoiceEntity> implements PanyInvoiceService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
}
|
||||
@@ -0,0 +1,366 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.ProductsMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.mdm.model.product.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import java.math.BigDecimal;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* 商品信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-27
|
||||
*/
|
||||
@Service
|
||||
public class ProductsServiceImpl extends SuperServiceImpl<ProductsMapper, ProductEntity> implements ProductsService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Override
|
||||
public List<ProductEntity> getList(ProductPagination productPagination){
|
||||
return getTypeList(productPagination,productPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<ProductEntity> getTypeList(ProductPagination productPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_product",ProductEntity.class);
|
||||
|
||||
MPJLambdaWrapper<ProductEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_product",ProductEntity.class)
|
||||
.selectAll(ProductEntity.class);
|
||||
MPJLambdaWrapper<ProductEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_product",ProductEntity.class)
|
||||
.distinct().select(ProductEntity::getProductId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(ProductsConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? ProductsConstant.getAppColumnData() : ProductsConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(productPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = true;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(productPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(productPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(productPagination, wrapper, isPc);
|
||||
otherConditions(productPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) productPagination.getCurrentPage(), (int) productPagination.getPageSize(), true);
|
||||
List<ProductEntity> userIPage = this.selectJoinList(ProductEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getProductId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(ProductEntity::getProductId,collect);
|
||||
}
|
||||
List<ProductEntity> result = this.selectJoinList(ProductEntity.class, wrapper);
|
||||
return productPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<ProductEntity> list = this.selectJoinList(ProductEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(productPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getProductId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(ProductPagination productPagination, MPJLambdaWrapper<ProductEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.isNull(ProductEntity::getDeleteMark);
|
||||
|
||||
wrapper.isNull(ProductEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(productPagination.getYunzhupaasKeyword())){
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(productPagination.getProductName())){
|
||||
String value = productPagination.getProductName() instanceof List ?
|
||||
JsonUtil.getObjectToString(productPagination.getProductName()) :
|
||||
String.valueOf(productPagination.getProductName());
|
||||
wrapper.like(ProductEntity::getProductName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(productPagination.getProductCategory())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] productCategory = JsonUtil.getJsonToBean(productPagination.getProductCategory(),String[][].class);
|
||||
for(int i=0;i<productCategory.length;i++){
|
||||
if(productCategory[i].length>0){
|
||||
idList.add(JsonUtil.getObjectToString(Arrays.asList(productCategory[i])));
|
||||
}
|
||||
}
|
||||
}catch (Exception e1){
|
||||
try {
|
||||
List<String> productCategory = JsonUtil.getJsonToList(productPagination.getProductCategory(),String.class);
|
||||
if(productCategory.size()>0){
|
||||
idList.add(JsonUtil.getObjectToString(productCategory));
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(productPagination.getProductCategory()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(ProductEntity::getProductCategory, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(productPagination.getProductType())){
|
||||
wrapper.eq(ProductEntity::getProductType,productPagination.getProductType());
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(productPagination.getSidx())){
|
||||
wrapper.orderByDesc(ProductEntity::getProductId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = productPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
ProductEntity productEntity = new ProductEntity();
|
||||
String oderTableField = productEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = productEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ProductEntity getInfo(String productid){
|
||||
MPJLambdaWrapper<ProductEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_product",ProductEntity.class)
|
||||
.selectAll(ProductEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(ProductEntity::getProductId, productid )
|
||||
.or().eq(ProductEntity::getFlowTaskId, productid)
|
||||
);
|
||||
return this.selectJoinOne(ProductEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(ProductEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String productid, ProductEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(ProductEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getProductId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(ProductForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getProductId()) && !form.getProductId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getProductId();
|
||||
}
|
||||
//验证业务主键
|
||||
String businessErr = checkBusinessKey(form, isUp ? id : null, null);
|
||||
if (StringUtil.isNotEmpty(businessErr)) {
|
||||
return businessErr;
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "商品编码";
|
||||
fieldTipName = "商品名称";
|
||||
if(StringUtil.isEmpty(form.getProductName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
fieldTipName = "商品类型";
|
||||
fieldTipName = "商品分类";
|
||||
fieldTipName = "商品简称";
|
||||
fieldTipName = "品牌";
|
||||
fieldTipName = "规格型号";
|
||||
fieldTipName = "颜色";
|
||||
fieldTipName = "尺寸/规格";
|
||||
fieldTipName = "重量";
|
||||
fieldTipName = "最小起订量";
|
||||
fieldTipName = "标准销售单价";
|
||||
fieldTipName = "毛重";
|
||||
fieldTipName = "净重";
|
||||
fieldTipName = "单位名称";
|
||||
fieldTipName = "包装尺寸";
|
||||
fieldTipName = "成本价";
|
||||
fieldTipName = "保修期";
|
||||
fieldTipName = "税率";
|
||||
fieldTipName = "税收分类";
|
||||
fieldTipName = "保修条款";
|
||||
fieldTipName = "备注";
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 验证业务主键
|
||||
*/
|
||||
private String checkBusinessKey(ProductForm form, Object id, List<String> flowIds){
|
||||
QueryWrapper<ProductEntity> wrapper = new QueryWrapper<>();
|
||||
//修改
|
||||
if (id != null){
|
||||
wrapper.lambda().ne(ProductEntity::getProductId, id);
|
||||
}
|
||||
//是否流程
|
||||
if(flowIds == null){
|
||||
wrapper.lambda().isNull(ProductEntity::getFlowId);
|
||||
}else{
|
||||
wrapper.lambda().in(ProductEntity::getFlowId, flowIds);
|
||||
}
|
||||
//假删除标志
|
||||
wrapper.lambda().isNull(ProductEntity::getDeleteMark);
|
||||
//商品名称字段判断
|
||||
if(form.getProductName() == null || form.getProductName().toString().trim().isEmpty()){
|
||||
wrapper.lambda().isNull(ProductEntity::getProductName);
|
||||
}else{
|
||||
wrapper.lambda().eq(ProductEntity::getProductName, form.getProductName());
|
||||
}
|
||||
//商品分类字段判断
|
||||
if(form.getProductCategory() == null || form.getProductCategory().toString().trim().isEmpty()
|
||||
||(form.getProductCategory() instanceof List && ((List) form.getProductCategory()).size() == 0)){
|
||||
wrapper.lambda().isNull(ProductEntity::getProductCategory);
|
||||
}else{
|
||||
Object obj = form.getProductCategory() instanceof List ?JsonUtil.getObjectToString(form.getProductCategory()):form.getProductCategory();
|
||||
wrapper.lambda().eq(ProductEntity::getProductCategory, obj);
|
||||
}
|
||||
if((int) this.count(wrapper)>0){
|
||||
return "商品分类下,商品名称数据已存在,请勿重复提交!";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param productForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(ProductForm productForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
productForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(ProductsConstant.getFormData(),productForm,ProductsConstant.TABLERENAMES),ProductForm.class);
|
||||
ProductEntity entity = JsonUtil.getJsonToBean(productForm, ProductEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setProductCode(generaterSwapUtil.getBillNumber("productCode", false));
|
||||
entity.setProductId(mainUuid);
|
||||
entity.setVersion(0);
|
||||
} else {
|
||||
if(StringUtil.isEmpty(entity.getProductCode()) ){
|
||||
entity.setProductCode(generaterSwapUtil.getBillNumber("productCode", false));
|
||||
}
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
if(!b){
|
||||
throw new DataException("当前表单原数据已被调整,请重新进入该页面编辑并提交数据");
|
||||
}
|
||||
ProductEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,520 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.CompanyMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.mdm.model.suppinfo.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.yunzhupaas.i18n.util.I18nUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import java.math.BigDecimal;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.lang.reflect.Field;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.yunzhupaas.model.QueryAllModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.yunzhupaas.util.*;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
/**
|
||||
*
|
||||
* 供应商信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class SuppinfoServiceImpl extends SuperServiceImpl<CompanyMapper, CompanyEntity> implements SuppinfoService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Autowired
|
||||
private SupplierService supplierService;
|
||||
@Autowired
|
||||
private PanyInvoiceService panyInvoiceService;
|
||||
@Autowired
|
||||
private CompanyBankService companyBankService;
|
||||
@Override
|
||||
public List<CompanyEntity> getList(SuppinfoPagination companyPagination){
|
||||
return getTypeList(companyPagination,companyPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<CompanyEntity> getTypeList(SuppinfoPagination companyPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_company",CompanyEntity.class);
|
||||
tableClassMap.put("mdm_company_bank",CompanyBankEntity.class);
|
||||
tableClassMap.put("mdm_company_invoice",PanyInvoiceEntity.class);
|
||||
tableClassMap.put("mdm_supplier",SupplierEntity.class);
|
||||
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.selectCollection(CompanyBankEntity.class,CompanyEntity::getCompanyBank)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(PanyInvoiceEntity.class,CompanyEntity::getPanyInvoice)
|
||||
.leftJoin(PanyInvoiceEntity.class,"mdm_company_invoice",PanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAssociation(SupplierEntity.class,CompanyEntity::getSupplier)
|
||||
.leftJoin(SupplierEntity.class,"mdm_supplier",SupplierEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAll(CompanyEntity.class);
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.leftJoin(PanyInvoiceEntity.class,"mdm_company_invoice",PanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.leftJoin(SupplierEntity.class,"mdm_supplier",SupplierEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.distinct().select(CompanyEntity::getCompanyId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(SuppinfoConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? SuppinfoConstant.getAppColumnData() : SuppinfoConstant.getColumnData();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
||||
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
||||
queryAllModel.setRuleJson(ruleJson);
|
||||
//高级查询
|
||||
boolean hasSuperQuery = true;
|
||||
if (hasSuperQuery) {
|
||||
queryAllModel.setSuperJson(companyPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = true;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(companyPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(companyPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(companyPagination, wrapper, isPc);
|
||||
otherConditions(companyPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) companyPagination.getCurrentPage(), (int) companyPagination.getPageSize(), true);
|
||||
List<CompanyEntity> userIPage = this.selectJoinList(CompanyEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getCompanyId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(CompanyEntity::getCompanyId,collect);
|
||||
}
|
||||
List<CompanyEntity> result = this.selectJoinList(CompanyEntity.class, wrapper);
|
||||
return companyPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<CompanyEntity> list = this.selectJoinList(CompanyEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(companyPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getCompanyId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(SuppinfoPagination companyPagination, MPJLambdaWrapper<CompanyEntity> wrapper, boolean isPc) {
|
||||
String databaseName;
|
||||
try {
|
||||
@Cleanup Connection cnn = DynamicDataSourceUtil.getCurrentConnection();
|
||||
databaseName = cnn.getMetaData().getDatabaseProductName().trim();
|
||||
} catch (SQLException e) {
|
||||
throw new DataException(e.getMessage());
|
||||
}
|
||||
wrapper.isNull(CompanyEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getYunzhupaasKeyword())){
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getCompanyName())){
|
||||
String value = companyPagination.getCompanyName() instanceof List ?
|
||||
JsonUtil.getObjectToString(companyPagination.getCompanyName()) :
|
||||
String.valueOf(companyPagination.getCompanyName());
|
||||
wrapper.like(CompanyEntity::getCompanyName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(companyPagination.getOrgId())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] orgId = JsonUtil.getJsonToBean(companyPagination.getOrgId(),String[][].class);
|
||||
for(int i=0;i<orgId.length;i++){
|
||||
if(orgId[i].length>0){
|
||||
idList.add(JsonUtil.getObjectToString(Arrays.asList(orgId[i])));
|
||||
}
|
||||
}
|
||||
}catch (Exception e1){
|
||||
try {
|
||||
List<String> orgId = JsonUtil.getJsonToList(companyPagination.getOrgId(),String.class);
|
||||
if(orgId.size()>0){
|
||||
idList.add(JsonUtil.getObjectToString(orgId));
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(companyPagination.getOrgId()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(CompanyEntity::getOrgId, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(companyPagination.getSidx())){
|
||||
wrapper.orderByDesc(CompanyEntity::getCompanyId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = companyPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
CompanyEntity companyEntity = new CompanyEntity();
|
||||
String oderTableField = companyEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = companyEntity.getClass().getDeclaredField(sidxField);
|
||||
declaredField.setAccessible(true);
|
||||
sidxField = declaredField.getAnnotation(TableField.class).value();
|
||||
}catch (Exception e){
|
||||
}
|
||||
String finalOderTableField = oderTableField;
|
||||
String finalSidxField = sidxField;
|
||||
Object select = wrapper.getSelectColumns().stream().filter(t -> Objects.equals(finalOderTableField, t.getTableAlias())
|
||||
&& Objects.equals(finalSidxField, t.getColumn())).findFirst().orElse(null);
|
||||
oderTableField = oderTableField + "." + sidxField;
|
||||
if (select == null) {
|
||||
wrapper.select(oderTableField);
|
||||
}
|
||||
if (descFlag) {
|
||||
wrapper.orderByDesc(oderTableField);
|
||||
} else {
|
||||
wrapper.orderByAsc(oderTableField);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public CompanyEntity getInfo(String companyid){
|
||||
MPJLambdaWrapper<CompanyEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_company",CompanyEntity.class)
|
||||
.selectCollection(CompanyBankEntity.class,CompanyEntity::getCompanyBank)
|
||||
.leftJoin(CompanyBankEntity.class,"mdm_company_bank",CompanyBankEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectCollection(PanyInvoiceEntity.class,CompanyEntity::getPanyInvoice)
|
||||
.leftJoin(PanyInvoiceEntity.class,"mdm_company_invoice",PanyInvoiceEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAssociation(SupplierEntity.class,CompanyEntity::getSupplier)
|
||||
.leftJoin(SupplierEntity.class,"mdm_supplier",SupplierEntity::getCompanyId,CompanyEntity::getCompanyId)
|
||||
.selectAll(CompanyEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(CompanyEntity::getCompanyId, companyid )
|
||||
.or().eq(CompanyEntity::getFlowTaskId, companyid)
|
||||
);
|
||||
return this.selectJoinOne(CompanyEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(CompanyEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String companyid, CompanyEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(CompanyEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getCompanyId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(SuppinfoForm form,int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getCompanyId()) && !form.getCompanyId().equals("0");
|
||||
Object id= null;
|
||||
String countRecover = "";
|
||||
String fieldTipName = "";
|
||||
String canNotNull = I18nUtil.getMessageStr("sys.validate.textRequiredSuffix", "不能为空");
|
||||
String canNotRepeated = I18nUtil.getMessageStr("EXIST103", "不能重复");
|
||||
if (isUp){
|
||||
id = form.getCompanyId();
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "企业编码";
|
||||
fieldTipName = "企业名称";
|
||||
if(StringUtil.isEmpty(form.getCompanyName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getCompanyName())){
|
||||
form.setCompanyName(form.getCompanyName().trim());
|
||||
QueryWrapper<CompanyEntity> company_nameWrapper=new QueryWrapper<>();
|
||||
company_nameWrapper.lambda().eq(CompanyEntity::getCompanyName,form.getCompanyName());
|
||||
company_nameWrapper.lambda().isNull(CompanyEntity::getFlowId);
|
||||
if (isUp){
|
||||
company_nameWrapper.lambda().ne(CompanyEntity::getCompanyId, id);
|
||||
}
|
||||
if((int) this.count(company_nameWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "简称/昵称";
|
||||
fieldTipName = "类型";
|
||||
fieldTipName = "社会信用代码";
|
||||
if(StringUtil.isEmpty(form.getCreditCode())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getCreditCode())){
|
||||
form.setCreditCode(form.getCreditCode().trim());
|
||||
QueryWrapper<CompanyEntity> credit_codeWrapper=new QueryWrapper<>();
|
||||
credit_codeWrapper.lambda().eq(CompanyEntity::getCreditCode,form.getCreditCode());
|
||||
credit_codeWrapper.lambda().isNull(CompanyEntity::getFlowId);
|
||||
if (isUp){
|
||||
credit_codeWrapper.lambda().ne(CompanyEntity::getCompanyId, id);
|
||||
}
|
||||
if((int) this.count(credit_codeWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
fieldTipName = "归属组织";
|
||||
fieldTipName = "所属地区";
|
||||
fieldTipName = "纳税人类别";
|
||||
fieldTipName = "企业规模";
|
||||
fieldTipName = "企业类型";
|
||||
fieldTipName = "行业代码";
|
||||
fieldTipName = "成立日期";
|
||||
fieldTipName = "注册资本";
|
||||
fieldTipName = "法定代表人";
|
||||
fieldTipName = "联系电话";
|
||||
if(StringUtil.isNotEmpty(form.getPhone())){
|
||||
if(!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getPhone())).matches()){
|
||||
return I18nUtil.getMessageStr("sys.validate.telephone", "请输入正确的电话号码");
|
||||
}
|
||||
}
|
||||
fieldTipName = "邮箱";
|
||||
if(StringUtil.isNotEmpty(form.getEmail())){
|
||||
if(!Pattern.compile("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$").matcher(String.valueOf(form.getEmail())).matches()){
|
||||
return I18nUtil.getMessageStr("sys.validate.email", "请输入正确的邮箱");
|
||||
}
|
||||
}
|
||||
fieldTipName = "网站";
|
||||
fieldTipName = "地址";
|
||||
fieldTipName = "经营范围";
|
||||
fieldTipName = "备注";
|
||||
//副表字段验证
|
||||
fieldTipName = "责任人";
|
||||
if( form.getYunzhupaas_supplier_yunzhupaas_majorPersonId() == null ){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
fieldTipName = "供应商级别";
|
||||
fieldTipName = "供应商类型";
|
||||
fieldTipName = "供应商分类";
|
||||
fieldTipName = "荣誉、资质";
|
||||
fieldTipName = "供应商业绩";
|
||||
fieldTipName = "完工项目";
|
||||
//子表字段验证
|
||||
if (form.getPanyInvoiceList()!=null){
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "发票抬头编码";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "发票抬头名称";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "纳税人识别号";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "纳税人类别";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "地址";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "电话";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户银行";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "银行账户";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "是否默认";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "是否有效";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
if (form.getCompanyBankList()!=null){
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户行";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "账户名";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "银行账号";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "开户行城市";
|
||||
|
||||
|
||||
fieldTipName = "设计子表"
|
||||
+ "-" + "备注";
|
||||
|
||||
}
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(SuppinfoForm companyForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
companyForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(SuppinfoConstant.getFormData(),companyForm,SuppinfoConstant.TABLERENAMES),SuppinfoForm.class);
|
||||
CompanyEntity entity = JsonUtil.getJsonToBean(companyForm, CompanyEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setCompanyCode(generaterSwapUtil.getBillNumber("CustomerCompanyCode", false));
|
||||
entity.setCompanyId(mainUuid);
|
||||
} else {
|
||||
if(StringUtil.isEmpty(entity.getCompanyCode()) ){
|
||||
entity.setCompanyCode(generaterSwapUtil.getBillNumber("CustomerCompanyCode", false));
|
||||
}
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
CompanyEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
//PanyInvoice子表数据新增修改
|
||||
QueryWrapper<PanyInvoiceEntity> PanyInvoicequeryWrapper = new QueryWrapper<>();
|
||||
PanyInvoicequeryWrapper.lambda().eq(PanyInvoiceEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(companyForm.getPanyInvoiceList())){
|
||||
panyInvoiceService.remove(PanyInvoicequeryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(companyForm.getPanyInvoiceList())){
|
||||
List<PanyInvoiceEntity> tableField46dc53 = JsonUtil.getJsonToList(companyForm.getPanyInvoiceList(),PanyInvoiceEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableField46dc53.stream().filter(t->t.getInvoiceId()!=null).map(PanyInvoiceEntity::getInvoiceId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
PanyInvoicequeryWrapper.lambda().notIn(PanyInvoiceEntity::getInvoiceId,childIds);
|
||||
}
|
||||
panyInvoiceService.remove(PanyInvoicequeryWrapper);
|
||||
for(PanyInvoiceEntity entitys : tableField46dc53){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(isSave || entitys.getInvoiceId()==null){
|
||||
entitys.setTitleCode(generaterSwapUtil.getBillNumber("InvoiceTitleCode", false));
|
||||
}else{
|
||||
if(StringUtil.isEmpty(entitys.getTitleCode()) || entitys.getInvoiceId() == null ){
|
||||
entitys.setTitleCode(generaterSwapUtil.getBillNumber("InvoiceTitleCode", false));
|
||||
}
|
||||
}
|
||||
if(entitys.getInvoiceId()==null){
|
||||
entitys.setInvoiceId(RandomUtil.uuId());
|
||||
}
|
||||
panyInvoiceService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
//CompanyBank子表数据新增修改
|
||||
QueryWrapper<CompanyBankEntity> CompanyBankqueryWrapper = new QueryWrapper<>();
|
||||
CompanyBankqueryWrapper.lambda().eq(CompanyBankEntity::getCompanyId, info.getCompanyId());
|
||||
if(!isSave && !CollectionUtils.isNotEmpty(companyForm.getCompanyBankList())){
|
||||
companyBankService.remove(CompanyBankqueryWrapper);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(companyForm.getCompanyBankList())){
|
||||
List<CompanyBankEntity> tableFieldad9d92 = JsonUtil.getJsonToList(companyForm.getCompanyBankList(),CompanyBankEntity.class);
|
||||
//移除的数据
|
||||
List<Object> childIds = tableFieldad9d92.stream().filter(t->t.getBankId()!=null).map(CompanyBankEntity::getBankId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(childIds)){
|
||||
CompanyBankqueryWrapper.lambda().notIn(CompanyBankEntity::getBankId,childIds);
|
||||
}
|
||||
companyBankService.remove(CompanyBankqueryWrapper);
|
||||
for(CompanyBankEntity entitys : tableFieldad9d92){
|
||||
entitys.setCompanyId(entity.getCompanyId());
|
||||
if(entitys.getBankId()==null){
|
||||
entitys.setBankId(RandomUtil.uuId());
|
||||
}
|
||||
companyBankService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
//mdm_supplier副表数据新增修改
|
||||
Map<String, Object> SupplierMap = generaterSwapUtil.getMastTabelData(companyForm,"mdm_supplier");
|
||||
SupplierEntity supplierentity = JsonUtil.getJsonToBean(SupplierMap,SupplierEntity.class);
|
||||
//自动生成的字段
|
||||
if(isSave){
|
||||
supplierentity.setSupplierId(RandomUtil.uuId());
|
||||
supplierentity.setCompanyId(entity.getCompanyId());
|
||||
}else{
|
||||
QueryWrapper<SupplierEntity> queryWrapperSupplier =new QueryWrapper<>();
|
||||
queryWrapperSupplier.lambda().eq(SupplierEntity::getCompanyId,info.getCompanyId());
|
||||
SupplierEntity supplierOneEntity= supplierService.getOne(queryWrapperSupplier);
|
||||
supplierentity.setSupplierId(supplierOneEntity.getSupplierId());
|
||||
supplierentity.setCompanyId(entity.getCompanyId());
|
||||
}
|
||||
|
||||
supplierService.saveOrUpdate(supplierentity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.SupplierMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.yunzhupaas.util.GeneraterSwapUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* 供应商信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Service
|
||||
public class SupplierServiceImpl extends SuperServiceImpl<SupplierMapper, SupplierEntity> implements SupplierService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
package com.yunzhupaas.base.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 com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.base.model.bcmprojecttype.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "项目类型" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/BcmProjectType")
|
||||
public class BcmProjectTypeController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private BcmProjectTypeService bcmProjectTypeService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param bcmProjectTypePagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody BcmProjectTypePagination bcmProjectTypePagination)throws Exception{
|
||||
List<BcmProjectTypeEntity> list= bcmProjectTypeService.getList(bcmProjectTypePagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (BcmProjectTypeEntity entity : list) {
|
||||
Map<String, Object> bcmProjectTypeMap=JsonUtil.entityToMap(entity);
|
||||
bcmProjectTypeMap.put("id", bcmProjectTypeMap.get("project_type_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(bcmProjectTypeMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, BcmProjectTypeConstant.getFormData(), BcmProjectTypeConstant.getColumnData(), bcmProjectTypePagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(bcmProjectTypePagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param bcmProjectTypeForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid BcmProjectTypeForm bcmProjectTypeForm) {
|
||||
String b = bcmProjectTypeService.checkForm(bcmProjectTypeForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
bcmProjectTypeService.saveOrUpdate(bcmProjectTypeForm, null ,true);
|
||||
}catch(Exception e){
|
||||
log.error("【项目类型新增接口异常】参数:{}", bcmProjectTypeForm, e);
|
||||
return ActionResult.fail(MsgCode.FA028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
BcmProjectTypeEntity entity= bcmProjectTypeService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//假删除
|
||||
entity.setDeleteMark(1);
|
||||
entity.setDeleteUserId(userProvider.get().getUserId());
|
||||
entity.setDeleteTime(new Date());
|
||||
bcmProjectTypeService.setIgnoreLogicDelete().updateById(entity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param bcmProjectTypeForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid BcmProjectTypeForm bcmProjectTypeForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
BcmProjectTypeEntity entity= bcmProjectTypeService.getInfo(id);
|
||||
if(entity!=null){
|
||||
bcmProjectTypeForm.setProjectTypeId(String.valueOf(entity.getProjectTypeId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = bcmProjectTypeService.checkForm(bcmProjectTypeForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
bcmProjectTypeService.saveOrUpdate(bcmProjectTypeForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
log.error("【项目类型修改接口异常】参数:{}", bcmProjectTypeForm, e);
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
BcmProjectTypeEntity entity= bcmProjectTypeService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> bcmProjectTypeMap=JsonUtil.entityToMap(entity);
|
||||
bcmProjectTypeMap.put("id", bcmProjectTypeMap.get("project_type_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
bcmProjectTypeMap = generaterSwapUtil.swapDataDetail(bcmProjectTypeMap,BcmProjectTypeConstant.getFormData(),"806852213774222853",isPc?false:false);
|
||||
//子表数据
|
||||
return ActionResult.success(bcmProjectTypeMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
BcmProjectTypeEntity entity= bcmProjectTypeService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> bcmProjectTypeMap=JsonUtil.entityToMap(entity);
|
||||
bcmProjectTypeMap.put("id", bcmProjectTypeMap.get("project_type_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
bcmProjectTypeMap = generaterSwapUtil.swapDataForm(bcmProjectTypeMap,BcmProjectTypeConstant.getFormData(),BcmProjectTypeConstant.TABLEFIELDKEY,BcmProjectTypeConstant.TABLERENAMES);
|
||||
return ActionResult.success(bcmProjectTypeMap);
|
||||
}
|
||||
/**
|
||||
* 获取项目类型列表
|
||||
*
|
||||
* @param bcmProjectTypePagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取项目类型列表")
|
||||
@PostMapping("/getBcmprojecttypeList")
|
||||
public ActionResult getBcmprojecttypeList(@RequestBody BcmProjectTypePagination bcmProjectTypePagination)throws Exception{
|
||||
List<BcmProjectTypeEntity> list= bcmProjectTypeService.getList(bcmProjectTypePagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (BcmProjectTypeEntity entity : list) {
|
||||
Map<String, Object> bcmProjectTypeMap=JsonUtil.entityToMap(entity);
|
||||
bcmProjectTypeMap.put("id", bcmProjectTypeMap.get("project_type_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(bcmProjectTypeMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, BcmProjectTypeConstant.getFormData(), BcmProjectTypeConstant.getColumnData(), bcmProjectTypePagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(bcmProjectTypePagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,273 +0,0 @@
|
||||
package com.yunzhupaas.base.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 com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.base.model.mdmcompany.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* mdm_company
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-270
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "mdm_company" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/MdmCompany")
|
||||
public class MdmCompanyController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private MdmCompanyService mdmCompanyService;
|
||||
|
||||
@Autowired
|
||||
private CrmCustomerService crmCustomerService;
|
||||
@Autowired
|
||||
private MdmCompanyContactService mdmCompanyContactService;
|
||||
@Autowired
|
||||
private MdmCompanyBankService mdmCompanyBankService;
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param mdmCompanyPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody MdmCompanyPagination mdmCompanyPagination)throws Exception{
|
||||
List<MdmCompanyEntity> list= mdmCompanyService.getList(mdmCompanyPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (MdmCompanyEntity entity : list) {
|
||||
|
||||
Map<String, Object> mdmCompanyMap=JsonUtil.entityToMap(entity);
|
||||
mdmCompanyMap.put("id", mdmCompanyMap.get("company_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
|
||||
// CrmCustomerEntity crmCustomerList = entity.getCrmCustomer();
|
||||
// mdmCompanyMap.put("tableField798457",JsonUtil.getJsonToBean(crmCustomerList,CrmCustomerEntity.class));
|
||||
// mdmCompanyMap.put("crmCustomerList",JsonUtil.getJsonToBean(crmCustomerList,CrmCustomerEntity.class));
|
||||
List<MdmCompanyContactEntity> mdmCompanyContactList = entity.getMdmCompanyContact();
|
||||
mdmCompanyMap.put("tableFieldc4fb23",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyContactList)));
|
||||
mdmCompanyMap.put("mdmCompanyContactList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyContactList)));
|
||||
List<MdmCompanyBankEntity> mdmCompanyBankList = entity.getMdmCompanyBank();
|
||||
mdmCompanyMap.put("tableFieldaafa82",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
mdmCompanyMap.put("mdmCompanyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
realList.add(mdmCompanyMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, MdmCompanyConstant.getFormData(), MdmCompanyConstant.getColumnData(), mdmCompanyPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(mdmCompanyPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param mdmCompanyForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid MdmCompanyForm mdmCompanyForm) {
|
||||
String b = mdmCompanyService.checkForm(mdmCompanyForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
mdmCompanyService.saveOrUpdate(mdmCompanyForm, null ,true);
|
||||
}catch(Exception e){
|
||||
log.error("【企业信息(包括:客商与企业内部单位)创建接口异常】参数:{}", mdmCompanyForm, e);
|
||||
return ActionResult.fail(MsgCode.FA028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
MdmCompanyEntity entity= mdmCompanyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//假删除
|
||||
entity.setDeleteMark(1);
|
||||
entity.setDeleteUserId(userProvider.get().getUserId());
|
||||
entity.setDeleteTime(new Date());
|
||||
mdmCompanyService.setIgnoreLogicDelete().updateById(entity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param mdmCompanyForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid MdmCompanyForm mdmCompanyForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
MdmCompanyEntity entity= mdmCompanyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
mdmCompanyForm.setCompanyId(String.valueOf(entity.getCompanyId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = mdmCompanyService.checkForm(mdmCompanyForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
mdmCompanyService.saveOrUpdate(mdmCompanyForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
log.error("【企业信息(包括:客商与企业内部单位)编辑接口异常】参数:{}", mdmCompanyForm, e);
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
MdmCompanyEntity entity= mdmCompanyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> mdmCompanyMap=JsonUtil.entityToMap(entity);
|
||||
mdmCompanyMap.put("id", mdmCompanyMap.get("company_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
CrmCustomerEntity crmCustomerList = entity.getCrmCustomer();
|
||||
mdmCompanyMap.put("tableField798457",JsonUtil.getJsonToBean(crmCustomerList,CrmCustomerEntity.class));
|
||||
mdmCompanyMap.put("crmCustomerList",JsonUtil.getJsonToBean(crmCustomerList,CrmCustomerEntity.class));
|
||||
List<MdmCompanyContactEntity> mdmCompanyContactList = entity.getMdmCompanyContact();
|
||||
mdmCompanyMap.put("tableFieldc4fb23",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyContactList)));
|
||||
mdmCompanyMap.put("mdmCompanyContactList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyContactList)));
|
||||
List<MdmCompanyBankEntity> mdmCompanyBankList = entity.getMdmCompanyBank();
|
||||
mdmCompanyMap.put("tableFieldaafa82",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
mdmCompanyMap.put("mdmCompanyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
mdmCompanyMap = generaterSwapUtil.swapDataDetail(mdmCompanyMap,MdmCompanyConstant.getFormData(),"807175611364673349",isPc?false:false);
|
||||
//子表数据
|
||||
mdmCompanyMap.put("crmCustomerList",mdmCompanyMap.get("tableField798457"));
|
||||
mdmCompanyMap.put("mdmCompanyContactList",mdmCompanyMap.get("tableFieldc4fb23"));
|
||||
mdmCompanyMap.put("mdmCompanyBankList",mdmCompanyMap.get("tableFieldaafa82"));
|
||||
return ActionResult.success(mdmCompanyMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
MdmCompanyEntity entity= mdmCompanyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> mdmCompanyMap=JsonUtil.entityToMap(entity);
|
||||
mdmCompanyMap.put("id", mdmCompanyMap.get("company_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
CrmCustomerEntity crmCustomer = entity.getCrmCustomer();
|
||||
// mdmCompanyMap.put("tableField798457",JsonUtil.getJsonToBean(crmCustomerList,CrmCustomerEntity.class));
|
||||
mdmCompanyMap.put("crmCustomer",JsonUtil.getJsonToBean(crmCustomer,CrmCustomerEntity.class));
|
||||
List<MdmCompanyContactEntity> mdmCompanyContactList = entity.getMdmCompanyContact();
|
||||
mdmCompanyMap.put("tableFieldc4fb23",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyContactList)));
|
||||
mdmCompanyMap.put("mdmCompanyContactList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyContactList)));
|
||||
List<MdmCompanyBankEntity> mdmCompanyBankList = entity.getMdmCompanyBank();
|
||||
mdmCompanyMap.put("tableFieldaafa82",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
mdmCompanyMap.put("mdmCompanyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
mdmCompanyMap = generaterSwapUtil.swapDataForm(mdmCompanyMap,MdmCompanyConstant.getFormData(),MdmCompanyConstant.TABLEFIELDKEY,MdmCompanyConstant.TABLERENAMES);
|
||||
return ActionResult.success(mdmCompanyMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,257 +0,0 @@
|
||||
package com.yunzhupaas.base.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 com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.base.model.mdmcontracttype.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* mdmContractType
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-30
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "mdmContractType" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/MdmContractType")
|
||||
public class MdmContractTypeController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private MdmContractTypeService mdmContractTypeService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param mdmContractTypePagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody MdmContractTypePagination mdmContractTypePagination)throws Exception{
|
||||
List<MdmContractTypeEntity> list= mdmContractTypeService.getList(mdmContractTypePagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (MdmContractTypeEntity entity : list) {
|
||||
Map<String, Object> mdmContractTypeMap=JsonUtil.entityToMap(entity);
|
||||
mdmContractTypeMap.put("id", mdmContractTypeMap.get("id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(mdmContractTypeMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, MdmContractTypeConstant.getFormData(), MdmContractTypeConstant.getColumnData(), mdmContractTypePagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(mdmContractTypePagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param mdmContractTypeForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid MdmContractTypeForm mdmContractTypeForm) {
|
||||
String b = mdmContractTypeService.checkForm(mdmContractTypeForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
mdmContractTypeService.saveOrUpdate(mdmContractTypeForm, null ,true);
|
||||
}catch(Exception e){
|
||||
log.error("【合同类型配置创建接口异常】参数:{}", mdmContractTypeForm, e);
|
||||
return ActionResult.fail(MsgCode.FA028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
MdmContractTypeEntity entity= mdmContractTypeService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//假删除
|
||||
entity.setDeleteMark(1);
|
||||
entity.setDeleteUserId(userProvider.get().getUserId());
|
||||
entity.setDeleteTime(new Date());
|
||||
mdmContractTypeService.setIgnoreLogicDelete().updateById(entity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param mdmContractTypeForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid MdmContractTypeForm mdmContractTypeForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
MdmContractTypeEntity entity= mdmContractTypeService.getInfo(id);
|
||||
if(entity!=null){
|
||||
mdmContractTypeForm.setId(String.valueOf(entity.getId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = mdmContractTypeService.checkForm(mdmContractTypeForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
mdmContractTypeService.saveOrUpdate(mdmContractTypeForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
log.error("【合同类型配置编辑接口异常】参数:{}", mdmContractTypeForm, e);
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
MdmContractTypeEntity entity= mdmContractTypeService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> mdmContractTypeMap=JsonUtil.entityToMap(entity);
|
||||
mdmContractTypeMap.put("id", mdmContractTypeMap.get("id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
mdmContractTypeMap = generaterSwapUtil.swapDataDetail(mdmContractTypeMap,MdmContractTypeConstant.getFormData(),"808252366691240901",isPc?false:false);
|
||||
//子表数据
|
||||
return ActionResult.success(mdmContractTypeMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
MdmContractTypeEntity entity= mdmContractTypeService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> mdmContractTypeMap=JsonUtil.entityToMap(entity);
|
||||
mdmContractTypeMap.put("id", mdmContractTypeMap.get("id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
mdmContractTypeMap = generaterSwapUtil.swapDataForm(mdmContractTypeMap,MdmContractTypeConstant.getFormData(),MdmContractTypeConstant.TABLEFIELDKEY,MdmContractTypeConstant.TABLERENAMES);
|
||||
return ActionResult.success(mdmContractTypeMap);
|
||||
}
|
||||
/**
|
||||
* 根据类型查询
|
||||
*
|
||||
* @param mdmContractTypePagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "根据类型查询")
|
||||
@PostMapping("/listByContractMode")
|
||||
public ActionResult listByContractMode(@RequestBody MdmContractTypePagination mdmContractTypePagination)throws Exception{
|
||||
List<MdmContractTypeEntity> list= mdmContractTypeService.getList(mdmContractTypePagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (MdmContractTypeEntity entity : list) {
|
||||
Map<String, Object> mdmContractTypeMap=JsonUtil.entityToMap(entity);
|
||||
mdmContractTypeMap.put("id", mdmContractTypeMap.get("id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(mdmContractTypeMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, MdmContractTypeConstant.getFormData(), MdmContractTypeConstant.getColumnData(), mdmContractTypePagination.getModuleId(),isPc?false:false);
|
||||
return ActionResult.success(realList);
|
||||
}
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
package com.yunzhupaas.base.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 com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.yunzhupaas.base.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.base.model.mdmproject.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 项目结构
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "项目结构" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/MdmProject")
|
||||
public class MdmProjectController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private MdmProjectService mdmProjectService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param mdmProjectPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody MdmProjectPagination mdmProjectPagination)throws Exception{
|
||||
List<MdmProjectEntity> list= mdmProjectService.getList(mdmProjectPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (MdmProjectEntity entity : list) {
|
||||
Map<String, Object> mdmProjectMap=JsonUtil.entityToMap(entity);
|
||||
mdmProjectMap.put("id", mdmProjectMap.get("project_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(mdmProjectMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, MdmProjectConstant.getFormData(), MdmProjectConstant.getColumnData(), mdmProjectPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(mdmProjectPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param mdmProjectForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid MdmProjectForm mdmProjectForm) {
|
||||
String b = mdmProjectService.checkForm(mdmProjectForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
mdmProjectService.saveOrUpdate(mdmProjectForm, null ,true);
|
||||
}catch(Exception e){
|
||||
log.error("【项目结构创建项目接口异常】参数:{}", mdmProjectForm, e);
|
||||
return ActionResult.fail(MsgCode.FA028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
MdmProjectEntity entity= mdmProjectService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//主表数据删除
|
||||
mdmProjectService.delete(entity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param mdmProjectForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid MdmProjectForm mdmProjectForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
MdmProjectEntity entity= mdmProjectService.getInfo(id);
|
||||
if(entity!=null){
|
||||
mdmProjectForm.setProjectId(String.valueOf(entity.getProjectId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = mdmProjectService.checkForm(mdmProjectForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
mdmProjectService.saveOrUpdate(mdmProjectForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
log.error("【项目结构修改项目接口异常】参数:{}", mdmProjectForm, e);
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
MdmProjectEntity entity= mdmProjectService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> mdmProjectMap=JsonUtil.entityToMap(entity);
|
||||
mdmProjectMap.put("id", mdmProjectMap.get("project_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
mdmProjectMap = generaterSwapUtil.swapDataDetail(mdmProjectMap,MdmProjectConstant.getFormData(),"806868519370098181",isPc?false:false);
|
||||
//子表数据
|
||||
return ActionResult.success(mdmProjectMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
MdmProjectEntity entity= mdmProjectService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> mdmProjectMap=JsonUtil.entityToMap(entity);
|
||||
mdmProjectMap.put("id", mdmProjectMap.get("project_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
mdmProjectMap = generaterSwapUtil.swapDataForm(mdmProjectMap,MdmProjectConstant.getFormData(),MdmProjectConstant.TABLEFIELDKEY,MdmProjectConstant.TABLERENAMES);
|
||||
return ActionResult.success(mdmProjectMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,697 @@
|
||||
package com.yunzhupaas.mdm.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 com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.mdm.model.asset.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.annotation.YunzhupaasField;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
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 java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import com.yunzhupaas.onlinedev.model.ExcelImFieldModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportDataModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportFormCheckUniqueModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ExcelImportModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualImportModel;
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.model.visualJson.config.HeaderModel;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.util.VisualUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 资产信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-28
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "资产信息" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/Asset")
|
||||
public class AssetController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private AssetService assetService;
|
||||
|
||||
@Autowired
|
||||
private SuppinfoService companyService;
|
||||
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param assetPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody AssetPagination assetPagination)throws Exception{
|
||||
List<AssetEntity> list= assetService.getList(assetPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (AssetEntity entity : list) {
|
||||
Map<String, Object> assetMap=JsonUtil.entityToMap(entity);
|
||||
assetMap.put("id", assetMap.get("asset_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(assetMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, AssetConstant.getFormData(), AssetConstant.getColumnData(), assetPagination.getModuleId(),isPc?false:false);
|
||||
for (Map<String, Object> map : realList) {
|
||||
if(ObjectUtil.isNotEmpty( map.get("supplier_id"))){
|
||||
map.put("supplier_id", companyService.getInfo(map.get("supplier_id").toString()).getCompanyName());
|
||||
}
|
||||
|
||||
}
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(assetPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param assetForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid AssetForm assetForm) {
|
||||
String b = assetService.checkForm(assetForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
assetService.saveOrUpdate(assetForm, null ,true);
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 导出Excel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出Excel")
|
||||
@PostMapping("/Actions/Export")
|
||||
public ActionResult Export(@RequestBody AssetPagination assetPagination) throws IOException {
|
||||
if (StringUtil.isEmpty(assetPagination.getSelectKey())){
|
||||
return ActionResult.fail(MsgCode.IMP011.get());
|
||||
}
|
||||
List<AssetEntity> list= assetService.getList(assetPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (AssetEntity entity : list) {
|
||||
Map<String, Object> assetMap=JsonUtil.entityToMap(entity);
|
||||
assetMap.put("id", assetMap.get("asset_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(assetMap);
|
||||
}
|
||||
//数据转换
|
||||
realList = generaterSwapUtil.swapDataList(realList, AssetConstant.getFormData(), AssetConstant.getColumnData(), assetPagination.getModuleId(),false);
|
||||
String[]keys=!StringUtil.isEmpty(assetPagination.getSelectKey())?assetPagination.getSelectKey():new String[0];
|
||||
UserInfo userInfo=userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(assetPagination.getMenuId());
|
||||
|
||||
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo,menuFullName);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出表格方法
|
||||
*/
|
||||
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo,String menuFullName){
|
||||
DownloadVO vo=DownloadVO.builder().build();
|
||||
List<ExcelExportEntity> entitys=new ArrayList<>();
|
||||
if(keys.length>0){
|
||||
for(String key:keys){
|
||||
switch(key){
|
||||
case "asset_code" :
|
||||
entitys.add(new ExcelExportEntity("资产编码" ,"asset_code"));
|
||||
break;
|
||||
case "asset_name" :
|
||||
entitys.add(new ExcelExportEntity("资产名称" ,"asset_name"));
|
||||
break;
|
||||
case "asset_type" :
|
||||
entitys.add(new ExcelExportEntity("资产类型" ,"asset_type"));
|
||||
break;
|
||||
case "asset_category" :
|
||||
entitys.add(new ExcelExportEntity("资产分类" ,"asset_category"));
|
||||
break;
|
||||
case "asset_status" :
|
||||
entitys.add(new ExcelExportEntity("资产状态" ,"asset_status"));
|
||||
break;
|
||||
case "asset_location" :
|
||||
entitys.add(new ExcelExportEntity("资产位置" ,"asset_location"));
|
||||
break;
|
||||
case "current_org_id" :
|
||||
entitys.add(new ExcelExportEntity("使用组织" ,"current_org_id"));
|
||||
break;
|
||||
case "current_user_id" :
|
||||
entitys.add(new ExcelExportEntity("保管用户" ,"current_user_id"));
|
||||
break;
|
||||
case "asset_ownership" :
|
||||
entitys.add(new ExcelExportEntity("资产权属" ,"asset_ownership"));
|
||||
break;
|
||||
case "measurement_unit" :
|
||||
entitys.add(new ExcelExportEntity("单位" ,"measurement_unit"));
|
||||
break;
|
||||
case "quantity" :
|
||||
entitys.add(new ExcelExportEntity("数量" ,"quantity"));
|
||||
break;
|
||||
case "purchase_date" :
|
||||
entitys.add(new ExcelExportEntity("购置日期" ,"purchase_date"));
|
||||
break;
|
||||
case "commissioning_date" :
|
||||
entitys.add(new ExcelExportEntity("启用日期" ,"commissioning_date"));
|
||||
break;
|
||||
case "expected_life" :
|
||||
entitys.add(new ExcelExportEntity("预计使用年限" ,"expected_life"));
|
||||
break;
|
||||
case "supplier_id" :
|
||||
entitys.add(new ExcelExportEntity("供应商" ,"supplier_id"));
|
||||
break;
|
||||
case "remark" :
|
||||
entitys.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, "表单信息");
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//去除空数据
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (Map<String, Object> map : list) {
|
||||
int i = 0;
|
||||
for (String key : keys) {
|
||||
//子表
|
||||
if (key.toLowerCase().startsWith("tablefield")) {
|
||||
String tableField = key.substring(0, key.indexOf("-" ));
|
||||
String field = key.substring(key.indexOf("-" ) + 1);
|
||||
Object o = map.get(tableField);
|
||||
if (o != null) {
|
||||
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
|
||||
for (Map<String, Object> childMap : childList) {
|
||||
if (childMap.get(field) != null) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Object o = map.get(key);
|
||||
if (o != null) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
dataList.add(map);
|
||||
}
|
||||
}
|
||||
List<ExcelExportEntity> mergerEntitys = new ArrayList<>(entitys);
|
||||
List<Map<String, Object>> mergerList=new ArrayList<>(dataList);
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(AssetConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
}
|
||||
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
|
||||
VisualUtils.mergerVertical(workbook, mergerEntitys, mergerList);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(AssetConstant.getFormData(),Arrays.asList(keys));
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName +"_"+ DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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;
|
||||
}
|
||||
@Operation(summary = "上传文件")
|
||||
@PostMapping("/Uploader")
|
||||
public ActionResult<Object> Uploader() {
|
||||
List<MultipartFile> list = UpUtil.getFileAll();
|
||||
MultipartFile file = list.get(0);
|
||||
if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) {
|
||||
String filePath = XSSEscape.escape(configValueUtil.getTemporaryFilePath());
|
||||
String fileName = XSSEscape.escape(RandomUtil.uuId() + "." + UpUtil.getFileType(file));
|
||||
//上传文件
|
||||
FileInfo fileInfo = FileUploadUtils.uploadFile(file, filePath, fileName);
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
vo.setName(fileInfo.getFilename());
|
||||
return ActionResult.success(vo);
|
||||
} else {
|
||||
return ActionResult.fail(MsgCode.FA017.get());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "模板下载")
|
||||
@GetMapping("/TemplateDownload")
|
||||
public ActionResult<DownloadVO> TemplateDownload(@RequestParam("menuId") String menuId){
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(menuId);
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("资产名称(asset_name)" ,"asset_name"));
|
||||
selectKeys.add("asset_name");
|
||||
entitys.add(new ExcelExportEntity("资产类型(asset_type)" ,"asset_type"));
|
||||
selectKeys.add("asset_type");
|
||||
entitys.add(new ExcelExportEntity("资产分类(asset_category)" ,"asset_category"));
|
||||
selectKeys.add("asset_category");
|
||||
entitys.add(new ExcelExportEntity("资产状态(asset_status)" ,"asset_status"));
|
||||
selectKeys.add("asset_status");
|
||||
entitys.add(new ExcelExportEntity("资产权属(asset_ownership)" ,"asset_ownership"));
|
||||
selectKeys.add("asset_ownership");
|
||||
entitys.add(new ExcelExportEntity("资产位置(asset_location)" ,"asset_location"));
|
||||
selectKeys.add("asset_location");
|
||||
entitys.add(new ExcelExportEntity("使用组织(current_org_id)" ,"current_org_id"));
|
||||
selectKeys.add("current_org_id");
|
||||
entitys.add(new ExcelExportEntity("单位(measurement_unit)" ,"measurement_unit"));
|
||||
selectKeys.add("measurement_unit");
|
||||
entitys.add(new ExcelExportEntity("启用日期(commissioning_date)" ,"commissioning_date"));
|
||||
selectKeys.add("commissioning_date");
|
||||
entitys.add(new ExcelExportEntity("购置日期(purchase_date)" ,"purchase_date"));
|
||||
selectKeys.add("purchase_date");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
entitys.add(new ExcelExportEntity("预计使用年限(expected_life)" ,"expected_life"));
|
||||
selectKeys.add("expected_life");
|
||||
entitys.add(new ExcelExportEntity("数量(quantity)" ,"quantity"));
|
||||
selectKeys.add("quantity");
|
||||
entitys.add(new ExcelExportEntity("保管用户(current_user_id)" ,"current_user_id"));
|
||||
selectKeys.add("current_user_id");
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(AssetConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.add(excelModel.getDataMap());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(AssetConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName + "导入模板.xls";
|
||||
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 ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入预览
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入预览" )
|
||||
@GetMapping("/ImportPreview")
|
||||
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
|
||||
Map<String, Object> headAndDataMap = new HashMap<>(2);
|
||||
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
|
||||
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
|
||||
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
|
||||
int headerRowIndex = 1;
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(headerRowIndex);
|
||||
params.setNeedVerify(true);
|
||||
try {
|
||||
InputStream inputStream = ExcelUtil.solveOrginTitle(temporary, headerRowIndex);
|
||||
List<Map> excelDataList = ExcelUtil.importExcelByInputStream(inputStream, 0, headerRowIndex, Map.class);
|
||||
//数据超过1000条
|
||||
if(excelDataList != null && excelDataList.size() > 1000) {
|
||||
return ActionResult.fail(MsgCode.ETD117.get());
|
||||
}
|
||||
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(AssetConstant.getColumnData(), ColumnDataModel.class);
|
||||
UploaderTemplateModel uploaderTemplateModel = JsonUtil.getJsonToBean(columnDataModel.getUploaderTemplateJson(), UploaderTemplateModel.class);
|
||||
List<String> selectKey = uploaderTemplateModel.getSelectKey();
|
||||
//子表合并
|
||||
List<Map<String, Object>> results = FormExecelUtils.dataMergeChildTable(excelDataList,selectKey);
|
||||
// 导入字段
|
||||
List<ExcelImFieldModel> columns = new ArrayList<>();
|
||||
columns.add(new ExcelImFieldModel("asset_name","资产名称","input"));
|
||||
columns.add(new ExcelImFieldModel("asset_type","资产类型","select"));
|
||||
columns.add(new ExcelImFieldModel("asset_category","资产分类","select"));
|
||||
columns.add(new ExcelImFieldModel("asset_status","资产状态","select"));
|
||||
columns.add(new ExcelImFieldModel("asset_ownership","资产权属","select"));
|
||||
columns.add(new ExcelImFieldModel("asset_location","资产位置","cascader"));
|
||||
columns.add(new ExcelImFieldModel("current_org_id","使用组织","organizeSelect"));
|
||||
columns.add(new ExcelImFieldModel("measurement_unit","单位","input"));
|
||||
columns.add(new ExcelImFieldModel("commissioning_date","启用日期","datePicker"));
|
||||
columns.add(new ExcelImFieldModel("purchase_date","购置日期","datePicker"));
|
||||
columns.add(new ExcelImFieldModel("remark","备注","textarea"));
|
||||
columns.add(new ExcelImFieldModel("expected_life","预计使用年限","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("quantity","数量","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("current_user_id","保管用户","userSelect"));
|
||||
headAndDataMap.put("dataRow" , results);
|
||||
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail(MsgCode.VS407.get());
|
||||
}
|
||||
return ActionResult.success(headAndDataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入数据" )
|
||||
@PostMapping("/ImportData")
|
||||
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
|
||||
List<Map<String, Object>> listData = visualImportModel.getList();
|
||||
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
|
||||
uniqueModel.setDbLinkId(AssetConstant.DBLINKID);
|
||||
uniqueModel.setUpdate(Objects.equals("1", "2"));
|
||||
|
||||
Map<String,String> tablefieldkey = new HashMap<>();
|
||||
for(String key:AssetConstant.TABLEFIELDKEY.keySet()){
|
||||
tablefieldkey.put(key,AssetConstant.TABLERENAMES.get(AssetConstant.TABLEFIELDKEY.get(key)));
|
||||
}
|
||||
ExcelImportModel excelImportModel = generaterSwapUtil.importData(AssetConstant.getFormData(),listData,uniqueModel, tablefieldkey,AssetConstant.getTableList());
|
||||
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
|
||||
for (ImportDataModel model : importDataModel) {
|
||||
String id = model.getId();
|
||||
Map<String, Object> result = model.getResultData();
|
||||
if(StringUtil.isNotEmpty(id)){
|
||||
update(id, JsonUtil.getJsonToBean(result,AssetForm.class), true);
|
||||
}else {
|
||||
create( JsonUtil.getJsonToBean(result,AssetForm.class));
|
||||
}
|
||||
}
|
||||
return ActionResult.success(excelImportModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出异常报告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出异常报告")
|
||||
@PostMapping("/ImportExceptionData")
|
||||
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(visualImportModel.getMenuId());
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
entitys.add(new ExcelExportEntity("异常原因", "errorsInfo",30));
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("资产名称(asset_name)" ,"asset_name"));
|
||||
selectKeys.add("asset_name");
|
||||
entitys.add(new ExcelExportEntity("资产类型(asset_type)" ,"asset_type"));
|
||||
selectKeys.add("asset_type");
|
||||
entitys.add(new ExcelExportEntity("资产分类(asset_category)" ,"asset_category"));
|
||||
selectKeys.add("asset_category");
|
||||
entitys.add(new ExcelExportEntity("资产状态(asset_status)" ,"asset_status"));
|
||||
selectKeys.add("asset_status");
|
||||
entitys.add(new ExcelExportEntity("资产权属(asset_ownership)" ,"asset_ownership"));
|
||||
selectKeys.add("asset_ownership");
|
||||
entitys.add(new ExcelExportEntity("资产位置(asset_location)" ,"asset_location"));
|
||||
selectKeys.add("asset_location");
|
||||
entitys.add(new ExcelExportEntity("使用组织(current_org_id)" ,"current_org_id"));
|
||||
selectKeys.add("current_org_id");
|
||||
entitys.add(new ExcelExportEntity("单位(measurement_unit)" ,"measurement_unit"));
|
||||
selectKeys.add("measurement_unit");
|
||||
entitys.add(new ExcelExportEntity("启用日期(commissioning_date)" ,"commissioning_date"));
|
||||
selectKeys.add("commissioning_date");
|
||||
entitys.add(new ExcelExportEntity("购置日期(purchase_date)" ,"purchase_date"));
|
||||
selectKeys.add("purchase_date");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
entitys.add(new ExcelExportEntity("预计使用年限(expected_life)" ,"expected_life"));
|
||||
selectKeys.add("expected_life");
|
||||
entitys.add(new ExcelExportEntity("数量(quantity)" ,"quantity"));
|
||||
selectKeys.add("quantity");
|
||||
entitys.add(new ExcelExportEntity("保管用户(current_user_id)" ,"current_user_id"));
|
||||
selectKeys.add("current_user_id");
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(AssetConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.addAll(visualImportModel.getList());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setFreezeCol(1);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(AssetConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
|
||||
String fileName = menuFullName + "错误报告_" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
AssetEntity entity= assetService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//假删除
|
||||
entity.setDeleteMark(1);
|
||||
entity.setDeleteUserId(userProvider.get().getUserId());
|
||||
entity.setDeleteTime(new Date());
|
||||
assetService.setIgnoreLogicDelete().updateById(entity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param assetForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid AssetForm assetForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
AssetEntity entity= assetService.getInfo(id);
|
||||
if(entity!=null){
|
||||
assetForm.setAssetId(String.valueOf(entity.getAssetId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = assetService.checkForm(assetForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
assetService.saveOrUpdate(assetForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
AssetEntity entity= assetService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> assetMap=JsonUtil.entityToMap(entity);
|
||||
assetMap.put("id", assetMap.get("asset_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
assetMap = generaterSwapUtil.swapDataDetail(assetMap,AssetConstant.getFormData(),"818770027560829701",isPc?false:false);
|
||||
assetMap.put("supplier_id", companyService.getInfo(assetMap.get("supplier_id").toString()).getCompanyName());
|
||||
//子表数据
|
||||
return ActionResult.success(assetMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
AssetEntity entity= assetService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> assetMap=JsonUtil.entityToMap(entity);
|
||||
assetMap.put("id", assetMap.get("asset_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
assetMap = generaterSwapUtil.swapDataForm(assetMap,AssetConstant.getFormData(),AssetConstant.TABLEFIELDKEY,AssetConstant.TABLERENAMES);
|
||||
return ActionResult.success(assetMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,932 @@
|
||||
package com.yunzhupaas.mdm.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 com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.mdm.model.company.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.annotation.YunzhupaasField;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
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 java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import com.yunzhupaas.onlinedev.model.ExcelImFieldModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportDataModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportFormCheckUniqueModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ExcelImportModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualImportModel;
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.model.visualJson.config.HeaderModel;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.util.VisualUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "企业信息" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/Company")
|
||||
public class CompanyController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
|
||||
@Autowired
|
||||
private CompanyBankService mdmCompanyBankService;
|
||||
@Autowired
|
||||
private CompanyInvoiceService companyInvoiceService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param companyPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody CompanyPagination companyPagination)throws Exception{
|
||||
List<CompanyEntity> list= companyService.getList(companyPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CompanyEntity entity : list) {
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
List<CompanyBankEntity> mdmCompanyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
companyMap.put("mdmCompanyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
List<CompanyInvoiceEntity> companyInvoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
companyMap.put("companyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
realList.add(companyMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, CompanyConstant.getFormData(), CompanyConstant.getColumnData(), companyPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(companyPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid CompanyForm companyForm) {
|
||||
String b = companyService.checkForm(companyForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
companyService.saveOrUpdate(companyForm, null ,true);
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 导出Excel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出Excel")
|
||||
@PostMapping("/Actions/Export")
|
||||
public ActionResult Export(@RequestBody CompanyPagination companyPagination) throws IOException {
|
||||
if (StringUtil.isEmpty(companyPagination.getSelectKey())){
|
||||
return ActionResult.fail(MsgCode.IMP011.get());
|
||||
}
|
||||
List<CompanyEntity> list= companyService.getList(companyPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CompanyEntity entity : list) {
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
List<CompanyBankEntity> mdmCompanyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
companyMap.put("mdmCompanyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
List<CompanyInvoiceEntity> companyInvoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
companyMap.put("companyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
realList.add(companyMap);
|
||||
}
|
||||
//数据转换
|
||||
realList = generaterSwapUtil.swapDataList(realList, CompanyConstant.getFormData(), CompanyConstant.getColumnData(), companyPagination.getModuleId(),false);
|
||||
String[]keys=!StringUtil.isEmpty(companyPagination.getSelectKey())?companyPagination.getSelectKey():new String[0];
|
||||
UserInfo userInfo=userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(companyPagination.getMenuId());
|
||||
|
||||
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo,menuFullName);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出表格方法
|
||||
*/
|
||||
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo,String menuFullName){
|
||||
DownloadVO vo=DownloadVO.builder().build();
|
||||
List<ExcelExportEntity> entitys=new ArrayList<>();
|
||||
if(keys.length>0){
|
||||
ExcelExportEntity tableFieldad9d92ExcelEntity = new ExcelExportEntity("设计子表(tableFieldad9d92)","tableFieldad9d92");
|
||||
List<ExcelExportEntity> tableFieldad9d92List = new ArrayList<>();
|
||||
ExcelExportEntity tableField46dc53ExcelEntity = new ExcelExportEntity("设计子表(tableField46dc53)","tableField46dc53");
|
||||
List<ExcelExportEntity> tableField46dc53List = new ArrayList<>();
|
||||
for(String key:keys){
|
||||
switch(key){
|
||||
case "company_code" :
|
||||
entitys.add(new ExcelExportEntity("企业编码" ,"company_code"));
|
||||
break;
|
||||
case "company_name" :
|
||||
entitys.add(new ExcelExportEntity("企业名称" ,"company_name"));
|
||||
break;
|
||||
case "short_name" :
|
||||
entitys.add(new ExcelExportEntity("简称/昵称" ,"short_name"));
|
||||
break;
|
||||
case "entity_type" :
|
||||
entitys.add(new ExcelExportEntity("类型" ,"entity_type"));
|
||||
break;
|
||||
case "credit_code" :
|
||||
entitys.add(new ExcelExportEntity("社会信用代码" ,"credit_code"));
|
||||
break;
|
||||
case "org_id" :
|
||||
entitys.add(new ExcelExportEntity("归属组织" ,"org_id"));
|
||||
break;
|
||||
case "province_id" :
|
||||
entitys.add(new ExcelExportEntity("所属地区" ,"province_id"));
|
||||
break;
|
||||
case "tax_type" :
|
||||
entitys.add(new ExcelExportEntity("纳税人类别" ,"tax_type"));
|
||||
break;
|
||||
case "enterprise_scale" :
|
||||
entitys.add(new ExcelExportEntity("企业规模" ,"enterprise_scale"));
|
||||
break;
|
||||
case "enterprise_nature" :
|
||||
entitys.add(new ExcelExportEntity("企业类型" ,"enterprise_nature"));
|
||||
break;
|
||||
case "industry_code" :
|
||||
entitys.add(new ExcelExportEntity("行业代码" ,"industry_code"));
|
||||
break;
|
||||
case "registration_date" :
|
||||
entitys.add(new ExcelExportEntity("成立日期" ,"registration_date"));
|
||||
break;
|
||||
case "registered_capital" :
|
||||
entitys.add(new ExcelExportEntity("注册资本" ,"registered_capital"));
|
||||
break;
|
||||
case "legal_representative" :
|
||||
entitys.add(new ExcelExportEntity("法定代表人" ,"legal_representative"));
|
||||
break;
|
||||
case "phone" :
|
||||
entitys.add(new ExcelExportEntity("联系电话" ,"phone"));
|
||||
break;
|
||||
case "email" :
|
||||
entitys.add(new ExcelExportEntity("邮箱" ,"email"));
|
||||
break;
|
||||
case "website" :
|
||||
entitys.add(new ExcelExportEntity("网站" ,"website"));
|
||||
break;
|
||||
case "address" :
|
||||
entitys.add(new ExcelExportEntity("地址" ,"address"));
|
||||
break;
|
||||
case "business_scope" :
|
||||
entitys.add(new ExcelExportEntity("经营范围" ,"business_scope"));
|
||||
break;
|
||||
case "remark" :
|
||||
entitys.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_name":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("开户行" ,"bank_name"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_account_name":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("账户名" ,"bank_account_name"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_account_number":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("银行账号" ,"bank_account_number"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_province":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("开户行城市" ,"bank_province"));
|
||||
break;
|
||||
case "tableFieldad9d92-remark":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
case "tableField46dc53-title_code":
|
||||
tableField46dc53List.add(new ExcelExportEntity("发票抬头编码" ,"title_code"));
|
||||
break;
|
||||
case "tableField46dc53-title_name":
|
||||
tableField46dc53List.add(new ExcelExportEntity("发票抬头名称" ,"title_name"));
|
||||
break;
|
||||
case "tableField46dc53-credit_code":
|
||||
tableField46dc53List.add(new ExcelExportEntity("纳税人识别号" ,"credit_code"));
|
||||
break;
|
||||
case "tableField46dc53-tax_type":
|
||||
tableField46dc53List.add(new ExcelExportEntity("纳税人类别" ,"tax_type"));
|
||||
break;
|
||||
case "tableField46dc53-address":
|
||||
tableField46dc53List.add(new ExcelExportEntity("地址" ,"address"));
|
||||
break;
|
||||
case "tableField46dc53-phone":
|
||||
tableField46dc53List.add(new ExcelExportEntity("电话" ,"phone"));
|
||||
break;
|
||||
case "tableField46dc53-bank_name":
|
||||
tableField46dc53List.add(new ExcelExportEntity("开户银行" ,"bank_name"));
|
||||
break;
|
||||
case "tableField46dc53-bank_account":
|
||||
tableField46dc53List.add(new ExcelExportEntity("银行账户" ,"bank_account"));
|
||||
break;
|
||||
case "tableField46dc53-is_defalut":
|
||||
tableField46dc53List.add(new ExcelExportEntity("是否默认" ,"is_defalut"));
|
||||
break;
|
||||
case "tableField46dc53-is_valid":
|
||||
tableField46dc53List.add(new ExcelExportEntity("是否有效" ,"is_valid"));
|
||||
break;
|
||||
case "tableField46dc53-remark":
|
||||
tableField46dc53List.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tableFieldad9d92List.size() > 0){
|
||||
tableFieldad9d92ExcelEntity.setList(tableFieldad9d92List);
|
||||
entitys.add(tableFieldad9d92ExcelEntity);
|
||||
}
|
||||
if(tableField46dc53List.size() > 0){
|
||||
tableField46dc53ExcelEntity.setList(tableField46dc53List);
|
||||
entitys.add(tableField46dc53ExcelEntity);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
List<ExcelExportEntity> mergerEntitys = new ArrayList<>(entitys);
|
||||
List<Map<String, Object>> mergerList=new ArrayList<>(dataList);
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(CompanyConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
}
|
||||
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
|
||||
VisualUtils.mergerVertical(workbook, mergerEntitys, mergerList);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(CompanyConstant.getFormData(),Arrays.asList(keys));
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName +"_"+ DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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;
|
||||
}
|
||||
@Operation(summary = "上传文件")
|
||||
@PostMapping("/Uploader")
|
||||
public ActionResult<Object> Uploader() {
|
||||
List<MultipartFile> list = UpUtil.getFileAll();
|
||||
MultipartFile file = list.get(0);
|
||||
if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) {
|
||||
String filePath = XSSEscape.escape(configValueUtil.getTemporaryFilePath());
|
||||
String fileName = XSSEscape.escape(RandomUtil.uuId() + "." + UpUtil.getFileType(file));
|
||||
//上传文件
|
||||
FileInfo fileInfo = FileUploadUtils.uploadFile(file, filePath, fileName);
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
vo.setName(fileInfo.getFilename());
|
||||
return ActionResult.success(vo);
|
||||
} else {
|
||||
return ActionResult.fail(MsgCode.FA017.get());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "模板下载")
|
||||
@GetMapping("/TemplateDownload")
|
||||
public ActionResult<DownloadVO> TemplateDownload(@RequestParam("menuId") String menuId){
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(menuId);
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("企业名称(company_name)" ,"company_name"));
|
||||
selectKeys.add("company_name");
|
||||
entitys.add(new ExcelExportEntity("社会信用代码(credit_code)" ,"credit_code"));
|
||||
selectKeys.add("credit_code");
|
||||
entitys.add(new ExcelExportEntity("归属组织(org_id)" ,"org_id"));
|
||||
selectKeys.add("org_id");
|
||||
entitys.add(new ExcelExportEntity("企业编码(company_code)" ,"company_code"));
|
||||
selectKeys.add("company_code");
|
||||
entitys.add(new ExcelExportEntity("简称/昵称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("类型(entity_type)" ,"entity_type"));
|
||||
selectKeys.add("entity_type");
|
||||
entitys.add(new ExcelExportEntity("纳税人类别(tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tax_type");
|
||||
entitys.add(new ExcelExportEntity("企业规模(enterprise_scale)" ,"enterprise_scale"));
|
||||
selectKeys.add("enterprise_scale");
|
||||
entitys.add(new ExcelExportEntity("企业类型(enterprise_nature)" ,"enterprise_nature"));
|
||||
selectKeys.add("enterprise_nature");
|
||||
entitys.add(new ExcelExportEntity("行业代码(industry_code)" ,"industry_code"));
|
||||
selectKeys.add("industry_code");
|
||||
entitys.add(new ExcelExportEntity("成立日期(registration_date)" ,"registration_date"));
|
||||
selectKeys.add("registration_date");
|
||||
entitys.add(new ExcelExportEntity("注册资本(registered_capital)" ,"registered_capital"));
|
||||
selectKeys.add("registered_capital");
|
||||
entitys.add(new ExcelExportEntity("法定代表人(legal_representative)" ,"legal_representative"));
|
||||
selectKeys.add("legal_representative");
|
||||
entitys.add(new ExcelExportEntity("联系电话(phone)" ,"phone"));
|
||||
selectKeys.add("phone");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("网站(website)" ,"website"));
|
||||
selectKeys.add("website");
|
||||
entitys.add(new ExcelExportEntity("地址(address)" ,"address"));
|
||||
selectKeys.add("address");
|
||||
entitys.add(new ExcelExportEntity("所属地区(province_id)" ,"province_id"));
|
||||
selectKeys.add("province_id");
|
||||
entitys.add(new ExcelExportEntity("经营范围(business_scope)" ,"business_scope"));
|
||||
selectKeys.add("business_scope");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
//tableFieldad9d92子表对象
|
||||
ExcelExportEntity tableFieldad9d92ExcelEntity = new ExcelExportEntity("设计子表(tableFieldad9d92)","tableFieldad9d92");
|
||||
List<ExcelExportEntity> tableFieldad9d92ExcelEntityList = new ArrayList<>();
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行(tableFieldad9d92-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("账户名(tableFieldad9d92-bank_account_name)" ,"bank_account_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("银行账号(tableFieldad9d92-bank_account_number)" ,"bank_account_number"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_number");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行城市(tableFieldad9d92-bank_province)" ,"bank_province"));
|
||||
selectKeys.add("tableFieldad9d92-bank_province");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("备注(tableFieldad9d92-remark)" ,"remark"));
|
||||
selectKeys.add("tableFieldad9d92-remark");
|
||||
tableFieldad9d92ExcelEntity.setList(tableFieldad9d92ExcelEntityList);
|
||||
if(tableFieldad9d92ExcelEntityList.size() > 0){
|
||||
entitys.add(tableFieldad9d92ExcelEntity);
|
||||
}
|
||||
//tableField46dc53子表对象
|
||||
ExcelExportEntity tableField46dc53ExcelEntity = new ExcelExportEntity("设计子表(tableField46dc53)","tableField46dc53");
|
||||
List<ExcelExportEntity> tableField46dc53ExcelEntityList = new ArrayList<>();
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("发票抬头名称(tableField46dc53-title_name)" ,"title_name"));
|
||||
selectKeys.add("tableField46dc53-title_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人识别号(tableField46dc53-credit_code)" ,"credit_code"));
|
||||
selectKeys.add("tableField46dc53-credit_code");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人类别(tableField46dc53-tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tableField46dc53-tax_type");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("地址(tableField46dc53-address)" ,"address"));
|
||||
selectKeys.add("tableField46dc53-address");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("电话(tableField46dc53-phone)" ,"phone"));
|
||||
selectKeys.add("tableField46dc53-phone");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("开户银行(tableField46dc53-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableField46dc53-bank_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("银行账户(tableField46dc53-bank_account)" ,"bank_account"));
|
||||
selectKeys.add("tableField46dc53-bank_account");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否默认(tableField46dc53-is_defalut)" ,"is_defalut"));
|
||||
selectKeys.add("tableField46dc53-is_defalut");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否有效(tableField46dc53-is_valid)" ,"is_valid"));
|
||||
selectKeys.add("tableField46dc53-is_valid");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("备注(tableField46dc53-remark)" ,"remark"));
|
||||
selectKeys.add("tableField46dc53-remark");
|
||||
tableField46dc53ExcelEntity.setList(tableField46dc53ExcelEntityList);
|
||||
if(tableField46dc53ExcelEntityList.size() > 0){
|
||||
entitys.add(tableField46dc53ExcelEntity);
|
||||
}
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(CompanyConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.add(excelModel.getDataMap());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(CompanyConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName + "导入模板.xls";
|
||||
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 ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入预览
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入预览" )
|
||||
@GetMapping("/ImportPreview")
|
||||
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
|
||||
Map<String, Object> headAndDataMap = new HashMap<>(2);
|
||||
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
|
||||
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
|
||||
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
|
||||
int headerRowIndex = 2;
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(headerRowIndex);
|
||||
params.setNeedVerify(true);
|
||||
try {
|
||||
InputStream inputStream = ExcelUtil.solveOrginTitle(temporary, headerRowIndex);
|
||||
List<Map> excelDataList = ExcelUtil.importExcelByInputStream(inputStream, 0, headerRowIndex, Map.class);
|
||||
//数据超过1000条
|
||||
if(excelDataList != null && excelDataList.size() > 1000) {
|
||||
return ActionResult.fail(MsgCode.ETD117.get());
|
||||
}
|
||||
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(CompanyConstant.getColumnData(), ColumnDataModel.class);
|
||||
UploaderTemplateModel uploaderTemplateModel = JsonUtil.getJsonToBean(columnDataModel.getUploaderTemplateJson(), UploaderTemplateModel.class);
|
||||
List<String> selectKey = uploaderTemplateModel.getSelectKey();
|
||||
//子表合并
|
||||
List<Map<String, Object>> results = FormExecelUtils.dataMergeChildTable(excelDataList,selectKey);
|
||||
// 导入字段
|
||||
List<ExcelImFieldModel> columns = new ArrayList<>();
|
||||
columns.add(new ExcelImFieldModel("company_name","企业名称","input"));
|
||||
columns.add(new ExcelImFieldModel("credit_code","社会信用代码","input"));
|
||||
columns.add(new ExcelImFieldModel("org_id","归属组织","organizeSelect"));
|
||||
columns.add(new ExcelImFieldModel("company_code","企业编码","billRule"));
|
||||
columns.add(new ExcelImFieldModel("short_name","简称/昵称","input"));
|
||||
columns.add(new ExcelImFieldModel("entity_type","类型","radio"));
|
||||
columns.add(new ExcelImFieldModel("tax_type","纳税人类别","select"));
|
||||
columns.add(new ExcelImFieldModel("enterprise_scale","企业规模","select"));
|
||||
columns.add(new ExcelImFieldModel("enterprise_nature","企业类型","select"));
|
||||
columns.add(new ExcelImFieldModel("industry_code","行业代码","select"));
|
||||
columns.add(new ExcelImFieldModel("registration_date","成立日期","datePicker"));
|
||||
columns.add(new ExcelImFieldModel("registered_capital","注册资本","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("legal_representative","法定代表人","input"));
|
||||
columns.add(new ExcelImFieldModel("phone","联系电话","input"));
|
||||
columns.add(new ExcelImFieldModel("email","邮箱","input"));
|
||||
columns.add(new ExcelImFieldModel("website","网站","input"));
|
||||
columns.add(new ExcelImFieldModel("address","地址","input"));
|
||||
columns.add(new ExcelImFieldModel("province_id","所属地区","areaSelect"));
|
||||
columns.add(new ExcelImFieldModel("business_scope","经营范围","textarea"));
|
||||
columns.add(new ExcelImFieldModel("remark","备注","textarea"));
|
||||
//tableFieldad9d92子表对象
|
||||
List<ExcelImFieldModel> tableFieldad9d92columns = new ArrayList<>();
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_name" ,"开户行"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_account_name" ,"账户名"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_account_number" ,"银行账号"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_province" ,"开户行城市"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("remark" ,"备注"));
|
||||
columns.add(new ExcelImFieldModel("tableFieldad9d92","设计子表","table",tableFieldad9d92columns));
|
||||
//tableField46dc53子表对象
|
||||
List<ExcelImFieldModel> tableField46dc53columns = new ArrayList<>();
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("title_name" ,"发票抬头名称"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("credit_code" ,"纳税人识别号"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("tax_type" ,"纳税人类别"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("address" ,"地址"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("phone" ,"电话"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("bank_name" ,"开户银行"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("bank_account" ,"银行账户"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("is_defalut" ,"是否默认"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("is_valid" ,"是否有效"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("remark" ,"备注"));
|
||||
columns.add(new ExcelImFieldModel("tableField46dc53","设计子表","table",tableField46dc53columns));
|
||||
headAndDataMap.put("dataRow" , results);
|
||||
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail(MsgCode.VS407.get());
|
||||
}
|
||||
return ActionResult.success(headAndDataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入数据" )
|
||||
@PostMapping("/ImportData")
|
||||
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
|
||||
List<Map<String, Object>> listData = visualImportModel.getList();
|
||||
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
|
||||
uniqueModel.setDbLinkId(CompanyConstant.DBLINKID);
|
||||
uniqueModel.setUpdate(Objects.equals("2", "2"));
|
||||
|
||||
Map<String,String> tablefieldkey = new HashMap<>();
|
||||
for(String key:CompanyConstant.TABLEFIELDKEY.keySet()){
|
||||
tablefieldkey.put(key,CompanyConstant.TABLERENAMES.get(CompanyConstant.TABLEFIELDKEY.get(key)));
|
||||
}
|
||||
ExcelImportModel excelImportModel = generaterSwapUtil.importData(CompanyConstant.getFormData(),listData,uniqueModel, tablefieldkey,CompanyConstant.getTableList());
|
||||
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
|
||||
for (ImportDataModel model : importDataModel) {
|
||||
String id = model.getId();
|
||||
Map<String, Object> result = model.getResultData();
|
||||
if(StringUtil.isNotEmpty(id)){
|
||||
update(id, JsonUtil.getJsonToBean(result,CompanyForm.class), true);
|
||||
}else {
|
||||
create( JsonUtil.getJsonToBean(result,CompanyForm.class));
|
||||
}
|
||||
}
|
||||
return ActionResult.success(excelImportModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出异常报告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出异常报告")
|
||||
@PostMapping("/ImportExceptionData")
|
||||
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(visualImportModel.getMenuId());
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
entitys.add(new ExcelExportEntity("异常原因", "errorsInfo",30));
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("企业名称(company_name)" ,"company_name"));
|
||||
selectKeys.add("company_name");
|
||||
entitys.add(new ExcelExportEntity("社会信用代码(credit_code)" ,"credit_code"));
|
||||
selectKeys.add("credit_code");
|
||||
entitys.add(new ExcelExportEntity("归属组织(org_id)" ,"org_id"));
|
||||
selectKeys.add("org_id");
|
||||
entitys.add(new ExcelExportEntity("企业编码(company_code)" ,"company_code"));
|
||||
selectKeys.add("company_code");
|
||||
entitys.add(new ExcelExportEntity("简称/昵称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("类型(entity_type)" ,"entity_type"));
|
||||
selectKeys.add("entity_type");
|
||||
entitys.add(new ExcelExportEntity("纳税人类别(tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tax_type");
|
||||
entitys.add(new ExcelExportEntity("企业规模(enterprise_scale)" ,"enterprise_scale"));
|
||||
selectKeys.add("enterprise_scale");
|
||||
entitys.add(new ExcelExportEntity("企业类型(enterprise_nature)" ,"enterprise_nature"));
|
||||
selectKeys.add("enterprise_nature");
|
||||
entitys.add(new ExcelExportEntity("行业代码(industry_code)" ,"industry_code"));
|
||||
selectKeys.add("industry_code");
|
||||
entitys.add(new ExcelExportEntity("成立日期(registration_date)" ,"registration_date"));
|
||||
selectKeys.add("registration_date");
|
||||
entitys.add(new ExcelExportEntity("注册资本(registered_capital)" ,"registered_capital"));
|
||||
selectKeys.add("registered_capital");
|
||||
entitys.add(new ExcelExportEntity("法定代表人(legal_representative)" ,"legal_representative"));
|
||||
selectKeys.add("legal_representative");
|
||||
entitys.add(new ExcelExportEntity("联系电话(phone)" ,"phone"));
|
||||
selectKeys.add("phone");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("网站(website)" ,"website"));
|
||||
selectKeys.add("website");
|
||||
entitys.add(new ExcelExportEntity("地址(address)" ,"address"));
|
||||
selectKeys.add("address");
|
||||
entitys.add(new ExcelExportEntity("所属地区(province_id)" ,"province_id"));
|
||||
selectKeys.add("province_id");
|
||||
entitys.add(new ExcelExportEntity("经营范围(business_scope)" ,"business_scope"));
|
||||
selectKeys.add("business_scope");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
//tableFieldad9d92子表对象
|
||||
ExcelExportEntity tableFieldad9d92ExcelEntity = new ExcelExportEntity("设计子表(tableFieldad9d92)","tableFieldad9d92");
|
||||
List<ExcelExportEntity> tableFieldad9d92ExcelEntityList = new ArrayList<>();
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行(tableFieldad9d92-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("账户名(tableFieldad9d92-bank_account_name)" ,"bank_account_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("银行账号(tableFieldad9d92-bank_account_number)" ,"bank_account_number"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_number");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行城市(tableFieldad9d92-bank_province)" ,"bank_province"));
|
||||
selectKeys.add("tableFieldad9d92-bank_province");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("备注(tableFieldad9d92-remark)" ,"remark"));
|
||||
selectKeys.add("tableFieldad9d92-remark");
|
||||
tableFieldad9d92ExcelEntity.setList(tableFieldad9d92ExcelEntityList);
|
||||
entitys.add(tableFieldad9d92ExcelEntity);
|
||||
//tableField46dc53子表对象
|
||||
ExcelExportEntity tableField46dc53ExcelEntity = new ExcelExportEntity("设计子表(tableField46dc53)","tableField46dc53");
|
||||
List<ExcelExportEntity> tableField46dc53ExcelEntityList = new ArrayList<>();
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("发票抬头名称(tableField46dc53-title_name)" ,"title_name"));
|
||||
selectKeys.add("tableField46dc53-title_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人识别号(tableField46dc53-credit_code)" ,"credit_code"));
|
||||
selectKeys.add("tableField46dc53-credit_code");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人类别(tableField46dc53-tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tableField46dc53-tax_type");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("地址(tableField46dc53-address)" ,"address"));
|
||||
selectKeys.add("tableField46dc53-address");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("电话(tableField46dc53-phone)" ,"phone"));
|
||||
selectKeys.add("tableField46dc53-phone");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("开户银行(tableField46dc53-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableField46dc53-bank_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("银行账户(tableField46dc53-bank_account)" ,"bank_account"));
|
||||
selectKeys.add("tableField46dc53-bank_account");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否默认(tableField46dc53-is_defalut)" ,"is_defalut"));
|
||||
selectKeys.add("tableField46dc53-is_defalut");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否有效(tableField46dc53-is_valid)" ,"is_valid"));
|
||||
selectKeys.add("tableField46dc53-is_valid");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("备注(tableField46dc53-remark)" ,"remark"));
|
||||
selectKeys.add("tableField46dc53-remark");
|
||||
tableField46dc53ExcelEntity.setList(tableField46dc53ExcelEntityList);
|
||||
entitys.add(tableField46dc53ExcelEntity);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(CompanyConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.addAll(visualImportModel.getList());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setFreezeCol(1);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(CompanyConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
|
||||
String fileName = menuFullName + "错误报告_" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//主表数据删除
|
||||
companyService.delete(entity);
|
||||
QueryWrapper<CompanyBankEntity> queryWrapperMdmCompanyBank=new QueryWrapper<>();
|
||||
queryWrapperMdmCompanyBank.lambda().eq(CompanyBankEntity::getCompanyId,entity.getCompanyId());
|
||||
//子表数据删除
|
||||
mdmCompanyBankService.remove(queryWrapperMdmCompanyBank);
|
||||
QueryWrapper<CompanyInvoiceEntity> queryWrapperCompanyInvoice=new QueryWrapper<>();
|
||||
queryWrapperCompanyInvoice.lambda().eq(CompanyInvoiceEntity::getCompanyId,entity.getCompanyId());
|
||||
//子表数据删除
|
||||
companyInvoiceService.remove(queryWrapperCompanyInvoice);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid CompanyForm companyForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
companyForm.setCompanyId(String.valueOf(entity.getCompanyId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = companyService.checkForm(companyForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
companyService.saveOrUpdate(companyForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
List<CompanyBankEntity> mdmCompanyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
companyMap.put("mdmCompanyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
List<CompanyInvoiceEntity> companyInvoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
companyMap.put("companyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
companyMap = generaterSwapUtil.swapDataDetail(companyMap,CompanyConstant.getFormData(),"806858527036409349",isPc?false:false);
|
||||
//子表数据
|
||||
companyMap.put("mdmCompanyBankList",companyMap.get("tableFieldad9d92"));
|
||||
companyMap.put("companyInvoiceList",companyMap.get("tableField46dc53"));
|
||||
return ActionResult.success(companyMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
List<CompanyBankEntity> mdmCompanyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
companyMap.put("mdmCompanyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(mdmCompanyBankList)));
|
||||
List<CompanyInvoiceEntity> companyInvoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
companyMap.put("companyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
companyMap = generaterSwapUtil.swapDataForm(companyMap,CompanyConstant.getFormData(),CompanyConstant.TABLEFIELDKEY,CompanyConstant.TABLERENAMES);
|
||||
return ActionResult.success(companyMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,970 @@
|
||||
package com.yunzhupaas.mdm.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.mdm.model.custinfo.CustinfoConstant;
|
||||
import com.yunzhupaas.mdm.model.custinfo.CustinfoForm;
|
||||
import com.yunzhupaas.mdm.model.custinfo.CustinfoPagination;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
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 java.io.InputStream;
|
||||
import com.yunzhupaas.onlinedev.model.ExcelImFieldModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportDataModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportFormCheckUniqueModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ExcelImportModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualImportModel;
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.model.visualJson.config.HeaderModel;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.util.VisualUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 客户信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "客户信息" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/Custinfo")
|
||||
public class CustinfoController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private CustinfoService companyService;
|
||||
|
||||
@Autowired
|
||||
private CompanyInvoiceService companyInvoiceService;
|
||||
@Autowired
|
||||
private CompanyBankService companyBankService;
|
||||
|
||||
@Autowired
|
||||
private CustomerService customerService;
|
||||
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param companyPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody CustinfoPagination companyPagination)throws Exception{
|
||||
List<CompanyEntity> list= companyService.getList(companyPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CompanyEntity entity : list) {
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
CustomerEntity customerEntity = entity.getCustomer();
|
||||
if(ObjectUtil.isNotEmpty(customerEntity)){
|
||||
Map<String, Object> customerMap=JsonUtil.entityToMap(customerEntity);
|
||||
for(String key:customerMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_customer_yunzhupaas_"+key,customerMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<CompanyInvoiceEntity> companyInvoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
companyMap.put("companyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
realList.add(companyMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, CustinfoConstant.getFormData(), CustinfoConstant.getColumnData(), companyPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(companyPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid CustinfoForm companyForm) {
|
||||
String b = companyService.checkForm(companyForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
companyService.saveOrUpdate(companyForm, null ,true);
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 导出Excel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出Excel")
|
||||
@PostMapping("/Actions/Export")
|
||||
public ActionResult Export(@RequestBody CustinfoPagination companyPagination) throws IOException {
|
||||
if (StringUtil.isEmpty(companyPagination.getSelectKey())){
|
||||
return ActionResult.fail(MsgCode.IMP011.get());
|
||||
}
|
||||
List<CompanyEntity> list= companyService.getList(companyPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CompanyEntity entity : list) {
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
CustomerEntity customerEntity = entity.getCustomer();
|
||||
if(ObjectUtil.isNotEmpty(customerEntity)){
|
||||
Map<String, Object> customerMap=JsonUtil.entityToMap(customerEntity);
|
||||
for(String key:customerMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_customer_yunzhupaas_"+key,customerMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<CompanyInvoiceEntity> companyInvoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
companyMap.put("companyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
realList.add(companyMap);
|
||||
}
|
||||
//数据转换
|
||||
realList = generaterSwapUtil.swapDataList(realList, CustinfoConstant.getFormData(), CustinfoConstant.getColumnData(), companyPagination.getModuleId(),false);
|
||||
String[]keys=!StringUtil.isEmpty(companyPagination.getSelectKey())?companyPagination.getSelectKey():new String[0];
|
||||
UserInfo userInfo=userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(companyPagination.getMenuId());
|
||||
|
||||
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo,menuFullName);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出表格方法
|
||||
*/
|
||||
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo,String menuFullName){
|
||||
DownloadVO vo=DownloadVO.builder().build();
|
||||
List<ExcelExportEntity> entitys=new ArrayList<>();
|
||||
if(keys.length>0){
|
||||
ExcelExportEntity tableField46dc53ExcelEntity = new ExcelExportEntity("设计子表(tableField46dc53)","tableField46dc53");
|
||||
List<ExcelExportEntity> tableField46dc53List = new ArrayList<>();
|
||||
ExcelExportEntity tableFieldad9d92ExcelEntity = new ExcelExportEntity("设计子表(tableFieldad9d92)","tableFieldad9d92");
|
||||
List<ExcelExportEntity> tableFieldad9d92List = new ArrayList<>();
|
||||
for(String key:keys){
|
||||
switch(key){
|
||||
case "company_code" :
|
||||
entitys.add(new ExcelExportEntity("客户编码" ,"company_code"));
|
||||
break;
|
||||
case "company_name" :
|
||||
entitys.add(new ExcelExportEntity("客户名称" ,"company_name"));
|
||||
break;
|
||||
case "short_name" :
|
||||
entitys.add(new ExcelExportEntity("简称/昵称" ,"short_name"));
|
||||
break;
|
||||
case "entity_type" :
|
||||
entitys.add(new ExcelExportEntity("类型" ,"entity_type"));
|
||||
break;
|
||||
case "credit_code" :
|
||||
entitys.add(new ExcelExportEntity("社会信用代码" ,"credit_code"));
|
||||
break;
|
||||
case "org_id" :
|
||||
entitys.add(new ExcelExportEntity("归属组织" ,"org_id"));
|
||||
break;
|
||||
case "province_id" :
|
||||
entitys.add(new ExcelExportEntity("所属地区" ,"province_id"));
|
||||
break;
|
||||
case "tax_type" :
|
||||
entitys.add(new ExcelExportEntity("纳税人类别" ,"tax_type"));
|
||||
break;
|
||||
case "enterprise_scale" :
|
||||
entitys.add(new ExcelExportEntity("企业规模" ,"enterprise_scale"));
|
||||
break;
|
||||
case "enterprise_nature" :
|
||||
entitys.add(new ExcelExportEntity("企业类型" ,"enterprise_nature"));
|
||||
break;
|
||||
case "industry_code" :
|
||||
entitys.add(new ExcelExportEntity("行业代码" ,"industry_code"));
|
||||
break;
|
||||
case "registration_date" :
|
||||
entitys.add(new ExcelExportEntity("成立日期" ,"registration_date"));
|
||||
break;
|
||||
case "registered_capital" :
|
||||
entitys.add(new ExcelExportEntity("注册资本" ,"registered_capital"));
|
||||
break;
|
||||
case "legal_representative" :
|
||||
entitys.add(new ExcelExportEntity("法定代表人" ,"legal_representative"));
|
||||
break;
|
||||
case "phone" :
|
||||
entitys.add(new ExcelExportEntity("联系电话" ,"phone"));
|
||||
break;
|
||||
case "email" :
|
||||
entitys.add(new ExcelExportEntity("邮箱" ,"email"));
|
||||
break;
|
||||
case "website" :
|
||||
entitys.add(new ExcelExportEntity("网站" ,"website"));
|
||||
break;
|
||||
case "address" :
|
||||
entitys.add(new ExcelExportEntity("地址" ,"address"));
|
||||
break;
|
||||
case "business_scope" :
|
||||
entitys.add(new ExcelExportEntity("经营范围" ,"business_scope"));
|
||||
break;
|
||||
case "remark" :
|
||||
entitys.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_customer_yunzhupaas_major_person_id" :
|
||||
entitys.add(new ExcelExportEntity("销售责任人" ,"yunzhupaas_mdm_customer_yunzhupaas_major_person_id"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_customer_yunzhupaas_customer_level" :
|
||||
entitys.add(new ExcelExportEntity("客户级别" ,"yunzhupaas_mdm_customer_yunzhupaas_customer_level"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_customer_yunzhupaas_customer_source" :
|
||||
entitys.add(new ExcelExportEntity("客户来源" ,"yunzhupaas_mdm_customer_yunzhupaas_customer_source"));
|
||||
break;
|
||||
case "tableField46dc53-title_code":
|
||||
tableField46dc53List.add(new ExcelExportEntity("发票抬头编码" ,"title_code"));
|
||||
break;
|
||||
case "tableField46dc53-title_name":
|
||||
tableField46dc53List.add(new ExcelExportEntity("发票抬头名称" ,"title_name"));
|
||||
break;
|
||||
case "tableField46dc53-credit_code":
|
||||
tableField46dc53List.add(new ExcelExportEntity("纳税人识别号" ,"credit_code"));
|
||||
break;
|
||||
case "tableField46dc53-tax_type":
|
||||
tableField46dc53List.add(new ExcelExportEntity("纳税人类别" ,"tax_type"));
|
||||
break;
|
||||
case "tableField46dc53-address":
|
||||
tableField46dc53List.add(new ExcelExportEntity("地址" ,"address"));
|
||||
break;
|
||||
case "tableField46dc53-phone":
|
||||
tableField46dc53List.add(new ExcelExportEntity("电话" ,"phone"));
|
||||
break;
|
||||
case "tableField46dc53-bank_name":
|
||||
tableField46dc53List.add(new ExcelExportEntity("开户银行" ,"bank_name"));
|
||||
break;
|
||||
case "tableField46dc53-bank_account":
|
||||
tableField46dc53List.add(new ExcelExportEntity("银行账户" ,"bank_account"));
|
||||
break;
|
||||
case "tableField46dc53-is_defalut":
|
||||
tableField46dc53List.add(new ExcelExportEntity("是否默认" ,"is_defalut"));
|
||||
break;
|
||||
case "tableField46dc53-is_valid":
|
||||
tableField46dc53List.add(new ExcelExportEntity("是否有效" ,"is_valid"));
|
||||
break;
|
||||
case "tableField46dc53-remark":
|
||||
tableField46dc53List.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_name":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("开户行" ,"bank_name"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_account_name":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("账户名" ,"bank_account_name"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_account_number":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("银行账号" ,"bank_account_number"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_province":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("开户行城市" ,"bank_province"));
|
||||
break;
|
||||
case "tableFieldad9d92-remark":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tableField46dc53List.size() > 0){
|
||||
tableField46dc53ExcelEntity.setList(tableField46dc53List);
|
||||
entitys.add(tableField46dc53ExcelEntity);
|
||||
}
|
||||
if(tableFieldad9d92List.size() > 0){
|
||||
tableFieldad9d92ExcelEntity.setList(tableFieldad9d92List);
|
||||
entitys.add(tableFieldad9d92ExcelEntity);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
List<ExcelExportEntity> mergerEntitys = new ArrayList<>(entitys);
|
||||
List<Map<String, Object>> mergerList=new ArrayList<>(dataList);
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(CustinfoConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
}
|
||||
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
|
||||
VisualUtils.mergerVertical(workbook, mergerEntitys, mergerList);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(CustinfoConstant.getFormData(),Arrays.asList(keys));
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName +"_"+ DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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;
|
||||
}
|
||||
@Operation(summary = "上传文件")
|
||||
@PostMapping("/Uploader")
|
||||
public ActionResult<Object> Uploader() {
|
||||
List<MultipartFile> list = UpUtil.getFileAll();
|
||||
MultipartFile file = list.get(0);
|
||||
if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) {
|
||||
String filePath = XSSEscape.escape(configValueUtil.getTemporaryFilePath());
|
||||
String fileName = XSSEscape.escape(RandomUtil.uuId() + "." + UpUtil.getFileType(file));
|
||||
//上传文件
|
||||
FileInfo fileInfo = FileUploadUtils.uploadFile(file, filePath, fileName);
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
vo.setName(fileInfo.getFilename());
|
||||
return ActionResult.success(vo);
|
||||
} else {
|
||||
return ActionResult.fail(MsgCode.FA017.get());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "模板下载")
|
||||
@GetMapping("/TemplateDownload")
|
||||
public ActionResult<DownloadVO> TemplateDownload(@RequestParam("menuId") String menuId){
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(menuId);
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("客户名称(company_name)" ,"company_name"));
|
||||
selectKeys.add("company_name");
|
||||
entitys.add(new ExcelExportEntity("社会信用代码(credit_code)" ,"credit_code"));
|
||||
selectKeys.add("credit_code");
|
||||
entitys.add(new ExcelExportEntity("归属组织(org_id)" ,"org_id"));
|
||||
selectKeys.add("org_id");
|
||||
entitys.add(new ExcelExportEntity("客户编码(company_code)" ,"company_code"));
|
||||
selectKeys.add("company_code");
|
||||
entitys.add(new ExcelExportEntity("简称/昵称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("类型(entity_type)" ,"entity_type"));
|
||||
selectKeys.add("entity_type");
|
||||
entitys.add(new ExcelExportEntity("纳税人类别(tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tax_type");
|
||||
entitys.add(new ExcelExportEntity("企业规模(enterprise_scale)" ,"enterprise_scale"));
|
||||
selectKeys.add("enterprise_scale");
|
||||
entitys.add(new ExcelExportEntity("企业类型(enterprise_nature)" ,"enterprise_nature"));
|
||||
selectKeys.add("enterprise_nature");
|
||||
entitys.add(new ExcelExportEntity("行业代码(industry_code)" ,"industry_code"));
|
||||
selectKeys.add("industry_code");
|
||||
entitys.add(new ExcelExportEntity("成立日期(registration_date)" ,"registration_date"));
|
||||
selectKeys.add("registration_date");
|
||||
entitys.add(new ExcelExportEntity("注册资本(registered_capital)" ,"registered_capital"));
|
||||
selectKeys.add("registered_capital");
|
||||
entitys.add(new ExcelExportEntity("法定代表人(legal_representative)" ,"legal_representative"));
|
||||
selectKeys.add("legal_representative");
|
||||
entitys.add(new ExcelExportEntity("联系电话(phone)" ,"phone"));
|
||||
selectKeys.add("phone");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("网站(website)" ,"website"));
|
||||
selectKeys.add("website");
|
||||
entitys.add(new ExcelExportEntity("地址(address)" ,"address"));
|
||||
selectKeys.add("address");
|
||||
entitys.add(new ExcelExportEntity("所属地区(province_id)" ,"province_id"));
|
||||
selectKeys.add("province_id");
|
||||
entitys.add(new ExcelExportEntity("经营范围(business_scope)" ,"business_scope"));
|
||||
selectKeys.add("business_scope");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
//tableField46dc53子表对象
|
||||
ExcelExportEntity tableField46dc53ExcelEntity = new ExcelExportEntity("设计子表(tableField46dc53)","tableField46dc53");
|
||||
List<ExcelExportEntity> tableField46dc53ExcelEntityList = new ArrayList<>();
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("发票抬头名称(tableField46dc53-title_name)" ,"title_name"));
|
||||
selectKeys.add("tableField46dc53-title_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人识别号(tableField46dc53-credit_code)" ,"credit_code"));
|
||||
selectKeys.add("tableField46dc53-credit_code");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人类别(tableField46dc53-tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tableField46dc53-tax_type");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("地址(tableField46dc53-address)" ,"address"));
|
||||
selectKeys.add("tableField46dc53-address");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("电话(tableField46dc53-phone)" ,"phone"));
|
||||
selectKeys.add("tableField46dc53-phone");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("开户银行(tableField46dc53-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableField46dc53-bank_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("银行账户(tableField46dc53-bank_account)" ,"bank_account"));
|
||||
selectKeys.add("tableField46dc53-bank_account");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否默认(tableField46dc53-is_defalut)" ,"is_defalut"));
|
||||
selectKeys.add("tableField46dc53-is_defalut");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否有效(tableField46dc53-is_valid)" ,"is_valid"));
|
||||
selectKeys.add("tableField46dc53-is_valid");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("备注(tableField46dc53-remark)" ,"remark"));
|
||||
selectKeys.add("tableField46dc53-remark");
|
||||
tableField46dc53ExcelEntity.setList(tableField46dc53ExcelEntityList);
|
||||
if(tableField46dc53ExcelEntityList.size() > 0){
|
||||
entitys.add(tableField46dc53ExcelEntity);
|
||||
}
|
||||
//tableFieldad9d92子表对象
|
||||
ExcelExportEntity tableFieldad9d92ExcelEntity = new ExcelExportEntity("设计子表(tableFieldad9d92)","tableFieldad9d92");
|
||||
List<ExcelExportEntity> tableFieldad9d92ExcelEntityList = new ArrayList<>();
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行(tableFieldad9d92-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("账户名(tableFieldad9d92-bank_account_name)" ,"bank_account_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("银行账号(tableFieldad9d92-bank_account_number)" ,"bank_account_number"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_number");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行城市(tableFieldad9d92-bank_province)" ,"bank_province"));
|
||||
selectKeys.add("tableFieldad9d92-bank_province");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("备注(tableFieldad9d92-remark)" ,"remark"));
|
||||
selectKeys.add("tableFieldad9d92-remark");
|
||||
tableFieldad9d92ExcelEntity.setList(tableFieldad9d92ExcelEntityList);
|
||||
if(tableFieldad9d92ExcelEntityList.size() > 0){
|
||||
entitys.add(tableFieldad9d92ExcelEntity);
|
||||
}
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(CustinfoConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.add(excelModel.getDataMap());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(CustinfoConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName + "导入模板.xls";
|
||||
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 ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入预览
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入预览" )
|
||||
@GetMapping("/ImportPreview")
|
||||
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
|
||||
Map<String, Object> headAndDataMap = new HashMap<>(2);
|
||||
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
|
||||
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
|
||||
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
|
||||
int headerRowIndex = 2;
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(headerRowIndex);
|
||||
params.setNeedVerify(true);
|
||||
try {
|
||||
InputStream inputStream = ExcelUtil.solveOrginTitle(temporary, headerRowIndex);
|
||||
List<Map> excelDataList = ExcelUtil.importExcelByInputStream(inputStream, 0, headerRowIndex, Map.class);
|
||||
//数据超过1000条
|
||||
if(excelDataList != null && excelDataList.size() > 1000) {
|
||||
return ActionResult.fail(MsgCode.ETD117.get());
|
||||
}
|
||||
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(CustinfoConstant.getColumnData(), ColumnDataModel.class);
|
||||
UploaderTemplateModel uploaderTemplateModel = JsonUtil.getJsonToBean(columnDataModel.getUploaderTemplateJson(), UploaderTemplateModel.class);
|
||||
List<String> selectKey = uploaderTemplateModel.getSelectKey();
|
||||
//子表合并
|
||||
List<Map<String, Object>> results = FormExecelUtils.dataMergeChildTable(excelDataList,selectKey);
|
||||
// 导入字段
|
||||
List<ExcelImFieldModel> columns = new ArrayList<>();
|
||||
columns.add(new ExcelImFieldModel("company_name","客户名称","input"));
|
||||
columns.add(new ExcelImFieldModel("credit_code","社会信用代码","input"));
|
||||
columns.add(new ExcelImFieldModel("org_id","归属组织","organizeSelect"));
|
||||
columns.add(new ExcelImFieldModel("company_code","客户编码","billRule"));
|
||||
columns.add(new ExcelImFieldModel("short_name","简称/昵称","input"));
|
||||
columns.add(new ExcelImFieldModel("entity_type","类型","radio"));
|
||||
columns.add(new ExcelImFieldModel("tax_type","纳税人类别","select"));
|
||||
columns.add(new ExcelImFieldModel("enterprise_scale","企业规模","select"));
|
||||
columns.add(new ExcelImFieldModel("enterprise_nature","企业类型","select"));
|
||||
columns.add(new ExcelImFieldModel("industry_code","行业代码","select"));
|
||||
columns.add(new ExcelImFieldModel("registration_date","成立日期","datePicker"));
|
||||
columns.add(new ExcelImFieldModel("registered_capital","注册资本","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("legal_representative","法定代表人","input"));
|
||||
columns.add(new ExcelImFieldModel("phone","联系电话","input"));
|
||||
columns.add(new ExcelImFieldModel("email","邮箱","input"));
|
||||
columns.add(new ExcelImFieldModel("website","网站","input"));
|
||||
columns.add(new ExcelImFieldModel("address","地址","input"));
|
||||
columns.add(new ExcelImFieldModel("province_id","所属地区","areaSelect"));
|
||||
columns.add(new ExcelImFieldModel("business_scope","经营范围","textarea"));
|
||||
columns.add(new ExcelImFieldModel("remark","备注","textarea"));
|
||||
//tableField46dc53子表对象
|
||||
List<ExcelImFieldModel> tableField46dc53columns = new ArrayList<>();
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("title_name" ,"发票抬头名称"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("credit_code" ,"纳税人识别号"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("tax_type" ,"纳税人类别"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("address" ,"地址"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("phone" ,"电话"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("bank_name" ,"开户银行"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("bank_account" ,"银行账户"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("is_defalut" ,"是否默认"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("is_valid" ,"是否有效"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("remark" ,"备注"));
|
||||
columns.add(new ExcelImFieldModel("tableField46dc53","设计子表","table",tableField46dc53columns));
|
||||
//tableFieldad9d92子表对象
|
||||
List<ExcelImFieldModel> tableFieldad9d92columns = new ArrayList<>();
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_name" ,"开户行"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_account_name" ,"账户名"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_account_number" ,"银行账号"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_province" ,"开户行城市"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("remark" ,"备注"));
|
||||
columns.add(new ExcelImFieldModel("tableFieldad9d92","设计子表","table",tableFieldad9d92columns));
|
||||
headAndDataMap.put("dataRow" , results);
|
||||
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail(MsgCode.VS407.get());
|
||||
}
|
||||
return ActionResult.success(headAndDataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入数据" )
|
||||
@PostMapping("/ImportData")
|
||||
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
|
||||
List<Map<String, Object>> listData = visualImportModel.getList();
|
||||
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
|
||||
uniqueModel.setDbLinkId(CustinfoConstant.DBLINKID);
|
||||
uniqueModel.setUpdate(Objects.equals("2", "2"));
|
||||
|
||||
Map<String,String> tablefieldkey = new HashMap<>();
|
||||
for(String key:CustinfoConstant.TABLEFIELDKEY.keySet()){
|
||||
tablefieldkey.put(key,CustinfoConstant.TABLERENAMES.get(CustinfoConstant.TABLEFIELDKEY.get(key)));
|
||||
}
|
||||
ExcelImportModel excelImportModel = generaterSwapUtil.importData(CustinfoConstant.getFormData(),listData,uniqueModel, tablefieldkey,CustinfoConstant.getTableList());
|
||||
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
|
||||
for (ImportDataModel model : importDataModel) {
|
||||
String id = model.getId();
|
||||
Map<String, Object> result = model.getResultData();
|
||||
if(StringUtil.isNotEmpty(id)){
|
||||
update(id, JsonUtil.getJsonToBean(result,CustinfoForm.class), true);
|
||||
}else {
|
||||
create( JsonUtil.getJsonToBean(result,CustinfoForm.class));
|
||||
}
|
||||
}
|
||||
return ActionResult.success(excelImportModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出异常报告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出异常报告")
|
||||
@PostMapping("/ImportExceptionData")
|
||||
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(visualImportModel.getMenuId());
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
entitys.add(new ExcelExportEntity("异常原因", "errorsInfo",30));
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("客户名称(company_name)" ,"company_name"));
|
||||
selectKeys.add("company_name");
|
||||
entitys.add(new ExcelExportEntity("社会信用代码(credit_code)" ,"credit_code"));
|
||||
selectKeys.add("credit_code");
|
||||
entitys.add(new ExcelExportEntity("归属组织(org_id)" ,"org_id"));
|
||||
selectKeys.add("org_id");
|
||||
entitys.add(new ExcelExportEntity("客户编码(company_code)" ,"company_code"));
|
||||
selectKeys.add("company_code");
|
||||
entitys.add(new ExcelExportEntity("简称/昵称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("类型(entity_type)" ,"entity_type"));
|
||||
selectKeys.add("entity_type");
|
||||
entitys.add(new ExcelExportEntity("纳税人类别(tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tax_type");
|
||||
entitys.add(new ExcelExportEntity("企业规模(enterprise_scale)" ,"enterprise_scale"));
|
||||
selectKeys.add("enterprise_scale");
|
||||
entitys.add(new ExcelExportEntity("企业类型(enterprise_nature)" ,"enterprise_nature"));
|
||||
selectKeys.add("enterprise_nature");
|
||||
entitys.add(new ExcelExportEntity("行业代码(industry_code)" ,"industry_code"));
|
||||
selectKeys.add("industry_code");
|
||||
entitys.add(new ExcelExportEntity("成立日期(registration_date)" ,"registration_date"));
|
||||
selectKeys.add("registration_date");
|
||||
entitys.add(new ExcelExportEntity("注册资本(registered_capital)" ,"registered_capital"));
|
||||
selectKeys.add("registered_capital");
|
||||
entitys.add(new ExcelExportEntity("法定代表人(legal_representative)" ,"legal_representative"));
|
||||
selectKeys.add("legal_representative");
|
||||
entitys.add(new ExcelExportEntity("联系电话(phone)" ,"phone"));
|
||||
selectKeys.add("phone");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("网站(website)" ,"website"));
|
||||
selectKeys.add("website");
|
||||
entitys.add(new ExcelExportEntity("地址(address)" ,"address"));
|
||||
selectKeys.add("address");
|
||||
entitys.add(new ExcelExportEntity("所属地区(province_id)" ,"province_id"));
|
||||
selectKeys.add("province_id");
|
||||
entitys.add(new ExcelExportEntity("经营范围(business_scope)" ,"business_scope"));
|
||||
selectKeys.add("business_scope");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
//tableField46dc53子表对象
|
||||
ExcelExportEntity tableField46dc53ExcelEntity = new ExcelExportEntity("设计子表(tableField46dc53)","tableField46dc53");
|
||||
List<ExcelExportEntity> tableField46dc53ExcelEntityList = new ArrayList<>();
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("发票抬头名称(tableField46dc53-title_name)" ,"title_name"));
|
||||
selectKeys.add("tableField46dc53-title_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人识别号(tableField46dc53-credit_code)" ,"credit_code"));
|
||||
selectKeys.add("tableField46dc53-credit_code");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人类别(tableField46dc53-tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tableField46dc53-tax_type");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("地址(tableField46dc53-address)" ,"address"));
|
||||
selectKeys.add("tableField46dc53-address");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("电话(tableField46dc53-phone)" ,"phone"));
|
||||
selectKeys.add("tableField46dc53-phone");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("开户银行(tableField46dc53-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableField46dc53-bank_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("银行账户(tableField46dc53-bank_account)" ,"bank_account"));
|
||||
selectKeys.add("tableField46dc53-bank_account");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否默认(tableField46dc53-is_defalut)" ,"is_defalut"));
|
||||
selectKeys.add("tableField46dc53-is_defalut");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否有效(tableField46dc53-is_valid)" ,"is_valid"));
|
||||
selectKeys.add("tableField46dc53-is_valid");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("备注(tableField46dc53-remark)" ,"remark"));
|
||||
selectKeys.add("tableField46dc53-remark");
|
||||
tableField46dc53ExcelEntity.setList(tableField46dc53ExcelEntityList);
|
||||
entitys.add(tableField46dc53ExcelEntity);
|
||||
//tableFieldad9d92子表对象
|
||||
ExcelExportEntity tableFieldad9d92ExcelEntity = new ExcelExportEntity("设计子表(tableFieldad9d92)","tableFieldad9d92");
|
||||
List<ExcelExportEntity> tableFieldad9d92ExcelEntityList = new ArrayList<>();
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行(tableFieldad9d92-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("账户名(tableFieldad9d92-bank_account_name)" ,"bank_account_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("银行账号(tableFieldad9d92-bank_account_number)" ,"bank_account_number"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_number");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行城市(tableFieldad9d92-bank_province)" ,"bank_province"));
|
||||
selectKeys.add("tableFieldad9d92-bank_province");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("备注(tableFieldad9d92-remark)" ,"remark"));
|
||||
selectKeys.add("tableFieldad9d92-remark");
|
||||
tableFieldad9d92ExcelEntity.setList(tableFieldad9d92ExcelEntityList);
|
||||
entitys.add(tableFieldad9d92ExcelEntity);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(CustinfoConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.addAll(visualImportModel.getList());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setFreezeCol(1);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(CustinfoConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
|
||||
String fileName = menuFullName + "错误报告_" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//主表数据删除
|
||||
companyService.delete(entity);
|
||||
QueryWrapper<CustomerEntity> queryWrapperCustomer=new QueryWrapper<>();
|
||||
queryWrapperCustomer.lambda().eq(CustomerEntity::getCompanyId,entity.getCompanyId());
|
||||
//副表数据删除
|
||||
customerService.remove(queryWrapperCustomer);
|
||||
QueryWrapper<CompanyInvoiceEntity> queryWrapperCompanyInvoice=new QueryWrapper<>();
|
||||
queryWrapperCompanyInvoice.lambda().eq(CompanyInvoiceEntity::getCompanyId,entity.getCompanyId());
|
||||
//子表数据删除
|
||||
companyInvoiceService.remove(queryWrapperCompanyInvoice);
|
||||
QueryWrapper<CompanyBankEntity> queryWrapperCompanyBank=new QueryWrapper<>();
|
||||
queryWrapperCompanyBank.lambda().eq(CompanyBankEntity::getCompanyId,entity.getCompanyId());
|
||||
//子表数据删除
|
||||
companyBankService.remove(queryWrapperCompanyBank);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid CustinfoForm companyForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
companyForm.setCompanyId(String.valueOf(entity.getCompanyId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = companyService.checkForm(companyForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
companyService.saveOrUpdate(companyForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
CustomerEntity customerEntity = entity.getCustomer();
|
||||
if(ObjectUtil.isNotEmpty(customerEntity)){
|
||||
Map<String, Object> customerMap=JsonUtil.entityToMap(customerEntity);
|
||||
for(String key:customerMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_customer_yunzhupaas_"+key,customerMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<CompanyInvoiceEntity> companyInvoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
companyMap.put("companyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
companyMap = generaterSwapUtil.swapDataDetail(companyMap,CustinfoConstant.getFormData(),"816972827587510981",isPc?false:false);
|
||||
//子表数据
|
||||
companyMap.put("companyInvoiceList",companyMap.get("tableField46dc53"));
|
||||
companyMap.put("companyBankList",companyMap.get("tableFieldad9d92"));
|
||||
return ActionResult.success(companyMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
CustomerEntity customerEntity = entity.getCustomer();
|
||||
if(ObjectUtil.isNotEmpty(customerEntity)){
|
||||
Map<String, Object> customerMap=JsonUtil.entityToMap(customerEntity);
|
||||
for(String key:customerMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_customer_yunzhupaas_"+key,customerMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<CompanyInvoiceEntity> companyInvoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
companyMap.put("companyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyInvoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap = generaterSwapUtil.swapDataForm(companyMap,CustinfoConstant.getFormData(),CustinfoConstant.TABLEFIELDKEY,CustinfoConstant.TABLERENAMES);
|
||||
return ActionResult.success(companyMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,947 @@
|
||||
package com.yunzhupaas.mdm.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.mdm.model.lpc.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
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 java.io.InputStream;
|
||||
import com.yunzhupaas.onlinedev.model.ExcelImFieldModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportDataModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportFormCheckUniqueModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ExcelImportModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualImportModel;
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.model.visualJson.config.HeaderModel;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.util.VisualUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 法人公司
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "法人公司" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/Lpc")
|
||||
public class LpcController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private LpcService companyService;
|
||||
|
||||
@Autowired
|
||||
private CompanyInvoiceService company_invoiceService;
|
||||
@Autowired
|
||||
private CompanyBankService companyBankService;
|
||||
|
||||
@Autowired
|
||||
private CorporationService corporationService;
|
||||
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param companyPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody LpcPagination companyPagination)throws Exception{
|
||||
List<CompanyEntity> list= companyService.getList(companyPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CompanyEntity entity : list) {
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
CorporationEntity corporationEntity = entity.getCorporation();
|
||||
if(ObjectUtil.isNotEmpty(corporationEntity)){
|
||||
Map<String, Object> corporationMap=JsonUtil.entityToMap(corporationEntity);
|
||||
for(String key:corporationMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_corporation_yunzhupaas_"+key,corporationMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<CompanyInvoiceEntity> company_invoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField5ced3a",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(company_invoiceList)));
|
||||
companyMap.put("company_invoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(company_invoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldbd0aa4",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
realList.add(companyMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, LpcConstant.getFormData(), LpcConstant.getColumnData(), companyPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(companyPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid LpcForm companyForm) throws Exception {
|
||||
String b = companyService.checkForm(companyForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
// try{
|
||||
companyService.saveOrUpdate(companyForm, null ,true);
|
||||
// }catch(Exception e){
|
||||
// return ActionResult.fail(MsgCode.FA028.get());
|
||||
// }
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 导出Excel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出Excel")
|
||||
@PostMapping("/Actions/Export")
|
||||
public ActionResult Export(@RequestBody LpcPagination companyPagination) throws IOException {
|
||||
if (StringUtil.isEmpty(companyPagination.getSelectKey())){
|
||||
return ActionResult.fail(MsgCode.IMP011.get());
|
||||
}
|
||||
List<CompanyEntity> list= companyService.getList(companyPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CompanyEntity entity : list) {
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
CorporationEntity corporationEntity = entity.getCorporation();
|
||||
if(ObjectUtil.isNotEmpty(corporationEntity)){
|
||||
Map<String, Object> corporationMap=JsonUtil.entityToMap(corporationEntity);
|
||||
for(String key:corporationMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_corporation_yunzhupaas_"+key,corporationMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<CompanyInvoiceEntity> company_invoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField5ced3a",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(company_invoiceList)));
|
||||
companyMap.put("company_invoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(company_invoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldbd0aa4",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
realList.add(companyMap);
|
||||
}
|
||||
//数据转换
|
||||
realList = generaterSwapUtil.swapDataList(realList, LpcConstant.getFormData(),LpcConstant.getColumnData(), companyPagination.getModuleId(),false);
|
||||
String[]keys=!StringUtil.isEmpty(companyPagination.getSelectKey())?companyPagination.getSelectKey():new String[0];
|
||||
UserInfo userInfo=userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(companyPagination.getMenuId());
|
||||
|
||||
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo,menuFullName);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出表格方法
|
||||
*/
|
||||
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo,String menuFullName){
|
||||
DownloadVO vo=DownloadVO.builder().build();
|
||||
List<ExcelExportEntity> entitys=new ArrayList<>();
|
||||
if(keys.length>0){
|
||||
ExcelExportEntity tableField5ced3aExcelEntity = new ExcelExportEntity("设计子表(tableField5ced3a)","tableField5ced3a");
|
||||
List<ExcelExportEntity> tableField5ced3aList = new ArrayList<>();
|
||||
ExcelExportEntity tableFieldbd0aa4ExcelEntity = new ExcelExportEntity("设计子表(tableFieldbd0aa4)","tableFieldbd0aa4");
|
||||
List<ExcelExportEntity> tableFieldbd0aa4List = new ArrayList<>();
|
||||
for(String key:keys){
|
||||
switch(key){
|
||||
case "entity_type" :
|
||||
entitys.add(new ExcelExportEntity("实体类型" ,"entity_type"));
|
||||
break;
|
||||
case "company_code" :
|
||||
entitys.add(new ExcelExportEntity("企业编码" ,"company_code"));
|
||||
break;
|
||||
case "company_name" :
|
||||
entitys.add(new ExcelExportEntity("企业名称" ,"company_name"));
|
||||
break;
|
||||
case "short_name" :
|
||||
entitys.add(new ExcelExportEntity("简称/昵称" ,"short_name"));
|
||||
break;
|
||||
case "credit_code" :
|
||||
entitys.add(new ExcelExportEntity("社会信用代码" ,"credit_code"));
|
||||
break;
|
||||
case "tax_type" :
|
||||
entitys.add(new ExcelExportEntity("纳税人类别" ,"tax_type"));
|
||||
break;
|
||||
case "org_id" :
|
||||
entitys.add(new ExcelExportEntity("归属组织" ,"org_id"));
|
||||
break;
|
||||
case "province_id" :
|
||||
entitys.add(new ExcelExportEntity("所属地区" ,"province_id"));
|
||||
break;
|
||||
case "enterprise_nature" :
|
||||
entitys.add(new ExcelExportEntity("企业类型" ,"enterprise_nature"));
|
||||
break;
|
||||
case "industry_code" :
|
||||
entitys.add(new ExcelExportEntity("行业代码" ,"industry_code"));
|
||||
break;
|
||||
case "enterprise_scale" :
|
||||
entitys.add(new ExcelExportEntity("企业规模" ,"enterprise_scale"));
|
||||
break;
|
||||
case "registration_date" :
|
||||
entitys.add(new ExcelExportEntity("成立日期" ,"registration_date"));
|
||||
break;
|
||||
case "registered_capital" :
|
||||
entitys.add(new ExcelExportEntity("注册资本" ,"registered_capital"));
|
||||
break;
|
||||
case "legal_representative" :
|
||||
entitys.add(new ExcelExportEntity("法定代表人" ,"legal_representative"));
|
||||
break;
|
||||
case "phone" :
|
||||
entitys.add(new ExcelExportEntity("联系电话" ,"phone"));
|
||||
break;
|
||||
case "email" :
|
||||
entitys.add(new ExcelExportEntity("邮箱" ,"email"));
|
||||
break;
|
||||
case "website" :
|
||||
entitys.add(new ExcelExportEntity("网站" ,"website"));
|
||||
break;
|
||||
case "address" :
|
||||
entitys.add(new ExcelExportEntity("地址" ,"address"));
|
||||
break;
|
||||
case "business_scope" :
|
||||
entitys.add(new ExcelExportEntity("经营范围" ,"business_scope"));
|
||||
break;
|
||||
case "remark" :
|
||||
entitys.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_corporation_yunzhupaas_major_person_id" :
|
||||
entitys.add(new ExcelExportEntity("负责人" ,"yunzhupaas_mdm_corporation_yunzhupaas_major_person_id"));
|
||||
break;
|
||||
case "tableField5ced3a-title_code":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("发票抬头编码" ,"title_code"));
|
||||
break;
|
||||
case "tableField5ced3a-title_name":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("发票抬头名称" ,"title_name"));
|
||||
break;
|
||||
case "tableField5ced3a-credit_code":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("纳税人识别号" ,"credit_code"));
|
||||
break;
|
||||
case "tableField5ced3a-tax_type":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("纳税人类别" ,"tax_type"));
|
||||
break;
|
||||
case "tableField5ced3a-address":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("地址" ,"address"));
|
||||
break;
|
||||
case "tableField5ced3a-phone":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("电话" ,"phone"));
|
||||
break;
|
||||
case "tableField5ced3a-bank_name":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("开户银行" ,"bank_name"));
|
||||
break;
|
||||
case "tableField5ced3a-bank_account":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("银行账户" ,"bank_account"));
|
||||
break;
|
||||
case "tableField5ced3a-is_defalut":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("是否默认抬头" ,"is_defalut"));
|
||||
break;
|
||||
case "tableField5ced3a-is_valid":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("是否有效" ,"is_valid"));
|
||||
break;
|
||||
case "tableField5ced3a-remark":
|
||||
tableField5ced3aList.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
case "tableFieldbd0aa4-bank_name":
|
||||
tableFieldbd0aa4List.add(new ExcelExportEntity("开户行" ,"bank_name"));
|
||||
break;
|
||||
case "tableFieldbd0aa4-bank_account_name":
|
||||
tableFieldbd0aa4List.add(new ExcelExportEntity("账户名" ,"bank_account_name"));
|
||||
break;
|
||||
case "tableFieldbd0aa4-bank_account_number":
|
||||
tableFieldbd0aa4List.add(new ExcelExportEntity("银行账号" ,"bank_account_number"));
|
||||
break;
|
||||
case "tableFieldbd0aa4-bank_province":
|
||||
tableFieldbd0aa4List.add(new ExcelExportEntity("开户行城市" ,"bank_province"));
|
||||
break;
|
||||
case "tableFieldbd0aa4-remark":
|
||||
tableFieldbd0aa4List.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tableField5ced3aList.size() > 0){
|
||||
tableField5ced3aExcelEntity.setList(tableField5ced3aList);
|
||||
entitys.add(tableField5ced3aExcelEntity);
|
||||
}
|
||||
if(tableFieldbd0aa4List.size() > 0){
|
||||
tableFieldbd0aa4ExcelEntity.setList(tableFieldbd0aa4List);
|
||||
entitys.add(tableFieldbd0aa4ExcelEntity);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
List<ExcelExportEntity> mergerEntitys = new ArrayList<>(entitys);
|
||||
List<Map<String, Object>> mergerList=new ArrayList<>(dataList);
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(LpcConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
}
|
||||
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
|
||||
VisualUtils.mergerVertical(workbook, mergerEntitys, mergerList);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(LpcConstant.getFormData(),Arrays.asList(keys));
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName +"_"+ DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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;
|
||||
}
|
||||
@Operation(summary = "上传文件")
|
||||
@PostMapping("/Uploader")
|
||||
public ActionResult<Object> Uploader() {
|
||||
List<MultipartFile> list = UpUtil.getFileAll();
|
||||
MultipartFile file = list.get(0);
|
||||
if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) {
|
||||
String filePath = XSSEscape.escape(configValueUtil.getTemporaryFilePath());
|
||||
String fileName = XSSEscape.escape(RandomUtil.uuId() + "." + UpUtil.getFileType(file));
|
||||
//上传文件
|
||||
FileInfo fileInfo = FileUploadUtils.uploadFile(file, filePath, fileName);
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
vo.setName(fileInfo.getFilename());
|
||||
return ActionResult.success(vo);
|
||||
} else {
|
||||
return ActionResult.fail(MsgCode.FA017.get());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "模板下载")
|
||||
@GetMapping("/TemplateDownload")
|
||||
public ActionResult<DownloadVO> TemplateDownload(@RequestParam("menuId") String menuId){
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(menuId);
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("企业名称(company_name)" ,"company_name"));
|
||||
selectKeys.add("company_name");
|
||||
entitys.add(new ExcelExportEntity("简称/昵称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("社会信用代码(credit_code)" ,"credit_code"));
|
||||
selectKeys.add("credit_code");
|
||||
entitys.add(new ExcelExportEntity("纳税人类别(tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tax_type");
|
||||
entitys.add(new ExcelExportEntity("归属组织(org_id)" ,"org_id"));
|
||||
selectKeys.add("org_id");
|
||||
entitys.add(new ExcelExportEntity("所属地区(province_id)" ,"province_id"));
|
||||
selectKeys.add("province_id");
|
||||
entitys.add(new ExcelExportEntity("企业类型(enterprise_nature)" ,"enterprise_nature"));
|
||||
selectKeys.add("enterprise_nature");
|
||||
entitys.add(new ExcelExportEntity("行业代码(industry_code)" ,"industry_code"));
|
||||
selectKeys.add("industry_code");
|
||||
entitys.add(new ExcelExportEntity("企业规模(enterprise_scale)" ,"enterprise_scale"));
|
||||
selectKeys.add("enterprise_scale");
|
||||
entitys.add(new ExcelExportEntity("成立日期(registration_date)" ,"registration_date"));
|
||||
selectKeys.add("registration_date");
|
||||
entitys.add(new ExcelExportEntity("注册资本(registered_capital)" ,"registered_capital"));
|
||||
selectKeys.add("registered_capital");
|
||||
entitys.add(new ExcelExportEntity("法定代表人(legal_representative)" ,"legal_representative"));
|
||||
selectKeys.add("legal_representative");
|
||||
entitys.add(new ExcelExportEntity("联系电话(phone)" ,"phone"));
|
||||
selectKeys.add("phone");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("网站(website)" ,"website"));
|
||||
selectKeys.add("website");
|
||||
entitys.add(new ExcelExportEntity("地址(address)" ,"address"));
|
||||
selectKeys.add("address");
|
||||
entitys.add(new ExcelExportEntity("负责人(yunzhupaas_mdm_corporation_yunzhupaas_major_person_id)" ,"yunzhupaas_mdm_corporation_yunzhupaas_major_person_id"));
|
||||
selectKeys.add("yunzhupaas_mdm_corporation_yunzhupaas_major_person_id");
|
||||
entitys.add(new ExcelExportEntity("经营范围(business_scope)" ,"business_scope"));
|
||||
selectKeys.add("business_scope");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
//tableField5ced3a子表对象
|
||||
ExcelExportEntity tableField5ced3aExcelEntity = new ExcelExportEntity("设计子表(tableField5ced3a)","tableField5ced3a");
|
||||
List<ExcelExportEntity> tableField5ced3aExcelEntityList = new ArrayList<>();
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("发票抬头名称(tableField5ced3a-title_name)" ,"title_name"));
|
||||
selectKeys.add("tableField5ced3a-title_name");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("纳税人识别号(tableField5ced3a-credit_code)" ,"credit_code"));
|
||||
selectKeys.add("tableField5ced3a-credit_code");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("纳税人类别(tableField5ced3a-tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tableField5ced3a-tax_type");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("地址(tableField5ced3a-address)" ,"address"));
|
||||
selectKeys.add("tableField5ced3a-address");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("电话(tableField5ced3a-phone)" ,"phone"));
|
||||
selectKeys.add("tableField5ced3a-phone");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("开户银行(tableField5ced3a-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableField5ced3a-bank_name");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("银行账户(tableField5ced3a-bank_account)" ,"bank_account"));
|
||||
selectKeys.add("tableField5ced3a-bank_account");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("是否默认抬头(tableField5ced3a-is_defalut)" ,"is_defalut"));
|
||||
selectKeys.add("tableField5ced3a-is_defalut");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("是否有效(tableField5ced3a-is_valid)" ,"is_valid"));
|
||||
selectKeys.add("tableField5ced3a-is_valid");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("备注(tableField5ced3a-remark)" ,"remark"));
|
||||
selectKeys.add("tableField5ced3a-remark");
|
||||
tableField5ced3aExcelEntity.setList(tableField5ced3aExcelEntityList);
|
||||
if(tableField5ced3aExcelEntityList.size() > 0){
|
||||
entitys.add(tableField5ced3aExcelEntity);
|
||||
}
|
||||
//tableFieldbd0aa4子表对象
|
||||
ExcelExportEntity tableFieldbd0aa4ExcelEntity = new ExcelExportEntity("设计子表(tableFieldbd0aa4)","tableFieldbd0aa4");
|
||||
List<ExcelExportEntity> tableFieldbd0aa4ExcelEntityList = new ArrayList<>();
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("开户行(tableFieldbd0aa4-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableFieldbd0aa4-bank_name");
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("账户名(tableFieldbd0aa4-bank_account_name)" ,"bank_account_name"));
|
||||
selectKeys.add("tableFieldbd0aa4-bank_account_name");
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("银行账号(tableFieldbd0aa4-bank_account_number)" ,"bank_account_number"));
|
||||
selectKeys.add("tableFieldbd0aa4-bank_account_number");
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("开户行城市(tableFieldbd0aa4-bank_province)" ,"bank_province"));
|
||||
selectKeys.add("tableFieldbd0aa4-bank_province");
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("备注(tableFieldbd0aa4-remark)" ,"remark"));
|
||||
selectKeys.add("tableFieldbd0aa4-remark");
|
||||
tableFieldbd0aa4ExcelEntity.setList(tableFieldbd0aa4ExcelEntityList);
|
||||
if(tableFieldbd0aa4ExcelEntityList.size() > 0){
|
||||
entitys.add(tableFieldbd0aa4ExcelEntity);
|
||||
}
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(LpcConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.add(excelModel.getDataMap());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(LpcConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName + "导入模板.xls";
|
||||
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 ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入预览
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入预览" )
|
||||
@GetMapping("/ImportPreview")
|
||||
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
|
||||
Map<String, Object> headAndDataMap = new HashMap<>(2);
|
||||
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
|
||||
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
|
||||
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
|
||||
int headerRowIndex = 2;
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(headerRowIndex);
|
||||
params.setNeedVerify(true);
|
||||
try {
|
||||
InputStream inputStream = ExcelUtil.solveOrginTitle(temporary, headerRowIndex);
|
||||
List<Map> excelDataList = ExcelUtil.importExcelByInputStream(inputStream, 0, headerRowIndex, Map.class);
|
||||
//数据超过1000条
|
||||
if(excelDataList != null && excelDataList.size() > 1000) {
|
||||
return ActionResult.fail(MsgCode.ETD117.get());
|
||||
}
|
||||
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(LpcConstant.getColumnData(), ColumnDataModel.class);
|
||||
UploaderTemplateModel uploaderTemplateModel = JsonUtil.getJsonToBean(columnDataModel.getUploaderTemplateJson(), UploaderTemplateModel.class);
|
||||
List<String> selectKey = uploaderTemplateModel.getSelectKey();
|
||||
//子表合并
|
||||
List<Map<String, Object>> results = FormExecelUtils.dataMergeChildTable(excelDataList,selectKey);
|
||||
// 导入字段
|
||||
List<ExcelImFieldModel> columns = new ArrayList<>();
|
||||
columns.add(new ExcelImFieldModel("company_name","企业名称","input"));
|
||||
columns.add(new ExcelImFieldModel("short_name","简称/昵称","input"));
|
||||
columns.add(new ExcelImFieldModel("credit_code","社会信用代码","input"));
|
||||
columns.add(new ExcelImFieldModel("tax_type","纳税人类别","select"));
|
||||
columns.add(new ExcelImFieldModel("org_id","归属组织","organizeSelect"));
|
||||
columns.add(new ExcelImFieldModel("province_id","所属地区","areaSelect"));
|
||||
columns.add(new ExcelImFieldModel("enterprise_nature","企业类型","select"));
|
||||
columns.add(new ExcelImFieldModel("industry_code","行业代码","select"));
|
||||
columns.add(new ExcelImFieldModel("enterprise_scale","企业规模","select"));
|
||||
columns.add(new ExcelImFieldModel("registration_date","成立日期","datePicker"));
|
||||
columns.add(new ExcelImFieldModel("registered_capital","注册资本","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("legal_representative","法定代表人","input"));
|
||||
columns.add(new ExcelImFieldModel("phone","联系电话","input"));
|
||||
columns.add(new ExcelImFieldModel("email","邮箱","input"));
|
||||
columns.add(new ExcelImFieldModel("website","网站","input"));
|
||||
columns.add(new ExcelImFieldModel("address","地址","input"));
|
||||
columns.add(new ExcelImFieldModel("yunzhupaas_mdm_corporation_yunzhupaas_major_person_id","负责人","userSelect"));
|
||||
columns.add(new ExcelImFieldModel("business_scope","经营范围","textarea"));
|
||||
columns.add(new ExcelImFieldModel("remark","备注","textarea"));
|
||||
//tableField5ced3a子表对象
|
||||
List<ExcelImFieldModel> tableField5ced3acolumns = new ArrayList<>();
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("title_name" ,"*发票抬头名称"));
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("credit_code" ,"*纳税人识别号"));
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("tax_type" ,"*纳税人类别"));
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("address" ,"地址"));
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("phone" ,"电话"));
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("bank_name" ,"开户银行"));
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("bank_account" ,"银行账户"));
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("is_defalut" ,"是否默认抬头"));
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("is_valid" ,"是否有效"));
|
||||
tableField5ced3acolumns.add(new ExcelImFieldModel("remark" ,"备注"));
|
||||
columns.add(new ExcelImFieldModel("tableField5ced3a","设计子表","table",tableField5ced3acolumns));
|
||||
//tableFieldbd0aa4子表对象
|
||||
List<ExcelImFieldModel> tableFieldbd0aa4columns = new ArrayList<>();
|
||||
tableFieldbd0aa4columns.add(new ExcelImFieldModel("bank_name" ,"开户行"));
|
||||
tableFieldbd0aa4columns.add(new ExcelImFieldModel("bank_account_name" ,"账户名"));
|
||||
tableFieldbd0aa4columns.add(new ExcelImFieldModel("bank_account_number" ,"银行账号"));
|
||||
tableFieldbd0aa4columns.add(new ExcelImFieldModel("bank_province" ,"开户行城市"));
|
||||
tableFieldbd0aa4columns.add(new ExcelImFieldModel("remark" ,"备注"));
|
||||
columns.add(new ExcelImFieldModel("tableFieldbd0aa4","设计子表","table",tableFieldbd0aa4columns));
|
||||
headAndDataMap.put("dataRow" , results);
|
||||
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail(MsgCode.VS407.get());
|
||||
}
|
||||
return ActionResult.success(headAndDataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入数据" )
|
||||
@PostMapping("/ImportData")
|
||||
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
|
||||
List<Map<String, Object>> listData = visualImportModel.getList();
|
||||
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
|
||||
uniqueModel.setDbLinkId(LpcConstant.DBLINKID);
|
||||
uniqueModel.setUpdate(Objects.equals("2", "2"));
|
||||
|
||||
Map<String,String> tablefieldkey = new HashMap<>();
|
||||
for(String key:LpcConstant.TABLEFIELDKEY.keySet()){
|
||||
tablefieldkey.put(key,LpcConstant.TABLERENAMES.get(LpcConstant.TABLEFIELDKEY.get(key)));
|
||||
}
|
||||
ExcelImportModel excelImportModel = generaterSwapUtil.importData(LpcConstant.getFormData(),listData,uniqueModel, tablefieldkey,LpcConstant.getTableList());
|
||||
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
|
||||
for (ImportDataModel model : importDataModel) {
|
||||
String id = model.getId();
|
||||
Map<String, Object> result = model.getResultData();
|
||||
if(StringUtil.isNotEmpty(id)){
|
||||
update(id, JsonUtil.getJsonToBean(result,LpcForm.class), true);
|
||||
}else {
|
||||
create( JsonUtil.getJsonToBean(result,LpcForm.class));
|
||||
}
|
||||
}
|
||||
return ActionResult.success(excelImportModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出异常报告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出异常报告")
|
||||
@PostMapping("/ImportExceptionData")
|
||||
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(visualImportModel.getMenuId());
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
entitys.add(new ExcelExportEntity("异常原因", "errorsInfo",30));
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("企业名称(company_name)" ,"company_name"));
|
||||
selectKeys.add("company_name");
|
||||
entitys.add(new ExcelExportEntity("简称/昵称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("社会信用代码(credit_code)" ,"credit_code"));
|
||||
selectKeys.add("credit_code");
|
||||
entitys.add(new ExcelExportEntity("纳税人类别(tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tax_type");
|
||||
entitys.add(new ExcelExportEntity("归属组织(org_id)" ,"org_id"));
|
||||
selectKeys.add("org_id");
|
||||
entitys.add(new ExcelExportEntity("所属地区(province_id)" ,"province_id"));
|
||||
selectKeys.add("province_id");
|
||||
entitys.add(new ExcelExportEntity("企业类型(enterprise_nature)" ,"enterprise_nature"));
|
||||
selectKeys.add("enterprise_nature");
|
||||
entitys.add(new ExcelExportEntity("行业代码(industry_code)" ,"industry_code"));
|
||||
selectKeys.add("industry_code");
|
||||
entitys.add(new ExcelExportEntity("企业规模(enterprise_scale)" ,"enterprise_scale"));
|
||||
selectKeys.add("enterprise_scale");
|
||||
entitys.add(new ExcelExportEntity("成立日期(registration_date)" ,"registration_date"));
|
||||
selectKeys.add("registration_date");
|
||||
entitys.add(new ExcelExportEntity("注册资本(registered_capital)" ,"registered_capital"));
|
||||
selectKeys.add("registered_capital");
|
||||
entitys.add(new ExcelExportEntity("法定代表人(legal_representative)" ,"legal_representative"));
|
||||
selectKeys.add("legal_representative");
|
||||
entitys.add(new ExcelExportEntity("联系电话(phone)" ,"phone"));
|
||||
selectKeys.add("phone");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("网站(website)" ,"website"));
|
||||
selectKeys.add("website");
|
||||
entitys.add(new ExcelExportEntity("地址(address)" ,"address"));
|
||||
selectKeys.add("address");
|
||||
entitys.add(new ExcelExportEntity("负责人(yunzhupaas_mdm_corporation_yunzhupaas_major_person_id)" ,"yunzhupaas_mdm_corporation_yunzhupaas_major_person_id"));
|
||||
selectKeys.add("yunzhupaas_mdm_corporation_yunzhupaas_major_person_id");
|
||||
entitys.add(new ExcelExportEntity("经营范围(business_scope)" ,"business_scope"));
|
||||
selectKeys.add("business_scope");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
//tableField5ced3a子表对象
|
||||
ExcelExportEntity tableField5ced3aExcelEntity = new ExcelExportEntity("设计子表(tableField5ced3a)","tableField5ced3a");
|
||||
List<ExcelExportEntity> tableField5ced3aExcelEntityList = new ArrayList<>();
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("发票抬头名称(tableField5ced3a-title_name)" ,"title_name"));
|
||||
selectKeys.add("tableField5ced3a-title_name");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("纳税人识别号(tableField5ced3a-credit_code)" ,"credit_code"));
|
||||
selectKeys.add("tableField5ced3a-credit_code");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("纳税人类别(tableField5ced3a-tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tableField5ced3a-tax_type");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("地址(tableField5ced3a-address)" ,"address"));
|
||||
selectKeys.add("tableField5ced3a-address");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("电话(tableField5ced3a-phone)" ,"phone"));
|
||||
selectKeys.add("tableField5ced3a-phone");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("开户银行(tableField5ced3a-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableField5ced3a-bank_name");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("银行账户(tableField5ced3a-bank_account)" ,"bank_account"));
|
||||
selectKeys.add("tableField5ced3a-bank_account");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("是否默认抬头(tableField5ced3a-is_defalut)" ,"is_defalut"));
|
||||
selectKeys.add("tableField5ced3a-is_defalut");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("是否有效(tableField5ced3a-is_valid)" ,"is_valid"));
|
||||
selectKeys.add("tableField5ced3a-is_valid");
|
||||
tableField5ced3aExcelEntityList.add(new ExcelExportEntity("备注(tableField5ced3a-remark)" ,"remark"));
|
||||
selectKeys.add("tableField5ced3a-remark");
|
||||
tableField5ced3aExcelEntity.setList(tableField5ced3aExcelEntityList);
|
||||
entitys.add(tableField5ced3aExcelEntity);
|
||||
//tableFieldbd0aa4子表对象
|
||||
ExcelExportEntity tableFieldbd0aa4ExcelEntity = new ExcelExportEntity("设计子表(tableFieldbd0aa4)","tableFieldbd0aa4");
|
||||
List<ExcelExportEntity> tableFieldbd0aa4ExcelEntityList = new ArrayList<>();
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("开户行(tableFieldbd0aa4-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableFieldbd0aa4-bank_name");
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("账户名(tableFieldbd0aa4-bank_account_name)" ,"bank_account_name"));
|
||||
selectKeys.add("tableFieldbd0aa4-bank_account_name");
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("银行账号(tableFieldbd0aa4-bank_account_number)" ,"bank_account_number"));
|
||||
selectKeys.add("tableFieldbd0aa4-bank_account_number");
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("开户行城市(tableFieldbd0aa4-bank_province)" ,"bank_province"));
|
||||
selectKeys.add("tableFieldbd0aa4-bank_province");
|
||||
tableFieldbd0aa4ExcelEntityList.add(new ExcelExportEntity("备注(tableFieldbd0aa4-remark)" ,"remark"));
|
||||
selectKeys.add("tableFieldbd0aa4-remark");
|
||||
tableFieldbd0aa4ExcelEntity.setList(tableFieldbd0aa4ExcelEntityList);
|
||||
entitys.add(tableFieldbd0aa4ExcelEntity);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(LpcConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.addAll(visualImportModel.getList());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setFreezeCol(1);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(LpcConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
|
||||
String fileName = menuFullName + "错误报告_" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//假删除
|
||||
entity.setDeleteMark(1);
|
||||
entity.setDeleteUserId(userProvider.get().getUserId());
|
||||
entity.setDeleteTime(new Date());
|
||||
companyService.setIgnoreLogicDelete().updateById(entity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid LpcForm companyForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
companyForm.setCompanyId(String.valueOf(entity.getCompanyId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = companyService.checkForm(companyForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
companyService.saveOrUpdate(companyForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
CorporationEntity corporationEntity = entity.getCorporation();
|
||||
if(ObjectUtil.isNotEmpty(corporationEntity)){
|
||||
Map<String, Object> corporationMap=JsonUtil.entityToMap(corporationEntity);
|
||||
for(String key:corporationMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_corporation_yunzhupaas_"+key,corporationMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<CompanyInvoiceEntity> company_invoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField5ced3a",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(company_invoiceList)));
|
||||
companyMap.put("company_invoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(company_invoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldbd0aa4",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
companyMap = generaterSwapUtil.swapDataDetail(companyMap,LpcConstant.getFormData(),"816296614598542021",isPc?false:false);
|
||||
//子表数据
|
||||
companyMap.put("company_invoiceList",companyMap.get("tableField5ced3a"));
|
||||
companyMap.put("companyBankList",companyMap.get("tableFieldbd0aa4"));
|
||||
return ActionResult.success(companyMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
CorporationEntity corporationEntity = entity.getCorporation();
|
||||
if(ObjectUtil.isNotEmpty(corporationEntity)){
|
||||
Map<String, Object> corporationMap=JsonUtil.entityToMap(corporationEntity);
|
||||
for(String key:corporationMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_corporation_yunzhupaas_"+key,corporationMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<CompanyInvoiceEntity> company_invoiceList = entity.getCompanyInvoice();
|
||||
companyMap.put("tableField5ced3a",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(company_invoiceList)));
|
||||
companyMap.put("company_invoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(company_invoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldbd0aa4",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap = generaterSwapUtil.swapDataForm(companyMap,LpcConstant.getFormData(),LpcConstant.TABLEFIELDKEY,LpcConstant.TABLERENAMES);
|
||||
return ActionResult.success(companyMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,679 @@
|
||||
package com.yunzhupaas.mdm.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 com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.mdm.model.material.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.annotation.YunzhupaasField;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
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 java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import com.yunzhupaas.onlinedev.model.ExcelImFieldModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportDataModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportFormCheckUniqueModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ExcelImportModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualImportModel;
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.model.visualJson.config.HeaderModel;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.util.VisualUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 物料信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-27
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "物料信息" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/Material")
|
||||
public class MaterialController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private MaterialService materialService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param materialPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody MaterialPagination materialPagination)throws Exception{
|
||||
List<MaterialEntity> list= materialService.getList(materialPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (MaterialEntity entity : list) {
|
||||
Map<String, Object> materialMap=JsonUtil.entityToMap(entity);
|
||||
materialMap.put("id", materialMap.get("material_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(materialMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, MaterialConstant.getFormData(), MaterialConstant.getColumnData(), materialPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(materialPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param materialForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid MaterialForm materialForm) {
|
||||
String b = materialService.checkForm(materialForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
materialService.saveOrUpdate(materialForm, null ,true);
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 导出Excel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出Excel")
|
||||
@PostMapping("/Actions/Export")
|
||||
public ActionResult Export(@RequestBody MaterialPagination materialPagination) throws IOException {
|
||||
if (StringUtil.isEmpty(materialPagination.getSelectKey())){
|
||||
return ActionResult.fail(MsgCode.IMP011.get());
|
||||
}
|
||||
List<MaterialEntity> list= materialService.getList(materialPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (MaterialEntity entity : list) {
|
||||
Map<String, Object> materialMap=JsonUtil.entityToMap(entity);
|
||||
materialMap.put("id", materialMap.get("material_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(materialMap);
|
||||
}
|
||||
//数据转换
|
||||
realList = generaterSwapUtil.swapDataList(realList, MaterialConstant.getFormData(), MaterialConstant.getColumnData(), materialPagination.getModuleId(),false);
|
||||
String[]keys=!StringUtil.isEmpty(materialPagination.getSelectKey())?materialPagination.getSelectKey():new String[0];
|
||||
UserInfo userInfo=userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(materialPagination.getMenuId());
|
||||
|
||||
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo,menuFullName);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出表格方法
|
||||
*/
|
||||
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo,String menuFullName){
|
||||
DownloadVO vo=DownloadVO.builder().build();
|
||||
List<ExcelExportEntity> entitys=new ArrayList<>();
|
||||
if(keys.length>0){
|
||||
for(String key:keys){
|
||||
switch(key){
|
||||
case "material_code" :
|
||||
entitys.add(new ExcelExportEntity("物料编码" ,"material_code"));
|
||||
break;
|
||||
case "material_name" :
|
||||
entitys.add(new ExcelExportEntity("物料名称" ,"material_name"));
|
||||
break;
|
||||
case "material_category" :
|
||||
entitys.add(new ExcelExportEntity("物料分类" ,"material_category"));
|
||||
break;
|
||||
case "material_model" :
|
||||
entitys.add(new ExcelExportEntity("规格型号" ,"material_model"));
|
||||
break;
|
||||
case "unit_name" :
|
||||
entitys.add(new ExcelExportEntity("单位名称" ,"unit_name"));
|
||||
break;
|
||||
case "brand" :
|
||||
entitys.add(new ExcelExportEntity("品牌" ,"brand"));
|
||||
break;
|
||||
case "tax_rate" :
|
||||
entitys.add(new ExcelExportEntity("税率" ,"tax_rate"));
|
||||
break;
|
||||
case "tax_code" :
|
||||
entitys.add(new ExcelExportEntity("税收分类" ,"tax_code"));
|
||||
break;
|
||||
case "texture" :
|
||||
entitys.add(new ExcelExportEntity("材质/纹理" ,"texture"));
|
||||
break;
|
||||
case "quality_standard" :
|
||||
entitys.add(new ExcelExportEntity("质量标准" ,"quality_standard"));
|
||||
break;
|
||||
case "technical_standard" :
|
||||
entitys.add(new ExcelExportEntity("技术标准" ,"technical_standard"));
|
||||
break;
|
||||
case "acceptance_criteria" :
|
||||
entitys.add(new ExcelExportEntity("验收标准" ,"acceptance_criteria"));
|
||||
break;
|
||||
case "delivery_requirements" :
|
||||
entitys.add(new ExcelExportEntity("交付要求" ,"delivery_requirements"));
|
||||
break;
|
||||
case "storage_conditions" :
|
||||
entitys.add(new ExcelExportEntity("储存条件" ,"storage_conditions"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, "表单信息");
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//去除空数据
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (Map<String, Object> map : list) {
|
||||
int i = 0;
|
||||
for (String key : keys) {
|
||||
//子表
|
||||
if (key.toLowerCase().startsWith("tablefield")) {
|
||||
String tableField = key.substring(0, key.indexOf("-" ));
|
||||
String field = key.substring(key.indexOf("-" ) + 1);
|
||||
Object o = map.get(tableField);
|
||||
if (o != null) {
|
||||
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
|
||||
for (Map<String, Object> childMap : childList) {
|
||||
if (childMap.get(field) != null) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Object o = map.get(key);
|
||||
if (o != null) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
dataList.add(map);
|
||||
}
|
||||
}
|
||||
List<ExcelExportEntity> mergerEntitys = new ArrayList<>(entitys);
|
||||
List<Map<String, Object>> mergerList=new ArrayList<>(dataList);
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(MaterialConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
}
|
||||
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
|
||||
VisualUtils.mergerVertical(workbook, mergerEntitys, mergerList);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(MaterialConstant.getFormData(),Arrays.asList(keys));
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName +"_"+ DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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;
|
||||
}
|
||||
@Operation(summary = "上传文件")
|
||||
@PostMapping("/Uploader")
|
||||
public ActionResult<Object> Uploader() {
|
||||
List<MultipartFile> list = UpUtil.getFileAll();
|
||||
MultipartFile file = list.get(0);
|
||||
if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) {
|
||||
String filePath = XSSEscape.escape(configValueUtil.getTemporaryFilePath());
|
||||
String fileName = XSSEscape.escape(RandomUtil.uuId() + "." + UpUtil.getFileType(file));
|
||||
//上传文件
|
||||
FileInfo fileInfo = FileUploadUtils.uploadFile(file, filePath, fileName);
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
vo.setName(fileInfo.getFilename());
|
||||
return ActionResult.success(vo);
|
||||
} else {
|
||||
return ActionResult.fail(MsgCode.FA017.get());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "模板下载")
|
||||
@GetMapping("/TemplateDownload")
|
||||
public ActionResult<DownloadVO> TemplateDownload(@RequestParam("menuId") String menuId){
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(menuId);
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("物料名称(material_name)" ,"material_name"));
|
||||
selectKeys.add("material_name");
|
||||
entitys.add(new ExcelExportEntity("物料分类(material_category)" ,"material_category"));
|
||||
selectKeys.add("material_category");
|
||||
entitys.add(new ExcelExportEntity("规格型号(material_model)" ,"material_model"));
|
||||
selectKeys.add("material_model");
|
||||
entitys.add(new ExcelExportEntity("单位名称(unit_name)" ,"unit_name"));
|
||||
selectKeys.add("unit_name");
|
||||
entitys.add(new ExcelExportEntity("品牌(brand)" ,"brand"));
|
||||
selectKeys.add("brand");
|
||||
entitys.add(new ExcelExportEntity("税率(tax_rate)" ,"tax_rate"));
|
||||
selectKeys.add("tax_rate");
|
||||
entitys.add(new ExcelExportEntity("税收分类(tax_code)" ,"tax_code"));
|
||||
selectKeys.add("tax_code");
|
||||
entitys.add(new ExcelExportEntity("材质/纹理(texture)" ,"texture"));
|
||||
selectKeys.add("texture");
|
||||
entitys.add(new ExcelExportEntity("质量标准(quality_standard)" ,"quality_standard"));
|
||||
selectKeys.add("quality_standard");
|
||||
entitys.add(new ExcelExportEntity("技术标准(technical_standard)" ,"technical_standard"));
|
||||
selectKeys.add("technical_standard");
|
||||
entitys.add(new ExcelExportEntity("验收标准(acceptance_criteria)" ,"acceptance_criteria"));
|
||||
selectKeys.add("acceptance_criteria");
|
||||
entitys.add(new ExcelExportEntity("交付要求(delivery_requirements)" ,"delivery_requirements"));
|
||||
selectKeys.add("delivery_requirements");
|
||||
entitys.add(new ExcelExportEntity("储存条件(storage_conditions)" ,"storage_conditions"));
|
||||
selectKeys.add("storage_conditions");
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(MaterialConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.add(excelModel.getDataMap());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(MaterialConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName + "导入模板.xls";
|
||||
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 ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入预览
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入预览" )
|
||||
@GetMapping("/ImportPreview")
|
||||
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
|
||||
Map<String, Object> headAndDataMap = new HashMap<>(2);
|
||||
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
|
||||
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
|
||||
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
|
||||
int headerRowIndex = 1;
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(headerRowIndex);
|
||||
params.setNeedVerify(true);
|
||||
try {
|
||||
InputStream inputStream = ExcelUtil.solveOrginTitle(temporary, headerRowIndex);
|
||||
List<Map> excelDataList = ExcelUtil.importExcelByInputStream(inputStream, 0, headerRowIndex, Map.class);
|
||||
//数据超过1000条
|
||||
if(excelDataList != null && excelDataList.size() > 1000) {
|
||||
return ActionResult.fail(MsgCode.ETD117.get());
|
||||
}
|
||||
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(MaterialConstant.getColumnData(), ColumnDataModel.class);
|
||||
UploaderTemplateModel uploaderTemplateModel = JsonUtil.getJsonToBean(columnDataModel.getUploaderTemplateJson(), UploaderTemplateModel.class);
|
||||
List<String> selectKey = uploaderTemplateModel.getSelectKey();
|
||||
//子表合并
|
||||
List<Map<String, Object>> results = FormExecelUtils.dataMergeChildTable(excelDataList,selectKey);
|
||||
// 导入字段
|
||||
List<ExcelImFieldModel> columns = new ArrayList<>();
|
||||
columns.add(new ExcelImFieldModel("material_name","物料名称","input"));
|
||||
columns.add(new ExcelImFieldModel("material_category","物料分类","cascader"));
|
||||
columns.add(new ExcelImFieldModel("material_model","规格型号","input"));
|
||||
columns.add(new ExcelImFieldModel("unit_name","单位名称","input"));
|
||||
columns.add(new ExcelImFieldModel("brand","品牌","input"));
|
||||
columns.add(new ExcelImFieldModel("tax_rate","税率","select"));
|
||||
columns.add(new ExcelImFieldModel("tax_code","税收分类","cascader"));
|
||||
columns.add(new ExcelImFieldModel("texture","材质/纹理","input"));
|
||||
columns.add(new ExcelImFieldModel("quality_standard","质量标准","input"));
|
||||
columns.add(new ExcelImFieldModel("technical_standard","技术标准","textarea"));
|
||||
columns.add(new ExcelImFieldModel("acceptance_criteria","验收标准","textarea"));
|
||||
columns.add(new ExcelImFieldModel("delivery_requirements","交付要求","textarea"));
|
||||
columns.add(new ExcelImFieldModel("storage_conditions","储存条件","textarea"));
|
||||
headAndDataMap.put("dataRow" , results);
|
||||
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail(MsgCode.VS407.get());
|
||||
}
|
||||
return ActionResult.success(headAndDataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入数据" )
|
||||
@PostMapping("/ImportData")
|
||||
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
|
||||
List<Map<String, Object>> listData = visualImportModel.getList();
|
||||
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
|
||||
uniqueModel.setDbLinkId(MaterialConstant.DBLINKID);
|
||||
uniqueModel.setUpdate(Objects.equals("2", "2"));
|
||||
|
||||
Map<String,String> tablefieldkey = new HashMap<>();
|
||||
for(String key:MaterialConstant.TABLEFIELDKEY.keySet()){
|
||||
tablefieldkey.put(key,MaterialConstant.TABLERENAMES.get(MaterialConstant.TABLEFIELDKEY.get(key)));
|
||||
}
|
||||
ExcelImportModel excelImportModel = generaterSwapUtil.importData(MaterialConstant.getFormData(),listData,uniqueModel, tablefieldkey,MaterialConstant.getTableList());
|
||||
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
|
||||
for (ImportDataModel model : importDataModel) {
|
||||
String id = model.getId();
|
||||
Map<String, Object> result = model.getResultData();
|
||||
if(StringUtil.isNotEmpty(id)){
|
||||
update(id, JsonUtil.getJsonToBean(result,MaterialForm.class), true);
|
||||
}else {
|
||||
create( JsonUtil.getJsonToBean(result,MaterialForm.class));
|
||||
}
|
||||
}
|
||||
return ActionResult.success(excelImportModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出异常报告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出异常报告")
|
||||
@PostMapping("/ImportExceptionData")
|
||||
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(visualImportModel.getMenuId());
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
entitys.add(new ExcelExportEntity("异常原因", "errorsInfo",30));
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("物料名称(material_name)" ,"material_name"));
|
||||
selectKeys.add("material_name");
|
||||
entitys.add(new ExcelExportEntity("物料分类(material_category)" ,"material_category"));
|
||||
selectKeys.add("material_category");
|
||||
entitys.add(new ExcelExportEntity("规格型号(material_model)" ,"material_model"));
|
||||
selectKeys.add("material_model");
|
||||
entitys.add(new ExcelExportEntity("单位名称(unit_name)" ,"unit_name"));
|
||||
selectKeys.add("unit_name");
|
||||
entitys.add(new ExcelExportEntity("品牌(brand)" ,"brand"));
|
||||
selectKeys.add("brand");
|
||||
entitys.add(new ExcelExportEntity("税率(tax_rate)" ,"tax_rate"));
|
||||
selectKeys.add("tax_rate");
|
||||
entitys.add(new ExcelExportEntity("税收分类(tax_code)" ,"tax_code"));
|
||||
selectKeys.add("tax_code");
|
||||
entitys.add(new ExcelExportEntity("材质/纹理(texture)" ,"texture"));
|
||||
selectKeys.add("texture");
|
||||
entitys.add(new ExcelExportEntity("质量标准(quality_standard)" ,"quality_standard"));
|
||||
selectKeys.add("quality_standard");
|
||||
entitys.add(new ExcelExportEntity("技术标准(technical_standard)" ,"technical_standard"));
|
||||
selectKeys.add("technical_standard");
|
||||
entitys.add(new ExcelExportEntity("验收标准(acceptance_criteria)" ,"acceptance_criteria"));
|
||||
selectKeys.add("acceptance_criteria");
|
||||
entitys.add(new ExcelExportEntity("交付要求(delivery_requirements)" ,"delivery_requirements"));
|
||||
selectKeys.add("delivery_requirements");
|
||||
entitys.add(new ExcelExportEntity("储存条件(storage_conditions)" ,"storage_conditions"));
|
||||
selectKeys.add("storage_conditions");
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(MaterialConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.addAll(visualImportModel.getList());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setFreezeCol(1);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(MaterialConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
|
||||
String fileName = menuFullName + "错误报告_" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
MaterialEntity entity= materialService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//假删除
|
||||
entity.setDeleteMark(1);
|
||||
entity.setDeleteUserId(userProvider.get().getUserId());
|
||||
entity.setDeleteTime(new Date());
|
||||
materialService.setIgnoreLogicDelete().updateById(entity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param materialForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid MaterialForm materialForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
MaterialEntity entity= materialService.getInfo(id);
|
||||
if(entity!=null){
|
||||
materialForm.setMaterialId(String.valueOf(entity.getMaterialId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = materialService.checkForm(materialForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
materialService.saveOrUpdate(materialForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
MaterialEntity entity= materialService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> materialMap=JsonUtil.entityToMap(entity);
|
||||
materialMap.put("id", materialMap.get("material_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
materialMap = generaterSwapUtil.swapDataDetail(materialMap,MaterialConstant.getFormData(),"817350987260887813",isPc?false:false);
|
||||
//子表数据
|
||||
return ActionResult.success(materialMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
MaterialEntity entity= materialService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> materialMap=JsonUtil.entityToMap(entity);
|
||||
materialMap.put("id", materialMap.get("material_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
materialMap = generaterSwapUtil.swapDataForm(materialMap,MaterialConstant.getFormData(),MaterialConstant.TABLEFIELDKEY,MaterialConstant.TABLERENAMES);
|
||||
return ActionResult.success(materialMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,743 @@
|
||||
package com.yunzhupaas.mdm.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 com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.mdm.model.product.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.annotation.YunzhupaasField;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
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 java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import com.yunzhupaas.onlinedev.model.ExcelImFieldModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportDataModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportFormCheckUniqueModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ExcelImportModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualImportModel;
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.model.visualJson.config.HeaderModel;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.util.VisualUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 商品信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-27
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "商品信息" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/Products")
|
||||
public class ProductsController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private ProductsService productsService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param productPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody ProductPagination productPagination)throws Exception{
|
||||
List<ProductEntity> list= productsService.getList(productPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (ProductEntity entity : list) {
|
||||
Map<String, Object> productMap=JsonUtil.entityToMap(entity);
|
||||
productMap.put("id", productMap.get("product_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(productMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, ProductsConstant.getFormData(), ProductsConstant.getColumnData(), productPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(productPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param productForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid ProductForm productForm) {
|
||||
String b = productsService.checkForm(productForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
productsService.saveOrUpdate(productForm, null ,true);
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 导出Excel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出Excel")
|
||||
@PostMapping("/Actions/Export")
|
||||
public ActionResult Export(@RequestBody ProductPagination productPagination) throws IOException {
|
||||
if (StringUtil.isEmpty(productPagination.getSelectKey())){
|
||||
return ActionResult.fail(MsgCode.IMP011.get());
|
||||
}
|
||||
List<ProductEntity> list= productsService.getList(productPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (ProductEntity entity : list) {
|
||||
Map<String, Object> productMap=JsonUtil.entityToMap(entity);
|
||||
productMap.put("id", productMap.get("product_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(productMap);
|
||||
}
|
||||
//数据转换
|
||||
realList = generaterSwapUtil.swapDataList(realList, ProductsConstant.getFormData(), ProductsConstant.getColumnData(), productPagination.getModuleId(),false);
|
||||
String[]keys=!StringUtil.isEmpty(productPagination.getSelectKey())?productPagination.getSelectKey():new String[0];
|
||||
UserInfo userInfo=userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(productPagination.getMenuId());
|
||||
|
||||
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo,menuFullName);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出表格方法
|
||||
*/
|
||||
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo,String menuFullName){
|
||||
DownloadVO vo=DownloadVO.builder().build();
|
||||
List<ExcelExportEntity> entitys=new ArrayList<>();
|
||||
if(keys.length>0){
|
||||
for(String key:keys){
|
||||
switch(key){
|
||||
case "product_code" :
|
||||
entitys.add(new ExcelExportEntity("商品编码" ,"product_code"));
|
||||
break;
|
||||
case "product_name" :
|
||||
entitys.add(new ExcelExportEntity("商品名称" ,"product_name"));
|
||||
break;
|
||||
case "product_type" :
|
||||
entitys.add(new ExcelExportEntity("商品类型" ,"product_type"));
|
||||
break;
|
||||
case "product_category" :
|
||||
entitys.add(new ExcelExportEntity("商品分类" ,"product_category"));
|
||||
break;
|
||||
case "short_name" :
|
||||
entitys.add(new ExcelExportEntity("商品简称" ,"short_name"));
|
||||
break;
|
||||
case "brand" :
|
||||
entitys.add(new ExcelExportEntity("品牌" ,"brand"));
|
||||
break;
|
||||
case "product_model" :
|
||||
entitys.add(new ExcelExportEntity("规格型号" ,"product_model"));
|
||||
break;
|
||||
case "color" :
|
||||
entitys.add(new ExcelExportEntity("颜色" ,"color"));
|
||||
break;
|
||||
case "product_size" :
|
||||
entitys.add(new ExcelExportEntity("尺寸/规格" ,"product_size"));
|
||||
break;
|
||||
case "weight" :
|
||||
entitys.add(new ExcelExportEntity("重量" ,"weight"));
|
||||
break;
|
||||
case "min_order_quantity" :
|
||||
entitys.add(new ExcelExportEntity("最小起订量" ,"min_order_quantity"));
|
||||
break;
|
||||
case "standard_sales_price" :
|
||||
entitys.add(new ExcelExportEntity("标准销售单价" ,"standard_sales_price"));
|
||||
break;
|
||||
case "gross_weight" :
|
||||
entitys.add(new ExcelExportEntity("毛重" ,"gross_weight"));
|
||||
break;
|
||||
case "net_weight" :
|
||||
entitys.add(new ExcelExportEntity("净重" ,"net_weight"));
|
||||
break;
|
||||
case "unit_name" :
|
||||
entitys.add(new ExcelExportEntity("单位名称" ,"unit_name"));
|
||||
break;
|
||||
case "packagesize" :
|
||||
entitys.add(new ExcelExportEntity("包装尺寸" ,"packagesize"));
|
||||
break;
|
||||
case "cost_price" :
|
||||
entitys.add(new ExcelExportEntity("成本价" ,"cost_price"));
|
||||
break;
|
||||
case "warranty_period" :
|
||||
entitys.add(new ExcelExportEntity("保修期" ,"warranty_period"));
|
||||
break;
|
||||
case "tax_rate" :
|
||||
entitys.add(new ExcelExportEntity("税率" ,"tax_rate"));
|
||||
break;
|
||||
case "tax_code" :
|
||||
entitys.add(new ExcelExportEntity("税收分类" ,"tax_code"));
|
||||
break;
|
||||
case "warranty_terms" :
|
||||
entitys.add(new ExcelExportEntity("保修条款" ,"warranty_terms"));
|
||||
break;
|
||||
case "remark" :
|
||||
entitys.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, "表单信息");
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//去除空数据
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (Map<String, Object> map : list) {
|
||||
int i = 0;
|
||||
for (String key : keys) {
|
||||
//子表
|
||||
if (key.toLowerCase().startsWith("tablefield")) {
|
||||
String tableField = key.substring(0, key.indexOf("-" ));
|
||||
String field = key.substring(key.indexOf("-" ) + 1);
|
||||
Object o = map.get(tableField);
|
||||
if (o != null) {
|
||||
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
|
||||
for (Map<String, Object> childMap : childList) {
|
||||
if (childMap.get(field) != null) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Object o = map.get(key);
|
||||
if (o != null) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
dataList.add(map);
|
||||
}
|
||||
}
|
||||
List<ExcelExportEntity> mergerEntitys = new ArrayList<>(entitys);
|
||||
List<Map<String, Object>> mergerList=new ArrayList<>(dataList);
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(ProductsConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
}
|
||||
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
|
||||
VisualUtils.mergerVertical(workbook, mergerEntitys, mergerList);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(ProductsConstant.getFormData(),Arrays.asList(keys));
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName +"_"+ DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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;
|
||||
}
|
||||
@Operation(summary = "上传文件")
|
||||
@PostMapping("/Uploader")
|
||||
public ActionResult<Object> Uploader() {
|
||||
List<MultipartFile> list = UpUtil.getFileAll();
|
||||
MultipartFile file = list.get(0);
|
||||
if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) {
|
||||
String filePath = XSSEscape.escape(configValueUtil.getTemporaryFilePath());
|
||||
String fileName = XSSEscape.escape(RandomUtil.uuId() + "." + UpUtil.getFileType(file));
|
||||
//上传文件
|
||||
FileInfo fileInfo = FileUploadUtils.uploadFile(file, filePath, fileName);
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
vo.setName(fileInfo.getFilename());
|
||||
return ActionResult.success(vo);
|
||||
} else {
|
||||
return ActionResult.fail(MsgCode.FA017.get());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "模板下载")
|
||||
@GetMapping("/TemplateDownload")
|
||||
public ActionResult<DownloadVO> TemplateDownload(@RequestParam("menuId") String menuId){
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(menuId);
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("商品名称(product_name)" ,"product_name"));
|
||||
selectKeys.add("product_name");
|
||||
entitys.add(new ExcelExportEntity("商品类型(product_type)" ,"product_type"));
|
||||
selectKeys.add("product_type");
|
||||
entitys.add(new ExcelExportEntity("商品分类(product_category)" ,"product_category"));
|
||||
selectKeys.add("product_category");
|
||||
entitys.add(new ExcelExportEntity("商品简称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("品牌(brand)" ,"brand"));
|
||||
selectKeys.add("brand");
|
||||
entitys.add(new ExcelExportEntity("规格型号(product_model)" ,"product_model"));
|
||||
selectKeys.add("product_model");
|
||||
entitys.add(new ExcelExportEntity("颜色(color)" ,"color"));
|
||||
selectKeys.add("color");
|
||||
entitys.add(new ExcelExportEntity("尺寸/规格(product_size)" ,"product_size"));
|
||||
selectKeys.add("product_size");
|
||||
entitys.add(new ExcelExportEntity("重量(weight)" ,"weight"));
|
||||
selectKeys.add("weight");
|
||||
entitys.add(new ExcelExportEntity("最小起订量(min_order_quantity)" ,"min_order_quantity"));
|
||||
selectKeys.add("min_order_quantity");
|
||||
entitys.add(new ExcelExportEntity("标准销售单价(standard_sales_price)" ,"standard_sales_price"));
|
||||
selectKeys.add("standard_sales_price");
|
||||
entitys.add(new ExcelExportEntity("毛重(gross_weight)" ,"gross_weight"));
|
||||
selectKeys.add("gross_weight");
|
||||
entitys.add(new ExcelExportEntity("净重(net_weight)" ,"net_weight"));
|
||||
selectKeys.add("net_weight");
|
||||
entitys.add(new ExcelExportEntity("单位名称(unit_name)" ,"unit_name"));
|
||||
selectKeys.add("unit_name");
|
||||
entitys.add(new ExcelExportEntity("包装尺寸(packagesize)" ,"packagesize"));
|
||||
selectKeys.add("packagesize");
|
||||
entitys.add(new ExcelExportEntity("成本价(cost_price)" ,"cost_price"));
|
||||
selectKeys.add("cost_price");
|
||||
entitys.add(new ExcelExportEntity("保修期(warranty_period)" ,"warranty_period"));
|
||||
selectKeys.add("warranty_period");
|
||||
entitys.add(new ExcelExportEntity("税率(tax_rate)" ,"tax_rate"));
|
||||
selectKeys.add("tax_rate");
|
||||
entitys.add(new ExcelExportEntity("税收分类(tax_code)" ,"tax_code"));
|
||||
selectKeys.add("tax_code");
|
||||
entitys.add(new ExcelExportEntity("保修条款(warranty_terms)" ,"warranty_terms"));
|
||||
selectKeys.add("warranty_terms");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(ProductsConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.add(excelModel.getDataMap());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(ProductsConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName + "导入模板.xls";
|
||||
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 ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入预览
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入预览" )
|
||||
@GetMapping("/ImportPreview")
|
||||
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
|
||||
Map<String, Object> headAndDataMap = new HashMap<>(2);
|
||||
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
|
||||
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
|
||||
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
|
||||
int headerRowIndex = 1;
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(headerRowIndex);
|
||||
params.setNeedVerify(true);
|
||||
try {
|
||||
InputStream inputStream = ExcelUtil.solveOrginTitle(temporary, headerRowIndex);
|
||||
List<Map> excelDataList = ExcelUtil.importExcelByInputStream(inputStream, 0, headerRowIndex, Map.class);
|
||||
//数据超过1000条
|
||||
if(excelDataList != null && excelDataList.size() > 1000) {
|
||||
return ActionResult.fail(MsgCode.ETD117.get());
|
||||
}
|
||||
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(ProductsConstant.getColumnData(), ColumnDataModel.class);
|
||||
UploaderTemplateModel uploaderTemplateModel = JsonUtil.getJsonToBean(columnDataModel.getUploaderTemplateJson(), UploaderTemplateModel.class);
|
||||
List<String> selectKey = uploaderTemplateModel.getSelectKey();
|
||||
//子表合并
|
||||
List<Map<String, Object>> results = FormExecelUtils.dataMergeChildTable(excelDataList,selectKey);
|
||||
// 导入字段
|
||||
List<ExcelImFieldModel> columns = new ArrayList<>();
|
||||
columns.add(new ExcelImFieldModel("product_name","商品名称","input"));
|
||||
columns.add(new ExcelImFieldModel("product_type","商品类型","select"));
|
||||
columns.add(new ExcelImFieldModel("product_category","商品分类","cascader"));
|
||||
columns.add(new ExcelImFieldModel("short_name","商品简称","input"));
|
||||
columns.add(new ExcelImFieldModel("brand","品牌","input"));
|
||||
columns.add(new ExcelImFieldModel("product_model","规格型号","input"));
|
||||
columns.add(new ExcelImFieldModel("color","颜色","input"));
|
||||
columns.add(new ExcelImFieldModel("product_size","尺寸/规格","input"));
|
||||
columns.add(new ExcelImFieldModel("weight","重量","input"));
|
||||
columns.add(new ExcelImFieldModel("min_order_quantity","最小起订量","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("standard_sales_price","标准销售单价","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("gross_weight","毛重","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("net_weight","净重","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("unit_name","单位名称","input"));
|
||||
columns.add(new ExcelImFieldModel("packagesize","包装尺寸","input"));
|
||||
columns.add(new ExcelImFieldModel("cost_price","成本价","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("warranty_period","保修期","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("tax_rate","税率","select"));
|
||||
columns.add(new ExcelImFieldModel("tax_code","税收分类","cascader"));
|
||||
columns.add(new ExcelImFieldModel("warranty_terms","保修条款","textarea"));
|
||||
columns.add(new ExcelImFieldModel("remark","备注","textarea"));
|
||||
headAndDataMap.put("dataRow" , results);
|
||||
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail(MsgCode.VS407.get());
|
||||
}
|
||||
return ActionResult.success(headAndDataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入数据" )
|
||||
@PostMapping("/ImportData")
|
||||
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
|
||||
List<Map<String, Object>> listData = visualImportModel.getList();
|
||||
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
|
||||
uniqueModel.setDbLinkId(ProductsConstant.DBLINKID);
|
||||
uniqueModel.setUpdate(Objects.equals("2", "2"));
|
||||
|
||||
Map<String,String> tablefieldkey = new HashMap<>();
|
||||
for(String key:ProductsConstant.TABLEFIELDKEY.keySet()){
|
||||
tablefieldkey.put(key,ProductsConstant.TABLERENAMES.get(ProductsConstant.TABLEFIELDKEY.get(key)));
|
||||
}
|
||||
ExcelImportModel excelImportModel = generaterSwapUtil.importData(ProductsConstant.getFormData(),listData,uniqueModel, tablefieldkey,ProductsConstant.getTableList());
|
||||
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
|
||||
for (ImportDataModel model : importDataModel) {
|
||||
String id = model.getId();
|
||||
Map<String, Object> result = model.getResultData();
|
||||
if(StringUtil.isNotEmpty(id)){
|
||||
update(id, JsonUtil.getJsonToBean(result,ProductForm.class), true);
|
||||
}else {
|
||||
create( JsonUtil.getJsonToBean(result,ProductForm.class));
|
||||
}
|
||||
}
|
||||
return ActionResult.success(excelImportModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出异常报告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出异常报告")
|
||||
@PostMapping("/ImportExceptionData")
|
||||
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(visualImportModel.getMenuId());
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
entitys.add(new ExcelExportEntity("异常原因", "errorsInfo",30));
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("商品名称(product_name)" ,"product_name"));
|
||||
selectKeys.add("product_name");
|
||||
entitys.add(new ExcelExportEntity("商品类型(product_type)" ,"product_type"));
|
||||
selectKeys.add("product_type");
|
||||
entitys.add(new ExcelExportEntity("商品分类(product_category)" ,"product_category"));
|
||||
selectKeys.add("product_category");
|
||||
entitys.add(new ExcelExportEntity("商品简称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("品牌(brand)" ,"brand"));
|
||||
selectKeys.add("brand");
|
||||
entitys.add(new ExcelExportEntity("规格型号(product_model)" ,"product_model"));
|
||||
selectKeys.add("product_model");
|
||||
entitys.add(new ExcelExportEntity("颜色(color)" ,"color"));
|
||||
selectKeys.add("color");
|
||||
entitys.add(new ExcelExportEntity("尺寸/规格(product_size)" ,"product_size"));
|
||||
selectKeys.add("product_size");
|
||||
entitys.add(new ExcelExportEntity("重量(weight)" ,"weight"));
|
||||
selectKeys.add("weight");
|
||||
entitys.add(new ExcelExportEntity("最小起订量(min_order_quantity)" ,"min_order_quantity"));
|
||||
selectKeys.add("min_order_quantity");
|
||||
entitys.add(new ExcelExportEntity("标准销售单价(standard_sales_price)" ,"standard_sales_price"));
|
||||
selectKeys.add("standard_sales_price");
|
||||
entitys.add(new ExcelExportEntity("毛重(gross_weight)" ,"gross_weight"));
|
||||
selectKeys.add("gross_weight");
|
||||
entitys.add(new ExcelExportEntity("净重(net_weight)" ,"net_weight"));
|
||||
selectKeys.add("net_weight");
|
||||
entitys.add(new ExcelExportEntity("单位名称(unit_name)" ,"unit_name"));
|
||||
selectKeys.add("unit_name");
|
||||
entitys.add(new ExcelExportEntity("包装尺寸(packagesize)" ,"packagesize"));
|
||||
selectKeys.add("packagesize");
|
||||
entitys.add(new ExcelExportEntity("成本价(cost_price)" ,"cost_price"));
|
||||
selectKeys.add("cost_price");
|
||||
entitys.add(new ExcelExportEntity("保修期(warranty_period)" ,"warranty_period"));
|
||||
selectKeys.add("warranty_period");
|
||||
entitys.add(new ExcelExportEntity("税率(tax_rate)" ,"tax_rate"));
|
||||
selectKeys.add("tax_rate");
|
||||
entitys.add(new ExcelExportEntity("税收分类(tax_code)" ,"tax_code"));
|
||||
selectKeys.add("tax_code");
|
||||
entitys.add(new ExcelExportEntity("保修条款(warranty_terms)" ,"warranty_terms"));
|
||||
selectKeys.add("warranty_terms");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(ProductsConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.addAll(visualImportModel.getList());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setFreezeCol(1);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(ProductsConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
|
||||
String fileName = menuFullName + "错误报告_" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
ProductEntity entity= productsService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//假删除
|
||||
entity.setDeleteMark(1);
|
||||
entity.setDeleteUserId(userProvider.get().getUserId());
|
||||
entity.setDeleteTime(new Date());
|
||||
productsService.setIgnoreLogicDelete().updateById(entity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param productForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid ProductForm productForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
ProductEntity entity= productsService.getInfo(id);
|
||||
if(entity!=null){
|
||||
productForm.setProductId(String.valueOf(entity.getProductId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = productsService.checkForm(productForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
productsService.saveOrUpdate(productForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
ProductEntity entity= productsService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> productMap=JsonUtil.entityToMap(entity);
|
||||
productMap.put("id", productMap.get("product_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
productMap = generaterSwapUtil.swapDataDetail(productMap,ProductsConstant.getFormData(),"817386322065883909",isPc?false:false);
|
||||
//子表数据
|
||||
return ActionResult.success(productMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
ProductEntity entity= productsService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> productMap=JsonUtil.entityToMap(entity);
|
||||
productMap.put("id", productMap.get("product_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
productMap = generaterSwapUtil.swapDataForm(productMap,ProductsConstant.getFormData(),ProductsConstant.TABLEFIELDKEY,ProductsConstant.TABLERENAMES);
|
||||
return ActionResult.success(productMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,992 @@
|
||||
package com.yunzhupaas.mdm.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 com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.mdm.model.suppinfo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import com.yunzhupaas.model.ExcelModel;
|
||||
import com.yunzhupaas.excel.ExcelExportStyler;
|
||||
import com.yunzhupaas.excel.ExcelHelper;
|
||||
import com.yunzhupaas.annotation.YunzhupaasField;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
|
||||
import com.yunzhupaas.base.util.FormExecelUtils;
|
||||
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 java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import com.yunzhupaas.onlinedev.model.ExcelImFieldModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportDataModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ImportFormCheckUniqueModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.ExcelImportModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualImportModel;
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
import lombok.Cleanup;
|
||||
import com.yunzhupaas.model.visualJson.config.HeaderModel;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.util.VisualUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 供应商信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "供应商信息" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/Suppinfo")
|
||||
public class SuppinfoController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private SuppinfoService companyService;
|
||||
|
||||
@Autowired
|
||||
private PanyInvoiceService panyInvoiceService;
|
||||
@Autowired
|
||||
private CompanyBankService companyBankService;
|
||||
|
||||
@Autowired
|
||||
private SupplierService supplierService;
|
||||
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param companyPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody SuppinfoPagination companyPagination)throws Exception{
|
||||
List<CompanyEntity> list= companyService.getList(companyPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CompanyEntity entity : list) {
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
SupplierEntity supplierEntity = entity.getSupplier();
|
||||
if(ObjectUtil.isNotEmpty(supplierEntity)){
|
||||
Map<String, Object> supplierMap=JsonUtil.entityToMap(supplierEntity);
|
||||
for(String key:supplierMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_supplier_yunzhupaas_"+key,supplierMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<PanyInvoiceEntity> panyInvoiceList = entity.getPanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(panyInvoiceList)));
|
||||
companyMap.put("panyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(panyInvoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
realList.add(companyMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, SuppinfoConstant.getFormData(), SuppinfoConstant.getColumnData(), companyPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(companyPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid SuppinfoForm companyForm) throws Exception {
|
||||
String b = companyService.checkForm(companyForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
// try{
|
||||
companyService.saveOrUpdate(companyForm, null ,true);
|
||||
// }catch(Exception e){
|
||||
// return ActionResult.fail(MsgCode.FA028.get());
|
||||
// }
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
/**
|
||||
* 导出Excel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出Excel")
|
||||
@PostMapping("/Actions/Export")
|
||||
public ActionResult Export(@RequestBody SuppinfoPagination companyPagination) throws IOException {
|
||||
if (StringUtil.isEmpty(companyPagination.getSelectKey())){
|
||||
return ActionResult.fail(MsgCode.IMP011.get());
|
||||
}
|
||||
List<CompanyEntity> list= companyService.getList(companyPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CompanyEntity entity : list) {
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
SupplierEntity supplierEntity = entity.getSupplier();
|
||||
if(ObjectUtil.isNotEmpty(supplierEntity)){
|
||||
Map<String, Object> supplierMap=JsonUtil.entityToMap(supplierEntity);
|
||||
for(String key:supplierMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_supplier_yunzhupaas_"+key,supplierMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<PanyInvoiceEntity> panyInvoiceList = entity.getPanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(panyInvoiceList)));
|
||||
companyMap.put("panyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(panyInvoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
realList.add(companyMap);
|
||||
}
|
||||
//数据转换
|
||||
realList = generaterSwapUtil.swapDataList(realList, SuppinfoConstant.getFormData(), SuppinfoConstant.getColumnData(), companyPagination.getModuleId(),false);
|
||||
String[]keys=!StringUtil.isEmpty(companyPagination.getSelectKey())?companyPagination.getSelectKey():new String[0];
|
||||
UserInfo userInfo=userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(companyPagination.getMenuId());
|
||||
|
||||
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo,menuFullName);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出表格方法
|
||||
*/
|
||||
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo,String menuFullName){
|
||||
DownloadVO vo=DownloadVO.builder().build();
|
||||
List<ExcelExportEntity> entitys=new ArrayList<>();
|
||||
if(keys.length>0){
|
||||
ExcelExportEntity tableField46dc53ExcelEntity = new ExcelExportEntity("设计子表(tableField46dc53)","tableField46dc53");
|
||||
List<ExcelExportEntity> tableField46dc53List = new ArrayList<>();
|
||||
ExcelExportEntity tableFieldad9d92ExcelEntity = new ExcelExportEntity("设计子表(tableFieldad9d92)","tableFieldad9d92");
|
||||
List<ExcelExportEntity> tableFieldad9d92List = new ArrayList<>();
|
||||
for(String key:keys){
|
||||
switch(key){
|
||||
case "company_code" :
|
||||
entitys.add(new ExcelExportEntity("企业编码" ,"company_code"));
|
||||
break;
|
||||
case "company_name" :
|
||||
entitys.add(new ExcelExportEntity("企业名称" ,"company_name"));
|
||||
break;
|
||||
case "short_name" :
|
||||
entitys.add(new ExcelExportEntity("简称/昵称" ,"short_name"));
|
||||
break;
|
||||
case "entity_type" :
|
||||
entitys.add(new ExcelExportEntity("类型" ,"entity_type"));
|
||||
break;
|
||||
case "credit_code" :
|
||||
entitys.add(new ExcelExportEntity("社会信用代码" ,"credit_code"));
|
||||
break;
|
||||
case "org_id" :
|
||||
entitys.add(new ExcelExportEntity("归属组织" ,"org_id"));
|
||||
break;
|
||||
case "province_id" :
|
||||
entitys.add(new ExcelExportEntity("所属地区" ,"province_id"));
|
||||
break;
|
||||
case "tax_type" :
|
||||
entitys.add(new ExcelExportEntity("纳税人类别" ,"tax_type"));
|
||||
break;
|
||||
case "enterprise_scale" :
|
||||
entitys.add(new ExcelExportEntity("企业规模" ,"enterprise_scale"));
|
||||
break;
|
||||
case "enterprise_nature" :
|
||||
entitys.add(new ExcelExportEntity("企业类型" ,"enterprise_nature"));
|
||||
break;
|
||||
case "industry_code" :
|
||||
entitys.add(new ExcelExportEntity("行业代码" ,"industry_code"));
|
||||
break;
|
||||
case "registration_date" :
|
||||
entitys.add(new ExcelExportEntity("成立日期" ,"registration_date"));
|
||||
break;
|
||||
case "registered_capital" :
|
||||
entitys.add(new ExcelExportEntity("注册资本" ,"registered_capital"));
|
||||
break;
|
||||
case "legal_representative" :
|
||||
entitys.add(new ExcelExportEntity("法定代表人" ,"legal_representative"));
|
||||
break;
|
||||
case "phone" :
|
||||
entitys.add(new ExcelExportEntity("联系电话" ,"phone"));
|
||||
break;
|
||||
case "email" :
|
||||
entitys.add(new ExcelExportEntity("邮箱" ,"email"));
|
||||
break;
|
||||
case "website" :
|
||||
entitys.add(new ExcelExportEntity("网站" ,"website"));
|
||||
break;
|
||||
case "address" :
|
||||
entitys.add(new ExcelExportEntity("地址" ,"address"));
|
||||
break;
|
||||
case "business_scope" :
|
||||
entitys.add(new ExcelExportEntity("经营范围" ,"business_scope"));
|
||||
break;
|
||||
case "remark" :
|
||||
entitys.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_supplier_yunzhupaas_major_person_id" :
|
||||
entitys.add(new ExcelExportEntity("责任人" ,"yunzhupaas_mdm_supplier_yunzhupaas_major_person_id"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_supplier_yunzhupaas_supplier_level" :
|
||||
entitys.add(new ExcelExportEntity("供应商级别" ,"yunzhupaas_mdm_supplier_yunzhupaas_supplier_level"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_supplier_yunzhupaas_supplier_type" :
|
||||
entitys.add(new ExcelExportEntity("供应商类型" ,"yunzhupaas_mdm_supplier_yunzhupaas_supplier_type"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_supplier_yunzhupaas_supplier_category" :
|
||||
entitys.add(new ExcelExportEntity("供应商分类" ,"yunzhupaas_mdm_supplier_yunzhupaas_supplier_category"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_supplier_yunzhupaas_honor" :
|
||||
entitys.add(new ExcelExportEntity("荣誉、资质" ,"yunzhupaas_mdm_supplier_yunzhupaas_honor"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_supplier_yunzhupaas_achievement" :
|
||||
entitys.add(new ExcelExportEntity("供应商业绩" ,"yunzhupaas_mdm_supplier_yunzhupaas_achievement"));
|
||||
break;
|
||||
case "yunzhupaas_mdm_supplier_yunzhupaas_finish_project" :
|
||||
entitys.add(new ExcelExportEntity("完工项目" ,"yunzhupaas_mdm_supplier_yunzhupaas_finish_project"));
|
||||
break;
|
||||
case "tableField46dc53-title_code":
|
||||
tableField46dc53List.add(new ExcelExportEntity("发票抬头编码" ,"title_code"));
|
||||
break;
|
||||
case "tableField46dc53-title_name":
|
||||
tableField46dc53List.add(new ExcelExportEntity("发票抬头名称" ,"title_name"));
|
||||
break;
|
||||
case "tableField46dc53-credit_code":
|
||||
tableField46dc53List.add(new ExcelExportEntity("纳税人识别号" ,"credit_code"));
|
||||
break;
|
||||
case "tableField46dc53-tax_type":
|
||||
tableField46dc53List.add(new ExcelExportEntity("纳税人类别" ,"tax_type"));
|
||||
break;
|
||||
case "tableField46dc53-address":
|
||||
tableField46dc53List.add(new ExcelExportEntity("地址" ,"address"));
|
||||
break;
|
||||
case "tableField46dc53-phone":
|
||||
tableField46dc53List.add(new ExcelExportEntity("电话" ,"phone"));
|
||||
break;
|
||||
case "tableField46dc53-bank_name":
|
||||
tableField46dc53List.add(new ExcelExportEntity("开户银行" ,"bank_name"));
|
||||
break;
|
||||
case "tableField46dc53-bank_account":
|
||||
tableField46dc53List.add(new ExcelExportEntity("银行账户" ,"bank_account"));
|
||||
break;
|
||||
case "tableField46dc53-is_defalut":
|
||||
tableField46dc53List.add(new ExcelExportEntity("是否默认" ,"is_defalut"));
|
||||
break;
|
||||
case "tableField46dc53-is_valid":
|
||||
tableField46dc53List.add(new ExcelExportEntity("是否有效" ,"is_valid"));
|
||||
break;
|
||||
case "tableField46dc53-remark":
|
||||
tableField46dc53List.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_name":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("开户行" ,"bank_name"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_account_name":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("账户名" ,"bank_account_name"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_account_number":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("银行账号" ,"bank_account_number"));
|
||||
break;
|
||||
case "tableFieldad9d92-bank_province":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("开户行城市" ,"bank_province"));
|
||||
break;
|
||||
case "tableFieldad9d92-remark":
|
||||
tableFieldad9d92List.add(new ExcelExportEntity("备注" ,"remark"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tableField46dc53List.size() > 0){
|
||||
tableField46dc53ExcelEntity.setList(tableField46dc53List);
|
||||
entitys.add(tableField46dc53ExcelEntity);
|
||||
}
|
||||
if(tableFieldad9d92List.size() > 0){
|
||||
tableFieldad9d92ExcelEntity.setList(tableFieldad9d92List);
|
||||
entitys.add(tableFieldad9d92ExcelEntity);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
List<ExcelExportEntity> mergerEntitys = new ArrayList<>(entitys);
|
||||
List<Map<String, Object>> mergerList=new ArrayList<>(dataList);
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(SuppinfoConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList, Objects.equals(columnDataModel.getType(), 4));
|
||||
}
|
||||
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
|
||||
VisualUtils.mergerVertical(workbook, mergerEntitys, mergerList);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(SuppinfoConstant.getFormData(),Arrays.asList(keys));
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName +"_"+ DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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;
|
||||
}
|
||||
@Operation(summary = "上传文件")
|
||||
@PostMapping("/Uploader")
|
||||
public ActionResult<Object> Uploader() {
|
||||
List<MultipartFile> list = UpUtil.getFileAll();
|
||||
MultipartFile file = list.get(0);
|
||||
if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) {
|
||||
String filePath = XSSEscape.escape(configValueUtil.getTemporaryFilePath());
|
||||
String fileName = XSSEscape.escape(RandomUtil.uuId() + "." + UpUtil.getFileType(file));
|
||||
//上传文件
|
||||
FileInfo fileInfo = FileUploadUtils.uploadFile(file, filePath, fileName);
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
vo.setName(fileInfo.getFilename());
|
||||
return ActionResult.success(vo);
|
||||
} else {
|
||||
return ActionResult.fail(MsgCode.FA017.get());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "模板下载")
|
||||
@GetMapping("/TemplateDownload")
|
||||
public ActionResult<DownloadVO> TemplateDownload(@RequestParam("menuId") String menuId){
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(menuId);
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("企业名称(company_name)" ,"company_name"));
|
||||
selectKeys.add("company_name");
|
||||
entitys.add(new ExcelExportEntity("社会信用代码(credit_code)" ,"credit_code"));
|
||||
selectKeys.add("credit_code");
|
||||
entitys.add(new ExcelExportEntity("归属组织(org_id)" ,"org_id"));
|
||||
selectKeys.add("org_id");
|
||||
entitys.add(new ExcelExportEntity("企业编码(company_code)" ,"company_code"));
|
||||
selectKeys.add("company_code");
|
||||
entitys.add(new ExcelExportEntity("简称/昵称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("类型(entity_type)" ,"entity_type"));
|
||||
selectKeys.add("entity_type");
|
||||
entitys.add(new ExcelExportEntity("纳税人类别(tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tax_type");
|
||||
entitys.add(new ExcelExportEntity("企业规模(enterprise_scale)" ,"enterprise_scale"));
|
||||
selectKeys.add("enterprise_scale");
|
||||
entitys.add(new ExcelExportEntity("企业类型(enterprise_nature)" ,"enterprise_nature"));
|
||||
selectKeys.add("enterprise_nature");
|
||||
entitys.add(new ExcelExportEntity("行业代码(industry_code)" ,"industry_code"));
|
||||
selectKeys.add("industry_code");
|
||||
entitys.add(new ExcelExportEntity("成立日期(registration_date)" ,"registration_date"));
|
||||
selectKeys.add("registration_date");
|
||||
entitys.add(new ExcelExportEntity("注册资本(registered_capital)" ,"registered_capital"));
|
||||
selectKeys.add("registered_capital");
|
||||
entitys.add(new ExcelExportEntity("法定代表人(legal_representative)" ,"legal_representative"));
|
||||
selectKeys.add("legal_representative");
|
||||
entitys.add(new ExcelExportEntity("联系电话(phone)" ,"phone"));
|
||||
selectKeys.add("phone");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("网站(website)" ,"website"));
|
||||
selectKeys.add("website");
|
||||
entitys.add(new ExcelExportEntity("地址(address)" ,"address"));
|
||||
selectKeys.add("address");
|
||||
entitys.add(new ExcelExportEntity("所属地区(province_id)" ,"province_id"));
|
||||
selectKeys.add("province_id");
|
||||
entitys.add(new ExcelExportEntity("经营范围(business_scope)" ,"business_scope"));
|
||||
selectKeys.add("business_scope");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
entitys.add(new ExcelExportEntity("责任人(yunzhupaas_mdm_supplier_yunzhupaas_major_person_id)" ,"yunzhupaas_mdm_supplier_yunzhupaas_major_person_id"));
|
||||
selectKeys.add("yunzhupaas_mdm_supplier_yunzhupaas_major_person_id");
|
||||
//tableField46dc53子表对象
|
||||
ExcelExportEntity tableField46dc53ExcelEntity = new ExcelExportEntity("设计子表(tableField46dc53)","tableField46dc53");
|
||||
List<ExcelExportEntity> tableField46dc53ExcelEntityList = new ArrayList<>();
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("发票抬头名称(tableField46dc53-title_name)" ,"title_name"));
|
||||
selectKeys.add("tableField46dc53-title_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人识别号(tableField46dc53-credit_code)" ,"credit_code"));
|
||||
selectKeys.add("tableField46dc53-credit_code");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人类别(tableField46dc53-tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tableField46dc53-tax_type");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("地址(tableField46dc53-address)" ,"address"));
|
||||
selectKeys.add("tableField46dc53-address");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("电话(tableField46dc53-phone)" ,"phone"));
|
||||
selectKeys.add("tableField46dc53-phone");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("开户银行(tableField46dc53-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableField46dc53-bank_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("银行账户(tableField46dc53-bank_account)" ,"bank_account"));
|
||||
selectKeys.add("tableField46dc53-bank_account");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否默认(tableField46dc53-is_defalut)" ,"is_defalut"));
|
||||
selectKeys.add("tableField46dc53-is_defalut");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否有效(tableField46dc53-is_valid)" ,"is_valid"));
|
||||
selectKeys.add("tableField46dc53-is_valid");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("备注(tableField46dc53-remark)" ,"remark"));
|
||||
selectKeys.add("tableField46dc53-remark");
|
||||
tableField46dc53ExcelEntity.setList(tableField46dc53ExcelEntityList);
|
||||
if(tableField46dc53ExcelEntityList.size() > 0){
|
||||
entitys.add(tableField46dc53ExcelEntity);
|
||||
}
|
||||
//tableFieldad9d92子表对象
|
||||
ExcelExportEntity tableFieldad9d92ExcelEntity = new ExcelExportEntity("设计子表(tableFieldad9d92)","tableFieldad9d92");
|
||||
List<ExcelExportEntity> tableFieldad9d92ExcelEntityList = new ArrayList<>();
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行(tableFieldad9d92-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("账户名(tableFieldad9d92-bank_account_name)" ,"bank_account_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("银行账号(tableFieldad9d92-bank_account_number)" ,"bank_account_number"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_number");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行城市(tableFieldad9d92-bank_province)" ,"bank_province"));
|
||||
selectKeys.add("tableFieldad9d92-bank_province");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("备注(tableFieldad9d92-remark)" ,"remark"));
|
||||
selectKeys.add("tableFieldad9d92-remark");
|
||||
tableFieldad9d92ExcelEntity.setList(tableFieldad9d92ExcelEntityList);
|
||||
if(tableFieldad9d92ExcelEntityList.size() > 0){
|
||||
entitys.add(tableFieldad9d92ExcelEntity);
|
||||
}
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(SuppinfoConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.add(excelModel.getDataMap());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(SuppinfoConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
String fileName = menuFullName + "导入模板.xls";
|
||||
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 ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入预览
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入预览" )
|
||||
@GetMapping("/ImportPreview")
|
||||
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
|
||||
Map<String, Object> headAndDataMap = new HashMap<>(2);
|
||||
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
|
||||
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
|
||||
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
|
||||
int headerRowIndex = 2;
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(headerRowIndex);
|
||||
params.setNeedVerify(true);
|
||||
try {
|
||||
InputStream inputStream = ExcelUtil.solveOrginTitle(temporary, headerRowIndex);
|
||||
List<Map> excelDataList = ExcelUtil.importExcelByInputStream(inputStream, 0, headerRowIndex, Map.class);
|
||||
//数据超过1000条
|
||||
if(excelDataList != null && excelDataList.size() > 1000) {
|
||||
return ActionResult.fail(MsgCode.ETD117.get());
|
||||
}
|
||||
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(SuppinfoConstant.getColumnData(), ColumnDataModel.class);
|
||||
UploaderTemplateModel uploaderTemplateModel = JsonUtil.getJsonToBean(columnDataModel.getUploaderTemplateJson(), UploaderTemplateModel.class);
|
||||
List<String> selectKey = uploaderTemplateModel.getSelectKey();
|
||||
//子表合并
|
||||
List<Map<String, Object>> results = FormExecelUtils.dataMergeChildTable(excelDataList,selectKey);
|
||||
// 导入字段
|
||||
List<ExcelImFieldModel> columns = new ArrayList<>();
|
||||
columns.add(new ExcelImFieldModel("company_name","企业名称","input"));
|
||||
columns.add(new ExcelImFieldModel("credit_code","社会信用代码","input"));
|
||||
columns.add(new ExcelImFieldModel("org_id","归属组织","organizeSelect"));
|
||||
columns.add(new ExcelImFieldModel("company_code","企业编码","billRule"));
|
||||
columns.add(new ExcelImFieldModel("short_name","简称/昵称","input"));
|
||||
columns.add(new ExcelImFieldModel("entity_type","类型","radio"));
|
||||
columns.add(new ExcelImFieldModel("tax_type","纳税人类别","select"));
|
||||
columns.add(new ExcelImFieldModel("enterprise_scale","企业规模","select"));
|
||||
columns.add(new ExcelImFieldModel("enterprise_nature","企业类型","select"));
|
||||
columns.add(new ExcelImFieldModel("industry_code","行业代码","select"));
|
||||
columns.add(new ExcelImFieldModel("registration_date","成立日期","datePicker"));
|
||||
columns.add(new ExcelImFieldModel("registered_capital","注册资本","inputNumber"));
|
||||
columns.add(new ExcelImFieldModel("legal_representative","法定代表人","input"));
|
||||
columns.add(new ExcelImFieldModel("phone","联系电话","input"));
|
||||
columns.add(new ExcelImFieldModel("email","邮箱","input"));
|
||||
columns.add(new ExcelImFieldModel("website","网站","input"));
|
||||
columns.add(new ExcelImFieldModel("address","地址","input"));
|
||||
columns.add(new ExcelImFieldModel("province_id","所属地区","areaSelect"));
|
||||
columns.add(new ExcelImFieldModel("business_scope","经营范围","textarea"));
|
||||
columns.add(new ExcelImFieldModel("remark","备注","textarea"));
|
||||
columns.add(new ExcelImFieldModel("yunzhupaas_mdm_supplier_yunzhupaas_major_person_id","责任人","userSelect"));
|
||||
//tableField46dc53子表对象
|
||||
List<ExcelImFieldModel> tableField46dc53columns = new ArrayList<>();
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("title_name" ,"发票抬头名称"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("credit_code" ,"纳税人识别号"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("tax_type" ,"纳税人类别"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("address" ,"地址"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("phone" ,"电话"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("bank_name" ,"开户银行"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("bank_account" ,"银行账户"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("is_defalut" ,"是否默认"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("is_valid" ,"是否有效"));
|
||||
tableField46dc53columns.add(new ExcelImFieldModel("remark" ,"备注"));
|
||||
columns.add(new ExcelImFieldModel("tableField46dc53","设计子表","table",tableField46dc53columns));
|
||||
//tableFieldad9d92子表对象
|
||||
List<ExcelImFieldModel> tableFieldad9d92columns = new ArrayList<>();
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_name" ,"开户行"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_account_name" ,"账户名"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_account_number" ,"银行账号"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("bank_province" ,"开户行城市"));
|
||||
tableFieldad9d92columns.add(new ExcelImFieldModel("remark" ,"备注"));
|
||||
columns.add(new ExcelImFieldModel("tableFieldad9d92","设计子表","table",tableFieldad9d92columns));
|
||||
headAndDataMap.put("dataRow" , results);
|
||||
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail(MsgCode.VS407.get());
|
||||
}
|
||||
return ActionResult.success(headAndDataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导入数据" )
|
||||
@PostMapping("/ImportData")
|
||||
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
|
||||
List<Map<String, Object>> listData = visualImportModel.getList();
|
||||
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
|
||||
uniqueModel.setDbLinkId(SuppinfoConstant.DBLINKID);
|
||||
uniqueModel.setUpdate(Objects.equals("2", "2"));
|
||||
|
||||
Map<String,String> tablefieldkey = new HashMap<>();
|
||||
for(String key:SuppinfoConstant.TABLEFIELDKEY.keySet()){
|
||||
tablefieldkey.put(key,SuppinfoConstant.TABLERENAMES.get(SuppinfoConstant.TABLEFIELDKEY.get(key)));
|
||||
}
|
||||
ExcelImportModel excelImportModel = generaterSwapUtil.importData(SuppinfoConstant.getFormData(),listData,uniqueModel, tablefieldkey,SuppinfoConstant.getTableList());
|
||||
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
|
||||
for (ImportDataModel model : importDataModel) {
|
||||
String id = model.getId();
|
||||
Map<String, Object> result = model.getResultData();
|
||||
if(StringUtil.isNotEmpty(id)){
|
||||
update(id, JsonUtil.getJsonToBean(result,SuppinfoForm.class), true);
|
||||
}else {
|
||||
create( JsonUtil.getJsonToBean(result,SuppinfoForm.class));
|
||||
}
|
||||
}
|
||||
return ActionResult.success(excelImportModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出异常报告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出异常报告")
|
||||
@PostMapping("/ImportExceptionData")
|
||||
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
|
||||
DownloadVO vo = DownloadVO.builder().build();
|
||||
UserInfo userInfo = userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(visualImportModel.getMenuId());
|
||||
//主表对象
|
||||
List<ExcelExportEntity> entitys = new ArrayList<>();
|
||||
entitys.add(new ExcelExportEntity("异常原因", "errorsInfo",30));
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
//以下添加字段
|
||||
entitys.add(new ExcelExportEntity("企业名称(company_name)" ,"company_name"));
|
||||
selectKeys.add("company_name");
|
||||
entitys.add(new ExcelExportEntity("社会信用代码(credit_code)" ,"credit_code"));
|
||||
selectKeys.add("credit_code");
|
||||
entitys.add(new ExcelExportEntity("归属组织(org_id)" ,"org_id"));
|
||||
selectKeys.add("org_id");
|
||||
entitys.add(new ExcelExportEntity("企业编码(company_code)" ,"company_code"));
|
||||
selectKeys.add("company_code");
|
||||
entitys.add(new ExcelExportEntity("简称/昵称(short_name)" ,"short_name"));
|
||||
selectKeys.add("short_name");
|
||||
entitys.add(new ExcelExportEntity("类型(entity_type)" ,"entity_type"));
|
||||
selectKeys.add("entity_type");
|
||||
entitys.add(new ExcelExportEntity("纳税人类别(tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tax_type");
|
||||
entitys.add(new ExcelExportEntity("企业规模(enterprise_scale)" ,"enterprise_scale"));
|
||||
selectKeys.add("enterprise_scale");
|
||||
entitys.add(new ExcelExportEntity("企业类型(enterprise_nature)" ,"enterprise_nature"));
|
||||
selectKeys.add("enterprise_nature");
|
||||
entitys.add(new ExcelExportEntity("行业代码(industry_code)" ,"industry_code"));
|
||||
selectKeys.add("industry_code");
|
||||
entitys.add(new ExcelExportEntity("成立日期(registration_date)" ,"registration_date"));
|
||||
selectKeys.add("registration_date");
|
||||
entitys.add(new ExcelExportEntity("注册资本(registered_capital)" ,"registered_capital"));
|
||||
selectKeys.add("registered_capital");
|
||||
entitys.add(new ExcelExportEntity("法定代表人(legal_representative)" ,"legal_representative"));
|
||||
selectKeys.add("legal_representative");
|
||||
entitys.add(new ExcelExportEntity("联系电话(phone)" ,"phone"));
|
||||
selectKeys.add("phone");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("网站(website)" ,"website"));
|
||||
selectKeys.add("website");
|
||||
entitys.add(new ExcelExportEntity("地址(address)" ,"address"));
|
||||
selectKeys.add("address");
|
||||
entitys.add(new ExcelExportEntity("所属地区(province_id)" ,"province_id"));
|
||||
selectKeys.add("province_id");
|
||||
entitys.add(new ExcelExportEntity("经营范围(business_scope)" ,"business_scope"));
|
||||
selectKeys.add("business_scope");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
entitys.add(new ExcelExportEntity("责任人(yunzhupaas_mdm_supplier_yunzhupaas_major_person_id)" ,"yunzhupaas_mdm_supplier_yunzhupaas_major_person_id"));
|
||||
selectKeys.add("yunzhupaas_mdm_supplier_yunzhupaas_major_person_id");
|
||||
//tableField46dc53子表对象
|
||||
ExcelExportEntity tableField46dc53ExcelEntity = new ExcelExportEntity("设计子表(tableField46dc53)","tableField46dc53");
|
||||
List<ExcelExportEntity> tableField46dc53ExcelEntityList = new ArrayList<>();
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("发票抬头名称(tableField46dc53-title_name)" ,"title_name"));
|
||||
selectKeys.add("tableField46dc53-title_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人识别号(tableField46dc53-credit_code)" ,"credit_code"));
|
||||
selectKeys.add("tableField46dc53-credit_code");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("纳税人类别(tableField46dc53-tax_type)" ,"tax_type"));
|
||||
selectKeys.add("tableField46dc53-tax_type");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("地址(tableField46dc53-address)" ,"address"));
|
||||
selectKeys.add("tableField46dc53-address");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("电话(tableField46dc53-phone)" ,"phone"));
|
||||
selectKeys.add("tableField46dc53-phone");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("开户银行(tableField46dc53-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableField46dc53-bank_name");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("银行账户(tableField46dc53-bank_account)" ,"bank_account"));
|
||||
selectKeys.add("tableField46dc53-bank_account");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否默认(tableField46dc53-is_defalut)" ,"is_defalut"));
|
||||
selectKeys.add("tableField46dc53-is_defalut");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("是否有效(tableField46dc53-is_valid)" ,"is_valid"));
|
||||
selectKeys.add("tableField46dc53-is_valid");
|
||||
tableField46dc53ExcelEntityList.add(new ExcelExportEntity("备注(tableField46dc53-remark)" ,"remark"));
|
||||
selectKeys.add("tableField46dc53-remark");
|
||||
tableField46dc53ExcelEntity.setList(tableField46dc53ExcelEntityList);
|
||||
entitys.add(tableField46dc53ExcelEntity);
|
||||
//tableFieldad9d92子表对象
|
||||
ExcelExportEntity tableFieldad9d92ExcelEntity = new ExcelExportEntity("设计子表(tableFieldad9d92)","tableFieldad9d92");
|
||||
List<ExcelExportEntity> tableFieldad9d92ExcelEntityList = new ArrayList<>();
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行(tableFieldad9d92-bank_name)" ,"bank_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("账户名(tableFieldad9d92-bank_account_name)" ,"bank_account_name"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_name");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("银行账号(tableFieldad9d92-bank_account_number)" ,"bank_account_number"));
|
||||
selectKeys.add("tableFieldad9d92-bank_account_number");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("开户行城市(tableFieldad9d92-bank_province)" ,"bank_province"));
|
||||
selectKeys.add("tableFieldad9d92-bank_province");
|
||||
tableFieldad9d92ExcelEntityList.add(new ExcelExportEntity("备注(tableFieldad9d92-remark)" ,"remark"));
|
||||
selectKeys.add("tableFieldad9d92-remark");
|
||||
tableFieldad9d92ExcelEntity.setList(tableFieldad9d92ExcelEntityList);
|
||||
entitys.add(tableFieldad9d92ExcelEntity);
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(SuppinfoConstant.getFormData(),selectKeys);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.addAll(visualImportModel.getList());
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, menuFullName + "模板");
|
||||
exportParams.setStyle(ExcelExportStyler.class);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setFreezeCol(1);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//复杂表头-表头和数据处理
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(SuppinfoConstant.getColumnData(), ColumnDataModel.class);
|
||||
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
|
||||
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
|
||||
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList, false);
|
||||
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList, false);
|
||||
}
|
||||
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
|
||||
ExcelHelper helper = new ExcelHelper();
|
||||
helper.init(workbook, exportParams, entitys, excelModel);
|
||||
helper.doPreHandle();
|
||||
helper.doPostHandle();
|
||||
}
|
||||
|
||||
String fileName = menuFullName + "错误报告_" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xls";
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id,@RequestParam(name = "forceDel",defaultValue = "false") boolean forceDel) throws Exception{
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//主表数据删除
|
||||
companyService.delete(entity);
|
||||
QueryWrapper<SupplierEntity> queryWrapperSupplier=new QueryWrapper<>();
|
||||
queryWrapperSupplier.lambda().eq(SupplierEntity::getCompanyId,entity.getCompanyId());
|
||||
//副表数据删除
|
||||
supplierService.remove(queryWrapperSupplier);
|
||||
QueryWrapper<PanyInvoiceEntity> queryWrapperPanyInvoice=new QueryWrapper<>();
|
||||
queryWrapperPanyInvoice.lambda().eq(PanyInvoiceEntity::getCompanyId,entity.getCompanyId());
|
||||
//子表数据删除
|
||||
panyInvoiceService.remove(queryWrapperPanyInvoice);
|
||||
QueryWrapper<CompanyBankEntity> queryWrapperCompanyBank=new QueryWrapper<>();
|
||||
queryWrapperCompanyBank.lambda().eq(CompanyBankEntity::getCompanyId,entity.getCompanyId());
|
||||
//子表数据删除
|
||||
companyBankService.remove(queryWrapperCompanyBank);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/batchRemove")
|
||||
@Transactional
|
||||
@Operation(summary = "批量删除")
|
||||
public ActionResult batchRemove(@RequestBody Object obj){
|
||||
Map<String, Object> objectMap = JsonUtil.entityToMap(obj);
|
||||
List<String> idList = JsonUtil.getJsonToList(objectMap.get("ids"), String.class);
|
||||
String errInfo = "";
|
||||
List<String> successList = new ArrayList<>();
|
||||
for (String allId : idList){
|
||||
try {
|
||||
this.delete(allId,false);
|
||||
successList.add(allId);
|
||||
} catch (Exception e) {
|
||||
errInfo = e.getMessage();
|
||||
}
|
||||
}
|
||||
if (successList.size() == 0 && StringUtil.isNotEmpty(errInfo)){
|
||||
return ActionResult.fail(errInfo);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
* @param companyForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid SuppinfoForm companyForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity!=null){
|
||||
companyForm.setCompanyId(String.valueOf(entity.getCompanyId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = companyService.checkForm(companyForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
companyService.saveOrUpdate(companyForm,id,false);
|
||||
}catch (DataException e1){
|
||||
return ActionResult.fail(e1.getMessage());
|
||||
}catch(Exception e){
|
||||
return ActionResult.fail(MsgCode.FA029.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}else{
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表单信息(详情页)
|
||||
* 详情页面使用-转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "表单信息(详情页)")
|
||||
@GetMapping("/detail/{id}")
|
||||
public ActionResult detailInfo(@PathVariable("id") String id){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
SupplierEntity supplierEntity = entity.getSupplier();
|
||||
if(ObjectUtil.isNotEmpty(supplierEntity)){
|
||||
Map<String, Object> supplierMap=JsonUtil.entityToMap(supplierEntity);
|
||||
for(String key:supplierMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_supplier_yunzhupaas_"+key,supplierMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<PanyInvoiceEntity> panyInvoiceList = entity.getPanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(panyInvoiceList)));
|
||||
companyMap.put("panyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(panyInvoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
companyMap = generaterSwapUtil.swapDataDetail(companyMap,SuppinfoConstant.getFormData(),"817082533433836293",isPc?false:false);
|
||||
//子表数据
|
||||
companyMap.put("panyInvoiceList",companyMap.get("tableField46dc53"));
|
||||
companyMap.put("companyBankList",companyMap.get("tableFieldad9d92"));
|
||||
return ActionResult.success(companyMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
CompanyEntity entity= companyService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> companyMap=JsonUtil.entityToMap(entity);
|
||||
companyMap.put("id", companyMap.get("company_id"));
|
||||
//副表数据
|
||||
SupplierEntity supplierEntity = entity.getSupplier();
|
||||
if(ObjectUtil.isNotEmpty(supplierEntity)){
|
||||
Map<String, Object> supplierMap=JsonUtil.entityToMap(supplierEntity);
|
||||
for(String key:supplierMap.keySet()){
|
||||
companyMap.put("yunzhupaas_mdm_supplier_yunzhupaas_"+key,supplierMap.get(key));
|
||||
}
|
||||
}
|
||||
//子表数据
|
||||
List<PanyInvoiceEntity> panyInvoiceList = entity.getPanyInvoice();
|
||||
companyMap.put("tableField46dc53",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(panyInvoiceList)));
|
||||
companyMap.put("panyInvoiceList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(panyInvoiceList)));
|
||||
List<CompanyBankEntity> companyBankList = entity.getCompanyBank();
|
||||
companyMap.put("tableFieldad9d92",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap.put("companyBankList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(companyBankList)));
|
||||
companyMap = generaterSwapUtil.swapDataForm(companyMap,SuppinfoConstant.getFormData(),SuppinfoConstant.TABLEFIELDKEY,SuppinfoConstant.TABLERENAMES);
|
||||
return ActionResult.success(companyMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.yunzhupaas.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
* 企业联系人
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_company_contact")
|
||||
public class MdmCompanyContactEntity {
|
||||
@TableId(value ="contact_id" )
|
||||
@JSONField(name = "contact_id")
|
||||
private String contactId;
|
||||
@TableField("company_id")
|
||||
@JSONField(name = "company_id")
|
||||
private String companyId;
|
||||
@TableField(value = "contact_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "contact_name")
|
||||
private String contactName;
|
||||
@TableField(value = "contact_title" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "contact_title")
|
||||
private String contactTitle;
|
||||
@TableField(value = "contact_phone" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "contact_phone")
|
||||
private String contactPhone;
|
||||
@TableField(value = "contact_email" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "contact_email")
|
||||
private String contactEmail;
|
||||
@TableField(value = "remark" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@TableField("f_delete_mark")
|
||||
@JSONField(name = "f_delete_mark")
|
||||
private Integer deleteMark;
|
||||
@TableField("f_delete_time")
|
||||
@JSONField(name = "f_delete_time")
|
||||
private Date deleteTime;
|
||||
@TableField("f_delete_user_id")
|
||||
@JSONField(name = "f_delete_user_id")
|
||||
private String deleteUserId;
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
package com.yunzhupaas.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
* 合同类型配置
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-30
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_contract_type")
|
||||
public class MdmContractTypeEntity {
|
||||
@TableId(value ="id" )
|
||||
@JSONField(name = "id")
|
||||
private String id;
|
||||
@TableField(value = "contract_type_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "contract_type_code")
|
||||
private String contractTypeCode;
|
||||
@TableField(value = "contract_type_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "contract_type_name")
|
||||
private String contractTypeName;
|
||||
@TableField(value = "contract_mode" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "contract_mode")
|
||||
private String contractMode;
|
||||
@TableField(value = "project_type" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "project_type")
|
||||
private String projectType;
|
||||
@TableField(value = "cl_list_enabled" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "cl_list_enabled")
|
||||
private String clListEnabled;
|
||||
@TableField(value = "cl_list_alias" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "cl_list_alias")
|
||||
private String clListAlias;
|
||||
@TableField(value = "cl_lst_seq" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "cl_lst_seq")
|
||||
private Integer clLstSeq;
|
||||
@TableField(value = "rg_list_enabled" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "rg_list_enabled")
|
||||
private String rgListEnabled;
|
||||
@TableField(value = "rg_list_alias" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "rg_list_alias")
|
||||
private String rgListAlias;
|
||||
@TableField(value = "rg_lst_seq" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "rg_lst_seq")
|
||||
private Integer rgLstSeq;
|
||||
@TableField(value = "zl_list_enabled" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "zl_list_enabled")
|
||||
private String zlListEnabled;
|
||||
@TableField(value = "zl_list_alias" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "zl_list_alias")
|
||||
private String zlListAlias;
|
||||
@TableField(value = "zl_lst_seq" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "zl_lst_seq")
|
||||
private Integer zlLstSeq;
|
||||
@TableField("fy_list_enabled")
|
||||
@JSONField(name = "fy_list_enabled")
|
||||
private String fyListEnabled;
|
||||
@TableField("fy_list_alias")
|
||||
@JSONField(name = "fy_list_alias")
|
||||
private String fyListAlias;
|
||||
@TableField("fy_lst_seq")
|
||||
@JSONField(name = "fy_lst_seq")
|
||||
private Integer fyLstSeq;
|
||||
@TableField(value = "gcl_list_enabled" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "gcl_list_enabled")
|
||||
private String gclListEnabled;
|
||||
@TableField(value = "gcl_list_alias" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "gcl_list_alias")
|
||||
private String gclListAlias;
|
||||
@TableField(value = "gcl_lst_seq" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "gcl_lst_seq")
|
||||
private Integer gclLstSeq;
|
||||
@TableField(value = "contract_temp_enabled" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "contract_temp_enabled")
|
||||
private String contractTempEnabled;
|
||||
@TableField(value = "workflow_enabled" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "workflow_enabled")
|
||||
private String workflowEnabled;
|
||||
@TableField(value = "workflow_temp_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "workflow_temp_id")
|
||||
private String workflowTempId;
|
||||
@TableField("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_date")
|
||||
@JSONField(name = "create_date")
|
||||
private Date createDate;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_date")
|
||||
@JSONField(name = "update_date")
|
||||
private Date updateDate;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@TableField("f_flow_id")
|
||||
@JSONField(name = "f_flow_id")
|
||||
private String flowId;
|
||||
@TableField("f_flow_task_id")
|
||||
@JSONField(name = "f_flow_task_id")
|
||||
private String flowTaskId;
|
||||
@TableField("f_delete_mark")
|
||||
@JSONField(name = "f_delete_mark")
|
||||
private Integer deleteMark;
|
||||
@TableField("f_delete_time")
|
||||
@JSONField(name = "f_delete_time")
|
||||
private Date deleteTime;
|
||||
@TableField("f_delete_user_id")
|
||||
@JSONField(name = "f_delete_user_id")
|
||||
private String deleteUserId;
|
||||
@TableField("f_version")
|
||||
@Version
|
||||
@JSONField(name = "f_version")
|
||||
private Integer version;
|
||||
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.yunzhupaas.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
* 项目结构
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_project")
|
||||
public class MdmProjectEntity {
|
||||
@TableId(value ="project_id" )
|
||||
@JSONField(name = "project_id")
|
||||
private String projectId;
|
||||
@TableField(value = "project_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "project_code")
|
||||
private String projectCode;
|
||||
@TableField(value = "project_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "project_name")
|
||||
private String projectName;
|
||||
@TableField(value = "parent_project_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "parent_project_id")
|
||||
private String parentProjectId;
|
||||
@TableField(value = "org_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "org_id")
|
||||
private String orgId;
|
||||
@TableField(value = "project_type" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "project_type")
|
||||
private String projectType;
|
||||
@TableField(value = "project_start_date" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "project_start_date")
|
||||
private Date projectStartDate;
|
||||
@TableField(value = "project_state_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "project_state_id")
|
||||
private String projectStateId;
|
||||
@TableField(value = "seq_num" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "seq_num")
|
||||
private Integer seqNum;
|
||||
@TableField(value = "remark" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField("delete_time")
|
||||
@JSONField(name = "delete_time")
|
||||
private Date deleteTime;
|
||||
@TableField("delete_by")
|
||||
@JSONField(name = "delete_by")
|
||||
private String deleteBy;
|
||||
@TableField("delete_mark")
|
||||
@JSONField(name = "delete_mark")
|
||||
private Integer deleteMark;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@TableField("f_flow_id")
|
||||
@JSONField(name = "f_flow_id")
|
||||
private String flowId;
|
||||
@TableField("f_flow_task_id")
|
||||
@JSONField(name = "f_flow_task_id")
|
||||
private String flowTaskId;
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,25 +0,0 @@
|
||||
package com.yunzhupaas.base.model.bcmprojecttype;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* 项目类型
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
*/
|
||||
@Data
|
||||
public class BcmProjectTypeExcelVO{
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.yunzhupaas.base.model.bcmprojecttype;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "表单参数")
|
||||
public class BcmProjectTypeForm {
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
@JSONField(name = "project_type_id")
|
||||
private String projectTypeId;
|
||||
|
||||
/** 乐观锁 **/
|
||||
@Schema(description = "乐观锁")
|
||||
@JsonProperty("f_version")
|
||||
@JSONField(name = "f_version")
|
||||
private Integer version;
|
||||
|
||||
/** 项目类型编码 **/
|
||||
@Schema(description = "项目类型编码")
|
||||
@JsonProperty("project_type_code")
|
||||
@JSONField(name = "project_type_code")
|
||||
private String projectTypeCode;
|
||||
/** 项目类型名称 **/
|
||||
@Schema(description = "项目类型名称")
|
||||
@JsonProperty("project_type_name")
|
||||
@JSONField(name = "project_type_name")
|
||||
private String projectTypeName;
|
||||
/** 备注 **/
|
||||
@Schema(description = "备注")
|
||||
@JsonProperty("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.yunzhupaas.base.model.mdmcompany;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* mdm_company
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-27
|
||||
*/
|
||||
@Data
|
||||
public class MdmCompanyBankExcelVO{
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,25 +0,0 @@
|
||||
package com.yunzhupaas.base.model.mdmcompany;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* mdm_company
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-27
|
||||
*/
|
||||
@Data
|
||||
public class MdmCompanyContactExcelVO{
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.yunzhupaas.base.model.mdmcompany;
|
||||
|
||||
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;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
*
|
||||
* mdm_company
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-27
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "MdmCompanyContact子表参数")
|
||||
public class MdmCompanyContactModel {
|
||||
|
||||
/** 子表:MdmCompanyContact 主键:contact_id **/
|
||||
@Schema(description = "主键")
|
||||
@JsonProperty("contact_id")
|
||||
private String contact_id;
|
||||
/** 联系人 **/
|
||||
@Schema(description = "联系人")
|
||||
@JsonProperty("contact_name")
|
||||
@JSONField(name = "contact_name")
|
||||
private String contactName;
|
||||
/** 联系人职务 **/
|
||||
@Schema(description = "联系人职务")
|
||||
@JsonProperty("contact_title")
|
||||
@JSONField(name = "contact_title")
|
||||
private String contactTitle;
|
||||
/** 电话 **/
|
||||
@Schema(description = "电话")
|
||||
@JsonProperty("contact_phone")
|
||||
@JSONField(name = "contact_phone")
|
||||
private String contactPhone;
|
||||
/** 邮箱 **/
|
||||
@Schema(description = "邮箱")
|
||||
@JsonProperty("contact_email")
|
||||
@JSONField(name = "contact_email")
|
||||
private String contactEmail;
|
||||
/** 备注 **/
|
||||
@Schema(description = "备注")
|
||||
@JsonProperty("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.yunzhupaas.base.model.mdmcompany;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* mdm_company
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-27
|
||||
*/
|
||||
@Data
|
||||
public class MdmCompanyExcelVO{
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,25 +0,0 @@
|
||||
package com.yunzhupaas.base.model.mdmcontracttype;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* mdmContractType
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-30
|
||||
*/
|
||||
@Data
|
||||
public class MdmContractTypeExcelVO{
|
||||
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package com.yunzhupaas.base.model.mdmcontracttype;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* mdmContractType
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-30
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "表单参数")
|
||||
public class MdmContractTypeForm {
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
@JSONField(name = "id")
|
||||
private String id;
|
||||
|
||||
/** 乐观锁 **/
|
||||
@Schema(description = "乐观锁")
|
||||
@JsonProperty("f_version")
|
||||
@JSONField(name = "f_version")
|
||||
private Integer version;
|
||||
|
||||
/** 合同类型编码 **/
|
||||
@Schema(description = "合同类型编码")
|
||||
@JsonProperty("contract_type_code")
|
||||
@JSONField(name = "contract_type_code")
|
||||
private String contractTypeCode;
|
||||
/** 合同类型名称 **/
|
||||
@Schema(description = "合同类型名称")
|
||||
@JsonProperty("contract_type_name")
|
||||
@JSONField(name = "contract_type_name")
|
||||
private String contractTypeName;
|
||||
/** 项目类型 **/
|
||||
@Schema(description = "项目类型")
|
||||
@JsonProperty("project_type")
|
||||
@JSONField(name = "project_type")
|
||||
private Object projectType;
|
||||
/** 合同模式 **/
|
||||
@Schema(description = "合同模式")
|
||||
@JsonProperty("contract_mode")
|
||||
@JSONField(name = "contract_mode")
|
||||
private Object contractMode;
|
||||
/** 材料清单 **/
|
||||
@Schema(description = "材料清单")
|
||||
@JsonProperty("cl_list_enabled")
|
||||
@JSONField(name = "cl_list_enabled")
|
||||
private Integer clListEnabled;
|
||||
/** 材料清单别名 **/
|
||||
@Schema(description = "材料清单别名")
|
||||
@JsonProperty("cl_list_alias")
|
||||
@JSONField(name = "cl_list_alias")
|
||||
private String clListAlias;
|
||||
/** 材料清单顺序 **/
|
||||
@Schema(description = "材料清单顺序")
|
||||
@JsonProperty("cl_lst_seq")
|
||||
@JSONField(name = "cl_lst_seq")
|
||||
private BigDecimal clLstSeq;
|
||||
/** 租赁清单 **/
|
||||
@Schema(description = "租赁清单")
|
||||
@JsonProperty("zl_list_enabled")
|
||||
@JSONField(name = "zl_list_enabled")
|
||||
private Integer zlListEnabled;
|
||||
/** 租赁清单别名 **/
|
||||
@Schema(description = "租赁清单别名")
|
||||
@JsonProperty("zl_list_alias")
|
||||
@JSONField(name = "zl_list_alias")
|
||||
private String zlListAlias;
|
||||
/** 租赁清单顺序 **/
|
||||
@Schema(description = "租赁清单顺序")
|
||||
@JsonProperty("zl_lst_seq")
|
||||
@JSONField(name = "zl_lst_seq")
|
||||
private BigDecimal zlLstSeq;
|
||||
/** 劳务清单 **/
|
||||
@Schema(description = "劳务清单")
|
||||
@JsonProperty("rg_list_enabled")
|
||||
@JSONField(name = "rg_list_enabled")
|
||||
private Integer rgListEnabled;
|
||||
/** 劳务清单别名 **/
|
||||
@Schema(description = "劳务清单别名")
|
||||
@JsonProperty("rg_list_alias")
|
||||
@JSONField(name = "rg_list_alias")
|
||||
private String rgListAlias;
|
||||
/** 劳务清单顺序 **/
|
||||
@Schema(description = "劳务清单顺序")
|
||||
@JsonProperty("rg_lst_seq")
|
||||
@JSONField(name = "rg_lst_seq")
|
||||
private BigDecimal rgLstSeq;
|
||||
/** 工程量清单 **/
|
||||
@Schema(description = "工程量清单")
|
||||
@JsonProperty("gcl_list_enabled")
|
||||
@JSONField(name = "gcl_list_enabled")
|
||||
private Integer gclListEnabled;
|
||||
/** 工程量清单别名 **/
|
||||
@Schema(description = "工程量清单别名")
|
||||
@JsonProperty("gcl_list_alias")
|
||||
@JSONField(name = "gcl_list_alias")
|
||||
private String gclListAlias;
|
||||
/** 工程量清单顺序 **/
|
||||
@Schema(description = "工程量清单顺序")
|
||||
@JsonProperty("gcl_lst_seq")
|
||||
@JSONField(name = "gcl_lst_seq")
|
||||
private BigDecimal gclLstSeq;
|
||||
/** 在线合同模板 **/
|
||||
@Schema(description = "在线合同模板")
|
||||
@JsonProperty("contract_temp_enabled")
|
||||
@JSONField(name = "contract_temp_enabled")
|
||||
private Integer contractTempEnabled;
|
||||
/** 工作流程 **/
|
||||
@Schema(description = "工作流程")
|
||||
@JsonProperty("workflow_enabled")
|
||||
@JSONField(name = "workflow_enabled")
|
||||
private Integer workflowEnabled;
|
||||
/** 流程模板ID,关联流程模板表 **/
|
||||
@Schema(description = "流程模板ID,关联流程模板表")
|
||||
@JsonProperty("workflow_temp_id")
|
||||
@JSONField(name = "workflow_temp_id")
|
||||
private Object workflowTempId;
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,25 +0,0 @@
|
||||
package com.yunzhupaas.base.model.mdmproject;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* 项目结构
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
*/
|
||||
@Data
|
||||
public class MdmProjectExcelVO{
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.yunzhupaas.base.model.mdmproject;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 项目结构
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "表单参数")
|
||||
public class MdmProjectForm {
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
@JSONField(name = "project_id")
|
||||
private String projectId;
|
||||
|
||||
|
||||
/** 项目编码 **/
|
||||
@Schema(description = "项目编码")
|
||||
@JsonProperty("project_code")
|
||||
@JSONField(name = "project_code")
|
||||
private String projectCode;
|
||||
/** 项目名称 **/
|
||||
@Schema(description = "项目名称")
|
||||
@JsonProperty("project_name")
|
||||
@JSONField(name = "project_name")
|
||||
private String projectName;
|
||||
/** 上级项目 **/
|
||||
@Schema(description = "上级项目")
|
||||
@JsonProperty("parent_project_id")
|
||||
@JSONField(name = "parent_project_id")
|
||||
private Object parentProjectId;
|
||||
/** 归属组织 **/
|
||||
@Schema(description = "归属组织")
|
||||
@JsonProperty("org_id")
|
||||
@JSONField(name = "org_id")
|
||||
private Object orgId;
|
||||
/** 项目类型 **/
|
||||
@Schema(description = "项目类型")
|
||||
@JsonProperty("project_type")
|
||||
@JSONField(name = "project_type")
|
||||
private Object projectType;
|
||||
/** 启动日期 **/
|
||||
@Schema(description = "启动日期")
|
||||
@JsonProperty("project_start_date")
|
||||
@JSONField(name = "project_start_date")
|
||||
private String projectStartDate;
|
||||
/** 项目状态 **/
|
||||
@Schema(description = "项目状态")
|
||||
@JsonProperty("project_state_id")
|
||||
@JSONField(name = "project_state_id")
|
||||
private Object projectStateId;
|
||||
/** 顺序号 **/
|
||||
@Schema(description = "顺序号")
|
||||
@JsonProperty("seq_num")
|
||||
@JSONField(name = "seq_num")
|
||||
private BigDecimal seqNum;
|
||||
/** 备注 **/
|
||||
@Schema(description = "备注")
|
||||
@JsonProperty("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
/**
|
||||
* 资产信息
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-28
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_asset")
|
||||
public class AssetEntity {
|
||||
@TableId(value ="asset_id" )
|
||||
@JSONField(name = "asset_id")
|
||||
private String assetId;
|
||||
@TableField(value = "asset_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "asset_code")
|
||||
private String assetCode;
|
||||
@TableField(value = "asset_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "asset_name")
|
||||
private String assetName;
|
||||
@TableField(value = "asset_type" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "asset_type")
|
||||
private String assetType;
|
||||
@TableField(value = "asset_category" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "asset_category")
|
||||
private String assetCategory;
|
||||
@TableField(value = "asset_status" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "asset_status")
|
||||
private String assetStatus;
|
||||
@TableField(value = "asset_location" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "asset_location")
|
||||
private String assetLocation;
|
||||
@TableField(value = "current_org_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "current_org_id")
|
||||
private String currentOrgId;
|
||||
@TableField(value = "current_user_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "current_user_id")
|
||||
private String currentUserId;
|
||||
@TableField(value = "asset_ownership" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "asset_ownership")
|
||||
private String assetOwnership;
|
||||
@TableField(value = "measurement_unit" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "measurement_unit")
|
||||
private String measurementUnit;
|
||||
@TableField(value = "quantity" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "quantity")
|
||||
private BigDecimal quantity;
|
||||
@TableField(value = "purchase_date" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "purchase_date")
|
||||
private Date purchaseDate;
|
||||
@TableField(value = "commissioning_date" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "commissioning_date")
|
||||
private Date commissioningDate;
|
||||
@TableField(value = "expected_life" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "expected_life")
|
||||
private BigDecimal expectedLife;
|
||||
@TableField(value = "supplier_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "supplier_id")
|
||||
private String supplierId;
|
||||
@TableField(value = "remark" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@TableField("f_flow_id")
|
||||
@JSONField(name = "f_flow_id")
|
||||
private String flowId;
|
||||
@TableField("f_flow_task_id")
|
||||
@JSONField(name = "f_flow_task_id")
|
||||
private String flowTaskId;
|
||||
@TableField("f_delete_mark")
|
||||
@JSONField(name = "f_delete_mark")
|
||||
private Integer deleteMark;
|
||||
@TableField("f_delete_time")
|
||||
@JSONField(name = "f_delete_time")
|
||||
private Date deleteTime;
|
||||
@TableField("f_delete_user_id")
|
||||
@JSONField(name = "f_delete_user_id")
|
||||
private String deleteUserId;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yunzhupaas.base.entity;
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -11,11 +11,11 @@ import com.alibaba.fastjson.annotation.JSONField;
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_company_bank")
|
||||
public class MdmCompanyBankEntity {
|
||||
public class CompanyBankEntity {
|
||||
@TableId(value ="bank_id" )
|
||||
@JSONField(name = "bank_id")
|
||||
private String bankId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yunzhupaas.base.entity;
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -12,11 +12,11 @@ import java.math.BigDecimal;
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_company")
|
||||
public class MdmCompanyEntity {
|
||||
public class CompanyEntity {
|
||||
@TableId(value ="company_id" )
|
||||
@JSONField(name = "company_id")
|
||||
private String companyId;
|
||||
@@ -32,7 +32,10 @@ public class MdmCompanyEntity {
|
||||
@TableField(value = "short_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "short_name")
|
||||
private String shortName;
|
||||
@TableField(value = "company_scope" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@TableField(value = "org_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "org_id")
|
||||
private String orgId;
|
||||
@TableField("company_scope")
|
||||
@JSONField(name = "company_scope")
|
||||
private String companyScope;
|
||||
@TableField(value = "credit_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@@ -91,7 +94,7 @@ public class MdmCompanyEntity {
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateBime;
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@@ -104,10 +107,6 @@ public class MdmCompanyEntity {
|
||||
@TableField("f_delete_user_id")
|
||||
@JSONField(name = "f_delete_user_id")
|
||||
private String deleteUserId;
|
||||
@TableField("f_version")
|
||||
@Version
|
||||
@JSONField(name = "f_version")
|
||||
private Integer version;
|
||||
@TableField("f_flow_id")
|
||||
@JSONField(name = "f_flow_id")
|
||||
private String flowId;
|
||||
@@ -115,13 +114,22 @@ public class MdmCompanyEntity {
|
||||
@JSONField(name = "f_flow_task_id")
|
||||
private String flowTaskId;
|
||||
|
||||
@JSONField(name = "mdmCompanyBank")
|
||||
@JSONField(name = "corporation")
|
||||
@TableField(exist = false)
|
||||
private List<MdmCompanyBankEntity> mdmCompanyBank;
|
||||
@JSONField(name = "mdmCompanyContact")
|
||||
private CorporationEntity corporation;
|
||||
@JSONField(name = "companyBank")
|
||||
@TableField(exist = false)
|
||||
private List<MdmCompanyContactEntity> mdmCompanyContact;
|
||||
@JSONField(name = "crmCustomer")
|
||||
private List<CompanyBankEntity> companyBank;
|
||||
@JSONField(name = "company_invoice")
|
||||
@TableField(exist = false)
|
||||
private CrmCustomerEntity crmCustomer;
|
||||
private List<CompanyInvoiceEntity> companyInvoice;
|
||||
@JSONField(name = "panyInvoice")
|
||||
@TableField(exist = false)
|
||||
private List<PanyInvoiceEntity> panyInvoice;
|
||||
@JSONField(name = "supplier")
|
||||
@TableField(exist = false)
|
||||
private SupplierEntity supplier;
|
||||
@JSONField(name = "customer")
|
||||
@TableField(exist = false)
|
||||
private CustomerEntity customer;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
* 企业发票抬头
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_company_invoice")
|
||||
public class CompanyInvoiceEntity {
|
||||
@TableId(value ="invoice_id" )
|
||||
@JSONField(name = "invoice_id")
|
||||
private String invoiceId;
|
||||
@TableField("company_id")
|
||||
@JSONField(name = "company_id")
|
||||
private String companyId;
|
||||
@TableField(value = "title_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "title_code")
|
||||
private String titleCode;
|
||||
@TableField(value = "title_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "title_name")
|
||||
private String titleName;
|
||||
@TableField(value = "credit_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "credit_code")
|
||||
private String creditCode;
|
||||
@TableField(value = "tax_type" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "tax_type")
|
||||
private String taxType;
|
||||
@TableField(value = "address" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "address")
|
||||
private String address;
|
||||
@TableField(value = "phone" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "phone")
|
||||
private String phone;
|
||||
@TableField(value = "bank_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "bank_name")
|
||||
private String bankName;
|
||||
@TableField(value = "bank_account" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "bank_account")
|
||||
private String bankAccount;
|
||||
@TableField(value = "is_valid" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "is_valid")
|
||||
private String isValid;
|
||||
@TableField(value = "is_defalut" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "is_defalut")
|
||||
private String isDefalut;
|
||||
@TableField(value = "remark" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@TableField("f_delete_mark")
|
||||
@JSONField(name = "f_delete_mark")
|
||||
private Integer deleteMark;
|
||||
@TableField("f_delete_time")
|
||||
@JSONField(name = "f_delete_time")
|
||||
private Date deleteTime;
|
||||
@TableField("f_delete_user_id")
|
||||
@JSONField(name = "f_delete_user_id")
|
||||
private String deleteUserId;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yunzhupaas.base.entity;
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -6,26 +6,26 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
* 项目类型
|
||||
* 法人公司
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("bcm_project_type")
|
||||
public class BcmProjectTypeEntity {
|
||||
@TableId(value ="project_type_id" )
|
||||
@JSONField(name = "project_type_id")
|
||||
private String projectTypeId;
|
||||
@TableField(value = "project_type_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "project_type_code")
|
||||
private String projectTypeCode;
|
||||
@TableField(value = "project_type_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "project_type_name")
|
||||
private String projectTypeName;
|
||||
@TableField(value = "remark" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@TableName("mdm_corporation")
|
||||
public class CorporationEntity {
|
||||
@TableId(value ="corporation_id" )
|
||||
@JSONField(name = "corporation_id")
|
||||
private String corporationId;
|
||||
@TableField("company_id")
|
||||
@JSONField(name = "company_id")
|
||||
private String companyId;
|
||||
@TableField(value = "major_person_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "major_person_id")
|
||||
private String majorPersonId;
|
||||
@TableField("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@@ -34,12 +34,12 @@ public class BcmProjectTypeEntity {
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@@ -52,10 +52,6 @@ public class BcmProjectTypeEntity {
|
||||
@TableField("f_delete_user_id")
|
||||
@JSONField(name = "f_delete_user_id")
|
||||
private String deleteUserId;
|
||||
@TableField("f_version")
|
||||
@Version
|
||||
@JSONField(name = "f_version")
|
||||
private Integer version;
|
||||
@TableField("f_flow_id")
|
||||
@JSONField(name = "f_flow_id")
|
||||
private String flowId;
|
||||
@@ -63,7 +59,4 @@ public class BcmProjectTypeEntity {
|
||||
@JSONField(name = "f_flow_task_id")
|
||||
private String flowTaskId;
|
||||
|
||||
@JSONField(name = "pcm_payment_plan")
|
||||
@TableField(exist = false)
|
||||
private List<MdmContractTypeEntity> mdmContractTypeEntities;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
* 客户
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_customer")
|
||||
public class CustomerEntity {
|
||||
@TableId(value ="customer_id" )
|
||||
@JSONField(name = "customer_id")
|
||||
private String customerId;
|
||||
@TableField("company_id")
|
||||
@JSONField(name = "company_id")
|
||||
private String companyId;
|
||||
@TableField(value = "major_person_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "major_person_id")
|
||||
private String personId;
|
||||
@TableField(value = "customer_level" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "customer_level")
|
||||
private String customerLevel;
|
||||
@TableField(value = "customer_source" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "customer_source")
|
||||
private String customerSource;
|
||||
@TableField("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import java.math.BigDecimal;
|
||||
/**
|
||||
* 物料信息
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_material")
|
||||
public class MaterialEntity {
|
||||
@TableId(value ="material_id" )
|
||||
@JSONField(name = "material_id")
|
||||
private String materialId;
|
||||
@TableField(value = "material_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "material_code")
|
||||
private String materialCode;
|
||||
@TableField(value = "material_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "material_name")
|
||||
private String materialName;
|
||||
@TableField(value = "material_model" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "material_model")
|
||||
private String materialModel;
|
||||
@TableField(value = "material_category" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "material_category")
|
||||
private String materialCategory;
|
||||
@TableField(value = "unit_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "unit_name")
|
||||
private String unitName;
|
||||
@TableField(value = "texture" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "texture")
|
||||
private String texture;
|
||||
@TableField(value = "brand" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "brand")
|
||||
private String brand;
|
||||
@TableField(value = "quality_standard" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "quality_standard")
|
||||
private String qualityStandard;
|
||||
@TableField(value = "technical_standard" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "technical_standard")
|
||||
private String technicalStandard;
|
||||
@TableField(value = "acceptance_criteria" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "acceptance_criteria")
|
||||
private String acceptanceCriteria;
|
||||
@TableField(value = "delivery_requirements" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "delivery_requirements")
|
||||
private String deliveryRequirements;
|
||||
@TableField(value = "storage_conditions" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "storage_conditions")
|
||||
private String storageConditions;
|
||||
@TableField(value = "tax_rate" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "tax_rate")
|
||||
private BigDecimal taxRate;
|
||||
@TableField(value = "tax_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "tax_code")
|
||||
private String taxCode;
|
||||
@TableField("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@TableField("f_flow_id")
|
||||
@JSONField(name = "f_flow_id")
|
||||
private String flowId;
|
||||
@TableField("f_flow_task_id")
|
||||
@JSONField(name = "f_flow_task_id")
|
||||
private String flowTaskId;
|
||||
@TableField("f_delete_mark")
|
||||
@JSONField(name = "f_delete_mark")
|
||||
private Integer deleteMark;
|
||||
@TableField("f_delete_time")
|
||||
@JSONField(name = "f_delete_time")
|
||||
private Date deleteTime;
|
||||
@TableField("f_delete_user_id")
|
||||
@JSONField(name = "f_delete_user_id")
|
||||
private String deleteUserId;
|
||||
@TableField("f_version")
|
||||
@Version
|
||||
@JSONField(name = "f_version")
|
||||
private Integer version;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
* 企业发票抬头
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_company_invoice")
|
||||
public class PanyInvoiceEntity {
|
||||
@TableId(value ="invoice_id" )
|
||||
@JSONField(name = "invoice_id")
|
||||
private String invoiceId;
|
||||
@TableField("company_id")
|
||||
@JSONField(name = "company_id")
|
||||
private String companyId;
|
||||
@TableField(value = "title_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "title_code")
|
||||
private String titleCode;
|
||||
@TableField(value = "title_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "title_name")
|
||||
private String titleName;
|
||||
@TableField(value = "credit_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "credit_code")
|
||||
private String creditCode;
|
||||
@TableField(value = "tax_type" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "tax_type")
|
||||
private String taxType;
|
||||
@TableField(value = "address" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "address")
|
||||
private String address;
|
||||
@TableField(value = "phone" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "phone")
|
||||
private String phone;
|
||||
@TableField(value = "bank_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "bank_name")
|
||||
private String bankName;
|
||||
@TableField(value = "bank_account" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "bank_account")
|
||||
private String bankAccount;
|
||||
@TableField(value = "is_valid" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "is_valid")
|
||||
private String isValid;
|
||||
@TableField(value = "is_defalut" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "is_defalut")
|
||||
private String isDefalut;
|
||||
@TableField(value = "remark" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@TableField("f_delete_mark")
|
||||
@JSONField(name = "f_delete_mark")
|
||||
private Integer deleteMark;
|
||||
@TableField("f_delete_time")
|
||||
@JSONField(name = "f_delete_time")
|
||||
private Date deleteTime;
|
||||
@TableField("f_delete_user_id")
|
||||
@JSONField(name = "f_delete_user_id")
|
||||
private String deleteUserId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
/**
|
||||
* 商品信息
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_product")
|
||||
public class ProductEntity {
|
||||
@TableId(value ="product_id" )
|
||||
@JSONField(name = "product_id")
|
||||
private String productId;
|
||||
@TableField(value = "product_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "product_code")
|
||||
private String productCode;
|
||||
@TableField(value = "product_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "product_name")
|
||||
private String productName;
|
||||
@TableField(value = "short_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "short_name")
|
||||
private String shortName;
|
||||
@TableField(value = "product_type" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "product_type")
|
||||
private String productType;
|
||||
@TableField(value = "product_category" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "product_category")
|
||||
private String productCategory;
|
||||
@TableField(value = "brand" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "brand")
|
||||
private String brand;
|
||||
@TableField(value = "product_model" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "product_model")
|
||||
private String productModel;
|
||||
@TableField(value = "color" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "color")
|
||||
private String color;
|
||||
@TableField(value = "product_size" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "product_size")
|
||||
private String productSize;
|
||||
@TableField(value = "weight" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "weight")
|
||||
private BigDecimal weight;
|
||||
@TableField(value = "unit_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "unit_name")
|
||||
private String unitName;
|
||||
@TableField(value = "min_order_quantity" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "min_order_quantity")
|
||||
private BigDecimal minOrderQuantity;
|
||||
@TableField(value = "standard_sales_price" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "standard_sales_price")
|
||||
private BigDecimal standardSalesPrice;
|
||||
@TableField(value = "gross_weight" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "gross_weight")
|
||||
private BigDecimal grossWeight;
|
||||
@TableField(value = "net_weight" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "net_weight")
|
||||
private BigDecimal netWeight;
|
||||
@TableField(value = "packagesize" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "packagesize")
|
||||
private String packagesize;
|
||||
@TableField(value = "cost_price" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "cost_price")
|
||||
private BigDecimal costPrice;
|
||||
@TableField(value = "tax_rate" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "tax_rate")
|
||||
private BigDecimal taxRate;
|
||||
@TableField(value = "tax_code" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "tax_code")
|
||||
private String taxCode;
|
||||
@TableField(value = "warranty_period" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "warranty_period")
|
||||
private Integer warrantyPeriod;
|
||||
@TableField(value = "warranty_terms" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "warranty_terms")
|
||||
private String warrantyTerms;
|
||||
@TableField(value = "remark" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
@TableField("f_flow_id")
|
||||
@JSONField(name = "f_flow_id")
|
||||
private String flowId;
|
||||
@TableField("f_flow_task_id")
|
||||
@JSONField(name = "f_flow_task_id")
|
||||
private String flowTaskId;
|
||||
@TableField("f_delete_mark")
|
||||
@JSONField(name = "f_delete_mark")
|
||||
private Integer deleteMark;
|
||||
@TableField("f_delete_time")
|
||||
@JSONField(name = "f_delete_time")
|
||||
private Date deleteTime;
|
||||
@TableField("f_delete_user_id")
|
||||
@JSONField(name = "f_delete_user_id")
|
||||
private String deleteUserId;
|
||||
@TableField("f_version")
|
||||
@Version
|
||||
@JSONField(name = "f_version")
|
||||
private Integer version;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.yunzhupaas.mdm.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
* 供应商
|
||||
*
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_supplier")
|
||||
public class SupplierEntity {
|
||||
@TableId(value ="supplier_id" )
|
||||
@JSONField(name = "supplier_id")
|
||||
private String supplierId;
|
||||
@TableField("company_id")
|
||||
@JSONField(name = "company_id")
|
||||
private String companyId;
|
||||
@TableField(value = "major_person_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "major_person_id")
|
||||
private String majorPersonId;
|
||||
@TableField(value = "supplier_level" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "supplier_level")
|
||||
private String supplierLevel;
|
||||
@TableField(value = "supplier_type" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "supplier_type")
|
||||
private String supplierType;
|
||||
@TableField(value = "supplier_category" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "supplier_category")
|
||||
private String supplierCategory;
|
||||
@TableField(value = "honor" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "honor")
|
||||
private String honor;
|
||||
@TableField(value = "achievement" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "achievement")
|
||||
private String achievement;
|
||||
@TableField(value = "finish_project" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "finish_project")
|
||||
private String finishProject;
|
||||
@TableField("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@TableField("create_by")
|
||||
@JSONField(name = "create_by")
|
||||
private String createBy;
|
||||
@TableField("create_time")
|
||||
@JSONField(name = "create_time")
|
||||
private Date createTime;
|
||||
@TableField("update_by")
|
||||
@JSONField(name = "update_by")
|
||||
private String updateBy;
|
||||
@TableField("update_time")
|
||||
@JSONField(name = "update_time")
|
||||
private Date updateTime;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,20 +1,20 @@
|
||||
|
||||
|
||||
package com.yunzhupaas.base.model.mdmcompany;
|
||||
package com.yunzhupaas.mdm.model.asset;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
*
|
||||
* mdm_company
|
||||
* 资产信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-27
|
||||
* @日期: 2026-04-28
|
||||
*/
|
||||
@Data
|
||||
public class MdmCompanyExcelErrorVO extends MdmCompanyExcelVO{
|
||||
public class AssetExcelErrorVO extends AssetExcelVO{
|
||||
|
||||
@Excel(name = "异常原因",orderNum = "-999")
|
||||
@JSONField(name = "errorsInfo")
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.yunzhupaas.mdm.model.asset;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* 资产信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-28
|
||||
*/
|
||||
@Data
|
||||
public class AssetExcelVO{
|
||||
/** 资产名称 **/
|
||||
@JSONField(name = "asset_name")
|
||||
@Excel(name = "资产名称(asset_name)",orderNum = "1", isImportField = "true" )
|
||||
private String asset_name;
|
||||
|
||||
/** 资产类型 **/
|
||||
@JSONField(name = "asset_type")
|
||||
@Excel(name = "资产类型(asset_type)",orderNum = "1", isImportField = "true" )
|
||||
private String asset_type;
|
||||
|
||||
/** 资产分类 **/
|
||||
@JSONField(name = "asset_category")
|
||||
@Excel(name = "资产分类(asset_category)",orderNum = "1", isImportField = "true" )
|
||||
private String asset_category;
|
||||
|
||||
/** 资产状态 **/
|
||||
@JSONField(name = "asset_status")
|
||||
@Excel(name = "资产状态(asset_status)",orderNum = "1", isImportField = "true" )
|
||||
private String asset_status;
|
||||
|
||||
/** 资产权属 **/
|
||||
@JSONField(name = "asset_ownership")
|
||||
@Excel(name = "资产权属(asset_ownership)",orderNum = "1", isImportField = "true" )
|
||||
private String asset_ownership;
|
||||
|
||||
/** 资产位置 **/
|
||||
@JSONField(name = "asset_location")
|
||||
@Excel(name = "资产位置(asset_location)",orderNum = "1", isImportField = "true" )
|
||||
private String asset_location;
|
||||
|
||||
/** 使用组织 **/
|
||||
@JSONField(name = "current_org_id")
|
||||
@Excel(name = "使用组织(current_org_id)",orderNum = "1", isImportField = "true" )
|
||||
private String current_org_id;
|
||||
|
||||
/** 单位 **/
|
||||
@JSONField(name = "measurement_unit")
|
||||
@Excel(name = "单位(measurement_unit)",orderNum = "1", isImportField = "true" )
|
||||
private String measurement_unit;
|
||||
|
||||
/** 启用日期 **/
|
||||
@JSONField(name = "commissioning_date")
|
||||
@Excel(name = "启用日期(commissioning_date)",orderNum = "1", isImportField = "true" )
|
||||
private String commissioning_date;
|
||||
|
||||
/** 购置日期 **/
|
||||
@JSONField(name = "purchase_date")
|
||||
@Excel(name = "购置日期(purchase_date)",orderNum = "1", isImportField = "true" )
|
||||
private String purchase_date;
|
||||
|
||||
/** 备注 **/
|
||||
@JSONField(name = "remark")
|
||||
@Excel(name = "备注(remark)",orderNum = "1", isImportField = "true" )
|
||||
private String remark;
|
||||
|
||||
/** 预计使用年限 **/
|
||||
@JSONField(name = "expected_life")
|
||||
@Excel(name = "预计使用年限(expected_life)",orderNum = "1", isImportField = "true" )
|
||||
private String expected_life;
|
||||
|
||||
/** 数量 **/
|
||||
@JSONField(name = "quantity")
|
||||
@Excel(name = "数量(quantity)",orderNum = "1", isImportField = "true" )
|
||||
private String quantity;
|
||||
|
||||
/** 保管用户 **/
|
||||
@JSONField(name = "current_user_id")
|
||||
@Excel(name = "保管用户(current_user_id)",orderNum = "1", isImportField = "true" )
|
||||
private String current_user_id;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.yunzhupaas.mdm.model.asset;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 资产信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-28
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "表单参数")
|
||||
public class AssetForm {
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
@JSONField(name = "asset_id")
|
||||
private String assetId;
|
||||
|
||||
|
||||
/** 资产编码 **/
|
||||
@Schema(description = "资产编码")
|
||||
@JsonProperty("asset_code")
|
||||
@JSONField(name = "asset_code")
|
||||
private String assetCode;
|
||||
/** 资产名称 **/
|
||||
@Schema(description = "资产名称")
|
||||
@JsonProperty("asset_name")
|
||||
@JSONField(name = "asset_name")
|
||||
private String assetName;
|
||||
/** 资产类型 **/
|
||||
@Schema(description = "资产类型")
|
||||
@JsonProperty("asset_type")
|
||||
@JSONField(name = "asset_type")
|
||||
private Object assetType;
|
||||
/** 资产分类 **/
|
||||
@Schema(description = "资产分类")
|
||||
@JsonProperty("asset_category")
|
||||
@JSONField(name = "asset_category")
|
||||
private Object assetCategory;
|
||||
/** 资产状态 **/
|
||||
@Schema(description = "资产状态")
|
||||
@JsonProperty("asset_status")
|
||||
@JSONField(name = "asset_status")
|
||||
private Object assetStatus;
|
||||
/** 资产位置 **/
|
||||
@Schema(description = "资产位置")
|
||||
@JsonProperty("asset_location")
|
||||
@JSONField(name = "asset_location")
|
||||
private Object assetLocation;
|
||||
/** 使用组织 **/
|
||||
@Schema(description = "使用组织")
|
||||
@JsonProperty("current_org_id")
|
||||
@JSONField(name = "current_org_id")
|
||||
private Object currentOrgId;
|
||||
/** 保管用户 **/
|
||||
@Schema(description = "保管用户")
|
||||
@JsonProperty("current_user_id")
|
||||
@JSONField(name = "current_user_id")
|
||||
private Object currentUserId;
|
||||
/** 资产权属 **/
|
||||
@Schema(description = "资产权属")
|
||||
@JsonProperty("asset_ownership")
|
||||
@JSONField(name = "asset_ownership")
|
||||
private Object assetOwnership;
|
||||
/** 单位 **/
|
||||
@Schema(description = "单位")
|
||||
@JsonProperty("measurement_unit")
|
||||
@JSONField(name = "measurement_unit")
|
||||
private String measurementUnit;
|
||||
/** 数量 **/
|
||||
@Schema(description = "数量")
|
||||
@JsonProperty("quantity")
|
||||
@JSONField(name = "quantity")
|
||||
private BigDecimal quantity;
|
||||
/** 购置日期 **/
|
||||
@Schema(description = "购置日期")
|
||||
@JsonProperty("purchase_date")
|
||||
@JSONField(name = "purchase_date")
|
||||
private String purchaseDate;
|
||||
/** 启用日期 **/
|
||||
@Schema(description = "启用日期")
|
||||
@JsonProperty("commissioning_date")
|
||||
@JSONField(name = "commissioning_date")
|
||||
private String commissioningDate;
|
||||
/** 预计使用年限 **/
|
||||
@Schema(description = "预计使用年限")
|
||||
@JsonProperty("expected_life")
|
||||
@JSONField(name = "expected_life")
|
||||
private BigDecimal expectedLife;
|
||||
/** 供应商 **/
|
||||
@Schema(description = "供应商")
|
||||
@JsonProperty("supplier_id")
|
||||
@JSONField(name = "supplier_id")
|
||||
private String supplierId;
|
||||
/** 备注 **/
|
||||
@Schema(description = "备注")
|
||||
@JsonProperty("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.yunzhupaas.mdm.model.asset;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import com.yunzhupaas.base.Pagination;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 资产信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-28
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "列表查询参数")
|
||||
public class AssetPagination extends Pagination {
|
||||
/** 关键词搜索 */
|
||||
@Schema(description = "关键词搜索")
|
||||
private String yunzhupaasKeyword;
|
||||
/** 查询key */
|
||||
@Schema(description = "查询key")
|
||||
private String[] selectKey;
|
||||
/** 选中数据数组id */
|
||||
@Schema(description = "选中数据数组id")
|
||||
private Object[] selectIds;
|
||||
/** json */
|
||||
@Schema(description = "json")
|
||||
private String json;
|
||||
/** 数据类型 0-当前页,1-全部数据 */
|
||||
@Schema(description = "数据类型 0-当前页,1-全部数据")
|
||||
private String dataType;
|
||||
/** 高级查询 */
|
||||
@Schema(description = "高级查询")
|
||||
private String superQueryJson;
|
||||
/** 功能id */
|
||||
@Schema(description = "功能id")
|
||||
private String moduleId;
|
||||
/** 菜单id */
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
/** 资产编码 */
|
||||
@Schema(description = "资产编码")
|
||||
@JsonProperty("asset_code")
|
||||
@JSONField(name = "assetCode")
|
||||
private Object assetCode;
|
||||
/** 资产名称 */
|
||||
@Schema(description = "资产名称")
|
||||
@JsonProperty("asset_name")
|
||||
@JSONField(name = "assetName")
|
||||
private Object assetName;
|
||||
/** 资产状态 */
|
||||
@Schema(description = "资产状态")
|
||||
@JsonProperty("asset_status")
|
||||
@JSONField(name = "assetStatus")
|
||||
private Object assetStatus;
|
||||
/** 购置日期 */
|
||||
@Schema(description = "购置日期")
|
||||
@JsonProperty("purchase_date")
|
||||
@JSONField(name = "purchaseDate")
|
||||
private Object purchaseDate;
|
||||
/** 启用日期 */
|
||||
@Schema(description = "启用日期")
|
||||
@JsonProperty("commissioning_date")
|
||||
@JSONField(name = "commissioningDate")
|
||||
private Object commissioningDate;
|
||||
/** 标签面板字段 */
|
||||
@Schema(description = "标签面板字段")
|
||||
@JsonProperty("asset_type")
|
||||
@JSONField(name = "assetType")
|
||||
private Object assetType;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,20 +1,20 @@
|
||||
|
||||
|
||||
package com.yunzhupaas.base.model.mdmproject;
|
||||
package com.yunzhupaas.mdm.model.company;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
*
|
||||
* 项目结构
|
||||
* 企业信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
public class MdmProjectExcelErrorVO extends MdmProjectExcelVO{
|
||||
public class CompanyExcelErrorVO extends CompanyExcelVO{
|
||||
|
||||
@Excel(name = "异常原因",orderNum = "-999")
|
||||
@JSONField(name = "errorsInfo")
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yunzhupaas.mdm.model.company;
|
||||
|
||||
import com.yunzhupaas.mdm.model.companyBank.CompanyBankExcelVO;
|
||||
import com.yunzhupaas.mdm.model.companyInvoice.CompanyInvoiceExcelVO;
|
||||
import lombok.Data;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* 企业信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
public class CompanyExcelVO{
|
||||
/** 企业名称 **/
|
||||
@JSONField(name = "company_name")
|
||||
@Excel(name = "企业名称(company_name)",orderNum = "1", isImportField = "true" )
|
||||
private String company_name;
|
||||
|
||||
/** 社会信用代码 **/
|
||||
@JSONField(name = "credit_code")
|
||||
@Excel(name = "社会信用代码(credit_code)",orderNum = "1", isImportField = "true" )
|
||||
private String credit_code;
|
||||
|
||||
/** 归属组织 **/
|
||||
@JSONField(name = "org_id")
|
||||
@Excel(name = "归属组织(org_id)",orderNum = "1", isImportField = "true" )
|
||||
private String org_id;
|
||||
|
||||
/** 企业编码 **/
|
||||
@JSONField(name = "company_code")
|
||||
@Excel(name = "企业编码(company_code)",orderNum = "1", isImportField = "true" )
|
||||
private String company_code;
|
||||
|
||||
/** 简称/昵称 **/
|
||||
@JSONField(name = "short_name")
|
||||
@Excel(name = "简称/昵称(short_name)",orderNum = "1", isImportField = "true" )
|
||||
private String short_name;
|
||||
|
||||
/** 类型 **/
|
||||
@JSONField(name = "entity_type")
|
||||
@Excel(name = "类型(entity_type)",orderNum = "1", isImportField = "true" )
|
||||
private String entity_type;
|
||||
|
||||
/** 纳税人类别 **/
|
||||
@JSONField(name = "tax_type")
|
||||
@Excel(name = "纳税人类别(tax_type)",orderNum = "1", isImportField = "true" )
|
||||
private String tax_type;
|
||||
|
||||
/** 企业规模 **/
|
||||
@JSONField(name = "enterprise_scale")
|
||||
@Excel(name = "企业规模(enterprise_scale)",orderNum = "1", isImportField = "true" )
|
||||
private String enterprise_scale;
|
||||
|
||||
/** 企业类型 **/
|
||||
@JSONField(name = "enterprise_nature")
|
||||
@Excel(name = "企业类型(enterprise_nature)",orderNum = "1", isImportField = "true" )
|
||||
private String enterprise_nature;
|
||||
|
||||
/** 行业代码 **/
|
||||
@JSONField(name = "industry_code")
|
||||
@Excel(name = "行业代码(industry_code)",orderNum = "1", isImportField = "true" )
|
||||
private String industry_code;
|
||||
|
||||
/** 成立日期 **/
|
||||
@JSONField(name = "registration_date")
|
||||
@Excel(name = "成立日期(registration_date)",orderNum = "1", isImportField = "true" )
|
||||
private String registration_date;
|
||||
|
||||
/** 注册资本 **/
|
||||
@JSONField(name = "registered_capital")
|
||||
@Excel(name = "注册资本(registered_capital)",orderNum = "1", isImportField = "true" )
|
||||
private String registered_capital;
|
||||
|
||||
/** 法定代表人 **/
|
||||
@JSONField(name = "legal_representative")
|
||||
@Excel(name = "法定代表人(legal_representative)",orderNum = "1", isImportField = "true" )
|
||||
private String legal_representative;
|
||||
|
||||
/** 联系电话 **/
|
||||
@JSONField(name = "phone")
|
||||
@Excel(name = "联系电话(phone)",orderNum = "1", isImportField = "true" )
|
||||
private String phone;
|
||||
|
||||
/** 邮箱 **/
|
||||
@JSONField(name = "email")
|
||||
@Excel(name = "邮箱(email)",orderNum = "1", isImportField = "true" )
|
||||
private String email;
|
||||
|
||||
/** 网站 **/
|
||||
@JSONField(name = "website")
|
||||
@Excel(name = "网站(website)",orderNum = "1", isImportField = "true" )
|
||||
private String website;
|
||||
|
||||
/** 地址 **/
|
||||
@JSONField(name = "address")
|
||||
@Excel(name = "地址(address)",orderNum = "1", isImportField = "true" )
|
||||
private String address;
|
||||
|
||||
/** 所属地区 **/
|
||||
@JSONField(name = "province_id")
|
||||
@Excel(name = "所属地区(province_id)",orderNum = "1", isImportField = "true" )
|
||||
private String province_id;
|
||||
|
||||
/** 经营范围 **/
|
||||
@JSONField(name = "business_scope")
|
||||
@Excel(name = "经营范围(business_scope)",orderNum = "1", isImportField = "true" )
|
||||
private String business_scope;
|
||||
|
||||
/** 备注 **/
|
||||
@JSONField(name = "remark")
|
||||
@Excel(name = "备注(remark)",orderNum = "1", isImportField = "true" )
|
||||
private String remark;
|
||||
|
||||
@JsonProperty("tableFieldad9d92")
|
||||
@ExcelCollection(name="设计子表(tableFieldad9d92)",orderNum = "5")
|
||||
private List<CompanyBankExcelVO> tableFieldad9d92;
|
||||
|
||||
@JsonProperty("tableField46dc53")
|
||||
@ExcelCollection(name="设计子表(tableField46dc53)",orderNum = "10")
|
||||
private List<CompanyInvoiceExcelVO> tableField46dc53;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yunzhupaas.base.model.mdmcompany;
|
||||
package com.yunzhupaas.mdm.model.company;
|
||||
|
||||
import com.yunzhupaas.base.model.crmCustomer.CrmCustomerModel;
|
||||
import com.yunzhupaas.mdm.model.companyBank.CompanyBankModel;
|
||||
import com.yunzhupaas.mdm.model.companyInvoice.CompanyInvoiceModel;
|
||||
import lombok.Data;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
@@ -9,25 +10,20 @@ import com.alibaba.fastjson.annotation.JSONField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* mdm_company
|
||||
* 企业信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-27
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "表单参数")
|
||||
public class MdmCompanyForm {
|
||||
public class CompanyForm {
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
@JSONField(name = "company_id")
|
||||
private String companyId;
|
||||
|
||||
/** 乐观锁 **/
|
||||
@Schema(description = "乐观锁")
|
||||
@JsonProperty("f_version")
|
||||
@JSONField(name = "f_version")
|
||||
private Integer version;
|
||||
|
||||
/** 企业编码 **/
|
||||
@Schema(description = "企业编码")
|
||||
@@ -54,11 +50,16 @@ public class MdmCompanyForm {
|
||||
@JsonProperty("credit_code")
|
||||
@JSONField(name = "credit_code")
|
||||
private String creditCode;
|
||||
/** 企业范围 **/
|
||||
@Schema(description = "企业范围")
|
||||
@JsonProperty("company_scope")
|
||||
@JSONField(name = "company_scope")
|
||||
private Object companyScope;
|
||||
/** 归属组织 **/
|
||||
@Schema(description = "归属组织")
|
||||
@JsonProperty("org_id")
|
||||
@JSONField(name = "org_id")
|
||||
private Object orgId;
|
||||
/** 所属地区 **/
|
||||
@Schema(description = "所属地区")
|
||||
@JsonProperty("province_id")
|
||||
@JSONField(name = "province_id")
|
||||
private Object provinceId;
|
||||
/** 纳税人类别 **/
|
||||
@Schema(description = "纳税人类别")
|
||||
@JsonProperty("tax_type")
|
||||
@@ -114,11 +115,6 @@ public class MdmCompanyForm {
|
||||
@JsonProperty("address")
|
||||
@JSONField(name = "address")
|
||||
private String address;
|
||||
/** 所属地区 **/
|
||||
@Schema(description = "所属地区")
|
||||
@JsonProperty("province_id")
|
||||
@JSONField(name = "province_id")
|
||||
private Object provinceId;
|
||||
/** 经营范围 **/
|
||||
@Schema(description = "经营范围")
|
||||
@JsonProperty("business_scope")
|
||||
@@ -130,42 +126,12 @@ public class MdmCompanyForm {
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
|
||||
/** 客户负责人 **/
|
||||
@Schema(description = "客户负责人")
|
||||
@JsonProperty("owner_id")
|
||||
@JSONField(name = "owner_id")
|
||||
private Object ownerId;
|
||||
/** 归属组织 **/
|
||||
@Schema(description = "归属组织")
|
||||
@JsonProperty("org_id")
|
||||
@JSONField(name = "org_id")
|
||||
private Object orgId;
|
||||
/** 客户等级 **/
|
||||
@Schema(description = "客户等级")
|
||||
@JsonProperty("customer_level")
|
||||
@JSONField(name = "customer_level")
|
||||
private Object customerLevel;
|
||||
/** 生命周期阶段 **/
|
||||
@Schema(description = "生命周期阶段")
|
||||
@JsonProperty("customer_lifecycle")
|
||||
@JSONField(name = "customer_lifecycle")
|
||||
private Object customerLifecycle;
|
||||
/** 是否公海客户 **/
|
||||
@Schema(description = "是否公海客户")
|
||||
@JsonProperty("is_public")
|
||||
@JSONField(name = "is_public")
|
||||
private Object isPublic;
|
||||
/** 最后一次跟进日期 **/
|
||||
@Schema(description = "最后一次跟进日期")
|
||||
@JsonProperty("last_followup_date")
|
||||
@JSONField(name = "last_followup_date")
|
||||
private Long lastFollowupDate;
|
||||
/** 子表数据 **/
|
||||
@Schema(description = "mdmCompanyContact子表数据")
|
||||
@JsonProperty("mdmCompanyContactList")
|
||||
private List<MdmCompanyContactModel> mdmCompanyContactList;
|
||||
/** 子表数据 **/
|
||||
@Schema(description = "mdmCompanyBank子表数据")
|
||||
@JsonProperty("mdmCompanyBankList")
|
||||
private List<MdmCompanyBankModel> mdmCompanyBankList;
|
||||
private List<CompanyBankModel> mdmCompanyBankList;
|
||||
/** 子表数据 **/
|
||||
@Schema(description = "companyInvoice子表数据")
|
||||
@JsonProperty("companyInvoiceList")
|
||||
private List<CompanyInvoiceModel> companyInvoiceList;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yunzhupaas.base.model.mdmcompany;
|
||||
package com.yunzhupaas.mdm.model.company;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@@ -9,15 +9,15 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* mdm_company
|
||||
* 企业信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-27
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "列表查询参数")
|
||||
public class MdmCompanyPagination extends Pagination {
|
||||
public class CompanyPagination extends Pagination {
|
||||
/** 关键词搜索 */
|
||||
@Schema(description = "关键词搜索")
|
||||
private String yunzhupaasKeyword;
|
||||
@@ -47,9 +47,9 @@ public class MdmCompanyPagination extends Pagination {
|
||||
@JsonProperty("company_name")
|
||||
@JSONField(name = "companyName")
|
||||
private Object companyName;
|
||||
/** 类型 */
|
||||
@Schema(description = "类型")
|
||||
@JsonProperty("entity_type")
|
||||
@JSONField(name = "entityType")
|
||||
private Object entityType;
|
||||
/** 归属组织 */
|
||||
@Schema(description = "归属组织")
|
||||
@JsonProperty("org_id")
|
||||
@JSONField(name = "orgId")
|
||||
private Object orgId;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.yunzhupaas.mdm.model.companyBank;
|
||||
|
||||
import lombok.Data;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
*
|
||||
* 法人公司
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
public class CompanyBankExcelVO{
|
||||
/** 开户行 **/
|
||||
@JSONField(name = "bank_name")
|
||||
@Excel(name = "开户行(bank_name)",orderNum = "1", isImportField = "true" )
|
||||
private String bank_name;
|
||||
|
||||
/** 账户名 **/
|
||||
@JSONField(name = "bank_account_name")
|
||||
@Excel(name = "账户名(bank_account_name)",orderNum = "1", isImportField = "true" )
|
||||
private String bank_account_name;
|
||||
|
||||
/** 银行账号 **/
|
||||
@JSONField(name = "bank_account_number")
|
||||
@Excel(name = "银行账号(bank_account_number)",orderNum = "1", isImportField = "true" )
|
||||
private String bank_account_number;
|
||||
|
||||
/** 开户行城市 **/
|
||||
@JSONField(name = "bank_province")
|
||||
@Excel(name = "开户行城市(bank_province)",orderNum = "1", isImportField = "true" )
|
||||
private String bank_province;
|
||||
|
||||
/** 备注 **/
|
||||
@JSONField(name = "remark")
|
||||
@Excel(name = "备注(remark)",orderNum = "1", isImportField = "true" )
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.yunzhupaas.base.model.mdmcompany;
|
||||
package com.yunzhupaas.mdm.model.companyBank;
|
||||
|
||||
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;
|
||||
@@ -11,42 +8,47 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
*
|
||||
* mdm_company
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-03-27
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "MdmCompanyBank子表参数")
|
||||
public class MdmCompanyBankModel {
|
||||
@Schema(description = "CompanyBank子表参数")
|
||||
public class CompanyBankModel {
|
||||
|
||||
/** 子表:MdmCompanyBank 主键:bank_id **/
|
||||
/** 子表:CompanyBank 主键:bank_id **/
|
||||
@Schema(description = "主键")
|
||||
@JsonProperty("bank_id")
|
||||
private String bank_id;
|
||||
/** 银行账号 **/
|
||||
@Schema(description = "银行账号")
|
||||
@JsonProperty("bank_account_number")
|
||||
@JSONField(name = "bank_account_number")
|
||||
private String bankAccountNumber;
|
||||
/** 开户行 **/
|
||||
@Schema(description = "开户行")
|
||||
@Excel(name = "开户行",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("bank_name")
|
||||
@JSONField(name = "bank_name")
|
||||
private String bankName;
|
||||
/** 账户名 **/
|
||||
@Schema(description = "账户名")
|
||||
@Excel(name = "账户名",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("bank_account_name")
|
||||
@JSONField(name = "bank_account_name")
|
||||
private String bankAccountName;
|
||||
/** 银行账号 **/
|
||||
@Schema(description = "银行账号")
|
||||
@Excel(name = "银行账号",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("bank_account_number")
|
||||
@JSONField(name = "bank_account_number")
|
||||
private String bankAccountNumber;
|
||||
/** 开户行城市 **/
|
||||
@Schema(description = "开户行城市")
|
||||
@Excel(name = "开户行城市",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("bank_province")
|
||||
@JSONField(name = "bank_province")
|
||||
private String bankProvince;
|
||||
/** 备注 **/
|
||||
@Schema(description = "备注")
|
||||
@Excel(name = "备注",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.yunzhupaas.mdm.model.companyInvoice;
|
||||
|
||||
import lombok.Data;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
*
|
||||
* 法人公司
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
public class CompanyInvoiceExcelVO{
|
||||
/** 发票抬头名称 **/
|
||||
@JSONField(name = "title_name")
|
||||
@Excel(name = "发票抬头名称(title_name)",orderNum = "1", isImportField = "true" )
|
||||
private String title_name;
|
||||
|
||||
/** 纳税人识别号 **/
|
||||
@JSONField(name = "credit_code")
|
||||
@Excel(name = "纳税人识别号(credit_code)",orderNum = "1", isImportField = "true" )
|
||||
private String credit_code;
|
||||
|
||||
/** 纳税人类别 **/
|
||||
@JSONField(name = "tax_type")
|
||||
@Excel(name = "纳税人类别(tax_type)",orderNum = "1", isImportField = "true" )
|
||||
private String tax_type;
|
||||
|
||||
/** 地址 **/
|
||||
@JSONField(name = "address")
|
||||
@Excel(name = "地址(address)",orderNum = "1", isImportField = "true" )
|
||||
private String address;
|
||||
|
||||
/** 电话 **/
|
||||
@JSONField(name = "phone")
|
||||
@Excel(name = "电话(phone)",orderNum = "1", isImportField = "true" )
|
||||
private String phone;
|
||||
|
||||
/** 开户银行 **/
|
||||
@JSONField(name = "bank_name")
|
||||
@Excel(name = "开户银行(bank_name)",orderNum = "1", isImportField = "true" )
|
||||
private String bank_name;
|
||||
|
||||
/** 银行账户 **/
|
||||
@JSONField(name = "bank_account")
|
||||
@Excel(name = "银行账户(bank_account)",orderNum = "1", isImportField = "true" )
|
||||
private String bank_account;
|
||||
|
||||
/** 是否默认抬头 **/
|
||||
@JSONField(name = "is_defalut")
|
||||
@Excel(name = "是否默认抬头(is_defalut)",orderNum = "1", isImportField = "true" )
|
||||
private String is_defalut;
|
||||
|
||||
/** 是否有效 **/
|
||||
@JSONField(name = "is_valid")
|
||||
@Excel(name = "是否有效(is_valid)",orderNum = "1", isImportField = "true" )
|
||||
private String is_valid;
|
||||
|
||||
/** 备注 **/
|
||||
@JSONField(name = "remark")
|
||||
@Excel(name = "备注(remark)",orderNum = "1", isImportField = "true" )
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.yunzhupaas.mdm.model.companyInvoice;
|
||||
|
||||
import lombok.Data;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
*
|
||||
* 法人公司
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "Company_invoice子表参数")
|
||||
public class CompanyInvoiceModel {
|
||||
|
||||
/** 子表:Company_invoice 主键:invoice_id **/
|
||||
@Schema(description = "主键")
|
||||
@JsonProperty("invoice_id")
|
||||
private String invoice_id;
|
||||
/** 发票抬头编码 **/
|
||||
@Schema(description = "发票抬头编码")
|
||||
@JsonProperty("title_code")
|
||||
@JSONField(name = "title_code")
|
||||
private String titleCode;
|
||||
/** 发票抬头名称 **/
|
||||
@Schema(description = "发票抬头名称")
|
||||
@Excel(name = "发票抬头名称",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("title_name")
|
||||
@JSONField(name = "title_name")
|
||||
private String titleName;
|
||||
/** 纳税人识别号 **/
|
||||
@Schema(description = "纳税人识别号")
|
||||
@Excel(name = "纳税人识别号",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("credit_code")
|
||||
@JSONField(name = "credit_code")
|
||||
private String creditCode;
|
||||
/** 纳税人类别 **/
|
||||
@Schema(description = "纳税人类别")
|
||||
@Excel(name = "纳税人类别",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("tax_type")
|
||||
@JSONField(name = "tax_type")
|
||||
private Object taxType;
|
||||
/** 地址 **/
|
||||
@Schema(description = "地址")
|
||||
@Excel(name = "地址",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("address")
|
||||
@JSONField(name = "address")
|
||||
private String address;
|
||||
/** 电话 **/
|
||||
@Schema(description = "电话")
|
||||
@Excel(name = "电话",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("phone")
|
||||
@JSONField(name = "phone")
|
||||
private String phone;
|
||||
/** 开户银行 **/
|
||||
@Schema(description = "开户银行")
|
||||
@Excel(name = "开户银行",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("bank_name")
|
||||
@JSONField(name = "bank_name")
|
||||
private String bankName;
|
||||
/** 银行账户 **/
|
||||
@Schema(description = "银行账户")
|
||||
@Excel(name = "银行账户",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("bank_account")
|
||||
@JSONField(name = "bank_account")
|
||||
private String bankAccount;
|
||||
/** 是否默认抬头 **/
|
||||
@Schema(description = "是否默认抬头")
|
||||
@Excel(name = "是否默认抬头",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("is_defalut")
|
||||
@JSONField(name = "is_defalut")
|
||||
private String isDefalut;
|
||||
/** 是否有效 **/
|
||||
@Schema(description = "是否有效")
|
||||
@Excel(name = "是否有效",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("is_valid")
|
||||
@JSONField(name = "is_valid")
|
||||
private String isValid;
|
||||
/** 备注 **/
|
||||
@Schema(description = "备注")
|
||||
@Excel(name = "备注",orderNum = "1",isImportField = "true")
|
||||
@JsonProperty("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,20 +1,20 @@
|
||||
|
||||
|
||||
package com.yunzhupaas.base.model.bcmprojecttype;
|
||||
package com.yunzhupaas.mdm.model.custinfo;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
*
|
||||
* 项目类型
|
||||
* 客户信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-03-26
|
||||
* @日期: 2026-04-24
|
||||
*/
|
||||
@Data
|
||||
public class BcmProjectTypeExcelErrorVO extends BcmProjectTypeExcelVO{
|
||||
public class CustinfoExcelErrorVO extends CustinfoExcelVO{
|
||||
|
||||
@Excel(name = "异常原因",orderNum = "-999")
|
||||
@JSONField(name = "errorsInfo")
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user