客户管理

This commit is contained in:
2025-11-21 16:51:06 +08:00
parent e33f097105
commit 2cb153b332
15 changed files with 669 additions and 62 deletions

View File

@ -18,21 +18,21 @@ import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
public class DatalogServiceImpl implements DatalogService{ public class DatalogServiceImpl implements DatalogService{
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> T insert(T entity) { public <T> T insert(T entity) {
return DataLogTools.insert(entity); return DataLogTools.insert(entity);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> T insert(T entity, DataOperationListener<T> listener) { public <T> T insert(T entity, DataOperationListener<T> listener) {
return DataLogTools.insert(entity,listener); return DataLogTools.insert(entity,listener);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> List<T> insertBatch(List<T> entitys) { public <T> List<T> insertBatch(List<T> entitys) {
List<T> res = Lists.newArrayList(); List<T> res = Lists.newArrayList();
@ -43,7 +43,7 @@ public class DatalogServiceImpl implements DatalogService{
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> List<T> insertBatch(List<T> entitys, DataOperationListener<T> listener) { public <T> List<T> insertBatch(List<T> entitys, DataOperationListener<T> listener) {
List<T> res = Lists.newArrayList(); List<T> res = Lists.newArrayList();
@ -54,7 +54,7 @@ public class DatalogServiceImpl implements DatalogService{
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> boolean updateById(T entity) { public <T> boolean updateById(T entity) {
DataLogTools.update(entity); DataLogTools.update(entity);
@ -62,7 +62,7 @@ public class DatalogServiceImpl implements DatalogService{
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> boolean updateById(T entity, DataOperationListener<T> listener) { public <T> boolean updateById(T entity, DataOperationListener<T> listener) {
DataLogTools.update(entity,listener); DataLogTools.update(entity,listener);
@ -70,7 +70,7 @@ public class DatalogServiceImpl implements DatalogService{
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> T delete(T entity) { public <T> T delete(T entity) {
return DataLogTools.delete(entity); return DataLogTools.delete(entity);
@ -78,7 +78,7 @@ public class DatalogServiceImpl implements DatalogService{
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> T deleteById(Class<T> klazz, long id) { public <T> T deleteById(Class<T> klazz, long id) {
return DataLogTools.deleteById(klazz, id); return DataLogTools.deleteById(klazz, id);
@ -86,28 +86,28 @@ public class DatalogServiceImpl implements DatalogService{
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> T deleteById(Class<T> klazz, long id, DataOperationListener<T> listener) { public <T> T deleteById(Class<T> klazz, long id, DataOperationListener<T> listener) {
return DataLogTools.deleteById(klazz,id,listener); return DataLogTools.deleteById(klazz,id,listener);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> boolean deleteByIds(Class<T> klazz, @Valid List<Long> ids) { public <T> boolean deleteByIds(Class<T> klazz, @Valid List<Long> ids) {
return DataLogTools.deleteByIds(klazz, ids); return DataLogTools.deleteByIds(klazz, ids);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> boolean deleteByIds(Class<T> klazz, @Valid List<Long> ids, DataOperationListener<T> listener) { public <T> boolean deleteByIds(Class<T> klazz, @Valid List<Long> ids, DataOperationListener<T> listener) {
return DataLogTools.deleteByIds(klazz,ids,listener); return DataLogTools.deleteByIds(klazz,ids,listener);
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> List<DataChangeLogVo> findLogsByEntityId(Class<T> klazz, long dataId) { public <T> List<DataChangeLogVo> findLogsByEntityId(Class<T> klazz, long dataId) {
return DataLogTools.findLogsByEntityId(klazz, dataId); return DataLogTools.findLogsByEntityId(klazz, dataId);
@ -115,28 +115,28 @@ public class DatalogServiceImpl implements DatalogService{
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> boolean enable(Class<T> klazz, @Valid List<Long> ids) { public <T> boolean enable(Class<T> klazz, @Valid List<Long> ids) {
return DataLogTools.enable(klazz, ids); return DataLogTools.enable(klazz, ids);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> boolean enable(Class<T> klazz, @Valid List<Long> ids, DataOperationListener<T> listener) { public <T> boolean enable(Class<T> klazz, @Valid List<Long> ids, DataOperationListener<T> listener) {
return DataLogTools.enable(klazz,ids,listener); return DataLogTools.enable(klazz,ids,listener);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> boolean disable(Class<T> klazz, @Valid List<Long> ids) { public <T> boolean disable(Class<T> klazz, @Valid List<Long> ids) {
return DataLogTools.disable(klazz, ids); return DataLogTools.disable(klazz, ids);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解 //@GlobalTransactional(rollbackFor = Exception.class) // Seata全局事务注解
@Override @Override
public <T> boolean disable(Class<T> klazz, @Valid List<Long> ids, DataOperationListener<T> listener) { public <T> boolean disable(Class<T> klazz, @Valid List<Long> ids, DataOperationListener<T> listener) {
return DataLogTools.disable(klazz,ids,listener); return DataLogTools.disable(klazz,ids,listener);

View File

@ -226,4 +226,10 @@ public class AddLngCustomerDto implements Serializable {
*/ */
@ApiModelProperty("lngCustomerContact子表") @ApiModelProperty("lngCustomerContact子表")
private List<AddLngCustomerContactDto> lngCustomerContactList; private List<AddLngCustomerContactDto> lngCustomerContactList;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
private List<AddLngFileUploadDto> lngFileUploadList;
} }

View File

@ -0,0 +1,86 @@
package com.xjrsoft.module.sales.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.util.List;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogTable;
/**
* @title: 客户
* @Author 管理员
* @Date: 2025-11-21
* @Version 1.0
*/
@Data
@LogTable(source="lng_file_upload",name="客户")
public class AddLngFileUploadDto implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@ApiModelProperty("")
@LogField(name="",index=0)
private String tableName;
/**
*
*/
@ApiModelProperty("")
@LogField(name="",index=0)
private Long tableId;
/**
*
*/
@ApiModelProperty("")
@LogField(name="",index=0)
private String columnName;
/**
*
*/
@ApiModelProperty("")
@LogField(name="",index=0)
private String fileOrg;
/**
*
*/
@ApiModelProperty("")
@LogField(name="",index=0)
private String filePath;
/**
*
*/
@ApiModelProperty("")
@LogField(name="",index=0)
private Long filesize;
/**
*
*/
@ApiModelProperty("")
@LogField(name="",index=0)
private String docDesc;
/**
*
*/
@ApiModelProperty("")
@LogField(name="",index=0)
private Short sort;
/**
*
*/
@ApiModelProperty("")
@LogField(name="",index=0)
private Long tenantId;
}

View File

@ -96,5 +96,6 @@ public class UpdateLngCustomerDocDto implements Serializable {
@ApiModelProperty("租户id") @ApiModelProperty("租户id")
private Long tenantId; private Long tenantId;
private String filePath;
} }

View File

@ -288,4 +288,15 @@ public class UpdateLngCustomerDto implements Serializable {
}, },
caseType = JoinCaseType.FULL, target = UpdateLngCustomerContactDto.class, type = JoinType.MANY) caseType = JoinCaseType.FULL, target = UpdateLngCustomerContactDto.class, type = JoinType.MANY)
private List<UpdateLngCustomerContactDto> lngCustomerContactList; private List<UpdateLngCustomerContactDto> lngCustomerContactList;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
@LogJoin(name = "lngFileUpload子表",
columns = {
@LogJoinColumn(field = "tableId",relatedField = "id", valueDirection = ValueDirectionType.RIGHT)
},
caseType = JoinCaseType.FULL, target = UpdateLngFileUploadDto.class, type = JoinType.MANY)
private List<UpdateLngFileUploadDto> lngFileUploadList;
} }

View File

@ -0,0 +1,107 @@
package com.xjrsoft.module.sales.dto;
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;
/**
* @title: 客户
* @Author 管理员
* @Date: 2025-11-21
* @Version 1.0
*/
@Data
@LogTable(source="lng_file_upload",name="客户")
public class UpdateLngFileUploadDto implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@LogField(name="",index=0)
@ApiModelProperty("")
private Long id;
/**
*
*/
@LogField(name="",index=1)
@ApiModelProperty("")
private String tableName;
/**
*
*/
@LogField(name="",index=2)
@ApiModelProperty("")
private Long tableId;
/**
*
*/
@LogField(name="",index=3)
@ApiModelProperty("")
private String columnName;
/**
*
*/
@LogField(name="",index=4)
@ApiModelProperty("")
private String fileOrg;
/**
*
*/
@LogField(name="",index=5)
@ApiModelProperty("")
private String filePath;
/**
*
*/
@LogField(name="",index=6)
@ApiModelProperty("")
private Long filesize;
/**
*
*/
@LogField(name="",index=7)
@ApiModelProperty("")
private String docDesc;
/**
*
*/
@LogField(name="",index=8)
@ApiModelProperty("")
private Short sort;
/**
*
*/
@LogField(name="",index=9)
@ApiModelProperty("")
private Long tenantId;
}

View File

@ -297,5 +297,11 @@ public class LngCustomerVo {
*/ */
@ApiModelProperty("lngCustomerContact子表") @ApiModelProperty("lngCustomerContact子表")
private List<LngCustomerContactVo> lngCustomerContactList; private List<LngCustomerContactVo> lngCustomerContactList;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
private List<LngFileUploadVo> lngFileUploadList;
} }

View File

@ -0,0 +1,135 @@
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: 表单出参
* @Author 管理员
* @Date: 2025-11-21
* @Version 1.0
*/
@Data
public class LngFileUploadVo {
/**
*
*/
@ApiModelProperty("")
private Long id;
/**
*
*/
@ApiModelProperty("")
private String tableName;
/**
*
*/
@ApiModelProperty("")
private Long tableId;
/**
*
*/
@ApiModelProperty("")
private String columnName;
/**
*
*/
@ApiModelProperty("")
private String fileOrg;
/**
*
*/
@ApiModelProperty("")
private String filePath;
/**
*
*/
@ApiModelProperty("")
private Long filesize;
/**
*
*/
@ApiModelProperty("")
private String docDesc;
/**
*
*/
@ApiModelProperty("")
private Short sort;
/**
*
*/
@ApiModelProperty("")
private Long createUserId;
/**
*
*/
@ApiModelProperty("")
private LocalDateTime createDate;
/**
*
*/
@ApiModelProperty("")
private Long modifyUserId;
/**
*
*/
@ApiModelProperty("")
private LocalDateTime modifyDate;
/**
*
*/
@ApiModelProperty("")
private Long tenantId;
/**
*
*/
@ApiModelProperty("")
private Long deptId;
/**
*
*/
@ApiModelProperty("")
private Long ruleUserId;
}

View File

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
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.utils.CollectionUtils;
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;
@ -24,9 +25,11 @@ import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.mdm.dto.LngBDocCpPageDto; import com.xjrsoft.module.mdm.dto.LngBDocCpPageDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBDocCpDto; import com.xjrsoft.module.mdm.dto.UpdateLngBDocCpDto;
import com.xjrsoft.module.mdm.entity.LngBDocCp; import com.xjrsoft.module.mdm.entity.LngBDocCp;
import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.service.IDocCpService; import com.xjrsoft.module.mdm.service.IDocCpService;
import com.xjrsoft.module.mdm.vo.LngBDocCpPageVo; import com.xjrsoft.module.mdm.vo.LngBDocCpPageVo;
import com.xjrsoft.module.mdm.vo.LngBDocCpVo; import com.xjrsoft.module.mdm.vo.LngBDocCpVo;
import com.xjrsoft.module.mdm.vo.LngBRegionVo;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
@ -122,4 +125,25 @@ public class DocCpController {
public R disable(@Valid @RequestBody List<Long> ids){ public R disable(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.disable(UpdateLngBDocCpDto.class,ids)); return R.ok(dataService.disable(UpdateLngBDocCpDto.class,ids));
} }
@GetMapping(value = "/queryList")
@ApiOperation(value="LngBDocCp列表(不分页)")
public R list(UpdateLngBDocCpDto dto){
LambdaQueryWrapper<LngBDocCp> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper
.like(StrUtil.isNotBlank(dto.getFullName()), LngBDocCp::getFullName, dto.getFullName())
.eq(StrUtil.isNotBlank(dto.getValid()), LngBDocCp::getValid, dto.getValid())
.orderByDesc(LngBDocCp::getCode);
List<LngBDocCpVo> voList = CollectionUtils.newArrayList();
List<LngBDocCp> docList = docCpService.list(queryWrapper);
if(docList != null && docList.size() > 0) {
for(LngBDocCp doc:docList) {
LngBDocCpVo vo = new LngBDocCpVo();
BeanUtil.copyProperties(doc, vo);
voList.add(vo);
}
}
return R.ok(voList);
}
} }

View File

@ -148,7 +148,7 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
})); }));
List<LngBRegionVo> voList = CollectionUtils.newArrayList(); List<LngBRegionVo> voList = CollectionUtils.newArrayList();
if(voList != null && regionList.size() > 0) { if(regionList != null && regionList.size() > 0) {
for(LngBRegion br:regionList) { for(LngBRegion br:regionList) {
LngBRegionVo vo = new LngBRegionVo(); LngBRegionVo vo = new LngBRegionVo();
BeanUtil.copyProperties(br, vo); BeanUtil.copyProperties(br, vo);

View File

@ -15,6 +15,7 @@ import com.pictc.annotations.datalog.JoinType;
import com.pictc.annotations.datalog.LogJoin; import com.pictc.annotations.datalog.LogJoin;
import com.pictc.annotations.datalog.LogJoinColumn; import com.pictc.annotations.datalog.LogJoinColumn;
import com.pictc.annotations.datalog.ValueDirectionType; import com.pictc.annotations.datalog.ValueDirectionType;
import com.xjrsoft.module.sales.dto.UpdateLngFileUploadDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -272,8 +273,8 @@ public class LngCustomer implements Serializable {
@EntityMapping(thisField = "cuCode", joinField = "cuCode") @EntityMapping(thisField = "cuCode", joinField = "cuCode")
@LogJoin(name = "客户业务信息", @LogJoin(name = "客户业务信息",
columns = { columns = {
@LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.LEFT) @LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.RIGHT)
}, caseType = JoinCaseType.NONE, target = LngCustomerAttrPower.class, type = JoinType.MANY) }, caseType = JoinCaseType.FULL, target = LngCustomerAttrPower.class, type = JoinType.MANY)
private List<LngCustomerAttrPower> lngCustomerAttrPowerList; private List<LngCustomerAttrPower> lngCustomerAttrPowerList;
/** /**
* lngCustomerBank * lngCustomerBank
@ -283,8 +284,8 @@ public class LngCustomer implements Serializable {
@EntityMapping(thisField = "cuCode", joinField = "cuCode") @EntityMapping(thisField = "cuCode", joinField = "cuCode")
@LogJoin(name = "客户银行信息", @LogJoin(name = "客户银行信息",
columns = { columns = {
@LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.LEFT) @LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.RIGHT)
}, caseType = JoinCaseType.NONE, target = LngCustomerBank.class, type = JoinType.MANY) }, caseType = JoinCaseType.FULL, target = LngCustomerBank.class, type = JoinType.MANY)
private List<LngCustomerBank> lngCustomerBankList; private List<LngCustomerBank> lngCustomerBankList;
/** /**
@ -295,8 +296,8 @@ public class LngCustomer implements Serializable {
@EntityMapping(thisField = "cuCode", joinField = "cuCode") @EntityMapping(thisField = "cuCode", joinField = "cuCode")
@LogJoin(name = "客户证书信息", @LogJoin(name = "客户证书信息",
columns = { columns = {
@LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.LEFT) @LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.RIGHT)
}, caseType = JoinCaseType.NONE, target = LngCustomerDoc.class, type = JoinType.MANY) }, caseType = JoinCaseType.FULL, target = LngCustomerDoc.class, type = JoinType.MANY)
private List<LngCustomerDoc> lngCustomerDocList; private List<LngCustomerDoc> lngCustomerDocList;
/** /**
@ -307,9 +308,23 @@ public class LngCustomer implements Serializable {
@EntityMapping(thisField = "cuCode", joinField = "cuCode") @EntityMapping(thisField = "cuCode", joinField = "cuCode")
@LogJoin(name = "客户联系人信息", @LogJoin(name = "客户联系人信息",
columns = { columns = {
@LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.LEFT) @LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.RIGHT)
}, caseType = JoinCaseType.NONE, target = LngCustomerContact.class, type = JoinType.MANY) }, caseType = JoinCaseType.FULL, target = LngCustomerContact.class, type = JoinType.MANY)
private List<LngCustomerContact> lngCustomerContactList; private List<LngCustomerContact> lngCustomerContactList;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
@TableField(exist = false)
@EntityMapping(thisField = "id", joinField = "tableId")
@LogJoin(name = "lngFileUpload子表",
columns = {
@LogJoinColumn(field = "tableId",relatedField = "id", valueDirection = ValueDirectionType.RIGHT)
},
caseType = JoinCaseType.FULL, target = UpdateLngFileUploadDto.class, type = JoinType.MANY)
private List<LngFileUpload> lngFileUploadList;
} }

View File

@ -0,0 +1,138 @@
package com.xjrsoft.module.sales.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.Version;
import com.github.yulichang.annotation.EntityMapping;
import io.swagger.annotations.ApiModel;
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 java.util.List;
/**
* @title: 客户
* @Author 管理员
* @Date: 2025-11-21
* @Version 1.0
*/
@Data
@TableName("lng_file_upload")
@ApiModel(value = "客户对象", description = "客户")
public class LngFileUpload implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@ApiModelProperty("")
@TableId
private Long id;
/**
*
*/
@ApiModelProperty("")
private String tableName;
/**
*
*/
@ApiModelProperty("")
private Long tableId;
/**
*
*/
@ApiModelProperty("")
private String columnName;
/**
*
*/
@ApiModelProperty("")
private String fileOrg;
/**
*
*/
@ApiModelProperty("")
private String filePath;
/**
*
*/
@ApiModelProperty("")
private Long filesize;
/**
*
*/
@ApiModelProperty("")
private String docDesc;
/**
*
*/
@ApiModelProperty("")
private Short sort;
/**
*
*/
@ApiModelProperty("")
@TableField(fill = FieldFill.INSERT)
private Long createUserId;
/**
*
*/
@ApiModelProperty("")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate;
/**
*
*/
@ApiModelProperty("")
@TableField(fill = FieldFill.UPDATE)
private Long modifyUserId;
/**
*
*/
@ApiModelProperty("")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime modifyDate;
/**
*
*/
@ApiModelProperty("")
private Long tenantId;
/**
*
*/
@ApiModelProperty("")
@TableField(fill = FieldFill.INSERT)
private Long deptId;
/**
*
*/
@ApiModelProperty("")
@TableField(fill = FieldFill.INSERT)
private Long ruleUserId;
}

View File

@ -0,0 +1,17 @@
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.LngFileUpload;
import org.apache.ibatis.annotations.Mapper;
/**
* @title: mapper
* @Author 管理员
* @Date: 2025-11-21
* @Version 1.0
*/
@Mapper
public interface LngFileUploadMapper extends MPJBaseMapper<LngFileUpload> {
}

View File

@ -2,11 +2,13 @@ package com.xjrsoft.module.sales.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
import com.pictc.utils.StringUtils;
import com.xjrsoft.module.sales.entity.LngCustomerAttrPower; import com.xjrsoft.module.sales.entity.LngCustomerAttrPower;
import com.xjrsoft.module.sales.mapper.LngCustomerAttrPowerMapper; import com.xjrsoft.module.sales.mapper.LngCustomerAttrPowerMapper;
import com.xjrsoft.module.sales.entity.LngCustomerBank; import com.xjrsoft.module.sales.entity.LngCustomerBank;
import com.xjrsoft.module.sales.mapper.LngCustomerBankMapper; import com.xjrsoft.module.sales.mapper.LngCustomerBankMapper;
import com.xjrsoft.module.sales.entity.LngCustomerDoc; import com.xjrsoft.module.sales.entity.LngCustomerDoc;
import com.xjrsoft.module.sales.entity.LngFileUpload;
import com.xjrsoft.module.sales.mapper.LngCustomerDocMapper; import com.xjrsoft.module.sales.mapper.LngCustomerDocMapper;
import com.xjrsoft.module.sales.entity.LngCustomerContact; import com.xjrsoft.module.sales.entity.LngCustomerContact;
import com.xjrsoft.module.sales.mapper.LngCustomerContactMapper; import com.xjrsoft.module.sales.mapper.LngCustomerContactMapper;
@ -15,8 +17,10 @@ import com.xjrsoft.module.sales.dto.UpdateLngCustomerBankDto;
import com.xjrsoft.module.sales.dto.UpdateLngCustomerContactDto; import com.xjrsoft.module.sales.dto.UpdateLngCustomerContactDto;
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDocDto; import com.xjrsoft.module.sales.dto.UpdateLngCustomerDocDto;
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto; import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
import com.xjrsoft.module.sales.dto.UpdateLngFileUploadDto;
import com.xjrsoft.module.sales.entity.LngCustomer; import com.xjrsoft.module.sales.entity.LngCustomer;
import com.xjrsoft.module.sales.mapper.LngCustomerMapper; import com.xjrsoft.module.sales.mapper.LngCustomerMapper;
import com.xjrsoft.module.sales.mapper.LngFileUploadMapper;
import com.xjrsoft.module.sales.service.ICustomerService; import com.xjrsoft.module.sales.service.ICustomerService;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
@ -37,12 +41,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, LngCustomer> implements ICustomerService { public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, LngCustomer> implements ICustomerService {
private final LngCustomerMapper customerLngCustomerMapper; private final LngCustomerMapper lngCustomerMapper;
private final LngCustomerAttrPowerMapper customerLngCustomerAttrPowerMapper; private final LngCustomerAttrPowerMapper lngCustomerAttrPowerMapper;
private final LngCustomerBankMapper customerLngCustomerBankMapper; private final LngCustomerBankMapper lngCustomerBankMapper;
private final LngCustomerDocMapper customerLngCustomerDocMapper; private final LngCustomerDocMapper lngCustomerDocMapper;
private final LngCustomerContactMapper customerLngCustomerContactMapper; private final LngCustomerContactMapper lngCustomerContactMapper;
private final LngFileUploadMapper lngFileUploadMapper;
@Override @Override
@ -51,32 +56,47 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
LngCustomer lngCustomer = new LngCustomer(); LngCustomer lngCustomer = new LngCustomer();
BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer); BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer);
customerLngCustomerMapper.insert(lngCustomer); lngCustomerMapper.insert(lngCustomer);
for (UpdateLngCustomerAttrPowerDto updateLngCustomerAttrPowerDto : updateLngCustomerDto.getLngCustomerAttrPowerList()) { for (UpdateLngCustomerAttrPowerDto updateLngCustomerAttrPowerDto : updateLngCustomerDto.getLngCustomerAttrPowerList()) {
LngCustomerAttrPower lngCustomerAttrPower = new LngCustomerAttrPower(); LngCustomerAttrPower lngCustomerAttrPower = new LngCustomerAttrPower();
BeanUtil.copyProperties(updateLngCustomerAttrPowerDto, lngCustomerAttrPower); BeanUtil.copyProperties(updateLngCustomerAttrPowerDto, lngCustomerAttrPower);
lngCustomerAttrPower.setCuCode(lngCustomer.getCuCode()); lngCustomerAttrPower.setCuCode(lngCustomer.getCuCode());
customerLngCustomerAttrPowerMapper.insert(lngCustomerAttrPower); lngCustomerAttrPowerMapper.insert(lngCustomerAttrPower);
} }
for (UpdateLngCustomerBankDto updateLngCustomerBankDto : updateLngCustomerDto.getLngCustomerBankList()) { for (UpdateLngCustomerBankDto updateLngCustomerBankDto : updateLngCustomerDto.getLngCustomerBankList()) {
LngCustomerBank lngCustomerBank = new LngCustomerBank(); LngCustomerBank lngCustomerBank = new LngCustomerBank();
BeanUtil.copyProperties(updateLngCustomerBankDto, lngCustomerBank); BeanUtil.copyProperties(updateLngCustomerBankDto, lngCustomerBank);
lngCustomerBank.setCuCode(lngCustomer.getCuCode()); lngCustomerBank.setCuCode(lngCustomer.getCuCode());
customerLngCustomerBankMapper.insert(lngCustomerBank); lngCustomerBankMapper.insert(lngCustomerBank);
} }
for (UpdateLngCustomerDocDto updateLngCustomerDocDto : updateLngCustomerDto.getLngCustomerDocList()) { for (UpdateLngCustomerDocDto updateLngCustomerDocDto : updateLngCustomerDto.getLngCustomerDocList()) {
LngCustomerDoc lngCustomerDoc = new LngCustomerDoc(); LngCustomerDoc lngCustomerDoc = new LngCustomerDoc();
BeanUtil.copyProperties(updateLngCustomerDocDto, lngCustomerDoc); BeanUtil.copyProperties(updateLngCustomerDocDto, lngCustomerDoc);
lngCustomerDoc.setCuCode(lngCustomer.getCuCode()); lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
customerLngCustomerDocMapper.insert(lngCustomerDoc); lngCustomerDocMapper.insert(lngCustomerDoc);
if(StringUtils.isNotEmpty(updateLngCustomerDocDto.getFilePath())) {
LngFileUpload lngFileUpload = new LngFileUpload();
lngFileUpload.setFilePath(updateLngCustomerDocDto.getFilePath());
lngFileUpload.setTableName("lng_customer_doc");
lngFileUpload.setTableId(lngCustomer.getId());
lngFileUploadMapper.insert(lngFileUpload);
}
} }
for (UpdateLngCustomerContactDto updateLngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) { for (UpdateLngCustomerContactDto updateLngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) {
LngCustomerContact lngCustomerContact = new LngCustomerContact(); LngCustomerContact lngCustomerContact = new LngCustomerContact();
BeanUtil.copyProperties(updateLngCustomerContactDto, lngCustomerContact); BeanUtil.copyProperties(updateLngCustomerContactDto, lngCustomerContact);
lngCustomerContact.setCuCode(lngCustomer.getCuCode()); lngCustomerContact.setCuCode(lngCustomer.getCuCode());
customerLngCustomerContactMapper.insert(lngCustomerContact); lngCustomerContactMapper.insert(lngCustomerContact);
}
for (UpdateLngFileUploadDto lngFileUploadDto : updateLngCustomerDto.getLngFileUploadList()) {
LngFileUpload lngFileUpload = new LngFileUpload();
BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
lngFileUpload.setTableName("lng_customer");
lngFileUpload.setTableId(lngCustomer.getId());
lngFileUploadMapper.insert(lngFileUpload);
} }
return true; return true;
} }
@ -85,11 +105,11 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
public Boolean update(UpdateLngCustomerDto updateLngCustomerDto) { public Boolean update(UpdateLngCustomerDto updateLngCustomerDto) {
LngCustomer lngCustomer = new LngCustomer(); LngCustomer lngCustomer = new LngCustomer();
BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer); BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer);
customerLngCustomerMapper.updateById(lngCustomer); lngCustomerMapper.updateById(lngCustomer);
//********************************* LngCustomerAttrPower 增删改 开始 *******************************************/ //********************************* LngCustomerAttrPower 增删改 开始 *******************************************/
{ {
// 查出所有子级的id // 查出所有子级的id
List<LngCustomerAttrPower> lngCustomerAttrPowerList = customerLngCustomerAttrPowerMapper.selectList(Wrappers.lambdaQuery(LngCustomerAttrPower.class).eq(LngCustomerAttrPower::getCuCode, lngCustomer.getCuCode()).select(LngCustomerAttrPower::getId)); List<LngCustomerAttrPower> lngCustomerAttrPowerList = lngCustomerAttrPowerMapper.selectList(Wrappers.lambdaQuery(LngCustomerAttrPower.class).eq(LngCustomerAttrPower::getCuCode, lngCustomer.getCuCode()).select(LngCustomerAttrPower::getId));
List<Long> lngCustomerAttrPowerIds = lngCustomerAttrPowerList.stream().map(LngCustomerAttrPower::getId).collect(Collectors.toList()); List<Long> lngCustomerAttrPowerIds = lngCustomerAttrPowerList.stream().map(LngCustomerAttrPower::getId).collect(Collectors.toList());
//原有子表单 没有被删除的主键 //原有子表单 没有被删除的主键
List<Long> lngCustomerAttrPowerOldIds = updateLngCustomerDto.getLngCustomerAttrPowerList().stream().map(UpdateLngCustomerAttrPowerDto::getId).filter(Objects::nonNull).collect(Collectors.toList()); List<Long> lngCustomerAttrPowerOldIds = updateLngCustomerDto.getLngCustomerAttrPowerList().stream().map(UpdateLngCustomerAttrPowerDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
@ -102,18 +122,18 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
//如果不等于空则修改 //如果不等于空则修改
if (lngCustomerAttrPower.getId() != null) { if (lngCustomerAttrPower.getId() != null) {
customerLngCustomerAttrPowerMapper.updateById(lngCustomerAttrPower); lngCustomerAttrPowerMapper.updateById(lngCustomerAttrPower);
} }
//如果等于空 则新增 //如果等于空 则新增
else { else {
//已经不存在的id 删除 //已经不存在的id 删除
lngCustomerAttrPower.setCuCode(lngCustomer.getCuCode()); lngCustomerAttrPower.setCuCode(lngCustomer.getCuCode());
customerLngCustomerAttrPowerMapper.insert(lngCustomerAttrPower); lngCustomerAttrPowerMapper.insert(lngCustomerAttrPower);
} }
} }
//已经不存在的id 删除 //已经不存在的id 删除
if(lngCustomerAttrPowerRemoveIds.size() > 0){ if(lngCustomerAttrPowerRemoveIds.size() > 0){
customerLngCustomerAttrPowerMapper.deleteBatchIds(lngCustomerAttrPowerRemoveIds); lngCustomerAttrPowerMapper.deleteBatchIds(lngCustomerAttrPowerRemoveIds);
} }
} }
//********************************* LngCustomerAttrPower 增删改 结束 *******************************************/ //********************************* LngCustomerAttrPower 增删改 结束 *******************************************/
@ -121,7 +141,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
//********************************* LngCustomerBank 增删改 开始 *******************************************/ //********************************* LngCustomerBank 增删改 开始 *******************************************/
{ {
// 查出所有子级的id // 查出所有子级的id
List<LngCustomerBank> lngCustomerBankList = customerLngCustomerBankMapper.selectList(Wrappers.lambdaQuery(LngCustomerBank.class).eq(LngCustomerBank::getCuCode, lngCustomer.getCuCode()).select(LngCustomerBank::getId)); List<LngCustomerBank> lngCustomerBankList = lngCustomerBankMapper.selectList(Wrappers.lambdaQuery(LngCustomerBank.class).eq(LngCustomerBank::getCuCode, lngCustomer.getCuCode()).select(LngCustomerBank::getId));
List<Long> lngCustomerBankIds = lngCustomerBankList.stream().map(LngCustomerBank::getId).collect(Collectors.toList()); List<Long> lngCustomerBankIds = lngCustomerBankList.stream().map(LngCustomerBank::getId).collect(Collectors.toList());
//原有子表单 没有被删除的主键 //原有子表单 没有被删除的主键
List<Long> lngCustomerBankOldIds = updateLngCustomerDto.getLngCustomerBankList().stream().map(UpdateLngCustomerBankDto::getId).filter(Objects::nonNull).collect(Collectors.toList()); List<Long> lngCustomerBankOldIds = updateLngCustomerDto.getLngCustomerBankList().stream().map(UpdateLngCustomerBankDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
@ -133,18 +153,18 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
BeanUtil.copyProperties(lngCustomerBankDto, lngCustomerBank); BeanUtil.copyProperties(lngCustomerBankDto, lngCustomerBank);
//如果不等于空则修改 //如果不等于空则修改
if (lngCustomerBank.getId() != null) { if (lngCustomerBank.getId() != null) {
customerLngCustomerBankMapper.updateById(lngCustomerBank); lngCustomerBankMapper.updateById(lngCustomerBank);
} }
//如果等于空 则新增 //如果等于空 则新增
else { else {
//已经不存在的id 删除 //已经不存在的id 删除
lngCustomerBank.setCuCode(lngCustomer.getCuCode()); lngCustomerBank.setCuCode(lngCustomer.getCuCode());
customerLngCustomerBankMapper.insert(lngCustomerBank); lngCustomerBankMapper.insert(lngCustomerBank);
} }
} }
//已经不存在的id 删除 //已经不存在的id 删除
if(lngCustomerBankRemoveIds.size() > 0){ if(lngCustomerBankRemoveIds.size() > 0){
customerLngCustomerBankMapper.deleteBatchIds(lngCustomerBankRemoveIds); lngCustomerBankMapper.deleteBatchIds(lngCustomerBankRemoveIds);
} }
} }
//********************************* LngCustomerBank 增删改 结束 *******************************************/ //********************************* LngCustomerBank 增删改 结束 *******************************************/
@ -152,7 +172,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
//********************************* LngCustomerDoc 增删改 开始 *******************************************/ //********************************* LngCustomerDoc 增删改 开始 *******************************************/
{ {
// 查出所有子级的id // 查出所有子级的id
List<LngCustomerDoc> lngCustomerDocList = customerLngCustomerDocMapper.selectList(Wrappers.lambdaQuery(LngCustomerDoc.class).eq(LngCustomerDoc::getCuCode, lngCustomer.getCuCode()).select(LngCustomerDoc::getId)); List<LngCustomerDoc> lngCustomerDocList = lngCustomerDocMapper.selectList(Wrappers.lambdaQuery(LngCustomerDoc.class).eq(LngCustomerDoc::getCuCode, lngCustomer.getCuCode()).select(LngCustomerDoc::getId));
List<Long> lngCustomerDocIds = lngCustomerDocList.stream().map(LngCustomerDoc::getId).collect(Collectors.toList()); List<Long> lngCustomerDocIds = lngCustomerDocList.stream().map(LngCustomerDoc::getId).collect(Collectors.toList());
//原有子表单 没有被删除的主键 //原有子表单 没有被删除的主键
List<Long> lngCustomerDocOldIds = updateLngCustomerDto.getLngCustomerDocList().stream().map(UpdateLngCustomerDocDto::getId).filter(Objects::nonNull).collect(Collectors.toList()); List<Long> lngCustomerDocOldIds = updateLngCustomerDto.getLngCustomerDocList().stream().map(UpdateLngCustomerDocDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
@ -162,20 +182,31 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
for (UpdateLngCustomerDocDto lngCustomerDocDto : updateLngCustomerDto.getLngCustomerDocList()) { for (UpdateLngCustomerDocDto lngCustomerDocDto : updateLngCustomerDto.getLngCustomerDocList()) {
LngCustomerDoc lngCustomerDoc = new LngCustomerDoc(); LngCustomerDoc lngCustomerDoc = new LngCustomerDoc();
BeanUtil.copyProperties(lngCustomerDocDto, lngCustomerDoc); BeanUtil.copyProperties(lngCustomerDocDto, lngCustomerDoc);
//如果不等于空则修改 //如果不等于空则修改
if (lngCustomerDoc.getId() != null) { if (lngCustomerDoc.getId() != null) {
customerLngCustomerDocMapper.updateById(lngCustomerDoc);
lngCustomerDocMapper.updateById(lngCustomerDoc);
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").eq(LngFileUpload::getTableId, lngCustomerDoc.getId()));
} }
//如果等于空 则新增 //如果等于空 则新增
else { else {
//已经不存在的id 删除 //已经不存在的id 删除
lngCustomerDoc.setCuCode(lngCustomer.getCuCode()); lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
customerLngCustomerDocMapper.insert(lngCustomerDoc); lngCustomerDocMapper.insert(lngCustomerDoc);
} }
if(StringUtils.isNotEmpty(lngCustomerDocDto.getFilePath())) {
LngFileUpload lngFileUpload = new LngFileUpload();
lngFileUpload.setFilePath(lngCustomerDocDto.getFilePath());
lngFileUpload.setTableName("lng_customer_doc");
lngFileUpload.setTableId(lngCustomerDoc.getId());
lngFileUploadMapper.insert(lngFileUpload);
}
} }
//已经不存在的id 删除 //已经不存在的id 删除
if(lngCustomerDocRemoveIds.size() > 0){ if(lngCustomerDocRemoveIds.size() > 0){
customerLngCustomerDocMapper.deleteBatchIds(lngCustomerDocRemoveIds); lngCustomerDocMapper.deleteBatchIds(lngCustomerDocRemoveIds);
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").in(LngFileUpload::getTableId, lngCustomerDocRemoveIds));
} }
} }
//********************************* LngCustomerDoc 增删改 结束 *******************************************/ //********************************* LngCustomerDoc 增删改 结束 *******************************************/
@ -183,7 +214,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
//********************************* LngCustomerContact 增删改 开始 *******************************************/ //********************************* LngCustomerContact 增删改 开始 *******************************************/
{ {
// 查出所有子级的id // 查出所有子级的id
List<LngCustomerContact> lngCustomerContactList = customerLngCustomerContactMapper.selectList(Wrappers.lambdaQuery(LngCustomerContact.class).eq(LngCustomerContact::getCuCode, lngCustomer.getCuCode()).select(LngCustomerContact::getId)); List<LngCustomerContact> lngCustomerContactList = lngCustomerContactMapper.selectList(Wrappers.lambdaQuery(LngCustomerContact.class).eq(LngCustomerContact::getCuCode, lngCustomer.getCuCode()).select(LngCustomerContact::getId));
List<Long> lngCustomerContactIds = lngCustomerContactList.stream().map(LngCustomerContact::getId).collect(Collectors.toList()); List<Long> lngCustomerContactIds = lngCustomerContactList.stream().map(LngCustomerContact::getId).collect(Collectors.toList());
//原有子表单 没有被删除的主键 //原有子表单 没有被删除的主键
List<Long> lngCustomerContactOldIds = updateLngCustomerDto.getLngCustomerContactList().stream().map(UpdateLngCustomerContactDto::getId).filter(Objects::nonNull).collect(Collectors.toList()); List<Long> lngCustomerContactOldIds = updateLngCustomerDto.getLngCustomerContactList().stream().map(UpdateLngCustomerContactDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
@ -195,34 +226,64 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
BeanUtil.copyProperties(lngCustomerContactDto, lngCustomerContact); BeanUtil.copyProperties(lngCustomerContactDto, lngCustomerContact);
//如果不等于空则修改 //如果不等于空则修改
if (lngCustomerContact.getId() != null) { if (lngCustomerContact.getId() != null) {
customerLngCustomerContactMapper.updateById(lngCustomerContact); lngCustomerContactMapper.updateById(lngCustomerContact);
} }
//如果等于空 则新增 //如果等于空 则新增
else { else {
//已经不存在的id 删除 //已经不存在的id 删除
lngCustomerContact.setCuCode(lngCustomer.getCuCode()); lngCustomerContact.setCuCode(lngCustomer.getCuCode());
customerLngCustomerContactMapper.insert(lngCustomerContact); lngCustomerContactMapper.insert(lngCustomerContact);
} }
} }
//已经不存在的id 删除 //已经不存在的id 删除
if(lngCustomerContactRemoveIds.size() > 0){ if(lngCustomerContactRemoveIds.size() > 0){
customerLngCustomerContactMapper.deleteBatchIds(lngCustomerContactRemoveIds); lngCustomerContactMapper.deleteBatchIds(lngCustomerContactRemoveIds);
} }
} }
//********************************* LngCustomerContact 增删改 结束 *******************************************/ //********************************* LngCustomerContact 增删改 结束 *******************************************/
//********************************* LngFileUpload 增删改 开始 *******************************************/
{
// 查出所有子级的id
List<LngFileUpload> lngFileUploadList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer").eq(LngFileUpload::getTableId, lngCustomer.getId()).select(LngFileUpload::getId));
List<Long> lngFileUploadIds = lngFileUploadList.stream().map(LngFileUpload::getId).collect(Collectors.toList());
//原有子表单 没有被删除的主键
List<Long> lngFileUploadOldIds = updateLngCustomerDto.getLngFileUploadList().stream().map(UpdateLngFileUploadDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
//找到需要删除的id
List<Long> lngFileUploadRemoveIds = lngFileUploadIds.stream().filter(item -> !lngFileUploadOldIds.contains(item)).collect(Collectors.toList());
for (UpdateLngFileUploadDto lngFileUploadDto : updateLngCustomerDto.getLngFileUploadList()) {
LngFileUpload lngFileUpload = new LngFileUpload();
BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
lngFileUpload.setTableName("lng_customer");
//如果不等于空则修改
if (lngFileUpload.getId() != null) {
lngFileUploadMapper.updateById(lngFileUpload);
}
//如果等于空 则新增
else {
lngFileUpload.setTableId(lngCustomer.getId());
lngFileUploadMapper.insert(lngFileUpload);
}
}
//已经不存在的id 删除
if(lngFileUploadRemoveIds.size() > 0){
lngFileUploadMapper.deleteBatchIds(lngFileUploadRemoveIds);
}
}
//********************************* LngFileUpload 增删改 结束 *******************************************/
return true; return true;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean delete(List<Long> ids) { public Boolean delete(List<Long> ids) {
customerLngCustomerMapper.deleteBatchIds(ids); lngCustomerMapper.deleteBatchIds(ids);
customerLngCustomerAttrPowerMapper.delete(Wrappers.lambdaQuery(LngCustomerAttrPower.class).in(LngCustomerAttrPower::getCuCode, ids)); lngCustomerAttrPowerMapper.delete(Wrappers.lambdaQuery(LngCustomerAttrPower.class).in(LngCustomerAttrPower::getCuCode, ids));
customerLngCustomerBankMapper.delete(Wrappers.lambdaQuery(LngCustomerBank.class).in(LngCustomerBank::getCuCode, ids)); lngCustomerBankMapper.delete(Wrappers.lambdaQuery(LngCustomerBank.class).in(LngCustomerBank::getCuCode, ids));
customerLngCustomerDocMapper.delete(Wrappers.lambdaQuery(LngCustomerDoc.class).in(LngCustomerDoc::getCuCode, ids)); lngCustomerDocMapper.delete(Wrappers.lambdaQuery(LngCustomerDoc.class).in(LngCustomerDoc::getCuCode, ids));
customerLngCustomerContactMapper.delete(Wrappers.lambdaQuery(LngCustomerContact.class).in(LngCustomerContact::getCuCode, ids)); lngCustomerContactMapper.delete(Wrappers.lambdaQuery(LngCustomerContact.class).in(LngCustomerContact::getCuCode, ids));
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).in(LngFileUpload::getTableId, ids));
return true; return true;
} }
} }

View File

@ -45,7 +45,7 @@ spring:
group: DNE group: DNE
discovery: discovery:
ip: 10.0.0.2 ip: 10.0.0.4
#network-interface: net7 #network-interface: net7
xjrsoft: xjrsoft: