From e2111c6d12743882110ad278776b6ea0803000fa Mon Sep 17 00:00:00 2001
From: nyoung <12190070+nyoungo@user.noreply.gitee.com>
Date: Sun, 1 Sep 2024 21:13:39 +0800
Subject: [PATCH 1/4] 1
---
.../iocoder/yudao/util}/WechatPayConfig.java | 7 +-
.../iocoder/yudao/util}/WechatPayRequest.java | 2 +-
.../iocoder/yudao/util}/WechatPayUrlEnum.java | 2 +-
.../yudao/util}/WechatPayValidator.java | 16 +-
dl-module-inspection/pom.xml | 6 +
.../controller/AppSwiperController.java | 28 +-
.../appBase/mapper/AppSwiperMapper.java | 3 +-
.../controller/ContractHistoryController.java | 199 +++++
.../InspectionContractController.java | 113 +++
.../core/controller/BaseController.java | 3 +-
.../controller/AppUserOwnController.java | 13 +-
.../controller/PartnerOwnController.java | 5 +-
.../inspection/entity/DelInspectionInfo.java | 10 +
.../inspection/entity/DelOrderInfo.java | 10 +
.../inspection/entity/InspectionEquInfo.java | 5 +
.../inspection/entity/InspectionFile.java | 5 +
.../inspection/entity/InspectionStepInfo.java | 4 +-
.../impl/InspectionInfoServiceImpl.java | 5 +
.../module/inspection/vo/SysDictData.java | 2 +
.../PartnerCustomerInfoController.java | 92 +++
.../mapper/PartnerCustomerInfoMapper.java | 35 +
.../service/IPartnerCustomerInfoService.java | 40 +
.../impl/PartnerCustomerInfoServiceImpl.java | 212 +++++-
.../payment/controller/OrderController.java | 185 +++++
.../payment/controller/WxPayController.java | 264 +++++++
.../module/payment/entity/OrderInfo.java | 4 +-
.../payment/mapper/OrderInfoMapper.java | 12 +
.../payment/service/OrderInfoService.java | 30 +
.../service/impl/OrderInfoServiceImpl.java | 708 +++++++++++++++++-
.../shop/controller/ShopCouponController.java | 172 +++++
.../controller/ShopUserCarController.java | 140 ++++
.../yudao/module/shop/entity/ShopCoupon.java | 4 +-
.../module/shop/entity/ShopRepairGoods.java | 56 ++
.../module/shop/mapper/ShopCouponMapper.java | 3 +-
.../shop/mapper/ShopRepairGoodsMapper.java | 65 ++
.../module/shop/mapper/ShopUserCarMapper.java | 3 +-
.../shop/service/IShopCouponService.java | 3 +-
.../shop/service/IShopRepairGoodsService.java | 62 ++
.../shop/service/IShopUserCarService.java | 3 +-
.../impl/PartnerDetailServiceImpl.java | 8 +-
.../service/impl/ShopCouponServiceImpl.java | 13 +-
.../impl/ShopMallPartnersServiceImpl.java | 13 +-
.../impl/ShopRepairGoodsServiceImpl.java | 159 ++++
.../service/impl/ShopUserCarServiceImpl.java | 5 +-
.../yudao/util/InspWechatPayConfig.java | 160 ----
.../mapper/appBase/AppSwiperMapper.xml | 10 +-
.../inspection/AppInspectionPartnerMapper.xml | 24 +-
.../InspectionAppointmentMapper.xml | 18 +-
.../inspection/InspectionInfoMapper.xml | 16 +-
.../partner/PartnerCustomerInfoMapper.xml | 109 +++
.../mapper/payment/OrderInfoMapper.xml | 8 +-
.../mapper/shop/ShopCouponMapper.xml | 42 +-
.../mapper/shop/ShopRepairGoodsMapper.xml | 82 ++
.../mapper/shop/ShopUserCarMapper.xml | 40 +-
.../jx/payment/api/JxOrderController.java | 4 +-
.../controller/admin/SysLoginController.java | 146 ++--
.../impl/RescueDriverInfoServiceImpl.java | 5 +-
.../impl/RescueOrderInfoServiceImpl.java | 4 +-
.../core/handler/GlobalExceptionHandler.java | 3 +-
.../yudao-module-system-biz/pom.xml | 6 +
.../admin/dict/DictDataController.java | 6 +-
.../admin/user/UserProfileController.java | 16 +
.../admin/user/vo/user/UserSaveReqVO.java | 6 +
.../dal/mysql/user/AdminUserMapper.java | 4 +-
.../system/service/auth/AdminAuthService.java | 3 +
.../service/auth/AdminAuthServiceImpl.java | 137 +++-
.../system/service/user/AdminUserService.java | 2 +
.../service/user/AdminUserServiceImpl.java | 7 +-
.../main/resources/mapper/SysUserMapper.xml | 10 +
.../src/main/resources/application.yaml | 5 +
70 files changed, 3230 insertions(+), 372 deletions(-)
rename {dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay => dl-module-base/src/main/java/cn/iocoder/yudao/util}/WechatPayConfig.java (97%)
rename {dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay => dl-module-base/src/main/java/cn/iocoder/yudao/util}/WechatPayRequest.java (98%)
rename {dl-module-jx/src/main/java/cn/iocoder/yudao/module/jx/payment/entity => dl-module-base/src/main/java/cn/iocoder/yudao/util}/WechatPayUrlEnum.java (95%)
rename {dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay => dl-module-base/src/main/java/cn/iocoder/yudao/util}/WechatPayValidator.java (87%)
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/contract/controller/ContractHistoryController.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/contract/controller/InspectionContractController.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/controller/PartnerCustomerInfoController.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/controller/OrderController.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/controller/WxPayController.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/controller/ShopCouponController.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/controller/ShopUserCarController.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopRepairGoods.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopRepairGoodsMapper.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopRepairGoodsService.java
create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopRepairGoodsServiceImpl.java
delete mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/util/InspWechatPayConfig.java
create mode 100644 dl-module-inspection/src/main/resources/mapper/partner/PartnerCustomerInfoMapper.xml
create mode 100644 dl-module-inspection/src/main/resources/mapper/shop/ShopRepairGoodsMapper.xml
diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay/WechatPayConfig.java b/dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayConfig.java
similarity index 97%
rename from dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay/WechatPayConfig.java
rename to dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayConfig.java
index d0f0f2f6..7a33200a 100644
--- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay/WechatPayConfig.java
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayConfig.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.rescue.utils.pay;
+package cn.iocoder.yudao.util;
import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
@@ -13,7 +13,6 @@ import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.impl.client.CloseableHttpClient;
-import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
@@ -79,6 +78,10 @@ public class WechatPayConfig {
private String jxAppSecret = "d1fecac806c5f3cd9aca9f3d5c3759c7";
+ private String jcAppId = "wx5eeea06aeaae4f89";
+ private String jcAppSecret = "42207958589342d9d1d287b9cb53e289";
+
+
/**
* 获取商户的私钥文件
diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay/WechatPayRequest.java b/dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayRequest.java
similarity index 98%
rename from dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay/WechatPayRequest.java
rename to dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayRequest.java
index 1f051e19..bcb6e110 100644
--- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay/WechatPayRequest.java
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayRequest.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.rescue.utils.pay;
+package cn.iocoder.yudao.util;
import lombok.extern.slf4j.Slf4j;
diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/jx/payment/entity/WechatPayUrlEnum.java b/dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayUrlEnum.java
similarity index 95%
rename from dl-module-jx/src/main/java/cn/iocoder/yudao/module/jx/payment/entity/WechatPayUrlEnum.java
rename to dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayUrlEnum.java
index b086c466..96e40cf3 100644
--- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/jx/payment/entity/WechatPayUrlEnum.java
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayUrlEnum.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.jx.payment.entity;
+package cn.iocoder.yudao.util;
import lombok.AllArgsConstructor;
diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay/WechatPayValidator.java b/dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayValidator.java
similarity index 87%
rename from dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay/WechatPayValidator.java
rename to dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayValidator.java
index f7000472..5027fbb8 100644
--- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/utils/pay/WechatPayValidator.java
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/util/WechatPayValidator.java
@@ -1,9 +1,11 @@
-package cn.iocoder.yudao.module.rescue.utils.pay;
+package cn.iocoder.yudao.util;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.wechat.pay.contrib.apache.httpclient.auth.Verifier;
+import com.wechat.pay.contrib.apache.httpclient.constant.WechatPayHttpHeaders;
+import com.wechat.pay.contrib.apache.httpclient.util.AesUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -17,8 +19,6 @@ import java.time.Duration;
import java.time.Instant;
import java.util.Map;
-import static com.wechat.pay.contrib.apache.httpclient.constant.WechatPayHttpHeaders.*;
-
/**
* @Author:
* @Description:
@@ -58,8 +58,8 @@ public class WechatPayValidator {
//构造验签名串
String message = buildMessage(request);
- String serial = request.getHeader(WECHAT_PAY_SERIAL);
- String signature = request.getHeader(WECHAT_PAY_SIGNATURE);
+ String serial = request.getHeader(WechatPayHttpHeaders.WECHAT_PAY_SERIAL);
+ String signature = request.getHeader(WechatPayHttpHeaders.WECHAT_PAY_SIGNATURE);
//验签
if (!verifier.verify(serial, message.getBytes(StandardCharsets.UTF_8), signature)) {
@@ -77,7 +77,7 @@ public class WechatPayValidator {
private void validateParameters(HttpServletRequest request) {
// NOTE: ensure HEADER_WECHAT_PAY_TIMESTAMP at last
- String[] headers = {WECHAT_PAY_SERIAL, WECHAT_PAY_SIGNATURE, WECHAT_PAY_NONCE, WECHAT_PAY_TIMESTAMP};
+ String[] headers = {WechatPayHttpHeaders.WECHAT_PAY_SERIAL, WechatPayHttpHeaders.WECHAT_PAY_SIGNATURE, WechatPayHttpHeaders.WECHAT_PAY_NONCE, WechatPayHttpHeaders.WECHAT_PAY_TIMESTAMP};
String header = null;
for (String headerName : headers) {
@@ -101,8 +101,8 @@ public class WechatPayValidator {
}
private String buildMessage(HttpServletRequest request) {
- String timestamp = request.getHeader(WECHAT_PAY_TIMESTAMP);
- String nonce = request.getHeader(WECHAT_PAY_NONCE);
+ String timestamp = request.getHeader(WechatPayHttpHeaders.WECHAT_PAY_TIMESTAMP);
+ String nonce = request.getHeader(WechatPayHttpHeaders.WECHAT_PAY_NONCE);
return timestamp + "\n"
+ nonce + "\n"
+ body + "\n";
diff --git a/dl-module-inspection/pom.xml b/dl-module-inspection/pom.xml
index 7d717f59..03b7e017 100644
--- a/dl-module-inspection/pom.xml
+++ b/dl-module-inspection/pom.xml
@@ -26,6 +26,12 @@
yudao-module-system-biz
${revision}
+
+ cn.iocoder.boot
+ yudao-module-infra-biz
+ 2.1.0-jdk8-snapshot
+ compile
+
8
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/AppSwiperController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/AppSwiperController.java
index 1344e3c5..610c88fd 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/AppSwiperController.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/AppSwiperController.java
@@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.appBase.controller;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
@@ -8,16 +10,21 @@ import cn.iocoder.yudao.module.appBase.entity.AppSwiper;
import cn.iocoder.yudao.module.appBase.service.IAppSwiperService;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.core.page.TableDataInfo;
+import cn.iocoder.yudao.module.infra.controller.app.file.vo.AppFileUploadReqVO;
+import cn.iocoder.yudao.module.infra.service.file.FileService;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import cn.iocoder.yudao.module.shop.service.IShopMallPartnersService;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.thoughtworks.xstream.core.SecurityUtils;
+import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
@@ -40,6 +47,25 @@ public class AppSwiperController extends BaseController
@Autowired
private AdminUserService userService;
+ @Resource
+ private FileService fileService;
+
+ @PostMapping({"/common/uploadImg","/common/upload"})
+ @Operation(summary = "上传文件")
+ public CommonResult uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception {
+ MultipartFile file = uploadReqVO.getFile();
+ String path = uploadReqVO.getPath();
+ String url = fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()));
+
+ Map map = new HashMap<>();
+ map.put("url", url);
+ map.put("fileName", file.getName());
+ map.put("newFileName", FileUtil.getName(url));
+ map.put("originalFilename", file.getOriginalFilename());
+
+ return success(map);
+ }
+
/**
* 查询【请填写功能名称】列表
*/
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/mapper/AppSwiperMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/mapper/AppSwiperMapper.java
index 4f5d6a0e..c1e404bd 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/mapper/AppSwiperMapper.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/mapper/AppSwiperMapper.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.appBase.mapper;
import cn.iocoder.yudao.module.appBase.entity.AppSwiper;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -29,7 +30,7 @@ public interface AppSwiperMapper
* @param appSwiper 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
- public List selectAppSwiperList(AppSwiper appSwiper);
+ public List selectAppSwiperList(@Param("vo") AppSwiper appSwiper);
/**
* 新增【请填写功能名称】
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/contract/controller/ContractHistoryController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/contract/controller/ContractHistoryController.java
new file mode 100644
index 00000000..f97164d8
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/contract/controller/ContractHistoryController.java
@@ -0,0 +1,199 @@
+package cn.iocoder.yudao.module.contract.controller;
+
+import cn.hutool.core.codec.Base64;
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.security.core.LoginUser;
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
+import cn.iocoder.yudao.module.contract.entity.ContractHistory;
+import cn.iocoder.yudao.module.contract.entity.ContractSignVo;
+import cn.iocoder.yudao.module.contract.entity.InspectionContract;
+import cn.iocoder.yudao.module.contract.service.IContractHistoryService;
+import cn.iocoder.yudao.module.contract.service.IInspectionContractService;
+import cn.iocoder.yudao.module.core.controller.BaseController;
+import cn.iocoder.yudao.module.core.page.TableDataInfo;
+import cn.iocoder.yudao.module.infra.service.file.FileService;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
+import cn.iocoder.yudao.module.system.service.user.AdminUserService;
+import cn.iocoder.yudao.util.ExcelUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.github.pagehelper.PageHelper;
+import org.dom4j.DocumentException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.util.Calendar;
+import java.util.List;
+
+import static cn.iocoder.yudao.module.contract.utils.ImageUtil.base64ToJpg;
+
+/**
+ * 签署历史Controller
+ *
+ * @author ruoyi
+ * @date 2023-07-19
+ */
+@RestController
+@RequestMapping("/admin-api/system/history")
+public class ContractHistoryController extends BaseController
+{
+ @Autowired
+ private AdminUserService userService;
+ @Autowired
+ private IContractHistoryService contractHistoryService;
+ @Autowired
+ private IInspectionContractService inspectionContractService;
+ @Resource
+ private FileService fileService;
+
+ /**
+ * 查询签署历史列表
+ */
+// @PreAuthorize("@ss.hasPermi('system:history:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ContractHistory contractHistory,@RequestParam("pageNum")Integer pageNum,@RequestParam("pageSize")Integer pageSize)
+ {
+ PageHelper.startPage(pageNum,pageSize);
+ List list = contractHistoryService.selectContractHistoryList(contractHistory);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出签署历史列表
+ */
+// @PreAuthorize("@ss.hasPermi('system:history:export')")
+
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ContractHistory contractHistory)
+ {
+ List list = contractHistoryService.selectContractHistoryList(contractHistory);
+ ExcelUtil util = new ExcelUtil(ContractHistory.class);
+ util.exportExcel(response, list, "签署历史数据");
+ }
+
+ /**
+ * 获取签署历史详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:history:query')")
+ @GetMapping(value = "/{id}")
+ public CommonResult getInfo(@PathVariable("id") Long id)
+ {
+ return success(contractHistoryService.selectContractHistoryById(id));
+ }
+
+ /**
+ * 新增签署历史
+ */
+
+ @PostMapping
+ public CommonResult add(@RequestBody ContractSignVo data) throws IOException, DocumentException {
+ Calendar calendar = Calendar.getInstance();
+ // 获取当前年
+ int year = calendar.get(Calendar.YEAR);
+ // 获取当前月
+ int month = calendar.get(Calendar.MONTH) + 1;
+ // 获取当前日
+ int day = calendar.get(Calendar.DATE);
+ ContractHistory contractHistory =new ContractHistory();
+ LoginUser nowUser = SecurityFrameworkUtils.getLoginUser();
+ contractHistory.setContractId(1L);
+ contractHistory.setUserId(nowUser.getId());
+ //实体对象转成map
+ JSONObject dataMap =new JSONObject();
+ dataMap.put("sfz",data.getSfz());
+ dataMap.put("position",data.getPosition());
+ dataMap.put("carNum",data.getCarNum());
+ dataMap.put("phone",data.getPhone());
+ dataMap.put("cbgs",data.getCbgs());
+ dataMap.put("kcyPhone",data.getKcyPhone());
+ dataMap.put("lc",data.getLc());
+ dataMap.put("rs",data.getRs());
+ dataMap.put("sjqk",data.getSjqk());
+ dataMap.put("jbr",data.getJbr());
+ dataMap.put("year",String.valueOf(year));
+ dataMap.put("month",String.valueOf(month));
+ dataMap.put("day",String.valueOf(day));
+ byte[] decode = Base64.decode(data.getSignImage());
+ String url = fileService.createFile("temp", null, decode);
+ contractHistory.setSignContract(url);
+ return success(contractHistoryService.insertContractHistory(contractHistory));
+ }
+
+
+
+ /**
+ * 新增检测委托授权
+ */
+
+ @PostMapping("/jcWts")
+ public CommonResult jcWts(@RequestBody InspectionContract data) throws Exception {
+ //当前登录用户
+ LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
+ Calendar calendar = Calendar.getInstance();
+ // 获取当前年
+ int year = calendar.get(Calendar.YEAR);
+ // 获取当前月
+ int month = calendar.get(Calendar.MONTH) + 1;
+ // 获取当前日
+ int day = calendar.get(Calendar.DATE);
+ //判断当前年是否已存在授权 当前车
+ LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>();
+ queryWrapper.eq(InspectionContract::getUserId,loginUser.getId())
+ .eq(InspectionContract::getCarnum,data.getCarnum()).like(InspectionContract::getYear,year);
+ InspectionContract one = inspectionContractService.getOne(queryWrapper);
+ if (ObjectUtil.isNotEmpty(one)){
+ throw new Exception("请不要重复授权");
+ }
+ AdminUserDO user = userService.getUser(loginUser.getId());
+ AdminUserDO wtrUser = userService.getUser(data.getWtrId());
+ data.setYear(year);
+ data.setMonth(month);
+ data.setDay(day);
+ data.setUserId(user.getId());
+ data.setBren(user.getNickname());
+ data.setBrphone(user.getMobile());
+ data.setBrsfz(user.getIdCard());
+ data.setWtr(wtrUser.getNickname());
+ data.setWtrphone(wtrUser.getMobile());
+ data.setWtrsfz(wtrUser.getIdCard());
+ ContractHistory contractHistory =new ContractHistory();
+ LoginUser nowUser = SecurityFrameworkUtils.getLoginUser();
+ contractHistory.setContractId(2L);
+ contractHistory.setUserId(nowUser.getId());
+ //实体对象转成map
+ JSONObject dataMap =JSONObject.parseObject(JSONObject.toJSONString(data));
+ byte[] decode = Base64.decode(data.getSignImage());
+ String url = fileService.createFile("temp", null, decode);
+ contractHistory.setSignContract(url);
+ inspectionContractService.save(data);
+ return success(contractHistoryService.insertContractHistory(contractHistory));
+ }
+ /**
+ * 修改签署历史
+ */
+// @PreAuthorize("@ss.hasPermi('system:history:edit')")
+ @PutMapping
+ public CommonResult edit(@RequestBody ContractHistory contractHistory)
+ {
+ return toAjax(contractHistoryService.updateContractHistory(contractHistory));
+ }
+
+ /**
+ * 删除签署历史
+ */
+// @PreAuthorize("@ss.hasPermi('system:history:remove')")
+
+ @DeleteMapping("/{ids}")
+ public CommonResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(contractHistoryService.deleteContractHistoryByIds(ids));
+ }
+
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/contract/controller/InspectionContractController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/contract/controller/InspectionContractController.java
new file mode 100644
index 00000000..d8eed842
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/contract/controller/InspectionContractController.java
@@ -0,0 +1,113 @@
+package cn.iocoder.yudao.module.contract.controller;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.module.contract.entity.InspectionContract;
+import cn.iocoder.yudao.module.contract.service.IInspectionContractService;
+import cn.iocoder.yudao.module.core.controller.BaseController;
+import cn.iocoder.yudao.module.core.page.TableDataInfo;
+import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
+import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
+import cn.iocoder.yudao.util.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * inspectionContractController
+ *
+ * @author ruoyi
+ * @date 2023-08-31
+ */
+@RestController
+@RequestMapping("/admin-api/contract/inspectionContract")
+public class InspectionContractController extends BaseController
+{
+ @Autowired
+ private IInspectionContractService inspectionContractService;
+ @Autowired
+ private AppInspectionPartnerService partnerList;
+
+ /**
+ * 查询inspectionContract列表
+ */
+// @PreAuthorize("@ss.hasPermi('contract:inspectionContract:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(InspectionContract inspectionContract)
+ {
+ startPage();
+ List list = inspectionContractService.selectInspectionContractList(inspectionContract);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出inspectionContract列表
+ */
+// @PreAuthorize("@ss.hasPermi('contract:inspectionContract:export')")
+// @Log(title = "inspectionContract", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, InspectionContract inspectionContract)
+ {
+ List list = inspectionContractService.selectInspectionContractList(inspectionContract);
+ ExcelUtil util = new ExcelUtil(InspectionContract.class);
+ util.exportExcel(response, list, "inspectionContract数据");
+ }
+
+ /**
+ * 获取inspectionContract详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('contract:inspectionContract:query')")
+ @GetMapping(value = "/{id}")
+ public CommonResult getInfo(@PathVariable("id") Long id)
+ {
+ return success(inspectionContractService.selectInspectionContractById(id));
+ }
+
+ /**
+ * 新增inspectionContract
+ */
+// @PreAuthorize("@ss.hasPermi('contract:inspectionContract:add')")
+// @Log(title = "inspectionContract", businessType = BusinessType.INSERT)
+ @PostMapping
+ public CommonResult add(@RequestBody InspectionContract inspectionContract)
+ {
+ return toAjax(inspectionContractService.insertInspectionContract(inspectionContract));
+ }
+
+ /**
+ * 修改inspectionContract
+ */
+// @PreAuthorize("@ss.hasPermi('contract:inspectionContract:edit')")
+// @Log(title = "inspectionContract", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public CommonResult edit(@RequestBody InspectionContract inspectionContract)
+ {
+ return toAjax(inspectionContractService.updateInspectionContract(inspectionContract));
+ }
+
+ /**
+ * 删除inspectionContract
+ */
+// @PreAuthorize("@ss.hasPermi('contract:inspectionContract:remove')")
+// @Log(title = "inspectionContract", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public CommonResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(inspectionContractService.deleteInspectionContractByIds(ids));
+ }
+
+
+ /**
+ * 授权管理
+ */
+
+ @GetMapping("/partnerGetWtList")
+ public TableDataInfo partnerGetWtList(InspectionContract inspectionContract) throws Exception {
+ ShopMallPartners partners = partnerList.shopInfo();
+ inspectionContract.setPartnerId(partners.getPartnerId());
+ startPage();
+ List list = inspectionContractService.partnerGetWtList(inspectionContract);
+ return getDataTable(list);
+ }
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/core/controller/BaseController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/core/controller/BaseController.java
index 77a55a55..282963d3 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/core/controller/BaseController.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/core/controller/BaseController.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.core.controller;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.core.page.*;
import cn.iocoder.yudao.module.core.text.HttpStatus;
import cn.iocoder.yudao.util.StringUtils;
@@ -157,7 +158,7 @@ public class BaseController
*/
public LoginUser getLoginUser()
{
- return getLoginUser();
+ return SecurityFrameworkUtils.getLoginUser();
}
/**
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/AppUserOwnController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/AppUserOwnController.java
index 769b511b..d19c9ae6 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/AppUserOwnController.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/AppUserOwnController.java
@@ -1,7 +1,11 @@
package cn.iocoder.yudao.module.inspection.controller;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
+import cn.iocoder.yudao.module.system.service.permission.PermissionService;
+import cn.iocoder.yudao.module.system.service.permission.RoleService;
+import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.github.pagehelper.PageHelper;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.core.page.TableDataInfo;
@@ -21,6 +25,13 @@ public class AppUserOwnController extends BaseController {
@Autowired
private IShopUserCarService shopUserCarService;
+ @Autowired
+ private PermissionService permissionService;
+ @Autowired
+ private AdminUserService userService;
+ @Autowired
+ private RoleService roleService;
+
@PostMapping("/updateRole")
public CommonResult updateRole(String roleCode)
{
@@ -45,7 +56,7 @@ public class AppUserOwnController extends BaseController {
{
PageHelper.startPage(pageNum,pageSize);
List dbList = ownService.getDbList(searchValue);
- return getDataTable(dbList);
+ return getDataTable(dbList);
}
@GetMapping(value = "/getAppUserCar")
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java
index 578a6311..67aa70e6 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java
@@ -520,6 +520,7 @@ public class PartnerOwnController extends BaseController {
dictSave.setStatus(0);
dictSave.setValue(dictData.getDictLabel());
dictSave.setCssClass("default");
+ dictSave.setRemark(dictData.getRemark());
dictDataService.createDictData(dictSave);
return success();
}
@@ -583,7 +584,9 @@ public class PartnerOwnController extends BaseController {
dictSave.setDictType(sysDictType.getType());
dictSave.setStatus(0);
- dictSave.setValue(dictData.getDictLabel());
+ dictSave.setLabel(dictData.getDictLabel());
+ dictSave.setValue(dictData.getDictValue());
+ dictSave.setRemark(dictData.getRemark());
dictSave.setCssClass("default");
dictDataService.createDictData(dictSave);
return success();
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DelInspectionInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DelInspectionInfo.java
index 6e259e02..903e1dac 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DelInspectionInfo.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DelInspectionInfo.java
@@ -161,6 +161,16 @@ public class DelInspectionInfo extends TenantBaseDO
@Excel(name = "是否上门取车")
private String isPickCar;
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ private String remark;
+
public void setId(Long id)
{
this.id = id;
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DelOrderInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DelOrderInfo.java
index 46d584c0..d3d20be2 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DelOrderInfo.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DelOrderInfo.java
@@ -210,6 +210,16 @@ public class DelOrderInfo extends TenantBaseDO
@Excel(name = "车辆性质")
private String carNature;
+ private String remark;
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
/** 车辆识别代码 */
@Excel(name = "车辆识别代码")
private String carIdNo;
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionEquInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionEquInfo.java
index 9a7f6020..cc27e940 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionEquInfo.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionEquInfo.java
@@ -1,8 +1,10 @@
package cn.iocoder.yudao.module.inspection.entity;
import java.util.Date;
+import java.util.Map;
import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@@ -57,4 +59,7 @@ public class InspectionEquInfo extends TenantBaseDO
@Excel(name = "下次检定时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date nextCheckTime;
+ @TableField(exist = false)
+ private Map params;
+
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionFile.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionFile.java
index c6fe1830..c52c020c 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionFile.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionFile.java
@@ -1,8 +1,10 @@
package cn.iocoder.yudao.module.inspection.entity;
import java.util.Date;
+import java.util.Map;
import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@@ -47,4 +49,7 @@ public class InspectionFile extends TenantBaseDO
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "提醒时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date warnTime;
+
+ @TableField(exist = false)
+ private Map params;
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionStepInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionStepInfo.java
index 84fd9b51..da0dfb83 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionStepInfo.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionStepInfo.java
@@ -33,10 +33,10 @@ public class InspectionStepInfo extends Model {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
//创建人id
- private Integer createBy;
+ private Integer creator;
//更新时间
private Date updateTime;
//更新人id
- private Integer updateBy;
+ private Integer updater;
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java
index a886417c..dc074881 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java
@@ -123,6 +123,11 @@ public class InspectionInfoServiceImpl extends ServiceImpl list = partnerCustomerInfoService.selectPartnerCustomerInfoList(partnerCustomerInfo);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出客户信息列表
+ */
+
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, PartnerCustomerInfo partnerCustomerInfo)
+ {
+ List list = partnerCustomerInfoService.selectPartnerCustomerInfoList(partnerCustomerInfo);
+ ExcelUtil util = new ExcelUtil(PartnerCustomerInfo.class);
+ util.exportExcel(response, list, "客户信息数据");
+ }
+
+ /**
+ * 获取客户信息详细信息
+ */
+ @GetMapping(value = "/{id}")
+ public CommonResult getInfo(@PathVariable("id") Long id)
+ {
+ return success(partnerCustomerInfoService.selectPartnerCustomerInfoById(id));
+ }
+
+ /**
+ * 新增客户信息
+ */
+
+ @PostMapping
+ public CommonResult add(@RequestBody PartnerCustomerInfo partnerCustomerInfo) throws Exception {
+ return toAjax(partnerCustomerInfoService.insertPartnerCustomerInfo(partnerCustomerInfo));
+ }
+
+ /**
+ * 修改客户信息
+ */
+
+ @PutMapping
+ public CommonResult edit(@RequestBody PartnerCustomerInfo partnerCustomerInfo)
+ {
+ return toAjax(partnerCustomerInfoService.updatePartnerCustomerInfo(partnerCustomerInfo));
+ }
+
+ /**
+ * 删除客户信息
+ */
+
+ @DeleteMapping("/{ids}")
+ public CommonResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(partnerCustomerInfoService.deletePartnerCustomerInfoByIds(ids));
+ }
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/mapper/PartnerCustomerInfoMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/mapper/PartnerCustomerInfoMapper.java
index 8fe3c305..16287e3b 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/mapper/PartnerCustomerInfoMapper.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/mapper/PartnerCustomerInfoMapper.java
@@ -5,6 +5,8 @@ import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
/**
* 客户信息Mapper接口
*
@@ -14,4 +16,37 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PartnerCustomerInfoMapper extends BaseMapper
{
+ /**
+ * 查询客户信息列表
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 客户信息集合
+ */
+ public List selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo);
+
+ /**
+ * 查询客户信息
+ *
+ * @param id 客户信息主键
+ * @return 客户信息
+ */
+ public PartnerCustomerInfo selectPartnerCustomerInfoById(Long id);
+
+ int insertPartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo);
+
+ /**
+ * 修改客户信息
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 结果
+ */
+ public int updatePartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo);
+
+ /**
+ * 批量删除客户信息
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deletePartnerCustomerInfoByIds(Long[] ids);
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/IPartnerCustomerInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/IPartnerCustomerInfoService.java
index 9afde20f..ac993eee 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/IPartnerCustomerInfoService.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/IPartnerCustomerInfoService.java
@@ -13,4 +13,44 @@ import java.util.List;
public interface IPartnerCustomerInfoService extends IService
{
+ /**
+ * 查询客户信息列表
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 客户信息集合
+ */
+ public List selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo);
+
+ /**
+ * 查询客户信息
+ *
+ * @param id 客户信息主键
+ * @return 客户信息
+ */
+ public PartnerCustomerInfo selectPartnerCustomerInfoById(Long id);
+
+ /**
+ * 新增客户信息
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 结果
+ */
+ public int insertPartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo) throws Exception;
+
+ /**
+ * 修改客户信息
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 结果
+ */
+ public int updatePartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo);
+
+ /**
+ * 批量删除客户信息
+ *
+ * @param ids 需要删除的客户信息主键集合
+ * @return 结果
+ */
+ public int deletePartnerCustomerInfoByIds(Long[] ids);
+
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java
index 1d1745ec..96692d41 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java
@@ -1,10 +1,33 @@
package cn.iocoder.yudao.module.partner.service.impl;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
import cn.iocoder.yudao.module.partner.mapper.PartnerCustomerInfoMapper;
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
+import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
+import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
+import cn.iocoder.yudao.module.shop.service.IShopUserCarService;
+import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
+import cn.iocoder.yudao.module.system.service.permission.PermissionService;
+import cn.iocoder.yudao.module.system.service.permission.RoleService;
+import cn.iocoder.yudao.module.system.service.user.AdminUserService;
+import cn.iocoder.yudao.util.DateUtils;
+import cn.iocoder.yudao.util.StringUtils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
/**
* 客户信息Service业务层处理
@@ -14,4 +37,191 @@ import org.springframework.stereotype.Service;
*/
@Service
public class PartnerCustomerInfoServiceImpl extends ServiceImpl implements IPartnerCustomerInfoService
-{}
+{
+ @Autowired
+ private IShopUserCarService userCarService;
+ @Autowired
+ private AppInspectionPartnerService partnerService;
+ @Autowired
+ private AdminUserService userService;
+ @Autowired
+ private RoleService roleService;
+ @Autowired
+ private PermissionService permissionService;
+
+ /**
+ * 查询客户信息列表
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 客户信息
+ */
+ @Override
+ public List selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo)
+ {
+ List partnerCustomerInfos = baseMapper.selectPartnerCustomerInfoList(partnerCustomerInfo);
+ for (PartnerCustomerInfo customerInfo : partnerCustomerInfos) {
+ LambdaQueryWrapper queryWrapper1 =new LambdaQueryWrapper<>();
+ queryWrapper1.eq(ShopUserCar::getUserId,customerInfo.getUserId());
+ List list = userCarService.list(queryWrapper1);
+ if (CollectionUtil.isNotEmpty(list)){
+ customerInfo.setUserCarList(list);
+ }else {
+ customerInfo.setUserCarList(new ArrayList<>());
+ }
+ }
+ return partnerCustomerInfos;
+ }
+
+ /**
+ * 查询客户信息
+ *
+ * @param id 客户信息主键
+ * @return 客户信息
+ */
+ @Override
+ public PartnerCustomerInfo selectPartnerCustomerInfoById(Long id)
+ {
+ return baseMapper.selectPartnerCustomerInfoById(id);
+ }
+
+ /**
+ * 新增客户信息
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 结果
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int insertPartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo) throws Exception {
+ ShopMallPartners partners = partnerService.shopInfo();
+ LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>();
+ queryWrapper.eq(PartnerCustomerInfo::getPartnerId,partners.getPartnerId()).eq(PartnerCustomerInfo::getCustomerPhone,partnerCustomerInfo.getCustomerPhone());
+ PartnerCustomerInfo customerInfo = this.getOne(queryWrapper);
+ if (ObjectUtils.isNotEmpty(customerInfo)){
+ throw new Exception("客户已存在");
+ }
+ AdminUserDO user = userService.selectUserByPhone(partnerCustomerInfo.getCustomerPhone());
+ if (ObjectUtils.isEmpty(user)){
+ RoleDO role = roleService.queryRole("jcyh");
+
+ UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
+ BeanUtils.copyProperties(partnerCustomerInfo,user);
+ userSaveReqVO.setUsername(partnerCustomerInfo.getCustomerPhone());
+ userSaveReqVO.setNickname(partnerCustomerInfo.getCustomerName());
+ Long uid = userService.createUser(new UserSaveReqVO());
+
+ Set ids = new HashSet<>();
+ ids.add(role.getId());
+ permissionService.assignUserRole(uid,ids);
+
+ }
+ if (!StringUtils.isEmpty(partnerCustomerInfo.getCustomerPhone())&&!StringUtils.isEmpty(partnerCustomerInfo.getRoleCode())){
+ RoleDO sysRole = roleService.queryRole(partnerCustomerInfo.getRoleCode());
+ Set ids = new HashSet<>();
+ ids.add(sysRole.getId());
+ permissionService.assignUserRole(user.getId(),ids);
+
+ }
+ List userCarList = partnerCustomerInfo.getUserCarList();
+ if (CollectionUtil.isNotEmpty(userCarList)){
+ for (ShopUserCar shopUserCar : userCarList) {
+ LambdaQueryWrapper queryWrapper1 =new LambdaQueryWrapper<>();
+ queryWrapper1.eq(ShopUserCar::getUserId,user.getId()).eq(ShopUserCar::getCarNo,shopUserCar.getCarNo());
+ ShopUserCar one = userCarService.getOne(queryWrapper1);
+ if (ObjectUtils.isNotEmpty(one)){
+ //保养日期
+ if (null!=shopUserCar.getMaintenanceDate()){
+ one.setMaintenanceDate(shopUserCar.getMaintenanceDate());
+ }
+ if (null!=shopUserCar.getMaintenanceMileage()){
+ one.setMaintenanceMileage(shopUserCar.getMaintenanceMileage());
+ }
+ if (null!=shopUserCar.getInspectionDate()){
+ one.setInspectionDate(shopUserCar.getInspectionDate());
+ }
+
+ if (null!=shopUserCar.getInsuranceDate()){
+ one.setInsuranceDate(shopUserCar.getInsuranceDate());
+ }
+ if (null!=shopUserCar.getNextMaintenanceDate()){
+ one.setNextMaintenanceDate(shopUserCar.getNextMaintenanceDate());
+ }
+ if (null!=shopUserCar.getNextMaintenanceMileage()){
+ one.setNextMaintenanceMileage(shopUserCar.getNextMaintenanceMileage());
+ }
+ if (null!=shopUserCar.getNextInspectionDate()){
+ one.setNextInspectionDate(shopUserCar.getNextInspectionDate());
+ }
+ if (null!=shopUserCar.getInsuranceExpiryDate()){
+ one.setInsuranceExpiryDate(shopUserCar.getInsuranceExpiryDate());
+ }
+ userCarService.updateById(one);
+ }else {
+ shopUserCar.setUserId(user.getId());
+ userCarService.save(shopUserCar);
+ }
+
+ }
+ }
+ partnerCustomerInfo.setPartnerId(partners.getPartnerId());
+ partnerCustomerInfo.setUserId(user.getId());
+ return baseMapper.insertPartnerCustomerInfo(partnerCustomerInfo);
+ }
+
+ /**
+ * 修改客户信息
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 结果
+ */
+ @Override
+ public int updatePartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo)
+ {
+ List userCarList = partnerCustomerInfo.getUserCarList();
+ for (ShopUserCar shopUserCar : userCarList) {
+ shopUserCar.setUserId(partnerCustomerInfo.getUserId());
+ }
+ if (CollectionUtil.isNotEmpty(userCarList)){
+ LambdaQueryWrapper queryWrapper1 =new LambdaQueryWrapper<>();
+ queryWrapper1.eq(ShopUserCar::getUserId,partnerCustomerInfo.getUserId());
+ userCarService.remove(queryWrapper1);
+ userCarService.saveBatch(userCarList);
+ }
+ if (!StringUtils.isEmpty(partnerCustomerInfo.getCustomerPhone())&&!StringUtils.isEmpty(partnerCustomerInfo.getRoleCode())){
+ AdminUserDO sysUser = userService.selectUserByPhone(partnerCustomerInfo.getCustomerPhone());
+ RoleDO sysRole = roleService.queryRole(partnerCustomerInfo.getRoleCode());
+
+ if (ObjectUtils.isNotEmpty(sysUser)){
+ Set ids = new HashSet();
+ ids.add(sysUser.getId());
+ permissionService.assignUserRole(sysUser.getId(),ids);
+ }else {
+ UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
+ userSaveReqVO.setUsername(partnerCustomerInfo.getCustomerPhone());
+ userSaveReqVO.setNickname(partnerCustomerInfo.getCustomerName());
+ userSaveReqVO.setMobile(partnerCustomerInfo.getCustomerPhone());
+ userSaveReqVO.setDeptId(partnerCustomerInfo.getDeptId());
+ Long uid = userService.createUser(userSaveReqVO);
+ Set ids = new HashSet();
+ ids.add(sysUser.getId());
+ permissionService.assignUserRole(uid,ids);
+ }
+
+ }
+
+ partnerCustomerInfo.setUpdateTime(DateUtils.getNowDate());
+ return baseMapper.updatePartnerCustomerInfo(partnerCustomerInfo);
+ }
+
+ /**
+ * 批量删除客户信息
+ *
+ * @param ids 需要删除的客户信息主键
+ * @return 结果
+ */
+ @Override
+ public int deletePartnerCustomerInfoByIds(Long[] ids)
+ {
+ return baseMapper.deletePartnerCustomerInfoByIds(ids);
+ }
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/controller/OrderController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/controller/OrderController.java
new file mode 100644
index 00000000..0d80f77d
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/controller/OrderController.java
@@ -0,0 +1,185 @@
+package cn.iocoder.yudao.module.payment.controller;
+
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.module.core.controller.BaseController;
+import cn.iocoder.yudao.module.core.page.PageDomain;
+import cn.iocoder.yudao.module.core.page.TableDataInfo;
+import cn.iocoder.yudao.module.core.page.TableSupport;
+import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
+import cn.iocoder.yudao.module.payment.entity.OrderInfo;
+import cn.iocoder.yudao.module.payment.entity.commentVo;
+import cn.iocoder.yudao.module.payment.service.OrderInfoService;
+import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
+import cn.iocoder.yudao.module.shop.service.IShopMallPartnersService;
+import cn.iocoder.yudao.util.StringUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.pagehelper.PageHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+
+@RequestMapping("/admin-api/orderApi")
+@RestController
+public class OrderController extends BaseController {
+
+ @Autowired
+ private OrderInfoService orderInfoService;
+ @Autowired
+ private IShopMallPartnersService shopMallPartnersService;
+ @Autowired
+ private AppInspectionPartnerService partnerService;
+
+
+ @PostMapping("/createOrder")
+ public CommonResult createOrder(@RequestBody OrderInfo orderInfo) throws Exception {
+ return CommonResult.success(orderInfoService.createOrder(orderInfo));
+ }
+
+
+ @GetMapping("/orderDetail")
+ public CommonResult orderDetail(Long goodsId, String type, String title, Integer amount) {
+ return CommonResult.success(orderInfoService.orderDetail(goodsId, type, title, amount));
+ }
+
+ @GetMapping("/pickCarDetail")
+ public CommonResult pickCarDetail(Long pickCarId) {
+ return CommonResult.success(orderInfoService.pickCarDetail(pickCarId));
+ }
+
+ //取消支付
+ @PostMapping("/cancelPay")
+ public CommonResult cancelPay(Long orderId) {
+ orderInfoService.cancelPay(orderId);
+ return CommonResult.ok();
+ }
+
+ @GetMapping("/orderList")
+ public TableDataInfo orderList(String status, String title) {
+ startPage();
+ List orderInfos = orderInfoService.orderList(status, title);
+ return getDataTable(orderInfos);
+
+ }
+
+ // 用于自营维修保养核销
+ @PostMapping("/validation")
+ public CommonResult validation(@RequestBody Map requestBody) {
+ Object accessCodeValue = requestBody.get("accessCode");
+ if (accessCodeValue != null) {
+ String accessCode = accessCodeValue.toString();
+ return CommonResult.success(orderInfoService.validation(accessCode));
+ } else {
+ return CommonResult.error(500,"核销码错误");
+ }
+ }
+
+ // 用于商城核销
+ @PostMapping("/validationMall")
+ public CommonResult validationMall(@RequestBody Map requestBody) {
+ Object accessCodeValue = requestBody.get("accessCode");
+ if (accessCodeValue != null) {
+ String accessCode = accessCodeValue.toString();
+ return CommonResult.success(orderInfoService.validationMall(accessCode));
+ } else {
+ return CommonResult.error(500,"核销码错误");
+ }
+ }
+
+ // 核销记录By核销人Id 微信端
+ @GetMapping("/validationListWx")
+ public TableDataInfo validationListWx(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
+ Page page = new Page<>(pageNum, pageSize);
+ List list = orderInfoService.validationListWx(page);
+ return getDataTable(list);
+ }
+
+ // 商城核销记录By核销人Id PC
+ @GetMapping("/validationListPc")
+ public TableDataInfo validationListPc(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
+ Page page = new Page<>(pageNum, pageSize);
+ List list = orderInfoService.validationListPc(page);
+ return getDataTable(list);
+ }
+
+
+ //评论商品和星级
+ @PostMapping("/reviewOrder")
+ public CommonResult reviewOrder(String orderId, Integer starLevel, String reviewStr) throws Exception {
+ orderInfoService.reviewOrder(orderId, starLevel, reviewStr);
+ return CommonResult.ok();
+ }
+
+ /**
+ * 查询检测订单列表
+ */
+ @GetMapping("/orderListSystem")
+ public TableDataInfo orderListSystem(OrderInfo shopInspectionOrder) {
+ startPage();
+ List list = orderInfoService.orderListSystem(shopInspectionOrder);
+ return getDataTable(list);
+ }
+
+ /**
+ * 订单评价
+ */
+
+ @PostMapping("/commentOrder")
+ public CommonResult commentOrder(@RequestBody OrderInfo orderInfo) throws Exception {
+ OrderInfo curOrderInfo = orderInfoService.getById(orderInfo.getId());
+ if (!Objects.equals(curOrderInfo.getUserId(), getUserId())) {
+ return CommonResult.error(500,"非当前用户订单,禁止评论");
+ }
+ return CommonResult.success(orderInfoService.commentOrder(orderInfo));
+ }
+
+ /**
+ * 获取尚未评价的订单
+ */
+
+ @GetMapping("/getNoCommentOrder")
+ public CommonResult getNoCommentOrder() {
+ return CommonResult.success(orderInfoService.getNoCommentOrder());
+ }
+
+ /**
+ * 获取商品的评价列表
+ */
+
+ @GetMapping("/getCommentOrderList")
+ public TableDataInfo getCommentOrderList(Long partnerId,Integer pageNum,Integer pageSize) {
+ //判断商家是否开启评论区
+ ShopMallPartners partners = partnerService.getById(partnerId);
+ if (StringUtils.isEmpty(partners.getOpenComment())||partners.getOpenComment().equals("0")){
+ return getDataTable(new ArrayList<>());
+ }
+ PageHelper.startPage(pageNum,pageSize);
+ List commentOrderList = orderInfoService.getCommentOrderList(partnerId);
+ return getDataTable(commentOrderList);
+ }
+
+ // pc端合作商订单列表
+ @GetMapping("/listPc")
+ public TableDataInfo listPc(OrderInfo orderInfo) {
+ // 当前合作商的商品
+ ShopMallPartners shopMallPartners = shopMallPartnersService.selectShopMallPartnersByUserId(getUserId(),"sc");
+ orderInfo.setPartnerId(shopMallPartners.getPartnerId());
+ PageDomain pageDomain = TableSupport.getPageDomain();
+ PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize(), pageDomain.getOrderBy());
+ List list = orderInfoService.orderListPc(orderInfo);
+ return getDataTable(list);
+ }
+
+ @GetMapping("/getOrderInfo/{id}")
+ public CommonResult getOrderInfo(@PathVariable("id") Long id) throws Exception {
+ OrderInfo curOrderInfo = orderInfoService.getById(id);
+ if (!Objects.equals(curOrderInfo.getUserId(), getUserId())) {
+ return CommonResult.error(500,"非当前用户订单");
+ }
+ return CommonResult.success(curOrderInfo);
+ }
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/controller/WxPayController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/controller/WxPayController.java
new file mode 100644
index 00000000..3f6aec3c
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/controller/WxPayController.java
@@ -0,0 +1,264 @@
+package cn.iocoder.yudao.module.payment.controller;
+
+
+import cn.iocoder.yudao.framework.security.core.LoginUser;
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
+import cn.iocoder.yudao.module.partner.entity.PartnerBankInfo;
+import cn.iocoder.yudao.module.payment.entity.OrderInfo;
+import cn.iocoder.yudao.module.payment.service.OrderInfoService;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
+import cn.iocoder.yudao.module.system.service.user.AdminUserService;
+import cn.iocoder.yudao.util.WechatPayConfig;
+import cn.iocoder.yudao.util.WechatPayRequest;
+import cn.iocoder.yudao.util.WechatPayUrlEnum;
+import cn.iocoder.yudao.util.StringUtils;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.partner.service.IPartnerBankInfoService;
+import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
+import com.wechat.pay.java.core.Config;
+import com.wechat.pay.java.core.RSAAutoCertificateConfig;
+import com.wechat.pay.java.service.payments.jsapi.JsapiService;
+import com.wechat.pay.java.service.payments.jsapi.model.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.security.*;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
+
+
+@RestController
+@RequestMapping("/admin-api/payApi")
+public class WxPayController {
+
+ @Resource
+ private WechatPayConfig wechatPayConfig;
+
+ @Resource
+ private WechatPayRequest wechatPayRequest;
+ @Autowired
+ private OrderInfoService orderInfoService;
+ @Autowired
+ private IPartnerBankInfoService partnerBankInfoService;
+ @Autowired
+ private AdminUserService adminUserService;
+
+ /**
+ * type:h5、jsapi、app、native、sub_jsapi
+ * @param type
+ * @return
+ */
+
+ @GetMapping("/prepayment")
+ public Map transactions(String type,Long orderId) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException, IOException {
+ LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
+ AdminUserDO user = adminUserService.getUser(loginUser.getId());
+ OrderInfo orderInfo = orderInfoService.getById(orderId);
+ // 统一参数封装
+ Map params = new HashMap<>(8);
+ params.put("appid", wechatPayConfig.getJcAppId());
+ params.put("mchid", wechatPayConfig.getMchId());
+ params.put("description", orderInfo.getGoodsTitle());
+ params.put("out_trade_no", orderInfo.getOrderNo());
+ params.put("notify_url", wechatPayConfig.getNotifyUrl());
+ Map amountMap = new HashMap<>(4);
+ // 金额单位为分
+ amountMap.put("total", orderInfo.getPayMoney());
+ //人民币
+ amountMap.put("currency", "CNY");
+ params.put("amount", amountMap);
+
+ // 场景信息
+ Map sceneInfoMap = new HashMap<>(4);
+ // 客户端IP
+ sceneInfoMap.put("payer_client_ip", "127.0.0.1");
+ // 商户端设备号(门店号或收银设备ID)
+ sceneInfoMap.put("device_id", "127.0.0.1");
+ // 除H5与JSAPI有特殊参数外,其他的支付方式都一样
+ if (type.equals(WechatPayUrlEnum.H5.getType())) {
+ Map h5InfoMap = new HashMap<>(4);
+ // 场景类型:iOS, Android, Wap
+ h5InfoMap.put("type", "IOS");
+ sceneInfoMap.put("h5_info", h5InfoMap);
+ } else if (type.equals(WechatPayUrlEnum.JSAPI.getType()) || type.equals(WechatPayUrlEnum.SUB_JSAPI.getType())) {
+ Map payerMap = new HashMap<>(4);
+ payerMap.put("openid", user.getOpenId());
+ params.put("payer", payerMap);
+ }
+ params.put("scene_info", sceneInfoMap);
+ String paramsStr = JSON.toJSONString(params);
+
+ String resStr = wechatPayRequest.wechatHttpPost("https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi",paramsStr);
+ Map resMap = JSONObject.parseObject(resStr);
+ Map signMap = paySignMsg(resMap.get("prepay_id").toString(), wechatPayConfig.getAppId(),null);
+ return signMap;
+ }
+
+ /**
+ * type:h5、jsapi、app、native、sub_jsapi
+ * @param type
+ * @return
+ */
+
+ @GetMapping("/jcPrepayment2")
+ public Map jcPrepayment2(String type,Long orderId) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException, IOException {
+ LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
+ AdminUserDO user = adminUserService.getUser(loginUser.getId());
+ OrderInfo orderInfo = orderInfoService.getById(orderId);
+ // 统一参数封装
+ Map params = new HashMap<>(8);
+ params.put("appid", wechatPayConfig.getJcAppId());
+ params.put("mchid", wechatPayConfig.getMchId());
+ params.put("description", orderInfo.getGoodsTitle());
+ params.put("out_trade_no", orderInfo.getOrderNo());
+ params.put("notify_url", wechatPayConfig.getNotifyUrl());
+ Map amountMap = new HashMap<>(4);
+ // 金额单位为分
+ amountMap.put("total", orderInfo.getPayMoney());
+ //人民币
+ amountMap.put("currency", "CNY");
+ params.put("amount", amountMap);
+
+ // 场景信息
+ Map sceneInfoMap = new HashMap<>(4);
+ // 客户端IP
+ sceneInfoMap.put("payer_client_ip", "127.0.0.1");
+ // 商户端设备号(门店号或收银设备ID)
+ sceneInfoMap.put("device_id", "127.0.0.1");
+ // 除H5与JSAPI有特殊参数外,其他的支付方式都一样
+ if (type.equals(WechatPayUrlEnum.H5.getType())) {
+ Map h5InfoMap = new HashMap<>(4);
+ // 场景类型:iOS, Android, Wap
+ h5InfoMap.put("type", "IOS");
+ sceneInfoMap.put("h5_info", h5InfoMap);
+ } else if (type.equals(WechatPayUrlEnum.JSAPI.getType()) || type.equals(WechatPayUrlEnum.SUB_JSAPI.getType())) {
+ Map payerMap = new HashMap<>(4);
+ payerMap.put("openid", user.getJcOpenId());
+ params.put("payer", payerMap);
+ }
+ params.put("scene_info", sceneInfoMap);
+ String paramsStr = JSON.toJSONString(params);
+
+ String resStr = wechatPayRequest.wechatHttpPost("https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi",paramsStr);
+ Map resMap = JSONObject.parseObject(resStr);
+ Map signMap = paySignMsg(resMap.get("prepay_id").toString(), wechatPayConfig.getAppId(),null);
+ return signMap;
+ }
+
+ /**
+ * type:h5、jsapi、app、native、sub_jsapi
+ * @param type
+ * @return
+ */
+
+ @GetMapping("/jcPrepayment")
+ public Map jcPrepayment(String type,Long orderId) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException, IOException {
+
+ LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
+ AdminUserDO user = adminUserService.getUser(loginUser.getId());
+ OrderInfo orderInfo = orderInfoService.getById(orderId);
+ LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>();
+ queryWrapper.eq(PartnerBankInfo::getPartnerId,orderInfo.getPartnerId());
+ PartnerBankInfo bankInfo = partnerBankInfoService.getOne(queryWrapper);
+
+ String prepayId = this.toGetPayInfo(wechatPayConfig.getJcAppId(), bankInfo.getMchId(), bankInfo.getApiclientKey(), orderInfo.getPayMoney().intValue()
+ , user.getJcOpenId(), bankInfo.getSerialNo(), bankInfo.getApiV3Key(), orderInfo.getGoodsTitle(),
+ wechatPayConfig.getNotifyUrl(), orderInfo.getOrderNo());
+ Map resMap = paySignMsg(prepayId, wechatPayConfig.getAppId(),bankInfo.getApiclientKey());
+ return resMap;
+ }
+ private Map paySignMsg(String prepayId,String appId,String privateKeyStr) throws IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException {
+ long timeMillis = System.currentTimeMillis();
+ String timeStamp = timeMillis/1000+"";
+ String nonceStr = timeMillis+"";
+ String packageStr = "prepay_id="+prepayId;
+ // 公共参数
+ Map resMap = new HashMap<>();
+ resMap.put("nonceStr",nonceStr);
+ resMap.put("timeStamp",timeStamp);
+ resMap.put("appId",appId);
+ resMap.put("package", packageStr);
+ // 使用字段appId、timeStamp、nonceStr、package进行签名
+ //从下往上依次生成
+ String message = buildMessage(appId, timeStamp, nonceStr, packageStr);
+ //签名
+ String paySign = sign(message.getBytes("utf-8"), privateKeyStr);
+ resMap.put("paySign", paySign);
+ resMap.put("signType", "RSA");
+ return resMap;
+ }
+
+
+ String sign(byte[] message,String privateKeyStr) throws NoSuchAlgorithmException, SignatureException, IOException, InvalidKeyException {
+ //签名方式
+ Signature sign = Signature.getInstance("SHA256withRSA");
+ //私钥,通过MyPrivateKey来获取,这是个静态类可以接调用方法 ,需要的是_key.pem文件的绝对路径配上文件名
+ PrivateKey privateKey =null;
+ if (StringUtils.isNotEmpty(privateKeyStr)){
+ privateKey = PemUtil.loadPrivateKey(privateKeyStr);
+ }else {
+ privateKey = wechatPayConfig.getPrivateKey(wechatPayConfig.getKeyPemPath());
+ }
+
+ sign.initSign(privateKey);
+ sign.update(message);
+ return Base64.getEncoder().encodeToString(sign.sign());
+ }
+
+ /**
+ * 按照前端签名文档规范进行排序,\n是换行
+ * @param timestamp
+ * @param nonceStr
+ * @param prepay_id
+ * @return
+ */
+ String buildMessage(String appId, String timestamp,String nonceStr,String prepay_id) {
+
+ return appId + "\n"
+ + timestamp + "\n"
+ + nonceStr + "\n"
+ + prepay_id + "\n";
+ }
+
+
+ public String toGetPayInfo(String appId, String merchantId,String privateKey,Integer total,String openId,
+ String merchantSerialNumber,String apiV3Key,String title,String notifyUrl,String orderNo){
+ Config config =
+ new RSAAutoCertificateConfig.Builder()
+ .merchantId(merchantId)
+ .privateKey(privateKey)
+ .merchantSerialNumber(merchantSerialNumber)
+ .apiV3Key(apiV3Key)
+ .build();
+ // 构建service
+ JsapiService service = new JsapiService.Builder().config(config).build();
+ // request.setXxx(val)设置所需参数,具体参数可见Request定义
+ PrepayRequest request = new PrepayRequest();
+ Amount amount = new Amount();
+ amount.setTotal(total);
+ amount.setCurrency("CNY");
+
+ request.setAmount(amount);
+ request.setAppid(appId);
+ request.setMchid(merchantId);
+ request.setDescription(title);
+ request.setNotifyUrl(notifyUrl);
+ request.setOutTradeNo(orderNo);
+ Payer payer =new Payer();
+ payer.setOpenid(openId);
+ request.setPayer(payer);
+ SettleInfo settleInfo =new SettleInfo();
+ settleInfo.setProfitSharing(true);
+ request.setSettleInfo(settleInfo);
+ // 调用下单方法,得到应答
+ PrepayResponse response = service.prepay(request);
+ return response.getPrepayId();
+ }
+
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java
index fa1baaa0..ddedb438 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java
@@ -66,13 +66,13 @@ public class OrderInfo {
//创建时间
private Date createTime;
//创建人id
- private Long createBy;
+ private Long creator;
//创建人所在部门
private Long deptId;
//更新时间
private Date updateTime;
//更新人id
- private Integer updateBy;
+ private Integer updater;
//积分充值的金额
@TableField(exist = false)
private Long balanceCz;
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/mapper/OrderInfoMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/mapper/OrderInfoMapper.java
index a77f2b25..45067268 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/mapper/OrderInfoMapper.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/mapper/OrderInfoMapper.java
@@ -2,8 +2,10 @@ package cn.iocoder.yudao.module.payment.mapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
+import cn.iocoder.yudao.module.payment.entity.commentVo;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -37,5 +39,15 @@ public interface OrderInfoMapper extends BaseMapper {
List governmentInspectionList(@Param("carNum")String carNum, @Param("status")String status, @Param("partnerId")String partnerId);
+ List orderList(@Param("userId") Long userId, @Param("status") String status,@Param("title") String title);
+
+ List validationListWx(Page page,@Param("validationUserId") Long validationUserId);
+ List validationListPc(Page page,Long partnerId);
+
+ Integer getNoCommentOrder(@Param("userId") Long userId);
+
+ List getCommentOrderList(@Param("partnerId") Long partnerId);
+
+ List orderListPc(OrderInfo orderInfo);
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/OrderInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/OrderInfoService.java
index 3aedf8a5..f51c33f6 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/OrderInfoService.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/OrderInfoService.java
@@ -3,6 +3,9 @@ package cn.iocoder.yudao.module.payment.service;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
+import cn.iocoder.yudao.module.payment.entity.commentVo;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@@ -22,5 +25,32 @@ public interface OrderInfoService extends IService {
List delworkOrder(Long partnerId,String carNum,String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime);
List orderListSystem(OrderInfo orderInfo);
+ Long createOrder(OrderInfo orderInfo) throws Exception;
+ JSONObject pickCarDetail(Long pickCarId);
+
+ JSONObject orderDetail(Long goodsId,String type,String title,Integer amount);
+
+ void cancelPay(Long orderId);
+
+ List orderList(String status,String title);
+
+ String validation(String accessCode);
+
+ OrderInfo getOrderByAccessCode(String accessCode);
+
+ String validationMall(String accessCode);
+
+ List validationListWx(Page page);
+
+ List validationListPc(Page page);
+
+ Integer commentOrder(OrderInfo orderInfo);
+
+ Integer getNoCommentOrder();
+
+ List getCommentOrderList(Long partnerId);
+
+ List orderListPc(OrderInfo orderInfo);
+
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java
index 2466d607..09d41d6e 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java
@@ -3,21 +3,39 @@ package cn.iocoder.yudao.module.payment.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
-import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
-import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
-import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService;
+import cn.iocoder.yudao.module.inspection.entity.*;
+import cn.iocoder.yudao.module.inspection.service.*;
+import cn.iocoder.yudao.module.partner.entity.PartnerWorker;
+import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
import cn.iocoder.yudao.module.payment.entity.OrderInfoDetail;
+import cn.iocoder.yudao.module.payment.entity.commentVo;
import cn.iocoder.yudao.module.payment.mapper.OrderInfoMapper;
import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService;
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
-import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
+import cn.iocoder.yudao.module.shop.entity.*;
+import cn.iocoder.yudao.module.shop.service.*;
+import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
+import cn.iocoder.yudao.module.system.service.permission.PermissionService;
+import cn.iocoder.yudao.module.system.service.permission.RoleService;
+import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.StringUtils;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
import java.util.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.stream.Collectors;
/**
* (OrderInfo)表服务实现类
@@ -33,7 +51,32 @@ public class OrderInfoServiceImpl extends ServiceImpl 0) {
+ if (ObjectUtil.isEmpty(shopUserBalance) || ObjectUtil.isEmpty(shopUserBalance.getBalance())) {
+ throw new Exception("积分不足!");
+ }
+ if (orderInfo.getBalance() > shopUserBalance.getBalance()) {
+ throw new Exception("积分不足!");
+ }
+ }
+ if ((orderInfo.getGoodsType().equals("qxmd") || orderInfo.getGoodsType().equals("jymd")) && orderInfo.getMdAmount() <= 0) {
+ throw new Exception("请输入买单金额!");
+ }
+
+ if (StringUtils.isNotEmpty(orderInfo.getPayType())&&orderInfo.getPayType().equals("sz")){
+ Set userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
+ List roleList = roleService.getRoleList(userRoleIdListByUserId);
+ boolean flag = false;
+ for (RoleDO role : roleList) {
+ if (role.getCode().equals("jcdb")) {
+ flag = true;
+ break;
+ }
+ }
+ if (!flag){
+ throw new Exception("您不是代办 请不要选择赊账!");
+ }
+ }
+ //优惠卷的积分
+ Long couponAmount = 0L;
+ String isCoupon = "0";
+ ShopCoupon shopCoupon = null;
+ if (null != orderInfo.getCouponId()) {
+ //判断当前用户是否拥有此优惠卷
+ shopCoupon = shopCouponService.selectShopCouponByCouponId(orderInfo.getCouponId());
+ if (!ObjectUtil.isEmpty(shopCoupon)) {
+ Lock lock = new ReentrantLock();
+ lock.lock();
+ try {
+ if (!shopCoupon.getCouponStatus().equals("0") || !shopCoupon.getUserId().equals(user.getId())) {
+ throw new Exception("优惠卷不存在");
+ }
+ //判断是否过期
+ boolean flag = shopCoupon.getStartTime().before(new Date()) && shopCoupon.getExpirationTime().after(new Date());
+ if (!flag) {
+ throw new Exception("优惠卷不在使用期限内");
+ }
+ //判断模块是否正确
+ if (shopCoupon.getCouponType().equals("cash")) {
+ //现金卷
+ if (shopCoupon.getBindMoudle().equals("检测项目现金券") && !orderInfo.getGoodsType().equals("jc")) {
+ throw new Exception("优惠卷不正确");
+ }
+ if (shopCoupon.getBindMoudle().equals("维修项目现金券") && !(orderInfo.getGoodsType().equals("qx") || orderInfo.getGoodsType().equals("qxmd"))) {
+ throw new Exception("优惠卷不正确");
+ }
+
+ }
+ //如果是抵扣券
+ if (shopCoupon.getCouponType().equals("offset")) {
+ //抵扣券 判断商品id是否正确
+ if (!shopCoupon.getBindGoodsIds().contains(orderInfo.getGoodsId().toString())) {
+ throw new Exception("优惠卷不匹配");
+ }
+ }
+ //冻结住优惠卷
+ shopCoupon.setCouponStatus("3");
+ shopCouponService.updateShopCoupon(shopCoupon);
+ couponAmount = shopCoupon.getDiscount();
+ isCoupon = "1";
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ }
+ JSONObject goods = this.getGoodsInfo(orderInfo);
+ if (ObjectUtil.isNotEmpty(shopCoupon) && StringUtils.isNotEmpty(shopCoupon.getCouponType()) && shopCoupon.getCouponType().equals("offset")) {
+ //如果是抵消卷 则匹配当前商品的价格
+ couponAmount = goods.getLong("payMoney");
+ }
+ OrderInfo createOrder = new OrderInfo();
+ createOrder.setOrderNo((orderInfo.getGoodsType().equals("qxmd") || orderInfo.getGoodsType().equals("jymd") ? orderInfo.getGoodsType() : goods.getString("goodsId")) + "-" + System.currentTimeMillis() + "-" + getRandomString6());
+ createOrder.setGoodsId(goods.getLong("goodsId"));
+ createOrder.setGoodsTitle(goods.getString("goodsName"));
+ createOrder.setGoodsType(orderInfo.getGoodsType());
+ createOrder.setSkuId(goods.getLong("skuId"));
+ createOrder.setSkuName(goods.getString("skuName"));
+ createOrder.setPartnerId(goods.getLong("partnerId"));
+ createOrder.setPartnerName(goods.getString("partnerName"));
+ createOrder.setRealName(user.getNickname());
+ createOrder.setPhonenumber(user.getMobile());
+ createOrder.setCreator(user.getId());
+ createOrder.setDeptId(user.getDeptId());
+ createOrder.setReduceMoney(goods.getLong("reduceMoney"));
+ //待支付
+ createOrder.setOrderStatus("0");
+ createOrder.setGoodsPrice(goods.getLongValue("goodsPrice"));
+ createOrder.setPayMoney(goods.getLong("payMoney") - orderInfo.getBalance() - couponAmount);
+ createOrder.setBalance(orderInfo.getBalance());
+ createOrder.setOrderTime(new Date());
+ createOrder.setUserId(user.getId());
+ createOrder.setIsCoupon(isCoupon);
+ createOrder.setUserCarId(orderInfo.getUserCarId());
+ createOrder.setOtherPhone(orderInfo.getOtherPhone());
+ createOrder.setDriverLicenesImg(orderInfo.getDriverLicenesImg());
+ createOrder.setIsPayOnline(orderInfo.getIsPayOnline());
+ createOrder.setIsPickCar(orderInfo.getIsPickCar());
+
+ if (isCoupon.equals("1")) {
+ createOrder.setCouponId(orderInfo.getCouponId());
+ }
+ this.save(createOrder);
+ //追加订单明细记录
+ OrderInfoDetail detail =new OrderInfoDetail(createOrder.getId(),"创建订单",new Date(),0L,"0");
+ orderInfoDetailService.save(detail);
+ if (ObjectUtil.isNotEmpty(orderInfo.getAppointmentId())){
+ //处理预约记录
+ orderInfo.setId(createOrder.getId());
+ this.dealAppointment(orderInfo);
+
+ }
+ if (ObjectUtil.isNotEmpty(orderInfo.getPickCarId())){
+ //处理上门取车服务
+ orderInfo.setId(createOrder.getId());
+ this.dealPickCar(orderInfo);
+
+ }
+ if (goods.getLong("payMoney") - couponAmount - orderInfo.getBalance() <= 0) {
+ Long userBalance = (goods.getLong("payMoney") - couponAmount) > 0 ? goods.getLong("payMoney") - couponAmount : 0L;
+ //公共订单处理
+ createOrder.setPayMoney(0L);
+ createOrder.setBalance(userBalance);
+ if (isCoupon.equals("1")) {
+ //如果使用优惠卷
+ //核销掉优惠卷
+ shopCoupon.setCouponStatus("1");
+ shopCoupon.setOrderId(createOrder.getId());
+ shopCoupon.setUseTime(new Date());
+ shopCouponService.updateShopCoupon(shopCoupon);
+ createOrder.setCouponId(shopCoupon.getCouponId());
+ createOrder.setCouponDiscount(shopCoupon.getDiscount() > goods.getLong("payMoney") ? goods.getLong("payMoney") : shopCoupon.getDiscount());
+
+ }
+ if (userBalance > 0) {
+ //扣除积分
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("goodsType", orderInfo.getGoodsType());
+ jsonObject.put("goodsTitle", orderInfo.getGoodsTitle());
+ userBalanceService.subtractBalance(userBalance, user.getId(), jsonObject);
+ }
+ // 生成16位核销码
+ UUID uuid = UUID.randomUUID();
+ long mostSignificantBits = uuid.getMostSignificantBits();
+ long leastSignificantBits = uuid.getLeastSignificantBits();
+ String combinedBits = mostSignificantBits + String.valueOf(leastSignificantBits);
+ String shortUuid = combinedBits.substring(combinedBits.length() - 16);
+ createOrder.setAccessCode(shortUuid);
+ createOrder.setOrderStatus("1");
+ createOrder.setPayTime(new Date());
+ //支付方式为余额支付
+ createOrder.setPayType("balance");
+ this.updateById(createOrder);
+ //追加订单明细记录
+ orderInfoDetailService.save(new OrderInfoDetail(createOrder.getId(),"支付成功",new Date(),createOrder.getPayMoney(),"0"));
+ //店铺销量+1
+ if (goods.getLong("partnerId") != null) {
+ partnerService.addSalesNum(goods.getLong("partnerId"));
+ }
+ return 11111111L;
+
+ } else if (StringUtils.isNotEmpty(createOrder.getPayType())&&createOrder.getPayType().equals("sz")){
+ //赊账的情况
+ //支付方式为余额支付
+ createOrder.setPayType("sz");
+ // 生成16位核销码
+ UUID uuid = UUID.randomUUID();
+ long mostSignificantBits = uuid.getMostSignificantBits();
+ long leastSignificantBits = uuid.getLeastSignificantBits();
+ String combinedBits = mostSignificantBits + String.valueOf(leastSignificantBits);
+ String shortUuid = combinedBits.substring(combinedBits.length() - 16);
+ createOrder.setAccessCode(shortUuid);
+ this.updateById(createOrder);
+ return 11111111L;
+ } else {
+ //支付方式为余额支付
+ createOrder.setPayType("wx");
+ if (isCoupon.equals("1")) {
+ //如果使用优惠卷
+ createOrder.setCouponId(shopCoupon.getCouponId());
+ createOrder.setCouponDiscount(shopCoupon.getDiscount());
+ }
+ this.updateById(createOrder);
+ //冻结积分
+ userBalanceService.frozenBalance(orderInfo.getBalance(), user.getId());
+ }
+ return createOrder.getId();
+ }
+
+ //获取商品信息
+ private JSONObject getGoodsInfo(OrderInfo orderInfo) throws Exception {
+ JSONObject res = new JSONObject();
+ Long userId = SecurityFrameworkUtils.getLoginUserId();
+ AdminUserDO sysUser = userService.getUser(userId);
+ Integer userLevel = sysUser.getUserLevel();
+ res.put("skuId", null);
+ res.put("skuName", "");
+ res.put("partnerId", null);
+ res.put("partnerName", "");
+ Long reduceMoney = 0l;
+ if (orderInfo.getGoodsType().equals("jc")) {
+ Long priceFen = 0L;
+ ShopInspectionGoods shopInspectionGoods = new ShopInspectionGoods();
+ if (ObjectUtil.isNotEmpty(orderInfo.getSkuId())) {
+ Set userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(sysUser.getId());
+ List roleList = roleService.getRoleList(userRoleIdListByUserId);
+ List roleKeys = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
+ //汽车检测
+ //规格处理
+ InspectionGoodsSku skuInfo = skuService.getById(orderInfo.getSkuId());
+ shopInspectionGoods = iShopInspectionService.selectShopInspectionGoodsById(Long.parseLong(skuInfo.getGoodsId().toString()));
+ if (ObjectUtil.isEmpty(shopInspectionGoods)) {
+ throw new Exception("商品不存在");
+ }
+ ShopMallPartners partners = partnerService.getById(shopInspectionGoods.getPartnerId());
+ if (ObjectUtil.isEmpty(partners)) {
+ throw new Exception("店铺不存在");
+ }
+ res.put("goodsId", skuInfo.getGoodsId());
+ res.put("goodsName", shopInspectionGoods.getTitle());
+ res.put("partnerId", shopInspectionGoods.getPartnerId());
+ res.put("partnerName", partners.getPartnerName());
+
+ //商品原价
+ res.put("goodsPrice", skuInfo.getPrice());
+ res.put("skuId", skuInfo.getId());
+ res.put("skuName", skuInfo.getSkuName());
+ priceFen = skuInfo.getPrice();
+ try {
+ if (roleKeys.contains("jcdb")){
+ //先判断是否为代办
+ priceFen=skuInfo.getDbPrice();
+ }else if (roleKeys.contains("jcdwgly")){
+ //单位管理员
+ priceFen=skuInfo.getDwPrice();
+ }else if (roleKeys.contains("jcworker")||roleKeys.contains("jcshop")){
+ //检测工人
+ //判断是否为当前店铺的工人
+ LambdaQueryWrapper queryWrapper1 =new LambdaQueryWrapper<>();
+ queryWrapper1.eq(PartnerWorker::getUserId,userId).eq(PartnerWorker::getPartnerId,shopInspectionGoods.getPartnerId()).last("limit 1");
+ PartnerWorker one = workerService.getOne(queryWrapper1);
+ if (ObjectUtils.isNotEmpty(one)){
+ priceFen=skuInfo.getYgPrice();
+ }
+ }
+
+ }catch (Exception e){
+ log.error(e.getMessage());
+ }
+ } else {
+ //汽车检测
+ shopInspectionGoods = iShopInspectionService.selectShopInspectionGoodsById(orderInfo.getGoodsId());
+ priceFen = shopInspectionGoods.getPrice();
+ if (ObjectUtil.isEmpty(shopInspectionGoods)) {
+ throw new Exception("商品不存在");
+ }
+ ShopMallPartners partners = partnerService.getById(shopInspectionGoods.getPartnerId());
+ if (ObjectUtil.isEmpty(partners)) {
+ throw new Exception("店铺不存在");
+ }
+ res.put("goodsId", orderInfo.getGoodsId());
+ res.put("goodsName", shopInspectionGoods.getTitle());
+ res.put("partnerId", shopInspectionGoods.getPartnerId());
+ res.put("partnerName", partners.getPartnerName());
+ //商品
+ res.put("goodsPrice", shopInspectionGoods.getPrice());
+ }
+ //根据计算得到的实付金额
+ ShopConfig shopConfig = configService.selectShopConfigById(1L);
+ //原价单位分
+
+ Double priceYuan = priceFen.doubleValue() / 100d;
+ Long realPrice = 0L;
+ if (StringUtils.isEmpty(shopInspectionGoods.getIsAttend()) || shopInspectionGoods.getIsAttend().equals("0") || shopInspectionGoods.getIsSpecial() == 1 || ObjectUtils.isEmpty(userLevel) || 0 == userLevel) {
+ //直接计算原价
+ realPrice = priceFen;
+ }
+ else if (userLevel == 1) {
+ //白银会员
+ //获取会员的优惠折扣
+ BigDecimal inspectionPlatinum = shopConfig.getInspectionSilver();
+ Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
+ Double realPriceTemp = BigDecimal.valueOf(priceYuan * ratio).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
+ realPrice = realPriceTemp.longValue();
+
+ } else if (userLevel == 2) {
+ //黄金会员
+ BigDecimal inspectionPlatinum = shopConfig.getInspectionGold();
+ Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
+ Double realPriceTemp = BigDecimal.valueOf(priceYuan * ratio).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
+ realPrice = realPriceTemp.longValue();
+ } else if (userLevel == 3) {
+ //白金会员
+ BigDecimal inspectionPlatinum = shopConfig.getInspectionPlatinum();
+ Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
+ Double realPriceTemp = BigDecimal.valueOf(priceYuan * ratio).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
+ realPrice = realPriceTemp.longValue();
+ }
+ reduceMoney = priceFen - realPrice;
+ //追加汽车上门取车服务费用
+ if (ObjectUtil.isNotEmpty(orderInfo.getPickCarId())){
+ JSONObject jsonObject = pickCarDetail(orderInfo.getPickCarId());
+ realPrice = realPrice +jsonObject.getLong("pickCarPrice");
+ }
+ res.put("payMoney", realPrice);
+ } else if (orderInfo.getGoodsType().equals("qx")) {
+ //汽车维修
+ ShopRepairGoods repairGoods = repairGoodsService.selectShopRepairGoodsById(orderInfo.getGoodsId());
+ if (ObjectUtil.isEmpty(repairGoods)) {
+ throw new Exception("商品不存在");
+ }
+ res.put("goodsId", orderInfo.getGoodsId());
+ res.put("goodsName", repairGoods.getTitle());
+ //商品原价
+ res.put("goodsPrice", repairGoods.getPrice());
+ //根据计算得到的实付金额
+ ShopConfig shopConfig = configService.selectShopConfigById(1L);
+ //原价单位分
+ Long priceFen = repairGoods.getPrice();
+ Double priceYuan = priceFen.doubleValue() / 100d;
+ Long realPrice = 0L;
+ if (repairGoods.getIsSpecial() == 1 || ObjectUtils.isEmpty(userLevel) || 0 == userLevel) {
+ //直接计算原价
+ realPrice = priceFen;
+ } else if (userLevel == 1) {
+ //白银会员
+ //获取会员的优惠折扣
+ BigDecimal inspectionPlatinum = shopConfig.getInspectionSilver();
+ Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
+ Double realPriceTemp = BigDecimal.valueOf(priceYuan * ratio).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
+ realPrice = realPriceTemp.longValue();
+
+ } else if (userLevel == 2) {
+ //黄金会员
+ BigDecimal inspectionPlatinum = shopConfig.getInspectionGold();
+ Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
+ Double realPriceTemp = BigDecimal.valueOf(priceYuan * ratio).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
+ realPrice = realPriceTemp.longValue();
+ } else if (userLevel == 3) {
+ //白金会员
+ BigDecimal inspectionPlatinum = shopConfig.getInspectionPlatinum();
+ Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
+ Double realPriceTemp = BigDecimal.valueOf(priceYuan * ratio).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
+ realPrice = realPriceTemp.longValue();
+ }
+ res.put("payMoney", realPrice);
+ reduceMoney = priceFen - realPrice;
+ } else if (orderInfo.getGoodsType().equals("cz")) {
+ //积分充值
+ res.put("goodsId", orderInfo.getGoodsId());
+ res.put("goodsName", "积分充值");
+ //商品原价
+ res.put("goodsPrice", orderInfo.getBalanceCz());
+ res.put("payMoney", orderInfo.getBalanceCz());
+ } else if (orderInfo.getGoodsType().equals("qxmd")) {
+ //买单功能
+ //原价单位分
+ Long priceFen = orderInfo.getMdAmount();
+ Long realPrice = 0L;
+ //直接计算原价
+ realPrice = priceFen;
+ res.put("goodsId", null);
+ res.put("goodsName", orderInfo.getGoodsTitle());
+ //商品原价
+ res.put("goodsPrice", orderInfo.getMdAmount());
+ res.put("payMoney", realPrice);
+ reduceMoney = priceFen - realPrice;
+ } else if (orderInfo.getGoodsType().equals("jymd")) {
+ //买单功能
+ //原价单位分
+ Long priceFen = orderInfo.getMdAmount();
+ Long realPrice = 0L;
+ //直接计算原价
+ realPrice = priceFen;
+ res.put("goodsId", null);
+ res.put("goodsName", orderInfo.getGoodsTitle());
+ //商品原价
+ res.put("goodsPrice", orderInfo.getMdAmount());
+ res.put("payMoney", realPrice);
+ reduceMoney = priceFen - realPrice;
+ }
+ //会员折扣的金额
+ res.put("reduceMoney", reduceMoney);
+ return res;
+ }
+
+ /**
+ * 6位随机数
+ *
+ * @return
+ */
+ public static String getRandomString6() {
+ String str = "abcdefghijklmnopqrstuvwxyz0123456789";
+ Random random = new Random();
+ StringBuilder buff = new StringBuilder();
+ for (int i = 0; i < 6; ++i) {
+ int number = random.nextInt(str.length());
+ buff.append(str.charAt(number));
+ }
+ return buff.toString();
+ }
+
+ private void dealAppointment(OrderInfo orderInfo){
+ if (orderInfo.getGoodsType().equals("jc")){
+ InspectionAppointment appointment = appointmentService.getById(orderInfo.getAppointmentId());
+ appointment.setOrderId(orderInfo.getId());
+ appointmentService.updateById(appointment);
+// //处理短信
+// String[] phones ={"18715738382","18715738835","18162987866"};
+//
+// try {
+// String carNum ="未知车牌号";
+// //开始检测短信发送
+// Long carId = orderInfo.getUserCarId();
+// if (ObjectUtil.isNotEmpty(carId)){
+// ShopUserCar userCar = userCarService.getById(carId);
+// carNum = userCar.getCarNo();
+// }
+// for (String phone : phones) {
+// if (PhoneValidator.isValid(phone)){
+// SendSmsUtil.sendMsgCommon(new String[]{carNum,appointment.getAppointmentDay()+(appointment.getAppointmentPeriod().equals("0")?"上午":"下午")},phone,"1400852709","机动车管家小程序","1962738");
+// }
+// }
+// }catch (Exception ignored){
+// log.error(ignored.getMessage());
+// }
+
+ }
+ }
+ private void dealPickCar(OrderInfo orderInfo){
+ if (orderInfo.getGoodsType().equals("jc")){
+ InspectionPickCar pickCarInfo = pickCarService.getById(orderInfo.getPickCarId());
+ pickCarInfo.setOrderId(orderInfo.getId());
+ pickCarService.updateById(pickCarInfo);
+ //追加订单明细记录
+ orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(),"上门取车费用",new Date(),pickCarInfo.getNeedPrice(),"1"));
+
+ }
+ }
+ @Override
+ public JSONObject pickCarDetail(Long pickCarId) {
+ JSONObject res =new JSONObject();
+ InspectionPickCar pickCar = pickCarService.getById(pickCarId);
+ res.put("pickCarPrice",Optional.ofNullable(pickCar.getNeedPrice()).orElse(0L));
+ return res;
+ }
+
+ @Override
+ public JSONObject orderDetail(Long goodsId, String type, String title, Integer amount) {
+ JSONObject res = new JSONObject();
+ //获取当前登录用户
+ LoginUser user = SecurityFrameworkUtils.getLoginUser();
+ AdminUserDO sysUser = userService.getUser(user.getId());
+ Integer userLevel = sysUser.getUserLevel();
+ ShopConfig shopConfig = configService.selectShopConfigById(1L);
+ UserBalance shopUserBalance = userBalanceService.selectShopUserBalanceByUserId(user.getId());
+ res.put("balance", Optional.ofNullable(shopUserBalance).orElse(new UserBalance()).getBalance());
+ res.put("userLevel", userLevel);
+ if (type.equals("jc")) {
+ ShopInspectionGoods shopInspectionGoods = iShopInspectionService.selectShopInspectionGoodsById(goodsId);
+ res.put("goodsName", shopInspectionGoods.getTitle());
+ res.put("goodsImage", shopInspectionGoods.getImage());
+ res.put("goodsPrice", shopInspectionGoods.getPrice());
+ res.put("isSpecial", shopInspectionGoods.getIsSpecial());
+ res.put("silver", shopConfig.getInspectionSilver());
+ res.put("gold", shopConfig.getInspectionGold());
+ res.put("platinum", shopConfig.getInspectionPlatinum());
+ } else if (type.equals("qx")) {
+ ShopRepairGoods shopInspectionGoods = repairGoodsService.selectShopRepairGoodsById(goodsId);
+ res.put("goodsName", shopInspectionGoods.getTitle());
+ res.put("goodsImage", shopInspectionGoods.getImage());
+ res.put("goodsPrice", shopInspectionGoods.getPrice());
+ res.put("isSpecial", shopInspectionGoods.getIsSpecial());
+ res.put("silver", shopConfig.getInspectionSilver());
+ res.put("gold", shopConfig.getInspectionGold());
+ res.put("platinum", shopConfig.getInspectionPlatinum());
+ } else if (type.equals("qxmd")) {
+ res.put("goodsName", title);
+ res.put("goodsImage", "http://www.nuoyunr.com/lananRsc/mdqx.png");
+ res.put("goodsPrice", amount);
+ res.put("isSpecial", "1");
+ res.put("silver", 10);
+ res.put("gold", 10);
+ res.put("platinum", 10);
+ } else if (type.equals("jymd")) {
+ res.put("goodsName", title);
+ res.put("goodsImage", "http://www.nuoyunr.com/lanan/mdqx.png");
+ res.put("goodsPrice", amount);
+ res.put("isSpecial", "1");
+ }
+ return res;
+ }
+
+ @Override
+ public void cancelPay(Long orderId) {
+ LoginUser user = SecurityFrameworkUtils.getLoginUser();
+ OrderInfo info = this.getById(orderId);
+ if (ObjectUtil.isNotEmpty(info.getBalance()) && info.getBalance() > 0) {
+ //打开相应的冻结积分
+ userBalanceService.thawBalance(info.getBalance(), user.getId());
+ }
+ if (!ObjectUtil.isEmpty(info.getIsCoupon()) && info.getIsCoupon().equals("1")) {
+ //打开相应的冻结优惠卷
+ ShopCoupon shopCoupon = shopCouponService.selectShopCouponByCouponId(info.getCouponId());
+ //处理优惠卷
+ shopCoupon.setCouponStatus("0");
+ shopCouponService.updateShopCoupon(shopCoupon);
+ }
+ LambdaUpdateWrapper queryWrapper =new LambdaUpdateWrapper<>();
+ queryWrapper.set(InspectionAppointment::getOrderId,null).eq(InspectionAppointment::getOrderId,orderId);
+ appointmentService.update(queryWrapper);
+
+ }
+
+ @Override
+ public List orderList(String status, String title) {
+ LoginUser user = SecurityFrameworkUtils.getLoginUser();
+
+ return baseMapper.orderList(user.getId(), status, title);
+ }
+
+ /**
+ * 核销功能
+ *
+ * @param accessCode
+ * @return
+ */
+ @Override
+ public String validation(String accessCode) {
+ if (accessCode == null || accessCode.length() != 16) {
+ return "核销码有误";
+ }
+ LoginUser sysUser = SecurityFrameworkUtils.getLoginUser();
+ AdminUserDO user = userService.getUser(sysUser.getId());
+ Set userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(sysUser.getId());
+ List roleList = roleService.getRoleList(userRoleIdListByUserId);
+ boolean isInsider = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList()).contains("insider");
+
+ if (!isInsider) {
+ return "非公司员工禁止使用";
+ }
+
+ OrderInfo orderInfo = getOrderByAccessCode(accessCode);
+ if (orderInfo != null && "1".equals(orderInfo.getOrderStatus())) {
+ orderInfo.setOrderStatus("2");
+ orderInfo.setValidationUserId(sysUser.getId());
+ orderInfo.setValidationRealName(user.getNickname());
+ orderInfo.setValidationTime(new Date());
+ int result = baseMapper.updateById(orderInfo);
+ String message = (result > 0) ? "核销成功" : "核销失败";
+ return message;
+ } else {
+ return "无此核销码或该订单已核销";
+ }
+ }
+
+ @Override
+ public OrderInfo getOrderByAccessCode(String accessCode) {
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(OrderInfo::getAccessCode, accessCode);
+ OrderInfo one = this.getOne(queryWrapper);
+ return one;
+ }
+
+ /**
+ * 商城核销功能
+ *
+ * @param accessCode
+ * @return
+ */
+ @Override
+ public String validationMall(String accessCode) {
+ if (accessCode == null || accessCode.length() != 16) {
+ return "核销码有误";
+ }
+ AdminUserDO sysUser = userService.getUser(SecurityFrameworkUtils.getLoginUserId());
+ Set userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(sysUser.getId());
+ List roleList = roleService.getRoleList(userRoleIdListByUserId);
+ boolean isPartners = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList()).contains("partners");
+
+ if (!isPartners) {
+ return "当前账号,非合作商,禁止使用";
+ }
+
+ OrderInfo orderInfo = getOrderByAccessCode(accessCode);
+
+
+ if (orderInfo != null && "1".equals(orderInfo.getOrderStatus())) {
+ ShopMallPartners shopMallPartners = shopMallPartnersService.selectShopMallPartnersByUserId(sysUser.getId(),"sc");
+ if (!Objects.equals(orderInfo.getPartnerId(), shopMallPartners.getPartnerId())) {
+ return "非本店铺核销码";
+ }
+ orderInfo.setOrderStatus("2");
+ orderInfo.setValidationUserId(sysUser.getId());
+ orderInfo.setValidationRealName(sysUser.getNickname());
+ orderInfo.setValidationTime(new Date());
+ int result = baseMapper.updateById(orderInfo);
+ String message = (result > 0) ? "核销成功" : "核销失败";
+ return message;
+ } else {
+ return "无此核销码或该订单已核销";
+ }
+ }
+
+ @Override
+ public List validationListWx(Page page) {
+ return baseMapper.validationListWx(page,SecurityFrameworkUtils.getLoginUserId());
+ }
+
+ // pc端核销记录 商城
+ @Override
+ public List validationListPc(Page page) {
+ ShopMallPartners shopMallPartners = shopMallPartnersService.selectShopMallPartnersByUserId(SecurityFrameworkUtils.getLoginUserId(),"sc");
+ Long partnerId = shopMallPartners.getPartnerId();
+ return baseMapper.validationListPc(page,partnerId);
+ }
+
+ @Override
+ public Integer commentOrder(OrderInfo orderInfo) {
+ orderInfo.setOrderStatus("3");
+ orderInfo.setCommentTime(new Date());
+ return baseMapper.updateById(orderInfo);
+ }
+
+ @Override
+ public Integer getNoCommentOrder() {
+ //获取当前登录用户
+ LoginUser user = SecurityFrameworkUtils.getLoginUser();
+ return baseMapper.getNoCommentOrder(user.getId());
+ }
+
+ @Override
+ public List getCommentOrderList(Long partnerId) {
+ return baseMapper.getCommentOrderList(partnerId);
+ }
+
+ @Override
+ public List orderListPc(OrderInfo orderInfo) {
+ return baseMapper.orderListPc(orderInfo);
+ }
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/controller/ShopCouponController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/controller/ShopCouponController.java
new file mode 100644
index 00000000..3a8b87b3
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/controller/ShopCouponController.java
@@ -0,0 +1,172 @@
+package cn.iocoder.yudao.module.shop.controller;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.module.core.controller.BaseController;
+import cn.iocoder.yudao.module.core.page.PageDomain;
+import cn.iocoder.yudao.module.core.page.TableDataInfo;
+import cn.iocoder.yudao.module.core.page.TableSupport;
+import cn.iocoder.yudao.module.shop.entity.ShopCoupon;
+import cn.iocoder.yudao.module.shop.service.IShopCouponService;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
+import cn.iocoder.yudao.util.ExcelUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.pagehelper.PageHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 优惠券Controller
+ *
+ * @author ruoyi
+ * @date 2023-07-31
+ */
+@RestController
+@RequestMapping("/admin-api/system/ShopCoupon")
+public class ShopCouponController extends BaseController
+{
+ @Autowired
+ private IShopCouponService shopCouponService;
+
+
+
+
+ /**
+ * 查询优惠券列表
+ */
+// @PreAuthorize("@ss.hasPermi('system:ShopCoupon:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ShopCoupon shopCoupon,@RequestParam("pageNum")Integer pageNum,@RequestParam("pageSize")Integer pageSize)
+ {
+ Page page = new Page<>(pageNum, pageSize);
+ List list = shopCouponService.selectShopCouponList(page,shopCoupon);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出优惠券列表
+ */
+// @PreAuthorize("@ss.hasPermi('system:ShopCoupon:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ShopCoupon shopCoupon)
+ {
+ Page page = new Page<>();
+ List list = shopCouponService.selectShopCouponList(page,shopCoupon);
+ ExcelUtil util = new ExcelUtil(ShopCoupon.class);
+ util.exportExcel(response, list, "优惠券数据");
+ }
+
+ /**
+ * 获取优惠券详细信息
+ */
+// @PreAuthorize("@ss.hasPermi('system:ShopCoupon:query')")
+ @GetMapping(value = "/{couponId}")
+ public CommonResult getInfo(@PathVariable("couponId") Long couponId)
+ {
+ return success(shopCouponService.selectShopCouponByCouponId(couponId));
+ }
+
+ /**
+ * 新增优惠券
+ */
+// @PreAuthorize("@ss.hasPermi('system:ShopCoupon:add')")
+ @PostMapping
+ public CommonResult add(@RequestBody ShopCoupon shopCoupon) {
+ List selectUserIds = shopCoupon.getSelectUserIds();
+ for (AdminUserDO sysUser : selectUserIds) {
+ String phoneNumber = sysUser.getMobile();
+ if (phoneNumber != null && !phoneNumber.isEmpty()) {
+ shopCoupon.setPhonenumber(phoneNumber);
+ } else {
+ shopCoupon.setPhonenumber("");
+ }
+ shopCoupon.setUserId(sysUser.getId());
+ shopCouponService.insertShopCoupon(shopCoupon);
+ }
+ return CommonResult.ok();
+ }
+
+ /**
+ * 修改优惠券
+ */
+// @PreAuthorize("@ss.hasPermi('system:ShopCoupon:edit')")
+ @PutMapping
+ public CommonResult edit(@RequestBody ShopCoupon shopCoupon)
+ {
+ return toAjax(shopCouponService.updateShopCoupon(shopCoupon));
+ }
+
+ /**
+ * 删除优惠券
+ */
+// @PreAuthorize("@ss.hasPermi('system:ShopCoupon:remove')")
+ @DeleteMapping("/{couponIds}")
+ public CommonResult remove(@PathVariable Long[] couponIds)
+ {
+ return toAjax(shopCouponService.deleteShopCouponByCouponIds(couponIds));
+ }
+ /* 我的优惠券 by userId */
+ @GetMapping(value = "/listByUserId")
+ public TableDataInfo listByUserId(ShopCoupon shopCoupon)
+ {
+ shopCoupon.setUserId(getUserId());
+ PageDomain pageDomain = TableSupport.getPageDomain();
+ PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize(), pageDomain.getOrderBy());
+ List list = shopCouponService.selectShopCouponByUserId(shopCoupon);
+ return getDataTable(list);
+ }
+
+ /* 可用优惠券 by userId */
+ @GetMapping(value = "/availableCouponsListByUserId")
+ public TableDataInfo availableCouponsListByUserId(ShopCoupon shopCoupon, @RequestParam("type") String type, @RequestParam(value = "goodId",required = false) Long goodId)
+ {
+ shopCoupon.setUserId(getUserId());
+ if ("jc".equals(type)){
+ shopCoupon.setBindMoudle("检测项目现金券");
+ }
+ if ("qx".equals(type)){
+ Integer findNum = shopCouponService.getOffsetCouponCount(getUserId(),goodId);
+ if (findNum <= 0 ){
+ shopCoupon.setBindMoudle("维修项目现金券");
+ }else {
+ List list = shopCouponService.getQxCouponList(getUserId(),goodId);
+ return getDataTable(list);
+ }
+ }
+ shopCoupon.setCouponStatus("0");
+ PageDomain pageDomain = TableSupport.getPageDomain();
+ PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize(), pageDomain.getOrderBy());
+ List list = shopCouponService.availableCouponsListByUserId(shopCoupon);
+ return getDataTable(list);
+ }
+
+ /* 可用优惠券 by userId */
+ @GetMapping(value = "/unAvailableCouponsListByUserId")
+ public TableDataInfo unAvailableCouponsListByUserId(ShopCoupon shopCoupon, @RequestParam("type") String type, @RequestParam(value = "goodId",required = false) Long goodId)
+ {
+ shopCoupon.setUserId(getUserId());
+ if ("jc".equals(type)){
+ shopCoupon.setBindMoudle("检测项目现金券");
+ }
+ if ("qx".equals(type)){
+ Integer findNum = shopCouponService.getOffsetCouponCount(getUserId(),goodId);
+ if (findNum <= 0 ){
+ shopCoupon.setBindMoudle("维修项目现金券");
+ }else {
+ List list = shopCouponService.unGetQxCouponList(getUserId(),goodId);
+ return getDataTable(list);
+ }
+ }
+ shopCoupon.setCouponStatus("0");
+
+ PageDomain pageDomain = TableSupport.getPageDomain();
+ PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize(), pageDomain.getOrderBy());
+
+ List list = shopCouponService.unAvailableCouponsListByUserId(shopCoupon);
+ return getDataTable(list);
+ }
+
+
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/controller/ShopUserCarController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/controller/ShopUserCarController.java
new file mode 100644
index 00000000..04762e96
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/controller/ShopUserCarController.java
@@ -0,0 +1,140 @@
+package cn.iocoder.yudao.module.shop.controller;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.module.core.controller.BaseController;
+import cn.iocoder.yudao.module.core.page.TableDataInfo;
+import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
+import cn.iocoder.yudao.module.shop.service.IShopUserCarService;
+import cn.iocoder.yudao.util.ExcelUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 用户车辆Controller
+ *
+ * @author ruoyi
+ * @date 2023-07-10
+ */
+@RestController
+@RequestMapping("/admin-api/system/userCar")
+public class ShopUserCarController extends BaseController
+{
+ @Autowired
+
+ private IShopUserCarService shopUserCarService;
+
+ /**
+ * 查询用户车辆列表
+ */
+// @PreAuthorize("@ss.hasPermi('system:userCar:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ShopUserCar shopUserCar,@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize)
+ {
+ Page page = new Page<>(pageNum, pageSize);
+ List list = shopUserCarService.selectShopUserCarList(page,shopUserCar);
+ return getDataTable(list);
+ }
+ @GetMapping("/listOfPartner")
+ public TableDataInfo listOfPartner(ShopUserCar shopUserCar,@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize)
+ {
+ Page page = new Page<>(pageNum, pageSize);
+ List list = shopUserCarService.selectShopUserCarList(page,shopUserCar);
+ return getDataTable(list);
+ }
+ /**
+ * 导出用户车辆列表
+ */
+// @PreAuthorize("@ss.hasPermi('system:userCar:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ShopUserCar shopUserCar)
+ {
+ Page page = new Page<>();
+ List list = shopUserCarService.selectShopUserCarList(page,shopUserCar);
+ ExcelUtil util = new ExcelUtil(ShopUserCar.class);
+ util.exportExcel(response, list, "用户车辆数据");
+ }
+
+ /**
+ * 获取用户车辆详细信息
+ */
+// @PreAuthorize("@ss.hasPermi('system:userCar:query')")
+ @GetMapping(value = "/{carId}")
+ public CommonResult getInfo(@PathVariable("carId") Long carId)
+ {
+ return success(shopUserCarService.selectShopUserCarByCarId(carId));
+ }
+
+ /**
+ * 新增用户车辆
+ */
+// @PreAuthorize("@ss.hasPermi('system:userCar:add')")
+
+ @PostMapping
+ public CommonResult add(@RequestBody ShopUserCar shopUserCar)
+ {
+ return toAjax(shopUserCarService.insertShopUserCar(shopUserCar));
+ }
+
+ /**
+ * 修改用户车辆
+ */
+// @PreAuthorize("@ss.hasPermi('system:userCar:edit')")
+
+ @PutMapping
+ public CommonResult edit(@RequestBody ShopUserCar shopUserCar)
+ {
+ return toAjax(shopUserCarService.updateShopUserCar(shopUserCar));
+ }
+
+
+ /**
+ * 删除用户车辆
+ */
+// @PreAuthorize("@ss.hasPermi('system:userCar:remove')")
+
+ @DeleteMapping("/{carIds}")
+ public CommonResult remove(@PathVariable Long[] carIds)
+ {
+ return toAjax(shopUserCarService.deleteShopUserCarByCarIds(carIds));
+ }
+
+ @GetMapping(value = "/getUserCar")
+ public CommonResult getUserCarByUserId()
+ {
+ return success(shopUserCarService.selectShopUserCarByUserId(getUserId()));
+ }
+
+ @PostMapping("/vehicleLicenseOCR")
+ public CommonResult vehicleLicenseOCR(String imagePath) throws Exception
+ {
+ return success(shopUserCarService.vehicleLicenseOCR(imagePath));
+ }
+
+ @PostMapping("/appVehicleLicenseOCR")
+ public CommonResult appVehicleLicenseOCR(String imagePath) throws Exception
+ {
+ return success(shopUserCarService.appVehicleLicenseOCR(imagePath));
+ }
+//20240327追加接口
+ @PostMapping("/appVehicleLicenseOCR2")
+ public CommonResult appVehicleLicenseOCR2(String imagePath) throws Exception
+ {
+ return success(shopUserCarService.appVehicleLicenseOCR2(imagePath));
+ }
+ @PostMapping("/infoCardOCR")
+ public CommonResult infoCardOCR(String imagePath) throws Exception
+ {
+ shopUserCarService.infoCardOCR(imagePath);
+ return success();
+ }
+ @GetMapping("/getInfoCard")
+ public CommonResult getInfoCard()
+ {
+ return success( shopUserCarService.getInfoCard());
+ }
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopCoupon.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopCoupon.java
index 59a1fdaa..70ebd9c1 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopCoupon.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopCoupon.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.shop.entity;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
@@ -83,7 +84,8 @@ public class ShopCoupon extends TenantBaseDO
@Excel(name = "用户姓名")
private String realName;
-
+ @TableField(exist = false)
+ private Map params;
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopRepairGoods.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopRepairGoods.java
new file mode 100644
index 00000000..7d1e7cde
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopRepairGoods.java
@@ -0,0 +1,56 @@
+package cn.iocoder.yudao.module.shop.entity;
+
+import cn.iocoder.yudao.annotation.Excel;
+import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 汽修商品对象 shop_repair_goods
+ *
+ * @author ruoyi
+ * @date 2023-07-08
+ */
+@Data
+public class ShopRepairGoods extends TenantBaseDO
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 商品id */
+ private Long id;
+
+ /** 商品分类id */
+ @Excel(name = "商品分类id")
+ private Long categoryId;
+
+ /** 标题 */
+ @Excel(name = "标题")
+ private String title;
+
+ /** 价格 */
+ @Excel(name = "价格")
+ private Long price;
+
+ /** 封面图 */
+ @Excel(name = "封面图")
+ private String image;
+
+ /** 商品图片 */
+ @Excel(name = "商品图片")
+ private String images;
+
+ /** 特价 */
+ @Excel(name = "特价")
+ private Integer isSpecial;
+
+ /** 详细描述 */
+ @Excel(name = "详细描述")
+ private String goodsDesc;
+ /** 价格 */
+ private BigDecimal originalPrice;
+ private BigDecimal lowPrice;
+ private BigDecimal realPrice;
+ private String[] imageList;
+
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopCouponMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopCouponMapper.java
index 991a40c5..666e4ecc 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopCouponMapper.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopCouponMapper.java
@@ -5,6 +5,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.iocoder.yudao.module.shop.entity.ShopCoupon;
import cn.iocoder.yudao.module.shop.entity.ShopCouponTemplate;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@@ -32,7 +33,7 @@ public interface ShopCouponMapper extends BaseMapper
* @param shopCoupon 优惠券
* @return 优惠券集合
*/
- public List selectShopCouponList(ShopCoupon shopCoupon);
+ public List selectShopCouponList(Page page,@Param("vo") ShopCoupon shopCoupon);
/**
* 新增优惠券
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopRepairGoodsMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopRepairGoodsMapper.java
new file mode 100644
index 00000000..36e752d1
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopRepairGoodsMapper.java
@@ -0,0 +1,65 @@
+package cn.iocoder.yudao.module.shop.mapper;
+
+
+import cn.iocoder.yudao.module.shop.entity.ShopRepairGoods;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 汽修商品Mapper接口
+ *
+ * @author ruoyi
+ * @date 2023-07-08
+ */
+@Mapper
+public interface ShopRepairGoodsMapper
+{
+ /**
+ * 查询汽修商品
+ *
+ * @param id 汽修商品主键
+ * @return 汽修商品
+ */
+ public ShopRepairGoods selectShopRepairGoodsById(Long id);
+
+ /**
+ * 查询汽修商品列表
+ *
+ * @param shopRepairGoods 汽修商品
+ * @return 汽修商品集合
+ */
+ public List selectShopRepairGoodsList(ShopRepairGoods shopRepairGoods);
+
+ /**
+ * 新增汽修商品
+ *
+ * @param shopRepairGoods 汽修商品
+ * @return 结果
+ */
+ public int insertShopRepairGoods(ShopRepairGoods shopRepairGoods);
+
+ /**
+ * 修改汽修商品
+ *
+ * @param shopRepairGoods 汽修商品
+ * @return 结果
+ */
+ public int updateShopRepairGoods(ShopRepairGoods shopRepairGoods);
+
+ /**
+ * 删除汽修商品
+ *
+ * @param id 汽修商品主键
+ * @return 结果
+ */
+ public int deleteShopRepairGoodsById(Long id);
+
+ /**
+ * 批量删除汽修商品
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteShopRepairGoodsByIds(Long[] ids);
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopUserCarMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopUserCarMapper.java
index b4ddb813..afc38a46 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopUserCarMapper.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/mapper/ShopUserCarMapper.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.shop.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -32,7 +33,7 @@ public interface ShopUserCarMapper extends BaseMapper
* @param shopUserCar 用户车辆
* @return 用户车辆集合
*/
- public List selectShopUserCarList(ShopUserCar shopUserCar);
+ public List selectShopUserCarList(Page page,@Param("vo") ShopUserCar shopUserCar);
/**
* 新增用户车辆
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopCouponService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopCouponService.java
index 797b719d..e14bcb61 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopCouponService.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopCouponService.java
@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.shop.service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.module.shop.entity.ShopCoupon;
import cn.iocoder.yudao.module.shop.entity.ShopCouponTemplate;
@@ -28,7 +29,7 @@ public interface IShopCouponService extends IService
* @param shopCoupon 优惠券
* @return 优惠券集合
*/
- public List selectShopCouponList(ShopCoupon shopCoupon);
+ public List selectShopCouponList(Page page,ShopCoupon shopCoupon);
/**
* 新增优惠券
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopRepairGoodsService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopRepairGoodsService.java
new file mode 100644
index 00000000..24e6ac14
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopRepairGoodsService.java
@@ -0,0 +1,62 @@
+package cn.iocoder.yudao.module.shop.service;
+
+import cn.iocoder.yudao.module.shop.entity.ShopRepairGoods;
+
+import java.util.List;
+
+/**
+ * 汽修商品Service接口
+ *
+ * @author ruoyi
+ * @date 2023-07-08
+ */
+public interface IShopRepairGoodsService
+{
+ /**
+ * 查询汽修商品
+ *
+ * @param id 汽修商品主键
+ * @return 汽修商品
+ */
+ public ShopRepairGoods selectShopRepairGoodsById(Long id);
+
+ /**
+ * 查询汽修商品列表
+ *
+ * @param shopRepairGoods 汽修商品
+ * @return 汽修商品集合
+ */
+ public List selectShopRepairGoodsList(ShopRepairGoods shopRepairGoods);
+
+ /**
+ * 新增汽修商品
+ *
+ * @param shopRepairGoods 汽修商品
+ * @return 结果
+ */
+ public int insertShopRepairGoods(ShopRepairGoods shopRepairGoods);
+
+ /**
+ * 修改汽修商品
+ *
+ * @param shopRepairGoods 汽修商品
+ * @return 结果
+ */
+ public int updateShopRepairGoods(ShopRepairGoods shopRepairGoods);
+
+ /**
+ * 批量删除汽修商品
+ *
+ * @param ids 需要删除的汽修商品主键集合
+ * @return 结果
+ */
+ public int deleteShopRepairGoodsByIds(Long[] ids);
+
+ /**
+ * 删除汽修商品信息
+ *
+ * @param id 汽修商品主键
+ * @return 结果
+ */
+ public int deleteShopRepairGoodsById(Long id);
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopUserCarService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopUserCarService.java
index e2ef0621..0a46a65b 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopUserCarService.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopUserCarService.java
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.shop.service;
import java.util.List;
import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
@@ -28,7 +29,7 @@ public interface IShopUserCarService extends IService
* @param shopUserCar 用户车辆
* @return 用户车辆集合
*/
- public List selectShopUserCarList(ShopUserCar shopUserCar);
+ public List selectShopUserCarList(Page page,ShopUserCar shopUserCar);
/**
* 新增用户车辆
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/PartnerDetailServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/PartnerDetailServiceImpl.java
index 0244d0f5..51759909 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/PartnerDetailServiceImpl.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/PartnerDetailServiceImpl.java
@@ -9,7 +9,7 @@ import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
-import cn.iocoder.yudao.util.InspWechatPayConfig;
+import cn.iocoder.yudao.util.WechatPayConfig;
import cn.iocoder.yudao.util.DateUtils;
import cn.iocoder.yudao.module.shop.entity.PartnerDetail;
import cn.iocoder.yudao.module.shop.mapper.PartnerDetailMapper;
@@ -60,7 +60,7 @@ public class PartnerDetailServiceImpl implements IPartnerDetailService
@Autowired
private IPartnerBankInfoService partnerBankInfoService;
@Resource
- private InspWechatPayConfig inspWechatPayConfig;
+ private WechatPayConfig wechatPayConfig;
@Autowired
private PermissionService permissionService;
@@ -157,7 +157,7 @@ public class PartnerDetailServiceImpl implements IPartnerDetailService
AddReceiverRequest request =new AddReceiverRequest();
request.setAppid(appId);
request.setType(ReceiverType.MERCHANT_ID);
- request.setAccount(inspWechatPayConfig.getMchId());
+ request.setAccount(wechatPayConfig.getMchId());
request.setName("成都车友帮网络科技有限公司");
request.setRelationType(ReceiverRelationType.HEADQUARTER);
AddReceiverResponse receiverResponse = service.addReceiver(request);
@@ -215,7 +215,7 @@ public class PartnerDetailServiceImpl implements IPartnerDetailService
queryWrapper.eq(PartnerBankInfo::getPartnerId,shopMallPartners.getPartnerId());
PartnerBankInfo bankInfo = partnerBankInfoService.getOne(queryWrapper);
try {
- receiversAdd(inspWechatPayConfig.getAppId(), bankInfo.getMchId(),bankInfo.getApiclientKey(),
+ receiversAdd(wechatPayConfig.getAppId(), bankInfo.getMchId(),bankInfo.getApiclientKey(),
bankInfo.getSerialNo(),bankInfo.getApiV3Key());
}catch (Exception e){
throw new Exception("商户信息不正确,请联系管理员");
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopCouponServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopCouponServiceImpl.java
index 113b9952..a509406c 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopCouponServiceImpl.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopCouponServiceImpl.java
@@ -12,8 +12,9 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
-import cn.iocoder.yudao.util.InspWechatPayConfig;
+import cn.iocoder.yudao.util.WechatPayConfig;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.iocoder.yudao.util.DateUtils;
import cn.iocoder.yudao.module.contract.service.IInspectionContractService;
@@ -51,7 +52,7 @@ public class ShopCouponServiceImpl extends ServiceImpl selectShopCouponList(ShopCoupon shopCoupon)
+ public List selectShopCouponList(Page page,ShopCoupon shopCoupon)
{
- return baseMapper.selectShopCouponList(shopCoupon);
+ return baseMapper.selectShopCouponList(page,shopCoupon);
}
/**
@@ -108,8 +109,8 @@ public class ShopCouponServiceImpl extends ServiceImpl params= new HashMap<>();
- params.put("appId",inspWechatPayConfig.getAppId());
- params.put("appSecret",inspWechatPayConfig.getAppSecret());
+ params.put("appId",wechatPayConfig.getAppId());
+ params.put("appSecret",wechatPayConfig.getAppSecret());
params.put("touser",user.getJcOpenId());
params.put("template_id",YHJ_MESSAGE);
JSONObject data =new JSONObject();
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopMallPartnersServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopMallPartnersServiceImpl.java
index d43bf18a..e258de78 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopMallPartnersServiceImpl.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopMallPartnersServiceImpl.java
@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.shop.service.impl;
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.partner.entity.PartnerBalance;
import cn.iocoder.yudao.module.partner.service.IPartnerBalanceService;
import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
@@ -7,6 +8,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
+import cn.iocoder.yudao.util.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.iocoder.yudao.module.partner.entity.PartnerWorker;
@@ -130,12 +132,17 @@ public class ShopMallPartnersServiceImpl extends ServiceImpl selectShopRepairGoodsList(ShopRepairGoods shopRepairGoods)
+ {
+ ShopConfig shopConfig = configService.selectShopConfigById(1L);
+ //获取最高会员的优惠折扣
+ BigDecimal inspectionPlatinum = shopConfig.getRepairPlatinum();
+ Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
+ PageDomain pageDomain = TableSupport.getPageDomain();
+ PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize(), pageDomain.getOrderBy());
+ List shopInspectionRes = shopRepairGoodsMapper.selectShopRepairGoodsList(shopRepairGoods);
+ for (ShopRepairGoods good : shopInspectionRes) {
+ if (good.getIsSpecial().equals(0)){
+ //原价单位分
+ Long priceFen = good.getPrice();
+ Double priceYuan= priceFen.doubleValue()/100d;
+ good.setLowPrice(BigDecimal.valueOf(priceYuan*ratio).setScale(2,BigDecimal.ROUND_HALF_UP));
+ }
+ }
+ return shopInspectionRes;
+ }
+
+ /**
+ * 新增汽修商品
+ *
+ * @param shopRepairGoods 汽修商品
+ * @return 结果
+ */
+ @Override
+ public int insertShopRepairGoods(ShopRepairGoods shopRepairGoods)
+ {
+ return shopRepairGoodsMapper.insertShopRepairGoods(shopRepairGoods);
+ }
+
+ /**
+ * 修改汽修商品
+ *
+ * @param shopRepairGoods 汽修商品
+ * @return 结果
+ */
+ @Override
+ public int updateShopRepairGoods(ShopRepairGoods shopRepairGoods)
+ {
+ return shopRepairGoodsMapper.updateShopRepairGoods(shopRepairGoods);
+ }
+
+ /**
+ * 批量删除汽修商品
+ *
+ * @param ids 需要删除的汽修商品主键
+ * @return 结果
+ */
+ @Override
+ public int deleteShopRepairGoodsByIds(Long[] ids)
+ {
+ return shopRepairGoodsMapper.deleteShopRepairGoodsByIds(ids);
+ }
+
+ /**
+ * 删除汽修商品信息
+ *
+ * @param id 汽修商品主键
+ * @return 结果
+ */
+ @Override
+ public int deleteShopRepairGoodsById(Long id)
+ {
+ return shopRepairGoodsMapper.deleteShopRepairGoodsById(id);
+ }
+}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopUserCarServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopUserCarServiceImpl.java
index 75d9eee0..d925bbd6 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopUserCarServiceImpl.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopUserCarServiceImpl.java
@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.IDCardOCR;
import cn.iocoder.yudao.util.VehicleLicenseOCR;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.iocoder.yudao.util.StringUtils;
import cn.iocoder.yudao.module.shop.entity.ShopCoupon;
@@ -63,9 +64,9 @@ public class ShopUserCarServiceImpl extends ServiceImpl selectShopUserCarList(ShopUserCar shopUserCar)
+ public List selectShopUserCarList(Page page,ShopUserCar shopUserCar)
{
- return baseMapper.selectShopUserCarList(shopUserCar);
+ return baseMapper.selectShopUserCarList(page,shopUserCar);
}
/**
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/util/InspWechatPayConfig.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/util/InspWechatPayConfig.java
deleted file mode 100644
index ca88619b..00000000
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/util/InspWechatPayConfig.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package cn.iocoder.yudao.util;
-
-
-import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
-import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
-import com.wechat.pay.contrib.apache.httpclient.auth.Verifier;
-import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
-import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator;
-import com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager;
-import com.wechat.pay.contrib.apache.httpclient.exception.HttpCodeException;
-import com.wechat.pay.contrib.apache.httpclient.exception.NotFoundException;
-import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
-import lombok.Data;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.springframework.context.annotation.Bean;
-import org.springframework.stereotype.Component;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import java.security.GeneralSecurityException;
-import java.security.PrivateKey;
-
-/**
- * @Author:
- * @Description:
- **/
-@Component
-@Data
-@Slf4j
-public class InspWechatPayConfig {
- /**
- * 应用编号
- */
- private String appId="wxe6518d72cb71a852";
- /**
- * 商户号
- */
- private String mchId="1625105516";
- /**
- * 服务商商户号
- */
- private String slMchId="1652687637";
- /**
- * APIv2密钥
- */
- private String apiKey="";
- /**
- * APIv3密钥
- */
- private String apiV3Key="9FA68244F52293311637F7AE2C516CA2";
- /**
- * 支付通知回调地址
- */
- private String notifyUrl="https://www.nuoyunr.com/rescue/rescuePayApi/payNotify";
- /**
- * 退款回调地址
- */
- private String refundNotifyUrl="https://www.nuoyunr.com/jdcJc/notify/refundNotify";
-
- /**
- * API 证书中的 key.pem
- */
- private String keyPemPath="apiclient_key.pem";
-
- /**
- * 商户序列号
- */
- private String serialNo="1CF257917547049CDEED041FF683E29FABAF99CB";
- private String appSecret="ab94673dd0cca78abd0a453d0aac9f98";
- /**
- * 微信支付V3-url前缀
- */
- private String baseUrl;
-
-
-
- /**
- * 获取商户的私钥文件
- * @param keyPemPath
- * @return
- */
- public PrivateKey getPrivateKey(String keyPemPath){
- log.info("进入获取");
- InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(keyPemPath);
- if(inputStream==null){
- log.info("私钥文件不存在");
- throw new RuntimeException("私钥文件不存在");
- }
- log.info("存在");
- return PemUtil.loadPrivateKey(inputStream);
- }
-
- /**
- * 获取证书管理器实例
- * @return
- */
- @Bean
- public Verifier getVerifier() throws GeneralSecurityException, IOException, HttpCodeException, NotFoundException {
-
- log.info("获取证书管理器实例");
-
- //获取商户私钥
- PrivateKey privateKey = getPrivateKey(keyPemPath);
-
- //私钥签名对象
- PrivateKeySigner privateKeySigner = new PrivateKeySigner(serialNo, privateKey);
-
- //身份认证对象
- WechatPay2Credentials wechatPay2Credentials = new WechatPay2Credentials(mchId, privateKeySigner);
-
- // 使用定时更新的签名验证器,不需要传入证书
- CertificatesManager certificatesManager = CertificatesManager.getInstance();
- certificatesManager.putMerchant(mchId,wechatPay2Credentials,apiV3Key.getBytes(StandardCharsets.UTF_8));
-
- return certificatesManager.getVerifier(mchId);
- }
-
-
- /**
- * 获取支付http请求对象
- * @param verifier
- * @return
- */
- @Bean(name = "wxPayClient")
- public CloseableHttpClient getWxPayClient(Verifier verifier) {
-
- //获取商户私钥
- PrivateKey privateKey = getPrivateKey(keyPemPath);
-
- WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
- .withMerchant(mchId, serialNo, privateKey)
- .withValidator(new WechatPay2Validator(verifier));
-
- // 通过WechatPayHttpClientBuilder构造的HttpClient,会自动的处理签名和验签,并进行证书自动更新
- return builder.build();
- }
-
- /**
- * 获取HttpClient,无需进行应答签名验证,跳过验签的流程
- */
- @Bean(name = "wxPayNoSignClient")
- public CloseableHttpClient getWxPayNoSignClient(){
-
- //获取商户私钥
- PrivateKey privateKey = getPrivateKey(keyPemPath);
-
- //用于构造HttpClient
- WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
- //设置商户信息
- .withMerchant(mchId, serialNo, privateKey)
- //无需进行签名验证、通过withValidator((response) -> true)实现
- .withValidator((response) -> true);
-
- // 通过WechatPayHttpClientBuilder构造的HttpClient,会自动的处理签名和验签,并进行证书自动更新
- return builder.build();
- }
-}
-
diff --git a/dl-module-inspection/src/main/resources/mapper/appBase/AppSwiperMapper.xml b/dl-module-inspection/src/main/resources/mapper/appBase/AppSwiperMapper.xml
index 729499c5..071439f9 100644
--- a/dl-module-inspection/src/main/resources/mapper/appBase/AppSwiperMapper.xml
+++ b/dl-module-inspection/src/main/resources/mapper/appBase/AppSwiperMapper.xml
@@ -20,11 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml
index 9c5c33ea..95700471 100644
--- a/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml
+++ b/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml
@@ -177,17 +177,17 @@ where sig.partner_id =#{partnerId}