客户管理-附件

This commit is contained in:
2025-12-01 16:52:59 +08:00
parent 19d6990c79
commit d8d7672e7c
9 changed files with 103 additions and 45 deletions

View File

@ -96,8 +96,14 @@ public class UpdateLngCustomerDocDto implements Serializable {
@ApiModelProperty("租户id")
private Long tenantId;
private String filePath;
private Long filesize;
/**
* 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> fileList;
}

View File

@ -122,7 +122,11 @@ public class LngCustomerDocVo {
private Long ruleUserId;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
private List<LngFileUploadVo> lngFileUploadList;
}

View File

@ -68,7 +68,10 @@ public class LngCustomerPageVo {
* 状态(未提交/审批中/已审批/已驳回)
*/
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
@Trans(type = TransType.DIC, id = "1990669393069129729")
@Trans(type = TransType.DIC, id = "1990669393069129729", transToFieldName = "approName")
private String approCode;
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
private String approName;
}

View File

@ -8,6 +8,8 @@ import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
/**
* @title: 表单出参
* @Author 管理员
@ -129,7 +131,8 @@ public class LngFileUploadVo {
private Long ruleUserId;
@ApiModelProperty("")
private String presignedUrl;
}

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.metadata.IPage;
import com.pictc.utils.StringUtils;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
@ -107,9 +108,10 @@ public class CustomerController {
public R add(@Valid @RequestBody UpdateLngCustomerDto dto){
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
dto.setCuCode("C"+code);
customerService.add(dto);
Long id = customerService.add(dto);
dto.setId(id);
codeRuleClient.useEncode(CUSTOMER_CODE);
return R.ok();
return R.ok(dto);
/**
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() {
@ -138,7 +140,6 @@ public class CustomerController {
@ApiOperation(value = "修改LngCustomer")
@SaCheckPermission("customer:edit")
public R update(@Valid @RequestBody UpdateLngCustomerDto dto){
// return R.ok(dataService.updateById(dto));
customerService.update(dto);
return R.ok();
}
@ -147,7 +148,7 @@ public class CustomerController {
@ApiOperation(value = "删除")
@SaCheckPermission("customer:delete")
public R delete(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.delete(ids));
return R.ok(customerService.delete(ids));
}

View File

@ -2,11 +2,19 @@ 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;
@ -123,10 +131,18 @@ public class LngCustomerDoc implements Serializable {
@TableField(fill = FieldFill.INSERT)
private Long ruleUserId;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
@TableField(exist = false)
private String filePath;
@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;
@TableField(exist = false)
private Long filesize;
}

View File

@ -133,6 +133,8 @@ public class LngFileUpload implements Serializable {
@TableField(fill = FieldFill.INSERT)
private Long ruleUserId;
@ApiModelProperty("")
@TableField(exist = false)
private String presignedUrl;
}

View File

@ -24,7 +24,7 @@ public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepSe
* @return
*/
Boolean add(UpdateLngCustomerDto updateLngCustomerDto);
Long add(UpdateLngCustomerDto updateLngCustomerDto);
/**
* 更新

View File

@ -12,6 +12,8 @@ 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;
@ -24,6 +26,7 @@ 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.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
@ -55,7 +58,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean add(UpdateLngCustomerDto updateLngCustomerDto) {
public Long add(UpdateLngCustomerDto updateLngCustomerDto) {
LngCustomer lngCustomer = new LngCustomer();
BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer);
@ -78,15 +81,18 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
lngCustomerDocMapper.insert(lngCustomerDoc);
if(StringUtils.isNotEmpty(updateLngCustomerDocDto.getFilePath())) {
if(CollectionUtil.isNotEmpty(updateLngCustomerDocDto.getFileList())) {
for(UpdateLngFileUploadDto lngFileUploadDto:updateLngCustomerDocDto.getFileList()) {
LngFileUpload lngFileUpload = new LngFileUpload();
lngFileUpload.setFilePath(updateLngCustomerDocDto.getFilePath());
BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
lngFileUpload.setTableName("lng_customer_doc");
lngFileUpload.setTableId(lngCustomer.getId());
lngFileUpload.setTableId(lngCustomerDoc.getId());
lngFileUploadMapper.insert(lngFileUpload);
}
}
}
for (UpdateLngCustomerContactDto updateLngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) {
LngCustomerContact lngCustomerContact = new LngCustomerContact();
BeanUtil.copyProperties(updateLngCustomerContactDto, lngCustomerContact);
@ -103,7 +109,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
}
}
return true;
return lngCustomer.getId();
}
@Override
@ -200,13 +206,16 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
lngCustomerDocMapper.insert(lngCustomerDoc);
}
if(StringUtils.isNotEmpty(lngCustomerDocDto.getFilePath())) {
if(CollectionUtil.isNotEmpty(lngCustomerDocDto.getFileList())) {
for(UpdateLngFileUploadDto lngFileUploadDto:lngCustomerDocDto.getFileList()) {
LngFileUpload lngFileUpload = new LngFileUpload();
lngFileUpload.setFilePath(lngCustomerDocDto.getFilePath());
BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
lngFileUpload.setTableName("lng_customer_doc");
lngFileUpload.setTableId(lngCustomerDoc.getId());
lngFileUploadMapper.insert(lngFileUpload);
}
}
}
//已经不存在的id 删除
if(lngCustomerDocRemoveIds.size() > 0){
@ -284,12 +293,17 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean delete(List<Long> ids) {
List<LngCustomer> customerList = lngCustomerMapper.selectList(Wrappers.lambdaQuery(LngCustomer.class).in(LngCustomer::getId, ids));
List<String> cuCodeList = customerList.stream().map(LngCustomer::getCuCode).filter(Objects::nonNull).collect(Collectors.toList());
lngCustomerMapper.deleteBatchIds(ids);
lngCustomerAttrPowerMapper.delete(Wrappers.lambdaQuery(LngCustomerAttrPower.class).in(LngCustomerAttrPower::getCuCode, ids));
lngCustomerBankMapper.delete(Wrappers.lambdaQuery(LngCustomerBank.class).in(LngCustomerBank::getCuCode, ids));
lngCustomerDocMapper.delete(Wrappers.lambdaQuery(LngCustomerDoc.class).in(LngCustomerDoc::getCuCode, ids));
lngCustomerContactMapper.delete(Wrappers.lambdaQuery(LngCustomerContact.class).in(LngCustomerContact::getCuCode, ids));
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).in(LngFileUpload::getTableId, ids));
if(CollectionUtil.isNotEmpty(cuCodeList)) {
lngCustomerAttrPowerMapper.delete(Wrappers.lambdaQuery(LngCustomerAttrPower.class).in(LngCustomerAttrPower::getCuCode, cuCodeList));
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"));
}
return true;
}
@ -302,14 +316,23 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
}
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> 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);
return lngCustomer;
}