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

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

@ -98,4 +98,6 @@ public class UpdateLngCustomerDocDto implements Serializable {
private String filePath; private String filePath;
private Long filesize;
} }

View File

@ -1,5 +1,8 @@
package com.xjrsoft.module.sales.vo; package com.xjrsoft.module.sales.vo;
import com.xjrsoft.common.annotation.Trans;
import com.xjrsoft.common.enums.TransType;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -41,26 +44,31 @@ public class LngCustomerPageVo {
* 企业性质(国有企业/非国有企业) * 企业性质(国有企业/非国有企业)
*/ */
@ApiModelProperty("企业性质(国有企业/非国有企业)") @ApiModelProperty("企业性质(国有企业/非国有企业)")
@Trans(type = TransType.DIC, id = "1990667133987635201")
private String natureCode; private String natureCode;
/** /**
* 客户分类(一类/二类) * 客户分类(一类/二类)
*/ */
@ApiModelProperty("客户分类(一类/二类)") @ApiModelProperty("客户分类(一类/二类)")
@Trans(type = TransType.DIC, id = "1990668094164484097")
private String classCode; private String classCode;
/** /**
* 客户类别(电厂/工业用户/城燃/贸易商) * 客户类别(电厂/工业用户/城燃/贸易商)
*/ */
@ApiModelProperty("客户类别(电厂/工业用户/城燃/贸易商)") @ApiModelProperty("客户类别(电厂/工业用户/城燃/贸易商)")
@Trans(type = TransType.DIC, id = "1990668471983194113")
private String typeCode; private String typeCode;
/** /**
* 有效标志(不在黑名单)(Y-有效N-无效) * 有效标志(不在黑名单)(Y-有效N-无效)
*/ */
@ApiModelProperty("有效标志(不在黑名单)(Y-有效N-无效)") @ApiModelProperty("有效标志(不在黑名单)(Y-有效N-无效)")
@Trans(type = TransType.DIC, id = "1978057078528327681")
private String valid; private String valid;
/** /**
* 状态(未提交/审批中/已审批/已驳回) * 状态(未提交/审批中/已审批/已驳回)
*/ */
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)") @ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
@Trans(type = TransType.DIC, id = "1990669393069129729")
private String approCode; private String approCode;
} }

View File

@ -1,20 +1,16 @@
package com.xjrsoft.module.sales.entity; 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.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField; 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.TableId;
import com.baomidou.mybatisplus.annotation.Version; import com.baomidou.mybatisplus.annotation.TableName;
import com.github.yulichang.annotation.EntityMapping;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; 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) @TableField(fill = FieldFill.INSERT)
private Long ruleUserId; 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); 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 com.xjrsoft.module.sales.service.ICustomerService;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -90,13 +93,16 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
lngCustomerContact.setCuCode(lngCustomer.getCuCode()); lngCustomerContact.setCuCode(lngCustomer.getCuCode());
lngCustomerContactMapper.insert(lngCustomerContact); lngCustomerContactMapper.insert(lngCustomerContact);
} }
for (UpdateLngFileUploadDto lngFileUploadDto : updateLngCustomerDto.getLngFileUploadList()) { if(updateLngCustomerDto.getLngFileUploadList() != null) {
LngFileUpload lngFileUpload = new LngFileUpload(); for (UpdateLngFileUploadDto lngFileUploadDto : updateLngCustomerDto.getLngFileUploadList()) {
BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload); LngFileUpload lngFileUpload = new LngFileUpload();
lngFileUpload.setTableName("lng_customer"); BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
lngFileUpload.setTableId(lngCustomer.getId()); lngFileUpload.setTableName("lng_customer");
lngFileUploadMapper.insert(lngFileUpload); lngFileUpload.setTableId(lngCustomer.getId());
lngFileUploadMapper.insert(lngFileUpload);
}
} }
return true; return true;
} }
@ -286,4 +292,25 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).in(LngFileUpload::getTableId, ids)); lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).in(LngFileUpload::getTableId, ids));
return true; 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;
}
} }