新增主数据与基本配置部分代码
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.mdm.entity.CrmLeadEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* crm_lead
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-05-18
|
||||
*/
|
||||
public interface CrmLeadMapper extends SuperMapper<CrmLeadEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yunzhupaas.mdm.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.mdm.entity.ProjectsEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
|
||||
/**
|
||||
* 项目信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-05-19
|
||||
*/
|
||||
public interface ProjectsMapper extends SuperMapper<ProjectsEntity> {
|
||||
|
||||
public String getProjettype(String projectstypeId);
|
||||
|
||||
}
|
||||
@@ -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.crmlead.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* crm_lead
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-05-18
|
||||
*/
|
||||
public interface CrmLeadService extends SuperService<CrmLeadEntity> {
|
||||
List<CrmLeadEntity> getList(CrmLeadPagination crmLeadPagination);
|
||||
|
||||
List<CrmLeadEntity> getTypeList(CrmLeadPagination crmLeadPagination,String dataType);
|
||||
|
||||
CrmLeadEntity getInfo(String leadid);
|
||||
|
||||
void delete(CrmLeadEntity entity);
|
||||
|
||||
void create(CrmLeadEntity entity);
|
||||
|
||||
boolean update(String leadid, CrmLeadEntity entity);
|
||||
|
||||
String checkForm(CrmLeadForm form,int i);
|
||||
|
||||
void saveOrUpdate(CrmLeadForm crmLeadForm,String id, boolean isSave) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.yunzhupaas.mdm.service;
|
||||
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.mdm.model.projects.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 项目信息
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-05-19
|
||||
*/
|
||||
public interface ProjectsService extends SuperService<ProjectsEntity> {
|
||||
List<ProjectsEntity> getList(ProjectsPagination projectsPagination);
|
||||
|
||||
List<ProjectsEntity> getTypeList(ProjectsPagination projectsPagination,String dataType);
|
||||
|
||||
ProjectsEntity getInfo(String projectid);
|
||||
|
||||
void delete(ProjectsEntity entity);
|
||||
|
||||
void create(ProjectsEntity entity);
|
||||
|
||||
boolean update(String projectid, ProjectsEntity entity);
|
||||
|
||||
String checkForm(ProjectsForm form,int i);
|
||||
|
||||
void saveOrUpdate(ProjectsForm projectsForm,String id, boolean isSave) throws Exception;
|
||||
/**
|
||||
* 树状列表查询
|
||||
* @return
|
||||
*/
|
||||
|
||||
public List<Map<String, Object>> getTreeList();
|
||||
|
||||
String getProjettype(String projectstypeId);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.CrmLeadMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.mdm.model.crmlead.*;
|
||||
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;
|
||||
/**
|
||||
*
|
||||
* crm_lead
|
||||
* 版本: V5.2.7
|
||||
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* 作者: 深圳市乐程软件有限公司
|
||||
* 日期: 2026-05-18
|
||||
*/
|
||||
@Service
|
||||
public class CrmLeadServiceImpl extends SuperServiceImpl<CrmLeadMapper, CrmLeadEntity> implements CrmLeadService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Override
|
||||
public List<CrmLeadEntity> getList(CrmLeadPagination crmLeadPagination){
|
||||
return getTypeList(crmLeadPagination,crmLeadPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<CrmLeadEntity> getTypeList(CrmLeadPagination crmLeadPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("crm_lead",CrmLeadEntity.class);
|
||||
|
||||
MPJLambdaWrapper<CrmLeadEntity> wrapper = JoinWrappers
|
||||
.lambda("crm_lead",CrmLeadEntity.class)
|
||||
.selectAll(CrmLeadEntity.class);
|
||||
MPJLambdaWrapper<CrmLeadEntity> wrapper2 = JoinWrappers
|
||||
.lambda("crm_lead",CrmLeadEntity.class)
|
||||
.distinct().select(CrmLeadEntity::getLeadId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(CrmLeadConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? CrmLeadConstant.getAppColumnData() : CrmLeadConstant.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(crmLeadPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = true;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(crmLeadPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(crmLeadPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(crmLeadPagination, wrapper, isPc);
|
||||
otherConditions(crmLeadPagination, wrapper2, isPc);
|
||||
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) crmLeadPagination.getCurrentPage(), (int) crmLeadPagination.getPageSize(), true);
|
||||
List<CrmLeadEntity> userIPage = this.selectJoinList(CrmLeadEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getLeadId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(CrmLeadEntity::getLeadId,collect);
|
||||
}
|
||||
List<CrmLeadEntity> result = this.selectJoinList(CrmLeadEntity.class, wrapper);
|
||||
return crmLeadPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<CrmLeadEntity> list = this.selectJoinList(CrmLeadEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(crmLeadPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getLeadId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(CrmLeadPagination crmLeadPagination, MPJLambdaWrapper<CrmLeadEntity> 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(CrmLeadEntity::getDeleteMark);
|
||||
|
||||
//流程数据隔离
|
||||
List<String> flowIds = generaterSwapUtil.getFlowIds(crmLeadPagination.getFlowId());
|
||||
wrapper.in(CrmLeadEntity::getFlowId,flowIds);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(crmLeadPagination.getYunzhupaasKeyword())){
|
||||
if(isPc){
|
||||
wrapper.and(t -> {
|
||||
t.like(CrmLeadEntity::getMobile,crmLeadPagination.getYunzhupaasKeyword()).or();
|
||||
});
|
||||
}
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(crmLeadPagination.getMobile())){
|
||||
String value = crmLeadPagination.getMobile() instanceof List ?
|
||||
JsonUtil.getObjectToString(crmLeadPagination.getMobile()) :
|
||||
String.valueOf(crmLeadPagination.getMobile());
|
||||
wrapper.like(CrmLeadEntity::getMobile,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(crmLeadPagination.getCustomerSource())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] customerSource = JsonUtil.getJsonToBean(crmLeadPagination.getCustomerSource(),String[][].class);
|
||||
for(int i=0;i<customerSource.length;i++){
|
||||
if(customerSource[i].length>0){
|
||||
idList.add(JsonUtil.getObjectToString(Arrays.asList(customerSource[i])));
|
||||
}
|
||||
}
|
||||
}catch (Exception e1){
|
||||
try {
|
||||
List<String> customerSource = JsonUtil.getJsonToList(crmLeadPagination.getCustomerSource(),String.class);
|
||||
if(customerSource.size()>0){
|
||||
idList.addAll(customerSource);
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(crmLeadPagination.getCustomerSource()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(CrmLeadEntity::getCustomerSource, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(crmLeadPagination.getSidx())){
|
||||
wrapper.orderByDesc(CrmLeadEntity::getLeadId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = crmLeadPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
CrmLeadEntity crmLeadEntity = new CrmLeadEntity();
|
||||
String oderTableField = crmLeadEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = crmLeadEntity.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 CrmLeadEntity getInfo(String leadid){
|
||||
MPJLambdaWrapper<CrmLeadEntity> wrapper = JoinWrappers
|
||||
.lambda("crm_lead",CrmLeadEntity.class)
|
||||
.selectAll(CrmLeadEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(CrmLeadEntity::getLeadId, leadid )
|
||||
.or().eq(CrmLeadEntity::getFlowTaskId, leadid)
|
||||
);
|
||||
return this.selectJoinOne(CrmLeadEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(CrmLeadEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String leadid, CrmLeadEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(CrmLeadEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getLeadId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(CrmLeadForm form,int i) {
|
||||
List<String> flowIds = generaterSwapUtil.getFlowIds(form.getFlowId());
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getLeadId()) && !form.getLeadId().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.getLeadId();
|
||||
}
|
||||
//主表字段验证
|
||||
fieldTipName = "线索名称";
|
||||
if(StringUtil.isEmpty(form.getLeadName())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
fieldTipName = "手机号";
|
||||
if(StringUtil.isEmpty(form.getMobile())){
|
||||
return fieldTipName + canNotNull;
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getMobile())){
|
||||
form.setMobile(form.getMobile().trim());
|
||||
QueryWrapper<CrmLeadEntity> mobileWrapper=new QueryWrapper<>();
|
||||
mobileWrapper.lambda().eq(CrmLeadEntity::getMobile,form.getMobile());
|
||||
mobileWrapper.lambda().in(CrmLeadEntity::getFlowId, flowIds);
|
||||
//假删除标志
|
||||
mobileWrapper.lambda().isNull(CrmLeadEntity::getDeleteMark);
|
||||
if (isUp){
|
||||
mobileWrapper.lambda().ne(CrmLeadEntity::getLeadId, id);
|
||||
}
|
||||
if((int) this.count(mobileWrapper)>0){
|
||||
countRecover = fieldTipName + canNotRepeated;
|
||||
}
|
||||
}
|
||||
if(StringUtil.isNotEmpty(form.getMobile())){
|
||||
if(!Pattern.compile("^1[3456789]\\d{9}$").matcher(String.valueOf(form.getMobile())).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 = "备注";
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param crmLeadForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(CrmLeadForm crmLeadForm,String id, boolean isSave) throws Exception{
|
||||
List<Map<String, Object>> formOperates = crmLeadForm.getFormOperates();
|
||||
List<String> hasOperate = new ArrayList<>();
|
||||
boolean noOperate = false;
|
||||
if(CollectionUtils.isNotEmpty(formOperates)){
|
||||
for (Map<String, Object> formOperate : formOperates) {
|
||||
String formOperateId = formOperate.get("id").toString();
|
||||
boolean formOperateWrite = formOperate.get("write") ==null? false : (boolean) formOperate.get("write");
|
||||
if(formOperateWrite){
|
||||
hasOperate.add(formOperateId);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
noOperate = true;
|
||||
}
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
crmLeadForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(CrmLeadConstant.getFormData(),crmLeadForm,CrmLeadConstant.TABLERENAMES),CrmLeadForm.class);
|
||||
CrmLeadEntity entity = JsonUtil.getJsonToBean(crmLeadForm, CrmLeadEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
entity.setFlowId(crmLeadForm.getFlowId());
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setLeadId(mainUuid);
|
||||
entity.setVersion(0);
|
||||
} else {
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
if(!b){
|
||||
throw new DataException("当前表单原数据已被调整,请重新进入该页面编辑并提交数据");
|
||||
}
|
||||
CrmLeadEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
|
||||
package com.yunzhupaas.mdm.service.impl;
|
||||
|
||||
import com.yunzhupaas.mdm.entity.*;
|
||||
import com.yunzhupaas.mdm.mapper.ProjectsMapper;
|
||||
import com.yunzhupaas.mdm.service.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yunzhupaas.mdm.model.projects.*;
|
||||
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-05-19
|
||||
*/
|
||||
@Service
|
||||
public class ProjectsServiceImpl extends SuperServiceImpl<ProjectsMapper, ProjectsEntity> implements ProjectsService{
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
@Autowired
|
||||
private ProjectsMapper projectsMapper;
|
||||
|
||||
@Override
|
||||
public List<ProjectsEntity> getList(ProjectsPagination projectsPagination){
|
||||
return getTypeList(projectsPagination,projectsPagination.getDataType());
|
||||
}
|
||||
/** 列表查询 */
|
||||
@Override
|
||||
public List<ProjectsEntity> getTypeList(ProjectsPagination projectsPagination,String dataType){
|
||||
String userId=userProvider.get().getUserId();
|
||||
Map<String,Class> tableClassMap=new HashMap<>();
|
||||
tableClassMap.put("mdm_project",ProjectsEntity.class);
|
||||
|
||||
MPJLambdaWrapper<ProjectsEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_project",ProjectsEntity.class)
|
||||
.selectAll(ProjectsEntity.class);
|
||||
MPJLambdaWrapper<ProjectsEntity> wrapper2 = JoinWrappers
|
||||
.lambda("mdm_project",ProjectsEntity.class)
|
||||
.distinct().select(ProjectsEntity::getProjectId);
|
||||
|
||||
QueryAllModel queryAllModel = new QueryAllModel();
|
||||
queryAllModel.setWrapper(wrapper);
|
||||
queryAllModel.setClassMap(tableClassMap);
|
||||
queryAllModel.setDbLink(ProjectsConstant.DBLINKID);
|
||||
//数据过滤
|
||||
boolean isPc = ServletUtil.getHeader("yunzhupaas-origin").equals("pc");
|
||||
String columnData = !isPc ? ProjectsConstant.getAppColumnData() : ProjectsConstant.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(projectsPagination.getSuperQueryJson());
|
||||
}
|
||||
//数据权限
|
||||
boolean pcPermission = false;
|
||||
boolean appPermission = false;
|
||||
if (isPc && pcPermission) {
|
||||
queryAllModel.setModuleId(projectsPagination.getMenuId());
|
||||
}
|
||||
if (!isPc && appPermission) {
|
||||
queryAllModel.setModuleId(projectsPagination.getMenuId());
|
||||
}
|
||||
//拼接复杂条件
|
||||
wrapper = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
if(wrapper == null) return new ArrayList<>();
|
||||
queryAllModel.setWrapper(wrapper2);
|
||||
wrapper2 = generaterSwapUtil.getConditionAllTable(queryAllModel);
|
||||
//其他条件拼接
|
||||
otherConditions(projectsPagination, wrapper, isPc);
|
||||
otherConditions(projectsPagination, wrapper2, isPc);
|
||||
|
||||
//分组和树形生成这个代码,pc端返回全部数据 !"2".equals(dataType)导出选中数据
|
||||
if(isPc && !"2".equals(dataType)){
|
||||
dataType = "1";
|
||||
}
|
||||
if("0".equals(dataType)){
|
||||
com.github.pagehelper.Page<Object> objects = PageHelper.startPage((int) projectsPagination.getCurrentPage(), (int) projectsPagination.getPageSize(), true);
|
||||
List<ProjectsEntity> userIPage = this.selectJoinList(ProjectsEntity.class, wrapper2);
|
||||
List<Object> collect = userIPage.stream().map(t -> t.getProjectId()).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
wrapper.in(ProjectsEntity::getProjectId,collect);
|
||||
}
|
||||
List<ProjectsEntity> result = this.selectJoinList(ProjectsEntity.class, wrapper);
|
||||
return projectsPagination.setData(result,objects.getTotal());
|
||||
}else{
|
||||
List<ProjectsEntity> list = this.selectJoinList(ProjectsEntity.class, wrapper);
|
||||
if("2".equals(dataType)){
|
||||
List<Object> selectIds = Arrays.asList(projectsPagination.getSelectIds());
|
||||
return list.stream().filter(t -> selectIds.contains(t.getProjectId())).collect(Collectors.toList());
|
||||
}else{
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他条件拼接
|
||||
*/
|
||||
private void otherConditions(ProjectsPagination projectsPagination, MPJLambdaWrapper<ProjectsEntity> 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(ProjectsEntity::getFlowId);
|
||||
//关键词
|
||||
if(ObjectUtil.isNotEmpty(projectsPagination.getYunzhupaasKeyword())){
|
||||
}
|
||||
//普通查询
|
||||
if(isPc){
|
||||
if(ObjectUtil.isNotEmpty(projectsPagination.getProjectName())){
|
||||
String value = projectsPagination.getProjectName() instanceof List ?
|
||||
JsonUtil.getObjectToString(projectsPagination.getProjectName()) :
|
||||
String.valueOf(projectsPagination.getProjectName());
|
||||
wrapper.like(ProjectsEntity::getProjectName,value);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(projectsPagination.getOrgId())){
|
||||
List<String> idList = new ArrayList<>();
|
||||
try {
|
||||
String[][] orgId = JsonUtil.getJsonToBean(projectsPagination.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(projectsPagination.getOrgId(),String.class);
|
||||
if(orgId.size()>0){
|
||||
idList.add(JsonUtil.getObjectToString(orgId));
|
||||
}
|
||||
}catch (Exception e2){
|
||||
idList.add(String.valueOf(projectsPagination.getOrgId()));
|
||||
}
|
||||
}
|
||||
wrapper.and(t->{
|
||||
idList.forEach(tt->{
|
||||
if(StringUtil.isNotEmpty(tt) && "Microsoft SQL Server".equalsIgnoreCase(databaseName)){
|
||||
tt = tt.replaceFirst("\\[","[[]");
|
||||
}
|
||||
t.like(ProjectsEntity::getOrgId, tt).or();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//排序
|
||||
if(StringUtil.isEmpty(projectsPagination.getSidx())){
|
||||
wrapper.orderByDesc(ProjectsEntity::getProjectId);
|
||||
}else{
|
||||
try {
|
||||
String[] split = projectsPagination.getSidx().split(",");
|
||||
for(String sidx:split){
|
||||
ProjectsEntity projectsEntity = new ProjectsEntity();
|
||||
String oderTableField = projectsEntity.getClass().getAnnotation(TableName.class).value();
|
||||
boolean descFlag = sidx.startsWith("-");
|
||||
String sidxField = descFlag ? sidx.substring(1) : sidx;
|
||||
try{
|
||||
Field declaredField = projectsEntity.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 ProjectsEntity getInfo(String projectid){
|
||||
MPJLambdaWrapper<ProjectsEntity> wrapper = JoinWrappers
|
||||
.lambda("mdm_project",ProjectsEntity.class)
|
||||
.selectAll(ProjectsEntity.class);
|
||||
wrapper.and(
|
||||
t->t.eq(ProjectsEntity::getProjectId, projectid )
|
||||
.or().eq(ProjectsEntity::getFlowTaskId, projectid)
|
||||
);
|
||||
return this.selectJoinOne(ProjectsEntity.class,wrapper);
|
||||
}
|
||||
@Override
|
||||
public void create(ProjectsEntity entity){
|
||||
this.save(entity);
|
||||
}
|
||||
@Override
|
||||
public boolean update(String projectid, ProjectsEntity entity){
|
||||
return this.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void delete(ProjectsEntity entity){
|
||||
if(entity!=null){
|
||||
this.removeById(entity.getProjectId());
|
||||
}
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(ProjectsForm 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 = "项目编码";
|
||||
fieldTipName = "项目名称";
|
||||
fieldTipName = "项目类型";
|
||||
fieldTipName = "归属组织";
|
||||
fieldTipName = "上级项目";
|
||||
fieldTipName = "顺序号";
|
||||
fieldTipName = "备注";
|
||||
return countRecover;
|
||||
}
|
||||
/**
|
||||
* 新增修改数据(事务回滚)
|
||||
* @param id
|
||||
* @param projectsForm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(ProjectsForm projectsForm,String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
projectsForm = JsonUtil.getJsonToBean(
|
||||
generaterSwapUtil.swapDatetime(ProjectsConstant.getFormData(),projectsForm,ProjectsConstant.TABLERENAMES),ProjectsForm.class);
|
||||
ProjectsEntity entity = JsonUtil.getJsonToBean(projectsForm, ProjectsEntity.class);
|
||||
String mainUuid = StringUtil.isEmpty(id) ? RandomUtil.uuId() : id;
|
||||
if(isSave){
|
||||
entity.setFlowTaskId(mainUuid);
|
||||
entity.setProjectId(mainUuid);
|
||||
} else {
|
||||
}
|
||||
boolean b = this.saveOrUpdate(entity);
|
||||
ProjectsEntity info = this.getInfo(mainUuid);
|
||||
if (info == null) throw new RuntimeException(MsgCode.FA001.get());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getTreeList() {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
List<ProjectsEntity> list = projectsMapper.selectList(null);
|
||||
for (ProjectsEntity node : list) {
|
||||
if (node.getPid() == null || node.getPid().isEmpty() || "0".equals(node.getPid())) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("projectId", node.getProjectId());
|
||||
map.put("projectName", node.getProjectName());
|
||||
map.put("children", getChildrenSimple(list, node.getProjectId()));
|
||||
result.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjettype(String projectstypeId) {
|
||||
return projectsMapper.getProjettype(projectstypeId);
|
||||
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getChildrenSimple(List<ProjectsEntity> list, String parentId) {
|
||||
List<Map<String, Object>> children = new ArrayList<>();
|
||||
for (ProjectsEntity node : list) {
|
||||
if (parentId.equals(node.getPid())) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("projectId", node.getProjectId());
|
||||
map.put("projectName", node.getProjectName());
|
||||
map.put("children", getChildrenSimple(list, node.getProjectId()));
|
||||
children.add(map);
|
||||
}
|
||||
}
|
||||
return children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,636 @@
|
||||
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.crmlead.*;
|
||||
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;
|
||||
|
||||
/**
|
||||
* crm_lead
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-05-18
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "crm_lead" , description = "bcm")
|
||||
@RequestMapping("/api/bcm/CrmLead")
|
||||
public class CrmLeadController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private CrmLeadService crmLeadService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param crmLeadPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody CrmLeadPagination crmLeadPagination)throws Exception{
|
||||
List<CrmLeadEntity> list= crmLeadService.getList(crmLeadPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CrmLeadEntity entity : list) {
|
||||
Map<String, Object> crmLeadMap=JsonUtil.entityToMap(entity);
|
||||
crmLeadMap.put("id", crmLeadMap.get("lead_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(crmLeadMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, CrmLeadConstant.getFormData(), CrmLeadConstant.getColumnData(), crmLeadPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
//流程状态添加
|
||||
generaterSwapUtil.getFlowStatus(realList);
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(crmLeadPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param crmLeadForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/{id}")
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@PathVariable("id") String id, @RequestBody @Valid CrmLeadForm crmLeadForm) {
|
||||
String b = crmLeadService.checkForm(crmLeadForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
crmLeadService.saveOrUpdate(crmLeadForm, id ,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 CrmLeadPagination crmLeadPagination) throws IOException {
|
||||
if (StringUtil.isEmpty(crmLeadPagination.getSelectKey())){
|
||||
return ActionResult.fail(MsgCode.IMP011.get());
|
||||
}
|
||||
List<CrmLeadEntity> list= crmLeadService.getList(crmLeadPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (CrmLeadEntity entity : list) {
|
||||
Map<String, Object> crmLeadMap=JsonUtil.entityToMap(entity);
|
||||
crmLeadMap.put("id", crmLeadMap.get("lead_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(crmLeadMap);
|
||||
}
|
||||
//数据转换
|
||||
realList = generaterSwapUtil.swapDataList(realList, CrmLeadConstant.getFormData(), CrmLeadConstant.getColumnData(), crmLeadPagination.getModuleId(),false);
|
||||
String[]keys=!StringUtil.isEmpty(crmLeadPagination.getSelectKey())?crmLeadPagination.getSelectKey():new String[0];
|
||||
UserInfo userInfo=userProvider.get();
|
||||
String menuFullName = generaterSwapUtil.getMenuName(crmLeadPagination.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 "lead_name" :
|
||||
entitys.add(new ExcelExportEntity("线索名称" ,"lead_name"));
|
||||
break;
|
||||
case "mobile" :
|
||||
entitys.add(new ExcelExportEntity("手机号" ,"mobile"));
|
||||
break;
|
||||
case "email" :
|
||||
entitys.add(new ExcelExportEntity("邮箱" ,"email"));
|
||||
break;
|
||||
case "lead_status" :
|
||||
entitys.add(new ExcelExportEntity("状态" ,"lead_status"));
|
||||
break;
|
||||
case "sales_id" :
|
||||
entitys.add(new ExcelExportEntity("销售人员" ,"sales_id"));
|
||||
break;
|
||||
case "customer_source" :
|
||||
entitys.add(new ExcelExportEntity("来源" ,"customer_source"));
|
||||
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(CrmLeadConstant.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(CrmLeadConstant.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("线索名称(lead_name)" ,"lead_name"));
|
||||
selectKeys.add("lead_name");
|
||||
entitys.add(new ExcelExportEntity("手机号(mobile)" ,"mobile"));
|
||||
selectKeys.add("mobile");
|
||||
entitys.add(new ExcelExportEntity("状态(lead_status)" ,"lead_status"));
|
||||
selectKeys.add("lead_status");
|
||||
entitys.add(new ExcelExportEntity("销售人员(sales_id)" ,"sales_id"));
|
||||
selectKeys.add("sales_id");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("来源(customer_source)" ,"customer_source"));
|
||||
selectKeys.add("customer_source");
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(CrmLeadConstant.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(CrmLeadConstant.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(CrmLeadConstant.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("lead_name","线索名称","input"));
|
||||
columns.add(new ExcelImFieldModel("mobile","手机号","input"));
|
||||
columns.add(new ExcelImFieldModel("lead_status","状态","select"));
|
||||
columns.add(new ExcelImFieldModel("sales_id","销售人员","usersSelect"));
|
||||
columns.add(new ExcelImFieldModel("remark","备注","textarea"));
|
||||
columns.add(new ExcelImFieldModel("email","邮箱","input"));
|
||||
columns.add(new ExcelImFieldModel("customer_source","来源","select"));
|
||||
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(CrmLeadConstant.DBLINKID);
|
||||
uniqueModel.setUpdate(Objects.equals("1", "2"));
|
||||
uniqueModel.setFlowId(visualImportModel.getFlowId());
|
||||
Map<String,String> tablefieldkey = new HashMap<>();
|
||||
for(String key:CrmLeadConstant.TABLEFIELDKEY.keySet()){
|
||||
tablefieldkey.put(key,CrmLeadConstant.TABLERENAMES.get(CrmLeadConstant.TABLEFIELDKEY.get(key)));
|
||||
}
|
||||
ExcelImportModel excelImportModel = generaterSwapUtil.importData(CrmLeadConstant.getFormData(),listData,uniqueModel, tablefieldkey,CrmLeadConstant.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,CrmLeadForm.class), true);
|
||||
}else {
|
||||
create(RandomUtil.uuId(), JsonUtil.getJsonToBean(result,CrmLeadForm.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("线索名称(lead_name)" ,"lead_name"));
|
||||
selectKeys.add("lead_name");
|
||||
entitys.add(new ExcelExportEntity("手机号(mobile)" ,"mobile"));
|
||||
selectKeys.add("mobile");
|
||||
entitys.add(new ExcelExportEntity("状态(lead_status)" ,"lead_status"));
|
||||
selectKeys.add("lead_status");
|
||||
entitys.add(new ExcelExportEntity("销售人员(sales_id)" ,"sales_id"));
|
||||
selectKeys.add("sales_id");
|
||||
entitys.add(new ExcelExportEntity("备注(remark)" ,"remark"));
|
||||
selectKeys.add("remark");
|
||||
entitys.add(new ExcelExportEntity("邮箱(email)" ,"email"));
|
||||
selectKeys.add("email");
|
||||
entitys.add(new ExcelExportEntity("来源(customer_source)" ,"customer_source"));
|
||||
selectKeys.add("customer_source");
|
||||
ExcelModel excelModel = generaterSwapUtil.getExcelParams(CrmLeadConstant.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(CrmLeadConstant.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{
|
||||
CrmLeadEntity entity= crmLeadService.getInfo(id);
|
||||
if(entity!=null){
|
||||
if(!forceDel){
|
||||
String errMsg = generaterSwapUtil.deleteFlowTask(entity.getFlowTaskId());
|
||||
if (StringUtil.isNotEmpty(errMsg)) {
|
||||
throw new DataException(errMsg);
|
||||
}
|
||||
}
|
||||
//假删除
|
||||
entity.setDeleteMark(1);
|
||||
entity.setDeleteUserId(userProvider.get().getUserId());
|
||||
entity.setDeleteTime(new Date());
|
||||
crmLeadService.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 crmLeadForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid CrmLeadForm crmLeadForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
CrmLeadEntity entity= crmLeadService.getInfo(id);
|
||||
if(entity!=null){
|
||||
crmLeadForm.setLeadId(String.valueOf(entity.getLeadId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = crmLeadService.checkForm(crmLeadForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
crmLeadService.saveOrUpdate(crmLeadForm,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){
|
||||
CrmLeadEntity entity= crmLeadService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> crmLeadMap=JsonUtil.entityToMap(entity);
|
||||
crmLeadMap.put("id", crmLeadMap.get("lead_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
crmLeadMap = generaterSwapUtil.swapDataDetail(crmLeadMap,CrmLeadConstant.getFormData(),"807145376418105157",isPc?false:false);
|
||||
//子表数据
|
||||
return ActionResult.success(crmLeadMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
CrmLeadEntity entity= crmLeadService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> crmLeadMap=JsonUtil.entityToMap(entity);
|
||||
crmLeadMap.put("id", crmLeadMap.get("lead_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
crmLeadMap = generaterSwapUtil.swapDataForm(crmLeadMap,CrmLeadConstant.getFormData(),CrmLeadConstant.TABLEFIELDKEY,CrmLeadConstant.TABLERENAMES);
|
||||
return ActionResult.success(crmLeadMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
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.projects.*;
|
||||
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.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 项目信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-05-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "项目信息" , description = "2")
|
||||
@RequestMapping("/api/bcm/Projects")
|
||||
public class ProjectsController {
|
||||
|
||||
@Autowired
|
||||
private GeneraterSwapUtil generaterSwapUtil;
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private ProjectsService projectsService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param projectsPagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult list(@RequestBody ProjectsPagination projectsPagination)throws Exception{
|
||||
List<ProjectsEntity> list= projectsService.getList(projectsPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (ProjectsEntity entity : list) {
|
||||
Map<String, Object> projectsMap=JsonUtil.entityToMap(entity);
|
||||
projectsMap.put("id", projectsMap.get("project_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
realList.add(projectsMap);
|
||||
}
|
||||
//数据转换
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
realList = generaterSwapUtil.swapDataList(realList, ProjectsConstant.getFormData(), ProjectsConstant.getColumnData(), projectsPagination.getModuleId(),isPc?false:false);
|
||||
|
||||
if(isPc){
|
||||
//分组和树形的树形数据转换
|
||||
realList = generaterSwapUtil.swapDataList(realList, ProjectsConstant.getColumnData(), "project_id");
|
||||
}
|
||||
for (Map<String, Object> map : realList) {
|
||||
Object object = map.get("children");
|
||||
if (ObjectUtil.isNotNull(object) && object instanceof List) {
|
||||
// ✅ 直接转换为原对象,不创建新对象
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> children = (List<Map<String, Object>>) object;
|
||||
for (Map<String, Object> child : children) {
|
||||
Object pidIdObj = child.get("pid_id");
|
||||
if (pidIdObj != null && !"".equals(pidIdObj.toString())) {
|
||||
ProjectsEntity entity = projectsService.getInfo(pidIdObj.toString());
|
||||
if (ObjectUtil.isNotNull(child.get("project_type_id_yunzhupaasId"))) {
|
||||
String projecttypeNme=projectsService.getProjettype(child.get("project_type_id_yunzhupaasId").toString());
|
||||
child.put("project_type_id", projecttypeNme);
|
||||
}
|
||||
if (entity != null) {
|
||||
child.put("pid", entity.getProjectName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(projectsPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param projectsForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid ProjectsForm projectsForm) throws Exception {
|
||||
String b = projectsService.checkForm(projectsForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
projectsService.saveOrUpdate(projectsForm, null ,true);
|
||||
}catch(Exception 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{
|
||||
ProjectsEntity entity= projectsService.getInfo(id);
|
||||
if(entity!=null){
|
||||
//主表数据删除
|
||||
projectsService.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 projectsForm
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid ProjectsForm projectsForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
ProjectsEntity entity= projectsService.getInfo(id);
|
||||
if(entity!=null){
|
||||
projectsForm.setProjectId(String.valueOf(entity.getProjectId()));
|
||||
|
||||
if (!isImport) {
|
||||
String b = projectsService.checkForm(projectsForm,1);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
projectsService.saveOrUpdate(projectsForm,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){
|
||||
ProjectsEntity entity= projectsService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> projectsMap=JsonUtil.entityToMap(entity);
|
||||
projectsMap.put("id", projectsMap.get("project_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
boolean isPc = "pc".equals(ServletUtil.getHeader("yunzhupaas-origin" ));
|
||||
projectsMap = generaterSwapUtil.swapDataDetail(projectsMap,ProjectsConstant.getFormData(),"826396413712664325",isPc?false:false);
|
||||
//子表数据
|
||||
if (ObjectUtil.isNotEmpty(projectsMap.get("pid_yunzhupaasId"))){
|
||||
ProjectsEntity entitys= projectsService.getInfo(projectsMap.get("pid_yunzhupaasId").toString());
|
||||
projectsMap.put("pid", entitys.getProjectName());
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(projectsMap.get("project_type_id_yunzhupaasId"))){
|
||||
String entitys= projectsService.getProjettype(projectsMap.get("project_type_id_yunzhupaasId").toString());
|
||||
projectsMap.put("project_type_id", entitys);
|
||||
}
|
||||
return ActionResult.success(projectsMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id){
|
||||
ProjectsEntity entity= projectsService.getInfo(id);
|
||||
if(entity==null){
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
Map<String, Object> projectsMap=JsonUtil.entityToMap(entity);
|
||||
projectsMap.put("id", projectsMap.get("project_id"));
|
||||
//副表数据
|
||||
//子表数据
|
||||
projectsMap = generaterSwapUtil.swapDataForm(projectsMap,ProjectsConstant.getFormData(),ProjectsConstant.TABLEFIELDKEY,ProjectsConstant.TABLERENAMES);
|
||||
|
||||
return ActionResult.success(projectsMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 树状列表查询
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "树状列表查询")
|
||||
@GetMapping("/getTreeList")
|
||||
public ActionResult getTreeList(){
|
||||
List<Map<String, Object>> treeList= projectsService.getTreeList();
|
||||
return ActionResult.success(treeList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -69,7 +69,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "工种信息" , description = "2")
|
||||
@RequestMapping("/api/2/WorkType")
|
||||
@RequestMapping("/api/bcm/WorkType")
|
||||
public class WorkTypeController {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
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-05-18
|
||||
*/
|
||||
@Data
|
||||
@TableName("crm_lead")
|
||||
public class CrmLeadEntity {
|
||||
@TableId(value ="lead_id" )
|
||||
@JSONField(name = "lead_id")
|
||||
private String leadId;
|
||||
@TableField(value = "lead_name" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "lead_name")
|
||||
private String leadName;
|
||||
@TableField(value = "mobile" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "mobile")
|
||||
private String mobile;
|
||||
@TableField(value = "email" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "email")
|
||||
private String email;
|
||||
@TableField(value = "lead_status" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "lead_status")
|
||||
private String leadStatus;
|
||||
@TableField(value = "sales_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "sales_id")
|
||||
private String salesId;
|
||||
@TableField(value = "customer_source" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "customer_source")
|
||||
private String customerSource;
|
||||
@TableField("customer_id")
|
||||
@JSONField(name = "customer_id")
|
||||
private String customerId;
|
||||
@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("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;
|
||||
@TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(name = "f_tenant_id")
|
||||
private String tenantId;
|
||||
|
||||
}
|
||||
@@ -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-05-19
|
||||
*/
|
||||
@Data
|
||||
@TableName("mdm_project")
|
||||
public class ProjectsEntity {
|
||||
@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 = "pid" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "pid")
|
||||
private String pid;
|
||||
@TableField(value = "org_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "org_id")
|
||||
private String orgId;
|
||||
@TableField(value = "project_type_id" , updateStrategy = FieldStrategy.IGNORED)
|
||||
@JSONField(name = "project_type_id")
|
||||
private String projectTypeId;
|
||||
@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(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
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
package com.yunzhupaas.mdm.model.crmlead;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
*
|
||||
* crm_lead
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-05-18
|
||||
*/
|
||||
@Data
|
||||
public class CrmLeadExcelErrorVO extends CrmLeadExcelVO{
|
||||
|
||||
@Excel(name = "异常原因",orderNum = "-999")
|
||||
@JSONField(name = "errorsInfo")
|
||||
private String errorsInfo;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.yunzhupaas.mdm.model.crmlead;
|
||||
|
||||
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;
|
||||
/**
|
||||
*
|
||||
* crm_lead
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-05-18
|
||||
*/
|
||||
@Data
|
||||
public class CrmLeadExcelVO{
|
||||
/** 线索名称 **/
|
||||
@JSONField(name = "lead_name")
|
||||
@Excel(name = "线索名称(lead_name)",orderNum = "1", isImportField = "true" )
|
||||
private String lead_name;
|
||||
|
||||
/** 手机号 **/
|
||||
@JSONField(name = "mobile")
|
||||
@Excel(name = "手机号(mobile)",orderNum = "1", isImportField = "true" )
|
||||
private String mobile;
|
||||
|
||||
/** 状态 **/
|
||||
@JSONField(name = "lead_status")
|
||||
@Excel(name = "状态(lead_status)",orderNum = "1", isImportField = "true" )
|
||||
private String lead_status;
|
||||
|
||||
/** 销售人员 **/
|
||||
@JSONField(name = "sales_id")
|
||||
@Excel(name = "销售人员(sales_id)",orderNum = "1", isImportField = "true" )
|
||||
private String sales_id;
|
||||
|
||||
/** 备注 **/
|
||||
@JSONField(name = "remark")
|
||||
@Excel(name = "备注(remark)",orderNum = "1", isImportField = "true" )
|
||||
private String remark;
|
||||
|
||||
/** 邮箱 **/
|
||||
@JSONField(name = "email")
|
||||
@Excel(name = "邮箱(email)",orderNum = "1", isImportField = "true" )
|
||||
private String email;
|
||||
|
||||
/** 来源 **/
|
||||
@JSONField(name = "customer_source")
|
||||
@Excel(name = "来源(customer_source)",orderNum = "1", isImportField = "true" )
|
||||
private String customer_source;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.yunzhupaas.mdm.model.crmlead;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* crm_lead
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-05-18
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "表单参数")
|
||||
public class CrmLeadForm {
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
@JSONField(name = "lead_id")
|
||||
private String leadId;
|
||||
|
||||
/** 乐观锁 **/
|
||||
@Schema(description = "乐观锁")
|
||||
@JsonProperty("f_version")
|
||||
@JSONField(name = "f_version")
|
||||
private Integer version;
|
||||
/** 流程id **/
|
||||
@Schema(description = "流程id")
|
||||
@JsonProperty("flowId")
|
||||
@JSONField(name = "f_flow_id")
|
||||
private String flowId;
|
||||
/** 流程权限列表 **/
|
||||
@JsonProperty("formOperates")
|
||||
private List<Map<String,Object>> formOperates = new ArrayList<>();
|
||||
|
||||
/** 线索名称 **/
|
||||
@Schema(description = "线索名称")
|
||||
@JsonProperty("lead_name")
|
||||
@JSONField(name = "lead_name")
|
||||
private String leadName;
|
||||
/** 手机号 **/
|
||||
@Schema(description = "手机号")
|
||||
@JsonProperty("mobile")
|
||||
@JSONField(name = "mobile")
|
||||
private String mobile;
|
||||
/** 邮箱 **/
|
||||
@Schema(description = "邮箱")
|
||||
@JsonProperty("email")
|
||||
@JSONField(name = "email")
|
||||
private String email;
|
||||
/** 状态 **/
|
||||
@Schema(description = "状态")
|
||||
@JsonProperty("lead_status")
|
||||
@JSONField(name = "lead_status")
|
||||
private Object leadStatus;
|
||||
/** 销售人员 **/
|
||||
@Schema(description = "销售人员")
|
||||
@JsonProperty("sales_id")
|
||||
@JSONField(name = "sales_id")
|
||||
private Object salesId;
|
||||
/** 来源 **/
|
||||
@Schema(description = "来源")
|
||||
@JsonProperty("customer_source")
|
||||
@JSONField(name = "customer_source")
|
||||
private Object customerSource;
|
||||
/** 备注 **/
|
||||
@Schema(description = "备注")
|
||||
@JsonProperty("remark")
|
||||
@JSONField(name = "remark")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.yunzhupaas.mdm.model.crmlead;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* crm_lead
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-05-18
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "列表查询参数")
|
||||
public class CrmLeadPagination extends Pagination {
|
||||
/** 流程模板id */
|
||||
@Schema(description = "流程模板id")
|
||||
private String flowId;
|
||||
/** 关键词搜索 */
|
||||
@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("mobile")
|
||||
@JSONField(name = "mobile")
|
||||
private Object mobile;
|
||||
/** 来源 */
|
||||
@Schema(description = "来源")
|
||||
@JsonProperty("customer_source")
|
||||
@JSONField(name = "customerSource")
|
||||
private Object customerSource;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
package com.yunzhupaas.mdm.model.projects;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
/**
|
||||
*
|
||||
* 项目信息
|
||||
* @版本: V5.2.7
|
||||
* @版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
|
||||
* @作者: 深圳市乐程软件有限公司
|
||||
* @日期: 2026-05-19
|
||||
*/
|
||||
@Data
|
||||
public class ProjectsExcelErrorVO extends ProjectsExcelVO{
|
||||
|
||||
@Excel(name = "异常原因",orderNum = "-999")
|
||||
@JSONField(name = "errorsInfo")
|
||||
private String errorsInfo;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yunzhupaas.mdm.model.projects;
|
||||
|
||||
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-05-19
|
||||
*/
|
||||
@Data
|
||||
public class ProjectsExcelVO{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.yunzhupaas.mdm.model.projects;
|
||||
|
||||
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-05-19
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "表单参数")
|
||||
public class ProjectsForm {
|
||||
/** 主键 */
|
||||
@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("project_type_id")
|
||||
@JSONField(name = "project_type_id")
|
||||
private Object projectTypeId;
|
||||
/** 归属组织 **/
|
||||
@Schema(description = "归属组织")
|
||||
@JsonProperty("org_id")
|
||||
@JSONField(name = "org_id")
|
||||
private Object orgId;
|
||||
/** 上级项目 **/
|
||||
@Schema(description = "上级项目")
|
||||
@JsonProperty("pid")
|
||||
@JSONField(name = "pid")
|
||||
private Object pid;
|
||||
/** 顺序号 **/
|
||||
@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,63 @@
|
||||
package com.yunzhupaas.mdm.model.projects;
|
||||
|
||||
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-05-19
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "列表查询参数")
|
||||
public class ProjectsPagination 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("project_name")
|
||||
@JSONField(name = "projectName")
|
||||
private Object projectName;
|
||||
/** 归属组织 */
|
||||
@Schema(description = "归属组织")
|
||||
@JsonProperty("org_id")
|
||||
@JSONField(name = "orgId")
|
||||
private Object orgId;
|
||||
/**
|
||||
* 树形异步父级字段传值
|
||||
*/
|
||||
private String treeParentValue;
|
||||
/**
|
||||
* 是否有参数
|
||||
*/
|
||||
private boolean hasParam=false;
|
||||
}
|
||||
Reference in New Issue
Block a user