修复bug
This commit is contained in:
@ -163,7 +163,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(customerService.delete(ids));
|
|
||||||
return R.ok(dataService.deleteByIds(UpdateLngCustomerDto.class,ids, new DataOperationListener<UpdateLngCustomerDto>() {
|
return R.ok(dataService.deleteByIds(UpdateLngCustomerDto.class,ids, new DataOperationListener<UpdateLngCustomerDto>() {
|
||||||
@Override
|
@Override
|
||||||
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||||
@ -182,7 +182,10 @@ public class CustomerController {
|
|||||||
@ApiOperation(value = "启用LngCustomer")
|
@ApiOperation(value = "启用LngCustomer")
|
||||||
@SaCheckPermission("customer:enable")
|
@SaCheckPermission("customer:enable")
|
||||||
public R enable(@Valid @RequestBody List<Long> ids){
|
public R enable(@Valid @RequestBody List<Long> ids){
|
||||||
|
Long count = customerService.countDisableByIds(ids);
|
||||||
|
if(count != null && count > 0) {
|
||||||
|
throw new BusinessException(BusinessCode.of(10500, "只能对已审批的客户才能进行启用操作"));
|
||||||
|
}
|
||||||
return R.ok(dataService.enable(UpdateLngCustomerDto.class,ids, new DataOperationListener<UpdateLngCustomerDto>() {
|
return R.ok(dataService.enable(UpdateLngCustomerDto.class,ids, new DataOperationListener<UpdateLngCustomerDto>() {
|
||||||
@Override
|
@Override
|
||||||
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||||
@ -201,7 +204,10 @@ public class CustomerController {
|
|||||||
@ApiOperation(value = "禁用LngCustomer")
|
@ApiOperation(value = "禁用LngCustomer")
|
||||||
@SaCheckPermission("customer:disable")
|
@SaCheckPermission("customer:disable")
|
||||||
public R disable(@Valid @RequestBody List<Long> ids){
|
public R disable(@Valid @RequestBody List<Long> ids){
|
||||||
//return R.ok(dataService.disable(UpdateLngCustomerDto.class,ids));
|
Long count = customerService.countDisableByIds(ids);
|
||||||
|
if(count != null && count > 0) {
|
||||||
|
throw new BusinessException(BusinessCode.of(10500, "只能对已审批的客户才能进行作废操作"));
|
||||||
|
}
|
||||||
return R.ok(dataService.disable(UpdateLngCustomerDto.class,ids, new DataOperationListener<UpdateLngCustomerDto>() {
|
return R.ok(dataService.disable(UpdateLngCustomerDto.class,ids, new DataOperationListener<UpdateLngCustomerDto>() {
|
||||||
@Override
|
@Override
|
||||||
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||||
|
|||||||
@ -17,16 +17,12 @@ import com.xjrsoft.module.sales.vo.LngCustomerVo;
|
|||||||
|
|
||||||
public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepService<LngCustomer>, MPJRelationService<LngCustomer> {
|
public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepService<LngCustomer>, MPJRelationService<LngCustomer> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean delete(List<Long> ids);
|
|
||||||
|
|
||||||
LngCustomerVo getCustomerById(Long id);
|
LngCustomerVo getCustomerById(Long id);
|
||||||
|
|
||||||
LngCustomer getByCode(String code);
|
LngCustomer getByCode(String code);
|
||||||
|
|
||||||
|
Long countDisableByIds(List<Long> ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
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.pictc.enums.ApproveCodeEnum;
|
||||||
import com.pictc.enums.BusinessCode;
|
import com.pictc.enums.BusinessCode;
|
||||||
import com.xjrsoft.common.exception.BusinessException;
|
import com.xjrsoft.common.exception.BusinessException;
|
||||||
import com.xjrsoft.module.mdm.client.ILngBankClient;
|
import com.xjrsoft.module.mdm.client.ILngBankClient;
|
||||||
@ -46,12 +47,9 @@ import lombok.AllArgsConstructor;
|
|||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, LngCustomer> implements ICustomerService {
|
public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, LngCustomer> implements ICustomerService {
|
||||||
|
|
||||||
private final LngCustomerMapper lngCustomerMapper;
|
private final LngCustomerMapper lngCustomerMapper;
|
||||||
|
|
||||||
private final LngCustomerAttrPowerMapper lngCustomerAttrPowerMapper;
|
|
||||||
private final LngCustomerBankMapper lngCustomerBankMapper;
|
|
||||||
private final LngCustomerDocMapper lngCustomerDocMapper;
|
|
||||||
private final LngCustomerContactMapper lngCustomerContactMapper;
|
|
||||||
|
|
||||||
private final IFileClient fileClient;
|
private final IFileClient fileClient;
|
||||||
|
|
||||||
@ -59,21 +57,6 @@ 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);
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LngCustomerVo getCustomerById(Long id) {
|
public LngCustomerVo getCustomerById(Long id) {
|
||||||
|
|
||||||
@ -115,4 +98,12 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
|||||||
queryWrapper.eq(LngCustomer::getCuCode,code);
|
queryWrapper.eq(LngCustomer::getCuCode,code);
|
||||||
return baseMapper.selectOne(queryWrapper);
|
return baseMapper.selectOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countDisableByIds(List<Long> ids) {
|
||||||
|
LambdaQueryWrapper<LngCustomer> queryWrapper = new LambdaQueryWrapper<LngCustomer>();
|
||||||
|
queryWrapper.in(LngCustomer::getId,ids);
|
||||||
|
queryWrapper.ne(LngCustomer::getApproCode, ApproveCodeEnum.YSP.getCode());
|
||||||
|
return baseMapper.selectCount(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -178,7 +178,10 @@ 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));
|
Long count = supplierService.countDisableByIds(ids);
|
||||||
|
if(count != null && count > 0) {
|
||||||
|
throw new BusinessException(BusinessCode.of(10500, "只能对已审批的供应商才能进行启用操作"));
|
||||||
|
}
|
||||||
return R.ok(dataService.enable(UpdateLngSupplierDto.class,ids, new DataOperationListener<UpdateLngSupplierDto>() {
|
return R.ok(dataService.enable(UpdateLngSupplierDto.class,ids, new DataOperationListener<UpdateLngSupplierDto>() {
|
||||||
@Override
|
@Override
|
||||||
public UpdateLngSupplierDto before(DataOperationContent<UpdateLngSupplierDto> content) {
|
public UpdateLngSupplierDto before(DataOperationContent<UpdateLngSupplierDto> content) {
|
||||||
@ -197,7 +200,10 @@ 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));
|
Long count = supplierService.countDisableByIds(ids);
|
||||||
|
if(count != null && count > 0) {
|
||||||
|
throw new BusinessException(BusinessCode.of(10500, "只能对已审批的供应商才能进行作废操作"));
|
||||||
|
}
|
||||||
return R.ok(dataService.disable(UpdateLngSupplierDto.class,ids, new DataOperationListener<UpdateLngSupplierDto>() {
|
return R.ok(dataService.disable(UpdateLngSupplierDto.class,ids, new DataOperationListener<UpdateLngSupplierDto>() {
|
||||||
@Override
|
@Override
|
||||||
public UpdateLngSupplierDto before(DataOperationContent<UpdateLngSupplierDto> content) {
|
public UpdateLngSupplierDto before(DataOperationContent<UpdateLngSupplierDto> content) {
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import com.xjrsoft.module.supplier.vo.LngSupplierVo;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: service
|
* @title: service
|
||||||
* @Author 管理员
|
* @Author 管理员
|
||||||
@ -33,4 +35,6 @@ public interface ISupplierService extends MPJBaseService<LngSupplier>, MPJDeepSe
|
|||||||
|
|
||||||
LngSupplier getByCode(String code);
|
LngSupplier getByCode(String code);
|
||||||
|
|
||||||
|
Long countDisableByIds(@Valid List<Long> ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,15 +4,17 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
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.pictc.enums.ApproveCodeEnum;
|
||||||
import com.xjrsoft.module.mdm.client.ILngBankClient;
|
import com.xjrsoft.module.mdm.client.ILngBankClient;
|
||||||
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
|
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
|
||||||
import com.xjrsoft.module.sales.vo.LngCustomerBankVo;
|
|
||||||
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
||||||
import com.xjrsoft.module.supplier.entity.LngSupplierBank;
|
import com.xjrsoft.module.supplier.entity.LngSupplierBank;
|
||||||
import com.xjrsoft.module.supplier.entity.LngSupplierContact;
|
import com.xjrsoft.module.supplier.entity.LngSupplierContact;
|
||||||
@ -102,6 +104,14 @@ public class SupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierMapper, L
|
|||||||
return baseMapper.selectOne(queryWrapper);
|
return baseMapper.selectOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countDisableByIds(@Valid List<Long> ids) {
|
||||||
|
LambdaQueryWrapper<LngSupplier> queryWrapper = new LambdaQueryWrapper<LngSupplier>();
|
||||||
|
queryWrapper.in(LngSupplier::getId,ids);
|
||||||
|
queryWrapper.ne(LngSupplier::getApproCode, ApproveCodeEnum.YSP.getCode());
|
||||||
|
return baseMapper.selectCount(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user