1、添加附件注解
2、完善附件保存
This commit is contained in:
@ -15,11 +15,17 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
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.pictc.enums.BusinessCode;
|
||||
import com.pictc.enums.ExceptionCommonCode;
|
||||
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.common.db.utils.CommonCallUtils;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.sales.dto.LngCustomerPageDto;
|
||||
@ -106,13 +112,13 @@ public class CustomerController {
|
||||
@ApiOperation(value = "新增LngCustomer")
|
||||
@SaCheckPermission("customer:add")
|
||||
public R add(@Valid @RequestBody UpdateLngCustomerDto dto){
|
||||
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
||||
dto.setCuCode("C"+code);
|
||||
Long id = customerService.add(dto);
|
||||
dto.setId(id);
|
||||
codeRuleClient.useEncode(CUSTOMER_CODE);
|
||||
return R.ok(dto);
|
||||
/**
|
||||
// String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
||||
// dto.setCuCode("C"+code);
|
||||
// Long id = customerService.add(dto);
|
||||
// dto.setId(id);
|
||||
// codeRuleClient.useEncode(CUSTOMER_CODE);
|
||||
// return R.ok(dto);
|
||||
|
||||
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() {
|
||||
|
||||
@Override
|
||||
@ -125,14 +131,14 @@ public class CustomerController {
|
||||
@Override
|
||||
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
if (StringUtils.isNotEmpty(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
codeRuleClient.useEncode(CUSTOMER_CODE);
|
||||
return content.getObj();
|
||||
}
|
||||
}));
|
||||
**/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -140,8 +146,27 @@ public class CustomerController {
|
||||
@ApiOperation(value = "修改LngCustomer")
|
||||
@SaCheckPermission("customer:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngCustomerDto dto){
|
||||
customerService.update(dto);
|
||||
return R.ok();
|
||||
// customerService.update(dto);
|
||||
// return R.ok();
|
||||
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngCustomerDto>() {
|
||||
|
||||
@Override
|
||||
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
||||
dto.setCuCode("C"+code);
|
||||
return content.getObj();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
|
||||
if (StringUtils.isNotEmpty(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
codeRuleClient.useEncode(CUSTOMER_CODE);
|
||||
return content.getObj();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
|
||||
@ -15,7 +15,6 @@ import com.pictc.annotations.datalog.JoinType;
|
||||
import com.pictc.annotations.datalog.LogJoin;
|
||||
import com.pictc.annotations.datalog.LogJoinColumn;
|
||||
import com.pictc.annotations.datalog.ValueDirectionType;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngFileUploadDto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -312,19 +311,6 @@ public class LngCustomer implements Serializable {
|
||||
}, caseType = JoinCaseType.FULL, target = LngCustomerContact.class, type = JoinType.MANY)
|
||||
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
@ -2,19 +2,11 @@ package com.xjrsoft.module.sales.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import com.pictc.annotations.datalog.JoinCaseType;
|
||||
import com.pictc.annotations.datalog.JoinType;
|
||||
import com.pictc.annotations.datalog.LogJoin;
|
||||
import com.pictc.annotations.datalog.LogJoinColumn;
|
||||
import com.pictc.annotations.datalog.ValueDirectionType;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngFileUploadDto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -130,19 +122,6 @@ public class LngCustomerDoc implements Serializable {
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
/**
|
||||
* 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> fileList;
|
||||
|
||||
|
||||
}
|
||||
@ -1,143 +0,0 @@
|
||||
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;
|
||||
|
||||
@ApiModelProperty("")
|
||||
@TableField(exist = false)
|
||||
private String presignedUrl;
|
||||
|
||||
//@ApiModelProperty("")
|
||||
//private Long xjrFileId;
|
||||
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
package com.xjrsoft.module.sales.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.sales.entity.LngFileUpload;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-11-21
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngFileUploadMapper extends MPJBaseMapper<LngFileUpload>,BaseMapper<LngFileUpload> {
|
||||
|
||||
}
|
||||
@ -1,42 +1,36 @@
|
||||
package com.xjrsoft.module.sales.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.pictc.utils.StringUtils;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomerAttrPower;
|
||||
import com.xjrsoft.module.sales.mapper.LngCustomerAttrPowerMapper;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomerBank;
|
||||
import com.xjrsoft.module.sales.mapper.LngCustomerBankMapper;
|
||||
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.entity.LngCustomerContact;
|
||||
import com.xjrsoft.module.sales.mapper.LngCustomerContactMapper;
|
||||
import com.xjrsoft.common.factory.CloudStorageService;
|
||||
import com.xjrsoft.common.factory.OssFactory;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerAttrPowerDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerBankDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerContactDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDocDto;
|
||||
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.LngCustomerAttrPower;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomerBank;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomerContact;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomerDoc;
|
||||
import com.xjrsoft.module.sales.mapper.LngCustomerAttrPowerMapper;
|
||||
import com.xjrsoft.module.sales.mapper.LngCustomerBankMapper;
|
||||
import com.xjrsoft.module.sales.mapper.LngCustomerContactMapper;
|
||||
import com.xjrsoft.module.sales.mapper.LngCustomerDocMapper;
|
||||
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.system.client.IFileClient;
|
||||
import com.xjrsoft.module.system.dto.LngFileUploadBindDto;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
@ -53,7 +47,8 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
private final LngCustomerBankMapper lngCustomerBankMapper;
|
||||
private final LngCustomerDocMapper lngCustomerDocMapper;
|
||||
private final LngCustomerContactMapper lngCustomerContactMapper;
|
||||
private final LngFileUploadMapper lngFileUploadMapper;
|
||||
|
||||
private final IFileClient fileClient;
|
||||
|
||||
|
||||
@Override
|
||||
@ -82,14 +77,12 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
lngCustomerDocMapper.insert(lngCustomerDoc);
|
||||
|
||||
if(CollectionUtil.isNotEmpty(updateLngCustomerDocDto.getFileList())) {
|
||||
for(UpdateLngFileUploadDto lngFileUploadDto:updateLngCustomerDocDto.getFileList()) {
|
||||
LngFileUpload lngFileUpload = new LngFileUpload();
|
||||
BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
|
||||
lngFileUpload.setTableName("lng_customer_doc");
|
||||
lngFileUpload.setTableId(lngCustomerDoc.getId());
|
||||
lngFileUploadMapper.insert(lngFileUpload);
|
||||
}
|
||||
|
||||
LngFileUploadBindDto bindDto = new LngFileUploadBindDto();
|
||||
bindDto.setTableId(updateLngCustomerDocDto.getId());
|
||||
bindDto.setTableName("lng_customer_doc");
|
||||
bindDto.setColumnName("fileList");
|
||||
bindDto.setFiles(updateLngCustomerDocDto.getFileList());
|
||||
fileClient.bindTableData(bindDto);
|
||||
}
|
||||
|
||||
}
|
||||
@ -100,13 +93,13 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
lngCustomerContactMapper.insert(lngCustomerContact);
|
||||
}
|
||||
if(updateLngCustomerDto.getLngFileUploadList() != null) {
|
||||
for (UpdateLngFileUploadDto lngFileUploadDto : updateLngCustomerDto.getLngFileUploadList()) {
|
||||
LngFileUpload lngFileUpload = new LngFileUpload();
|
||||
BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
|
||||
lngFileUpload.setTableName("lng_customer");
|
||||
lngFileUpload.setTableId(lngCustomer.getId());
|
||||
lngFileUploadMapper.insert(lngFileUpload);
|
||||
}
|
||||
LngFileUploadBindDto bindDto = new LngFileUploadBindDto();
|
||||
bindDto.setTableId(updateLngCustomerDto.getId());
|
||||
bindDto.setTableName("lng_customer");
|
||||
bindDto.setColumnName("lngFileUploadList");
|
||||
bindDto.setFiles(updateLngCustomerDto.getLngFileUploadList());
|
||||
fileClient.bindTableData(bindDto);
|
||||
|
||||
}
|
||||
|
||||
return lngCustomer.getId();
|
||||
@ -198,7 +191,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
if (lngCustomerDoc.getId() != null) {
|
||||
|
||||
lngCustomerDocMapper.updateById(lngCustomerDoc);
|
||||
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").eq(LngFileUpload::getTableId, lngCustomerDoc.getId()));
|
||||
//lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").eq(LngFileUpload::getTableId, lngCustomerDoc.getId()));
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
@ -207,20 +200,20 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
lngCustomerDocMapper.insert(lngCustomerDoc);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(lngCustomerDocDto.getFileList())) {
|
||||
for(UpdateLngFileUploadDto lngFileUploadDto:lngCustomerDocDto.getFileList()) {
|
||||
LngFileUpload lngFileUpload = new LngFileUpload();
|
||||
BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
|
||||
lngFileUpload.setTableName("lng_customer_doc");
|
||||
lngFileUpload.setTableId(lngCustomerDoc.getId());
|
||||
lngFileUploadMapper.insert(lngFileUpload);
|
||||
}
|
||||
// for(UpdateLngFileUploadDto lngFileUploadDto:lngCustomerDocDto.getFileList()) {
|
||||
// LngFileUpload lngFileUpload = new LngFileUpload();
|
||||
// BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
|
||||
// lngFileUpload.setTableName("lng_customer_doc");
|
||||
// lngFileUpload.setTableId(lngCustomerDoc.getId());
|
||||
// lngFileUploadMapper.insert(lngFileUpload);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngCustomerDocRemoveIds.size() > 0){
|
||||
lngCustomerDocMapper.deleteBatchIds(lngCustomerDocRemoveIds);
|
||||
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").in(LngFileUpload::getTableId, lngCustomerDocRemoveIds));
|
||||
//lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").in(LngFileUpload::getTableId, lngCustomerDocRemoveIds));
|
||||
|
||||
}
|
||||
}
|
||||
@ -260,31 +253,31 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
//********************************* 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);
|
||||
}
|
||||
// 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;
|
||||
@ -301,8 +294,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
lngCustomerBankMapper.delete(Wrappers.lambdaQuery(LngCustomerBank.class).in(LngCustomerBank::getCuCode, cuCodeList));
|
||||
lngCustomerDocMapper.delete(Wrappers.lambdaQuery(LngCustomerDoc.class).in(LngCustomerDoc::getCuCode, cuCodeList));
|
||||
lngCustomerContactMapper.delete(Wrappers.lambdaQuery(LngCustomerContact.class).in(LngCustomerContact::getCuCode, cuCodeList));
|
||||
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).in(LngFileUpload::getTableId, ids).eq(LngFileUpload::getTableName, "lng_customer"));
|
||||
|
||||
// lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).in(LngFileUpload::getTableId, ids).eq(LngFileUpload::getTableName, "lng_customer"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -316,24 +308,24 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(lngCustomer.getLngCustomerDocList())) {
|
||||
for(LngCustomerDoc lngCustomerDoc: lngCustomer.getLngCustomerDocList()) {
|
||||
List<LngFileUpload> tempList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomerDoc.getId()).eq(LngFileUpload::getTableName, "lng_customer_doc"));
|
||||
if(CollectionUtil.isNotEmpty(tempList)) {
|
||||
CloudStorageService storageService = OssFactory.build();
|
||||
tempList.forEach(file -> {
|
||||
file.setPresignedUrl(storageService.fixUrl(file.getFilePath()));
|
||||
});
|
||||
lngCustomerDoc.setFileList(tempList);
|
||||
}
|
||||
// List<LngFileUpload> tempList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomerDoc.getId()).eq(LngFileUpload::getTableName, "lng_customer_doc"));
|
||||
// if(CollectionUtil.isNotEmpty(tempList)) {
|
||||
// CloudStorageService storageService = OssFactory.build();
|
||||
// tempList.forEach(file -> {
|
||||
// file.setPresignedUrl(storageService.fixUrl(file.getFilePath()));
|
||||
// });
|
||||
// lngCustomerDoc.setFileList(tempList);
|
||||
// }
|
||||
}
|
||||
}
|
||||
List<LngFileUpload> fileList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomer.getId()).eq(LngFileUpload::getTableName, "lng_customer"));
|
||||
if (CollUtil.isNotEmpty(fileList)) {
|
||||
CloudStorageService storageService = OssFactory.build();
|
||||
fileList.forEach(file -> {
|
||||
file.setPresignedUrl(storageService.fixUrl(file.getFilePath()));
|
||||
});
|
||||
}
|
||||
lngCustomer.setLngFileUploadList(fileList);
|
||||
// List<LngFileUpload> fileList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomer.getId()).eq(LngFileUpload::getTableName, "lng_customer"));
|
||||
// if (CollUtil.isNotEmpty(fileList)) {
|
||||
// CloudStorageService storageService = OssFactory.build();
|
||||
// fileList.forEach(file -> {
|
||||
// file.setPresignedUrl(storageService.fixUrl(file.getFilePath()));
|
||||
// });
|
||||
// }
|
||||
//lngCustomer.setLngFileUploadList(fileList);
|
||||
return lngCustomer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user