Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
d3b94ada16
@ -348,5 +348,19 @@ public class DlRepairTicketsController {
|
||||
dlRepairTicketsService.updateTicket(respVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工单
|
||||
*
|
||||
* @author 小李
|
||||
* @date 20:05 2024/11/1
|
||||
* @param id 工单ID
|
||||
**/
|
||||
@DeleteMapping("/remove")
|
||||
@Operation(summary = "删除工单")
|
||||
public CommonResult<?> removeTicketById(@RequestParam("id") String id) {
|
||||
dlRepairTicketsService.removeTicketById(id);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,4 +226,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
void updateTicket(DlRepairTicketsRespVO respVO);
|
||||
|
||||
/**
|
||||
* 删除工单
|
||||
*
|
||||
* @author 小李
|
||||
* @date 20:05 2024/11/1
|
||||
* @param id 工单ID
|
||||
**/
|
||||
void removeTicketById(String id);
|
||||
}
|
||||
|
@ -217,7 +217,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// 门店信息
|
||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||
DeptRespDTO dept = deptApi.getDept(deptId);
|
||||
@ -438,7 +437,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
userDTO.setPassword("123456");
|
||||
adminUserApi.createUser(userDTO);
|
||||
// 如果新增了数据,id没有回填
|
||||
if (ObjectUtil.isEmpty(userDTO.getId())){
|
||||
if (ObjectUtil.isEmpty(userDTO.getId())) {
|
||||
AdminUserRespDTO byMobile = adminUserApi.getUserByMobile(userDTO.getMobile());
|
||||
userDTO.setId(byMobile.getId());
|
||||
}
|
||||
@ -450,12 +449,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())) {
|
||||
// 新增之前判断一下电话号码是否重复
|
||||
List<CustomerMain> list = customerService.list(new LambdaQueryWrapper<CustomerMain>().eq(CustomerMain::getPhoneNumber, customerAndCarVO.getUserInfo().getPhoneNumber()));
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
throw exception0(500, "电话号码重复");
|
||||
}
|
||||
customerService.save(customerAndCarVO.getUserInfo());
|
||||
// 如果新增了数据,id没有回填
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())){
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())) {
|
||||
CustomerMain byPhoneNumber = customerService.getOne(new LambdaQueryWrapper<CustomerMain>().eq(CustomerMain::getPhoneNumber, customerAndCarVO.getUserInfo().getPhoneNumber()));
|
||||
customerAndCarVO.getUserInfo().setId(byPhoneNumber.getId());
|
||||
}
|
||||
@ -469,12 +468,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
customerAndCarVO.getCarInfo().setUserId(customerAndCarVO.getUserInfo().getUserId());
|
||||
// 新增之前判断一下车牌重复没
|
||||
List<CarMain> list = carMainService.list(new LambdaQueryWrapper<CarMain>().eq(CarMain::getLicenseNumber, customerAndCarVO.getCarInfo().getLicenseNumber()));
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
throw exception0(500, "车牌重复");
|
||||
}
|
||||
carMainService.createCarMain(customerAndCarVO.getCarInfo());
|
||||
// 如果新增了数据,id没有回填
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())){
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())) {
|
||||
CarMain byLicenseNumber = carMainService.getOne(new LambdaQueryWrapper<CarMain>().eq(CarMain::getLicenseNumber, customerAndCarVO.getCarInfo().getLicenseNumber()));
|
||||
customerAndCarVO.getCarInfo().setId(byLicenseNumber.getId());
|
||||
}
|
||||
@ -514,7 +513,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public void print(HttpServletResponse response, String id) {
|
||||
// 开始之前先计算一次工单
|
||||
boolean flag = computeTicket(id);
|
||||
if (!flag){
|
||||
if (!flag) {
|
||||
throw exception0(500, "系统异常");
|
||||
}
|
||||
// 预备工作
|
||||
@ -706,7 +705,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
params.put("matlabourFavorable", "0.00");
|
||||
|
||||
// 管理费、救援费、三包费、定损费、结算备注(这个是因为和工单备注用的同一个)、todo 客户签字
|
||||
params.put("manageCost", ObjectUtil.isNotEmpty(tickets.getManagerMoney()) ? tickets.getManagerMoney() : "0.00") ;
|
||||
params.put("manageCost", ObjectUtil.isNotEmpty(tickets.getManagerMoney()) ? tickets.getManagerMoney() : "0.00");
|
||||
params.put("rescueCost", ObjectUtil.isNotEmpty(tickets.getRescueMoney()) ? tickets.getRescueMoney() : "0.00");
|
||||
params.put("tripleCost", ObjectUtil.isNotEmpty(tickets.getThreePackMoney()) ? tickets.getThreePackMoney() : "0.00");
|
||||
params.put("lossCost", ObjectUtil.isNotEmpty(tickets.getConfirmFaultMoney()) ? tickets.getConfirmFaultMoney() : "0.00");
|
||||
@ -756,7 +755,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
String bank = "";
|
||||
String bankAddress = "";
|
||||
String account = "";
|
||||
if (company != null){
|
||||
if (company != null) {
|
||||
corporation = company.getCorpName();
|
||||
bankAddress = company.getAddress();
|
||||
bank = company.getBankAccount();
|
||||
@ -777,10 +776,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 生成收款二维码
|
||||
int width = 100, height = 100;
|
||||
byte[] texts = CreateQRCodeUtil.GenerateQRCode(payUrl, width, height);
|
||||
if (ObjectUtil.isNotEmpty(texts)){
|
||||
if (ObjectUtil.isNotEmpty(texts)) {
|
||||
params.put("qrCode", new PictureRenderData(width, height, PictureType.PNG, texts));
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -832,12 +831,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 所有的员工信息
|
||||
String userIdsStr = "";
|
||||
List<Long> userIds = new ArrayList<>();
|
||||
for (RepairWorker worker:list){
|
||||
for (RepairWorker worker : list) {
|
||||
userIds.add(worker.getUserId());
|
||||
if("".equals(userIdsStr)){
|
||||
if ("".equals(userIdsStr)) {
|
||||
userIdsStr = String.valueOf(worker.getUserId());
|
||||
}else{
|
||||
userIdsStr = ","+worker.getUserId();
|
||||
} else {
|
||||
userIdsStr = "," + worker.getUserId();
|
||||
}
|
||||
}
|
||||
repairTicketsReqVO.setUserIds(userIds);
|
||||
@ -1176,52 +1175,54 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
item.eq(DlTicketWares::getTicketId, id)
|
||||
.notIn(DlTicketWares::getStatus, status);
|
||||
}));
|
||||
// 查配件申请表的所有已领取数量小于申请数量的子表信息
|
||||
List<String> ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList());
|
||||
List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
|
||||
item.in(DlTwItem::getTwId, ids)
|
||||
.apply("wares_already_count < wares_count");
|
||||
}));
|
||||
if (CollectionUtil.isNotEmpty(twItems)) {
|
||||
// 更新工单子表(主要是把已领料的字段同步给工单配件的数量字段)
|
||||
// 查询工单子表(三个查询条件,属于那个工单,属于配件类型,属于需要改变的(即申请表的已领取数量小于申请数量的))
|
||||
Set<String> waresId = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toSet());
|
||||
List<DlRepairTitem> items = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(item -> {
|
||||
item.eq(DlRepairTitem::getTicketId, id)
|
||||
.eq(DlRepairTitem::getItemType, "02")
|
||||
.in(DlRepairTitem::getPartId, waresId);
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
// 查配件申请表的所有已领取数量小于申请数量的子表信息
|
||||
List<String> ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList());
|
||||
List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
|
||||
item.in(DlTwItem::getTwId, ids)
|
||||
.apply("wares_already_count < wares_count");
|
||||
}));
|
||||
// 同一个配件可能申请过多次,属于是一个工单配件可能是对应多个申请表配件
|
||||
List<DlRepairTitem> AllItems = items.stream().map(item -> {
|
||||
DlRepairTitem titem = new DlRepairTitem();
|
||||
titem.setId(item.getId());
|
||||
List<DlTwItem> wares = twItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList());
|
||||
int sum = wares.stream().mapToInt(DlTwItem::getWaresAlreadyCount).sum();
|
||||
titem.setItemCount(sum);
|
||||
BigDecimal discount = item.getItemDiscount() == null ? BigDecimal.ONE : item.getItemDiscount();
|
||||
titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(sum)).multiply(discount));
|
||||
return titem;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(twItems)) {
|
||||
// 更新工单子表(主要是把已领料的字段同步给工单配件的数量字段)
|
||||
// 查询工单子表(三个查询条件,属于那个工单,属于配件类型,属于需要改变的(即申请表的已领取数量小于申请数量的))
|
||||
Set<String> waresId = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toSet());
|
||||
List<DlRepairTitem> items = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(item -> {
|
||||
item.eq(DlRepairTitem::getTicketId, id)
|
||||
.eq(DlRepairTitem::getItemType, "02")
|
||||
.in(DlRepairTitem::getPartId, waresId);
|
||||
}));
|
||||
// 同一个配件可能申请过多次,属于是一个工单配件可能是对应多个申请表配件
|
||||
List<DlRepairTitem> AllItems = items.stream().map(item -> {
|
||||
DlRepairTitem titem = new DlRepairTitem();
|
||||
titem.setId(item.getId());
|
||||
List<DlTwItem> wares = twItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList());
|
||||
int sum = wares.stream().mapToInt(DlTwItem::getWaresAlreadyCount).sum();
|
||||
titem.setItemCount(sum);
|
||||
BigDecimal discount = item.getItemDiscount() == null ? BigDecimal.ONE : item.getItemDiscount();
|
||||
titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(sum)).multiply(discount));
|
||||
return titem;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 可能出现配件申请单审核通过了没有任何领取或全部退了的情况,所以如果itemCount等于0,直接把这个数据删掉
|
||||
// 过滤出需要删除的数据
|
||||
List<DlRepairTitem> delItems = AllItems.stream().filter(item -> item.getItemCount() == 0).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(delItems)) {
|
||||
// 删除需要删的
|
||||
titemService.removeBatchByIds(delItems);
|
||||
Set<String> delIds = delItems.stream().map(DlRepairTitem::getId).collect(Collectors.toSet());
|
||||
// 得到需要改的
|
||||
List<DlRepairTitem> updateItems = AllItems.stream().filter(item -> delIds.contains(item.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(updateItems)) {
|
||||
titemService.updateBatchById(updateItems);
|
||||
// 可能出现配件申请单审核通过了没有任何领取或全部退了的情况,所以如果itemCount等于0,直接把这个数据删掉
|
||||
// 过滤出需要删除的数据
|
||||
List<DlRepairTitem> delItems = AllItems.stream().filter(item -> item.getItemCount() == 0).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(delItems)) {
|
||||
// 删除需要删的
|
||||
titemService.removeBatchByIds(delItems);
|
||||
Set<String> delIds = delItems.stream().map(DlRepairTitem::getId).collect(Collectors.toSet());
|
||||
// 得到需要改的
|
||||
List<DlRepairTitem> updateItems = AllItems.stream().filter(item -> delIds.contains(item.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(updateItems)) {
|
||||
titemService.updateBatchById(updateItems);
|
||||
}
|
||||
} else {
|
||||
// 没有需要删的就是全部都需要改
|
||||
titemService.updateBatchById(AllItems);
|
||||
}
|
||||
} else {
|
||||
// 没有需要删的就是全部都需要改
|
||||
titemService.updateBatchById(AllItems);
|
||||
}
|
||||
|
||||
// 重新计算维修工单
|
||||
return computeTicket(id);
|
||||
// 重新计算维修工单
|
||||
return computeTicket(id);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1331,7 +1332,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 查子表
|
||||
List<DlRepairTitem> list = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, ticketId));
|
||||
// 计算子表
|
||||
if (CollectionUtil.isEmpty(list)){
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw exception0(500, "没有项目、配件或其他");
|
||||
}
|
||||
List<DlRepairTitem> updateItems = list.stream().map(item -> {
|
||||
@ -1512,22 +1513,40 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
/**
|
||||
* 修改工单主表,只是主表
|
||||
*
|
||||
* @param respVO 请求对象
|
||||
* @author 小李
|
||||
* @date 10:25 2024/10/30
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void updateTicket(DlRepairTicketsRespVO respVO){
|
||||
public void updateTicket(DlRepairTicketsRespVO respVO) {
|
||||
// 更新主表
|
||||
baseMapper.updateById(respVO);
|
||||
|
||||
// 重新计算
|
||||
boolean flag = computeTicket(respVO.getId());
|
||||
if (!flag){
|
||||
if (!flag) {
|
||||
throw exception0(500, "系统异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工单
|
||||
*
|
||||
* @param id 工单ID
|
||||
* @author 小李
|
||||
* @date 20:05 2024/11/1
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void removeTicketById(String id) {
|
||||
// 删除订单
|
||||
repairOrderInfoService.remove(new LambdaQueryWrapper<RepairOrderInfo>().eq(RepairOrderInfo::getGoodsId, id));
|
||||
// 删除工单
|
||||
baseMapper.deleteById(id);
|
||||
// 删除工单子表
|
||||
titemService.remove(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,6 +56,8 @@ spring:
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
|
||||
username: lanan_dev
|
||||
password: lighting@2024
|
||||
# username: lanan
|
||||
# password: 123456
|
||||
# username: sa # SQL Server 连接的示例
|
||||
# password: Yudao@2024 # SQL Server 连接的示例
|
||||
# username: SYSDBA # DM 连接的示例
|
||||
|
Loading…
Reference in New Issue
Block a user