客户管理
This commit is contained in:
@ -198,21 +198,21 @@ public class UpdateLngCustomerDto implements Serializable {
|
|||||||
* 是否校验预付款(Y-是,N-否)
|
* 是否校验预付款(Y-是,N-否)
|
||||||
*/
|
*/
|
||||||
@LogField(name="是否校验预付款(Y-是,N-否)",index=23)
|
@LogField(name="是否校验预付款(Y-是,N-否)",index=23)
|
||||||
@ApiModelProperty("是否校验预付款(Y-是,N-否)")
|
@ApiModelProperty("是否校验预付款")
|
||||||
private String prepaySign;
|
private String prepaySign;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 有无线上(竞拍)(Y-有,N-无)
|
* 有无线上(竞拍)(Y-有,N-无)
|
||||||
*/
|
*/
|
||||||
@LogField(name="有无线上(竞拍)(Y-有,N-无)",index=24)
|
@LogField(name="有无线上(竞拍)(Y-有,N-无)",index=24)
|
||||||
@ApiModelProperty("有无线上(竞拍)(Y-有,N-无)")
|
@ApiModelProperty("有无线上竞拍")
|
||||||
private String onlineSign;
|
private String onlineSign;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自有终端(Y-是,N-否)
|
* 自有终端(Y-是,N-否)
|
||||||
*/
|
*/
|
||||||
@LogField(name="自有终端(Y-是,N-否)",index=25)
|
@LogField(name="自有终端(Y-是,N-否)",index=25)
|
||||||
@ApiModelProperty("自有终端(Y-是,N-否)")
|
@ApiModelProperty("自有终端")
|
||||||
private String tSign;
|
private String tSign;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,14 +226,14 @@ public class UpdateLngCustomerDto implements Serializable {
|
|||||||
* 有效标志(不在黑名单)(Y-有效,N-无效)
|
* 有效标志(不在黑名单)(Y-有效,N-无效)
|
||||||
*/
|
*/
|
||||||
@LogField(name="有效标志(不在黑名单)(Y-有效,N-无效)",index=27)
|
@LogField(name="有效标志(不在黑名单)(Y-有效,N-无效)",index=27)
|
||||||
@ApiModelProperty("有效标志(不在黑名单)(Y-有效,N-无效)")
|
@ApiModelProperty("有效标志(不在黑名单)")
|
||||||
private String valid;
|
private String valid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(未提交/审批中/已审批/已驳回)
|
* 状态(未提交/审批中/已审批/已驳回)
|
||||||
*/
|
*/
|
||||||
@LogField(name="状态(未提交/审批中/已审批/已驳回)",index=28)
|
@LogField(name="状态(未提交/审批中/已审批/已驳回)",index=28)
|
||||||
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
|
@ApiModelProperty("状态")
|
||||||
private String approCode;
|
private String approCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -112,12 +112,7 @@ public class CustomerController {
|
|||||||
@ApiOperation(value = "新增LngCustomer")
|
@ApiOperation(value = "新增LngCustomer")
|
||||||
@SaCheckPermission("customer:add")
|
@SaCheckPermission("customer:add")
|
||||||
public R add(@Valid @RequestBody UpdateLngCustomerDto dto){
|
public R add(@Valid @RequestBody UpdateLngCustomerDto dto){
|
||||||
// String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
|
||||||
// dto.setCuCode("C"+code);
|
|
||||||
// Long id = customerService.add(dto);
|
|
||||||
// dto.setId(id);
|
|
||||||
// codeRuleClient.useEncode(CUSTOMER_CODE);
|
|
||||||
// return R.ok(dto);
|
|
||||||
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
||||||
dto.setCuCode("C"+code);
|
dto.setCuCode("C"+code);
|
||||||
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() {
|
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() {
|
||||||
@ -131,9 +126,9 @@ public class CustomerController {
|
|||||||
@Override
|
@Override
|
||||||
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
|
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||||
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
|
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
|
||||||
if (StringUtils.isNotEmpty(msg)) {
|
if (StringUtils.isNotEmpty(msg)) {
|
||||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||||
}
|
}
|
||||||
codeRuleClient.useEncode(CUSTOMER_CODE);
|
codeRuleClient.useEncode(CUSTOMER_CODE);
|
||||||
return content.getObj();
|
return content.getObj();
|
||||||
}
|
}
|
||||||
@ -146,24 +141,23 @@ 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){
|
||||||
// customerService.update(dto);
|
|
||||||
// return R.ok();
|
|
||||||
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngCustomerDto>() {
|
|
||||||
|
|
||||||
@Override
|
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngCustomerDto>() {
|
||||||
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
|
||||||
return content.getObj();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
|
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||||
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
|
return content.getObj();
|
||||||
if (StringUtils.isNotEmpty(msg)) {
|
}
|
||||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
|
||||||
}
|
@Override
|
||||||
return content.getObj();
|
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||||
}
|
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
|
||||||
}));
|
if (StringUtils.isNotEmpty(msg)) {
|
||||||
|
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||||
|
}
|
||||||
|
return content.getObj();
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
package com.xjrsoft.module.sales.service;
|
package com.xjrsoft.module.sales.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import java.util.List;
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseService;
|
import com.github.yulichang.base.MPJBaseService;
|
||||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
|
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomer;
|
import com.xjrsoft.module.sales.entity.LngCustomer;
|
||||||
import lombok.Data;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: service
|
* @title: service
|
||||||
@ -17,22 +15,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepService<LngCustomer>, MPJRelationService<LngCustomer> {
|
public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepService<LngCustomer>, MPJRelationService<LngCustomer> {
|
||||||
/**
|
|
||||||
* 新增
|
|
||||||
*
|
|
||||||
* @param lngCustomer
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
|
|
||||||
Long add(UpdateLngCustomerDto updateLngCustomerDto);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新
|
|
||||||
*
|
|
||||||
* @param lngCustomer
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean update(UpdateLngCustomerDto updateLngCustomerDto);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
|
|||||||
@ -9,11 +9,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerAttrPowerDto;
|
|
||||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerBankDto;
|
|
||||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerContactDto;
|
|
||||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDocDto;
|
|
||||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
|
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomer;
|
import com.xjrsoft.module.sales.entity.LngCustomer;
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomerAttrPower;
|
import com.xjrsoft.module.sales.entity.LngCustomerAttrPower;
|
||||||
import com.xjrsoft.module.sales.entity.LngCustomerBank;
|
import com.xjrsoft.module.sales.entity.LngCustomerBank;
|
||||||
@ -26,9 +21,7 @@ import com.xjrsoft.module.sales.mapper.LngCustomerDocMapper;
|
|||||||
import com.xjrsoft.module.sales.mapper.LngCustomerMapper;
|
import com.xjrsoft.module.sales.mapper.LngCustomerMapper;
|
||||||
import com.xjrsoft.module.sales.service.ICustomerService;
|
import com.xjrsoft.module.sales.service.ICustomerService;
|
||||||
import com.xjrsoft.module.system.client.IFileClient;
|
import com.xjrsoft.module.system.client.IFileClient;
|
||||||
import com.xjrsoft.module.system.dto.LngFileUploadBindDto;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
@ -51,237 +44,6 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
|||||||
private final IFileClient fileClient;
|
private final IFileClient fileClient;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Long add(UpdateLngCustomerDto updateLngCustomerDto) {
|
|
||||||
|
|
||||||
LngCustomer lngCustomer = new LngCustomer();
|
|
||||||
BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer);
|
|
||||||
lngCustomerMapper.insert(lngCustomer);
|
|
||||||
for (UpdateLngCustomerAttrPowerDto updateLngCustomerAttrPowerDto : updateLngCustomerDto.getLngCustomerAttrPowerList()) {
|
|
||||||
LngCustomerAttrPower lngCustomerAttrPower = new LngCustomerAttrPower();
|
|
||||||
BeanUtil.copyProperties(updateLngCustomerAttrPowerDto, lngCustomerAttrPower);
|
|
||||||
lngCustomerAttrPower.setCuCode(lngCustomer.getCuCode());
|
|
||||||
lngCustomerAttrPowerMapper.insert(lngCustomerAttrPower);
|
|
||||||
}
|
|
||||||
for (UpdateLngCustomerBankDto updateLngCustomerBankDto : updateLngCustomerDto.getLngCustomerBankList()) {
|
|
||||||
LngCustomerBank lngCustomerBank = new LngCustomerBank();
|
|
||||||
BeanUtil.copyProperties(updateLngCustomerBankDto, lngCustomerBank);
|
|
||||||
lngCustomerBank.setCuCode(lngCustomer.getCuCode());
|
|
||||||
lngCustomerBankMapper.insert(lngCustomerBank);
|
|
||||||
}
|
|
||||||
for (UpdateLngCustomerDocDto updateLngCustomerDocDto : updateLngCustomerDto.getLngCustomerDocList()) {
|
|
||||||
LngCustomerDoc lngCustomerDoc = new LngCustomerDoc();
|
|
||||||
BeanUtil.copyProperties(updateLngCustomerDocDto, lngCustomerDoc);
|
|
||||||
lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
|
|
||||||
lngCustomerDocMapper.insert(lngCustomerDoc);
|
|
||||||
|
|
||||||
if(CollectionUtil.isNotEmpty(updateLngCustomerDocDto.getFileList())) {
|
|
||||||
LngFileUploadBindDto bindDto = new LngFileUploadBindDto();
|
|
||||||
bindDto.setTableId(updateLngCustomerDocDto.getId());
|
|
||||||
bindDto.setTableName("lng_customer_doc");
|
|
||||||
bindDto.setColumnName("fileList");
|
|
||||||
bindDto.setFiles(updateLngCustomerDocDto.getFileList());
|
|
||||||
fileClient.bindTableData(bindDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
for (UpdateLngCustomerContactDto updateLngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) {
|
|
||||||
LngCustomerContact lngCustomerContact = new LngCustomerContact();
|
|
||||||
BeanUtil.copyProperties(updateLngCustomerContactDto, lngCustomerContact);
|
|
||||||
lngCustomerContact.setCuCode(lngCustomer.getCuCode());
|
|
||||||
lngCustomerContactMapper.insert(lngCustomerContact);
|
|
||||||
}
|
|
||||||
if(updateLngCustomerDto.getLngFileUploadList() != null) {
|
|
||||||
LngFileUploadBindDto bindDto = new LngFileUploadBindDto();
|
|
||||||
bindDto.setTableId(updateLngCustomerDto.getId());
|
|
||||||
bindDto.setTableName("lng_customer");
|
|
||||||
bindDto.setColumnName("lngFileUploadList");
|
|
||||||
bindDto.setFiles(updateLngCustomerDto.getLngFileUploadList());
|
|
||||||
fileClient.bindTableData(bindDto);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return lngCustomer.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Boolean update(UpdateLngCustomerDto updateLngCustomerDto) {
|
|
||||||
LngCustomer lngCustomer = new LngCustomer();
|
|
||||||
BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer);
|
|
||||||
lngCustomerMapper.updateById(lngCustomer);
|
|
||||||
//********************************* LngCustomerAttrPower 增删改 开始 *******************************************/
|
|
||||||
{
|
|
||||||
// 查出所有子级的id
|
|
||||||
List<LngCustomerAttrPower> lngCustomerAttrPowerList = lngCustomerAttrPowerMapper.selectList(Wrappers.lambdaQuery(LngCustomerAttrPower.class).eq(LngCustomerAttrPower::getCuCode, lngCustomer.getCuCode()).select(LngCustomerAttrPower::getId));
|
|
||||||
List<Long> lngCustomerAttrPowerIds = lngCustomerAttrPowerList.stream().map(LngCustomerAttrPower::getId).collect(Collectors.toList());
|
|
||||||
//原有子表单 没有被删除的主键
|
|
||||||
List<Long> lngCustomerAttrPowerOldIds = updateLngCustomerDto.getLngCustomerAttrPowerList().stream().map(UpdateLngCustomerAttrPowerDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
//找到需要删除的id
|
|
||||||
List<Long> lngCustomerAttrPowerRemoveIds = lngCustomerAttrPowerIds.stream().filter(item -> !lngCustomerAttrPowerOldIds.contains(item)).collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (UpdateLngCustomerAttrPowerDto lngCustomerAttrPowerDto : updateLngCustomerDto.getLngCustomerAttrPowerList()) {
|
|
||||||
LngCustomerAttrPower lngCustomerAttrPower = new LngCustomerAttrPower();
|
|
||||||
BeanUtil.copyProperties(lngCustomerAttrPowerDto, lngCustomerAttrPower);
|
|
||||||
//如果不等于空则修改
|
|
||||||
if (lngCustomerAttrPower.getId() != null) {
|
|
||||||
|
|
||||||
lngCustomerAttrPowerMapper.updateById(lngCustomerAttrPower);
|
|
||||||
}
|
|
||||||
//如果等于空 则新增
|
|
||||||
else {
|
|
||||||
//已经不存在的id 删除
|
|
||||||
lngCustomerAttrPower.setCuCode(lngCustomer.getCuCode());
|
|
||||||
lngCustomerAttrPowerMapper.insert(lngCustomerAttrPower);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//已经不存在的id 删除
|
|
||||||
if(lngCustomerAttrPowerRemoveIds.size() > 0){
|
|
||||||
lngCustomerAttrPowerMapper.deleteBatchIds(lngCustomerAttrPowerRemoveIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//********************************* LngCustomerAttrPower 增删改 结束 *******************************************/
|
|
||||||
|
|
||||||
//********************************* LngCustomerBank 增删改 开始 *******************************************/
|
|
||||||
{
|
|
||||||
// 查出所有子级的id
|
|
||||||
List<LngCustomerBank> lngCustomerBankList = lngCustomerBankMapper.selectList(Wrappers.lambdaQuery(LngCustomerBank.class).eq(LngCustomerBank::getCuCode, lngCustomer.getCuCode()).select(LngCustomerBank::getId));
|
|
||||||
List<Long> lngCustomerBankIds = lngCustomerBankList.stream().map(LngCustomerBank::getId).collect(Collectors.toList());
|
|
||||||
//原有子表单 没有被删除的主键
|
|
||||||
List<Long> lngCustomerBankOldIds = updateLngCustomerDto.getLngCustomerBankList().stream().map(UpdateLngCustomerBankDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
//找到需要删除的id
|
|
||||||
List<Long> lngCustomerBankRemoveIds = lngCustomerBankIds.stream().filter(item -> !lngCustomerBankOldIds.contains(item)).collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (UpdateLngCustomerBankDto lngCustomerBankDto : updateLngCustomerDto.getLngCustomerBankList()) {
|
|
||||||
LngCustomerBank lngCustomerBank = new LngCustomerBank();
|
|
||||||
BeanUtil.copyProperties(lngCustomerBankDto, lngCustomerBank);
|
|
||||||
//如果不等于空则修改
|
|
||||||
if (lngCustomerBank.getId() != null) {
|
|
||||||
lngCustomerBankMapper.updateById(lngCustomerBank);
|
|
||||||
}
|
|
||||||
//如果等于空 则新增
|
|
||||||
else {
|
|
||||||
//已经不存在的id 删除
|
|
||||||
lngCustomerBank.setCuCode(lngCustomer.getCuCode());
|
|
||||||
lngCustomerBankMapper.insert(lngCustomerBank);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//已经不存在的id 删除
|
|
||||||
if(lngCustomerBankRemoveIds.size() > 0){
|
|
||||||
lngCustomerBankMapper.deleteBatchIds(lngCustomerBankRemoveIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//********************************* LngCustomerBank 增删改 结束 *******************************************/
|
|
||||||
|
|
||||||
//********************************* LngCustomerDoc 增删改 开始 *******************************************/
|
|
||||||
{
|
|
||||||
// 查出所有子级的id
|
|
||||||
List<LngCustomerDoc> lngCustomerDocList = lngCustomerDocMapper.selectList(Wrappers.lambdaQuery(LngCustomerDoc.class).eq(LngCustomerDoc::getCuCode, lngCustomer.getCuCode()).select(LngCustomerDoc::getId));
|
|
||||||
List<Long> lngCustomerDocIds = lngCustomerDocList.stream().map(LngCustomerDoc::getId).collect(Collectors.toList());
|
|
||||||
//原有子表单 没有被删除的主键
|
|
||||||
List<Long> lngCustomerDocOldIds = updateLngCustomerDto.getLngCustomerDocList().stream().map(UpdateLngCustomerDocDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
//找到需要删除的id
|
|
||||||
List<Long> lngCustomerDocRemoveIds = lngCustomerDocIds.stream().filter(item -> !lngCustomerDocOldIds.contains(item)).collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (UpdateLngCustomerDocDto lngCustomerDocDto : updateLngCustomerDto.getLngCustomerDocList()) {
|
|
||||||
LngCustomerDoc lngCustomerDoc = new LngCustomerDoc();
|
|
||||||
BeanUtil.copyProperties(lngCustomerDocDto, lngCustomerDoc);
|
|
||||||
//如果不等于空则修改
|
|
||||||
if (lngCustomerDoc.getId() != null) {
|
|
||||||
|
|
||||||
lngCustomerDocMapper.updateById(lngCustomerDoc);
|
|
||||||
//lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").eq(LngFileUpload::getTableId, lngCustomerDoc.getId()));
|
|
||||||
}
|
|
||||||
//如果等于空 则新增
|
|
||||||
else {
|
|
||||||
//已经不存在的id 删除
|
|
||||||
lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
|
|
||||||
lngCustomerDocMapper.insert(lngCustomerDoc);
|
|
||||||
}
|
|
||||||
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 删除
|
|
||||||
if(lngCustomerDocRemoveIds.size() > 0){
|
|
||||||
lngCustomerDocMapper.deleteBatchIds(lngCustomerDocRemoveIds);
|
|
||||||
//lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").in(LngFileUpload::getTableId, lngCustomerDocRemoveIds));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//********************************* LngCustomerDoc 增删改 结束 *******************************************/
|
|
||||||
|
|
||||||
//********************************* LngCustomerContact 增删改 开始 *******************************************/
|
|
||||||
{
|
|
||||||
// 查出所有子级的id
|
|
||||||
List<LngCustomerContact> lngCustomerContactList = lngCustomerContactMapper.selectList(Wrappers.lambdaQuery(LngCustomerContact.class).eq(LngCustomerContact::getCuCode, lngCustomer.getCuCode()).select(LngCustomerContact::getId));
|
|
||||||
List<Long> lngCustomerContactIds = lngCustomerContactList.stream().map(LngCustomerContact::getId).collect(Collectors.toList());
|
|
||||||
//原有子表单 没有被删除的主键
|
|
||||||
List<Long> lngCustomerContactOldIds = updateLngCustomerDto.getLngCustomerContactList().stream().map(UpdateLngCustomerContactDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
//找到需要删除的id
|
|
||||||
List<Long> lngCustomerContactRemoveIds = lngCustomerContactIds.stream().filter(item -> !lngCustomerContactOldIds.contains(item)).collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (UpdateLngCustomerContactDto lngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) {
|
|
||||||
LngCustomerContact lngCustomerContact = new LngCustomerContact();
|
|
||||||
BeanUtil.copyProperties(lngCustomerContactDto, lngCustomerContact);
|
|
||||||
//如果不等于空则修改
|
|
||||||
if (lngCustomerContact.getId() != null) {
|
|
||||||
lngCustomerContactMapper.updateById(lngCustomerContact);
|
|
||||||
}
|
|
||||||
//如果等于空 则新增
|
|
||||||
else {
|
|
||||||
//已经不存在的id 删除
|
|
||||||
lngCustomerContact.setCuCode(lngCustomer.getCuCode());
|
|
||||||
lngCustomerContactMapper.insert(lngCustomerContact);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//已经不存在的id 删除
|
|
||||||
if(lngCustomerContactRemoveIds.size() > 0){
|
|
||||||
lngCustomerContactMapper.deleteBatchIds(lngCustomerContactRemoveIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//********************************* LngCustomerContact 增删改 结束 *******************************************/
|
|
||||||
|
|
||||||
//********************************* LngFileUpload 增删改 开始 *******************************************/
|
|
||||||
{
|
|
||||||
// 查出所有子级的id
|
|
||||||
// List<LngFileUpload> lngFileUploadList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer").eq(LngFileUpload::getTableId, lngCustomer.getId()).select(LngFileUpload::getId));
|
|
||||||
// List<Long> lngFileUploadIds = lngFileUploadList.stream().map(LngFileUpload::getId).collect(Collectors.toList());
|
|
||||||
// //原有子表单 没有被删除的主键
|
|
||||||
// List<Long> lngFileUploadOldIds = updateLngCustomerDto.getLngFileUploadList().stream().map(UpdateLngFileUploadDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
// //找到需要删除的id
|
|
||||||
// List<Long> lngFileUploadRemoveIds = lngFileUploadIds.stream().filter(item -> !lngFileUploadOldIds.contains(item)).collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// for (UpdateLngFileUploadDto lngFileUploadDto : updateLngCustomerDto.getLngFileUploadList()) {
|
|
||||||
// LngFileUpload lngFileUpload = new LngFileUpload();
|
|
||||||
// BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
|
|
||||||
// lngFileUpload.setTableName("lng_customer");
|
|
||||||
// //如果不等于空则修改
|
|
||||||
// if (lngFileUpload.getId() != null) {
|
|
||||||
// lngFileUploadMapper.updateById(lngFileUpload);
|
|
||||||
// }
|
|
||||||
// //如果等于空 则新增
|
|
||||||
// else {
|
|
||||||
// lngFileUpload.setTableId(lngCustomer.getId());
|
|
||||||
// lngFileUploadMapper.insert(lngFileUpload);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //已经不存在的id 删除
|
|
||||||
// if(lngFileUploadRemoveIds.size() > 0){
|
|
||||||
// lngFileUploadMapper.deleteBatchIds(lngFileUploadRemoveIds);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
//********************************* LngFileUpload 增删改 结束 *******************************************/
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ -294,7 +56,6 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
|||||||
lngCustomerBankMapper.delete(Wrappers.lambdaQuery(LngCustomerBank.class).in(LngCustomerBank::getCuCode, cuCodeList));
|
lngCustomerBankMapper.delete(Wrappers.lambdaQuery(LngCustomerBank.class).in(LngCustomerBank::getCuCode, cuCodeList));
|
||||||
lngCustomerDocMapper.delete(Wrappers.lambdaQuery(LngCustomerDoc.class).in(LngCustomerDoc::getCuCode, cuCodeList));
|
lngCustomerDocMapper.delete(Wrappers.lambdaQuery(LngCustomerDoc.class).in(LngCustomerDoc::getCuCode, cuCodeList));
|
||||||
lngCustomerContactMapper.delete(Wrappers.lambdaQuery(LngCustomerContact.class).in(LngCustomerContact::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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,36 +1,39 @@
|
|||||||
package com.xjrsoft.module.supplier.controller;
|
package com.xjrsoft.module.supplier.controller;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import java.util.List;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
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.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.xjrsoft.common.model.result.R;
|
||||||
import com.xjrsoft.common.constant.GlobalConstant;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
||||||
import com.xjrsoft.common.page.ConventPage;
|
import com.xjrsoft.common.page.ConventPage;
|
||||||
import com.xjrsoft.common.page.PageOutput;
|
import com.xjrsoft.common.page.PageOutput;
|
||||||
import com.xjrsoft.common.model.result.R;
|
|
||||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||||
import com.xjrsoft.module.supplier.dto.AddLngSupplierDto;
|
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||||
import com.xjrsoft.module.supplier.dto.UpdateLngSupplierDto;
|
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
||||||
|
|
||||||
import com.xjrsoft.module.supplier.dto.LngSupplierPageDto;
|
import com.xjrsoft.module.supplier.dto.LngSupplierPageDto;
|
||||||
|
import com.xjrsoft.module.supplier.dto.UpdateLngSupplierDto;
|
||||||
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
||||||
import com.xjrsoft.module.supplier.service.ISupplierService;
|
import com.xjrsoft.module.supplier.service.ISupplierService;
|
||||||
import com.xjrsoft.module.supplier.vo.LngSupplierPageVo;
|
import com.xjrsoft.module.supplier.vo.LngSupplierPageVo;
|
||||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
|
||||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
|
||||||
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
|
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: 供应商
|
* @title: 供应商
|
||||||
@ -39,8 +42,8 @@ import java.util.List;
|
|||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/supplier" + "/supplier")
|
@RequestMapping("/supplier/supplier")
|
||||||
@Api(value = "/supplier" + "/supplier",tags = "供应商代码")
|
@Api(value = "/supplier/supplier",tags = "供应商代码")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class SupplierController {
|
public class SupplierController {
|
||||||
|
|
||||||
@ -61,7 +64,7 @@ public class SupplierController {
|
|||||||
.like(StrUtil.isNotBlank(dto.getTypeCode()),LngSupplier::getTypeCode,dto.getTypeCode())
|
.like(StrUtil.isNotBlank(dto.getTypeCode()),LngSupplier::getTypeCode,dto.getTypeCode())
|
||||||
.like(StrUtil.isNotBlank(dto.getClassCode()),LngSupplier::getClassCode,dto.getClassCode())
|
.like(StrUtil.isNotBlank(dto.getClassCode()),LngSupplier::getClassCode,dto.getClassCode())
|
||||||
.like(StrUtil.isNotBlank(dto.getDI()),LngSupplier::getDI,dto.getDI())
|
.like(StrUtil.isNotBlank(dto.getDI()),LngSupplier::getDI,dto.getDI())
|
||||||
.like(StrUtil.isNotBlank(dto.getValid()),LngSupplier::getValid,dto.getValid())
|
.eq(StrUtil.isNotBlank(dto.getValid()),LngSupplier::getValid,dto.getValid())
|
||||||
.like(StrUtil.isNotBlank(dto.getApproCode()),LngSupplier::getApproCode,dto.getApproCode())
|
.like(StrUtil.isNotBlank(dto.getApproCode()),LngSupplier::getApproCode,dto.getApproCode())
|
||||||
.orderByDesc(LngSupplier::getId)
|
.orderByDesc(LngSupplier::getId)
|
||||||
.select(LngSupplier.class,x -> VoToColumnUtil.fieldsToColumns(LngSupplierPageVo.class).contains(x.getProperty()));
|
.select(LngSupplier.class,x -> VoToColumnUtil.fieldsToColumns(LngSupplierPageVo.class).contains(x.getProperty()));
|
||||||
@ -109,7 +112,7 @@ public class SupplierController {
|
|||||||
@ApiOperation(value = "删除")
|
@ApiOperation(value = "删除")
|
||||||
@SaCheckPermission("supplier:delete")
|
@SaCheckPermission("supplier:delete")
|
||||||
public R delete(@Valid @RequestBody List<Long> ids){
|
public R delete(@Valid @RequestBody List<Long> ids){
|
||||||
return R.ok(dataService.deleteByIds(UpdateLngSupplierDto.class, ids));
|
return R.ok(dataService.deleteByIds(UpdateLngSupplierDto.class, ids));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +120,7 @@ public class SupplierController {
|
|||||||
@ApiOperation(value = "启用LngSupplier")
|
@ApiOperation(value = "启用LngSupplier")
|
||||||
@SaCheckPermission("supplier:enable")
|
@SaCheckPermission("supplier:enable")
|
||||||
public R enable(@Valid @RequestBody List<Long> ids){
|
public R enable(@Valid @RequestBody List<Long> ids){
|
||||||
return R.ok(dataService.enable(UpdateLngSupplierDto.class,ids));
|
return R.ok(dataService.enable(UpdateLngSupplierDto.class,ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,7 +128,7 @@ public class SupplierController {
|
|||||||
@ApiOperation(value = "禁用LngSupplier")
|
@ApiOperation(value = "禁用LngSupplier")
|
||||||
@SaCheckPermission("supplier:disable")
|
@SaCheckPermission("supplier:disable")
|
||||||
public R disable(@Valid @RequestBody List<Long> ids){
|
public R disable(@Valid @RequestBody List<Long> ids){
|
||||||
return R.ok(dataService.disable(UpdateLngSupplierDto.class,ids));
|
return R.ok(dataService.disable(UpdateLngSupplierDto.class,ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user