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/InspectionMallPartnersController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionMallPartnersController.java
index e76c76ee..20fef636 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionMallPartnersController.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionMallPartnersController.java
@@ -10,6 +10,8 @@ import cn.hutool.poi.excel.ExcelWriter;
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.text.Convert;
+import cn.iocoder.yudao.module.core.text.ServletUtils;
import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
@@ -127,8 +129,8 @@ public class InspectionMallPartnersController extends BaseController {
}
partner.setPartnerId(worker.getPartnerId());
}
- PageHelper.startPage(pageNum,pageSize);
- List list = orderInfoService.workOrder(partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime);
+ Page page = new Page<>(pageNum,pageSize);
+ List list = orderInfoService.workOrder(page,partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime);
return getDataTable(list);
}
@@ -166,8 +168,8 @@ public class InspectionMallPartnersController extends BaseController {
}
partner.setPartnerId(worker.getPartnerId());
}
- PageHelper.startPage(pageNum,pageSize);
- List list = orderInfoService.delworkOrder(partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime);
+ Page page = new Page<>(pageNum,pageSize);
+ List list = orderInfoService.delworkOrder(page,partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime);
return getDataTable(list);
}
@@ -195,8 +197,10 @@ public class InspectionMallPartnersController extends BaseController {
}
partner.setPartnerId(worker.getPartnerId());
}
- PageHelper.startPage(1,500);
- List list = orderInfoService.workOrder(partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime);
+ int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
+ int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
+ Page page = new Page<>(pageNum,pageSize);
+ List list = orderInfoService.workOrder(page,partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime);
List> rows =new ArrayList<>();
Map stringObjectMap = orderInfoService.workOrderData(partner.getPartnerId(), carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
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..8549e8ba 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
@@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
import cn.iocoder.yudao.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.core.page.TableDataInfo;
@@ -323,8 +324,8 @@ public class PartnerOwnController extends BaseController {
if (!partnersTmp.getUserId().equals(user.getId())){
return null;
}
- PageHelper.startPage(pageNum,pageSize);
- List workList = partnerList.getWorkList(partnerId,postId, workName, phoneNum);
+ Page page = new Page<>(pageNum, pageSize);
+ List workList = partnerList.getWorkList(page,partnerId,postId, workName, phoneNum);
return getDataTable(workList);
}
@@ -344,8 +345,8 @@ public class PartnerOwnController extends BaseController {
if (!partnerId.equals(partners.getPartnerId())){
return null;
}
- PageHelper.startPage(pageNum,pageSize);
- List inspectionInfos = partnerList.inspectionList(partnerId, status, carNum);
+ Page page = new Page<>(pageNum,pageSize);
+ List inspectionInfos = partnerList.inspectionList(page,partnerId, status, carNum);
return getDataTable(inspectionInfos);
}
@@ -365,8 +366,8 @@ public class PartnerOwnController extends BaseController {
if (ObjectUtil.isEmpty(worker)){
return null;
}
- PageHelper.startPage(pageNum,pageSize);
- List inspectionInfos = partnerList.inspectionList(partnerId, status, searchValue);
+ Page page = new Page<>(pageNum,pageSize);
+ List inspectionInfos = partnerList.inspectionList(page,partnerId, status, searchValue);
return getDataTable(inspectionInfos);
}
//增加检测步骤信息
@@ -395,8 +396,8 @@ public class PartnerOwnController extends BaseController {
if (!partnersTmp.getUserId().equals(user.getId())){
return null;
}
- PageHelper.startPage(pageNum,pageSize);
- List appointments = partnerList.getAppointmentList(partnerId,phoneNum);
+ Page page = new Page<>(pageNum,pageSize);
+ List appointments = partnerList.getAppointmentList(page,partnerId,phoneNum);
return getDataTable(appointments);
}
@@ -520,6 +521,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 +585,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/controller/ShopInspectionGoodsController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java
index 53cb401a..cf132612 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java
@@ -9,6 +9,8 @@ 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.core.text.Convert;
+import cn.iocoder.yudao.module.core.text.ServletUtils;
import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
@@ -20,6 +22,7 @@ import cn.iocoder.yudao.module.partner.entity.PartnerWorker;
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -201,8 +204,10 @@ public class ShopInspectionGoodsController extends BaseController
}
shopInspectionOrder.setPartnerId(partner.getPartnerId());
shopInspectionOrder.setValidationTime(new Date());
- startPage();
- List list = orderInfoService.orderListSystem(shopInspectionOrder);
+ int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
+ int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
+ Page page = new Page<>(pageNum,pageSize);
+ List list = orderInfoService.orderListSystem(page,shopInspectionOrder);
return getDataTable(list);
}
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/mapper/AppInspectionPartnerMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java
index fd0fec15..c83c83bd 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java
@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.inspection.entity.ShopInspectionCategory;
import cn.iocoder.yudao.module.inspection.query.PartnerListQuery;
import cn.iocoder.yudao.module.inspection.vo.*;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -31,8 +32,8 @@ public interface AppInspectionPartnerMapper extends BaseMapper
List hotGoodsList(@Param("partnerId") Long partnerId,@Param("dateStr")String dateStr);
List manageGoodsList(@Param("partnerId") Long partnerId, @Param("isListing")String isListing,@Param("goodsTitle") String goodsTitle);
List orderList(@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum,@Param("title") String title);
- List getWorkList(@Param("partnerId")Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum")String phoneNum);
- List inspectionList(@Param("partnerId")Long partnerId,@Param("status") String status, @Param("carNum")String carNum);
+ List getWorkList(Page page,@Param("partnerId")Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum")String phoneNum);
+ List inspectionList(Page page,@Param("partnerId")Long partnerId, @Param("status") String status, @Param("carNum")String carNum);
List workerInspectionList(@Param("workerId")Long workerId,@Param("status") String status, @Param("searchValue")String searchValue);
List validationList(@Param("partnerId") Long partnerId, @Param("searchValue") String searchValue);
List getPickCarList(@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum, @Param("pickStatus") String pickStatus);
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java
index 375d0b16..d5af610f 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionAppointment;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -63,7 +64,7 @@ public interface InspectionAppointmentMapper extends BaseMapper getAppointmentList(@Param("partnerId") Long partnerId,@Param("phoneNum")String phoneNum);
+ List getAppointmentList(Page page,@Param("partnerId") Long partnerId, @Param("phoneNum")String phoneNum);
List getAppointmentOwn(@Param("userId") Long userId);
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionInfoMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionInfoMapper.java
index d2980a45..650ce14e 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionInfoMapper.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionInfoMapper.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -65,11 +66,11 @@ public interface InspectionInfoMapper extends BaseMapper
* @return 结果
*/
public int deleteInspectionInfoByIds(Long[] ids);
- List workOrder(@Param("partnerId") Long partnerId, @Param("carNum")String carNum, @Param("goodsTitle")String goodsTitle
- ,@Param("customerSource")String customerSource,@Param("payType")String payType,@Param("startTime")String startTime
- ,@Param("roleId") Long roleId,@Param("endTime")String endTime);
+ List workOrder(Page page,@Param("partnerId") Long partnerId, @Param("carNum")String carNum, @Param("goodsTitle")String goodsTitle
+ , @Param("customerSource")String customerSource, @Param("payType")String payType, @Param("startTime")String startTime
+ , @Param("roleId") Long roleId, @Param("endTime")String endTime);
- List delworkOrder(@Param("partnerId") Long partnerId, @Param("carNum")String carNum, @Param("goodsTitle")String goodsTitle
+ List delworkOrder(Page page,@Param("partnerId") Long partnerId, @Param("carNum")String carNum, @Param("goodsTitle")String goodsTitle
,@Param("customerSource")String customerSource,@Param("payType")String payType,@Param("startTime")String startTime
,@Param("roleId") Long roleId,@Param("endTime")String endTime);
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java
index 2c07059b..f67e55aa 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java
@@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.partner.entity.PartnerWorker;
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.module.inspection.entity.*;
import cn.iocoder.yudao.module.inspection.query.PartnerListQuery;
@@ -52,18 +53,18 @@ public interface AppInspectionPartnerService extends IService
Long orderDetailByCode(Long partnerId,String code) throws Exception;
void takeOut(Long partnerId,Long orderId,Long workId,String carNum) throws Exception;
void addWorker(Long partnerId,String realName,String phoneNum,Long postId) throws Exception;
- List getWorkList(Long partnerId, Long postId, String workName, String phoneNum);
+ List getWorkList(Page page,Long partnerId, Long postId, String workName, String phoneNum);
void delWorker(Long partnerId,Long workId);
- List inspectionList(Long partnerId,String status,String carNum);
+ List inspectionList(Page page,Long partnerId, String status, String carNum);
InspectionInfoVo inspectionDetail(Long inspectionInfoId);
List workerInspectionList(Long partnerId,String status,String searchValue);
void addStepInfo(InspectionStepInfo stepInfo);
void stopInspection(InspectionInfo info) throws Exception;
void makeCertOk(Long inspectionId);
- List getAppointmentList(Long partnerId,String phoneNum);
+ List getAppointmentList(Page page,Long partnerId,String phoneNum);
List validationList(Long partnerId,String searchValue);
void sendCoupon(ShopCouponTemplate template) throws Exception;
List listCoupon(Long partnerId,String searchValue);
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java
index a230820a..3ad5e154 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.inspection.service;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.module.inspection.entity.InspectionAppointment;
import cn.iocoder.yudao.module.inspection.entity.InspectionPickCar;
@@ -72,6 +73,6 @@ public interface IInspectionAppointmentService extends IService getAppointmentList(Long partnerId,String phoneNum);
+ public List getAppointmentList(Page page,Long partnerId, String phoneNum);
List getAppointmentOwn();
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java
index 6340bec9..6a78ea50 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java
@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.inspection.service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
@@ -61,8 +62,8 @@ public interface IInspectionInfoService extends IService
* @return 结果
*/
public int deleteInspectionInfoById(Long id);
- List workOrder(Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime);
- List delworkOrder(Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime);
+ List workOrder(Page page,Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
+ List delworkOrder(Page page,Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime);
Map workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java
index 0055f116..23143b24 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java
@@ -37,6 +37,7 @@ import cn.iocoder.yudao.util.SendSmsUtil;
import cn.iocoder.yudao.util.VehicleLicenseOCR;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import cn.iocoder.yudao.util.StringUtils;
@@ -1055,8 +1056,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getWorkList(Long partnerId,Long postId,String workName,String phoneNum) {
- return baseMapper.getWorkList(partnerId,postId,workName,phoneNum);
+ public List getWorkList(Page page,Long partnerId,Long postId,String workName,String phoneNum) {
+ return baseMapper.getWorkList(page,partnerId,postId,workName,phoneNum);
}
@Override
@@ -1070,8 +1071,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl inspectionList(Long partnerId,String status,String carNum) {
- return baseMapper.inspectionList(partnerId,status,carNum);
+ public List inspectionList(Page page,Long partnerId, String status, String carNum) {
+ return baseMapper.inspectionList(page,partnerId,status,carNum);
}
@Override
@@ -1213,8 +1214,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getAppointmentList(Long partnerId,String phoneNum) {
- return appointmentService.getAppointmentList(partnerId,phoneNum);
+ public List getAppointmentList(Page page,Long partnerId,String phoneNum) {
+ return appointmentService.getAppointmentList(page,partnerId,phoneNum);
}
@Override
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionAppointmentServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionAppointmentServiceImpl.java
index 01a59f19..aa52b592 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionAppointmentServiceImpl.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionAppointmentServiceImpl.java
@@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.SendSmsUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+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.util.StringUtils;
@@ -346,8 +347,8 @@ public class InspectionAppointmentServiceImpl extends ServiceImpl getAppointmentList(Long partnerId,String phoneNum) {
- return baseMapper.getAppointmentList(partnerId,phoneNum);
+ public List getAppointmentList(Page page,Long partnerId, String phoneNum) {
+ return baseMapper.getAppointmentList(page,partnerId,phoneNum);
}
@Override
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..c4d54686 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
@@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.SendSmsUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+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.inspection.entity.*;
@@ -105,12 +106,12 @@ public class InspectionInfoServiceImpl extends ServiceImpl workerQueryWrapper =new LambdaQueryWrapper<>();
workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId());
PartnerWorker worker = workerService.getOne(workerQueryWrapper);
- AdminUserDO workerUser =userService.getUser(worker.getUserId());
if (ObjectUtils.isNotEmpty(worker)){
inspectionInfo.setWorkId(worker.getId());
}else {
throw new Exception("请先将接待员加入员工");
}
+ AdminUserDO workerUser =userService.getUser(worker.getUserId());
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户";
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"无";
AdminUserDO user = userService.getUserByMobile(buyPhone);
@@ -123,6 +124,11 @@ public class InspectionInfoServiceImpl extends ServiceImpl workOrder(Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime){
- return baseMapper.workOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
+ public List workOrder(Page page,Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime){
+ return baseMapper.workOrder(page,partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
}
@Override
- public List delworkOrder(Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime){
- return baseMapper.delworkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
+ public List delworkOrder(Page page,Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime){
+ return baseMapper.delworkOrder(page,partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
}
@Override
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/SysDictData.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/SysDictData.java
index cc4d61ea..e89ed528 100644
--- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/SysDictData.java
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/SysDictData.java
@@ -42,4 +42,6 @@ public class SysDictData
/** 状态(0正常 1停用) */
private String status;
+ private String remark;
+
}
diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/controller/PartnerCustomerInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/controller/PartnerCustomerInfoController.java
new file mode 100644
index 00000000..12f3f803
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/controller/PartnerCustomerInfoController.java
@@ -0,0 +1,98 @@
+package cn.iocoder.yudao.module.partner.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.core.text.Convert;
+import cn.iocoder.yudao.module.core.text.ServletUtils;
+import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
+import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
+import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
+import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
+import cn.iocoder.yudao.util.ExcelUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 客户信息Controller
+ *
+ * @author zcy
+ * @date 2023-09-13
+ */
+@RestController
+@RequestMapping("/admin-api/customerInfo/customerInfo")
+public class PartnerCustomerInfoController extends BaseController
+{
+ @Autowired
+ private IPartnerCustomerInfoService partnerCustomerInfoService;
+ @Autowired
+ private AppInspectionPartnerService partnerService;
+
+ /**
+ * 查询客户信息列表
+ */
+ @GetMapping("/list")
+ public TableDataInfo list(PartnerCustomerInfo partnerCustomerInfo) throws Exception {
+ ShopMallPartners partners = partnerService.shopInfo();
+ partnerCustomerInfo.setPartnerId(partners.getPartnerId());
+ int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
+ int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
+ Page page = new Page<>(pageNum,pageSize);
+ List list = partnerCustomerInfoService.selectPartnerCustomerInfoList(page,partnerCustomerInfo);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出客户信息列表
+ */
+
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, PartnerCustomerInfo partnerCustomerInfo)
+ {
+ Page page = new Page<>();
+ List list = partnerCustomerInfoService.selectPartnerCustomerInfoList(page,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..675870a2 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
@@ -3,7 +3,11 @@ package cn.iocoder.yudao.module.partner.mapper;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
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;
+
+import java.util.List;
/**
* 客户信息Mapper接口
@@ -14,4 +18,37 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PartnerCustomerInfoMapper extends BaseMapper
{
+ /**
+ * 查询客户信息列表
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 客户信息集合
+ */
+ public List selectPartnerCustomerInfoList(Page page ,@Param("vo") 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..bbd74f99 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
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.partner.service;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@@ -13,4 +14,44 @@ import java.util.List;
public interface IPartnerCustomerInfoService extends IService
{
+ /**
+ * 查询客户信息列表
+ *
+ * @param partnerCustomerInfo 客户信息
+ * @return 客户信息集合
+ */
+ public List selectPartnerCustomerInfoList(Page page ,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..a79f8124 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,34 @@
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.plugins.pagination.Page;
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 +38,189 @@ 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(Page page ,PartnerCustomerInfo partnerCustomerInfo)
+ {
+ List partnerCustomerInfos = baseMapper.selectPartnerCustomerInfoList(page,partnerCustomerInfo);
+ for (PartnerCustomerInfo customerInfo : partnerCustomerInfos) {
+ List list = userCarService.selectUserCarsByUserId(customerInfo.getUserId());
+ 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();
+ user = new AdminUserDO();
+ BeanUtils.copyProperties(partnerCustomerInfo,user);
+ userSaveReqVO.setUsername(partnerCustomerInfo.getCustomerPhone());
+ userSaveReqVO.setNickname(partnerCustomerInfo.getCustomerName());
+ userSaveReqVO.setPassword("123456");
+ Long uid = userService.createUser(userSaveReqVO);
+ user.setId(uid);
+ 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)){
+ userCarService.deleteShopUserCarByUserId(partnerCustomerInfo.getUserId());
+ 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..2273e484
--- /dev/null
+++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/controller/OrderController.java
@@ -0,0 +1,189 @@
+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.core.text.Convert;
+import cn.iocoder.yudao.module.core.text.ServletUtils;
+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) {
+ int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
+ int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
+ Page page = new Page<>(pageNum,pageSize);
+ List list = orderInfoService.orderListSystem(page,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..4d74e66d 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;
@@ -27,7 +29,7 @@ public interface OrderInfoMapper extends BaseMapper {
List inspectionList(@Param("status") String status, @Param("userId")Long userId);
- List orderListSystem(OrderInfo orderInfo);
+ List orderListSystem(Page page,@Param("vo") OrderInfo orderInfo);
List statisticsZXTMonth(@Param("partnerId") Long partnerId,@Param("startTime")String startTime,@Param("endTime")String endTime);
@@ -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..a2ff0c92 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;
@@ -17,10 +20,37 @@ import java.util.Map;
public interface OrderInfoService extends IService {
void reviewOrder(String orderId,Integer starLevel,String reviewStr) throws Exception;
List orderListApp(String status, String title, String type);
- List workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
+ List workOrder(Page page,Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
Map workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
- List delworkOrder(Long partnerId,String carNum,String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime);
- List orderListSystem(OrderInfo orderInfo);
+ List delworkOrder(Page page,Long partnerId,String carNum,String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime);
+ List orderListSystem(Page page,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..d1b75c4c 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 workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
+ public List workOrder(Page page,Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
if (StringUtils.isNotEmpty(startTime)){
startTime = startTime+" 00:00:00";
}
if (StringUtils.isNotEmpty(endTime)){
endTime = endTime+" 23:59:59";
}
- return iInspectionInfoService.workOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime, roleId,endTime);
+ return iInspectionInfoService.workOrder(page,partnerId,carNum,goodsTitle, customerSource, payType, startTime, roleId,endTime);
}
@Override
@@ -85,21 +128,676 @@ public class OrderInfoServiceImpl extends ServiceImpl delworkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
+ public List delworkOrder(Page page,Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
if (StringUtils.isNotEmpty(startTime)){
startTime = startTime+" 00:00:00";
}
if (StringUtils.isNotEmpty(endTime)){
endTime = endTime+" 23:59:59";
}
- return iInspectionInfoService.delworkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime, roleId,endTime);
+ return iInspectionInfoService.delworkOrder(page,partnerId,carNum,goodsTitle, customerSource, payType, startTime, roleId,endTime);
}
@Override
- public List orderListSystem(OrderInfo orderInfo) {
- return baseMapper.orderListSystem(orderInfo);
+ public List orderListSystem(Page page,OrderInfo orderInfo) {
+ return baseMapper.orderListSystem(page,orderInfo);
}
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Long createOrder(OrderInfo orderInfo) throws Exception {
+ //获取当前登录用户
+ LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
+ AdminUserDO user = userService.getUser(loginUser.getId());
+ UserBalance shopUserBalance = userBalanceService.selectShopUserBalanceByUserId(user.getId());
+ if (orderInfo.getBalance() > 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