Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
许允枞 2024-11-02 17:10:07 +08:00
commit d3b94ada16
4 changed files with 105 additions and 61 deletions

View File

@ -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();
}
}

View File

@ -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);
}

View File

@ -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,6 +1175,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
item.eq(DlTicketWares::getTicketId, id)
.notIn(DlTicketWares::getStatus, status);
}));
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 -> {
@ -1223,6 +1223,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 重新计算维修工单
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));
}
}

View File

@ -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 连接的示例