客户管理-附件

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") @ApiModelProperty("租户id")
private Long tenantId; private Long tenantId;
/**
private String filePath; * lngFileUpload
*/
private Long filesize; @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; private Long ruleUserId;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
private List<LngFileUploadVo> lngFileUploadList;
} }

View File

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

View File

@ -8,6 +8,8 @@ import java.time.LocalDateTime;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
/** /**
* @title: 表单出参 * @title: 表单出参
* @Author 管理员 * @Author 管理员
@ -129,7 +131,8 @@ public class LngFileUploadVo {
private Long ruleUserId; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pictc.utils.StringUtils;
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;
@ -107,9 +108,10 @@ public class CustomerController {
public R add(@Valid @RequestBody UpdateLngCustomerDto dto){ public R add(@Valid @RequestBody UpdateLngCustomerDto dto){
String code = codeRuleClient.genEncode(CUSTOMER_CODE); String code = codeRuleClient.genEncode(CUSTOMER_CODE);
dto.setCuCode("C"+code); dto.setCuCode("C"+code);
customerService.add(dto); Long id = customerService.add(dto);
dto.setId(id);
codeRuleClient.useEncode(CUSTOMER_CODE); codeRuleClient.useEncode(CUSTOMER_CODE);
return R.ok(); return R.ok(dto);
/** /**
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() { return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() {
@ -138,7 +140,6 @@ public class CustomerController {
@ApiOperation(value = "修改LngCustomer") @ApiOperation(value = "修改LngCustomer")
@SaCheckPermission("customer:edit") @SaCheckPermission("customer:edit")
public R update(@Valid @RequestBody UpdateLngCustomerDto dto){ public R update(@Valid @RequestBody UpdateLngCustomerDto dto){
// return R.ok(dataService.updateById(dto));
customerService.update(dto); customerService.update(dto);
return R.ok(); return R.ok();
} }
@ -147,7 +148,7 @@ public class CustomerController {
@ApiOperation(value = "删除") @ApiOperation(value = "删除")
@SaCheckPermission("customer:delete") @SaCheckPermission("customer:delete")
public R delete(@Valid @RequestBody List<Long> ids){ 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.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
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.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -123,10 +131,18 @@ 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; * lngFileUpload
*/
@TableField(exist = false) @ApiModelProperty("lngFileUpload子表")
private Long filesize; @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;
} }

View File

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

View File

