Browse Source

修改客户添加不能重复

training
caoyizhong 1 year ago
parent
commit
a24fd77dbb
  1. 6
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java
  2. 18
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/dto/AftersalesWorkOrderDTO.java
  3. 3
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesWorkOrderService.java
  4. 34
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java
  5. 22
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java
  6. 1
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml

6
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java

@ -16,6 +16,7 @@
*/
package com.logpm.aftersales.controller;
import com.logpm.aftersales.dto.AftersalesWorkOrderDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -23,6 +24,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@ -55,6 +57,7 @@ import javax.servlet.http.HttpServletResponse;
@AllArgsConstructor
@RequestMapping("/aftersalesWorkOrder")
@Api(value = "客服异常工单", tags = "客服异常工单接口")
@Slf4j
public class AftersalesWorkOrderController extends BladeController {
private final IAftersalesWorkOrderService aftersalesWorkOrderService;
@ -117,7 +120,8 @@ public class AftersalesWorkOrderController extends BladeController {
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入aftersalesWorkOrder")
public R submit(@Valid @RequestBody AftersalesWorkOrderEntity aftersalesWorkOrder) {
public R submit(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) {
log.info("工单创建的数据{}",aftersalesWorkOrder.toString());
return R.status(aftersalesWorkOrderService.saveOrUpdateOwn(aftersalesWorkOrder));
}

18
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/dto/AftersalesWorkOrderDTO.java

@ -16,10 +16,12 @@
*/
package com.logpm.aftersales.dto;
import com.logpm.aftersales.entity.AftersalesWorkOrderEntity;
import com.logpm.aftersales.entity.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 客服异常工单 数据传输对象实体类
*
@ -30,5 +32,19 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
public class AftersalesWorkOrderDTO extends AftersalesWorkOrderEntity {
private static final long serialVersionUID = 1L;
/**
* 包件
*/
private List<AftersalesAbnormalPackageEntity> packageEntityList;
/**
* 责任方和处理方
*/
private List<AftersalesProcessorEntity> processorEntityList;
/**
* 货损图片
*/
private List<AftersalesDecreaseImageEntity> decreaseImageEntityList;
}

3
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesWorkOrderService.java

@ -17,6 +17,7 @@
package com.logpm.aftersales.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.logpm.aftersales.dto.AftersalesWorkOrderDTO;
import com.logpm.aftersales.entity.AftersalesWorkOrderEntity;
import com.logpm.aftersales.vo.AftersalesWorkOrderVO;
import com.logpm.aftersales.excel.AftersalesWorkOrderExcel;
@ -54,5 +55,5 @@ public interface IAftersalesWorkOrderService extends BaseService<AftersalesWorkO
* @param aftersalesWorkOrder
* @return
*/
boolean saveOrUpdateOwn(AftersalesWorkOrderEntity aftersalesWorkOrder);
boolean saveOrUpdateOwn(AftersalesWorkOrderDTO aftersalesWorkOrder);
}

34
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java

@ -17,15 +17,22 @@
package com.logpm.aftersales.service.impl;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.logpm.aftersales.dto.AftersalesWorkOrderDTO;
import com.logpm.aftersales.entity.AftersalesWorkOrderEntity;
import com.logpm.aftersales.service.IAftersalesAbnormalPackageService;
import com.logpm.aftersales.vo.AftersalesWorkOrderVO;
import com.logpm.aftersales.excel.AftersalesWorkOrderExcel;
import com.logpm.aftersales.mapper.AftersalesWorkOrderMapper;
import com.logpm.aftersales.service.IAftersalesWorkOrderService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
@ -35,8 +42,13 @@ import java.util.List;
* @since 2023-11-17
*/
@Service
@Slf4j
@AllArgsConstructor
public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl<AftersalesWorkOrderMapper, AftersalesWorkOrderEntity> implements IAftersalesWorkOrderService {
private final IAftersalesAbnormalPackageService aftersalesAbnormalPackageService;
@Override
public IPage<AftersalesWorkOrderVO> selectAftersalesWorkOrderPage(IPage<AftersalesWorkOrderVO> page, AftersalesWorkOrderVO aftersalesWorkOrder) {
return page.setRecords(baseMapper.selectAftersalesWorkOrderPage(page, aftersalesWorkOrder));
@ -58,9 +70,29 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl<AftersalesWo
* @return
*/
@Override
public boolean saveOrUpdateOwn(AftersalesWorkOrderEntity aftersalesWorkOrder) {
@Transactional(rollbackFor = Exception.class)
public boolean saveOrUpdateOwn(AftersalesWorkOrderDTO aftersalesWorkOrder) {
if(ObjectUtils.isNull(aftersalesWorkOrder.getId())){
//新增
aftersalesWorkOrder.setInitiationIdentification("PDA");
if(ObjectUtils.isNotNull(aftersalesWorkOrder.getPackageEntityList())){
//包件信息
}
if(ObjectUtils.isNotNull(aftersalesWorkOrder.getDecreaseImageEntityList())){
//货损图片
}
if(ObjectUtils.isNotNull(aftersalesWorkOrder.getProcessorEntityList())){
//责任方 处理方
}
return baseMapper.insert(aftersalesWorkOrder) > 0 ? true : false;
}else{

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

@ -154,6 +154,16 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
if (ObjectUtils.isNull(basicdataClient.getPid())) {
basicdataClient.setPid(0L);
}
//查询客户编码和客户名称是否存在
BasicdataClientEntity basicdataClient1 = baseMapper.selectOne(Wrappers.<BasicdataClientEntity>query().lambda()
.eq(BasicdataClientEntity::getClientCode, basicdataClient.getClientCode())
.or()
.eq(BasicdataClientEntity::getClientName, basicdataClient.getClientName())
);
if(ObjectUtils.isNotNull(basicdataClient1)){
throw new ServiceException("客户编码或客户名称已存在");
}
//添加
this.save(basicdataClient);
// //绑定客户账号和客户关系
@ -291,6 +301,8 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
List<DictBiz> clientBiz = DictBizCache.getList(DictBizConstant.CLIENT_TYPE); //客 工
List<DictBiz> freightBiz = DictBizCache.getList(DictBizConstant.BASIC_FREIGHT_TYPE); //客 工
Set<String> set =new HashSet<>();
QueryWrapper<BasicdataClientEntity> queryWrapper = new QueryWrapper<>();
List<BasicdataClientEntity> basicdataClients = baseMapper.selectList(queryWrapper);
for (BasicdataClientExcel i : data) {
log.info("导入数据《》《》{}",i);
if(set.isEmpty()){
@ -301,10 +313,18 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
continue;
}
}
if(ObjectUtils.isNull(i.getClientCode()) || ObjectUtils.isNull(i.getClientName())){
throw new ServiceException("客户编码或客户名称不能为空!");
}
BasicdataClientEntity basicdataClient = new BasicdataClientEntity();
BeanUtil.copyProperties(i,basicdataClient);
//查询客户编码和客户名称是否存在
boolean b = basicdataClients.stream().anyMatch(ii -> ii.getClientCode().equals(basicdataClient.getClientCode())
|| ii.getClientName().equals(basicdataClient.getClientName()));
if(b){
throw new ServiceException("客户编码或客户名称已存在");
}
// Optional<DictBiz> first = dictBizs.stream().filter(ii -> ii.getDictValue().equals(i.getTypeService())).findFirst();
Optional<DictBiz> clientFirst = clientBiz.stream().filter(ii -> ii.getDictValue().equals(i.getClientType())).findFirst();
// i.setTypeService(first.get().getDictValue());

1
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml

@ -198,6 +198,7 @@
<if test="param.questId != null and param.questId != ''">and quest_id =#{param.questId } </if>
<if test="param.questType != null and param.questType != ''">and quest_type =#{param.questType } </if>
<if test="param.questTarget != null and param.questTarget != ''">and quest_target =#{param.questTarget } </if>
<if test="param.questStatus != null ">and quest_status =#{param.questStatus } </if>
<if test="param.warehouseId != null and param.warehouseId != ''">and warehouse_id =#{param.warehouseId } </if>
<if test="param.allocationId != null and param.allocationId != ''">and allocation_id =#{param.allocationId } </if>
<if test="param.trayId != null and param.trayId != ''">and tray_id =#{param.trayId } </if>

Loading…
Cancel
Save