Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -18,8 +18,8 @@
|
|||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<libServerUrl>http://10.10.2.102:9500</libServerUrl>
|
<libServerUrl>http://10.10.2.102:9500</libServerUrl>
|
||||||
<libServerUser>admin</libServerUser>
|
<libServerUser>pcitc</libServerUser>
|
||||||
<libServerPwd>Gas@Dev123</libServerPwd>
|
<libServerPwd>K9$pQ3!zX7@rT2&w</libServerPwd>
|
||||||
<ignoreUpload>false</ignoreUpload>
|
<ignoreUpload>false</ignoreUpload>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|||||||
@ -18,8 +18,10 @@
|
|||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<docker-image-name>pcitc/itc-pcitc-demo</docker-image-name>
|
<docker-image-name>pcitc/itc-pcitc-demo</docker-image-name>
|
||||||
<libServerUrl>http://172.27.46.206:23117</libServerUrl>
|
<libServerUrl>http://10.10.2.102:9500/</libServerUrl>
|
||||||
<ignoreUpload>false</ignoreUpload>
|
<libServerUser>pcitc</libServerUser>
|
||||||
|
<libServerPwd>K9$pQ3!zX7@rT2&w</libServerPwd>
|
||||||
|
<ignoreUpload>false</ignoreUpload>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -83,22 +85,6 @@
|
|||||||
<build>
|
<build>
|
||||||
<finalName>app</finalName>
|
<finalName>app</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- <plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<version>2.7.6</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>repackage</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<classifier>classes</classifier>
|
|
||||||
<attach>false</attach>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin> -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.geg</groupId>
|
<groupId>com.geg</groupId>
|
||||||
<artifactId>tanuki-boot-maven-plugin</artifactId>
|
<artifactId>tanuki-boot-maven-plugin</artifactId>
|
||||||
@ -108,6 +94,7 @@
|
|||||||
<ignoreUpload>${ignoreUpload}</ignoreUpload>
|
<ignoreUpload>${ignoreUpload}</ignoreUpload>
|
||||||
<libServerUser>${libServerUser}</libServerUser>
|
<libServerUser>${libServerUser}</libServerUser>
|
||||||
<libServerPwd>${libServerPwd}</libServerPwd>
|
<libServerPwd>${libServerPwd}</libServerPwd>
|
||||||
|
<appName>demo-service</appName>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@ -1,62 +1,16 @@
|
|||||||
package com.pictc.utils;
|
package com.pictc.utils;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import java.math.BigDecimal;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.sql.Date;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Time;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.OffsetDateTime;
|
|
||||||
import java.time.OffsetTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
import org.apache.ibatis.session.SqlSession;
|
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
|
||||||
import org.mybatis.spring.SqlSessionUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
||||||
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
|
||||||
import com.pictc.annotations.datalog.JoinCaseType;
|
import com.pictc.annotations.datalog.*;
|
||||||
import com.pictc.annotations.datalog.JoinValueType;
|
|
||||||
import com.pictc.annotations.datalog.LogJoin;
|
|
||||||
import com.pictc.annotations.datalog.LogJoinColumn;
|
|
||||||
import com.pictc.annotations.datalog.ValueDirectionType;
|
|
||||||
import com.pictc.converts.ConverUtil;
|
import com.pictc.converts.ConverUtil;
|
||||||
import com.pictc.datalog.DataOperationContent;
|
import com.pictc.datalog.*;
|
||||||
import com.pictc.datalog.DataOperationListener;
|
|
||||||
import com.pictc.datalog.DefaultDataOperationListener;
|
|
||||||
import com.pictc.datalog.LogAttrFieldInfo;
|
|
||||||
import com.pictc.datalog.LogFieldInfo;
|
|
||||||
import com.pictc.datalog.LogJoinInfo;
|
|
||||||
import com.pictc.datalog.LogTableInfo;
|
|
||||||
import com.pictc.enums.BusinessCode;
|
import com.pictc.enums.BusinessCode;
|
||||||
import com.pictc.enums.ExceptionCommonCode;
|
import com.pictc.enums.ExceptionCommonCode;
|
||||||
import com.pictc.exceptions.OrmException;
|
import com.pictc.exceptions.OrmException;
|
||||||
@ -65,7 +19,6 @@ import com.pictc.jdbc.ResultSetUtils;
|
|||||||
import com.pictc.jdbc.model.JdbcParam;
|
import com.pictc.jdbc.model.JdbcParam;
|
||||||
import com.xjrsoft.common.exception.BusinessException;
|
import com.xjrsoft.common.exception.BusinessException;
|
||||||
import com.xjrsoft.common.utils.SecureUtil;
|
import com.xjrsoft.common.utils.SecureUtil;
|
||||||
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
|
|
||||||
import com.xjrsoft.module.datalog.entity.DataChangeLog;
|
import com.xjrsoft.module.datalog.entity.DataChangeLog;
|
||||||
import com.xjrsoft.module.datalog.entity.json.FieldChange;
|
import com.xjrsoft.module.datalog.entity.json.FieldChange;
|
||||||
import com.xjrsoft.module.datalog.mapper.DatalogMapper;
|
import com.xjrsoft.module.datalog.mapper.DatalogMapper;
|
||||||
@ -75,12 +28,25 @@ import com.xjrsoft.module.organization.dto.UserDto;
|
|||||||
import com.xjrsoft.module.system.client.IFileClient;
|
import com.xjrsoft.module.system.client.IFileClient;
|
||||||
import com.xjrsoft.module.system.dto.LngFileUploadBindDto;
|
import com.xjrsoft.module.system.dto.LngFileUploadBindDto;
|
||||||
import com.xjrsoft.module.system.dto.UpdateLngFileUploadDto;
|
import com.xjrsoft.module.system.dto.UpdateLngFileUploadDto;
|
||||||
import com.xjrsoft.module.system.vo.LngFileUploadVo;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.sql.*;
|
||||||
|
import java.time.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@SuppressWarnings({"unused","rawtypes","unchecked"})
|
@SuppressWarnings({"unused","rawtypes","unchecked"})
|
||||||
@ -261,7 +227,7 @@ public class DataLogTools {
|
|||||||
buildFields(datalog,tabInfo,dto,old);
|
buildFields(datalog,tabInfo,dto,old);
|
||||||
logs.add(datalog);
|
logs.add(datalog);
|
||||||
List<LogJoinInfo> joins = tabInfo.getJoins();
|
List<LogJoinInfo> joins = tabInfo.getJoins();
|
||||||
if(!CollectionUtils.isNotEmpty(joins)) {
|
if(CollectionUtils.isNotEmpty(joins)) {
|
||||||
for (LogJoinInfo join : joins) {
|
for (LogJoinInfo join : joins) {
|
||||||
if(join.getJoin().caseType()==JoinCaseType.FULL) {
|
if(join.getJoin().caseType()==JoinCaseType.FULL) {
|
||||||
buildJoins(logs,datalog,OperationType.UPDATE,tabInfo,join,dto);
|
buildJoins(logs,datalog,OperationType.UPDATE,tabInfo,join,dto);
|
||||||
@ -316,7 +282,7 @@ public class DataLogTools {
|
|||||||
logs.add(datalog);
|
logs.add(datalog);
|
||||||
delete(entity, tabInfo, mapper);
|
delete(entity, tabInfo, mapper);
|
||||||
List<LogJoinInfo> joins = tabInfo.getJoins();
|
List<LogJoinInfo> joins = tabInfo.getJoins();
|
||||||
if(!CollectionUtils.isNotEmpty(joins)) {
|
if(CollectionUtils.isNotEmpty(joins)) {
|
||||||
for (LogJoinInfo join : joins) {
|
for (LogJoinInfo join : joins) {
|
||||||
if(join.getJoin().caseType()==JoinCaseType.FULL) {
|
if(join.getJoin().caseType()==JoinCaseType.FULL) {
|
||||||
buildJoins(logs,datalog,OperationType.DELETE,tabInfo,join,entity);
|
buildJoins(logs,datalog,OperationType.DELETE,tabInfo,join,entity);
|
||||||
@ -377,7 +343,7 @@ public class DataLogTools {
|
|||||||
buildFields(datalog,tabInfo,entity,null);
|
buildFields(datalog,tabInfo,entity,null);
|
||||||
logs.add(datalog);
|
logs.add(datalog);
|
||||||
List<LogJoinInfo> joins = tabInfo.getJoins();
|
List<LogJoinInfo> joins = tabInfo.getJoins();
|
||||||
if(!CollectionUtils.isNotEmpty(joins)) {
|
if(CollectionUtils.isNotEmpty(joins)) {
|
||||||
for (LogJoinInfo join : joins) {
|
for (LogJoinInfo join : joins) {
|
||||||
if(join.getJoin().caseType()==JoinCaseType.FULL) {
|
if(join.getJoin().caseType()==JoinCaseType.FULL) {
|
||||||
buildJoins(logs,datalog,OperationType.DELETE,tabInfo,join,entity);
|
buildJoins(logs,datalog,OperationType.DELETE,tabInfo,join,entity);
|
||||||
@ -525,7 +491,7 @@ public class DataLogTools {
|
|||||||
Object old = mapper.selectById(id);
|
Object old = mapper.selectById(id);
|
||||||
if(old==null) return null;
|
if(old==null) return null;
|
||||||
T dto = (T) tabInfo.toDto(old);
|
T dto = (T) tabInfo.toDto(old);
|
||||||
initJoinValues(tabInfo,dto,SetUtils.of(klazz), full);
|
// initJoinValues(tabInfo,dto,SetUtils.of(klazz), full);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,7 +505,7 @@ public class DataLogTools {
|
|||||||
public static void initJoinValues(LogTableInfo tabInfo,Object entity,Set<Class<?>> classPath,boolean full){
|
public static void initJoinValues(LogTableInfo tabInfo,Object entity,Set<Class<?>> classPath,boolean full){
|
||||||
List<LogJoinInfo> joins = tabInfo.getJoins();
|
List<LogJoinInfo> joins = tabInfo.getJoins();
|
||||||
BaseMapper mapper = MybatisTools.getMapper(tabInfo.getEntityType());
|
BaseMapper mapper = MybatisTools.getMapper(tabInfo.getEntityType());
|
||||||
if(!CollectionUtils.isNotEmpty(joins)) {
|
if(CollectionUtils.isNotEmpty(joins)) {
|
||||||
for (LogJoinInfo join : joins) {
|
for (LogJoinInfo join : joins) {
|
||||||
LogTableInfo joinTable = join.getTableInfo();
|
LogTableInfo joinTable = join.getTableInfo();
|
||||||
if(full) {
|
if(full) {
|
||||||
|
|||||||
@ -1,23 +1,12 @@
|
|||||||
package com.xjrsoft.module.sales.dto;
|
package com.xjrsoft.module.sales.dto;
|
||||||
|
|
||||||
|
import com.pictc.annotations.datalog.LogField;
|
||||||
|
import com.pictc.annotations.datalog.LogTable;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.pictc.annotations.datalog.LogTable;
|
|
||||||
import com.pictc.annotations.datalog.LogField;
|
|
||||||
import com.pictc.annotations.datalog.LogJoin;
|
|
||||||
import com.pictc.annotations.datalog.LogJoinColumn;
|
|
||||||
import com.pictc.annotations.datalog.JoinCaseType;
|
|
||||||
import com.pictc.annotations.datalog.JoinType;
|
|
||||||
import com.pictc.annotations.datalog.ValueDirectionType;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +27,7 @@ public class UpdateLngCustomerGroupCustomerDto implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@LogField(name="主键",index=0)
|
@LogField(name="主键",index=0)
|
||||||
@ApiModelProperty("主键")
|
@ApiModelProperty("主键")
|
||||||
private String id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 组编码
|
* 组编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,8 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,13 +69,49 @@ public class UpdateLngGradeSystemItemDto implements Serializable {
|
|||||||
@LogField(name="备注",index=6)
|
@LogField(name="备注",index=6)
|
||||||
@ApiModelProperty("备注")
|
@ApiModelProperty("备注")
|
||||||
private String note;
|
private String note;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户id
|
* 创建人id
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty("创建人id")
|
||||||
|
private Long createUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private LocalDateTime createDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("修改人id")
|
||||||
|
private Long modifyUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("修改时间")
|
||||||
|
private LocalDateTime modifyDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
@LogField(name="租户id",index=7)
|
@LogField(name="租户id",index=7)
|
||||||
@ApiModelProperty("租户id")
|
@ApiModelProperty("租户id")
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("部门id")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("数据权限id")
|
||||||
|
private Long ruleUserId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,7 @@ package com.xjrsoft.module.sales.vo;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: 表单出参
|
* @title: 表单出参
|
||||||
@ -21,7 +18,7 @@ public class LngCustomerGroupCustomerVo {
|
|||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty("主键")
|
@ApiModelProperty("主键")
|
||||||
private String id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 组编码
|
* 组编码
|
||||||
*/
|
*/
|
||||||
@ -73,6 +70,27 @@ public class LngCustomerGroupCustomerVo {
|
|||||||
@ApiModelProperty("数据权限id")
|
@ApiModelProperty("数据权限id")
|
||||||
private Long ruleUserId;
|
private Long ruleUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("客户名称")
|
||||||
|
private String cuName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国内/国际
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("国内/国际")
|
||||||
|
private String diName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户类别
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("客户类别")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户分类
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("客户分类")
|
||||||
|
private String className;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
package com.xjrsoft.module.sales.vo;
|
package com.xjrsoft.module.sales.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.xjrsoft.common.annotation.Trans;
|
||||||
|
import com.xjrsoft.common.enums.TransType;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import com.xjrsoft.common.annotation.Trans;
|
|
||||||
import com.xjrsoft.common.enums.TransType;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: 分页列表出参
|
* @title: 分页列表出参
|
||||||
@ -23,7 +21,7 @@ public class LngCustomerGroupPageVo {
|
|||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty("主键")
|
@ApiModelProperty("主键")
|
||||||
private String id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 组编码(按类型自动编码)
|
* 组编码(按类型自动编码)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -48,15 +48,9 @@ public class LngGradeSystemItemVo {
|
|||||||
* 评价部门编码
|
* 评价部门编码
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty("评价部门编码")
|
@ApiModelProperty("评价部门编码")
|
||||||
@Trans(type = TransType.DEPT, labelField = "eDeptName")
|
@Trans(type = TransType.DEPT, transToFieldName = "eDeptName")
|
||||||
private String eDeptCode;
|
private String eDeptCode;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评价部门编码
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("评价部门名称")
|
|
||||||
private String eDeptName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示顺序
|
* 显示顺序
|
||||||
|
|||||||
@ -1,22 +1,31 @@
|
|||||||
package com.xjrsoft.module.sales.controller;
|
package com.xjrsoft.module.sales.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.google.api.client.util.Lists;
|
||||||
|
import com.pictc.datalog.DataOperationContent;
|
||||||
|
import com.pictc.datalog.DataOperationListener;
|
||||||
|
import com.pictc.enums.BusinessCode;
|
||||||
|
import com.pictc.enums.ExceptionCommonCode;
|
||||||
|
import com.pictc.jdbc.JdbcTools;
|
||||||
|
import com.pictc.jdbc.model.JdbcParam;
|
||||||
|
import com.pictc.utils.StringUtils;
|
||||||
|
import com.xjrsoft.common.exception.BusinessException;
|
||||||
import com.xjrsoft.common.model.result.R;
|
import com.xjrsoft.common.model.result.R;
|
||||||
import com.xjrsoft.common.page.ConventPage;
|
import com.xjrsoft.common.page.ConventPage;
|
||||||
import com.xjrsoft.common.page.PageOutput;
|
import com.xjrsoft.common.page.PageOutput;
|
||||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||||
|
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||||
import com.xjrsoft.module.sales.dto.LngCustomerGroupPageDto;
|
import com.xjrsoft.module.sales.dto.LngCustomerGroupPageDto;
|
||||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerGroupDto;
|
import com.xjrsoft.module.sales.dto.UpdateLngCustomerGroupDto;
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
|
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
|
||||||
import com.xjrsoft.module.sales.service.ICustomerGroupService;
|
import com.xjrsoft.module.sales.service.ICustomerGroupService;
|
||||||
import com.xjrsoft.module.sales.vo.LngCustomerGroupPageVo;
|
import com.xjrsoft.module.sales.vo.LngCustomerGroupPageVo;
|
||||||
import com.xjrsoft.module.sales.vo.LngCustomerGroupVo;
|
import com.xjrsoft.module.system.client.ICodeRuleClient;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -40,21 +49,21 @@ public class CustomerGroupController {
|
|||||||
|
|
||||||
private final ICustomerGroupService customerGroupService;
|
private final ICustomerGroupService customerGroupService;
|
||||||
private final DatalogService dataService;
|
private final DatalogService dataService;
|
||||||
|
private final ICodeRuleClient codeRuleClient;
|
||||||
|
private final String GRP_CODE = "grpCode";
|
||||||
|
|
||||||
@GetMapping(value = "/page")
|
// @GetMapping(value = "/page")
|
||||||
@ApiOperation(value="LngCustomerGroup列表(分页)")
|
@ApiOperation(value="LngCustomerGroup列表(分页)")
|
||||||
@SaCheckPermission("customerGroup:list")
|
@SaCheckPermission("customerGroup:list")
|
||||||
public R page(@Valid LngCustomerGroupPageDto dto){
|
public R page(@Valid LngCustomerGroupPageDto dto){
|
||||||
|
|
||||||
LambdaQueryWrapper<LngCustomerGroup> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<LngCustomerGroup> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper
|
queryWrapper
|
||||||
.like(StrUtil.isNotBlank(dto.getGrpCode()),LngCustomerGroup::getGrpCode,dto.getGrpCode())
|
.eq(StrUtil.isNotBlank(dto.getTypeCode()),LngCustomerGroup::getTypeCode,dto.getTypeCode())
|
||||||
.like(StrUtil.isNotBlank(dto.getTypeCode()),LngCustomerGroup::getTypeCode,dto.getTypeCode())
|
|
||||||
.between(ObjectUtil.isNotNull(dto.getDateFromStart()) && ObjectUtil.isNotNull(dto.getDateFromEnd()),LngCustomerGroup::getDateFrom,dto.getDateFromStart(),dto.getDateFromEnd())
|
.between(ObjectUtil.isNotNull(dto.getDateFromStart()) && ObjectUtil.isNotNull(dto.getDateFromEnd()),LngCustomerGroup::getDateFrom,dto.getDateFromStart(),dto.getDateFromEnd())
|
||||||
.between(ObjectUtil.isNotNull(dto.getDateToStart()) && ObjectUtil.isNotNull(dto.getDateToEnd()),LngCustomerGroup::getDateTo,dto.getDateToStart(),dto.getDateToEnd())
|
.between(ObjectUtil.isNotNull(dto.getDateToStart()) && ObjectUtil.isNotNull(dto.getDateToEnd()),LngCustomerGroup::getDateTo,dto.getDateToStart(),dto.getDateToEnd())
|
||||||
.like(StrUtil.isNotBlank(dto.getGrpName()),LngCustomerGroup::getGrpName,dto.getGrpName())
|
.like(StrUtil.isNotBlank(dto.getGrpName()),LngCustomerGroup::getGrpName,dto.getGrpName())
|
||||||
.like(StrUtil.isNotBlank(dto.getNote()),LngCustomerGroup::getNote,dto.getNote())
|
.orderByAsc(LngCustomerGroup::getGrpCode)
|
||||||
.orderByDesc(LngCustomerGroup::getId)
|
|
||||||
.select(LngCustomerGroup.class,x -> VoToColumnUtil.fieldsToColumns(LngCustomerGroupPageVo.class).contains(x.getProperty()));
|
.select(LngCustomerGroup.class,x -> VoToColumnUtil.fieldsToColumns(LngCustomerGroupPageVo.class).contains(x.getProperty()));
|
||||||
IPage<LngCustomerGroup> page = customerGroupService.page(ConventPage.getPage(dto), queryWrapper);
|
IPage<LngCustomerGroup> page = customerGroupService.page(ConventPage.getPage(dto), queryWrapper);
|
||||||
PageOutput<LngCustomerGroupPageVo> pageOutput = ConventPage.getPageOutput(page, LngCustomerGroupPageVo.class);
|
PageOutput<LngCustomerGroupPageVo> pageOutput = ConventPage.getPageOutput(page, LngCustomerGroupPageVo.class);
|
||||||
@ -65,35 +74,96 @@ public class CustomerGroupController {
|
|||||||
@ApiOperation(value="根据id查询LngCustomerGroup信息")
|
@ApiOperation(value="根据id查询LngCustomerGroup信息")
|
||||||
@SaCheckPermission("customerGroup:detail")
|
@SaCheckPermission("customerGroup:detail")
|
||||||
public R info(@RequestParam Long id){
|
public R info(@RequestParam Long id){
|
||||||
LngCustomerGroup lngCustomerGroup = customerGroupService.getByIdDeep(id);
|
return R.ok(customerGroupService.info(id));
|
||||||
if (lngCustomerGroup == null) {
|
|
||||||
return R.error("找不到此数据!");
|
|
||||||
}
|
|
||||||
return R.ok(BeanUtil.toBean(lngCustomerGroup, LngCustomerGroupVo.class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/datalog")
|
||||||
|
@ApiOperation(value="根据id查询LngCustomerGroup数据详细日志")
|
||||||
|
@SaCheckPermission("customerGroup:datalog")
|
||||||
|
public R datalog(@RequestParam Long id){
|
||||||
|
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngCustomerGroupDto.class,id);
|
||||||
|
return R.ok(logs);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation(value = "新增LngCustomerGroup")
|
@ApiOperation(value = "新增LngCustomerGroup")
|
||||||
@SaCheckPermission("customerGroup:add")
|
@SaCheckPermission("customerGroup:add")
|
||||||
public R add(@Valid @RequestBody UpdateLngCustomerGroupDto dto){
|
public R add(@Valid @RequestBody UpdateLngCustomerGroupDto dto){
|
||||||
UpdateLngCustomerGroupDto res = dataService.insert(dto);
|
String code = codeRuleClient.genEncode(GRP_CODE);
|
||||||
|
dto.setGrpCode("GD" + code);
|
||||||
|
UpdateLngCustomerGroupDto res = dataService.insert(dto, new DataOperationListener<UpdateLngCustomerGroupDto>() {
|
||||||
|
@Override
|
||||||
|
public UpdateLngCustomerGroupDto before(DataOperationContent<UpdateLngCustomerGroupDto> content) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UpdateLngCustomerGroupDto after(DataOperationContent<UpdateLngCustomerGroupDto> content) {
|
||||||
|
execAfter(content.getTableName(), content.getIdValue(), "I");
|
||||||
|
return content.getObj();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
codeRuleClient.useEncode(GRP_CODE);
|
||||||
return R.ok(res.getId());
|
return R.ok(res.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void execAfter(String table, Long id, String sign) {
|
||||||
|
String sql = StringUtils.format("{? = call pc_{0}.f_save(?, ?)}", table);
|
||||||
|
List<JdbcParam> params = Lists.newArrayList();
|
||||||
|
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||||
|
params.add(outParam);
|
||||||
|
params.add(JdbcParam.ofLong(id));
|
||||||
|
params.add(JdbcParam.ofString(sign));
|
||||||
|
JdbcTools.call(sql,params);
|
||||||
|
String error = outParam.getStringValue();
|
||||||
|
if (StringUtils.isNotEmpty(error)) {
|
||||||
|
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_SAVE_EXEC_ERROR, error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation(value = "修改LngCustomerGroup")
|
@ApiOperation(value = "修改LngCustomerGroup")
|
||||||
@SaCheckPermission("customerGroup:edit")
|
@SaCheckPermission("customerGroup:edit")
|
||||||
public R update(@Valid @RequestBody UpdateLngCustomerGroupDto dto){
|
public R update(@Valid @RequestBody UpdateLngCustomerGroupDto dto){
|
||||||
return R.ok(dataService.updateById(dto));
|
return R.ok(dataService.updateById(dto, new DataOperationListener<UpdateLngCustomerGroupDto>() {
|
||||||
|
@Override
|
||||||
|
public UpdateLngCustomerGroupDto before(DataOperationContent<UpdateLngCustomerGroupDto> content) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UpdateLngCustomerGroupDto after(DataOperationContent<UpdateLngCustomerGroupDto> content) {
|
||||||
|
execAfter(content.getTableName(), content.getIdValue(), "U");
|
||||||
|
return content.getObj();
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@ApiOperation(value = "删除")
|
@ApiOperation(value = "删除")
|
||||||
@SaCheckPermission("customerGroup:delete")
|
@SaCheckPermission("customerGroup:delete")
|
||||||
public R delete(@Valid @RequestBody List<Long> ids){
|
public R delete(@Valid @RequestBody List<Long> ids){
|
||||||
return R.ok(dataService.deleteByIds(UpdateLngCustomerGroupDto.class, ids));
|
return R.ok(dataService.deleteByIds(UpdateLngCustomerGroupDto.class, ids, new DataOperationListener<UpdateLngCustomerGroupDto>() {
|
||||||
|
@Override
|
||||||
|
public UpdateLngCustomerGroupDto before(DataOperationContent<UpdateLngCustomerGroupDto> content) {
|
||||||
|
String sql = StringUtils.format("{? = call pc_{0}.f_before_delete(?)}", content.getTableName());
|
||||||
|
List<JdbcParam> params = Lists.newArrayList();
|
||||||
|
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||||
|
params.add(outParam);
|
||||||
|
params.add(JdbcParam.ofLong(content.getIdValue()));
|
||||||
|
JdbcTools.call(sql,params);
|
||||||
|
String error = outParam.getStringValue();
|
||||||
|
if (StringUtils.isNotEmpty(error)) {
|
||||||
|
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
|
||||||
|
}
|
||||||
|
return content.getObj();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UpdateLngCustomerGroupDto after(DataOperationContent<UpdateLngCustomerGroupDto> content) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -5,6 +5,8 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.pictc.datalog.DataOperationContent;
|
||||||
|
import com.pictc.datalog.DataOperationListener;
|
||||||
import com.xjrsoft.common.model.result.R;
|
import com.xjrsoft.common.model.result.R;
|
||||||
import com.xjrsoft.common.page.ConventPage;
|
import com.xjrsoft.common.page.ConventPage;
|
||||||
import com.xjrsoft.common.page.PageOutput;
|
import com.xjrsoft.common.page.PageOutput;
|
||||||
@ -111,7 +113,17 @@ public class GradeSystemController {
|
|||||||
@ApiOperation(value = "启用LngGradeSystem")
|
@ApiOperation(value = "启用LngGradeSystem")
|
||||||
@SaCheckPermission("gradeSystem:enable")
|
@SaCheckPermission("gradeSystem:enable")
|
||||||
public R enable(@Valid @RequestBody List<Long> ids){
|
public R enable(@Valid @RequestBody List<Long> ids){
|
||||||
return R.ok(dataService.enable(UpdateLngGradeSystemDto.class,ids));
|
return R.ok(dataService.enable(UpdateLngGradeSystemDto.class,ids, new DataOperationListener<UpdateLngGradeSystemDto>() {
|
||||||
|
@Override
|
||||||
|
public UpdateLngGradeSystemDto before(DataOperationContent<UpdateLngGradeSystemDto> content) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UpdateLngGradeSystemDto after(DataOperationContent<UpdateLngGradeSystemDto> content) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,7 +131,17 @@ public class GradeSystemController {
|
|||||||
@ApiOperation(value = "禁用LngGradeSystem")
|
@ApiOperation(value = "禁用LngGradeSystem")
|
||||||
@SaCheckPermission("gradeSystem:disable")
|
@SaCheckPermission("gradeSystem:disable")
|
||||||
public R disable(@Valid @RequestBody List<Long> ids){
|
public R disable(@Valid @RequestBody List<Long> ids){
|
||||||
return R.ok(dataService.disable(UpdateLngGradeSystemDto.class,ids));
|
return R.ok(dataService.disable(UpdateLngGradeSystemDto.class, ids, new DataOperationListener<UpdateLngGradeSystemDto>() {
|
||||||
|
@Override
|
||||||
|
public UpdateLngGradeSystemDto before(DataOperationContent<UpdateLngGradeSystemDto> content) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UpdateLngGradeSystemDto after(DataOperationContent<UpdateLngGradeSystemDto> content) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public class LngCustomerGroupCustomer implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty("主键")
|
@ApiModelProperty("主键")
|
||||||
@TableId
|
@TableId
|
||||||
private String id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 组编码
|
* 组编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.xjrsoft.module.sales.mapper;
|
package com.xjrsoft.module.sales.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomerGroupCustomer;
|
import com.xjrsoft.module.sales.entity.LngCustomerGroupCustomer;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@ -11,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface LngCustomerGroupCustomerMapper extends MPJBaseMapper<LngCustomerGroupCustomer> {
|
public interface LngCustomerGroupCustomerMapper extends MPJBaseMapper<LngCustomerGroupCustomer>, BaseMapper<LngCustomerGroupCustomer> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,12 @@ package com.xjrsoft.module.sales.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
|
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
|
||||||
|
import com.xjrsoft.module.sales.vo.LngCustomerGroupCustomerVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: mapper
|
* @title: mapper
|
||||||
@ -12,6 +17,17 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface LngCustomerGroupMapper extends MPJBaseMapper<LngCustomerGroup> {
|
public interface LngCustomerGroupMapper extends MPJBaseMapper<LngCustomerGroup>, BaseMapper<LngCustomerGroup> {
|
||||||
|
|
||||||
|
@Select("SELECT t1.*, t2.cu_name, dd1.name AS di_name, dd2.name AS type_name, dd3.name AS class_name" +
|
||||||
|
" FROM lng_customer_group_customer t1" +
|
||||||
|
" LEFT JOIN lng_customer t2 on t1.cu_code = t2.cu_code" +
|
||||||
|
" LEFT JOIN xjr_dictionary_item di1 ON di1.code = 'LNG_NATURE'" +
|
||||||
|
" LEFT JOIN xjr_dictionary_detail dd1 ON dd1.item_id = di1.id AND dd1.code = t2.d_i" +
|
||||||
|
" LEFT JOIN xjr_dictionary_item di2 ON di2.code = 'LNG_CU_TYP'" +
|
||||||
|
" LEFT JOIN xjr_dictionary_detail dd2 ON dd2.item_id = di2.id AND dd2.code = t2.type_code" +
|
||||||
|
" LEFT JOIN xjr_dictionary_item di3 ON di3.code = 'LNG_CLASS'" +
|
||||||
|
" LEFT JOIN xjr_dictionary_detail dd3 ON dd3.item_id = di3.id AND dd3.code = t2.class_code" +
|
||||||
|
" WHERE t1.grp_code = #{grpCode}")
|
||||||
|
List<LngCustomerGroupCustomerVo> queryCustomerList(@Param("grpCode") String grpCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,7 @@ import com.github.yulichang.base.MPJBaseService;
|
|||||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
|
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
|
||||||
|
import com.xjrsoft.module.sales.vo.LngCustomerGroupVo;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: service
|
* @title: service
|
||||||
@ -15,27 +14,12 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public interface ICustomerGroupService extends MPJBaseService<LngCustomerGroup>, MPJDeepService<LngCustomerGroup>, MPJRelationService<LngCustomerGroup> {
|
public interface ICustomerGroupService extends MPJBaseService<LngCustomerGroup>, MPJDeepService<LngCustomerGroup>, MPJRelationService<LngCustomerGroup> {
|
||||||
/**
|
|
||||||
* 新增
|
|
||||||
*
|
|
||||||
* @param lngCustomerGroup
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean add(LngCustomerGroup lngCustomerGroup);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新
|
* 详情
|
||||||
*
|
*
|
||||||
* @param lngCustomerGroup
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean update(LngCustomerGroup lngCustomerGroup);
|
LngCustomerGroupVo info(Long id);
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean delete(List<Long> ids);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,6 @@ import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
|||||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||||
import com.xjrsoft.module.sales.entity.LngGradeSystem;
|
import com.xjrsoft.module.sales.entity.LngGradeSystem;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: service
|
* @title: service
|
||||||
* @Author 管理员
|
* @Author 管理员
|
||||||
@ -15,27 +13,5 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public interface IGradeSystemService extends MPJBaseService<LngGradeSystem>, MPJDeepService<LngGradeSystem>, MPJRelationService<LngGradeSystem> {
|
public interface IGradeSystemService extends MPJBaseService<LngGradeSystem>, MPJDeepService<LngGradeSystem>, MPJRelationService<LngGradeSystem> {
|
||||||
/**
|
|
||||||
* 新增
|
|
||||||
*
|
|
||||||
* @param lngGradeSystem
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean add(LngGradeSystem lngGradeSystem);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新
|
|
||||||
*
|
|
||||||
* @param lngGradeSystem
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean update(LngGradeSystem lngGradeSystem);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean delete(List<Long> ids);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
package com.xjrsoft.module.sales.service.impl;
|
package com.xjrsoft.module.sales.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||||
|
import com.pictc.enums.BusinessCode;
|
||||||
|
import com.xjrsoft.common.exception.BusinessException;
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
|
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomerGroupCustomer;
|
|
||||||
import com.xjrsoft.module.sales.mapper.LngCustomerGroupCustomerMapper;
|
|
||||||
import com.xjrsoft.module.sales.mapper.LngCustomerGroupMapper;
|
import com.xjrsoft.module.sales.mapper.LngCustomerGroupMapper;
|
||||||
import com.xjrsoft.module.sales.service.ICustomerGroupService;
|
import com.xjrsoft.module.sales.service.ICustomerGroupService;
|
||||||
|
import com.xjrsoft.module.sales.vo.LngCustomerGroupCustomerVo;
|
||||||
|
import com.xjrsoft.module.sales.vo.LngCustomerGroupVo;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: service
|
* @title: service
|
||||||
@ -24,65 +24,19 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CustomerGroupServiceImpl extends MPJBaseServiceImpl<LngCustomerGroupMapper, LngCustomerGroup> implements ICustomerGroupService {
|
public class CustomerGroupServiceImpl extends MPJBaseServiceImpl<LngCustomerGroupMapper, LngCustomerGroup> implements ICustomerGroupService {
|
||||||
private final LngCustomerGroupMapper customerGroupLngCustomerGroupMapper;
|
|
||||||
|
|
||||||
private final LngCustomerGroupCustomerMapper customerGroupLngCustomerGroupCustomerMapper;
|
|
||||||
|
|
||||||
|
private final LngCustomerGroupMapper lngCustomerGroupMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
public LngCustomerGroupVo info(Long id) {
|
||||||
public Boolean add(LngCustomerGroup lngCustomerGroup) {
|
LngCustomerGroup lngCustomerGroup = lngCustomerGroupMapper.selectById(id);
|
||||||
customerGroupLngCustomerGroupMapper.insert(lngCustomerGroup);
|
if (Objects.isNull(lngCustomerGroup)) {
|
||||||
for (LngCustomerGroupCustomer lngCustomerGroupCustomer : lngCustomerGroup.getLngCustomerGroupCustomerList()) {
|
throw new BusinessException(BusinessCode.of(10500, "找不到此数据!"));
|
||||||
lngCustomerGroupCustomer.setGrpCode(lngCustomerGroup.getGrpCode());
|
|
||||||
customerGroupLngCustomerGroupCustomerMapper.insert(lngCustomerGroupCustomer);
|
|
||||||
}
|
}
|
||||||
|
LngCustomerGroupVo lngCustomerGroupVo = new LngCustomerGroupVo();
|
||||||
return true;
|
BeanUtils.copyProperties(lngCustomerGroup, lngCustomerGroupVo);
|
||||||
}
|
List<LngCustomerGroupCustomerVo> list = lngCustomerGroupMapper.queryCustomerList(lngCustomerGroupVo.getGrpCode());
|
||||||
|
lngCustomerGroupVo.setLngCustomerGroupCustomerList(list);
|
||||||
@Override
|
return lngCustomerGroupVo;
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Boolean update(LngCustomerGroup lngCustomerGroup) {
|
|
||||||
customerGroupLngCustomerGroupMapper.updateById(lngCustomerGroup);
|
|
||||||
//********************************* LngCustomerGroupCustomer 增删改 开始 *******************************************/
|
|
||||||
{
|
|
||||||
// 查出所有子级的id
|
|
||||||
List<LngCustomerGroupCustomer> lngCustomerGroupCustomerList = customerGroupLngCustomerGroupCustomerMapper.selectList(Wrappers.lambdaQuery(LngCustomerGroupCustomer.class).eq(LngCustomerGroupCustomer::getGrpCode, lngCustomerGroup.getGrpCode()).select(LngCustomerGroupCustomer::getId));
|
|
||||||
List<String> lngCustomerGroupCustomerIds = lngCustomerGroupCustomerList.stream().map(LngCustomerGroupCustomer::getId).collect(Collectors.toList());
|
|
||||||
//原有子表单 没有被删除的主键
|
|
||||||
List<String> lngCustomerGroupCustomerOldIds = lngCustomerGroup.getLngCustomerGroupCustomerList().stream().map(LngCustomerGroupCustomer::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
//找到需要删除的id
|
|
||||||
List<String> lngCustomerGroupCustomerRemoveIds = lngCustomerGroupCustomerIds.stream().filter(item -> !lngCustomerGroupCustomerOldIds.contains(item)).collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (LngCustomerGroupCustomer lngCustomerGroupCustomer : lngCustomerGroup.getLngCustomerGroupCustomerList()) {
|
|
||||||
//如果不等于空则修改
|
|
||||||
if (lngCustomerGroupCustomer.getId() != null) {
|
|
||||||
customerGroupLngCustomerGroupCustomerMapper.updateById(lngCustomerGroupCustomer);
|
|
||||||
}
|
|
||||||
//如果等于空 则新增
|
|
||||||
else {
|
|
||||||
//已经不存在的id 删除
|
|
||||||
lngCustomerGroupCustomer.setGrpCode(lngCustomerGroup.getGrpCode());
|
|
||||||
customerGroupLngCustomerGroupCustomerMapper.insert(lngCustomerGroupCustomer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//已经不存在的id 删除
|
|
||||||
if(lngCustomerGroupCustomerRemoveIds.size() > 0){
|
|
||||||
customerGroupLngCustomerGroupCustomerMapper.deleteBatchIds(lngCustomerGroupCustomerRemoveIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//********************************* LngCustomerGroupCustomer 增删改 结束 *******************************************/
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Boolean delete(List<Long> ids) {
|
|
||||||
customerGroupLngCustomerGroupMapper.deleteBatchIds(ids);
|
|
||||||
customerGroupLngCustomerGroupCustomerMapper.delete(Wrappers.lambdaQuery(LngCustomerGroupCustomer.class).in(LngCustomerGroupCustomer::getGrpCode, ids));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,11 @@
|
|||||||
package com.xjrsoft.module.sales.service.impl;
|
package com.xjrsoft.module.sales.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||||
import com.xjrsoft.module.sales.entity.LngGradeSystem;
|
import com.xjrsoft.module.sales.entity.LngGradeSystem;
|
||||||
import com.xjrsoft.module.sales.entity.LngGradeSystemItem;
|
|
||||||
import com.xjrsoft.module.sales.mapper.LngGradeSystemItemMapper;
|
|
||||||
import com.xjrsoft.module.sales.mapper.LngGradeSystemMapper;
|
import com.xjrsoft.module.sales.mapper.LngGradeSystemMapper;
|
||||||
import com.xjrsoft.module.sales.service.IGradeSystemService;
|
import com.xjrsoft.module.sales.service.IGradeSystemService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: service
|
* @title: service
|
||||||
@ -24,65 +16,5 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class GradeSystemServiceImpl extends MPJBaseServiceImpl<LngGradeSystemMapper, LngGradeSystem> implements IGradeSystemService {
|
public class GradeSystemServiceImpl extends MPJBaseServiceImpl<LngGradeSystemMapper, LngGradeSystem> implements IGradeSystemService {
|
||||||
private final LngGradeSystemMapper gradeSystemLngGradeSystemMapper;
|
|
||||||
|
|
||||||
private final LngGradeSystemItemMapper gradeSystemLngGradeSystemItemMapper;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Boolean add(LngGradeSystem lngGradeSystem) {
|
|
||||||
gradeSystemLngGradeSystemMapper.insert(lngGradeSystem);
|
|
||||||
for (LngGradeSystemItem lngGradeSystemItem : lngGradeSystem.getLngGradeSystemItemList()) {
|
|
||||||
lngGradeSystemItem.setGsId(lngGradeSystem.getId());
|
|
||||||
gradeSystemLngGradeSystemItemMapper.insert(lngGradeSystemItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Boolean update(LngGradeSystem lngGradeSystem) {
|
|
||||||
gradeSystemLngGradeSystemMapper.updateById(lngGradeSystem);
|
|
||||||
//********************************* LngGradeSystemItem 增删改 开始 *******************************************/
|
|
||||||
{
|
|
||||||
// 查出所有子级的id
|
|
||||||
List<LngGradeSystemItem> lngGradeSystemItemList = gradeSystemLngGradeSystemItemMapper.selectList(Wrappers.lambdaQuery(LngGradeSystemItem.class).eq(LngGradeSystemItem::getGsId, lngGradeSystem.getId()).select(LngGradeSystemItem::getId));
|
|
||||||
List<Long> lngGradeSystemItemIds = lngGradeSystemItemList.stream().map(LngGradeSystemItem::getId).collect(Collectors.toList());
|
|
||||||
//原有子表单 没有被删除的主键
|
|
||||||
List<Long> lngGradeSystemItemOldIds = lngGradeSystem.getLngGradeSystemItemList().stream().map(LngGradeSystemItem::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
//找到需要删除的id
|
|
||||||
List<Long> lngGradeSystemItemRemoveIds = lngGradeSystemItemIds.stream().filter(item -> !lngGradeSystemItemOldIds.contains(item)).collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (LngGradeSystemItem lngGradeSystemItem : lngGradeSystem.getLngGradeSystemItemList()) {
|
|
||||||
//如果不等于空则修改
|
|
||||||
if (lngGradeSystemItem.getId() != null) {
|
|
||||||
gradeSystemLngGradeSystemItemMapper.updateById(lngGradeSystemItem);
|
|
||||||
}
|
|
||||||
//如果等于空 则新增
|
|
||||||
else {
|
|
||||||
//已经不存在的id 删除
|
|
||||||
lngGradeSystemItem.setGsId(lngGradeSystem.getId());
|
|
||||||
gradeSystemLngGradeSystemItemMapper.insert(lngGradeSystemItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//已经不存在的id 删除
|
|
||||||
if(lngGradeSystemItemRemoveIds.size() > 0){
|
|
||||||
gradeSystemLngGradeSystemItemMapper.deleteBatchIds(lngGradeSystemItemRemoveIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//********************************* LngGradeSystemItem 增删改 结束 *******************************************/
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Boolean delete(List<Long> ids) {
|
|
||||||
gradeSystemLngGradeSystemMapper.deleteBatchIds(ids);
|
|
||||||
gradeSystemLngGradeSystemItemMapper.delete(Wrappers.lambdaQuery(LngGradeSystemItem.class).in(LngGradeSystemItem::getGsId, ids));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user