@ -24,7 +24,7 @@ public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepSe
* @return * @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.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;
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.UpdateLngCustomerAttrPowerDto;
import com.xjrsoft.module.sales.dto.UpdateLngCustomerBankDto; import com.xjrsoft.module.sales.dto.UpdateLngCustomerBankDto;
import com.xjrsoft.module.sales.dto.UpdateLngCustomerContactDto; 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 com.xjrsoft.module.sales.service.ICustomerService;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -55,7 +58,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean add(UpdateLngCustomerDto updateLngCustomerDto) { public Long add(UpdateLngCustomerDto updateLngCustomerDto) {
LngCustomer lngCustomer = new LngCustomer(); LngCustomer lngCustomer = new LngCustomer();
BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer); BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer);
@ -78,13 +81,16 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
lngCustomerDoc.setCuCode(lngCustomer.getCuCode()); lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
lngCustomerDocMapper.insert(lngCustomerDoc); lngCustomerDocMapper.insert(lngCustomerDoc);
if(StringUtils.isNotEmpty(updateLngCustomerDocDto.getFilePath())) { if(CollectionUtil.isNotEmpty(updateLngCustomerDocDto.getFileList())) {
LngFileUpload lngFileUpload = new LngFileUpload(); for(UpdateLngFileUploadDto lngFileUploadDto:updateLngCustomerDocDto.getFileList()) {
lngFileUpload.setFilePath(updateLngCustomerDocDto.getFilePath()); LngFileUpload lngFileUpload = new LngFileUpload();
lngFileUpload.setTableName("lng_customer_doc"); BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
lngFileUpload.setTableId(lngCustomer.getId()); lngFileUpload.setTableName("lng_customer_doc");
lngFileUploadMapper.insert(lngFileUpload); lngFileUpload.setTableId(lngCustomerDoc.getId());
} lngFileUploadMapper.insert(lngFileUpload);
}
}
} }
for (UpdateLngCustomerContactDto updateLngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) { for (UpdateLngCustomerContactDto updateLngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) {
@ -103,7 +109,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
} }
} }
return true; return lngCustomer.getId();
} }
@Override @Override
@ -200,12 +206,15 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
lngCustomerDoc.setCuCode(lngCustomer.getCuCode()); lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
lngCustomerDocMapper.insert(lngCustomerDoc); lngCustomerDocMapper.insert(lngCustomerDoc);
} }
if(StringUtils.isNotEmpty(lngCustomerDocDto.getFilePath())) { if(CollectionUtil.isNotEmpty(lngCustomerDocDto.getFileList())) {
LngFileUpload lngFileUpload = new LngFileUpload(); for(UpdateLngFileUploadDto lngFileUploadDto:lngCustomerDocDto.getFileList()) {
lngFileUpload.setFilePath(lngCustomerDocDto.getFilePath()); LngFileUpload lngFileUpload = new LngFileUpload();
lngFileUpload.setTableName("lng_customer_doc"); BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
lngFileUpload.setTableId(lngCustomerDoc.getId()); lngFileUpload.setTableName("lng_customer_doc");
lngFileUploadMapper.insert(lngFileUpload); lngFileUpload.setTableId(lngCustomerDoc.getId());
lngFileUploadMapper.insert(lngFileUpload);
}
} }
} }
//已经不存在的id 删除 //已经不存在的id 删除
@ -284,13 +293,18 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean delete(List<Long> ids) { public Boolean delete(List<Long> ids) {
lngCustomerMapper.deleteBatchIds(ids); List<LngCustomer> customerList = lngCustomerMapper.selectList(Wrappers.lambdaQuery(LngCustomer.class).in(LngCustomer::getId, ids));
lngCustomerAttrPowerMapper.delete(Wrappers.lambdaQuery(LngCustomerAttrPower.class).in(LngCustomerAttrPower::getCuCode, ids)); List<String> cuCodeList = customerList.stream().map(LngCustomer::getCuCode).filter(Objects::nonNull).collect(Collectors.toList());
lngCustomerBankMapper.delete(Wrappers.lambdaQuery(LngCustomerBank.class).in(LngCustomerBank::getCuCode, ids)); lngCustomerMapper.deleteBatchIds(ids);
lngCustomerDocMapper.delete(Wrappers.lambdaQuery(LngCustomerDoc.class).in(LngCustomerDoc::getCuCode, ids)); if(CollectionUtil.isNotEmpty(cuCodeList)) {
lngCustomerContactMapper.delete(Wrappers.lambdaQuery(LngCustomerContact.class).in(LngCustomerContact::getCuCode, ids)); lngCustomerAttrPowerMapper.delete(Wrappers.lambdaQuery(LngCustomerAttrPower.class).in(LngCustomerAttrPower::getCuCode, cuCodeList));
lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).in(LngFileUpload::getTableId, ids)); lngCustomerBankMapper.delete(Wrappers.lambdaQuery(LngCustomerBank.class).in(LngCustomerBank::getCuCode, cuCodeList));
return true; 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;
} }
@Override @Override
@ -302,15 +316,24 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
} }
if(CollectionUtil.isNotEmpty(lngCustomer.getLngCustomerDocList())) { if(CollectionUtil.isNotEmpty(lngCustomer.getLngCustomerDocList())) {
for(LngCustomerDoc lngCustomerDoc: 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")); List<LngFileUpload> tempList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomerDoc.getId()).eq(LngFileUpload::getTableName, "lng_customer_doc"));
if(temp != null) { if(CollectionUtil.isNotEmpty(tempList)) {
lngCustomerDoc.setFilePath(temp.getFilePath()); CloudStorageService storageService = OssFactory.build();
lngCustomerDoc.setFilesize(temp.getFilesize()); 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")); List<LngFileUpload> fileList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomer.getId()).eq(LngFileUpload::getTableName, "lng_customer"));
lngCustomer.setLngFileUploadList(fileList); if (CollUtil.isNotEmpty(fileList)) {
CloudStorageService storageService = OssFactory.build();
fileList.forEach(file -> {
file.setPresignedUrl(storageService.fixUrl(file.getFilePath()));
});
}
lngCustomer.setLngFileUploadList(fileList);
return lngCustomer; return lngCustomer;
} }
} }