1
This commit is contained in:
parent
687168001f
commit
e2111c6d12
@ -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";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取商户的私钥文件
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.rescue.utils.pay;
|
||||
package cn.iocoder.yudao.util;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.jx.payment.entity;
|
||||
package cn.iocoder.yudao.util;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
@ -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";
|
@ -26,6 +26,12 @@
|
||||
<artifactId>yudao-module-system-biz</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-infra-biz</artifactId>
|
||||
<version>2.1.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
@ -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<String,Object> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
|
@ -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<AppSwiper> selectAppSwiperList(AppSwiper appSwiper);
|
||||
public List<AppSwiper> selectAppSwiperList(@Param("vo") AppSwiper appSwiper);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
|
@ -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<ContractHistory> list = contractHistoryService.selectContractHistoryList(contractHistory);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出签署历史列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:history:export')")
|
||||
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ContractHistory contractHistory)
|
||||
{
|
||||
List<ContractHistory> list = contractHistoryService.selectContractHistoryList(contractHistory);
|
||||
ExcelUtil<ContractHistory> util = new ExcelUtil<ContractHistory>(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<InspectionContract> 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));
|
||||
}
|
||||
|
||||
}
|
@ -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<InspectionContract> 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<InspectionContract> list = inspectionContractService.selectInspectionContractList(inspectionContract);
|
||||
ExcelUtil<InspectionContract> util = new ExcelUtil<InspectionContract>(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<InspectionContract> list = inspectionContractService.partnerGetWtList(inspectionContract);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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<AdminUserDO> dbList = ownService.getDbList(searchValue);
|
||||
return getDataTable(dbList);
|
||||
return getDataTable(dbList);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getAppUserCar")
|
||||
|
@ -520,6 +520,7 @@ public class PartnerOwnController extends BaseController {
|
||||
dictSave.setStatus(0);
|
||||
dictSave.setValue(dictData.getDictLabel());
|
||||
dictSave.setCssClass("default");
|
||||
dictSave.setRemark(dictData.getRemark());
|
||||
dictDataService.createDictData(dictSave);
|
||||
return success();
|
||||
}
|
||||
@ -583,7 +584,9 @@ public class PartnerOwnController extends BaseController {
|
||||
|
||||
dictSave.setDictType(sysDictType.getType());
|
||||
dictSave.setStatus(0);
|
||||
dictSave.setValue(dictData.getDictLabel());
|
||||
dictSave.setLabel(dictData.getDictLabel());
|
||||
dictSave.setValue(dictData.getDictValue());
|
||||
dictSave.setRemark(dictData.getRemark());
|
||||
dictSave.setCssClass("default");
|
||||
dictDataService.createDictData(dictSave);
|
||||
return success();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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<String,Object> params;
|
||||
|
||||
}
|
||||
|
@ -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<String,Object> params;
|
||||
}
|
||||
|
@ -33,10 +33,10 @@ public class InspectionStepInfo extends Model<InspectionStepInfo> {
|
||||
@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;
|
||||
}
|
||||
|
||||
|
@ -123,6 +123,11 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
userSaveReqVO.setPassword("123456");
|
||||
Long uid = userService.createUser(userSaveReqVO);
|
||||
inspectionInfo.setUserId(uid);
|
||||
user = new AdminUserDO();
|
||||
user.setId(uid);
|
||||
user.setNickname(buyName);
|
||||
user.setUsername(buyPhone);
|
||||
user.setMobile(buyPhone);
|
||||
}else {
|
||||
inspectionInfo.setUserId(user.getId());
|
||||
}
|
||||
|
@ -42,4 +42,6 @@ public class SysDictData
|
||||
/** 状态(0正常 1停用) */
|
||||
private String status;
|
||||
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,92 @@
|
||||
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.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 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());
|
||||
startPage();
|
||||
List<PartnerCustomerInfo> list = partnerCustomerInfoService.selectPartnerCustomerInfoList(partnerCustomerInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出客户信息列表
|
||||
*/
|
||||
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PartnerCustomerInfo partnerCustomerInfo)
|
||||
{
|
||||
List<PartnerCustomerInfo> list = partnerCustomerInfoService.selectPartnerCustomerInfoList(partnerCustomerInfo);
|
||||
ExcelUtil<PartnerCustomerInfo> util = new ExcelUtil<PartnerCustomerInfo>(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));
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户信息Mapper接口
|
||||
*
|
||||
@ -14,4 +16,37 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface PartnerCustomerInfoMapper extends BaseMapper<PartnerCustomerInfo>
|
||||
{
|
||||
/**
|
||||
* 查询客户信息列表
|
||||
*
|
||||
* @param partnerCustomerInfo 客户信息
|
||||
* @return 客户信息集合
|
||||
*/
|
||||
public List<PartnerCustomerInfo> selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo);
|
||||
|
||||
/**
|
||||
* 查询客户信息
|
||||
*
|
||||
* @param id 客户信息主键
|
||||
* @return 客户信息
|
||||
*/
|
||||
public PartnerCustomerInfo selectPartnerCustomerInfoById(Long id);
|
||||
|
||||
int insertPartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo);
|
||||
|
||||
/**
|
||||
* 修改客户信息
|
||||
*
|
||||
* @param partnerCustomerInfo 客户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo);
|
||||
|
||||
/**
|
||||
* 批量删除客户信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePartnerCustomerInfoByIds(Long[] ids);
|
||||
}
|
||||
|
@ -13,4 +13,44 @@ import java.util.List;
|
||||
public interface IPartnerCustomerInfoService extends IService<PartnerCustomerInfo>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询客户信息列表
|
||||
*
|
||||
* @param partnerCustomerInfo 客户信息
|
||||
* @return 客户信息集合
|
||||
*/
|
||||
public List<PartnerCustomerInfo> selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo);
|
||||
|
||||
/**
|
||||
* 查询客户信息
|
||||
*
|
||||
* @param id 客户信息主键
|
||||
* @return 客户信息
|
||||
*/
|
||||
public PartnerCustomerInfo selectPartnerCustomerInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 新增客户信息
|
||||
*
|
||||
* @param partnerCustomerInfo 客户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改客户信息
|
||||
*
|
||||
* @param partnerCustomerInfo 客户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo);
|
||||
|
||||
/**
|
||||
* 批量删除客户信息
|
||||
*
|
||||
* @param ids 需要删除的客户信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePartnerCustomerInfoByIds(Long[] ids);
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,33 @@
|
||||
package cn.iocoder.yudao.module.partner.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
|
||||
import cn.iocoder.yudao.module.partner.mapper.PartnerCustomerInfoMapper;
|
||||
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
|
||||
import cn.iocoder.yudao.module.shop.service.IShopUserCarService;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.util.DateUtils;
|
||||
import cn.iocoder.yudao.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 客户信息Service业务层处理
|
||||
@ -14,4 +37,191 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerInfoMapper, PartnerCustomerInfo> 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<PartnerCustomerInfo> selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo)
|
||||
{
|
||||
List<PartnerCustomerInfo> partnerCustomerInfos = baseMapper.selectPartnerCustomerInfoList(partnerCustomerInfo);
|
||||
for (PartnerCustomerInfo customerInfo : partnerCustomerInfos) {
|
||||
LambdaQueryWrapper<ShopUserCar> queryWrapper1 =new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ShopUserCar::getUserId,customerInfo.getUserId());
|
||||
List<ShopUserCar> list = userCarService.list(queryWrapper1);
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
customerInfo.setUserCarList(list);
|
||||
}else {
|
||||
customerInfo.setUserCarList(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
return partnerCustomerInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户信息
|
||||
*
|
||||
* @param id 客户信息主键
|
||||
* @return 客户信息
|
||||
*/
|
||||
@Override
|
||||
public PartnerCustomerInfo selectPartnerCustomerInfoById(Long id)
|
||||
{
|
||||
return baseMapper.selectPartnerCustomerInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客户信息
|
||||
*
|
||||
* @param partnerCustomerInfo 客户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertPartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo) throws Exception {
|
||||
ShopMallPartners partners = partnerService.shopInfo();
|
||||
LambdaQueryWrapper<PartnerCustomerInfo> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PartnerCustomerInfo::getPartnerId,partners.getPartnerId()).eq(PartnerCustomerInfo::getCustomerPhone,partnerCustomerInfo.getCustomerPhone());
|
||||
PartnerCustomerInfo customerInfo = this.getOne(queryWrapper);
|
||||
if (ObjectUtils.isNotEmpty(customerInfo)){
|
||||
throw new Exception("客户已存在");
|
||||
}
|
||||
AdminUserDO user = userService.selectUserByPhone(partnerCustomerInfo.getCustomerPhone());
|
||||
if (ObjectUtils.isEmpty(user)){
|
||||
RoleDO role = roleService.queryRole("jcyh");
|
||||
|
||||
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
||||
BeanUtils.copyProperties(partnerCustomerInfo,user);
|
||||
userSaveReqVO.setUsername(partnerCustomerInfo.getCustomerPhone());
|
||||
userSaveReqVO.setNickname(partnerCustomerInfo.getCustomerName());
|
||||
Long uid = userService.createUser(new UserSaveReqVO());
|
||||
|
||||
Set<Long> 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<Long> ids = new HashSet<>();
|
||||
ids.add(sysRole.getId());
|
||||
permissionService.assignUserRole(user.getId(),ids);
|
||||
|
||||
}
|
||||
List<ShopUserCar> userCarList = partnerCustomerInfo.getUserCarList();
|
||||
if (CollectionUtil.isNotEmpty(userCarList)){
|
||||
for (ShopUserCar shopUserCar : userCarList) {
|
||||
LambdaQueryWrapper<ShopUserCar> 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<ShopUserCar> userCarList = partnerCustomerInfo.getUserCarList();
|
||||
for (ShopUserCar shopUserCar : userCarList) {
|
||||
shopUserCar.setUserId(partnerCustomerInfo.getUserId());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(userCarList)){
|
||||
LambdaQueryWrapper<ShopUserCar> queryWrapper1 =new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ShopUserCar::getUserId,partnerCustomerInfo.getUserId());
|
||||
userCarService.remove(queryWrapper1);
|
||||
userCarService.saveBatch(userCarList);
|
||||
}
|
||||
if (!StringUtils.isEmpty(partnerCustomerInfo.getCustomerPhone())&&!StringUtils.isEmpty(partnerCustomerInfo.getRoleCode())){
|
||||
AdminUserDO sysUser = userService.selectUserByPhone(partnerCustomerInfo.getCustomerPhone());
|
||||
RoleDO sysRole = roleService.queryRole(partnerCustomerInfo.getRoleCode());
|
||||
|
||||
if (ObjectUtils.isNotEmpty(sysUser)){
|
||||
Set<Long> ids = new HashSet<Long>();
|
||||
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<Long> ids = new HashSet<Long>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,185 @@
|
||||
package cn.iocoder.yudao.module.payment.controller;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.core.controller.BaseController;
|
||||
import cn.iocoder.yudao.module.core.page.PageDomain;
|
||||
import cn.iocoder.yudao.module.core.page.TableDataInfo;
|
||||
import cn.iocoder.yudao.module.core.page.TableSupport;
|
||||
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
|
||||
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
|
||||
import cn.iocoder.yudao.module.payment.entity.commentVo;
|
||||
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
|
||||
import cn.iocoder.yudao.module.shop.service.IShopMallPartnersService;
|
||||
import cn.iocoder.yudao.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@RequestMapping("/admin-api/orderApi")
|
||||
@RestController
|
||||
public class OrderController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private OrderInfoService orderInfoService;
|
||||
@Autowired
|
||||
private IShopMallPartnersService shopMallPartnersService;
|
||||
@Autowired
|
||||
private AppInspectionPartnerService partnerService;
|
||||
|
||||
|
||||
@PostMapping("/createOrder")
|
||||
public CommonResult createOrder(@RequestBody OrderInfo orderInfo) throws Exception {
|
||||
return CommonResult.success(orderInfoService.createOrder(orderInfo));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/orderDetail")
|
||||
public CommonResult orderDetail(Long goodsId, String type, String title, Integer amount) {
|
||||
return CommonResult.success(orderInfoService.orderDetail(goodsId, type, title, amount));
|
||||
}
|
||||
|
||||
@GetMapping("/pickCarDetail")
|
||||
public CommonResult pickCarDetail(Long pickCarId) {
|
||||
return CommonResult.success(orderInfoService.pickCarDetail(pickCarId));
|
||||
}
|
||||
|
||||
//取消支付
|
||||
@PostMapping("/cancelPay")
|
||||
public CommonResult cancelPay(Long orderId) {
|
||||
orderInfoService.cancelPay(orderId);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/orderList")
|
||||
public TableDataInfo orderList(String status, String title) {
|
||||
startPage();
|
||||
List<OrderInfo> orderInfos = orderInfoService.orderList(status, title);
|
||||
return getDataTable(orderInfos);
|
||||
|
||||
}
|
||||
|
||||
// 用于自营维修保养核销
|
||||
@PostMapping("/validation")
|
||||
public CommonResult validation(@RequestBody Map<String, Object> 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<String, Object> 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<OrderInfo> page = new Page<>(pageNum, pageSize);
|
||||
List<OrderInfo> list = orderInfoService.validationListWx(page);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
// 商城核销记录By核销人Id PC
|
||||
@GetMapping("/validationListPc")
|
||||
public TableDataInfo validationListPc(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
|
||||
Page<OrderInfo> page = new Page<>(pageNum, pageSize);
|
||||
List<OrderInfo> list = orderInfoService.validationListPc(page);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
//评论商品和星级
|
||||
@PostMapping("/reviewOrder")
|
||||
public CommonResult reviewOrder(String orderId, Integer starLevel, String reviewStr) throws Exception {
|
||||
orderInfoService.reviewOrder(orderId, starLevel, reviewStr);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询检测订单列表
|
||||
*/
|
||||
@GetMapping("/orderListSystem")
|
||||
public TableDataInfo orderListSystem(OrderInfo shopInspectionOrder) {
|
||||
startPage();
|
||||
List<OrderInfo> list = orderInfoService.orderListSystem(shopInspectionOrder);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单评价
|
||||
*/
|
||||
|
||||
@PostMapping("/commentOrder")
|
||||
public CommonResult commentOrder(@RequestBody OrderInfo orderInfo) throws Exception {
|
||||
OrderInfo curOrderInfo = orderInfoService.getById(orderInfo.getId());
|
||||
if (!Objects.equals(curOrderInfo.getUserId(), getUserId())) {
|
||||
return CommonResult.error(500,"非当前用户订单,禁止评论");
|
||||
}
|
||||
return CommonResult.success(orderInfoService.commentOrder(orderInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取尚未评价的订单
|
||||
*/
|
||||
|
||||
@GetMapping("/getNoCommentOrder")
|
||||
public CommonResult getNoCommentOrder() {
|
||||
return CommonResult.success(orderInfoService.getNoCommentOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品的评价列表
|
||||
*/
|
||||
|
||||
@GetMapping("/getCommentOrderList")
|
||||
public TableDataInfo getCommentOrderList(Long partnerId,Integer pageNum,Integer pageSize) {
|
||||
//判断商家是否开启评论区
|
||||
ShopMallPartners partners = partnerService.getById(partnerId);
|
||||
if (StringUtils.isEmpty(partners.getOpenComment())||partners.getOpenComment().equals("0")){
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
PageHelper.startPage(pageNum,pageSize);
|
||||
List<commentVo> 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<OrderInfo> 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);
|
||||
}
|
||||
}
|
@ -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<String,Object> 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<String, Object> 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<String, Object> amountMap = new HashMap<>(4);
|
||||
// 金额单位为分
|
||||
amountMap.put("total", orderInfo.getPayMoney());
|
||||
//人民币
|
||||
amountMap.put("currency", "CNY");
|
||||
params.put("amount", amountMap);
|
||||
|
||||
// 场景信息
|
||||
Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> resMap = JSONObject.parseObject(resStr);
|
||||
Map<String, Object> 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<String,Object> 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<String, Object> 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<String, Object> amountMap = new HashMap<>(4);
|
||||
// 金额单位为分
|
||||
amountMap.put("total", orderInfo.getPayMoney());
|
||||
//人民币
|
||||
amountMap.put("currency", "CNY");
|
||||
params.put("amount", amountMap);
|
||||
|
||||
// 场景信息
|
||||
Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> resMap = JSONObject.parseObject(resStr);
|
||||
Map<String, Object> 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<String,Object> 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<PartnerBankInfo> 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<String, Object> resMap = paySignMsg(prepayId, wechatPayConfig.getAppId(),bankInfo.getApiclientKey());
|
||||
return resMap;
|
||||
}
|
||||
private Map<String, Object> 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<String, Object> 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();
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -2,8 +2,10 @@ package cn.iocoder.yudao.module.payment.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
|
||||
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
|
||||
import cn.iocoder.yudao.module.payment.entity.commentVo;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -37,5 +39,15 @@ public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
|
||||
|
||||
List<InspectionInfo> governmentInspectionList(@Param("carNum")String carNum, @Param("status")String status, @Param("partnerId")String partnerId);
|
||||
|
||||
List<OrderInfo> orderList(@Param("userId") Long userId, @Param("status") String status,@Param("title") String title);
|
||||
|
||||
List<OrderInfo> validationListWx(Page<OrderInfo> page,@Param("validationUserId") Long validationUserId);
|
||||
List<OrderInfo> validationListPc(Page<OrderInfo> page,Long partnerId);
|
||||
|
||||
Integer getNoCommentOrder(@Param("userId") Long userId);
|
||||
|
||||
List<commentVo> getCommentOrderList(@Param("partnerId") Long partnerId);
|
||||
|
||||
List<OrderInfo> orderListPc(OrderInfo orderInfo);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,9 @@ package cn.iocoder.yudao.module.payment.service;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
|
||||
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
|
||||
import cn.iocoder.yudao.module.payment.entity.commentVo;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
@ -22,5 +25,32 @@ public interface OrderInfoService extends IService<OrderInfo> {
|
||||
List<InspectionInfo> delworkOrder(Long partnerId,String carNum,String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime);
|
||||
List<OrderInfo> orderListSystem(OrderInfo orderInfo);
|
||||
|
||||
Long createOrder(OrderInfo orderInfo) throws Exception;
|
||||
JSONObject pickCarDetail(Long pickCarId);
|
||||
|
||||
JSONObject orderDetail(Long goodsId,String type,String title,Integer amount);
|
||||
|
||||
void cancelPay(Long orderId);
|
||||
|
||||
List<OrderInfo> orderList(String status,String title);
|
||||
|
||||
String validation(String accessCode);
|
||||
|
||||
OrderInfo getOrderByAccessCode(String accessCode);
|
||||
|
||||
String validationMall(String accessCode);
|
||||
|
||||
List<OrderInfo> validationListWx(Page<OrderInfo> page);
|
||||
|
||||
List<OrderInfo> validationListPc(Page<OrderInfo> page);
|
||||
|
||||
Integer commentOrder(OrderInfo orderInfo);
|
||||
|
||||
Integer getNoCommentOrder();
|
||||
|
||||
List<commentVo> getCommentOrderList(Long partnerId);
|
||||
|
||||
List<OrderInfo> orderListPc(OrderInfo orderInfo);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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<OrderInfoMapper, OrderInfo
|
||||
private IOrderInfoDetailService orderInfoDetailService;
|
||||
@Autowired
|
||||
private IInspectionInfoService iInspectionInfoService;
|
||||
|
||||
@Autowired
|
||||
private IUserBalanceService userBalanceService;
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private IShopCouponService shopCouponService;
|
||||
@Autowired
|
||||
private AdminUserService userService;
|
||||
@Autowired
|
||||
private IInspectionAppointmentService appointmentService;
|
||||
@Autowired
|
||||
private IInspectionPickCarService pickCarService;
|
||||
@Autowired
|
||||
private InspectionGoodsSkuService skuService;
|
||||
@Autowired
|
||||
private IShopInspectionGoodsService iShopInspectionService;
|
||||
@Autowired
|
||||
private IPartnerWorkerService workerService;
|
||||
@Autowired
|
||||
private IShopConfigService configService;
|
||||
@Autowired
|
||||
private IShopRepairGoodsService repairGoodsService;
|
||||
@Autowired
|
||||
private IShopMallPartnersService shopMallPartnersService;
|
||||
|
||||
@Override
|
||||
public void reviewOrder(String orderId, Integer starLevel, String reviewStr) throws Exception {
|
||||
@ -100,6 +143,661 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
return baseMapper.orderListSystem(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<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
|
||||
List<RoleDO> 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<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(sysUser.getId());
|
||||
List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
|
||||
List<String> 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<PartnerWorker> 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<InspectionAppointment> queryWrapper =new LambdaUpdateWrapper<>();
|
||||
queryWrapper.set(InspectionAppointment::getOrderId,null).eq(InspectionAppointment::getOrderId,orderId);
|
||||
appointmentService.update(queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderInfo> 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<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(sysUser.getId());
|
||||
List<RoleDO> 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<OrderInfo> 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<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(sysUser.getId());
|
||||
List<RoleDO> 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<OrderInfo> validationListWx(Page<OrderInfo> page) {
|
||||
return baseMapper.validationListWx(page,SecurityFrameworkUtils.getLoginUserId());
|
||||
}
|
||||
|
||||
// pc端核销记录 商城
|
||||
@Override
|
||||
public List<OrderInfo> validationListPc(Page<OrderInfo> 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<commentVo> getCommentOrderList(Long partnerId) {
|
||||
return baseMapper.getCommentOrderList(partnerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderInfo> orderListPc(OrderInfo orderInfo) {
|
||||
return baseMapper.orderListPc(orderInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -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<ShopCoupon> page = new Page<>(pageNum, pageSize);
|
||||
List<ShopCoupon> list = shopCouponService.selectShopCouponList(page,shopCoupon);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出优惠券列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:ShopCoupon:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ShopCoupon shopCoupon)
|
||||
{
|
||||
Page<ShopCoupon> page = new Page<>();
|
||||
List<ShopCoupon> list = shopCouponService.selectShopCouponList(page,shopCoupon);
|
||||
ExcelUtil<ShopCoupon> util = new ExcelUtil<ShopCoupon>(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<AdminUserDO> 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<ShopCoupon> 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<ShopCoupon> list = shopCouponService.getQxCouponList(getUserId(),goodId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
shopCoupon.setCouponStatus("0");
|
||||
PageDomain pageDomain = TableSupport.getPageDomain();
|
||||
PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize(), pageDomain.getOrderBy());
|
||||
List<ShopCoupon> 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<ShopCoupon> list = shopCouponService.unGetQxCouponList(getUserId(),goodId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
shopCoupon.setCouponStatus("0");
|
||||
|
||||
PageDomain pageDomain = TableSupport.getPageDomain();
|
||||
PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize(), pageDomain.getOrderBy());
|
||||
|
||||
List<ShopCoupon> list = shopCouponService.unAvailableCouponsListByUserId(shopCoupon);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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<ShopUserCar> page = new Page<>(pageNum, pageSize);
|
||||
List<ShopUserCar> list = shopUserCarService.selectShopUserCarList(page,shopUserCar);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@GetMapping("/listOfPartner")
|
||||
public TableDataInfo listOfPartner(ShopUserCar shopUserCar,@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize)
|
||||
{
|
||||
Page<ShopUserCar> page = new Page<>(pageNum, pageSize);
|
||||
List<ShopUserCar> list = shopUserCarService.selectShopUserCarList(page,shopUserCar);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 导出用户车辆列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:userCar:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ShopUserCar shopUserCar)
|
||||
{
|
||||
Page<ShopUserCar> page = new Page<>();
|
||||
List<ShopUserCar> list = shopUserCarService.selectShopUserCarList(page,shopUserCar);
|
||||
ExcelUtil<ShopUserCar> util = new ExcelUtil<ShopUserCar>(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());
|
||||
}
|
||||
}
|
@ -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<String,Object> params;
|
||||
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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<ShopCoupon>
|
||||
* @param shopCoupon 优惠券
|
||||
* @return 优惠券集合
|
||||
*/
|
||||
public List<ShopCoupon> selectShopCouponList(ShopCoupon shopCoupon);
|
||||
public List<ShopCoupon> selectShopCouponList(Page<ShopCoupon> page,@Param("vo") ShopCoupon shopCoupon);
|
||||
|
||||
/**
|
||||
* 新增优惠券
|
||||
|
@ -0,0 +1,65 @@
|
||||
package cn.iocoder.yudao.module.shop.mapper;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopRepairGoods;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 汽修商品Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-07-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface ShopRepairGoodsMapper
|
||||
{
|
||||
/**
|
||||
* 查询汽修商品
|
||||
*
|
||||
* @param id 汽修商品主键
|
||||
* @return 汽修商品
|
||||
*/
|
||||
public ShopRepairGoods selectShopRepairGoodsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询汽修商品列表
|
||||
*
|
||||
* @param shopRepairGoods 汽修商品
|
||||
* @return 汽修商品集合
|
||||
*/
|
||||
public List<ShopRepairGoods> selectShopRepairGoodsList(ShopRepairGoods shopRepairGoods);
|
||||
|
||||
/**
|
||||
* 新增汽修商品
|
||||
*
|
||||
* @param shopRepairGoods 汽修商品
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertShopRepairGoods(ShopRepairGoods shopRepairGoods);
|
||||
|
||||
/**
|
||||
* 修改汽修商品
|
||||
*
|
||||
* @param shopRepairGoods 汽修商品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateShopRepairGoods(ShopRepairGoods shopRepairGoods);
|
||||
|
||||
/**
|
||||
* 删除汽修商品
|
||||
*
|
||||
* @param id 汽修商品主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteShopRepairGoodsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除汽修商品
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteShopRepairGoodsByIds(Long[] ids);
|
||||
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -32,7 +33,7 @@ public interface ShopUserCarMapper extends BaseMapper<ShopUserCar>
|
||||
* @param shopUserCar 用户车辆
|
||||
* @return 用户车辆集合
|
||||
*/
|
||||
public List<ShopUserCar> selectShopUserCarList(ShopUserCar shopUserCar);
|
||||
public List<ShopUserCar> selectShopUserCarList(Page<ShopUserCar> page,@Param("vo") ShopUserCar shopUserCar);
|
||||
|
||||
/**
|
||||
* 新增用户车辆
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.shop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopCoupon;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopCouponTemplate;
|
||||
@ -28,7 +29,7 @@ public interface IShopCouponService extends IService<ShopCoupon>
|
||||
* @param shopCoupon 优惠券
|
||||
* @return 优惠券集合
|
||||
*/
|
||||
public List<ShopCoupon> selectShopCouponList(ShopCoupon shopCoupon);
|
||||
public List<ShopCoupon> selectShopCouponList(Page<ShopCoupon> page,ShopCoupon shopCoupon);
|
||||
|
||||
/**
|
||||
* 新增优惠券
|
||||
|
@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.shop.service;
|
||||
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopRepairGoods;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 汽修商品Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-07-08
|
||||
*/
|
||||
public interface IShopRepairGoodsService
|
||||
{
|
||||
/**
|
||||
* 查询汽修商品
|
||||
*
|
||||
* @param id 汽修商品主键
|
||||
* @return 汽修商品
|
||||
*/
|
||||
public ShopRepairGoods selectShopRepairGoodsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询汽修商品列表
|
||||
*
|
||||
* @param shopRepairGoods 汽修商品
|
||||
* @return 汽修商品集合
|
||||
*/
|
||||
public List<ShopRepairGoods> selectShopRepairGoodsList(ShopRepairGoods shopRepairGoods);
|
||||
|
||||
/**
|
||||
* 新增汽修商品
|
||||
*
|
||||
* @param shopRepairGoods 汽修商品
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertShopRepairGoods(ShopRepairGoods shopRepairGoods);
|
||||
|
||||
/**
|
||||
* 修改汽修商品
|
||||
*
|
||||
* @param shopRepairGoods 汽修商品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateShopRepairGoods(ShopRepairGoods shopRepairGoods);
|
||||
|
||||
/**
|
||||
* 批量删除汽修商品
|
||||
*
|
||||
* @param ids 需要删除的汽修商品主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteShopRepairGoodsByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除汽修商品信息
|
||||
*
|
||||
* @param id 汽修商品主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteShopRepairGoodsById(Long id);
|
||||
}
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.shop.service;
|
||||
import java.util.List;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||
|
||||
@ -28,7 +29,7 @@ public interface IShopUserCarService extends IService<ShopUserCar>
|
||||
* @param shopUserCar 用户车辆
|
||||
* @return 用户车辆集合
|
||||
*/
|
||||
public List<ShopUserCar> selectShopUserCarList(ShopUserCar shopUserCar);
|
||||
public List<ShopUserCar> selectShopUserCarList(Page<ShopUserCar> page,ShopUserCar shopUserCar);
|
||||
|
||||
/**
|
||||
* 新增用户车辆
|
||||
|
@ -9,7 +9,7 @@ import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.util.InspWechatPayConfig;
|
||||
import cn.iocoder.yudao.util.WechatPayConfig;
|
||||
import cn.iocoder.yudao.util.DateUtils;
|
||||
import cn.iocoder.yudao.module.shop.entity.PartnerDetail;
|
||||
import cn.iocoder.yudao.module.shop.mapper.PartnerDetailMapper;
|
||||
@ -60,7 +60,7 @@ public class PartnerDetailServiceImpl implements IPartnerDetailService
|
||||
@Autowired
|
||||
private IPartnerBankInfoService partnerBankInfoService;
|
||||
@Resource
|
||||
private InspWechatPayConfig inspWechatPayConfig;
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
|
||||
@ -157,7 +157,7 @@ public class PartnerDetailServiceImpl implements IPartnerDetailService
|
||||
AddReceiverRequest request =new AddReceiverRequest();
|
||||
request.setAppid(appId);
|
||||
request.setType(ReceiverType.MERCHANT_ID);
|
||||
request.setAccount(inspWechatPayConfig.getMchId());
|
||||
request.setAccount(wechatPayConfig.getMchId());
|
||||
request.setName("成都车友帮网络科技有限公司");
|
||||
request.setRelationType(ReceiverRelationType.HEADQUARTER);
|
||||
AddReceiverResponse receiverResponse = service.addReceiver(request);
|
||||
@ -215,7 +215,7 @@ public class PartnerDetailServiceImpl implements IPartnerDetailService
|
||||
queryWrapper.eq(PartnerBankInfo::getPartnerId,shopMallPartners.getPartnerId());
|
||||
PartnerBankInfo bankInfo = partnerBankInfoService.getOne(queryWrapper);
|
||||
try {
|
||||
receiversAdd(inspWechatPayConfig.getAppId(), bankInfo.getMchId(),bankInfo.getApiclientKey(),
|
||||
receiversAdd(wechatPayConfig.getAppId(), bankInfo.getMchId(),bankInfo.getApiclientKey(),
|
||||
bankInfo.getSerialNo(),bankInfo.getApiV3Key());
|
||||
}catch (Exception e){
|
||||
throw new Exception("商户信息不正确,请联系管理员");
|
||||
|
@ -12,8 +12,9 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.util.InspWechatPayConfig;
|
||||
import cn.iocoder.yudao.util.WechatPayConfig;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.iocoder.yudao.util.DateUtils;
|
||||
import cn.iocoder.yudao.module.contract.service.IInspectionContractService;
|
||||
@ -51,7 +52,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper,ShopCoup
|
||||
@Autowired
|
||||
private AdminUserService userService;
|
||||
@Resource
|
||||
private InspWechatPayConfig inspWechatPayConfig;
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
@Autowired
|
||||
private AppInspectionGoodsService appInspectionGoodsService;
|
||||
@Autowired
|
||||
@ -82,9 +83,9 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper,ShopCoup
|
||||
* @return 优惠券
|
||||
*/
|
||||
@Override
|
||||
public List<ShopCoupon> selectShopCouponList(ShopCoupon shopCoupon)
|
||||
public List<ShopCoupon> selectShopCouponList(Page<ShopCoupon> page,ShopCoupon shopCoupon)
|
||||
{
|
||||
return baseMapper.selectShopCouponList(shopCoupon);
|
||||
return baseMapper.selectShopCouponList(page,shopCoupon);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,8 +109,8 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper,ShopCoup
|
||||
try {
|
||||
AdminUserDO user = userService.getUser(shopCoupon.getUserId());
|
||||
Map<String,Object> params= new HashMap<>();
|
||||
params.put("appId",inspWechatPayConfig.getAppId());
|
||||
params.put("appSecret",inspWechatPayConfig.getAppSecret());
|
||||
params.put("appId",wechatPayConfig.getAppId());
|
||||
params.put("appSecret",wechatPayConfig.getAppSecret());
|
||||
params.put("touser",user.getJcOpenId());
|
||||
params.put("template_id",YHJ_MESSAGE);
|
||||
JSONObject data =new JSONObject();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.shop.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerBalance;
|
||||
import cn.iocoder.yudao.module.partner.service.IPartnerBalanceService;
|
||||
import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
|
||||
@ -7,6 +8,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerWorker;
|
||||
@ -130,12 +132,17 @@ public class ShopMallPartnersServiceImpl extends ServiceImpl<ShopMallPartnersMap
|
||||
}
|
||||
|
||||
}
|
||||
AdminUserDO user = userService.getUser(shopMallPartners.getUserId());
|
||||
userRoleMapper.deleteListByUserId(user.getId());
|
||||
if(null!=shopMallPartners.getUserId()){
|
||||
AdminUserDO user = userService.getUser(shopMallPartners.getUserId());
|
||||
userRoleMapper.deleteListByUserId(user.getId());
|
||||
}
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
AdminUserDO user = userService.getUser(loginUserId);
|
||||
UserRoleDO userRoleDO = new UserRoleDO();
|
||||
userRoleDO.setRoleId(113L);
|
||||
userRoleDO.setUserId(user.getId());
|
||||
userRoleDO.setUserId(loginUserId);
|
||||
userRoleMapper.insert(userRoleDO);
|
||||
|
||||
//创建账户
|
||||
PartnerBalance partnerBalance =new PartnerBalance();
|
||||
partnerBalance.setPartnerId(shopMallPartners.getPartnerId());
|
||||
|
@ -0,0 +1,159 @@
|
||||
package cn.iocoder.yudao.module.shop.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.core.page.PageDomain;
|
||||
import cn.iocoder.yudao.module.core.page.TableSupport;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopConfig;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopRepairGoods;
|
||||
import cn.iocoder.yudao.module.shop.mapper.ShopRepairGoodsMapper;
|
||||
import cn.iocoder.yudao.module.shop.service.IShopConfigService;
|
||||
import cn.iocoder.yudao.module.shop.service.IShopRepairGoodsService;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.util.StringUtils;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 汽修商品Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-07-08
|
||||
*/
|
||||
@Service
|
||||
public class ShopRepairGoodsServiceImpl implements IShopRepairGoodsService
|
||||
{
|
||||
@Autowired
|
||||
private ShopRepairGoodsMapper shopRepairGoodsMapper;
|
||||
@Autowired
|
||||
private IShopConfigService configService;
|
||||
@Autowired
|
||||
private AdminUserService userService;
|
||||
|
||||
/**
|
||||
* 查询汽修商品
|
||||
*
|
||||
* @param id 汽修商品主键
|
||||
* @return 汽修商品
|
||||
*/
|
||||
@Override
|
||||
public ShopRepairGoods selectShopRepairGoodsById(Long id)
|
||||
{
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
AdminUserDO sysUser = userService.getUser(userId);
|
||||
Integer userLevel = sysUser.getUserLevel();
|
||||
ShopRepairGoods good = shopRepairGoodsMapper.selectShopRepairGoodsById(id);
|
||||
//处理图片格式
|
||||
if (!StringUtils.isEmpty(good.getImages())){
|
||||
good.setImageList(good.getImages().split(","));
|
||||
}
|
||||
ShopConfig shopConfig = configService.selectShopConfigById(1L);
|
||||
//原价单位分
|
||||
Long priceFen = good.getPrice();
|
||||
Double priceYuan= priceFen.doubleValue()/100d;
|
||||
good.setOriginalPrice(BigDecimal.valueOf(priceYuan));
|
||||
if (good.getIsSpecial()==1|| ObjectUtils.isEmpty(userLevel)||0==userLevel){
|
||||
//直接计算原价
|
||||
good.setRealPrice(BigDecimal.valueOf(priceYuan));
|
||||
}
|
||||
else if (userLevel==1){
|
||||
//白银会员
|
||||
//获取会员的优惠折扣
|
||||
BigDecimal inspectionPlatinum = shopConfig.getRepairSilver();
|
||||
Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
|
||||
good.setRealPrice(BigDecimal.valueOf(priceYuan*ratio).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
}else if (userLevel==2){
|
||||
//黄金会员
|
||||
BigDecimal inspectionPlatinum = shopConfig.getRepairGold();
|
||||
Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
|
||||
good.setRealPrice(BigDecimal.valueOf(priceYuan*ratio).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}else if (userLevel==3){
|
||||
//白金会员
|
||||
BigDecimal inspectionPlatinum = shopConfig.getRepairPlatinum();
|
||||
Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
|
||||
good.setRealPrice(BigDecimal.valueOf(priceYuan*ratio).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
return good;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汽修商品列表
|
||||
*
|
||||
* @param shopRepairGoods 汽修商品
|
||||
* @return 汽修商品
|
||||
*/
|
||||
@Override
|
||||
public List<ShopRepairGoods> selectShopRepairGoodsList(ShopRepairGoods shopRepairGoods)
|
||||
{
|
||||
ShopConfig shopConfig = configService.selectShopConfigById(1L);
|
||||
//获取最高会员的优惠折扣
|
||||
BigDecimal inspectionPlatinum = shopConfig.getRepairPlatinum();
|
||||
Double ratio = inspectionPlatinum.divide(BigDecimal.valueOf(10)).doubleValue();
|
||||
PageDomain pageDomain = TableSupport.getPageDomain();
|
||||
PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize(), pageDomain.getOrderBy());
|
||||
List<ShopRepairGoods> shopInspectionRes = shopRepairGoodsMapper.selectShopRepairGoodsList(shopRepairGoods);
|
||||
for (ShopRepairGoods good : shopInspectionRes) {
|
||||
if (good.getIsSpecial().equals(0)){
|
||||
//原价单位分
|
||||
Long priceFen = good.getPrice();
|
||||
Double priceYuan= priceFen.doubleValue()/100d;
|
||||
good.setLowPrice(BigDecimal.valueOf(priceYuan*ratio).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
return shopInspectionRes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增汽修商品
|
||||
*
|
||||
* @param shopRepairGoods 汽修商品
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertShopRepairGoods(ShopRepairGoods shopRepairGoods)
|
||||
{
|
||||
return shopRepairGoodsMapper.insertShopRepairGoods(shopRepairGoods);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改汽修商品
|
||||
*
|
||||
* @param shopRepairGoods 汽修商品
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateShopRepairGoods(ShopRepairGoods shopRepairGoods)
|
||||
{
|
||||
return shopRepairGoodsMapper.updateShopRepairGoods(shopRepairGoods);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除汽修商品
|
||||
*
|
||||
* @param ids 需要删除的汽修商品主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteShopRepairGoodsByIds(Long[] ids)
|
||||
{
|
||||
return shopRepairGoodsMapper.deleteShopRepairGoodsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除汽修商品信息
|
||||
*
|
||||
* @param id 汽修商品主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteShopRepairGoodsById(Long id)
|
||||
{
|
||||
return shopRepairGoodsMapper.deleteShopRepairGoodsById(id);
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.util.IDCardOCR;
|
||||
import cn.iocoder.yudao.util.VehicleLicenseOCR;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.iocoder.yudao.util.StringUtils;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopCoupon;
|
||||
@ -63,9 +64,9 @@ public class ShopUserCarServiceImpl extends ServiceImpl<ShopUserCarMapper,ShopUs
|
||||
* @return 用户车辆
|
||||
*/
|
||||
@Override
|
||||
public List<ShopUserCar> selectShopUserCarList(ShopUserCar shopUserCar)
|
||||
public List<ShopUserCar> selectShopUserCarList(Page<ShopUserCar> page,ShopUserCar shopUserCar)
|
||||
{
|
||||
return baseMapper.selectShopUserCarList(shopUserCar);
|
||||
return baseMapper.selectShopUserCarList(page,shopUserCar);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,160 +0,0 @@
|
||||
package cn.iocoder.yudao.util;
|
||||
|
||||
|
||||
import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
|
||||
import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
|
||||
import com.wechat.pay.contrib.apache.httpclient.auth.Verifier;
|
||||
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
|
||||
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator;
|
||||
import com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager;
|
||||
import com.wechat.pay.contrib.apache.httpclient.exception.HttpCodeException;
|
||||
import com.wechat.pay.contrib.apache.httpclient.exception.NotFoundException;
|
||||
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.PrivateKey;
|
||||
|
||||
/**
|
||||
* @Author:
|
||||
* @Description:
|
||||
**/
|
||||
@Component
|
||||
@Data
|
||||
@Slf4j
|
||||
public class InspWechatPayConfig {
|
||||
/**
|
||||
* 应用编号
|
||||
*/
|
||||
private String appId="wxe6518d72cb71a852";
|
||||
/**
|
||||
* 商户号
|
||||
*/
|
||||
private String mchId="1625105516";
|
||||
/**
|
||||
* 服务商商户号
|
||||
*/
|
||||
private String slMchId="1652687637";
|
||||
/**
|
||||
* APIv2密钥
|
||||
*/
|
||||
private String apiKey="";
|
||||
/**
|
||||
* APIv3密钥
|
||||
*/
|
||||
private String apiV3Key="9FA68244F52293311637F7AE2C516CA2";
|
||||
/**
|
||||
* 支付通知回调地址
|
||||
*/
|
||||
private String notifyUrl="https://www.nuoyunr.com/rescue/rescuePayApi/payNotify";
|
||||
/**
|
||||
* 退款回调地址
|
||||
*/
|
||||
private String refundNotifyUrl="https://www.nuoyunr.com/jdcJc/notify/refundNotify";
|
||||
|
||||
/**
|
||||
* API 证书中的 key.pem
|
||||
*/
|
||||
private String keyPemPath="apiclient_key.pem";
|
||||
|
||||
/**
|
||||
* 商户序列号
|
||||
*/
|
||||
private String serialNo="1CF257917547049CDEED041FF683E29FABAF99CB";
|
||||
private String appSecret="ab94673dd0cca78abd0a453d0aac9f98";
|
||||
/**
|
||||
* 微信支付V3-url前缀
|
||||
*/
|
||||
private String baseUrl;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取商户的私钥文件
|
||||
* @param keyPemPath
|
||||
* @return
|
||||
*/
|
||||
public PrivateKey getPrivateKey(String keyPemPath){
|
||||
log.info("进入获取");
|
||||
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(keyPemPath);
|
||||
if(inputStream==null){
|
||||
log.info("私钥文件不存在");
|
||||
throw new RuntimeException("私钥文件不存在");
|
||||
}
|
||||
log.info("存在");
|
||||
return PemUtil.loadPrivateKey(inputStream);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取证书管理器实例
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Verifier getVerifier() throws GeneralSecurityException, IOException, HttpCodeException, NotFoundException {
|
||||
|
||||
log.info("获取证书管理器实例");
|
||||
|
||||
//获取商户私钥
|
||||
PrivateKey privateKey = getPrivateKey(keyPemPath);
|
||||
|
||||
//私钥签名对象
|
||||
PrivateKeySigner privateKeySigner = new PrivateKeySigner(serialNo, privateKey);
|
||||
|
||||
//身份认证对象
|
||||
WechatPay2Credentials wechatPay2Credentials = new WechatPay2Credentials(mchId, privateKeySigner);
|
||||
|
||||
// 使用定时更新的签名验证器,不需要传入证书
|
||||
CertificatesManager certificatesManager = CertificatesManager.getInstance();
|
||||
certificatesManager.putMerchant(mchId,wechatPay2Credentials,apiV3Key.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
return certificatesManager.getVerifier(mchId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取支付http请求对象
|
||||
* @param verifier
|
||||
* @return
|
||||
*/
|
||||
@Bean(name = "wxPayClient")
|
||||
public CloseableHttpClient getWxPayClient(Verifier verifier) {
|
||||
|
||||
//获取商户私钥
|
||||
PrivateKey privateKey = getPrivateKey(keyPemPath);
|
||||
|
||||
WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
|
||||
.withMerchant(mchId, serialNo, privateKey)
|
||||
.withValidator(new WechatPay2Validator(verifier));
|
||||
|
||||
// 通过WechatPayHttpClientBuilder构造的HttpClient,会自动的处理签名和验签,并进行证书自动更新
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取HttpClient,无需进行应答签名验证,跳过验签的流程
|
||||
*/
|
||||
@Bean(name = "wxPayNoSignClient")
|
||||
public CloseableHttpClient getWxPayNoSignClient(){
|
||||
|
||||
//获取商户私钥
|
||||
PrivateKey privateKey = getPrivateKey(keyPemPath);
|
||||
|
||||
//用于构造HttpClient
|
||||
WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
|
||||
//设置商户信息
|
||||
.withMerchant(mchId, serialNo, privateKey)
|
||||
//无需进行签名验证、通过withValidator((response) -> true)实现
|
||||
.withValidator((response) -> true);
|
||||
|
||||
// 通过WechatPayHttpClientBuilder构造的HttpClient,会自动的处理签名和验签,并进行证书自动更新
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectAppSwiperList" parameterType="cn.iocoder.yudao.module.appBase.entity.AppSwiper" resultMap="AppSwiperResult">
|
||||
<include refid="selectAppSwiperVo"/>
|
||||
<where>
|
||||
<if test="moudleName != null and moudleName != ''"> and moudle_name like concat('%', #{moudleName}, '%')</if>
|
||||
<if test="swiperName != null and swiperName != ''"> and swiper_name like concat('%', #{swiperName}, '%')</if>
|
||||
<if test="swiperPicture != null and swiperPicture != ''"> and swiper_picture = #{swiperPicture}</if>
|
||||
<if test="jumpUrl != null and jumpUrl != ''"> and jump_url = #{jumpUrl}</if>
|
||||
<if test="listOrder != null "> and list_order = #{listOrder}</if>
|
||||
<if test="vo.moudleName != null and vo.moudleName != ''"> and moudle_name like concat('%', #{vo.moudleName}, '%')</if>
|
||||
<if test="vo.swiperName != null and vo.swiperName != ''"> and swiper_name like concat('%', #{vo.swiperName}, '%')</if>
|
||||
<if test="vo.swiperPicture != null and vo.swiperPicture != ''"> and swiper_picture = #{vo.swiperPicture}</if>
|
||||
<if test="vo.jumpUrl != null and vo.jumpUrl != ''"> and jump_url = #{vo.jumpUrl}</if>
|
||||
<if test="vo.listOrder != null "> and list_order = #{vo.listOrder}</if>
|
||||
</where>
|
||||
order by list_order asc
|
||||
</select>
|
||||
|
@ -177,17 +177,17 @@ where sig.partner_id =#{partnerId}
|
||||
</select>
|
||||
<select id="getWorkList" resultType="cn.iocoder.yudao.module.partner.entity.PartnerWorker">
|
||||
SELECT
|
||||
pw.id,pw.user_id,su.real_name as workName,su.phonenumber as workPhone, su.avatar
|
||||
pw.id,pw.user_id,su.nickname as workName,su.mobile as workPhone, su.avatar
|
||||
FROM
|
||||
partner_worker pw
|
||||
INNER JOIN sys_user su ON pw.user_id = su.user_id
|
||||
left JOIN sys_user_post sup on sup.user_id = su.user_id
|
||||
INNER JOIN system_users su ON pw.user_id = su.id
|
||||
left JOIN system_user_post sup on sup.user_id = su.id
|
||||
where pw.partner_id = #{partnerId}
|
||||
<if test="workName!=null and workName!=''">
|
||||
and su.real_name like concat('%',#{workName},'%')
|
||||
and su.nickname like concat('%',#{workName},'%')
|
||||
</if>
|
||||
<if test="phoneNum!=null and phoneNum!=''">
|
||||
and su.phonenumber like concat('%',#{phoneNum},'%')
|
||||
and su.mobile like concat('%',#{phoneNum},'%')
|
||||
</if>
|
||||
<if test="postId!=null and postId!=''">
|
||||
and sup.post_id = #{postId}
|
||||
@ -197,11 +197,11 @@ where sig.partner_id =#{partnerId}
|
||||
<select id="inspectionList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
SELECT
|
||||
info.id,info.worker_name,info.worker_phone,info.worker_avatar,info.`status`,info.is_pass,info.start_time,info.end_time,step.title as lastTitle,
|
||||
su.real_name buyName,su.phonenumber as buyPhone,oi.order_no as orderNo,oi.pay_money+oi.balance as realPayMoney,oi.goods_title as goodsName,info.car_num,info.is_retrial
|
||||
su.nickname buyName,su.mobile as buyPhone,oi.order_no as orderNo,oi.pay_money+oi.balance as realPayMoney,oi.goods_title as goodsName,info.car_num,info.is_retrial
|
||||
from
|
||||
inspection_info info
|
||||
LEFT JOIN inspection_step_info step ON info.id = step.inspection_info_id
|
||||
INNER JOIN sys_user su on su.user_id = info.user_id
|
||||
INNER JOIN system_users su on su.id = info.user_id
|
||||
INNER JOIN order_info oi on oi.id = info.inspection_order_id
|
||||
WHERE info.status = #{status} and info.partner_id = #{partnerId}
|
||||
<if test="carNum!=null and carNum!=''">
|
||||
@ -213,11 +213,11 @@ where sig.partner_id =#{partnerId}
|
||||
<select id="workerInspectionList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
SELECT
|
||||
info.id,info.worker_name,info.worker_phone,info.worker_avatar,info.`status`,info.is_pass,info.start_time,info.end_time,step.title as lastTitle,
|
||||
su.real_name buyName,su.phonenumber as buyPhone,oi.order_no as orderNo,oi.pay_money+oi.balance as realPayMoney,oi.goods_title as goodsName,info.car_num,info.is_retrial
|
||||
su.nickname buyName,su.mobile as buyPhone,oi.order_no as orderNo,oi.pay_money+oi.balance as realPayMoney,oi.goods_title as goodsName,info.car_num,info.is_retrial
|
||||
from
|
||||
inspection_info info
|
||||
LEFT JOIN inspection_step_info step ON info.id = step.inspection_info_id
|
||||
INNER JOIN sys_user su on su.user_id = info.user_id
|
||||
INNER JOIN system_users su on su.id = info.user_id
|
||||
INNER JOIN order_info oi on oi.id = info.inspection_order_id
|
||||
WHERE info.status = #{status} and info.work_id = #{workerId}
|
||||
<if test="searchValue!=null and searchValue!=''">
|
||||
@ -388,15 +388,15 @@ FROM
|
||||
</select>
|
||||
<select id="staticsTable5" resultType="java.util.Map">
|
||||
SELECT
|
||||
ROUND(IFNULL(SUM(oi.goods_price),0)/100) theAmount,su.real_name theName
|
||||
ROUND(IFNULL(SUM(oi.goods_price),0)/100) theAmount,su.nickname theName
|
||||
FROM
|
||||
order_info oi
|
||||
INNER JOIN inspection_info ii on oi.id = ii.inspection_order_id
|
||||
inner join sys_user su on su.user_id = oi.user_id
|
||||
inner join system_user su on su.id = oi.user_id
|
||||
WHERE oi.partner_id ='19'
|
||||
and ii.create_time BETWEEN #{startTime} and #{endTime}
|
||||
and oi.validation_time is null and ii.`status`='1' and ii.is_pass = '1'
|
||||
GROUP BY su.user_id
|
||||
GROUP BY su.id
|
||||
order by theAmount desc
|
||||
</select>
|
||||
<select id="dhjNum" resultType="java.lang.Long">
|
||||
|
@ -93,28 +93,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
<select id="getAppointmentList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionAppointment">
|
||||
SELECT
|
||||
ip.*,su.phonenumber as buyPhoneNum,su.real_name as buyName,ip.goods_title as goodsTitle,
|
||||
ip.*,su.mobile as buyPhoneNum,su.nickname as buyName,ip.goods_title as goodsTitle,
|
||||
suc.car_nature,suc.car_brand,suc.car_model,suc.car_no
|
||||
FROM
|
||||
inspection_appointment ip
|
||||
INNER JOIN sys_user su ON ip.user_id = su.user_id
|
||||
INNER JOIN system_users su ON ip.user_id = su.id
|
||||
left JOIN order_info oi ON ip.order_id = oi.id
|
||||
left join shop_user_car suc on suc.car_id = oi.user_car_id
|
||||
where ip.partner_id = #{partnerId}
|
||||
<if test="phoneNum!=null and phoneNum!=''">
|
||||
and su.phonenumber like concat('%',#{phoneNum},'%')
|
||||
and su.mobile like concat('%',#{phoneNum},'%')
|
||||
</if>
|
||||
order by ip.create_time desc
|
||||
</select>
|
||||
<select id="getAppointmentOwn" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionAppointment">
|
||||
SELECT
|
||||
ip.*,su.phonenumber as buyPhoneNum,su.real_name as buyName,ip.goods_title as goodsTitle,
|
||||
suc.car_nature,suc.car_brand,suc.car_model,suc.car_no
|
||||
ip.*,su.mobile as buyPhoneNum,su.nickname as buyName,ip.goods_title as goodsTitle,
|
||||
suc.car_nature,suc.car_brand,suc.car_model,suc.car_no
|
||||
FROM
|
||||
inspection_appointment ip
|
||||
INNER JOIN sys_user su ON ip.user_id = su.user_id
|
||||
left JOIN order_info oi ON ip.order_id = oi.id
|
||||
left join shop_user_car suc on suc.car_id = oi.user_car_id
|
||||
inspection_appointment ip
|
||||
INNER JOIN system_users su ON ip.user_id = su.id
|
||||
left JOIN order_info oi ON ip.order_id = oi.id
|
||||
left join shop_user_car suc on suc.car_id = oi.user_car_id
|
||||
where ip.user_id = #{userId}
|
||||
order by ip.create_time desc
|
||||
</select>
|
||||
|
@ -122,12 +122,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="workOrder" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
select ins.*,oi.goods_title,su.real_name as buyName,su.phonenumber as buyPhone,oi.sku_name,oi.pay_money as realPayMoney
|
||||
select ins.*,oi.goods_title,su.nickname as buyName,su.mobile as buyPhone,oi.sku_name,oi.pay_money as realPayMoney
|
||||
,oi.pay_type,oi.order_status as orderStatus,oi.goods_id,oi.sku_id,oi.pay_time,oi.goods_price,ins.create_time
|
||||
from inspection_info ins
|
||||
left join order_info oi on oi.id = ins.inspection_order_id
|
||||
left join sys_user su on su.user_id = ins.user_id
|
||||
left join sys_user_role sur on sur.user_id = su.user_id
|
||||
left join system_users su on su.id = ins.user_id
|
||||
left join system_user_role sur on sur.user_id = su.id
|
||||
where 1=1 and ins.partner_id = #{partnerId}
|
||||
<if test="carNum!=null and carNum!=''">
|
||||
and ins.car_num like concat('%',#{carNum},'%')
|
||||
@ -152,12 +152,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="delworkOrder" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
select ins.*,oi.goods_title,su.real_name as buyName,su.phonenumber as buyPhone,oi.sku_name,oi.pay_money as realPayMoney
|
||||
select ins.*,oi.goods_title,su.nickname as buyName,su.mobile as buyPhone,oi.sku_name,oi.pay_money as realPayMoney
|
||||
,oi.pay_type,oi.order_status as orderStatus,oi.goods_id,oi.sku_id,oi.pay_time,oi.goods_price,ins.create_time
|
||||
from del_inspection_info ins
|
||||
left join del_order_info oi on oi.id = ins.inspection_order_id
|
||||
left join sys_user su on su.user_id = ins.user_id
|
||||
left join sys_user_role sur on sur.user_id = su.user_id
|
||||
left join system_users su on su.id = ins.user_id
|
||||
left join system_user_role sur on sur.user_id = su.id
|
||||
where 1=1 and ins.partner_id = #{partnerId}
|
||||
<if test="carNum!=null and carNum!=''">
|
||||
and ins.car_num like concat('%',#{carNum},'%')
|
||||
@ -185,8 +185,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select ifnull(sum(oi.pay_money),0) as payMoneySum,ifnull(sum(oi.goods_price),0) goodsPriceSum
|
||||
from inspection_info ins
|
||||
left join order_info oi on oi.id = ins.inspection_order_id
|
||||
left join sys_user su on su.user_id = ins.user_id
|
||||
left join sys_user_role sur on sur.user_id = su.user_id
|
||||
left join system_users su on su.id = ins.user_id
|
||||
left join system_user_role sur on sur.user_id = su.id
|
||||
where 1=1 and ins.partner_id = #{partnerId}
|
||||
<if test="carNum!=null and carNum!=''">
|
||||
and ins.car_num like concat('%',#{carNum},'%')
|
||||
|
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.partner.mapper.PartnerCustomerInfoMapper">
|
||||
|
||||
<resultMap type="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo" id="PartnerCustomerInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="partnerId" column="partner_id" />
|
||||
<result property="customerName" column="customer_name" />
|
||||
<result property="customerPhone" column="customer_phone" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="sex" column="sex" />
|
||||
<result property="userAge" column="user_age" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="creator" column="creator" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updater" column="updater" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPartnerCustomerInfoVo">
|
||||
select id, partner_id, customer_name, customer_phone, user_id, sex, user_age, dept_id, create_time, creator, update_time, updater from partner_customer_info
|
||||
</sql>
|
||||
|
||||
<select id="selectPartnerCustomerInfoList" parameterType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo" resultMap="PartnerCustomerInfoResult">
|
||||
select pci.*,sr.name from partner_customer_info pci
|
||||
left join shop_user_car suc on suc.user_id = pci.user_id
|
||||
left join system_users su on su.id = pci.user_id
|
||||
left join system_user_role sur on sur.user_id = su.id
|
||||
left join system_role sr on sr.id = sur.role_id
|
||||
<where>
|
||||
and pci.partner_id = #{partnerId}
|
||||
<if test="carNum != null and carNum != ''"> and suc.car_no like concat('%', #{carNum}, '%')</if>
|
||||
<if test="customerName != null and customerName != ''"> and pci.customer_name like concat('%', #{customerName}, '%')</if>
|
||||
<if test="customerPhone != null and customerPhone != ''"> and pci.customer_phone like concat('%', #{customerPhone}, '%')</if>
|
||||
<if test="roleCode != null and roleCode != ''"> and sr.code = #{roleCode}</if>
|
||||
|
||||
</where>
|
||||
group by pci.id
|
||||
order by suc.next_inspection_date
|
||||
</select>
|
||||
|
||||
<select id="selectPartnerCustomerInfoById" parameterType="Long" resultMap="PartnerCustomerInfoResult">
|
||||
<include refid="selectPartnerCustomerInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPartnerCustomerInfo" parameterType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo">
|
||||
insert into partner_customer_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="partnerId != null">partner_id,</if>
|
||||
<if test="customerName != null">customer_name,</if>
|
||||
<if test="customerPhone != null">customer_phone,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="sex != null">sex,</if>
|
||||
<if test="userAge != null">user_age,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="creator != null">creator,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updater != null">updater,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="partnerId != null">#{partnerId},</if>
|
||||
<if test="customerName != null">#{customerName},</if>
|
||||
<if test="customerPhone != null">#{customerPhone},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="sex != null">#{sex},</if>
|
||||
<if test="userAge != null">#{userAge},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="creator != null">#{creator},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updater != null">#{updater},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updatePartnerCustomerInfo" parameterType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo">
|
||||
update partner_customer_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="partnerId != null">partner_id = #{partnerId},</if>
|
||||
<if test="customerName != null">customer_name = #{customerName},</if>
|
||||
<if test="customerPhone != null">customer_phone = #{customerPhone},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="sex != null">sex = #{sex},</if>
|
||||
<if test="userAge != null">user_age = #{userAge},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="creator != null">creator = #{creator},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updater != null">updater = #{updater},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletePartnerCustomerInfoById" parameterType="Long">
|
||||
delete from partner_customer_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePartnerCustomerInfoByIds" parameterType="String">
|
||||
delete from partner_customer_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -43,8 +43,8 @@
|
||||
oi.goods_title,
|
||||
oi.goods_title,
|
||||
oi.goods_type,
|
||||
su.real_name AS realName,
|
||||
su.phonenumber,
|
||||
su.nickname AS realName,
|
||||
su.mobile as phonenumber,
|
||||
oi.goods_price,
|
||||
oi.pay_money,
|
||||
oi.order_time,
|
||||
@ -56,7 +56,7 @@
|
||||
suc.car_no
|
||||
FROM
|
||||
`order_info` oi
|
||||
LEFT JOIN sys_user su ON su.user_id = oi.user_id
|
||||
LEFT JOIN system_users su ON su.id = oi.user_id
|
||||
left join shop_user_car suc on suc.car_id = oi.user_car_id
|
||||
where 1=1
|
||||
<if test="orderStatus!=null and orderStatus!='' ">
|
||||
@ -78,7 +78,7 @@
|
||||
and oi.validation_real_name like concat('%',#{validationRealName},'%')
|
||||
</if>
|
||||
<if test="phonenumber!=null and phonenumber!='' ">
|
||||
and su.phonenumber like concat('%',#{phonenumber},'%')
|
||||
and su.mobile like concat('%',#{phonenumber},'%')
|
||||
</if>
|
||||
<if test="realPayMoney!=null ">
|
||||
and oi.pay_money <![CDATA[>=]]> #{realPayMoney}
|
||||
|
@ -29,34 +29,34 @@
|
||||
<sql id="selectShopCouponVo">
|
||||
select coupon_id,title, coupon_type, coupon_code, bind_moudle, bind_goods_ids, discount, start_time,
|
||||
expiration_time, use_time, coupon_status, shop_coupon.creator, shop_coupon.create_time, shop_coupon.updater,
|
||||
shop_coupon.update_time,shop_coupon.user_id,order_id,shop_coupon.phonenumber,sys_user.real_name from shop_coupon
|
||||
LEFT JOIN sys_user on shop_coupon.user_id = sys_user.user_id
|
||||
shop_coupon.update_time,shop_coupon.user_id,order_id,shop_coupon.phonenumber,sys_user.nickname from shop_coupon shop_coupon
|
||||
LEFT JOIN system_users sys_user on shop_coupon.user_id = sys_user.id
|
||||
</sql>
|
||||
|
||||
<select id="selectShopCouponList" parameterType="cn.iocoder.yudao.module.shop.entity.ShopCoupon" resultMap="ShopCouponResult">
|
||||
<include refid="selectShopCouponVo"/>
|
||||
<where>
|
||||
<if test="couponType != null and couponType != ''"> and coupon_type = #{couponType}</if>
|
||||
<if test="couponCode != null and couponCode != ''"> and coupon_code like concat('%', #{couponCode}, '%')</if>
|
||||
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
|
||||
<if test="bindMoudle != null and bindMoudle != ''"> and bind_moudle = #{bindMoudle}</if>
|
||||
<if test="bindGoodsIds != null and bindGoodsIds != ''"> and bind_goods_ids = #{bindGoodsIds}</if>
|
||||
<if test="realName != null "> and sys_user.real_name like concat('%', #{realName}, '%')</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||
<if test="phonenumber != null and phonenumber != ''"> and phonenumber like concat('%', #{phonenumber}, '%')</if>
|
||||
<if test="params.beginStartTime != null and params.beginStartTime != '' and params.endStartTime != null and params.endStartTime != ''"> and start_time between #{params.beginStartTime} and #{params.endStartTime}</if>
|
||||
<if test="params.beginExpirationTime != null and params.beginExpirationTime != '' and params.endExpirationTime != null and params.endExpirationTime != ''"> and expiration_time between #{params.beginExpirationTime} and #{params.endExpirationTime}</if>
|
||||
<if test="params.beginUseTime != null and params.beginUseTime != '' and params.endUseTime != null and params.endUseTime != ''"> and use_time between #{params.beginUseTime} and #{params.endUseTime}</if>
|
||||
<if test="couponStatus != null and couponStatus != ''">
|
||||
<if test="vo.couponType != null and vo.couponType != ''"> and coupon_type = #{vo.couponType}</if>
|
||||
<if test="vo.couponCode != null and vo.couponCode != ''"> and coupon_code like concat('%', #{vo.couponCode}, '%')</if>
|
||||
<if test="vo.title != null and vo.title != ''"> and title like concat('%', #{vo.title}, '%')</if>
|
||||
<if test="vo.bindMoudle != null and vo.bindMoudle != ''"> and bind_moudle = #{vo.bindMoudle}</if>
|
||||
<if test="vo.bindGoodsIds != null and vo.bindGoodsIds != ''"> and bind_goods_ids = #{vo.bindGoodsIds}</if>
|
||||
<if test="vo.realName != null "> and sys_user.nickname like concat('%', #{vo.realName}, '%')</if>
|
||||
<if test="vo.userId != null "> and user_id = #{vo.userId}</if>
|
||||
<if test="vo.orderId != null "> and order_id = #{vo.orderId}</if>
|
||||
<if test="vo.phonenumber != null and vo.phonenumber != ''"> and phonenumber like concat('%', #{vo.phonenumber}, '%')</if>
|
||||
<if test="vo.params.beginStartTime != null and vo.params.beginStartTime != '' and vo.params.endStartTime != null and vo.params.endStartTime != ''"> and start_time between #{vo.params.beginStartTime} and #{vo.params.endStartTime}</if>
|
||||
<if test="vo.params.beginExpirationTime != null and vo.params.beginExpirationTime != '' and vo.params.endExpirationTime != null and vo.params.endExpirationTime != ''"> and expiration_time between #{vo.params.beginExpirationTime} and #{vo.params.endExpirationTime}</if>
|
||||
<if test="vo.params.beginUseTime != null and vo.params.beginUseTime != '' and vo.params.endUseTime != null and vo.params.endUseTime != ''"> and use_time between #{vo.params.beginUseTime} and #{vo.params.endUseTime}</if>
|
||||
<if test="vo.couponStatus != null and vo.couponStatus != ''">
|
||||
<choose>
|
||||
<when test="couponStatus='0'.toString()">
|
||||
and now() BETWEEN start_time AND expiration_time and coupon_status = #{couponStatus}
|
||||
<when test="vo.couponStatus='0'.toString()">
|
||||
and now() BETWEEN start_time AND expiration_time and coupon_status = #{vo.couponStatus}
|
||||
</when>
|
||||
<when test="couponStatus='1'.toString()">
|
||||
and coupon_status = #{couponStatus}
|
||||
<when test="vo.couponStatus='1'.toString()">
|
||||
and coupon_status = #{vo.couponStatus}
|
||||
</when>
|
||||
<when test="couponStatus='2'.toString()">
|
||||
<when test="vo.couponStatus='2'.toString()">
|
||||
and coupon_status = '0' and now() <![CDATA[>]]> expiration_time
|
||||
</when>
|
||||
</choose>
|
||||
@ -79,7 +79,7 @@
|
||||
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
|
||||
<if test="bindMoudle != null and bindMoudle != ''"> and bind_moudle = #{bindMoudle}</if>
|
||||
<if test="bindGoodsIds != null and bindGoodsIds != ''"> and bind_goods_ids = #{bindGoodsIds}</if>
|
||||
<if test="userId != null "> and sys_user.user_id = #{userId}</if>
|
||||
<if test="userId != null "> and sys_user.id = #{userId}</if>
|
||||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||
<if test="phonenumber != null and phonenumber != ''"> and phonenumber like concat('%', #{phonenumber}, '%')</if>
|
||||
<if test="params.beginStartTime != null and params.beginStartTime != '' and params.endStartTime != null and params.endStartTime != ''"> and start_time between #{params.beginStartTime} and #{params.endStartTime}</if>
|
||||
|
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.shop.mapper.ShopRepairGoodsMapper">
|
||||
|
||||
<resultMap type="cn.iocoder.yudao.module.shop.entity.ShopRepairGoods" id="ShopRepairGoodsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="categoryId" column="category_id" />
|
||||
<result property="title" column="title" />
|
||||
<result property="price" column="price" />
|
||||
<result property="image" column="image" />
|
||||
<result property="images" column="images" />
|
||||
<result property="isSpecial" column="is_special" />
|
||||
<result property="goodsDesc" column="goods_desc" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectShopRepairGoodsVo">
|
||||
select id, category_id, title, price, image, images, is_special, goods_desc from shop_repair_goods
|
||||
</sql>
|
||||
|
||||
<select id="selectShopRepairGoodsList" parameterType="cn.iocoder.yudao.module.shop.entity.ShopRepairGoods" resultMap="ShopRepairGoodsResult">
|
||||
<include refid="selectShopRepairGoodsVo"/>
|
||||
<where>
|
||||
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
||||
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
|
||||
<if test="isSpecial != null "> and is_special = #{isSpecial}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectShopRepairGoodsById" parameterType="Long" resultMap="ShopRepairGoodsResult">
|
||||
<include refid="selectShopRepairGoodsVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertShopRepairGoods" parameterType="cn.iocoder.yudao.module.shop.entity.ShopRepairGoods" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into shop_repair_goods
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="categoryId != null">category_id,</if>
|
||||
<if test="title != null">title,</if>
|
||||
<if test="price != null">price,</if>
|
||||
<if test="image != null">image,</if>
|
||||
<if test="images != null">images,</if>
|
||||
<if test="isSpecial != null">is_special,</if>
|
||||
<if test="goodsDesc != null">goods_desc,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="categoryId != null">#{categoryId},</if>
|
||||
<if test="title != null">#{title},</if>
|
||||
<if test="price != null">#{price},</if>
|
||||
<if test="image != null">#{image},</if>
|
||||
<if test="images != null">#{images},</if>
|
||||
<if test="isSpecial != null">#{isSpecial},</if>
|
||||
<if test="goodsDesc != null">#{goodsDesc},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateShopRepairGoods" parameterType="cn.iocoder.yudao.module.shop.entity.ShopRepairGoods">
|
||||
update shop_repair_goods
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="categoryId != null">category_id = #{categoryId},</if>
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="price != null">price = #{price},</if>
|
||||
<if test="image != null">image = #{image},</if>
|
||||
<if test="images != null">images = #{images},</if>
|
||||
<if test="isSpecial != null">is_special = #{isSpecial},</if>
|
||||
<if test="goodsDesc != null">goods_desc = #{goodsDesc},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteShopRepairGoodsById" parameterType="Long">
|
||||
delete from shop_repair_goods where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteShopRepairGoodsByIds" parameterType="String">
|
||||
delete from shop_repair_goods where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -30,25 +30,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select car_id, shop_user_car.user_id, car_model, shop_user_car.car_no, maintenance_date, maintenance_mileage,
|
||||
inspection_date, insurance_date, next_maintenance_date, next_maintenance_mileage,
|
||||
next_inspection_date, insurance_expiry_date,car_brand,car_nature,car_register_date,car_license_img,
|
||||
sys_user.real_name,sys_user.phonenumber
|
||||
from shop_user_car left join sys_user on shop_user_car.user_id = sys_user.user_id
|
||||
sys_user.nickname realName,sys_user.mobile phonenumber
|
||||
from shop_user_car shop_user_car left join system_users sys_user on shop_user_car.user_id = sys_user.id
|
||||
</sql>
|
||||
|
||||
<select id="selectShopUserCarList" parameterType="cn.iocoder.yudao.module.shop.entity.ShopUserCar" resultMap="ShopUserCarResult">
|
||||
<include refid="selectShopUserCarVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and sys_user.user_id = #{userId}</if>
|
||||
<if test="carNature != null "> and car_nature = #{carNature}</if>
|
||||
<if test="realName != null "> and sys_user.real_name like concat('%', #{realName}, '%')</if>
|
||||
<if test="carNo != null and carNo != ''"> and shop_user_car.car_no like concat('%', #{carNo}, '%')</if>
|
||||
<if test="params.beginMaintenanceDate != null and params.beginMaintenanceDate != '' and params.endMaintenanceDate != null and params.endMaintenanceDate != ''"> and maintenance_date between #{params.beginMaintenanceDate} and #{params.endMaintenanceDate}</if>
|
||||
<if test="params.beginMaintenanceMileage != null and params.beginMaintenanceMileage != '' and params.endMaintenanceMileage != null and params.endMaintenanceMileage != ''"> and maintenance_mileage between #{params.beginMaintenanceMileage} and #{params.endMaintenanceMileage}</if>
|
||||
<if test="params.beginInspectionDate != null and params.beginInspectionDate != '' and params.endInspectionDate != null and params.endInspectionDate != ''"> and inspection_date between #{params.beginInspectionDate} and #{params.endInspectionDate}</if>
|
||||
<if test="params.beginInsuranceDate != null and params.beginInsuranceDate != '' and params.endInsuranceDate != null and params.endInsuranceDate != ''"> and insurance_date between #{params.beginInsuranceDate} and #{params.endInsuranceDate}</if>
|
||||
<if test="params.beginNextMaintenanceDate != null and params.beginNextMaintenanceDate != '' and params.endNextMaintenanceDate != null and params.endNextMaintenanceDate != ''"> and next_maintenance_date between #{params.beginNextMaintenanceDate} and #{params.endNextMaintenanceDate}</if>
|
||||
<if test="params.beginNextMaintenanceMileage != null and params.beginNextMaintenanceMileage != '' and params.endNextMaintenanceMileage != null and params.endNextMaintenanceMileage != ''"> and next_maintenance_mileage between #{params.beginNextMaintenanceMileage} and #{params.endNextMaintenanceMileage}</if>
|
||||
<if test="params.beginNextInspectionDate != null and params.beginNextInspectionDate != '' and params.endNextInspectionDate != null and params.endNextInspectionDate != ''"> and next_inspection_date between #{params.beginNextInspectionDate} and #{params.endNextInspectionDate}</if>
|
||||
<if test="params.beginInsuranceExpiryDate != null and params.beginInsuranceExpiryDate != '' and params.endInsuranceExpiryDate != null and params.endInsuranceExpiryDate != ''"> and insurance_expiry_date between #{params.beginInsuranceExpiryDate} and #{params.endInsuranceExpiryDate}</if>
|
||||
<if test="vo.userId != null "> and sys_user.id = #{vo.userId}</if>
|
||||
<if test="vo.carNature != null "> and car_nature = #{vo.carNature}</if>
|
||||
<if test="vo.realName != null "> and sys_user.real_name like concat('%', #{vo.realName}, '%')</if>
|
||||
<if test="vo.carNo != null and vo.carNo != ''"> and shop_user_car.car_no like concat('%', #{vo.carNo}, '%')</if>
|
||||
<if test="vo.params.beginMaintenanceDate != null and vo.params.beginMaintenanceDate != '' and vo.params.endMaintenanceDate != null and vo.params.endMaintenanceDate != ''"> and maintenance_date between #{vo.params.beginMaintenanceDate} and #{vo.params.endMaintenanceDate}</if>
|
||||
<if test="vo.params.beginMaintenanceMileage != null and vo.params.beginMaintenanceMileage != '' and vo.params.endMaintenanceMileage != null and vo.params.endMaintenanceMileage != ''"> and maintenance_mileage between #{vo.params.beginMaintenanceMileage} and #{vo.params.endMaintenanceMileage}</if>
|
||||
<if test="vo.params.beginInspectionDate != null and vo.params.beginInspectionDate != '' and vo.params.endInspectionDate != null and vo.params.endInspectionDate != ''"> and inspection_date between #{vo.params.beginInspectionDate} and #{vo.params.endInspectionDate}</if>
|
||||
<if test="vo.params.beginInsuranceDate != null and vo.params.beginInsuranceDate != '' and vo.params.endInsuranceDate != null and vo.params.endInsuranceDate != ''"> and insurance_date between #{vo.params.beginInsuranceDate} and #{vo.params.endInsuranceDate}</if>
|
||||
<if test="vo.params.beginNextMaintenanceDate != null and vo.params.beginNextMaintenanceDate != '' and vo.params.endNextMaintenanceDate != null and vo.params.endNextMaintenanceDate != ''"> and next_maintenance_date between #{vo.params.beginNextMaintenanceDate} and #{vo.params.endNextMaintenanceDate}</if>
|
||||
<if test="vo.params.beginNextMaintenanceMileage != null and vo.params.beginNextMaintenanceMileage != '' and vo.params.endNextMaintenanceMileage != null and vo.params.endNextMaintenanceMileage != ''"> and next_maintenance_mileage between #{vo.params.beginNextMaintenanceMileage} and #{vo.params.endNextMaintenanceMileage}</if>
|
||||
<if test="vo.params.beginNextInspectionDate != null and vo.params.beginNextInspectionDate != '' and vo.params.endNextInspectionDate != null and vo.params.endNextInspectionDate != ''"> and next_inspection_date between #{vo.params.beginNextInspectionDate} and #{vo.params.endNextInspectionDate}</if>
|
||||
<if test="vo.params.beginInsuranceExpiryDate != null and vo.params.beginInsuranceExpiryDate != '' and vo.params.endInsuranceExpiryDate != null and vo.params.endInsuranceExpiryDate != ''"> and insurance_expiry_date between #{vo.params.beginInsuranceExpiryDate} and #{vo.params.endInsuranceExpiryDate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -58,12 +58,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
<select id="selectShopUserCarByUserId" parameterType="Long" resultMap="ShopUserCarResult">
|
||||
<include refid="selectShopUserCarVo"/>
|
||||
where sys_user.user_id = #{userId}
|
||||
where sys_user.id = #{userId}
|
||||
limit 1
|
||||
</select>
|
||||
<select id="selectUserCarsByUserId" parameterType="Long" resultMap="ShopUserCarResult">
|
||||
<include refid="selectShopUserCarVo"/>
|
||||
where sys_user.user_id = #{userId}
|
||||
where sys_user.id = #{userId}
|
||||
</select>
|
||||
<select id="getDbCars" parameterType="Long" resultMap="ShopUserCarResult">
|
||||
SELECT
|
||||
@ -72,14 +72,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
suc.car_no
|
||||
FROM
|
||||
shop_user_car suc
|
||||
INNER JOIN sys_user su on suc.user_id = su.user_id
|
||||
inner join inspection_contract ic ON ic.user_id = su.user_id and suc.car_no = ic.carnum
|
||||
where now() <![CDATA[ <= ]]> DATE_ADD(ic.create_time, INTERVAL 10 DAY) and su.user_id = #{userId}
|
||||
INNER JOIN system_users su on suc.user_id = su.id
|
||||
inner join inspection_contract ic ON ic.user_id = su.id and suc.car_no = ic.carnum
|
||||
where now() <![CDATA[ <= ]]> DATE_ADD(ic.create_time, INTERVAL 10 DAY) and su.id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserCarsByUserIdCarNum" resultMap="ShopUserCarResult">
|
||||
<include refid="selectShopUserCarVo"/>
|
||||
where sys_user.user_id = #{userId} and shop_user_car.car_no = #{carNum}
|
||||
where sys_user.id = #{userId} and shop_user_car.car_no = #{carNum}
|
||||
</select>
|
||||
|
||||
<insert id="insertShopUserCar" parameterType="cn.iocoder.yudao.module.shop.entity.ShopUserCar" useGeneratedKeys="true" keyProperty="carId">
|
||||
|
@ -8,12 +8,12 @@ import cn.iocoder.yudao.module.jx.mapper.DriveSchoolCourseMapper;
|
||||
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolInfoMapper;
|
||||
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolReservationCourseMapper;
|
||||
import cn.iocoder.yudao.module.jx.payment.entity.PayEntity;
|
||||
import cn.iocoder.yudao.module.jx.payment.entity.WechatPayUrlEnum;
|
||||
import cn.iocoder.yudao.util.WechatPayUrlEnum;
|
||||
import cn.iocoder.yudao.module.jx.payment.mapper.DrivePayMapper;
|
||||
import cn.iocoder.yudao.module.jx.payment.utils.AesUtil;
|
||||
import cn.iocoder.yudao.module.jx.payment.utils.WechatPayRequests;
|
||||
import cn.iocoder.yudao.module.jx.service.DrivePayService;
|
||||
import cn.iocoder.yudao.module.rescue.utils.pay.WechatPayConfig;
|
||||
import cn.iocoder.yudao.util.WechatPayConfig;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
|
@ -12,25 +12,25 @@ import cn.iocoder.yudao.module.rescue.domain.LoginBody;
|
||||
import cn.iocoder.yudao.module.rescue.domain.WxLoginBody;
|
||||
import cn.iocoder.yudao.module.rescue.service.IDriverInfoService;
|
||||
import cn.iocoder.yudao.module.rescue.utils.RescueSysLoginService;
|
||||
import cn.iocoder.yudao.module.rescue.utils.pay.WechatPayConfig;
|
||||
import cn.iocoder.yudao.util.WechatPayConfig;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
||||
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.auth.AdminAuthService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.MenuService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.thoughtworks.xstream.core.SecurityUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@ -64,7 +64,7 @@ public class SysLoginController {
|
||||
private MenuService menuService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userService;
|
||||
private AdminUserService userService;
|
||||
|
||||
@Resource
|
||||
private PermissionApi permissionApi;
|
||||
@ -85,6 +85,9 @@ public class SysLoginController {
|
||||
@Resource
|
||||
private WechatPayConfig wxConfig;
|
||||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
@Resource
|
||||
private RestTemplate restTemplate;
|
||||
// @Autowired
|
||||
@ -130,7 +133,7 @@ public class SysLoginController {
|
||||
@PostMapping("/loginApp")
|
||||
public CommonResult loginApp(@RequestBody LoginBody loginBody) throws Exception {
|
||||
String userName = loginBody.getUsername();
|
||||
AdminUserRespDTO user = userService.getUserByUsername(userName);
|
||||
AdminUserDO user = userService.getUserByUsername(userName);
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
|
||||
}
|
||||
@ -236,7 +239,7 @@ public class SysLoginController {
|
||||
public CommonResult getInfo() {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
AdminUserRespDTO user = userService.getUser(loginUser.getId());
|
||||
AdminUserDO user = userService.getUser(loginUser.getId());
|
||||
map.put("user", user);
|
||||
// 角色集合
|
||||
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(loginUser.getId());
|
||||
@ -286,18 +289,20 @@ public class SysLoginController {
|
||||
// ajax.put("schoolInfo", driveSchoolInfo);
|
||||
// return ajax;
|
||||
// }
|
||||
// /**
|
||||
// * 获取App用户信息
|
||||
// *
|
||||
// * @return 用户信息
|
||||
// */
|
||||
// @GetMapping("/getAppInfo")
|
||||
// public CommonResult getAppInfo()
|
||||
// {
|
||||
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// AdminUserRespDTO user = userService.getUser(loginUser.getId());
|
||||
// // 角色集合
|
||||
// Set<String> roles = permissionService.getRolePermission(NamedObject.user);
|
||||
/**
|
||||
* 获取App用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("/getAppInfo")
|
||||
public CommonResult getAppInfo()
|
||||
{
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
AdminUserDO user = userService.getUser(loginUser.getId());
|
||||
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
|
||||
List<RoleDO> roleList = roleService.getRoleList(roleIdsByUserId);
|
||||
// 角色集合
|
||||
// Set<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toSet());
|
||||
// UserBalance userBalance = balanceService.selectShopUserBalanceByUserId(NamedObject.user.getUserId());
|
||||
// if (ObjectUtil.isNotEmpty(userBalance)) {
|
||||
// sysUser.setBalance(userBalance.getBalance());
|
||||
@ -311,17 +316,17 @@ public class SysLoginController {
|
||||
// balanceService.insertShopUserBalance(userBalance);
|
||||
// sysUser.setBalance(0L);
|
||||
// }
|
||||
// AjaxResult ajax = success();
|
||||
// ajax.put("user", sysUser);
|
||||
// ajax.put("role", roles);
|
||||
Map<String,Object> ajax = new HashMap<>();
|
||||
ajax.put("user", user);
|
||||
ajax.put("role", roleList);
|
||||
// ShopConfig shopConfig = configService.selectShopConfigById(1L);
|
||||
// if (StringUtils.isEmpty(shopConfig.getOpenRz())||shopConfig.getOpenRz().equals("0")){
|
||||
// ajax.put("openRz", "0");
|
||||
// }else {
|
||||
// ajax.put("openRz", "1");
|
||||
ajax.put("openRz", "1");
|
||||
// }
|
||||
// return ajax;
|
||||
// }
|
||||
return CommonResult.success(ajax);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取App用户信息
|
||||
@ -332,7 +337,7 @@ public class SysLoginController {
|
||||
public CommonResult getJcgfInfo() throws Exception {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
AdminUserRespDTO user = userService.getUser(loginUser.getId());
|
||||
AdminUserDO user = userService.getUser(loginUser.getId());
|
||||
// 角色集合
|
||||
List<RoleReqDTO> roleList = roleApi.getRoleList();
|
||||
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
|
||||
@ -360,7 +365,7 @@ public class SysLoginController {
|
||||
public CommonResult getJjInfo() throws Exception {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
AdminUserRespDTO user = userService.getUser(loginUser.getId());
|
||||
AdminUserDO user = userService.getUser(loginUser.getId());
|
||||
// 角色集合
|
||||
List<RoleReqDTO> roleList = roleApi.getRoleList();
|
||||
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
|
||||
@ -419,7 +424,7 @@ public class SysLoginController {
|
||||
if (ObjectUtil.isEmpty(driverInfo)){
|
||||
return error(500, "信息有误");
|
||||
}
|
||||
AdminUserRespDTO user = userService.getUser(userId);
|
||||
AdminUserDO user = userService.getUser(userId);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("user", user);
|
||||
map.put("driverInfo", driverInfo);
|
||||
@ -509,46 +514,45 @@ public class SysLoginController {
|
||||
}
|
||||
}
|
||||
|
||||
// @PostMapping("/wxLoginJc")
|
||||
// public AjaxResult wxLoginJc(@RequestBody WxLoginBody wxLoginBody) {
|
||||
// String code = wxLoginBody.getCode();
|
||||
// //秘钥
|
||||
// String encryptedIv = wxLoginBody.getEncryptedIv();
|
||||
// //加密数据
|
||||
// String encryptedData = wxLoginBody.getEncryptedData();
|
||||
//
|
||||
// //想微信服务器发送请求获取用户信息
|
||||
// String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxConfig.getAppId() + "&secret=" + wxConfig.getAppSecret() + "&js_code=" + code + "&grant_type=authorization_code";
|
||||
// System.out.println(url);
|
||||
// String res = restTemplate.getForObject(url, String.class);
|
||||
// JSONObject jsonObject = JSONObject.parseObject(res);
|
||||
//
|
||||
// //获取session_key和openid
|
||||
// String sessionKey = jsonObject.getString("session_key");
|
||||
// String openId = jsonObject.getString("openid");
|
||||
//
|
||||
// System.out.println(sessionKey);
|
||||
// System.out.println(openId);
|
||||
// //解密
|
||||
// String decryptResult = "";
|
||||
// try {
|
||||
// //如果没有绑定微信开放平台,解析结果是没有unionid的。
|
||||
// decryptResult = decrypt(sessionKey, encryptedIv, encryptedData);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// return AjaxResult.error("微信登录失败!");
|
||||
// }
|
||||
//
|
||||
// if (StringUtils.hasText(decryptResult)) {
|
||||
@PostMapping("/wxLoginJc")
|
||||
public CommonResult wxLoginJc(@RequestBody WxLoginBody wxLoginBody) {
|
||||
String code = wxLoginBody.getCode();
|
||||
//秘钥
|
||||
String encryptedIv = wxLoginBody.getEncryptedIv();
|
||||
//加密数据
|
||||
String encryptedData = wxLoginBody.getEncryptedData();
|
||||
|
||||
//想微信服务器发送请求获取用户信息
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxConfig.getJcAppId() + "&secret=" + wxConfig.getJcAppSecret() + "&js_code=" + code + "&grant_type=authorization_code";
|
||||
System.out.println(url);
|
||||
String res = restTemplate.getForObject(url, String.class);
|
||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||
|
||||
//获取session_key和openid
|
||||
String sessionKey = jsonObject.getString("session_key");
|
||||
String openId = jsonObject.getString("openid");
|
||||
|
||||
System.out.println(sessionKey);
|
||||
System.out.println(openId);
|
||||
//解密
|
||||
String decryptResult = "";
|
||||
try {
|
||||
//如果没有绑定微信开放平台,解析结果是没有unionid的。
|
||||
decryptResult = decrypt(sessionKey, encryptedIv, encryptedData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return CommonResult.error(500,"微信登录失败!");
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(decryptResult)) {
|
||||
// TODO 待完成
|
||||
// //如果解析成功,获取token
|
||||
// String token = loginService.wxLoginJc(decryptResult,openId,wxLoginBody.getInviteId());
|
||||
// AjaxResult ajax = AjaxResult.success();
|
||||
// ajax.put(Constants.TOKEN, token);
|
||||
// return ajax;
|
||||
// } else {
|
||||
// return AjaxResult.error("微信登录失败!");
|
||||
// }
|
||||
// }
|
||||
AuthLoginRespVO authLoginRespVO = loginService.wxLoginJc(decryptResult, openId, wxLoginBody.getInviteId());
|
||||
return success(authLoginRespVO);
|
||||
} else {
|
||||
return error(500, "微信登录失败!");
|
||||
}
|
||||
}
|
||||
//
|
||||
@PostMapping("/wxLoginRescue")
|
||||
public CommonResult wxLoginRescue(@RequestBody WxLoginBody wxLoginBody) {
|
||||
@ -584,10 +588,8 @@ public class SysLoginController {
|
||||
if (StringUtils.hasText(decryptResult)) {
|
||||
// TODO 待完成
|
||||
// //如果解析成功,获取token
|
||||
// String token = loginService.wxLoginRescue(decryptResult,openId,wxLoginBody.getInviteId());
|
||||
// AjaxResult ajax = AjaxResult.success();
|
||||
// ajax.put(Constants.TOKEN, token);
|
||||
return error(500, "待完成");
|
||||
AuthLoginRespVO authLoginRespVO = loginService.wxLoginRescue(decryptResult, openId, wxLoginBody.getInviteId());
|
||||
return success(authLoginRespVO);
|
||||
} else {
|
||||
return error(500, "微信登录失败!");
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.CoordinateUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.iocoder.yudao.module.rescue.domain.*;
|
||||
import cn.iocoder.yudao.module.rescue.dto.TaskDto;
|
||||
import cn.iocoder.yudao.module.rescue.mapper.RescueDriverInfoMapper;
|
||||
import cn.iocoder.yudao.module.rescue.utils.RedissonDelayQueue;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
@ -13,8 +12,8 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.rescue.service.*;
|
||||
import cn.iocoder.yudao.module.rescue.utils.RedisUtil;
|
||||
import cn.iocoder.yudao.module.rescue.utils.StringUtils;
|
||||
import cn.iocoder.yudao.module.rescue.utils.pay.WechatPayConfig;
|
||||
import cn.iocoder.yudao.module.rescue.utils.pay.WechatPayRequest;
|
||||
import cn.iocoder.yudao.util.WechatPayConfig;
|
||||
import cn.iocoder.yudao.util.WechatPayRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
|
@ -7,8 +7,8 @@ import cn.iocoder.yudao.module.rescue.domain.*;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.rescue.service.*;
|
||||
import cn.iocoder.yudao.module.rescue.utils.pay.AesUtil;
|
||||
import cn.iocoder.yudao.module.rescue.utils.pay.WechatPayConfig;
|
||||
import cn.iocoder.yudao.module.rescue.utils.pay.WechatPayRequest;
|
||||
import cn.iocoder.yudao.util.WechatPayConfig;
|
||||
import cn.iocoder.yudao.util.WechatPayRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
|
@ -16,6 +16,7 @@ import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.util.Assert;
|
||||
@ -242,7 +243,7 @@ public class GlobalExceptionHandler {
|
||||
// 插入异常日志
|
||||
this.createExceptionLog(req, ex);
|
||||
// 返回 ERROR CommonResult
|
||||
return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), INTERNAL_SERVER_ERROR.getMsg());
|
||||
return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), StringUtils.isNotEmpty(ex.getMessage())?ex.getMessage():INTERNAL_SERVER_ERROR.getMsg());
|
||||
}
|
||||
|
||||
private void createExceptionLog(HttpServletRequest req, Throwable e) {
|
||||
|
@ -127,6 +127,12 @@
|
||||
<groupId>com.xingyuv</groupId>
|
||||
<artifactId>spring-boot-starter-captcha-plus</artifactId> <!-- 验证码,一般用于登录使用 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||
<artifactId>wechatpay-apache-httpclient</artifactId>
|
||||
<version>0.4.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -40,7 +40,7 @@ public class DictDataController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "新增字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('system:dict:create')")
|
||||
public CommonResult<Long> createDictData(@Valid @RequestBody DictDataSaveReqVO createReqVO) {
|
||||
Long dictDataId = dictDataService.createDictData(createReqVO);
|
||||
return success(dictDataId);
|
||||
@ -48,7 +48,7 @@ public class DictDataController {
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "修改字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('system:dict:update')")
|
||||
public CommonResult<Boolean> updateDictData(@Valid @RequestBody DictDataSaveReqVO updateReqVO) {
|
||||
dictDataService.updateDictData(updateReqVO);
|
||||
return success(true);
|
||||
@ -83,7 +83,7 @@ public class DictDataController {
|
||||
@GetMapping(value = "/get")
|
||||
@Operation(summary = "/查询字典数据详细")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
public CommonResult<DictDataRespVO> getDictData(@RequestParam("id") Long id) {
|
||||
DictDataDO dictData = dictDataService.getDictData(id);
|
||||
return success(BeanUtils.toBean(dictData, DictDataRespVO.class));
|
||||
|
@ -4,9 +4,12 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.convert.user.UserConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
|
||||
@ -29,8 +32,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.ok;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
|
||||
@ -97,4 +102,15 @@ public class UserProfileController {
|
||||
return success(avatar);
|
||||
}
|
||||
|
||||
@PutMapping("/updateNickName")
|
||||
public CommonResult updateNickName(@RequestBody Map<String,Object> user) {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
||||
userSaveReqVO.setId(loginUser.getId());
|
||||
userSaveReqVO.setNickname((String) user.get("realName"));
|
||||
userService.updateUser(userSaveReqVO);
|
||||
|
||||
return ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -94,4 +94,10 @@ public class UserSaveReqVO {
|
||||
|
||||
private Integer userAge;
|
||||
|
||||
private String rescueOpenId;
|
||||
|
||||
private Long inviteId;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
}
|
||||
|
||||
default AdminUserDO selectByMobile(String mobile) {
|
||||
return selectOne(AdminUserDO::getMobile, mobile);
|
||||
return null;
|
||||
}
|
||||
|
||||
default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
|
||||
@ -55,4 +55,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
List<String> getStudentNumber(Long id);
|
||||
|
||||
AdminUserDO selectUserByPhone(String phone);
|
||||
|
||||
AdminUserDO getUserByMobileWithoutTenant(String phoneNumber);
|
||||
}
|
||||
|
@ -72,4 +72,7 @@ public interface AdminAuthService {
|
||||
|
||||
AuthLoginRespVO wxLogin(String decryptResult,String openId,Long inviteId);
|
||||
|
||||
AuthLoginRespVO wxLoginRescue(String decryptResult, String openId, Long inviteId);
|
||||
|
||||
AuthLoginRespVO wxLoginJc(String decryptResult, String openId, Long inviteId);
|
||||
}
|
||||
|
@ -6,13 +6,17 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.system.api.logger.dto.LoginLogCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.convert.auth.AuthConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||
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.enums.logger.LoginLogTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum;
|
||||
@ -21,6 +25,8 @@ import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
|
||||
import cn.iocoder.yudao.module.system.service.logger.LoginLogService;
|
||||
import cn.iocoder.yudao.module.system.service.member.MemberService;
|
||||
import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
|
||||
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.social.SocialUserService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@ -30,11 +36,12 @@ import com.xingyuv.captcha.model.vo.CaptchaVO;
|
||||
import com.xingyuv.captcha.service.CaptchaService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Validator;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
@ -65,6 +72,13 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
private CaptchaService captchaService;
|
||||
@Resource
|
||||
private SmsCodeApi smsCodeApi;
|
||||
@Resource
|
||||
private PermissionService permissionService;
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -306,4 +320,125 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
return UserTypeEnum.ADMIN;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检测模块微信登录
|
||||
*
|
||||
* @param decryptResult 登录凭证 只能用一次
|
||||
* @return
|
||||
*/
|
||||
public AuthLoginRespVO wxLoginRescue(String decryptResult,String openId,Long inviteId){
|
||||
//字符串转json
|
||||
JSONObject jsonObject = JSONObject.parseObject(decryptResult);
|
||||
System.out.println(jsonObject);
|
||||
System.out.println("openId"+openId);
|
||||
String phoneNumber = jsonObject.getString("phoneNumber");
|
||||
//还可以获取其他信息
|
||||
//根据openid判断数据库中是否有该用户
|
||||
//根据openid查询用户信息
|
||||
AdminUserDO wxUser = userService.getUserByMobile(phoneNumber);
|
||||
//如果查不到,则新增,查到了,则更新
|
||||
UserSaveReqVO user = new UserSaveReqVO();
|
||||
if (wxUser == null) {
|
||||
// 新增
|
||||
user.setUsername(phoneNumber);
|
||||
user.setNickname(phoneNumber);
|
||||
user.setMobile(phoneNumber);
|
||||
user.setPassword(passwordEncoder.encode("123456"));
|
||||
user.setRescueOpenId(openId);
|
||||
user.setId(1L);
|
||||
if (null!=inviteId){
|
||||
//绑定上级
|
||||
user.setInviteId(inviteId);
|
||||
//给上级进行积分奖励
|
||||
// userBalanceService.inviteRewards(inviteId);
|
||||
}
|
||||
user.setDeptId(100L);
|
||||
userService.createUser(user);
|
||||
|
||||
List<RoleDO> jcyh = roleService.getRoleListByCodes(Collections.singletonList("jcyh"));
|
||||
Set<Long> ids = new HashSet<>();
|
||||
ids.add(jcyh.get(0).getId());
|
||||
permissionService.assignUserRole(user.getId(),ids);
|
||||
}else {
|
||||
//更新
|
||||
user.setId(wxUser.getId());
|
||||
user.setNickname(phoneNumber);
|
||||
user.setMobile(phoneNumber);
|
||||
user.setRescueOpenId(openId);
|
||||
user.setId(1L);
|
||||
if (ObjectUtil.isEmpty(user.getInviteId())){
|
||||
if (null!=inviteId){
|
||||
//绑定上级
|
||||
user.setInviteId(inviteId);
|
||||
//给上级进行积分奖励
|
||||
// userBalanceService.inviteRewards(inviteId);
|
||||
}
|
||||
}
|
||||
userService.updateUser(user);
|
||||
}
|
||||
|
||||
// 生成token
|
||||
return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthLoginRespVO wxLoginJc(String decryptResult, String openId, Long inviteId) {
|
||||
//字符串转json
|
||||
JSONObject jsonObject = JSONObject.parseObject(decryptResult);
|
||||
System.out.println(jsonObject);
|
||||
System.out.println("openId"+openId);
|
||||
String phoneNumber = jsonObject.getString("phoneNumber");
|
||||
//还可以获取其他信息
|
||||
//根据openid判断数据库中是否有该用户
|
||||
//根据openid查询用户信息
|
||||
AdminUserDO wxUser = userService.getUserByMobileWithoutTenant(phoneNumber);
|
||||
//如果查不到,则新增,查到了,则更新
|
||||
UserSaveReqVO user = new UserSaveReqVO();
|
||||
if (wxUser == null) {
|
||||
// 新增
|
||||
user.setUsername(phoneNumber);
|
||||
user.setNickname(phoneNumber);
|
||||
user.setMobile(phoneNumber);
|
||||
user.setPassword(passwordEncoder.encode("123456"));
|
||||
user.setRescueOpenId(openId);
|
||||
user.setTenantId(1L);
|
||||
if (null!=inviteId){
|
||||
//绑定上级
|
||||
user.setInviteId(inviteId);
|
||||
//给上级进行积分奖励
|
||||
// userBalanceService.inviteRewards(inviteId);
|
||||
}
|
||||
user.setDeptId(100L);
|
||||
Long uid = userService.createUser(user);
|
||||
|
||||
wxUser = new AdminUserDO();
|
||||
wxUser.setId(uid);
|
||||
wxUser.setUsername(phoneNumber);
|
||||
|
||||
List<RoleDO> jcyh = roleService.getRoleListByCodes(Collections.singletonList("jcyh"));
|
||||
Set<Long> ids = new HashSet<>();
|
||||
ids.add(jcyh.get(0).getId());
|
||||
permissionService.assignUserRole(user.getId(),ids);
|
||||
}else {
|
||||
//更新
|
||||
// user.setId(wxUser.getId());
|
||||
// user.setNickname(phoneNumber);
|
||||
// user.setMobile(phoneNumber);
|
||||
// user.setRescueOpenId(openId);
|
||||
// user.setId(1L);
|
||||
// if (ObjectUtil.isEmpty(user.getInviteId())){
|
||||
// if (null!=inviteId){
|
||||
// //绑定上级
|
||||
// user.setInviteId(inviteId);
|
||||
// //给上级进行积分奖励
|
||||
//// userBalanceService.inviteRewards(inviteId);
|
||||
// }
|
||||
// }
|
||||
// userService.updateUser(user);
|
||||
}
|
||||
|
||||
// 生成token
|
||||
return createTokenAfterLoginSuccess(wxUser.getId(), wxUser.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
|
||||
}
|
||||
}
|
||||
|
@ -217,4 +217,6 @@ public interface AdminUserService {
|
||||
List<String> getStudentNumber(Long id);
|
||||
|
||||
AdminUserDO selectUserByPhone(String phone);
|
||||
|
||||
AdminUserDO getUserByMobileWithoutTenant(String phoneNumber);
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
if (StrUtil.isBlank(mobile)) {
|
||||
return;
|
||||
}
|
||||
AdminUserDO user = userMapper.selectByMobile(mobile);
|
||||
AdminUserDO user = userMapper.getUserByMobileWithoutTenant(mobile);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
@ -525,6 +525,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
return userMapper.selectUserByPhone(phone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminUserDO getUserByMobileWithoutTenant(String phoneNumber) {
|
||||
return userMapper.getUserByMobileWithoutTenant(phoneNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对密码进行加密
|
||||
*
|
||||
|
@ -34,4 +34,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select su.*
|
||||
from system_users su where su.mobile = #{phone} and su.deleted = '0'
|
||||
</select>
|
||||
<select id="getUserByMobileWithoutTenant"
|
||||
resultType="cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
system_users
|
||||
WHERE
|
||||
mobile = #{phoneNumber}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -222,6 +222,8 @@ yudao:
|
||||
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录
|
||||
- /admin-api/system/config/configKey/**
|
||||
- /websocket/**
|
||||
- /admin-api/rescue/wxLoginRescue
|
||||
- /admin-api/rescue/wxLoginJc
|
||||
websocket:
|
||||
enable: true # websocket的开关
|
||||
path: /infra/ws # 路径
|
||||
@ -261,6 +263,9 @@ yudao:
|
||||
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,无法携带租户编号
|
||||
# - /admin-api/rescue/login
|
||||
- /admin-api/rescue/loginApp
|
||||
- /admin-api/rescue/wxLoginRescue
|
||||
- /admin-api/rescue/wxLoginJc
|
||||
- /admin-api/wxLoginRescue
|
||||
ignore-tables:
|
||||
- system_tenant
|
||||
- system_tenant_package
|
||||
|
Loading…
Reference in New Issue
Block a user