客户管理-附件保存与查询

This commit is contained in:
2025-11-24 17:53:33 +08:00
parent a36ab70458
commit 68450da4f9
5 changed files with 55 additions and 16 deletions

View File

@ -1,20 +1,16 @@
package com.xjrsoft.module.sales.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
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 com.baomidou.mybatisplus.annotation.TableName;
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;
/**
@ -127,6 +123,10 @@ public class LngCustomerDoc implements Serializable {
@TableField(fill = FieldFill.INSERT)
private Long ruleUserId;
@TableField(exist = false)
private String filePath;
@TableField(exist = false)
private Long filesize;
}

View File

@ -42,4 +42,6 @@ public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepSe
*/
Boolean delete(List<Long> ids);
LngCustomer getCustomerById(Long id);
}

View File

@ -24,9 +24,12 @@ import com.xjrsoft.module.sales.mapper.LngFileUploadMapper;
import com.xjrsoft.module.sales.service.ICustomerService;
import cn.hutool.core.bean.BeanUtil;
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;
@ -90,13 +93,16 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
lngCustomerContact.setCuCode(lngCustomer.getCuCode());
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);
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);
}
}
return true;
}
@ -286,4 +292,25 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).in(LngFileUpload::getTableId, ids));
return true;
}
@Override
public LngCustomer getCustomerById(Long id) {
LngCustomer lngCustomer = this.getByIdDeep(id);
if(lngCustomer == null) {
return null;
}
if(CollectionUtil.isNotEmpty(lngCustomer.getLngCustomerDocList())) {
for(LngCustomerDoc lngCustomerDoc: lngCustomer.getLngCustomerDocList()) {
LngFileUpload temp = lngFileUploadMapper.selectOne(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomerDoc.getId()).eq(LngFileUpload::getTableName, "lng_customer_doc"));
if(temp != null) {
lngCustomerDoc.setFilePath(temp.getFilePath());
lngCustomerDoc.setFilesize(temp.getFilesize());
}
}
}
List<LngFileUpload> fileList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomer.getId()).eq(LngFileUpload::getTableName, "lng_customer"));
lngCustomer.setLngFileUploadList(fileList);
return lngCustomer;
}
}