diff --git a/dl-module-base/pom.xml b/dl-module-base/pom.xml index ffce3d1c..8d0bfd04 100644 --- a/dl-module-base/pom.xml +++ b/dl-module-base/pom.xml @@ -16,6 +16,18 @@ + + + com.google.zxing + core + ${zxing.version} + + + com.google.zxing + javase + ${zxing.version} + + com.blingblingbang diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/entity/Company.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/entity/Company.java index 33e6f43d..08d61e7d 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/entity/Company.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/entity/Company.java @@ -66,5 +66,8 @@ public class Company extends TenantBaseDO { private String loginAccount ; /** 关联的服务编号(多个以英文逗号隔开)(实际就是这个企业的用户登录后有哪些系统权限) */ private String serviceCodes ; - + /** 开户行 */ + private String bankAccount; + /** 收款账号 */ + private String account; } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/order/controller/admin/RepairOrderInfoController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/order/controller/admin/RepairOrderInfoController.java index 35e01ace..dde61feb 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/order/controller/admin/RepairOrderInfoController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/order/controller/admin/RepairOrderInfoController.java @@ -19,6 +19,11 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.io.IOException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.SignatureException; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 维修模块 订单") @@ -95,4 +100,17 @@ public class RepairOrderInfoController { public CommonResult census() { return success(repairOrderInfoService.census()); } + + /** + * PC支付按钮 + * + * @author 小李 + * @date 17:26 2024/10/30 + * @param id id + **/ + @GetMapping("/toPay") + @Operation(summary = "PC支付按钮") + public CommonResult toPay(@RequestParam("id")String id) throws IOException, NoSuchAlgorithmException, SignatureException, InvalidKeyException { + return success(repairOrderInfoService.payTransactionsCode(id)); + } } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/util/CreateQRCodeUtil.java b/dl-module-base/src/main/java/cn/iocoder/yudao/util/CreateQRCodeUtil.java new file mode 100644 index 00000000..7d95dd0f --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/util/CreateQRCodeUtil.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.util; + +import com.google.zxing.BarcodeFormat; +import com.google.zxing.MultiFormatWriter; +import com.google.zxing.WriterException; +import com.google.zxing.client.j2se.MatrixToImageWriter; +import com.google.zxing.common.BitMatrix; +import org.springframework.stereotype.Component; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +/** + * 用于生成二维码的工具类 + * + * @author 小李 + * @date 14:56 2024/10/30 +**/ +public class CreateQRCodeUtil { + + /** + * 生成二维码的方法 + * + * @author 小李 + * @date 15:00 2024/10/30 + * @param text 二维码的内容 + * @param width 二维码的宽度 + * @param height 二维码的高度 + **/ + public static byte[] GenerateQRCode(String text, int width, int height) { + try { + BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height); + + try (ByteArrayOutputStream pngOutputStream = new ByteArrayOutputStream()) { + MatrixToImageWriter.writeToStream(bitMatrix, "PNG", pngOutputStream); + return pngOutputStream.toByteArray(); + } + }catch (Exception e){ + e.printStackTrace(); + return null; + } + } +} diff --git a/dl-module-base/src/main/resources/mapper/custom/CustomerMainMapper.xml b/dl-module-base/src/main/resources/mapper/custom/CustomerMainMapper.xml index 91712365..94bd20ed 100644 --- a/dl-module-base/src/main/resources/mapper/custom/CustomerMainMapper.xml +++ b/dl-module-base/src/main/resources/mapper/custom/CustomerMainMapper.xml @@ -59,9 +59,11 @@ AND main.phone_number LIKE concat('%',#{entity.phoneNumber},'%') - AND main.phone_number = #{entity.phoneOrCar} - OR car.license_number = #{entity.phoneOrCar} - OR car.vin = #{entity.phoneOrCar} + AND ( + main.phone_number LIKE CONCAT('%',#{entity.phoneOrCar},'%') + OR car.license_number LIKE CONCAT('%',#{entity.phoneOrCar},'%') + OR car.vin LIKE CONCAT('%',#{entity.phoneOrCar},'%') + ) GROUP BY main.id diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java index 9e460e00..51919d1c 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java @@ -31,6 +31,12 @@ public class DlInspectionProjectServiceImpl extends ServiceImpl() + .eq(DlInspectionProject::getProjectName, createReqVO.getProjectName())); + if (ObjectUtil.isNotNull(dlInspectionProject1)) { + throw new RuntimeException("检测项目已存在"); + } // 插入 DlInspectionProject dlInspectionProject = BeanUtils.toBean(createReqVO, DlInspectionProject.class); dlInspectionProject.setDeleted(false); diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml index 93c01800..5e3a7fc3 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml @@ -23,5 +23,6 @@ AND role_id = #{entity.roleId} + ORDER BY create_time DESC \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java index 70273940..93cc3124 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java @@ -334,5 +334,19 @@ public class DlRepairTicketsController { dlRepairTicketsService.addItems(respVO); return CommonResult.ok(); } + + /** + * 修改工单主表,只是主表 + * + * @author 小李 + * @date 10:25 2024/10/30 + * @param respVO 请求对象 + **/ + @PostMapping("/updateTicket") + @Operation(summary = "修改工单主表,只是主表") + public CommonResult updateTicket(@RequestBody DlRepairTicketsRespVO respVO) { + dlRepairTicketsService.updateTicket(respVO); + return CommonResult.ok(); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java index bcf014d6..a29750f8 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java @@ -217,4 +217,13 @@ public interface DlRepairTicketsService extends IService { * @date 16:35 2024/10/26 **/ void autoInspection(); + + /** + * 修改工单主表,只是主表 + * + * @author 小李 + * @date 10:25 2024/10/30 + * @param respVO 请求对象 + **/ + void updateTicket(DlRepairTicketsRespVO respVO); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 4c5ff2ce..a89228f6 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -6,6 +6,8 @@ import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.*; import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; +import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairWorkerService; @@ -13,6 +15,8 @@ import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO; import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO; import cn.iocoder.yudao.module.booking.entity.DlRepairBooking; import cn.iocoder.yudao.module.booking.service.DlRepairBookingService; +import cn.iocoder.yudao.module.company.entity.Company; +import cn.iocoder.yudao.module.company.service.CompanyService; import cn.iocoder.yudao.module.conf.entity.BaseType; import cn.iocoder.yudao.module.conf.service.BaseTypeService; import cn.iocoder.yudao.module.custom.entity.*; @@ -49,6 +53,7 @@ import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService; import cn.iocoder.yudao.module.tickets.service.DlTwItemService; import cn.iocoder.yudao.module.tickets.tools.WordUtil; import cn.iocoder.yudao.module.tickets.vo.*; +import cn.iocoder.yudao.util.CreateQRCodeUtil; import cn.iocoder.yudao.util.SendSmsUtil; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -59,6 +64,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.config.Configure; import com.deepoove.poi.config.ConfigureBuilder; +import com.deepoove.poi.data.PictureRenderData; +import com.deepoove.poi.data.PictureType; import com.deepoove.poi.plugin.table.HackLoopTableRenderPolicy; import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Lazy; @@ -170,6 +177,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl dataList = dictDataApi.getDictDataList(DICT_REPAIR_PART_DISPOSAL); @@ -526,10 +536,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl item.getItemPrice().multiply(BigDecimal.valueOf(item.getItemCount()))).reduce(BigDecimal.ZERO, BigDecimal::add); + // 加上特殊费用 + // 管理费 + BigDecimal managerMoney = ObjectUtil.isNotEmpty(tickets.getManagerMoney()) ? tickets.getManagerMoney() : new BigDecimal("0"); + // 救援费 + BigDecimal rescueMoney = ObjectUtil.isNotEmpty(tickets.getRescueMoney()) ? tickets.getRescueMoney() : new BigDecimal("0"); + // 三包费 + BigDecimal threePackMoney = ObjectUtil.isNotEmpty(tickets.getThreePackMoney()) ? tickets.getThreePackMoney() : new BigDecimal("0"); + // 定损费 + BigDecimal confirmFaultMoney = ObjectUtil.isNotEmpty(tickets.getConfirmFaultMoney()) ? tickets.getConfirmFaultMoney() : new BigDecimal("0"); + matTotalCost = matTotalCost.add(managerMoney).add(rescueMoney).add(threePackMoney).add(confirmFaultMoney); params.put("matTotalCost", matTotalCost); // 应收费目前是工单的打折后的总价 params.put("allCost", tickets.getTotalPrice()); @@ -661,14 +680,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairOrderInfo::getGoodsId, tickets.getId())); if (ObjectUtil.isNotEmpty(orderInfo)) { - if (ObjectUtil.isNotEmpty(orderInfo.getPayTime())) { - params.put("settleDate", date.format(orderInfo.getPayTime())); - } // 付款情况 // 先取支付字典 List payTypes = dictDataApi.getDictDataList(DICT_REPAIR_PAY_TYPE); @@ -696,12 +713,51 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl companies = companyService.list(new LambdaQueryWrapper().in(Company::getTenantId, tenantId)); + // 得到属于当前业务的公司 + Company company = companies.stream().filter(item -> { + String[] service = item.getServiceCodes().split(","); + for (String s : service) { + if (s.equals("weixiu")) { + return true; + } + } + return false; + }).findFirst().orElse(null); + String corporation = ""; + String bank = ""; + String bankAddress = ""; + String account = ""; + if (company != null){ + corporation = company.getCorpName(); + bankAddress = company.getAddress(); + bank = company.getBankAccount(); + account = company.getAccount(); + } // 取不到的先给未知 - params.put("corporation", "未知"); - params.put("bank", "未知"); - params.put("bankAddress", "未知"); - params.put("account", "未知"); + params.put("corporation", corporation); + params.put("bank", bank); + params.put("bankAddress", bankAddress); + params.put("account", account); + + // 调支付接口 + String payUrl = ""; + try { + Map stringObjectMap = repairOrderInfoService.payTransactionsCode(orderInfo.getId()); + payUrl = (String) stringObjectMap.get("code_url"); + // 这个地方可能报错,报错就不生成二维码了,保证工单是能出来的 + // 生成收款二维码 + int width = 100, height = 100; + byte[] texts = CreateQRCodeUtil.GenerateQRCode(payUrl, width, height); + if (ObjectUtil.isNotEmpty(texts)){ + params.put("qrCode", new PictureRenderData(width, height, PictureType.PNG, texts)); + } + }catch (Exception e){ + e.printStackTrace(); + } Configure config = configureBuilder.build(); try { @@ -742,14 +798,25 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId())); // 查自己班组的员工信息 List list = repairWorkerService.list(new LambdaQueryWrapper().eq(RepairWorker::getWorkType, one.getWorkType())); // 所有的员工信息 - List userIds = list.stream().map(RepairWorker::getUserId).collect(Collectors.toList()); + String userIdsStr = ""; + List userIds = new ArrayList<>(); + for (RepairWorker worker:list){ + userIds.add(worker.getUserId()); + if("".equals(userIdsStr)){ + userIdsStr = String.valueOf(worker.getUserId()); + }else{ + userIdsStr = ","+worker.getUserId(); + } + } repairTicketsReqVO.setUserIds(userIds); + repairTicketsReqVO.setUserIdsStr(userIdsStr); } else { //普通维修工 repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId())); @@ -1276,6 +1343,30 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairOrderInfo::getGoodsId, ticketId)); + RepairOrderInfo newOrderInfo = new RepairOrderInfo(); + newOrderInfo.setId(orderInfo.getId()); + // 更新商品原价和实付金额 + newOrderInfo.setGoodsPrice(tickets.getTotalPrice()); + newOrderInfo.setPayMoney(tickets.getTotalPrice()); + repairOrderInfoService.updateById(newOrderInfo); + return baseMapper.updateById(tickets) > 0; } @@ -1392,6 +1483,26 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl userIds; + /** 工单中项目指定的施工人员的ids字符串拼接 */ + private String userIdsStr; + /** 查询类型(waiting 待处理的 | all 所有数据) */ private String selectType; + + /** 人员角色code */ + private String roleCode; } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsRespVO.java index b4057bf7..7c82fee1 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsRespVO.java @@ -58,5 +58,7 @@ public class DlRepairTicketsRespVO extends DlRepairTickets { /** 如果是完成并移交下一班组,就有移交给了那一个班组 */ private String nextName; + /** 维修班组长是否可以重新派工--当前施工人是自己或者本班组内的人员 */ + private Boolean canOperate; } diff --git a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml index 70a97621..349d4b4c 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml @@ -106,6 +106,7 @@ + @@ -208,7 +209,13 @@ @@ -311,7 +331,7 @@ -- 维修工或维修厂长查所有的就是维修人是自己的或者是自己班组内的 -- and ( - find_in_set(#{item}, drt.now_repair_id) > 0 + find_in_set(#{item}, drti.repair_ids) > 0 ) diff --git a/dl-module-repair/src/main/resources/templates/ticketTemplate.docx b/dl-module-repair/src/main/resources/templates/ticketTemplate.docx index 40bd2e8a..eb4a7fbb 100644 Binary files a/dl-module-repair/src/main/resources/templates/ticketTemplate.docx and b/dl-module-repair/src/main/resources/templates/ticketTemplate.docx differ diff --git a/pom.xml b/pom.xml index 71853a32..012302b6 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,7 @@ 1.5.5.Final UTF-8 1.1.2 + 3.4.1