Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2025-12-18 15:57:11 +08:00
17 changed files with 254 additions and 312 deletions

View File

@ -18,8 +18,8 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<libServerUrl>http://10.10.2.102:9500</libServerUrl>
<libServerUser>admin</libServerUser>
<libServerPwd>Gas@Dev123</libServerPwd>
<libServerUser>pcitc</libServerUser>
<libServerPwd>K9$pQ3!zX7@rT2&amp;w</libServerPwd>
<ignoreUpload>false</ignoreUpload>
</properties>

View File

@ -18,7 +18,9 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<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>
<libServerUser>pcitc</libServerUser>
<libServerPwd>K9$pQ3!zX7@rT2&amp;w</libServerPwd>
<ignoreUpload>false</ignoreUpload>
</properties>
@ -83,22 +85,6 @@
<build>
<finalName>app</finalName>
<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>
<groupId>com.geg</groupId>
<artifactId>tanuki-boot-maven-plugin</artifactId>
@ -108,6 +94,7 @@
<ignoreUpload>${ignoreUpload}</ignoreUpload>
<libServerUser>${libServerUser}</libServerUser>
<libServerPwd>${libServerPwd}</libServerPwd>
<appName>demo-service</appName>
</configuration>
<executions>
<execution>

View File

@ -1,62 +1,16 @@
package com.pictc.utils;
import java.io.Serializable;
import java.math.BigDecimal;
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 cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import com.pictc.annotations.datalog.JoinCaseType;
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.annotations.datalog.*;
import com.pictc.converts.ConverUtil;
import com.pictc.datalog.DataOperationContent;
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.datalog.*;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.exceptions.OrmException;
@ -65,7 +19,6 @@ import com.pictc.jdbc.ResultSetUtils;
import com.pictc.jdbc.model.JdbcParam;
import com.xjrsoft.common.exception.BusinessException;
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.json.FieldChange;
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.dto.LngFileUploadBindDto;
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.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
@SuppressWarnings({"unused","rawtypes","unchecked"})
@ -261,7 +227,7 @@ public class DataLogTools {
buildFields(datalog,tabInfo,dto,old);
logs.add(datalog);
List<LogJoinInfo> joins = tabInfo.getJoins();
if(!CollectionUtils.isNotEmpty(joins)) {
if(CollectionUtils.isNotEmpty(joins)) {
for (LogJoinInfo join : joins) {
if(join.getJoin().caseType()==JoinCaseType.FULL) {
buildJoins(logs,datalog,OperationType.UPDATE,tabInfo,join,dto);
@ -316,7 +282,7 @@ public class DataLogTools {
logs.add(datalog);
delete(entity, tabInfo, mapper);
List<LogJoinInfo> joins = tabInfo.getJoins();
if(!CollectionUtils.isNotEmpty(joins)) {
if(CollectionUtils.isNotEmpty(joins)) {
for (LogJoinInfo join : joins) {
if(join.getJoin().caseType()==JoinCaseType.FULL) {
buildJoins(logs,datalog,OperationType.DELETE,tabInfo,join,entity);
@ -377,7 +343,7 @@ public class DataLogTools {
buildFields(datalog,tabInfo,entity,null);
logs.add(datalog);
List<LogJoinInfo> joins = tabInfo.getJoins();
if(!CollectionUtils.isNotEmpty(joins)) {
if(CollectionUtils.isNotEmpty(joins)) {
for (LogJoinInfo join : joins) {
if(join.getJoin().caseType()==JoinCaseType.FULL) {
buildJoins(logs,datalog,OperationType.DELETE,tabInfo,join,entity);
@ -525,7 +491,7 @@ public class DataLogTools {
Object old = mapper.selectById(id);
if(old==null) return null;
T dto = (T) tabInfo.toDto(old);
initJoinValues(tabInfo,dto,SetUtils.of(klazz), full);
// initJoinValues(tabInfo,dto,SetUtils.of(klazz), full);
return dto;
}
@ -539,7 +505,7 @@ public class DataLogTools {
public static void initJoinValues(LogTableInfo tabInfo,Object entity,Set<Class<?>> classPath,boolean full){
List<LogJoinInfo> joins = tabInfo.getJoins();
BaseMapper mapper = MybatisTools.getMapper(tabInfo.getEntityType());
if(!CollectionUtils.isNotEmpty(joins)) {
if(CollectionUtils.isNotEmpty(joins)) {
for (LogJoinInfo join : joins) {
LogTableInfo joinTable = join.getTableInfo();
if(full) {

View File

@ -1,23 +1,12 @@
package com.xjrsoft.module.sales.dto;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogTable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
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)
@ApiModelProperty("主键")
private String id;
private Long id;
/**
* 组编码
*/

View File

@ -6,8 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
@ -71,6 +70,30 @@ public class UpdateLngGradeSystemItemDto implements Serializable {
@ApiModelProperty("备注")
private String note;
/**
* 创建人id
*/
@ApiModelProperty("创建人id")
private Long createUserId;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private LocalDateTime createDate;
/**
* 修改人id
*/
@ApiModelProperty("修改人id")
private Long modifyUserId;
/**
* 修改时间
*/
@ApiModelProperty("修改时间")
private LocalDateTime modifyDate;
/**
* 租户id
*/
@ -78,5 +101,17 @@ public class UpdateLngGradeSystemItemDto implements Serializable {
@ApiModelProperty("租户id")
private Long tenantId;
/**
* 部门id
*/
@ApiModelProperty("部门id")
private Long deptId;
/**
* 数据权限id
*/
@ApiModelProperty("数据权限id")
private Long ruleUserId;
}

View File

@ -3,10 +3,7 @@ package com.xjrsoft.module.sales.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.util.List;
/**
* @title: 表单出参
@ -21,7 +18,7 @@ public class LngCustomerGroupCustomerVo {
* 主键
*/
@ApiModelProperty("主键")
private String id;
private Long id;
/**
* 组编码
*/
@ -73,6 +70,27 @@ public class LngCustomerGroupCustomerVo {
@ApiModelProperty("数据权限id")
private Long ruleUserId;
/**
* 客户名称
*/
@ApiModelProperty("客户名称")
private String cuName;
/**
* 国内/国际
*/
@ApiModelProperty("国内/国际")
private String diName;
/**
* 客户类别
*/
@ApiModelProperty("客户类别")
private String typeName;
/**
* 客户分类
*/
@ApiModelProperty("客户分类")
private String className;
}

View File

@ -1,14 +1,12 @@
package com.xjrsoft.module.sales.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjrsoft.common.annotation.Trans;
import com.xjrsoft.common.enums.TransType;
import io.swagger.annotations.ApiModelProperty;
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.math.BigDecimal;
/**
* @title: 分页列表出参
@ -23,7 +21,7 @@ public class LngCustomerGroupPageVo {
* 主键
*/
@ApiModelProperty("主键")
private String id;
private Long id;
/**
* 组编码(按类型自动编码)
*/

View File

@ -48,16 +48,10 @@ public class LngGradeSystemItemVo {
* 评价部门编码
*/
@ApiModelProperty("评价部门编码")
@Trans(type = TransType.DEPT, labelField = "eDeptName")
@Trans(type = TransType.DEPT, transToFieldName = "eDeptName")
private String eDeptCode;
/**
* 评价部门编码
*/
@ApiModelProperty("评价部门名称")
private String eDeptName;
/**
* 显示顺序
*/

View File

@ -1,22 +1,31 @@
package com.xjrsoft.module.sales.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil;
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.UpdateLngCustomerGroupDto;
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
import com.xjrsoft.module.sales.service.ICustomerGroupService;
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.ApiOperation;
import lombok.AllArgsConstructor;
@ -40,21 +49,21 @@ public class CustomerGroupController {
private final ICustomerGroupService customerGroupService;
private final DatalogService dataService;
private final ICodeRuleClient codeRuleClient;
private final String GRP_CODE = "grpCode";
@GetMapping(value = "/page")
// @GetMapping(value = "/page")
@ApiOperation(value="LngCustomerGroup列表(分页)")
@SaCheckPermission("customerGroup:list")
public R page(@Valid LngCustomerGroupPageDto dto){
LambdaQueryWrapper<LngCustomerGroup> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper
.like(StrUtil.isNotBlank(dto.getGrpCode()),LngCustomerGroup::getGrpCode,dto.getGrpCode())
.like(StrUtil.isNotBlank(dto.getTypeCode()),LngCustomerGroup::getTypeCode,dto.getTypeCode())
.eq(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.getDateToStart()) && ObjectUtil.isNotNull(dto.getDateToEnd()),LngCustomerGroup::getDateTo,dto.getDateToStart(),dto.getDateToEnd())
.like(StrUtil.isNotBlank(dto.getGrpName()),LngCustomerGroup::getGrpName,dto.getGrpName())
.like(StrUtil.isNotBlank(dto.getNote()),LngCustomerGroup::getNote,dto.getNote())
.orderByDesc(LngCustomerGroup::getId)
.orderByAsc(LngCustomerGroup::getGrpCode)
.select(LngCustomerGroup.class,x -> VoToColumnUtil.fieldsToColumns(LngCustomerGroupPageVo.class).contains(x.getProperty()));
IPage<LngCustomerGroup> page = customerGroupService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngCustomerGroupPageVo> pageOutput = ConventPage.getPageOutput(page, LngCustomerGroupPageVo.class);
@ -65,35 +74,96 @@ public class CustomerGroupController {
@ApiOperation(value="根据id查询LngCustomerGroup信息")
@SaCheckPermission("customerGroup:detail")
public R info(@RequestParam Long id){
LngCustomerGroup lngCustomerGroup = customerGroupService.getByIdDeep(id);
if (lngCustomerGroup == null) {
return R.error("找不到此数据!");
}
return R.ok(BeanUtil.toBean(lngCustomerGroup, LngCustomerGroupVo.class));
return R.ok(customerGroupService.info(id));
}
@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
@ApiOperation(value = "新增LngCustomerGroup")
@SaCheckPermission("customerGroup:add")
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());
}
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
@ApiOperation(value = "修改LngCustomerGroup")
@SaCheckPermission("customerGroup:edit")
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
@ApiOperation(value = "删除")
@SaCheckPermission("customerGroup:delete")
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;
}
}));
}
}

View File

@ -5,6 +5,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
@ -111,7 +113,17 @@ public class GradeSystemController {
@ApiOperation(value = "启用LngGradeSystem")
@SaCheckPermission("gradeSystem:enable")
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")
@SaCheckPermission("gradeSystem:disable")
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;
}
}));
}

View File

@ -30,7 +30,7 @@ public class LngCustomerGroupCustomer implements Serializable {
*/
@ApiModelProperty("主键")
@TableId
private String id;
private Long id;
/**
* 组编码
*/

View File

@ -1,5 +1,6 @@
package com.xjrsoft.module.sales.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.xjrsoft.module.sales.entity.LngCustomerGroupCustomer;
import org.apache.ibatis.annotations.Mapper;
@ -11,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
* @Version 1.0
*/
@Mapper
public interface LngCustomerGroupCustomerMapper extends MPJBaseMapper<LngCustomerGroupCustomer> {
public interface LngCustomerGroupCustomerMapper extends MPJBaseMapper<LngCustomerGroupCustomer>, BaseMapper<LngCustomerGroupCustomer> {
}

View File

@ -3,7 +3,12 @@ package com.xjrsoft.module.sales.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
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.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @title: mapper
@ -12,6 +17,17 @@ import org.apache.ibatis.annotations.Mapper;
* @Version 1.0
*/
@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);
}

View File

@ -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.MPJRelationService;
import com.xjrsoft.module.sales.entity.LngCustomerGroup;
import java.util.List;
import com.xjrsoft.module.sales.vo.LngCustomerGroupVo;
/**
* @title: service
@ -15,27 +14,12 @@ import java.util.List;
*/
public interface ICustomerGroupService extends MPJBaseService<LngCustomerGroup>, MPJDeepService<LngCustomerGroup>, MPJRelationService<LngCustomerGroup> {
/**
* 新增
*
* @param lngCustomerGroup
* @return
*/
Boolean add(LngCustomerGroup lngCustomerGroup);
/**
* 更新
* 详情
*
* @param lngCustomerGroup
* @param id
* @return
*/
Boolean update(LngCustomerGroup lngCustomerGroup);
/**
* 删除
*
* @param ids
* @return
*/
Boolean delete(List<Long> ids);
LngCustomerGroupVo info(Long id);
}

View File

@ -5,8 +5,6 @@ import com.github.yulichang.extension.mapping.base.MPJDeepService;
import com.github.yulichang.extension.mapping.base.MPJRelationService;
import com.xjrsoft.module.sales.entity.LngGradeSystem;
import java.util.List;
/**
* @title: service
* @Author 管理员
@ -15,27 +13,5 @@ import java.util.List;
*/
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);
}

View File

@ -1,19 +1,19 @@
package com.xjrsoft.module.sales.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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.LngCustomerGroupCustomer;
import com.xjrsoft.module.sales.mapper.LngCustomerGroupCustomerMapper;
import com.xjrsoft.module.sales.mapper.LngCustomerGroupMapper;
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 org.springframework.beans.BeanUtils;
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
@ -24,65 +24,19 @@ import java.util.stream.Collectors;
@Service
@AllArgsConstructor
public class CustomerGroupServiceImpl extends MPJBaseServiceImpl<LngCustomerGroupMapper, LngCustomerGroup> implements ICustomerGroupService {
private final LngCustomerGroupMapper customerGroupLngCustomerGroupMapper;
private final LngCustomerGroupCustomerMapper customerGroupLngCustomerGroupCustomerMapper;
private final LngCustomerGroupMapper lngCustomerGroupMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean add(LngCustomerGroup lngCustomerGroup) {
customerGroupLngCustomerGroupMapper.insert(lngCustomerGroup);
for (LngCustomerGroupCustomer lngCustomerGroupCustomer : lngCustomerGroup.getLngCustomerGroupCustomerList()) {
lngCustomerGroupCustomer.setGrpCode(lngCustomerGroup.getGrpCode());
customerGroupLngCustomerGroupCustomerMapper.insert(lngCustomerGroupCustomer);
public LngCustomerGroupVo info(Long id) {
LngCustomerGroup lngCustomerGroup = lngCustomerGroupMapper.selectById(id);
if (Objects.isNull(lngCustomerGroup)) {
throw new BusinessException(BusinessCode.of(10500, "找不到此数据!"));
}
return true;
}
@Override
@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;
LngCustomerGroupVo lngCustomerGroupVo = new LngCustomerGroupVo();
BeanUtils.copyProperties(lngCustomerGroup, lngCustomerGroupVo);
List<LngCustomerGroupCustomerVo> list = lngCustomerGroupMapper.queryCustomerList(lngCustomerGroupVo.getGrpCode());
lngCustomerGroupVo.setLngCustomerGroupCustomerList(list);
return lngCustomerGroupVo;
}
}

View File

@ -1,19 +1,11 @@
package com.xjrsoft.module.sales.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl;
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.service.IGradeSystemService;
import lombok.AllArgsConstructor;
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
@ -24,65 +16,5 @@ import java.util.stream.Collectors;
@Service
@AllArgsConstructor
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;
}
}