This commit is contained in:
xiaofajia 2024-10-30 20:38:09 +08:00
commit 3c1b2355db
4 changed files with 46 additions and 6 deletions

View File

@ -34,6 +34,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@ -171,7 +172,29 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
/*3、保存客户主表信息*/
//暂时写死会员id TODO
main.setMemberLevelId("9d4567b7e68803933f4917a4aab6b745");
this.saveOrUpdate(main);
//解决重复用户校验
if (StringUtils.isEmpty(main.getId())){
//通过手机号匹配是否存在当前用户
LambdaQueryWrapper<CustomerMain> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CustomerMain::getPhoneNumber,main.getPhoneNumber());
List<CustomerMain> list = list(lambdaQueryWrapper);
if (list.isEmpty()){
//如不存在插入
this.save(main);
} else {
if (StringUtils.isNotEmpty(main.getCusName())) {
//如存在更新用户名称
CustomerMain updateCust = list.get(0);
updateCust.setCusName(main.getCusName());
this.updateById(updateCust);
}
}
} else {
//存在id直接更行
this.updateById(main);
}
/*4、保存扩展表信息*/
if ( null!=saveReqVO.getItemList() && !saveReqVO.getItemList().isEmpty()) {

View File

@ -451,7 +451,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 新增车辆信息
if (ObjectUtil.isNotEmpty(customerAndCarVO.getCarInfo())) {
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())) {
customerAndCarVO.getCarInfo().setUserId(Long.valueOf(customerAndCarVO.getUserInfo().getId()));
customerAndCarVO.getCarInfo().setUserId(customerAndCarVO.getUserInfo().getUserId());
carMainService.createCarMain(customerAndCarVO.getCarInfo());
} else {
carMainService.updateCarMain(customerAndCarVO.getCarInfo());

View File

@ -245,9 +245,13 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 如果是通过并且是领料就还需要把配件信息加入到工单中
if (ObjectUtil.isNotEmpty(status) && status.equals("02") && type.equals("01")) {
// 更新维修工单
if (null == repairItemList || repairItemList.isEmpty()) {
repairItemList = new ArrayList<>();
//配件没传去库里面查需要的配件
if(null!=respVO.getRepairWaresList()){
repairItemList= new ArrayList<>();
//走的是更新配件库价格
Map<String,BigDecimal> updateMap = respVO.getRepairWaresList().stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getPrice));
//更新配件库的价格
List<RepairWares> updateWaresList = new ArrayList<>();
//去库里面查需要的配件
LambdaQueryWrapper<DlTwItem> queryWrapper = new LambdaQueryWrapper<DlTwItem>()
.eq(DlTwItem::getTwId, mainId);
List<DlTwItem> applyList = twItemService.list(queryWrapper);
@ -262,7 +266,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
repairTitem.setItemCount(item.getWaresCount());
repairTitem.setItemName(item.getWaresName());
repairTitem.setItemUnit(waresMap.get(item.getWaresId()).getUnit());
repairTitem.setItemPrice(waresMap.get(item.getWaresId()).getPrice());
//取前端传过来的销售价格
repairTitem.setItemPrice(updateMap.get(item.getId()));
//默认不打折为1
repairTitem.setItemDiscount(new BigDecimal(1));
repairTitem.setItemMoney(new BigDecimal(repairTitem.getItemCount()).multiply(repairTitem.getItemPrice()));
@ -271,8 +276,16 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
repairTitem.setPartId(item.getWaresId());
repairTitem.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode());
repairItemList.add(repairTitem);
//组装配件库更新价格
RepairWares update = new RepairWares();
update.setId(item.getWaresId());
update.setPrice(updateMap.get(item.getId()));
updateWaresList.add(update);
}
}
if(!updateWaresList.isEmpty()){
repairWaresService.updateBatchById(updateWaresList);
}
}
// 更新维修工单子表----需要合并相同的配件故修改
// 先查维修工单的子表中的配件相关的信息

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.tickets.vo;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
@ -29,4 +30,7 @@ public class DlTicketWaresRespVO extends DlTicketWares {
/** 领料、采购单子表 */
private List<DlRepairSoi> repairSois;
/** 更新配件库子表价格 */
private List<RepairWares> repairWaresList;
}