客户管理-附件
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
@ -122,7 +122,11 @@ public class LngCustomerDocVo {
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* lngFileUpload
|
||||
*/
|
||||
@ApiModelProperty("lngFileUpload子表")
|
||||
private List<LngFileUploadVo> lngFileUploadList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String filePath;
|
||||
/**
|
||||
* 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;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long filesize;
|
||||
|
||||
}
|
||||
@ -133,6 +133,8 @@ public class LngFileUpload implements Serializable {
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
@ApiModelProperty("")
|
||||
@TableField(exist = false)
|
||||
private String presignedUrl;
|
||||
|
||||
}
|
||||
@ -24,7 +24,7 @@ public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepSe
|
||||
* @return
|
||||
*/
|
||||
|
||||
Boolean add(UpdateLngCustomerDto updateLngCustomerDto);
|
||||
Long add(UpdateLngCustomerDto updateLngCustomerDto);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
|
||||
@ -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,13 +81,16 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerDocMapper.insert(lngCustomerDoc);
|
||||
|
||||
if(StringUtils.isNotEmpty(updateLngCustomerDocDto.getFilePath())) {
|
||||
LngFileUpload lngFileUpload = new LngFileUpload();
|
||||
lngFileUpload.setFilePath(updateLngCustomerDocDto.getFilePath());
|
||||
lngFileUpload.setTableName("lng_customer_doc");
|
||||
lngFileUpload.setTableId(lngCustomer.getId());
|
||||
lngFileUploadMapper.insert(lngFileUpload);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
for (UpdateLngCustomerContactDto updateLngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) {
|
||||
@ -103,7 +109,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return lngCustomer.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -200,12 +206,15 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerDocMapper.insert(lngCustomerDoc);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(lngCustomerDocDto.getFilePath())) {
|
||||
LngFileUpload lngFileUpload = new LngFileUpload();
|
||||
lngFileUpload.setFilePath(lngCustomerDocDto.getFilePath());
|
||||
lngFileUpload.setTableName("lng_customer_doc");
|
||||
lngFileUpload.setTableId(lngCustomerDoc.getId());
|
||||
lngFileUploadMapper.insert(lngFileUpload);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
@ -284,13 +293,18 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delete(List<Long> ids) {
|
||||
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));
|
||||
return true;
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -302,15 +316,24 @@ 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"));
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user