Browse Source

修改客户信息

dev-warehouse
caoyizhong 2 years ago
parent
commit
8a7246a49a
  1. 10
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStoreContactEntity.java
  2. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java
  3. 11
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataStoreContactController.java
  4. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java
  5. 1
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataStoreContactService.java
  6. 15
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java
  7. 13
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataStoreBrandServiceImpl.java
  8. 25
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataStoreContactServiceImpl.java

10
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStoreContactEntity.java

@ -64,9 +64,9 @@ public class BasicdataStoreContactEntity extends TenantEntity {
@ApiModelProperty(value = "预留5")
private String reserve5;
/**
* 门店名称
* 客户ID
*/
@ApiModelProperty(value = "门店名称")
@ApiModelProperty(value = "客户ID")
private Long shopId;
/**
* 联系人
@ -84,5 +84,9 @@ public class BasicdataStoreContactEntity extends TenantEntity {
*/
@ApiModelProperty(value = "区分类型")
private Integer partitionType;
/**
* 默认联系人
*/
@ApiModelProperty(value = "默认联系人")
private Boolean defaultType;
}

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java

@ -155,7 +155,7 @@ public class BasicdataClientController extends BladeController {
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(basicdataClientService.deleteLogic(Func.toLongList(ids)));
return R.status(basicdataClientService.ownDeleteLogic(Func.toLongList(ids)));
}

11
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataStoreContactController.java

@ -16,6 +16,7 @@
*/
package com.logpm.basicdata.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -97,6 +98,14 @@ public class BasicdataStoreContactController extends BladeController {
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入basicdataStoreContact")
public R save(@Valid @RequestBody BasicdataStoreContactEntity basicdataStoreContact) {
List<BasicdataStoreContactEntity> storeContactEntities = basicdataStoreContactService.list(Wrappers.<BasicdataStoreContactEntity>query().lambda()
.eq(BasicdataStoreContactEntity::getShopId, basicdataStoreContact.getShopId())
);
if(storeContactEntities.size() > 0){
basicdataStoreContact.setDefaultType(false);
}else{
basicdataStoreContact.setDefaultType(true);
}
return R.status(basicdataStoreContactService.save(basicdataStoreContact));
}
@ -107,7 +116,7 @@ public class BasicdataStoreContactController extends BladeController {
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入basicdataStoreContact")
public R update(@Valid @RequestBody BasicdataStoreContactEntity basicdataStoreContact) {
return R.status(basicdataStoreContactService.updateById(basicdataStoreContact));
return R.status(basicdataStoreContactService.ownUpdateById(basicdataStoreContact));
}
/**

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java

@ -57,4 +57,6 @@ public interface IBasicdataClientService extends BaseService<BasicdataClientEnti
boolean ownSaveOrUpdate(BasicdataClientEntity basicdataClient);
List<BasicdataClientEntity> listName(String name);
Boolean ownDeleteLogic(List<Long> toLongList);
}

1
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataStoreContactService.java

@ -49,4 +49,5 @@ public interface IBasicdataStoreContactService extends BaseService<BasicdataStor
*/
List<BasicdataStoreContactExcel> exportBasicdataStoreContact(Wrapper<BasicdataStoreContactEntity> queryWrapper);
Boolean ownUpdateById(BasicdataStoreContactEntity basicdataStoreContact);
}

15
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java

@ -141,4 +141,19 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean ownDeleteLogic(List<Long> toLongList) {
toLongList.forEach( i ->{
List<BasicdataClientEntity> basicdataClientEntities = baseMapper.selectList(Wrappers.<BasicdataClientEntity>query().lambda()
.eq(BasicdataClientEntity::getPid, i)
);
if(basicdataClientEntities.size() > 0){
baseMapper.deleteBatchIds(basicdataClientEntities);
}
});
return this.deleteLogic(toLongList);
}
}

13
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataStoreBrandServiceImpl.java

@ -72,18 +72,17 @@ public class BasicdataStoreBrandServiceImpl extends BaseServiceImpl<BasicdataSto
@Override
public Boolean submitSave(BasicdataStoreBrandEntity basicdataStoreBrand) {
//查询客户id
List<BasicdataShopEntity> list = basicdataShopService.list(Wrappers.<BasicdataShopEntity>query().lambda()
.eq(BasicdataShopEntity::getId, basicdataStoreBrand.getShopId())
);
// List<BasicdataShopEntity> list = basicdataShopService.list(Wrappers.<BasicdataShopEntity>query().lambda()
// .eq(BasicdataShopEntity::getId, basicdataStoreBrand.getShopId())
// );
List<BasicdataStoreBrandEntity> basicdataStoreBrandEntities = baseMapper.selectList(Wrappers.<BasicdataStoreBrandEntity>query().lambda()
.eq(BasicdataStoreBrandEntity::getShopId, basicdataStoreBrand.getShopId())
.eq(BasicdataStoreBrandEntity::getBrandId, basicdataStoreBrand.getBrandId())
.eq(BasicdataStoreBrandEntity::getClientId,list.get(0).getClientId())
.eq(BasicdataStoreBrandEntity::getClientId,basicdataStoreBrand.getShopId())
);
if(basicdataStoreBrandEntities.size() > 0){
throw new RuntimeException("当前门店已拥有该品牌!");
throw new RuntimeException("当前已拥有该品牌!");
}
basicdataStoreBrand.setClientId(list.get(0).getClientId());
basicdataStoreBrand.setClientId(Long.parseLong(basicdataStoreBrand.getShopId()));
return this.saveOrUpdate(basicdataStoreBrand);
}

25
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataStoreContactServiceImpl.java

@ -16,11 +16,13 @@
*/
package com.logpm.basicdata.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.entity.BasicdataStoreContactEntity;
import com.logpm.basicdata.vo.BasicdataStoreContactVO;
import com.logpm.basicdata.excel.BasicdataStoreContactExcel;
import com.logpm.basicdata.mapper.BasicdataStoreContactMapper;
import com.logpm.basicdata.service.IBasicdataStoreContactService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -34,6 +36,7 @@ import java.util.List;
* @since 2023-05-16
*/
@Service
@Slf4j
public class BasicdataStoreContactServiceImpl extends BaseServiceImpl<BasicdataStoreContactMapper, BasicdataStoreContactEntity> implements IBasicdataStoreContactService {
@Override
@ -51,4 +54,26 @@ public class BasicdataStoreContactServiceImpl extends BaseServiceImpl<BasicdataS
return basicdataStoreContactList;
}
@Override
public Boolean ownUpdateById(BasicdataStoreContactEntity basicdataStoreContact) {
try{
List<BasicdataStoreContactEntity> storeContactEntities = baseMapper.selectList(Wrappers.<BasicdataStoreContactEntity>query().lambda()
.eq(BasicdataStoreContactEntity::getShopId, basicdataStoreContact.getShopId())
);
storeContactEntities.forEach( i ->{
if(i.getShopId().equals(basicdataStoreContact.getShopId())){
this.updateById(basicdataStoreContact);
}else{
i.setDefaultType(false);
this.updateById(i);
}
});
return true;
}catch (Exception e){
log.info("报错信息:",e.getMessage());
return false;
}
}
}

Loading…
Cancel
Save