Compare commits

...

2 Commits

Author SHA1 Message Date
xyc
53944642e2 更新 2025-07-02 17:59:31 +08:00
xyc
9ddfaceb62 更新 2025-06-27 17:19:09 +08:00
39 changed files with 2692 additions and 209 deletions

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -134,4 +135,10 @@ public class Company extends TenantBaseDO {
* 纬度
*/
private BigDecimal lat;
/**
* 距离
*/
@TableField(exist = false)
private Long distance;
}

View File

@ -47,6 +47,9 @@
<select id="getCompanyPageByServer" resultType="cn.iocoder.yudao.module.company.entity.Company">
select bc.*
<if test="map.lgt != null">
, ROUND(ST_Distance_Sphere (POINT (#{map.lgt}, #{map.lat}),POINT (bc.lgt, bc.lat ))) AS distance
</if>
from base_company bc
left join system_tenant st on bc.tenant_id = st.id
where FIND_IN_SET(#{map.serviceCodes}, bc.service_codes) > 0
@ -54,5 +57,8 @@
<if test="map.tenantId != null">
and bc.tenant_id = #{map.tenantId}
</if>
<if test="map.lgt != null">
order by distance
</if>
</select>
</mapper>

View File

@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.core.text.Convert;
import cn.iocoder.yudao.module.core.text.ServletUtils;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
@ -22,6 +23,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.util.ExcelExtraHelper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -36,9 +38,12 @@ import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import cn.iocoder.yudao.module.shop.service.IShopMallPartnersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
@ -66,12 +71,11 @@ public class InspectionMallPartnersController extends BaseController {
*/
@GetMapping("/list")
public CommonResult list(ShopMallPartners shopMallPartners,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
shopMallPartners.setType("jc");
Page<ShopMallPartners> page = new Page<>(pageNum, pageSize);
IPage<ShopMallPartners> list = shopMallPartnersService.selectShopMallPartnersList(page,shopMallPartners);
IPage<ShopMallPartners> list = shopMallPartnersService.selectShopMallPartnersList(page, shopMallPartners);
return success(list);
}
@ -81,14 +85,13 @@ public class InspectionMallPartnersController extends BaseController {
*/
@GetMapping("/listComment")
public CommonResult listComment(Long partnerId,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<OrderInfo> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<OrderInfo> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.select(OrderInfo::getGoodsTitle,OrderInfo::getCommentDesc,OrderInfo::getCommentTime,OrderInfo::getCommentStar,OrderInfo::getRealName,OrderInfo::getId).eq(OrderInfo::getPartnerId,partnerId).orderByDesc(OrderInfo::getCommentTime).isNotNull(OrderInfo::getCommentTime);
LambdaQueryWrapper<OrderInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(OrderInfo::getGoodsTitle, OrderInfo::getCommentDesc, OrderInfo::getCommentTime, OrderInfo::getCommentStar, OrderInfo::getRealName, OrderInfo::getId).eq(OrderInfo::getPartnerId, partnerId).orderByDesc(OrderInfo::getCommentTime).isNotNull(OrderInfo::getCommentTime);
IPage<OrderInfo> list = orderInfoService.page(page,queryWrapper);
IPage<OrderInfo> list = orderInfoService.page(page, queryWrapper);
return success(list);
}
@ -96,10 +99,9 @@ public class InspectionMallPartnersController extends BaseController {
* 删除评论
*/
@PostMapping("/delCommentByOrderId")
public CommonResult delCommentByOrderId(Long orderId)
{
LambdaUpdateWrapper<OrderInfo> queryWrapper =new LambdaUpdateWrapper<>();
queryWrapper.eq(OrderInfo::getId,orderId).set(OrderInfo::getCommentTime,null).set(OrderInfo::getCommentDesc,"").set(OrderInfo::getCommentStar,null);
public CommonResult delCommentByOrderId(Long orderId) {
LambdaUpdateWrapper<OrderInfo> queryWrapper = new LambdaUpdateWrapper<>();
queryWrapper.eq(OrderInfo::getId, orderId).set(OrderInfo::getCommentTime, null).set(OrderInfo::getCommentDesc, "").set(OrderInfo::getCommentStar, null);
orderInfoService.update(queryWrapper);
return success();
}
@ -108,58 +110,55 @@ public class InspectionMallPartnersController extends BaseController {
* 工单管理
*/
@GetMapping("/workOrder")
public CommonResult<IPage<?>> workOrder(String carNum,String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime,Integer pageSize,Integer pageNum)
{
LoginUser user = SecurityFrameworkUtils.getLoginUser();
Set<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
ShopMallPartners partner = new ShopMallPartners();
if (roles.contains("jcshop")){
LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0").last("limit 1");
partner = shopMallPartnersService.getOne(queryWrapper);
if (ObjectUtil.isEmpty(partner)){
return error();
}
}else if (roles.contains("jcworker")){
LambdaQueryWrapper<PartnerWorker> queryWrapperWork =new LambdaQueryWrapper<>();
queryWrapperWork.eq(PartnerWorker::getUserId,user.getId()).last("limit 1");
PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork);
if (ObjectUtil.isEmpty(worker)){
return error();
}
partner.setPartnerId(worker.getPartnerId());
}
public CommonResult<IPage<?>> workOrder(OrderTableQuery query, Integer pageSize, Integer pageNum) {
// LoginUser user = SecurityFrameworkUtils.getLoginUser();
// Set<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
// List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
// List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
// ShopMallPartners partner = new ShopMallPartners();
// if (roles.contains("jcshop")){
// LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
// queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0").last("limit 1");
// partner = shopMallPartnersService.getOne(queryWrapper);
// if (ObjectUtil.isEmpty(partner)){
// return error();
// }
// }else if (roles.contains("jcworker")){
// LambdaQueryWrapper<PartnerWorker> queryWrapperWork =new LambdaQueryWrapper<>();
// queryWrapperWork.eq(PartnerWorker::getUserId,user.getId()).last("limit 1");
// PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork);
// if (ObjectUtil.isEmpty(worker)){
// return error();
// }
// partner.setPartnerId(worker.getPartnerId());
// }
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
IPage<InspectionInfo> list = orderInfoService.pageWorkOrder(partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime,page);
IPage<InspectionInfo> list = orderInfoService.pageWorkOrder(query, page);
return CommonResult.success(list);
}
@GetMapping("/delWorkOrder")
public CommonResult<IPage<?>> delWorkOrder(String carNum,String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime,Integer pageSize,Integer pageNum)
{
public CommonResult<IPage<?>> delWorkOrder(String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Integer pageSize, Integer pageNum) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
Set<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
ShopMallPartners partner = new ShopMallPartners();
if (roles.contains("jcshop")){
LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0").last("limit 1");
ShopMallPartners partner = new ShopMallPartners();
if (roles.contains("jcshop")) {
LambdaQueryWrapper<ShopMallPartners> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType, "jc").eq(ShopMallPartners::getIsBanned, "0").last("limit 1");
partner = shopMallPartnersService.getOne(queryWrapper);
if (ObjectUtil.isEmpty(partner)){
if (ObjectUtil.isEmpty(partner)) {
return error();
}
}else if (roles.contains("jcworker")){
LambdaQueryWrapper<PartnerWorker> queryWrapperWork =new LambdaQueryWrapper<>();
queryWrapperWork.eq(PartnerWorker::getUserId,user.getId());
} else if (roles.contains("jcworker")) {
LambdaQueryWrapper<PartnerWorker> queryWrapperWork = new LambdaQueryWrapper<>();
queryWrapperWork.eq(PartnerWorker::getUserId, user.getId());
PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork);
if (ObjectUtil.isEmpty(worker)){
if (ObjectUtil.isEmpty(worker)) {
return error();
}
partner.setPartnerId(worker.getPartnerId());
@ -168,74 +167,56 @@ public class InspectionMallPartnersController extends BaseController {
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
// List<InspectionInfo> list = orderInfoService.delworkOrder(partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime);
IPage<InspectionInfo> list = orderInfoService.pageWorkOrder(partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime,page);
IPage<InspectionInfo> list = orderInfoService.pageWorkOrder(partner.getPartnerId(), carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page);
return CommonResult.success(list);
}
@PostMapping("/exportWorkOrder")
public void exportWorkOrder(String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, HttpServletResponse response) throws IOException {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
Set<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
public void exportWorkOrder(OrderTableQuery query, HttpServletResponse response) throws IOException {
// LoginUser user = SecurityFrameworkUtils.getLoginUser();
Page<InspectionInfo> page = new Page<>(1, 1000000000);
List<InspectionInfo> list = orderInfoService.pageWorkOrder(query, page).getRecords();
List<List<String>> rows = new ArrayList<>();
Map<String, Object> stringObjectMap = orderInfoService.workOrderData(query);
List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
ShopMallPartners partner = new ShopMallPartners();
if (roles.contains("jcshop")){
LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0").last("limit 1");
partner = shopMallPartnersService.getOne(queryWrapper);
if (ObjectUtil.isEmpty(partner)){
return;
}
}else if (roles.contains("jcworker")){
LambdaQueryWrapper<PartnerWorker> queryWrapperWork =new LambdaQueryWrapper<>();
queryWrapperWork.eq(PartnerWorker::getUserId,user.getId());
PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork);
if (ObjectUtil.isEmpty(worker)){
return;
}
partner.setPartnerId(worker.getPartnerId());
}
int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
Page<InspectionInfo> page = new Page<>(pageNum,pageSize);
List<InspectionInfo> list = orderInfoService.workOrder(partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime);
List<List<String>> rows =new ArrayList<>();
Map<String, Object> stringObjectMap = orderInfoService.workOrderData(partner.getPartnerId(), carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
rows.add(CollUtil.newArrayList("公示价格汇总:","",String.valueOf(Double.parseDouble(stringObjectMap.get("goodsPriceSum").toString())/100d)+"","实付金额汇总:","",String.valueOf(Double.parseDouble(stringObjectMap.get("payMoneySum").toString())/100d)+""));
rows.add(CollUtil.newArrayList("车牌号", "检测类型", "检测项目", "公示价格","实收金额","付款时间","客户手机号","接待员手机号","客户来源","支付方式","开始时间","结束时间","检测结果","备注"));
rows.add(CollUtil.newArrayList("公示价格汇总:", "", String.valueOf(Double.parseDouble(stringObjectMap.get("goodsPriceSum").toString()) / 100d) + "", "实付金额汇总:", "", String.valueOf(Double.parseDouble(stringObjectMap.get("payMoneySum").toString()) / 100d) + ""));
rows.add(CollUtil.newArrayList("车牌号", "检测车型", "检测类型", "业务渠道", "客户来源", "经办人", "公示价格", "实收金额", "付款时间", "客户手机号", "支付方式", "开始时间", "结束时间", "检测结果"));
List<DictDataDO> sysDictData = dictDataService.getDictDataListByDictType("pay_type");
Map<String,String> payMap =new HashMap<>();
Map<String, String> payMap = new HashMap<>();
for (DictDataDO it : sysDictData) {
payMap.put(it.getValue(),it.getLabel());
payMap.put(it.getValue(), it.getLabel());
}
for (InspectionInfo item : list) {
String isPassStr ="";
if (StringUtils.isEmpty(item.getIsPass())){
String isPassStr = "";
if (item.getIsPass() == null) {
isPassStr = "进行中";
}else{
if (item.getIsPass().equals("0")){
} else {
if (item.getIsPass().equals("0") && item.getStatus().equals("1")) {
isPassStr = "不合格";
}else {
} else if (item.getIsPass().equals("1") && item.getStatus().equals("1")) {
isPassStr = "合格";
} else if ((item.getStatus().equals("2"))) {
isPassStr = "重审中";
} else {
isPassStr = "进行中";
}
}
String payTypeStr ="";
if (StringUtils.isEmpty(item.getPayType())){
payTypeStr = "";
}else{
String payTypeStr = "";
if (StringUtils.isEmpty(item.getPayType())) {
payTypeStr = "暂未支付";
} else {
payTypeStr = payMap.get(item.getPayType());
}
rows.add(CollUtil.newArrayList(Optional.ofNullable(item.getCarNum()).orElse(""), Optional.ofNullable(item.getGoodsTitle()).orElse("") ,Optional.ofNullable(item.getSkuName()).orElse("") ,ObjectUtil.isEmpty(item.getGoodsPrice())?"":String.valueOf(item.getGoodsPrice()/100),ObjectUtil.isEmpty(item.getRealPayMoney())?"":String.valueOf(item.getRealPayMoney()/100), ObjectUtil.isEmpty(item.getPayTime())?"":DateUtil.format(item.getPayTime(),"yyyy-MM-dd hh:mm"),
Optional.ofNullable(item.getBuyPhone()).orElse(""), Optional.ofNullable(item.getWorkerPhone()).orElse("") , Optional.ofNullable(item.getCustomerSource()).orElse("") , payTypeStr, ObjectUtil.isEmpty(item.getStartTime())?"":DateUtil.format(item.getStartTime(),"yyyy-MM-dd hh:mm"), ObjectUtil.isEmpty(item.getEndTime())?"":DateUtil.format(item.getEndTime(),"yyyy-MM-dd hh:mm"), isPassStr,
Optional.ofNullable(item.getRemark()).orElse("")));
rows.add(CollUtil.newArrayList(Optional.ofNullable(item.getCarNum()).orElse(""), Optional.ofNullable(item.getGoodsTitle()).orElse(""), Optional.ofNullable(item.getSkuName()).orElse(""), Optional.ofNullable(item.getBusinessChannel()).orElse(""), Optional.ofNullable(item.getCustomerSource()).orElse(""), Optional.ofNullable(item.getOtherName()).orElse(""), ObjectUtil.isEmpty(item.getGoodsPrice()) ? "" : BigDecimal.valueOf(item.getGoodsPrice())
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP)
.toString(), ObjectUtil.isEmpty(item.getRealPayMoney()) ? "暂未支付" : BigDecimal.valueOf(item.getRealPayMoney())
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP)
.toString(), ObjectUtil.isEmpty(item.getPayTime()) ? "暂未支付" : DateUtil.format(item.getPayTime(), "yyyy-MM-dd hh:mm"),
Optional.ofNullable(item.getBuyPhone()).orElse(""), payTypeStr, ObjectUtil.isEmpty(item.getStartTime()) ? "" : DateUtil.format(item.getStartTime(), "yyyy-MM-dd hh:mm"), ObjectUtil.isEmpty(item.getEndTime()) ? "" : DateUtil.format(item.getEndTime(), "yyyy-MM-dd hh:mm"), isPassStr));
}
ExcelWriter writer = ExcelUtil.getWriter();
@ -243,12 +224,16 @@ public class InspectionMallPartnersController extends BaseController {
//合并单元格后的标题行使用默认标题样式
//一次性写出内容强制输出标题
writer.write(rows, true);
ExcelExtraHelper.enhanceExcel(writer, rows,
CollUtil.newArrayList(8,11,12),
null);
//out为OutputStream需要写出到的目标流
//response为HttpServletResponse对象
response.setContentType("application/vnd.ms-excel;charset=utf-8");
//test.xls是弹出下载对话框的文件名不能为中文中文请自行编码
response.setHeader("Content-Disposition","attachment;filename=test.xls");
ServletOutputStream out=response.getOutputStream();
response.setHeader("Content-Disposition", "attachment;filename=test.xls");
ServletOutputStream out = response.getOutputStream();
writer.flush(out, true);
// 关闭writer释放内存
@ -258,36 +243,36 @@ public class InspectionMallPartnersController extends BaseController {
}
@GetMapping("/workOrderData")
public CommonResult workOrderData(String carNum,String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime,Integer pageSize,Integer pageNum)
{
LoginUser user = SecurityFrameworkUtils.getLoginUser();
Set<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
ShopMallPartners partner = new ShopMallPartners();
if (roles.contains("jcshop")){
LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0").last("limit 1");
partner = shopMallPartnersService.getOne(queryWrapper);
if (ObjectUtil.isEmpty(partner)){
return CommonResult.error(-1,"信息有误");
}
}else if (roles.contains("jcworker")){
LambdaQueryWrapper<PartnerWorker> queryWrapperWork =new LambdaQueryWrapper<>();
queryWrapperWork.eq(PartnerWorker::getUserId,user.getId()).last("limit 1");
PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork);
if (ObjectUtil.isEmpty(worker)){
return CommonResult.error(-1,"信息有误");
}
partner.setPartnerId(worker.getPartnerId());
}
return success(orderInfoService.workOrderData(partner.getPartnerId(),carNum,goodsTitle, customerSource, payType,startTime,roleId,endTime));
public CommonResult workOrderData(OrderTableQuery query, Integer pageSize, Integer pageNum) {
// LoginUser user = SecurityFrameworkUtils.getLoginUser();
// Set<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
// List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
//
// List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
// ShopMallPartners partner = new ShopMallPartners();
// if (roles.contains("jcshop")) {
// LambdaQueryWrapper<ShopMallPartners> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType, "jc").eq(ShopMallPartners::getIsBanned, "0").last("limit 1");
// partner = shopMallPartnersService.getOne(queryWrapper);
// if (ObjectUtil.isEmpty(partner)) {
// return CommonResult.error(-1, "信息有误");
// }
// } else if (roles.contains("jcworker")) {
// LambdaQueryWrapper<PartnerWorker> queryWrapperWork = new LambdaQueryWrapper<>();
// queryWrapperWork.eq(PartnerWorker::getUserId, user.getId()).last("limit 1");
// PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork);
// if (ObjectUtil.isEmpty(worker)) {
// return CommonResult.error(-1, "信息有误");
// }
// partner.setPartnerId(worker.getPartnerId());
// }
return success(orderInfoService.workOrderData(query));
}
/**
* 修改数据
*
* @return 修改结果
*/
@PostMapping("/add")
@ -296,8 +281,10 @@ public class InspectionMallPartnersController extends BaseController {
this.shopMallPartnersService.insertShopMallPartners(shopMallPartners);
return success();
}
/**
* 修改数据
*
* @return 修改结果
*/
@PostMapping("/edit")
@ -308,6 +295,7 @@ public class InspectionMallPartnersController extends BaseController {
/**
* 设置店主
*
* @return 修改结果
*/
@PostMapping("/setShopAdmin")
@ -315,8 +303,10 @@ public class InspectionMallPartnersController extends BaseController {
this.shopMallPartnersService.setShopAdmin(shopMallPartners);
return success();
}
/**
* 封禁 解禁
*
* @return 修改结果
*/
@PostMapping("/banned")
@ -326,12 +316,12 @@ public class InspectionMallPartnersController extends BaseController {
shopMallPartnersService.updateShopMallPartners(shopMallPartners);
return success();
}
/**
* 删除合作商管理
*/
@PostMapping("/del")
public CommonResult remove(@RequestParam("idList") Long[] idList)
{
public CommonResult remove(@RequestParam("idList") Long[] idList) {
return toAjax(shopMallPartnersService.deleteShopMallPartnersByPartnerIds(idList));
}
}

View File

@ -643,6 +643,9 @@ public class PartnerOwnController extends BaseController {
//线下收费
@PostMapping("/offlineCharging")
public CommonResult offlineCharging(@RequestBody InspectionInfoVo infoVo) {
if (ObjectUtil.isEmpty(infoVo.getPayType())) {
throw new SecurityException("请选择支付方式");
}
partnerList.offlineCharging(infoVo);
return success();
}

View File

@ -0,0 +1,859 @@
package cn.iocoder.yudao.module.inspection.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
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.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.entity.*;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
import cn.iocoder.yudao.module.inspection.vo.*;
import cn.iocoder.yudao.module.partner.entity.PartnerBalanceDetail;
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.shop.entity.ShopCouponTemplate;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO;
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/userClient/partnerOwn/partner")
public class UserClientPartnerOwnController extends BaseController {
@Autowired
private AppInspectionPartnerService partnerList;
@Autowired
private IPartnerWorkerService partnerWorkerService;
@Autowired
private DictTypeService dictTypeService;
@Autowired
private DictDataService dictDataService;
@Autowired
private RoleService roleService;
/**
* 获取店铺详情
*/
@GetMapping("/shopInfo")
public CommonResult shopInfo() throws Exception {
return success(partnerList.shopInfo());
}
@GetMapping("/shopInfoByUserId")
public CommonResult shopInfoByUserId() throws Exception {
return success(partnerList.shopInfoByUserId());
}
/**
* 获取上门取车 预约条数
*/
@GetMapping("/getAppointAndPickNum")
public CommonResult getAppointAndPickNum() throws Exception {
return success(partnerList.getAppointAndPickNum());
}
/**
* 开始或者停止营业
*/
@PostMapping("/startOrEnd")
public CommonResult startOrEnd(Long partnerId) {
partnerList.startOrEnd(partnerId);
return success();
}
/**
* 首页 顶部数据统计
*/
@GetMapping("/statisticsInfo")
public CommonResult statisticsInfo() {
return success(partnerList.statisticsInfo(null));
}
/**
* 检测线图
*/
@GetMapping("/chartInfoAmount")
public CommonResult chartInfoAmount(Long partnerId, String unit) {
return success(partnerList.chartInfoAmount(partnerId, unit));
}
/**
* 新检测线图
*/
@GetMapping("/newChartInfoAmount")
public CommonResult newChartInfoAmount(String unit) {
return success(partnerList.newChartInfoAmount(unit));
}
/**
* staticsTable1
* 检测数量折线图
*/
@GetMapping("/chartLineInspectionNum")
public CommonResult chartLineInspectionNum(Long partnerId, String unit) {
return success(partnerList.chartLineInspectionNum(partnerId, unit));
}
/**
* staticsTable1
* 新检测数量折线图
*/
@GetMapping("/newChartLineInspectionNum")
public CommonResult newChartLineInspectionNum(String unit) {
return success(partnerList.newChartLineInspectionNum(unit));
}
/**
* 检测金额折线图
*/
@GetMapping("/chartLineInspectionAmount")
public CommonResult chartLineInspectionAmount(Long partnerId, String unit) {
return success(partnerList.chartLineInspectionAmount(partnerId, unit));
}
/**
* 新检测金额折线图
*/
@GetMapping("/newChartLineInspectionAmount")
public CommonResult newChartLineInspectionAmount(String unit) {
return success(partnerList.newChartLineInspectionAmount(unit));
}
/**
* 检测线图
*/
@GetMapping("/chartInfoNum")
public CommonResult chartInfoNum(Long partnerId, String unit) {
return success(partnerList.chartInfoNum(partnerId, unit));
}
/**
* 新检测线图
*/
@GetMapping("/newChartInfoNum")
public CommonResult newChartInfoNum(String unit) {
return success(partnerList.newChartInfoNum(unit));
}
/**
* 检测线图
*/
@GetMapping("/chartInfoRatio")
public CommonResult chartInfoRatio(Long partnerId, String unit) throws Exception {
if (ObjectUtil.isNull(partnerId)) {
partnerId = partnerList.shopInfoByUserId().getPartnerId();
}
return success(partnerList.chartInfoRatio(partnerId, unit));
}
/**
* 新检测线图
*/
@GetMapping("/newChartInfoRatio")
public CommonResult newChartInfoRatio(String unit) {
return success(partnerList.newChartInfoRatio(unit));
}
/**
* 首页 订单信息
*/
@GetMapping("/orderInfo")
public CommonResult orderInfo(Long partnerId) {
return success(partnerList.orderInfo(partnerId));
}
/**
* 热销商品列表
*/
@GetMapping("/hotGoodsList")
public CommonResult hotGoodsList(Long partnerId) {
return success(partnerList.hotGoodsList(partnerId));
}
/**
* 热销商品列表
*/
@GetMapping("/newHotGoodsList")
public CommonResult newHotGoodsList() {
return success(partnerList.newHotGoodsList());
}
/**
* 分页查询所有数据
*
* @return 所有数据
*/
@GetMapping("/categoryList")
public CommonResult categoryList(Long partnerId) {
return success(partnerList.categoryList(partnerId));
}
/**
* 发布商品
*/
@PostMapping("/addGoods")
public CommonResult addGoods(@RequestBody ShopInspectionGoods goods) throws Exception {
partnerList.addGoods(goods);
return success();
}
/**
* 商品管理列表
*/
@GetMapping("/goodsList")
public CommonResult goodsList(Long partnerId, String isListing, String goodsTitle,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
// LoginUser user = SecurityFrameworkUtils.getLoginUser();
// ShopMallPartners partners = partnerList.getById(partnerId);
// if (!partners.getUserId().equals(user.getId())) {
// return null;
// }
Page<GoodsVo> page = new Page<>(pageNum, pageSize);
IPage<GoodsVo> list = partnerList.goodsList(page, partnerId, isListing, goodsTitle);
return success(list);
}
/**
* 商品管理列表
*/
@GetMapping("/canUsegoods")
public CommonResult canUseGoods(Long partnerId) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partners = partnerList.getById(partnerId);
if (!partners.getUserId().equals(user.getId())) {
return null;
}
return success(partnerList.canUseGoods(partnerId));
}
/**
* 商品详细信息
*/
@GetMapping("/goodsDetail")
public CommonResult goodsDetail(Long goodsId) {
return success(partnerList.goodsDetail(goodsId));
}
/**
* 修改商品
*/
@PostMapping("/editGoods")
public CommonResult editGoods(@RequestBody ShopInspectionGoods goods) throws Exception {
partnerList.editGoods(goods);
return success();
}
@PostMapping("/editSkuPrice")
public CommonResult editSkuPrice(@RequestBody ShopInspectionGoods goods) throws Exception {
partnerList.editSkuPrice(goods);
return success();
}
/**
* 上下架
*/
@PostMapping("/changeListing")
public CommonResult changeListing(Long goodsId) throws Exception {
partnerList.changeListing(goodsId);
return success();
}
/**
* 删除商品
*/
@PostMapping("/delGoods")
public CommonResult delGoods(Long goodsId) throws Exception {
partnerList.delGoods(goodsId);
return success();
}
/**
* 管理店铺信息
*/
@PostMapping("/getPartnerInfo")
public CommonResult getPartnerInfo(Long partnerId) {
return success(partnerList.getPartnerInfo(partnerId));
}
/**
* 管理店铺信息
*/
@PostMapping("/editPartnerInfo")
public CommonResult editPartnerInfo(@RequestBody ShopMallPartners partners) {
partnerList.editPartnerInfo(partners);
return success();
}
/**
* 店铺账户信息
*/
@GetMapping("/accountInfo")
public CommonResult accountInfo(Long partnerId) {
return success(partnerList.accountInfo(partnerId));
}
/**
* 店铺账户信息
*/
@GetMapping("/accountDetail")
public CommonResult accountDetail(Long partnerId,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<PartnerBalanceDetail> page = new Page<>(pageNum, pageSize);
IPage<PartnerBalanceDetail> details = partnerList.accountDetail(page, partnerId, pageNum, pageSize);
return success(details);
}
/**
* 当前店铺的订单信息
*/
@GetMapping("/orderList")
public CommonResult orderList(Long partnerId, String phoneNum, String title,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partnersTmp = partnerList.getById(partnerId);
if (!partnersTmp.getUserId().equals(user.getId())) {
return null;
}
Page<OrderAppDetail> page = new Page<>(pageNum, pageSize);
IPage<OrderAppDetail> orderInfos = partnerList.orderList(page, partnerId, phoneNum, title);
return success(orderInfos);
}
/**
* 通过核销码获取订单信息
*/
@GetMapping("/orderDetailByCode")
public CommonResult orderDetailByCode(Long partnerId, String code) throws Exception {
Long orderId = partnerList.orderDetailByCode(partnerId, code);
return success(orderId);
}
/**
* 当前的订单信息
*/
@GetMapping("/orderDetail")
public CommonResult orderDetail(Long partnerId, Long orderId) {
OrderAppDetail orderInfos = partnerList.orderDetail(partnerId, orderId);
return success(orderInfos);
}
/**
* 店铺核销功能
*/
@PostMapping("/takeOut")
public CommonResult takeOut(@RequestBody InspectionInfo inspectionInfo) throws Exception {
partnerList.takeOut(inspectionInfo);
return success();
}
@PostMapping("/addWorker")
public CommonResult addWorker(Long partnerId, String realName, String phoneNum, Long postId) throws Exception {
partnerList.addWorker(partnerId, realName, phoneNum, postId);
return success();
}
/**
* 获取员工信息
*/
@GetMapping("/getWorkList")
public CommonResult<IPage<?>> getWorkList(Long partnerId, String workName, String phoneNum, Long postId, Integer pageNum, Integer pageSize) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
// ShopMallPartners partnersTmp = partnerList.getById(partnerId);
// if (!partnersTmp.getUserId().equals(user.getId())){
// return null;
// }
/*获取检测的用户*/
RolePageReqVO reqVO = new RolePageReqVO();
reqVO.setPageNo(pageNum);
reqVO.setNickname(workName);
reqVO.setPageSize(pageSize);
IPage<UserDTO> userDTOIPage = roleService.selectListByRoleId(reqVO);
// Page<LabelRespVO> page = new Page<>(pageNum, pageSize);
// IPage<PartnerWorker> workList = partnerList.pageWorkList(partnerId,postId, workName, phoneNum,page);
return CommonResult.success(userDTOIPage);
}
@PostMapping("/delWorker")
public CommonResult delWorker(Long partnerId, String workIdStr) {
String[] workIds = workIdStr.split(",");
for (String workId : workIds) {
partnerList.delWorker(partnerId, Long.parseLong(workId));
}
return success();
}
//获取检测的数据
@GetMapping("/inspectionList")
public CommonResult inspectionList(Long partnerId, String status, String carNum, Integer pageSize, Integer pageNum) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
if (!partnerId.equals(partners.getPartnerId())) {
return null;
}
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
IPage<InspectionInfo> inspectionInfos = partnerList.inspectionList(page, partnerId, status, carNum);
return success(inspectionInfos);
}
//获取检测的详细信息
@GetMapping("/inspectionDetail")
@TenantIgnore
public CommonResult inspectionDetail(Long inspectionInfoId) {
return CommonResult.success(partnerList.inspectionDetail(inspectionInfoId));
}
//获取检测的数据
@GetMapping("/workerInspectionList")
public CommonResult workerInspectionList(Long partnerId, String status, String searchValue, Integer pageSize, Integer pageNum) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
LambdaQueryWrapper<PartnerWorker> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PartnerWorker::getUserId, user.getId()).eq(PartnerWorker::getPartnerId, partnerId);
PartnerWorker worker = partnerWorkerService.getOne(queryWrapper);
if (ObjectUtil.isEmpty(worker)) {
return null;
}
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
IPage<InspectionInfo> inspectionInfos = partnerList.inspectionList(page, partnerId, status, searchValue);
return success(inspectionInfos);
}
//增加检测步骤信息
@PostMapping("/addStepInfo")
public CommonResult addStepInfo(@RequestBody InspectionStepInfo stepInfo) {
partnerList.addStepInfo(stepInfo);
return success();
}
//增加检测结果
@PostMapping("/stopInspection")
public CommonResult editInspection(@RequestBody InspectionInfo info) throws Exception {
partnerList.stopInspection(info);
return success();
}
//完成制证
@PostMapping("/makeCertOk")
public CommonResult makeCertOk(Long inspectionId) {
partnerList.makeCertOk(inspectionId);
return success();
}
//获取到店预约的数据
@GetMapping("/getAppointmentList")
public CommonResult getAppointmentList(Long partnerId, String phoneNum, Integer pageSize, Integer pageNum, String carNo) {
// LoginUser user = SecurityFrameworkUtils.getLoginUser();
// ShopMallPartners partnersTmp = partnerList.getById(partnerId);
// if (!partnersTmp.getUserId().equals(user.getId())){
// return null;
// }
Page<InspectionAppointment> page = new Page<>(pageNum, pageSize);
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, partnerId, phoneNum,carNo,null,null);
return success(appointments);
}
//获取上门取车数据
@GetMapping("/getPickCarList")
public CommonResult getPickCarList(Long partnerId, String phoneNum, String pickStatus, Integer pageSize, Integer pageNum) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
// ShopMallPartners partnersTmp = partnerList.getById(partnerId);
// if (!partnersTmp.getUserId().equals(user.getId())){
// return null;
// }
Page<InspectionPickCar> page = new Page<>(pageNum, pageSize);
IPage<InspectionPickCar> pickCarList = partnerList.getPickCarList(page, partnerId, phoneNum, pickStatus);
return success(pickCarList);
}
//获取上门取车详情页
@GetMapping("/getPickCarDetail")
public CommonResult getPickCarDetail(Long dataId) {
InspectionPickCar pickCar = partnerList.getPickCarDetail(dataId);
return success(pickCar);
}
// 核销记录By核销人Id
@GetMapping("/validationList")
public CommonResult validationList(Long partnerId, String searchValue,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partnersTmp = partnerList.getById(partnerId);
if (!partnersTmp.getUserId().equals(user.getId())) {
return null;
}
Page<OrderInfo> page = new Page<>(pageNum, pageSize);
IPage<OrderInfo> orderInfos = partnerList.validationList(page, partnerId, searchValue);
return success(orderInfos);
}
//送券功能
@PostMapping("/sendCoupon")
public CommonResult sendCoupon(@RequestBody ShopCouponTemplate template) throws Exception {
partnerList.sendCoupon(template);
return success();
}
//优惠券列表
@GetMapping("/listCoupon")
public CommonResult listCoupon(Long partnerId, String searchValue,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partnersTmp = partnerList.getById(partnerId);
if (!partnersTmp.getUserId().equals(user.getId())) {
return success(new ArrayList<>());
}
Page<ShopCouponTemplate> page = new Page<>(pageNum, pageSize);
IPage<ShopCouponTemplate> shopCouponTemplates = partnerList.listCoupon(page, partnerId, searchValue);
return success(shopCouponTemplates);
}
//删除优惠券
@PostMapping("/delCoupon")
public CommonResult delCoupon(Long partnerId, Long id) {
partnerList.delCoupon(partnerId, id);
return success();
}
//指派工人上门取车
@PostMapping("/designatePickCarWorker")
public CommonResult designatePickCarWorker(Long pickCarId, Long workerId) {
partnerList.designatePickCarWorker(pickCarId, workerId);
return success();
}
//获取上门取车数据
@GetMapping("/getPickCarListOfWorker")
public CommonResult getPickCarListOfWorker(Long partnerId, String phoneNum,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
// .eq(PartnerWorker::getUserId,user.getId())
// LambdaQueryWrapper<PartnerWorker> queryWrapper =new LambdaQueryWrapper<>();
// queryWrapper.eq(PartnerWorker::getPartnerId,partnerId);
// PartnerWorker worker = partnerWorkerService.getOne(queryWrapper);
// if (ObjectUtil.isEmpty(worker)){
// return null;
// }
Page<InspectionPickCar> page = new Page<>(pageNum, pageSize);
IPage<InspectionPickCar> pickCarList = partnerList.getPickCarListOfWorker(page, user.getId(), phoneNum);
return success(pickCarList);
}
//获取客户来源
@GetMapping("/getCustomerSource")
public CommonResult getCustomerSource(String searchValue) throws Exception {
ShopMallPartners partners = partnerList.shopInfoByUserId();
String dictStr = "customer_source-" + partners.getPartnerId();
DictTypeDO sysDictType = dictTypeService.getDictType(dictStr);
if (ObjectUtil.isEmpty(sysDictType)) {
//初始化
DictTypeSaveReqVO save = new DictTypeSaveReqVO();
save.setName("客户来源-" + partners.getPartnerName());
save.setStatus(0);
save.setType(dictStr);
dictTypeService.createDictType(save);
}
List<DictDataDO> dataList = dictDataService.getDictDataListByDictType(dictStr);
if (CollectionUtil.isEmpty(dataList)) {
dataList = new ArrayList<>();
}
if (StringUtils.isNotEmpty(searchValue)) {
dataList = dataList.stream().filter(it -> {
return it.getLabel().contains(searchValue);
}).collect(Collectors.toList());
}
return success(dataList);
}
//新增客户来源
@PostMapping("/addCustomerSource")
public CommonResult addCustomerSource(@RequestBody SysDictData dictData) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
String dictStr = "customer_source-" + partners.getPartnerId();
DictTypeDO sysDictType = dictTypeService.getDictType(dictStr);
DictDataSaveReqVO dictSave = new DictDataSaveReqVO();
dictSave.setLabel(dictData.getDictLabel());
dictSave.setDictType(sysDictType.getType());
dictSave.setStatus(0);
dictSave.setValue(dictData.getDictLabel());
dictSave.setCssClass("default");
dictSave.setRemark(dictData.getRemark());
dictDataService.createDictData(dictSave);
return success();
}
//新增客户来源
@PostMapping("/delCustomerSource")
public CommonResult delCustomerSource(Long dictId) {
dictDataService.deleteDictData(dictId);
return success();
}
//批量删除客户来源
@PostMapping("/delCustomerSourceBatch")
public CommonResult delCustomerSourceBatch(@RequestBody List<Long> dictIds) {
dictDataService.deleteDictDataBatch(dictIds);
return success();
}
@PostMapping("/vehicleLicenseOCR")
public CommonResult vehicleLicenseOCR(String imagePath) throws Exception {
return success(partnerList.vehicleLicenseOCR(imagePath));
}
//线下收费
@PostMapping("/offlineCharging")
public CommonResult offlineCharging(@RequestBody InspectionInfoVo infoVo) {
partnerList.offlineCharging(infoVo);
return success();
}
//获取收款账号
@GetMapping("/getBankAccountList")
public CommonResult getBankAccountList(String searchValue) throws Exception {
ShopMallPartners partners = partnerList.shopInfoByUserId();
String dictStr = "partner_bankList-" + partners.getPartnerId();
DictTypeDO sysDictType = dictTypeService.getDictType(dictStr);
if (ObjectUtil.isEmpty(sysDictType)) {
//初始化
DictTypeSaveReqVO sysDictTypeSave = new DictTypeSaveReqVO();
sysDictTypeSave.setName("收款账户-" + partners.getPartnerName());
sysDictTypeSave.setStatus(0);
sysDictTypeSave.setType(dictStr);
dictTypeService.createDictType(sysDictTypeSave);
}
List<DictDataDO> dataList = dictDataService.getDictDataListByDictType(dictStr);
if (CollectionUtil.isEmpty(dataList)) {
dataList = new ArrayList<>();
}
if (StringUtils.isNotEmpty(searchValue)) {
dataList = dataList.stream().filter(it -> {
return it.getLabel().contains(searchValue);
}).collect(Collectors.toList());
}
return success(dataList);
}
//新增银行卡账户
@PostMapping("/addBankAccount")
public CommonResult addBankAccount(@RequestBody SysDictData dictData) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
String dictStr = "partner_bankList-" + partners.getPartnerId();
DictTypeDO sysDictType = dictTypeService.getDictType(dictStr);
DictDataSaveReqVO dictSave = new DictDataSaveReqVO();
dictSave.setDictType(sysDictType.getType());
dictSave.setStatus(0);
dictSave.setLabel(dictData.getDictLabel());
dictSave.setValue(dictData.getDictValue());
dictSave.setRemark(dictData.getRemark());
dictSave.setCssClass("default");
dictDataService.createDictData(dictSave);
return success();
}
//删除银行卡账户
@PostMapping("/delBankAccount")
public CommonResult delBankAccount(Long dictId) {
dictDataService.deleteDictData(dictId);
return success();
}
//工单预览
@GetMapping("/workOrderView")
public CommonResult workOrderView(Long inspectionId) {
return success(partnerList.workOrderView(inspectionId));
}
//岗位信息
@GetMapping("/inspectionPostInfo")
public CommonResult inspectionPostInfo() {
return success(partnerList.inspectionPostInfo());
}
//统计表格1
@GetMapping("/staticsTable1")
public CommonResult staticsTable1(String startTime, String endTime) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable1(partners.getPartnerId(), startTime, endTime));
}
//统计表格1
@GetMapping("/newStaticsTable1")
public CommonResult newStaticsTable1(String startTime, String endTime) throws Exception {
return success(partnerList.newStaticsTable1(startTime, endTime));
}
//统计表格2
@GetMapping("/staticsTable2")
public CommonResult staticsTable2(String startTime, String endTime) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable2(partners.getPartnerId(), startTime, endTime));
}
//新统计表格2
@GetMapping("/newStaticsTable2")
public CommonResult newStaticsTable2(String startTime, String endTime) throws Exception {
return success(partnerList.newStaticsTable2(startTime, endTime));
}
//统计表格3
@GetMapping("/staticsTable3")
public CommonResult staticsTable3(String startTime, String endTime) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable3(partners.getPartnerId(), startTime, endTime));
}
//新统计表格3
@GetMapping("/newStaticsTable3")
public CommonResult newStaticsTable3(String startTime, String endTime) throws Exception {
return success(partnerList.newStaticsTable3(startTime, endTime));
}
//统计表格3
@GetMapping("/staticsTable3Detail")
public CommonResult staticsTable3Detail(String startTime, String endTime, String remark) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable3Detail(partners.getPartnerId(), startTime, endTime, remark));
}
//统计表格4
@GetMapping("/staticsTable4")
public CommonResult staticsTable4(String startTime, String endTime) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable4(partners.getPartnerId(), startTime, endTime));
}
//统计表格5
@GetMapping("/staticsTable5")
public CommonResult staticsTable5(String startTime, String endTime) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable5(partners.getPartnerId(), startTime, endTime));
}
/**
* 查询检测类型统计
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 结果
*/
@GetMapping("/queryInspectionSkuList")
public CommonResult<?> queryInspectionSkuList(String startTime, String endTime) {
if (StrUtil.isEmpty(startTime) || StrUtil.isEmpty(endTime)) {
startTime = DateUtil.format(new Date(), "yyyy-MM-dd");
endTime = DateUtil.format(new Date(), "yyyy-MM-dd");
}
return success(partnerList.queryInspectionSkuList(startTime, endTime));
}
/**
* 根据inspection_info的id查有的项目名称
*
* @param ids inspection_info的id
* @author 小李
* @date 14:52 2024/12/10
**/
@GetMapping("/getProjectByIds")
public CommonResult<?> getProjectByIds(Long[] ids) {
return success(partnerList.getProjectByIds(ids));
}
/**
* 根据时间查订单
*
* @param startTime 开始时间 非必传
* @param endTime 结束时间 非必传
* @param pageNum 页码
* @param pageSize 条数
* @author 小李
* @date 14:39 2024/12/12
**/
@GetMapping("/getOrderByDate")
public CommonResult<?> getOrderByDate(OrderTableQuery query,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<OrderTable> page = new Page<>(pageNum, pageSize);
return success(partnerList.getOrderByDate(query, page));
}
/**
* 根据时间查订单
*
* @param startTime 开始时间 非必传
* @param endTime 结束时间 非必传
* @param pageNum 页码
* @param pageSize 条数
* @author 小李
* @date 14:39 2024/12/12
**/
@GetMapping("/getOrderApp")
public CommonResult<?> getOrderApp(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "chooseStatus", required = false) String chooseStatus,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<OrderTable> page = new Page<>(pageNum, pageSize);
return success(partnerList.getOrderApp(startTime, endTime, chooseStatus, page));
}
/**
* 分类计数
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param chooseStatus 状态
* @author 小李
* @date 17:14 2024/12/16
**/
@GetMapping("/getTypeCount")
public CommonResult<?> getTypeCount(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "chooseStatus", required = false) String chooseStatus) {
return success(partnerList.getTypeCount(startTime, endTime, chooseStatus));
}
/**
* 获取员工统计
*
* @param dlInspectionProject 项目
* @return 结果
*/
@PostMapping("/getStaffCount")
public CommonResult<?> getStaffCount(@RequestBody DlInspectionProject dlInspectionProject) {
return success(partnerList.getStaffCount(dlInspectionProject));
}
}

View File

@ -26,7 +26,8 @@ public class InspectionBusinessChannelController {
public CommonResult<List<InspectionBusinessChannel>> getChannelTree(InspectionBusinessChannel channel) {
return CommonResult.success(inspectionBusinessChannelService.list(Wrappers.<InspectionBusinessChannel>lambdaQuery()
.eq(ObjectUtil.isNotEmpty(channel.getType()), InspectionBusinessChannel::getType, channel.getType())
.like(ObjectUtil.isNotEmpty(channel.getName()), InspectionBusinessChannel::getName, channel.getName())));
.like(ObjectUtil.isNotEmpty(channel.getName()), InspectionBusinessChannel::getName, channel.getName())
.orderByAsc(InspectionBusinessChannel::getSort)));
}
/**

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.inspection.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/inspection/orderInfo")
@RequiredArgsConstructor
public class InspectionOrderInfoController {
private final OrderInfoService orderInfoService;
/**
* 修改订单信息
*
* @param orderInfo 修改的订单信息
* @return 修改结果
*/
@PutMapping
public CommonResult<?> update(@RequestBody OrderInfo orderInfo) {
return CommonResult.success(orderInfoService.updateById(orderInfo));
}
/**
* 获取订单信息
* @param id
* @return
*/
@GetMapping("/{id}")
public CommonResult<?> get(@PathVariable Long id){
return CommonResult.success(orderInfoService.getById(id));
}
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.inspection.controller.app;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.inspection.service.InspectionStaffService;
import cn.iocoder.yudao.module.inspection.service.InspectionStepInfoService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.security.PermitAll;
@Tag(name = "小程序 - 检测")
@RestController
@RequestMapping("/inspection")
@RequiredArgsConstructor
public class AppInspectionController {
private final InspectionStaffService inspectionStaffService;
/**
* 根据唯一码查询检测人员
*
* @param uniqueCode 唯一码
* @return 检测人员
*/
@RequestMapping("/getInspectionStaffByUniqueCode")
@TenantIgnore
@PermitAll
public CommonResult<?> getInspectionStaffByUniqueCode(@RequestParam("uniqueCode") String uniqueCode) {
return CommonResult.success(inspectionStaffService.getInspectionStaffByUniqueCode(uniqueCode));
}
}

View File

@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.inspection.controller.app;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.inspection.query.GoodsQuery;
import cn.iocoder.yudao.module.inspection.service.AppInspectionGoodsService;
import cn.iocoder.yudao.module.inspection.service.IInspectionAppointmentService;
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 static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@RestController
@RequestMapping("/goods")
public class AppInspectionGoodsController
{
@Autowired
private AppInspectionGoodsService appInspectionGoodsService;
@Autowired
private IInspectionAppointmentService appointmentService;
/**
* 获取商品规格
*/
@GetMapping("/goodsSkuList")
public CommonResult goodsSkuList(GoodsQuery goodsQuery)
{
return success(appInspectionGoodsService.goodsSkuList(goodsQuery));
}
/**
* 预约功能
*/
@GetMapping("/appointmentDateList")
public CommonResult appointmentDateList(Long goodsId,String type)
{
return success(appointmentService.appointmentDateList(goodsId,type));
}
/**
* 获取商品详情
*/
@GetMapping("/goodsDetail")
public CommonResult goodsDetail(GoodsQuery goodsQuery)
{
return success(appInspectionGoodsService.goodsDetail(goodsQuery));
}
/**
* 下单页信息返回
*/
@GetMapping("/orderSkuInfo")
public CommonResult orderSkuInfo(GoodsQuery goodsQuery)
{
return success(appInspectionGoodsService.orderSkuInfo(goodsQuery));
}
}

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.inspection.controller.app;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
import cn.iocoder.yudao.module.inspection.service.AppInspectionOrderService;
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/order")
public class AppInspectionOrderController extends BaseController {
@Autowired
private AppInspectionOrderService appInspectionOrderService;
@Autowired
private OrderInfoService orderInfoService;
@GetMapping("/orderList")
@TenantIgnore
public CommonResult orderList(String status, String title,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) {
Page<OrderInfo> page = new Page<>(pageNum, pageSize);
IPage<OrderInfo> orderInfos = orderInfoService.orderListApp(page, status, title, "jc");
return success(orderInfos);
}
@GetMapping("/orderDetail")
public CommonResult orderDetail(Long orderId) {
return CommonResult.success(appInspectionOrderService.orderDetailApp(orderId));
}
//获取检测的数据
@GetMapping("/inspectionList")
@TenantIgnore
public CommonResult inspectionList(String status,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) {
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
IPage<InspectionInfo> inspectionInfos = appInspectionOrderService.inspectionList(page,status);
return success(inspectionInfos);
}
//获取检测的详细信息
@GetMapping("/inspectionDetail")
public CommonResult inspectionDetail(Long inspectionInfoId) {
return CommonResult.success(appInspectionOrderService.inspectionDetail(inspectionInfoId));
}
//评论商品和星级
@PostMapping("/reviewOrder")
public CommonResult reviewOrder(String orderId,Integer starLevel,String reviewStr) throws Exception {
orderInfoService.reviewOrder(orderId,starLevel,reviewStr);
return CommonResult.ok();
}
//政府部门获取检测的数据统计
@GetMapping("/statisticsTop")
public CommonResult statisticsTop() {
return success(appInspectionOrderService.statisticsTop());
}
//政府部门获取检测的数据统计
@GetMapping("/statisticsMid")
public CommonResult statisticsMid() {
return success(appInspectionOrderService.statisticsMid());
}
//政府部门获取检测的数据统计
@GetMapping("/statisticsZXT")
public CommonResult statisticsZXT(Long partnerId,String type) {
return success(appInspectionOrderService.statisticsZXT(partnerId,type));
}
//政府部门获取检测的数据统计
@GetMapping("/statisticsOrder")
public CommonResult statisticsOrder() {
return success(appInspectionOrderService.statisticsOrder());
}
//政府部门获取检测的数据
@GetMapping("/getPartnerList")
public CommonResult getPartnerList(String partnerName) {
return success(appInspectionOrderService.getPartnerList(partnerName));
}
//政府部门获取检测的数据
@GetMapping("/governmentInspectionList")
public CommonResult governmentInspectionList(String carNum,String status,String partnerId,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) {
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
IPage<InspectionInfo> inspectionInfos = appInspectionOrderService.governmentInspectionList(page,carNum,status,partnerId);
return success(inspectionInfos);
}
}

View File

@ -7,15 +7,20 @@ import cn.hutool.core.util.StrUtil;
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.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.entity.*;
import cn.iocoder.yudao.module.inspection.query.GoodsQuery;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.inspection.service.AppInspectionGoodsService;
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
import cn.iocoder.yudao.module.inspection.vo.*;
import cn.iocoder.yudao.module.partner.entity.PartnerBalanceDetail;
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.commentVo;
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
import cn.iocoder.yudao.module.shop.entity.ShopCouponTemplate;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
@ -425,6 +430,7 @@ public class AppPartnerOwnController extends BaseController {
//获取检测的详细信息
@GetMapping("/inspectionDetail")
@TenantIgnore
public CommonResult inspectionDetail(Long inspectionInfoId) {
return CommonResult.success(partnerList.inspectionDetail(inspectionInfoId));
}
@ -474,7 +480,7 @@ public class AppPartnerOwnController extends BaseController {
// return null;
// }
Page<InspectionAppointment> page = new Page<>(pageNum, pageSize);
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, partnerId, phoneNum,carNo,null,null);
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, partnerId, phoneNum, carNo, null, null);
return success(appointments);
}
@ -820,10 +826,10 @@ public class AppPartnerOwnController extends BaseController {
**/
@GetMapping("/getOrderApp")
public CommonResult<?> getOrderApp(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "chooseStatus", required = false) String chooseStatus,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "chooseStatus", required = false) String chooseStatus,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<OrderTable> page = new Page<>(pageNum, pageSize);
return success(partnerList.getOrderApp(startTime, endTime, chooseStatus, page));
}
@ -854,4 +860,32 @@ public class AppPartnerOwnController extends BaseController {
public CommonResult<?> getStaffCount(@RequestBody DlInspectionProject dlInspectionProject) {
return success(partnerList.getStaffCount(dlInspectionProject));
}
// ================================================================================================
@Autowired
private AppInspectionGoodsService appInspectionGoodsService;
@Autowired
private OrderInfoService orderInfoService;
/**
* 商品列表查询
*/
@GetMapping("/list")
@TenantIgnore
public CommonResult goodsList(GoodsQuery goodsQuery) {
List<GoodsVo> list = appInspectionGoodsService.goodsList(goodsQuery);
return success(list);
}
@GetMapping("/getCommentOrderList")
@TenantIgnore
public CommonResult getCommentOrderList(
@RequestParam(value = "tenantId", required = false, defaultValue = "1") Long tenantId,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<commentVo> page = new Page<>(pageNum, pageSize);
IPage<commentVo> commentOrderList = orderInfoService.getCommentOrderList(page, tenantId);
return success(commentOrderList);
}
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.inspection.controller.app;
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.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.inspection.service.AppUserOwnService;
import cn.iocoder.yudao.module.shop.service.IShopUserCarService;
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 static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@RestController
@RequestMapping("/appInspection/userOwn")
public class AppUserInfoController {
@Autowired
private AppUserOwnService ownService;
@Autowired
private IShopUserCarService shopUserCarService;
@GetMapping("/getCars")
@TenantIgnore
public CommonResult getCars()
{
return success(ownService.getCars());
}
@GetMapping(value = "/getUserCar")
@TenantIgnore
public CommonResult getUserCarByUserId()
{
//当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
return success(shopUserCarService.selectShopUserCarByUserId(loginUser.getId()));
}
}

View File

@ -94,4 +94,11 @@ public class InspectionAppointment extends TenantBaseDO
private String isUse;
@TableField(exist = false)
private String owner;
/**
* 用于区分 预约表还是接车
*/
@TableField(exist = false)
private String sourceType;
@TableField(exist = false)
private String customerSource;
}

View File

@ -19,6 +19,8 @@ public class InspectionBusinessChannel extends TenantBaseDO {
private String userIds; // 绑定的用户ID
private Integer sort; // 排序
// 子节点
@TableField(exist = false)
private List<InspectionBusinessChannel> children;

View File

@ -214,4 +214,18 @@ public class InspectionInfo extends TenantBaseDO
private String content;
@TableField(exist = false)
private Long inspectionInfoId;
@TableField(exist = false)
private Integer isMeetPickCar;
@TableField(exist = false)
private String pickCarAddress;
/**
* 出纳是否确认 0-未到账 1-已到账 null-待确认
*/
@TableField(exist = false)
private String cashierConfirm;
/**
* 出纳确认备注
*/
@TableField(exist = false)
private String cashierConfirmRemark;
}

View File

@ -76,6 +76,16 @@ public class InspectionMeetCarOrder extends TenantBaseDO {
*/
private Integer meetType;
/**
* 是否上门取车 0否 1是
*/
private Integer isPickCar;
/**
* 上门接车是否完成 0未完成 1已完成
*/
private Integer isMeetPickCar;
@TableField(exist = false)
private Long appointmentId;

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.inspection.mapper;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -73,6 +74,7 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
IPage<InspectionInfo> pageWorkOrder(@Param("partnerId") Long partnerId, @Param("carNum")String carNum, @Param("goodsTitle")String goodsTitle
, @Param("customerSource")String customerSource, @Param("payType")String payType, @Param("startTime")String startTime
, @Param("roleId") Long roleId, @Param("endTime")String endTime,Page<InspectionInfo> page);
IPage<InspectionInfo> pageWorkOrderNew(@Param("query") OrderTableQuery query, Page<InspectionInfo> page);
List<InspectionInfo> delworkOrder(@Param("partnerId") Long partnerId, @Param("carNum")String carNum, @Param("goodsTitle")String goodsTitle
,@Param("customerSource")String customerSource,@Param("payType")String payType,@Param("startTime")String startTime
@ -99,4 +101,6 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
IPage<InspectionInfo> geStelectInspectionByBusiness(@Param("page") Page<InspectionInfo> page,@Param("info") InspectionInfo inspectionInfo);
List<InspectionInfo> selectMeetCarList(@Param("datetimeRange") List<String> datetimeRange);
Map<String, Object> workOrderDataNew(@Param("query") OrderTableQuery query);
}

View File

@ -49,5 +49,13 @@ public interface InspectionStaffMapper extends BaseMapper<InspectionStaff> {
* @return
*/
List<InspectionStaffExportVo> getAll(InspectionStaffQuery query);
/**
* 根据唯一码查询检测员工子表
*
* @param uniqueCode 唯一码
* @return
*/
InspectionStaffSaveVo getInspectionStaffByUniqueCode(String uniqueCode);
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.inspection.vo.DlInspectionWorkNodeVo;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -79,6 +80,7 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
List<InspectionInfo> workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
IPage<InspectionInfo> pageWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime,Page<InspectionInfo> page);
IPage<InspectionInfo> pageWorkOrder(OrderTableQuery query, Page<InspectionInfo> page);
List<InspectionInfo> delworkOrder(Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime);
@ -86,6 +88,7 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
IPage<InspectionInfo> pageDelWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime,Page<InspectionInfo> page);
Map<String,Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
Map<String,Object> workOrderData(OrderTableQuery query);
/**
* 根据当前登陆人获取可以选择的工单

View File

@ -79,9 +79,18 @@ public interface InspectionStaffService extends IService<InspectionStaff> {
/**
* 获取已完成项目
*
* @param userId
* @return
*/
IPage<Map<String, Object>> getFinishProjectByUserId(Page<Map<String, Object>> page, InspectionListQuery query);
/**
* 根据唯一码获取检测员工
*
* @param uniqueCode 唯一码
* @return
*/
InspectionStaffSaveVo getInspectionStaffByUniqueCode(String uniqueCode);
}

View File

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.common.service.InspectionNoticeService;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.constant.InspectionConstants;
import cn.iocoder.yudao.module.constant.InspectionFileEnum;
@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
@ -44,6 +46,9 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
@Autowired
private InspectionFileRecordService fileRecordService;
@Autowired
private InspectionNoticeService noticeService;
/**
* 查询inspectionFile
*
@ -154,6 +159,35 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
}
InspectionFile file = this.selectInspectionFileById(inspectionFile.getId());
// 对比文件信息找出修改了什么内容
try {
Map<String, Map<String, Object>> compare = compare(file, inspectionFile);
List<String> keys = new ArrayList<>();
for (Map.Entry<String, Map<String, Object>> entry : compare.entrySet()) {
if ("fileName".equals(entry.getKey())) {
if ("1".equals(file.getType())) {
keys.add(entry.getValue().get("oldValue") + "文件夹称修改为" + entry.getValue().get("newValue"));
}else if ("2".equals(file.getType())) {
keys.add(entry.getValue().get("oldValue") + "文件称修改为" + entry.getValue().get("newValue"));
}
}
if ("filePath".equals(entry.getKey())) {
keys.add("路径修改为" + entry.getValue().get("newValue"));
}
System.out.println("字段 '" + entry.getKey() + "' 变化: " +
entry.getValue().get("oldValue") + " -> " +
entry.getValue().get("newValue"));
}
// 发送站内信
// 将keys以后好隔开
String content = String.join(",", keys);
noticeService.sentMessage(842L, content);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
if ((ObjectUtil.isNotEmpty(inspectionFile.getFilePath()) && ObjectUtil.isNotEmpty(file.getFilePath()) && !file.getFilePath().equals(inspectionFile.getFilePath()))
|| (ObjectUtil.isNotEmpty(inspectionFile.getFileName()) && !file.getFileName().equals(inspectionFile.getFileName()))
|| (ObjectUtil.isNotEmpty(inspectionFile.getWarnTime()) && !file.getWarnTime().equals(inspectionFile.getWarnTime()))) {
@ -177,6 +211,38 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
.eq(InspectionFile::getId, inspectionFile.getId()));
}
public static Map<String, Map<String, Object>> compare(InspectionFile oldObj, InspectionFile newObj) throws IllegalAccessException {
Map<String, Map<String, Object>> differences = new HashMap<>();
// 获取类的所有字段包括私有字段
Field[] fields = InspectionFile.class.getDeclaredFields();
for (Field field : fields) {
// 设置可访问私有字段
field.setAccessible(true);
// 跳过serialVersionUID字段
if ("serialVersionUID".equals(field.getName())) {
continue;
}
// 获取字段值
Object oldValue = field.get(oldObj);
Object newValue = field.get(newObj);
// 比较字段值
if ((oldValue == null && newValue != null) ||
(oldValue != null && !oldValue.equals(newValue))) {
Map<String, Object> diff = new HashMap<>();
diff.put("oldValue", oldValue);
diff.put("newValue", newValue);
differences.put(field.getName(), diff);
}
}
return differences;
}
/**
* 批量删除inspectionFile
*

View File

@ -30,6 +30,7 @@ import cn.iocoder.yudao.module.constant.InspectionConstants;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.inspection.vo.DlInspectionWorkNodeVo;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
@ -175,7 +176,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
AdminUserDO workerUser = userService.getUser(loginUser.getId());
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户";
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "";
AdminUserDO user = getAdminUserDO(buyPhone);
// AdminUserDO user = getAdminUserDO(buyPhone);
AdminUserDO user = userService.getUserByUsername(buyPhone, null, USER_TYPE_CUS);
if (ObjectUtils.isEmpty(user)) {
//新增用户
@ -541,7 +543,9 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
// 修改接车订单表
inspectionMeetCarOrderService.update(Wrappers.<InspectionMeetCarOrder>lambdaUpdate()
.eq(InspectionMeetCarOrder::getId, inspectionInfo.getId())
.set(InspectionMeetCarOrder::getMeetManId, inspectionInfo.getMeetManId()));
.set(InspectionMeetCarOrder::getMeetManId, inspectionInfo.getMeetManId())
.set(InspectionMeetCarOrder::getIsMeet, 0)
.set(InspectionMeetCarOrder::getIsMeetPickCar, 0));
// 查询接车订单信息
InspectionMeetCarOrder order = inspectionMeetCarOrderService.getById(inspectionInfo.getId());
@ -609,6 +613,10 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
public IPage<InspectionInfo> pageWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page<InspectionInfo> page) {
return baseMapper.pageWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page);
}
@Override
public IPage<InspectionInfo> pageWorkOrder(OrderTableQuery query, Page<InspectionInfo> page) {
return baseMapper.pageWorkOrderNew(query, page);
}
@Override
public List<InspectionInfo> delworkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
@ -625,6 +633,11 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
return baseMapper.workOrderData(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
}
@Override
public Map<String, Object> workOrderData(OrderTableQuery query) {
return baseMapper.workOrderDataNew(query);
}
/**
* 根据当前登陆人获取可以选择的工单
*
@ -929,7 +942,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
// 修改接车订单表为已接车
inspectionMeetCarOrderService.update(Wrappers.<InspectionMeetCarOrder>lambdaUpdate()
.eq(InspectionMeetCarOrder::getId, inspectionWorkNode.getMeetCarId())
.set(InspectionMeetCarOrder::getIsMeet, InspectionConstants.INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_YES));
.set(InspectionMeetCarOrder::getIsMeet, InspectionConstants.INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_YES)
.set(InspectionMeetCarOrder::getIsMeetPickCar, InspectionConstants.INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_YES));
}
return true;
@ -950,7 +964,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
InspectionStepInfo stepInfo = new InspectionStepInfo();
stepInfo.setInspectionInfoId(inspectionWorkNode.getInspectionInfoId());
String title = "还车拍照";
if (inspectionWorkNode.getReturnType() == 0 ){
if (inspectionWorkNode.getReturnType() == 0) {
title = "还车拍照";
} else if (inspectionWorkNode.getReturnType() == 1) {
title = "上门还车";

View File

@ -49,6 +49,8 @@ public class InspectionMeetCarOrderServiceImpl extends ServiceImpl<InspectionMee
private final InspectionNoticeService noticeService;
private final InspectionBusinessMeetAddressRecordService meetAddressRecordService;
/**
* 添加接车订单
*
@ -146,5 +148,13 @@ public class InspectionMeetCarOrderServiceImpl extends ServiceImpl<InspectionMee
.eq(InspectionMeetCarOrder::getId, order.getId())
.set(InspectionMeetCarOrder::getIsMeet, 1));
}
// 判断上门取车地址是否为空 如果不为空添加到记录中
if (ObjectUtil.isNotEmpty(order.getMeetAddress())) {
InspectionBusinessMeetAddressRecord meetAddressRecord = new InspectionBusinessMeetAddressRecord();
meetAddressRecord.setUserId(SecurityFrameworkUtils.getLoginUserId());
meetAddressRecord.setAddress(order.getMeetAddress());
meetAddressRecordService.save(meetAddressRecord);
}
}
}

View File

@ -306,6 +306,17 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
return inspectionWorkNodeMapper.selectStaffProjectByUserId(page,query);
}
/**
* 根据唯一码获取检测员工
*
* @param uniqueCode 唯一码
* @return
*/
@Override
public InspectionStaffSaveVo getInspectionStaffByUniqueCode(String uniqueCode) {
return baseMapper.getInspectionStaffByUniqueCode(uniqueCode);
}
/**
* 保存检测员工
*

View File

@ -99,6 +99,14 @@ public class OrderInfo extends TenantBaseDO {
private Long partnerId;
//合作商id
private String partnerName;
/**
* 出纳是否确认 0-未到账 1-已到账 null-待确认
*/
private String cashierConfirm;
/**
* 出纳确认备注
*/
private String cashierConfirmRemark;
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.payment.service;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.label.vo.LabelPageReqVO;
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
@ -31,8 +32,10 @@ public interface OrderInfoService extends IService<OrderInfo> {
List<InspectionInfo> workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
IPage<InspectionInfo> pageWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime,Page<InspectionInfo> page);
IPage<InspectionInfo> pageWorkOrder(OrderTableQuery query, Page<InspectionInfo> page);
Map<String, Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
Map<String, Object> workOrderData(OrderTableQuery query);
List<InspectionInfo> delworkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.inspection.entity.*;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.inspection.service.*;
import cn.iocoder.yudao.module.inspection.vo.InspectionOrderExportVo;
import cn.iocoder.yudao.module.partner.entity.PartnerWorker;
@ -141,6 +142,18 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
return iInspectionInfoService.pageWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page);
}
@Override
public IPage<InspectionInfo> pageWorkOrder(OrderTableQuery query, Page<InspectionInfo> page) {
if (StringUtils.isNotEmpty(query.getStartTime())) {
query.setStartTime(query.getStartTime() + " 00:00:00");
}
if (StringUtils.isNotEmpty(query.getEndTime())) {
query.setEndTime(query.getEndTime() + " 23:59:59");
}
return iInspectionInfoService.pageWorkOrder(query, page);
}
@Override
public Map<String, Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
if (StringUtils.isNotEmpty(startTime)) {
@ -151,6 +164,16 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
}
return iInspectionInfoService.workOrderData(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
}
@Override
public Map<String, Object> workOrderData(OrderTableQuery query) {
if (StringUtils.isNotEmpty(query.getStartTime())) {
query.setStartTime(query.getStartTime() + " 00:00:00");
}
if (StringUtils.isNotEmpty(query.getEndTime())) {
query.setEndTime(query.getEndTime() + " 23:59:59");
}
return iInspectionInfoService.workOrderData(query);
}
@Override
public List<InspectionInfo> delworkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {

View File

@ -0,0 +1,105 @@
package cn.iocoder.yudao.util;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import org.apache.poi.ss.usermodel.*;
import java.util.List;
public class ExcelExtraHelper {
/**
* 根据内容自动设置列宽并设置样式
* @param writer ExcelWriter
* @param rows 所有行含表头
* @param timeColumnIndexList 哪些列是时间列索引从0开始
* @param numberColumnIndexList 哪些列是数字列右对齐
*/
public static void enhanceExcel(ExcelWriter writer, List<List<String>> rows,
List<Integer> timeColumnIndexList, List<Integer> numberColumnIndexList) {
if (CollUtil.isEmpty(rows)) return;
// ============ 1. 表头样式 ============
CellStyle headStyle = writer.getHeadCellStyle();
Font headFont = writer.getWorkbook().createFont();
headFont.setBold(true);
headFont.setFontHeightInPoints((short) 12);
headStyle.setFont(headFont);
// 设置背景色
headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// ============ 2. 内容样式 ============
CellStyle contentStyle = writer.getCellStyle();
contentStyle.setAlignment(HorizontalAlignment.LEFT);
contentStyle.setVerticalAlignment(VerticalAlignment.CENTER);
// ============ 3. 时间列样式 ============
CellStyle timeStyle = writer.getWorkbook().createCellStyle();
timeStyle.cloneStyleFrom(contentStyle);
timeStyle.setDataFormat(writer.getWorkbook().createDataFormat().getFormat("yyyy-MM-dd HH:mm"));
// ============ 4. 数字列样式 ============
CellStyle numberStyle = writer.getWorkbook().createCellStyle();
numberStyle.cloneStyleFrom(contentStyle);
numberStyle.setAlignment(HorizontalAlignment.RIGHT);
// ============ 5. 根据内容自动调节列宽 ============
int colSize = rows.get(0).size();
int[] maxLength = new int[colSize];
for (List<String> row : rows) {
for (int colIndex = 0; colIndex < colSize; colIndex++) {
if (row.size() > colIndex && row.get(colIndex) != null) {
String cell = row.get(colIndex);
int length = getStringDisplayLength(cell);
if (length > maxLength[colIndex]) {
maxLength[colIndex] = length;
}
}
}
}
for (int i = 0; i < colSize; i++) {
writer.setColumnWidth(i, maxLength[i] + 2);
}
// ============ 6. 设置时间列 & 数字列格式 ============
Sheet sheet = writer.getSheet();
int rowCount = rows.size();
for (int rowIdx = 1; rowIdx < rowCount; rowIdx++) { // 第0行是表头
Row row = sheet.getRow(rowIdx);
if (row == null) continue;
if (timeColumnIndexList != null)
for (Integer colIdx : timeColumnIndexList) {
Cell cell = row.getCell(colIdx);
if (cell != null) {
cell.setCellStyle(timeStyle);
}
}
if (numberColumnIndexList != null)
for (Integer colIdx : numberColumnIndexList) {
Cell cell = row.getCell(colIdx);
if (cell != null) {
cell.setCellStyle(numberStyle);
}
}
}
}
/**
* 中文算2长度英文算1
*/
private static int getStringDisplayLength(String str) {
int length = 0;
for (char c : str.toCharArray()) {
if (c >= 0x4E00 && c <= 0x9FA5) {
length += 2;
} else {
length += 1;
}
}
return length;
}
}

View File

@ -265,7 +265,7 @@
-- ) valid_roles ON staff.user_id = valid_roles.user_id
LEFT JOIN system_users su ON su.id = staff.user_id
<where>
staff.deleted = 0
staff.deleted = 0 AND su.deleted = 0
-- AND (valid_roles.user_id IS NOT NULL) -- 只保留有合格角色的用户
</where>

View File

@ -96,31 +96,80 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="getAppointmentList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionAppointment">
SELECT
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,igs.sku_name
FROM
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 and oi.deleted=0
left join shop_user_car suc on suc.car_id = oi.user_car_id and suc.deleted=0
LEFT JOIN inspection_goods_sku igs on igs.id = ip.sku_id
where ip.deleted=0 and oi.validation_time IS NULL
<if test="phoneNum!=null and phoneNum!=''">
and (su.mobile like concat('%',#{phoneNum},'%') OR ip.car_no like concat('%',#{phoneNum},'%'))
</if>
<if test="partnerId!=null and partnerId!=''">
and ip.partner_id = #{partnerId}
</if>
<if test="carNo != null and carNo != ''">
and ip.car_no like concat('%',#{carNo},'%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
and ip.appointment_day between #{startTime} and #{endTime}
</if>
order by ip.create_time desc
<select id="getAppointmentList"
resultType="cn.iocoder.yudao.module.inspection.entity.InspectionAppointment">
SELECT * FROM (
-- 部分1预约表
SELECT
ip.id AS id,
ip.appointment_day AS appointmentDay,
CONVERT(ip.goods_title USING utf8mb4) COLLATE utf8mb4_general_ci AS goodsTitle,
CONVERT(su.mobile USING utf8mb4) COLLATE utf8mb4_general_ci AS buyPhoneNum,
CONVERT(su.nickname USING utf8mb4) COLLATE utf8mb4_general_ci AS buyName,
CONVERT(suc.car_nature USING utf8mb4) COLLATE utf8mb4_general_ci AS car_nature,
CONVERT(suc.car_brand USING utf8mb4) COLLATE utf8mb4_general_ci AS car_brand,
CONVERT(suc.car_model USING utf8mb4) COLLATE utf8mb4_general_ci AS car_model,
CONVERT(suc.car_no USING utf8mb4) COLLATE utf8mb4_general_ci AS car_no,
CONVERT(igs.sku_name USING utf8mb4) COLLATE utf8mb4_general_ci AS sku_name,
CONVERT("" USING utf8mb4) COLLATE utf8mb4_general_ci AS customerSource,
ip.create_time AS createTime,
CONVERT('appointment' USING utf8mb4) COLLATE utf8mb4_general_ci AS sourceType
FROM inspection_appointment ip
INNER JOIN system_users su ON ip.user_id = su.id AND ip.tenant_id = 180 AND su.tenant_id = 180
LEFT JOIN order_info oi ON ip.order_id = oi.id AND oi.deleted=0 AND oi.tenant_id=180
LEFT JOIN shop_user_car suc ON suc.car_id = oi.user_car_id AND suc.deleted=0 AND suc.tenant_id=180
LEFT JOIN inspection_goods_sku igs ON igs.id = ip.sku_id AND igs.tenant_id=180
WHERE ip.deleted=0 AND oi.validation_time IS NULL
<if test="phoneNum!=null and phoneNum!=''">
AND (su.mobile LIKE concat('%',#{phoneNum},'%') OR ip.car_no LIKE concat('%',#{phoneNum},'%'))
</if>
<if test="partnerId!=null and partnerId!=''">
AND ip.partner_id = #{partnerId}
</if>
<if test="carNo != null and carNo != ''">
AND ip.car_no LIKE concat('%',#{carNo},'%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND ip.appointment_day BETWEEN #{startTime} AND #{endTime}
</if>
UNION ALL
-- 部分2接车表
SELECT
imco.id AS id,
imco.appointment_day AS appointmentDay,
CONVERT(imco.goods_title USING utf8mb4) COLLATE utf8mb4_general_ci AS goodsTitle,
CONVERT(imco.buy_phone USING utf8mb4) COLLATE utf8mb4_general_ci AS buyPhoneNum,
CONVERT(imco.buy_name USING utf8mb4) COLLATE utf8mb4_general_ci AS buyName,
CONVERT(imco.car_nature USING utf8mb4) COLLATE utf8mb4_general_ci AS car_nature,
CONVERT(imco.car_model USING utf8mb4) COLLATE utf8mb4_general_ci AS car_brand,
CONVERT(imco.car_model USING utf8mb4) COLLATE utf8mb4_general_ci AS car_model,
CONVERT(imco.car_num USING utf8mb4) COLLATE utf8mb4_general_ci AS car_no,
CONVERT(imco.sku_name USING utf8mb4) COLLATE utf8mb4_general_ci AS sku_name,
CONVERT(imco.customer_source USING utf8mb4) COLLATE utf8mb4_general_ci AS customerSource,
imco.create_time AS createTime,
CONVERT('meetcar' USING utf8mb4) COLLATE utf8mb4_general_ci AS sourceType
FROM inspection_meet_car_order imco
WHERE imco.deleted=0 AND (imco.is_meet = 0 OR (imco.is_pick_car = 0 AND imco.is_meet_pick_car = 0))
<if test="phoneNum!=null and phoneNum!=''">
AND (imco.buy_phone LIKE concat('%',#{phoneNum},'%') OR imco.car_num LIKE concat('%',#{phoneNum},'%'))
</if>
<if test="partnerId!=null and partnerId!=''">
<!-- 如果接车表也有 partner_id这里可以写条件 -->
</if>
<if test="carNo != null and carNo != ''">
AND imco.car_num LIKE concat('%',#{carNo},'%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND imco.appointment_day BETWEEN #{startTime} AND #{endTime}
</if>
) t
ORDER BY t.createTime DESC
</select>
<select id="getAppointmentOwn" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionAppointment">
SELECT
ip.*,su.mobile as buyPhoneNum,su.nickname as buyName,ip.goods_title as goodsTitle,

View File

@ -212,7 +212,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="pageWorkOrder" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
select distinct 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
,oi.pay_type,oi.order_status as orderStatus,oi.goods_id,oi.sku_id,oi.pay_time,oi.goods_price,oi.cashier_confirm,oi.cashier_confirm_remark
from inspection_info ins
left join order_info oi on oi.id = ins.inspection_order_id
left join system_users su on su.id = ins.user_id
@ -405,6 +405,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
null AS longitude,
null AS appointmentDay,
null AS appointmentTime,
null AS is_pick_car,
0 AS source_type
FROM inspection_info ii
WHERE ii.deleted = 0 AND ii.meet_man_id = #{inspectionInfo.dealUserId} AND ii.is_meet_car = '0' AND ii.status != '1'
@ -433,6 +434,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
imco.longitude,
imco.appointment_day,
imco.appointment_time,
imco.is_pick_car,
1 AS source_type
FROM inspection_meet_car_order imco
WHERE imco.deleted = 0 AND imco.meet_man_id = #{inspectionInfo.dealUserId} AND imco.is_meet = '0'
@ -625,38 +627,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
imco.buy_phone,
imco.car_num,
imco.other_phone,
imco.inspection_info_id AS inspectionInfoId
imco.inspection_info_id AS inspectionInfoId,
-- 以下是 status != 1 时才会返回的字段
<if test="info.status != 1">
,ii.id AS id,
imco.id AS meetCarId,
ii.id AS id,
ii.status AS status,
ii.worker_name AS workerName,
ii.worker_phone AS workerPhone,
ii.car_model AS carModel,
ii.car_nature AS carNature,
ii.car_status AS carStatus,
ii.car_id_no AS carIdNo,
ii.buy_name AS buyName,
ii.buy_phone AS buyPhone,
ii.unit_name AS unitName,
ii.remark AS remark,
ii.start_time AS startTime,
ii.end_time AS endTime,
ii.is_pass AS isPass,
ii.is_retrial AS isRetrial,
ii.recheck_count AS recheckCount,
ii.reinspect_count AS reinspectCount,
ii.other_phone AS otherPhone,
ii.is_pay_online AS isPayOnline,
ii.is_pick_car AS isPickCar,
oi.sku_name AS skuName,
oi.goods_title,
ii.*
oi.goods_title AS goodsTitle
</if>
-- status == 1说明只有 meet_car 数据,需要返回 id 字段(占位)
<if test="info.status == 1">
,imco.id AS id
imco.id AS id
</if>
FROM inspection_meet_car_order imco
JOIN inspection_business_channel ibc ON imco.customer_source_id = ibc.id
<if test="info.status != 1">
INNER JOIN inspection_info ii
ON imco.inspection_info_id = ii.id AND ii.deleted = 0
LEFT JOIN order_info oi
ON ii.inspection_order_id = oi.id AND oi.deleted = 0
INNER JOIN inspection_info ii ON imco.inspection_info_id = ii.id AND ii.deleted = 0
LEFT JOIN order_info oi ON ii.inspection_order_id = oi.id AND oi.deleted = 0
</if>
WHERE imco.deleted = 0
WHERE imco.deleted = 0 AND ibc.deleted = 0
<if test="info.userId != null and info.userId != ''">
AND imco.meet_man_id = #{info.userId}
AND FIND_IN_SET(#{info.userId}, ibc.user_ids)
</if>
<if test="info.carNum != null and info.carNum != ''">
AND imco.car_num LIKE CONCAT('%', #{info.carNum}, '%')
</if>
<if test="info.status != null and info.status == 2">
AND ii.status = '0'
</if>
<if test="info.status != null and info.status == 3">
AND ii.status = '1'
<if test="info.status != null and info.status != 1">
<if test="info.status == 2">
AND ii.status = '0'
</if>
<if test="info.status == 3">
AND ii.status = '1'
</if>
</if>
</select>
<select id="selectMeetCarList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT ii.*, imco.meet_type
FROM inspection_info ii
@ -668,4 +700,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
</select>
<select id="pageWorkOrderNew" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
select distinct 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,oi.cashier_confirm,oi.cashier_confirm_remark
from inspection_info ins
left join order_info oi on oi.id = ins.inspection_order_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
<if test="query.carModelOrCarYear!=null and query.carModelOrCarYear!=''">
and ins.car_num like concat('%',#{query.carModelOrCarYear},'%')
</if>
<if test="query.skuName!=null and query.skuName!=''">
and oi.sku_name like concat('%',#{query.skuName},'%')
</if>
<if test="query.customerSource!=null and query.customerSource!=''">
AND ins.customer_source = #{query.customerSource}
</if>
<if test="query.carYear!=null and query.carYear!=''">
AND (TIMESTAMPDIFF(YEAR, ins.car_register_date, CURDATE()) >= #{query.carYear}
AND TIMESTAMPDIFF(YEAR, ins.car_register_date, CURDATE()) &lt; #{query.carYear} + 1)
</if>
<if test="query.payType!=null and query.payType!=''">
and oi.pay_type = #{query.payType}
</if>
<if test="query.startTime!=null and query.startTime!=''">
and ins.start_time between #{query.startTime} and #{query.endTime}
</if>
order by ins.start_time desc
</select>
<select id="workOrderDataNew" resultType="java.util.Map">
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 system_users su on su.id = ins.user_id
left join system_user_role sur on sur.user_id = su.id
where 1=1
<if test="query.carModelOrCarYear!=null and query.carModelOrCarYear!=''">
and ins.car_num like concat('%',#{query.carModelOrCarYear},'%')
</if>
<if test="query.skuName!=null and query.skuName!=''">
and oi.sku_name like concat('%',#{query.skuName},'%')
</if>
<if test="query.customerSource!=null and query.customerSource!=''">
AND ins.customer_source = #{query.customerSource}
</if>
<if test="query.carYear!=null and query.carYear!=''">
AND (TIMESTAMPDIFF(YEAR, ins.car_register_date, CURDATE()) >= #{query.carYear}
AND TIMESTAMPDIFF(YEAR, ins.car_register_date, CURDATE()) &lt; #{query.carYear} + 1)
</if>
<if test="query.payType!=null and query.payType!=''">
and oi.pay_type = #{query.payType}
</if>
<if test="query.startTime!=null and query.startTime!=''">
and ins.start_time between #{query.startTime} and #{query.endTime}
</if>
</select>
</mapper>

View File

@ -114,4 +114,39 @@
</if>
</where>
</select>
<select id="getInspectionStaffByUniqueCode"
resultType="cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo">
SELECT distinct
su.id as id,
su.nickname,
su.username,
su.user_type,
su.remark,
su.dept_id,
su.mobile,
su.password,
su.avatar,
su.sex,
su.status,
iss.id_card,
iss.address,
iss.educational,
iss.school,
iss.short_number,
iss.join_date,
iss.probation_period,
iss.social_security_buy_date,
iss.emergency_contact_name,
iss.emergency_contact_phone,
iss.driver_license_type,
iss.folder_id,
iss.unique_code
FROM inspection_staff iss
inner join system_users su on iss.user_id = su.id
<where>
<if test="uniqueCode != null and uniqueCode != ''">
and iss.unique_code = #{uniqueCode}
</if>
</where>
</select>
</mapper>

View File

@ -134,11 +134,12 @@
<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,
oi.goods_title as goodsName,info.car_num,oi.partner_name as partnerName
oi.goods_title as goodsName,info.car_num,company.corp_name as partnerName
from
inspection_info info
LEFT JOIN inspection_step_info step ON info.id = step.inspection_info_id
left join order_info oi on oi.id = info.inspection_order_id
LEFT JOIN base_company company ON company.tenant_id = info.tenant_id AND company.service_codes LIKE '%jiance%' AND company.deleted = '0'
WHERE info.user_id = #{userId}
and info.status = #{status}
GROUP BY info.id

View File

@ -0,0 +1,788 @@
package cn.iocoder.yudao.module.rescue.controller.app;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.config.SecurityProperties;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
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.vo.RegisterVO;
import cn.iocoder.yudao.module.shop.entity.ShopConfig;
import cn.iocoder.yudao.module.shop.entity.UserBalance;
import cn.iocoder.yudao.module.shop.service.IShopConfigService;
import cn.iocoder.yudao.module.shop.service.IUserBalanceService;
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.controller.admin.auth.vo.AuthLoginReqVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginRespVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
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 cn.iocoder.yudao.util.RedisCache;
import cn.iocoder.yudao.util.SendSmsUtil;
import cn.iocoder.yudao.util.WechatPayConfig;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.*;
import static cn.iocoder.yudao.module.rescue.utils.RescueSysLoginService.generateVerificationCode;
/**
* 登录验证
*
* @author ruoyi
*/
@RestController
@Slf4j
@RequestMapping("/rescue")
public class AppSysLoginController {
@Resource
private AdminAuthService loginService;
@Resource
private MenuService menuService;
@Resource
private AdminUserService userService;
@Resource
private PermissionApi permissionApi;
@Resource
private RoleApi roleApi;
@Resource
private DictDataApi dataApi;
@Resource
private RedisCache redisCache2;
@Resource
private RescueSysLoginService rescueSysLoginService;
@Resource
private WechatPayConfig wxConfig;
@Resource
private RoleService roleService;
@Resource
private RestTemplate restTemplate;
@Resource
private SecurityProperties securityProperties;
@Resource
private IUserBalanceService balanceService;
// @Autowired
// private IShopMallPartnersService partnersService;
// @Autowired
// private IPartnerWorkerService jcWorkerService;
@Resource
private IShopConfigService configService;
@Resource
private IDriverInfoService driverInfoService;
// @Autowired
// private IDriveSchoolInfoService driveSchoolInfoService;
//
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/login")
public CommonResult login(@RequestBody LoginBody loginBody) {
// 生成令牌
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
authLoginReqVO.setUsername(loginBody.getUsername());
authLoginReqVO.setPassword(loginBody.getPassword());
return success(loginService.login(authLoginReqVO));
}
@GetMapping("/dict/data/type/{type}")
public CommonResult getDictDataByType(@PathVariable("type") String type){
return success(dataApi.getDictDataList(type));
}
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/loginApp")
@TenantIgnore
public CommonResult loginApp(@RequestBody LoginBody loginBody) throws Exception {
String userName = loginBody.getUsername();
AdminUserDO user = userService.getUserByUsername(userName);
if (ObjectUtil.isEmpty(user)) {
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
}
// 获取登录用户的角色信息
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
if (ObjectUtil.isEmpty(roleIdsByUserId) || roleIdsByUserId.size() == 0) {
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
}
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<String> roleNames = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).map(item -> item.getName()).collect(Collectors.toList());
Boolean flag = (loginBody.getType().equals("0") && roleNames.contains("调度中心")) || (loginBody.getType().equals("0") && roleNames.contains("交警大队"));
// 角色认证登录
if (!flag) {
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
}
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
authLoginReqVO.setUsername(loginBody.getUsername());
authLoginReqVO.setPassword(loginBody.getPassword());
return success(loginService.login(authLoginReqVO));
}
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/loginJcApp")
// @TenantIgnore
public CommonResult loginJcApp(@RequestBody LoginBody loginBody) throws Exception {
String userName = loginBody.getUsername();
AdminUserDO user = userService.getUserByUsername(userName);
if (ObjectUtil.isEmpty(user)) {
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
}
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
authLoginReqVO.setUsername(loginBody.getUsername());
authLoginReqVO.setPassword(loginBody.getPassword());
return success(loginService.login(authLoginReqVO));
}
/**
* 汽修小程序登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/loginQx")
@TenantIgnore
public CommonResult loginQx(@RequestBody LoginBody loginBody) throws Exception {
String userName = loginBody.getUsername();
AdminUserDO user = userService.getUserByUsername(userName);
if (ObjectUtil.isEmpty(user)) {
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
}
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
authLoginReqVO.setUsername(loginBody.getUsername());
authLoginReqVO.setPassword(loginBody.getPassword());
AuthLoginRespVO login = loginService.login(authLoginReqVO);
Map<String,Object> map = new HashMap<>();
map.put("accessToken",login.getAccessToken());
map.put("expiresTime",login.getExpiresTime());
map.put("refreshToken",login.getRefreshToken());
map.put("userId",login.getUserId());
if(org.apache.commons.lang3.StringUtils.isEmpty(user.getMobile())){
map.put("needMobile","1");
}else{
map.put("needMobile","0");
}
return success(map);
}
/**
* 发送验证码
* @param phone
* @return
*/
@GetMapping("/sendSmsQx")
@TenantIgnore
public CommonResult sendSmsQx(@RequestParam("phone") String phone) {
String msgCode = generateVerificationCode();
redisCache2.setCacheObject(phone+"-registerCode",msgCode,300, TimeUnit.SECONDS);
SendSmsUtil.sendMsg(msgCode,phone,"1400852709","机动车管家小程序","1917285");
return ok();
}
/**
* 汽修小程序更新用户手机号方法
*
* @param registerVO 登录信息
* @return 结果
*/
@PostMapping("/updateUserQx")
public CommonResult registerQx(@RequestBody RegisterVO registerVO){
if(org.apache.commons.lang3.StringUtils.isEmpty(registerVO.getPhone())){
return error(500,"手机号不能为空");
}
if(org.apache.commons.lang3.StringUtils.isEmpty(registerVO.getCode())){
return error(500,"验证码不能为空");
}
Object registerCode = redisCache2.getCacheObject(registerVO.getPhone() + "-registerCode");
if(null==registerCode || !registerCode.equals(registerVO.getCode())){
return error(500,"验证码错误");
}
redisCache2.deleteObject(registerVO.getPhone() + "-registerCode");
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
userSaveReqVO.setId(loginUser.getId());
userSaveReqVO.setMobile(registerVO.getPhone());
userService.updateUser(userSaveReqVO);
return success("成功");
}
/**
* 司机登录方法
*
* @param loginBody 司机登录方法
* @return 结果
*/
@PostMapping("/driverLogin")
@TenantIgnore
public CommonResult driverLogin(@RequestBody LoginBody loginBody) throws Exception {
// 生成令牌
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
authLoginReqVO.setUsername(loginBody.getUsername());
authLoginReqVO.setPassword(loginBody.getPassword());
AuthLoginRespVO login = loginService.login(authLoginReqVO);
return success(login);
}
/**
* 登录获取验证码
*
* @return 结果
*/
@PostMapping("/loginSmsCode")
public CommonResult loginSmsCode(String phone) {
return rescueSysLoginService.loginSmsCode(phone);
}
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/loginJx")
public CommonResult loginJx(@RequestBody LoginBody loginBody) throws Exception {
// 生成令牌
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
authLoginReqVO.setUsername(loginBody.getUsername());
authLoginReqVO.setPassword(loginBody.getPassword());
AuthLoginRespVO login = loginService.login(authLoginReqVO);
return success(login);
}
// @PostMapping("/loginSmsCodeJx")
// public AjaxResult loginSmsCodeJx(String phone) {
// return loginService.loginSmsCodeJx(phone);
// }
/**
* 忘记密码获取验证码
*
* @return 结果
*/
@PostMapping("/pwdSmsCode")
public CommonResult pwdSmsCode(String phone) {
return rescueSysLoginService.pwdSmsCode(phone);
}
// /**
// * 更新密码
// *
// * @return 结果
// */
// @PostMapping("/updatePwd")
// public CommonResult<Object> updatePwd(String phone, String msgCode, String password) {
// if (!redisCache2.hasKey(phone+"-pwdCode")||!redisCache2.getCacheObject(phone+"-pwdCode").equals(msgCode)){
// return error(500, "验证码错误");
// }
// AdminUserRespDTO sysUser = userService.getUserByMobile(phone);
// if (userService.resetPassword(sysUser.getId(), SecurityFrameworkUtils.encryptPassword(password)); > 0)
// {
// // 更新缓存用户密码
// sysUser.setPassword(SecurityUtils.encryptPassword(password));
// userService.updateUser(sysUser);
// return success();
// }
// return error("修改密码异常,请联系管理员");
// }
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping("/getInfo")
public CommonResult getInfo() {
HashMap<String, Object> map = new HashMap<>();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserDO user = userService.getUser(loginUser.getId());
map.put("user", user);
// 角色集合
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(loginUser.getId());
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<RoleReqDTO> role = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).collect(Collectors.toList());
map.put("role", role);
// 权限集合
List<MenuDO> menuList = menuService.getMenuList();
// Set<String> permissions = permissionService.getMenuPermission(user);
// ajax.put("permissions", permissions);
return success(map);
}
//
// @Resource
// private DriveSchoolCoachMapper driveSchoolCoachMapper;
// @Resource
// private SysUserMapper sysUserMapper;
// /**
// * 获取
// *
// * @return 用户信息
// */
// @GetMapping("getJxInfo")
// public CommonResult getJxInfo()
// {
// LoginUser user = SecurityFrameworkUtils.getLoginUser();
// // 角色集合
// Set<String> roles = permissionService.getRolePermission(user);
// //获取驾校的
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// Long userId = loginUser.getId();
// SysUser sysUser = sysUserMapper.selectUserById(userId);
// String phonenumber = sysUser.getPhonenumber();
// DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber);
//
// if (ObjectUtils.isNotEmpty(driveSchoolCoach)){
// user.setAvatar(driveSchoolCoach.getImage());
// }
// DriveSchoolInfo driveSchoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId();
//
// AjaxResult ajax = success();
// ajax.put("user", user);
// ajax.put("roles", roles);
// ajax.put("schoolInfo", driveSchoolInfo);
// return ajax;
// }
/**
* 获取App用户信息
*
* @return 用户信息
*/
@GetMapping("/getAppInfo")
@TenantIgnore
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);
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", "0");
}
return CommonResult.success(ajax);
}
/**
* 获取App用户信息
*
* @return 用户信息
*/
@GetMapping("/getJcAppInfo")
@TenantIgnore
public CommonResult getJcAppInfo()
{
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserDO user = userService.getUser(loginUser.getId());
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
List<RoleDO> roleList = roleService.getRoleList(roleIdsByUserId);
// 角色集合
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
UserBalance userBalance = balanceService.selectShopUserBalanceByUserId(loginUser.getId());
if (ObjectUtil.isNotEmpty(userBalance)) {
userSaveReqVO.setBalance(userBalance.getBalance());
} else {
//新增用户积分表信息
userBalance=new UserBalance();
userBalance.setUserId(loginUser.getId());
userBalance.setAllBalance(0L);
userBalance.setBalance(0L);
userBalance.setFrozenBalance(0L);
balanceService.insertShopUserBalance(userBalance);
userSaveReqVO.setBalance(0L);
}
userService.updateUser(userSaveReqVO);
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", "0");
}
return CommonResult.success(ajax);
}
/**
* 获取App用户信息
*
* @return 用户信息
*/
@GetMapping("/getJcgfInfo")
public CommonResult getJcgfInfo() throws Exception {
Map<String, Object> map = new HashMap<>();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserDO user = userService.getUser(loginUser.getId());
// 角色集合
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
List<RoleReqDTO> role = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).collect(Collectors.toList());
map.put("user", user);
map.put("role", role);
if (CollectionUtil.isNotEmpty(role)){
AtomicBoolean flag = new AtomicBoolean(false);
role.forEach(it->{
if (it.getCode().equals("jcgf")){
flag.set(true);
}
});
if (!flag.get()){
throw exception(CommonErrorCodeConstants.MISTAKEN_IDENTITY);
}
}else {
throw exception(CommonErrorCodeConstants.MISTAKEN_IDENTITY);
}
return success(map);
}
//获取交警的信息
@GetMapping("/getJjInfo")
public CommonResult getJjInfo() throws Exception {
Map<String, Object> map = new HashMap<>();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserDO user = userService.getUser(loginUser.getId());
// 角色集合
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
List<RoleReqDTO> role = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).collect(Collectors.toList());
map.put("user", user);
map.put("role", role);
if (CollectionUtil.isNotEmpty(role)){
AtomicBoolean flag = new AtomicBoolean(false);
role.forEach(it->{
if (it.getCode().equals("jjdd")){
flag.set(true);
}
});
if (!flag.get()){
throw exception(CommonErrorCodeConstants.MISTAKEN_IDENTITY);
}
}else {
throw exception(CommonErrorCodeConstants.MISTAKEN_IDENTITY);
}
return success(map);
}
// /**
// * 获取App用户信息
// *
// * @return 用户信息
// */
// @GetMapping("/getJcPartnerInfo")
// public AjaxResult getJcPartnerInfo()
// {
// LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// queryWrapper.eq(ShopMallPartners::getUserId,user.getUserId()).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0");
// ShopMallPartners partner = partnersService.getOne(queryWrapper);
// if (ObjectUtil.isEmpty(partner)){
// return error("信息有误");
// }
// SysUser sysUser = userService.selectUserById(user.getUserId());
// AjaxResult ajax = success();
// ajax.put("user", sysUser);
// return ajax;
// }
//
/**
* 获取救援司机用户信息
*
* @return 用户信息
*/
@GetMapping("/getRescueDriverInfo")
public CommonResult getRescueDriverInfo()
{
LambdaQueryWrapper<DriverInfo> queryWrapper =new LambdaQueryWrapper<>();
Long userId = SecurityFrameworkUtils.getLoginUserId();
queryWrapper.eq(DriverInfo::getUserId, userId);
DriverInfo driverInfo = driverInfoService.getOne(queryWrapper);
if (ObjectUtil.isEmpty(driverInfo)){
return error(500, "信息有误");
}
AdminUserDO user = userService.getUser(userId);
Map<String, Object> map = new HashMap<>();
map.put("user", user);
map.put("driverInfo", driverInfo);
return success(map);
}
/**
* 获取检测工用户信息
*
* @return 用户信息
*/
@GetMapping("/getJcWorkerInfo")
public CommonResult getJcWorkerInfo()
{
LoginUser user = SecurityFrameworkUtils.getLoginUser();
Map<String, Object> map = new HashMap<>();
map.put("partnerId", user.getTenantId());
map.put("user", user);
// 查询用户表信息
AdminUserDO selectUser = userService.getUser(user.getId());
map.put("userInfo", selectUser);
return CommonResult.success(map);
}
@PostMapping("/wxLogin")
public CommonResult wxLogin(@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.getJxAppId() + "&secret=" + wxConfig.getJxAppSecret() + "&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");
//解密
String decryptResult = "";
try {
//如果没有绑定微信开放平台解析结果是没有unionid的
decryptResult = decrypt(sessionKey, encryptedIv, encryptedData);
} catch (Exception e) {
e.printStackTrace();
return error(500, "微信登录失败!");
}
if (StringUtils.hasText(decryptResult)) {
//如果解析成功,获取token
AuthLoginRespVO loginVO = loginService.wxLogin(decryptResult,openId,wxLoginBody.getInviteId());
Map<String, Object> map = new HashMap<>();
map.put("token", loginVO.getAccessToken());
return success(map);
} else {
return error(500, "微信登录失败!");
}
}
@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
AuthLoginRespVO authLoginRespVO = loginService.wxLoginJc(decryptResult, openId, wxLoginBody.getInviteId());
return success(authLoginRespVO);
} else {
return error(500, "微信登录失败!");
}
}
//
@PostMapping("/wxLoginRescue")
public CommonResult wxLoginRescue(@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 error(500, "微信登录失败!");
}
if (StringUtils.hasText(decryptResult)) {
// TODO 待完成
// //如果解析成功,获取token
AuthLoginRespVO authLoginRespVO = loginService.wxLoginRescue(decryptResult, openId, wxLoginBody.getInviteId());
return success(authLoginRespVO);
} else {
return error(500, "微信登录失败!");
}
}
//
/**
* AES解密
*/
private String decrypt(String sessionKey,String encryptedIv,String encryptedData) throws Exception{
// 转化为字节数组
byte[] key = Base64.decode(sessionKey);
byte[] iv = Base64.decode(encryptedIv);
byte[] encData = Base64.decode(encryptedData);
// 如果密钥不足16位那么就补足
int base =16;
if (key.length % base !=0) {
int groups = key.length / base +(key.length % base != 0 ? 1 : 0);
byte[] temp = new byte[groups * base];
Arrays.fill(temp,(byte) 0);
System.arraycopy(key,0,temp,0,key.length);
key = temp;
}
// 如果初始向量不足16位也补足
if (iv.length % base !=0) {
int groups = iv.length / base +(iv.length % base != 0 ? 1 : 0);
byte[] temp = new byte[groups * base];
Arrays.fill(temp,(byte) 0);
System.arraycopy(iv,0,temp,0,iv.length);
iv = temp;
}
AlgorithmParameterSpec ivSpec = new IvParameterSpec(iv);
String resultStr = null;
try {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec keySpec = new SecretKeySpec(key,"AES");
cipher.init(Cipher.DECRYPT_MODE,keySpec,ivSpec);
resultStr = new String(cipher.doFinal(encData),"UTF-8");
} catch (Exception e){
// logger.info("解析错误");
e.printStackTrace();
}
// 解析加密后的字符串
return resultStr;
}
/**
* 同步数据
* @author 小李
* @date 14:51 2024/8/24
* @param
**/
@GetMapping("/sync")
@Operation(summary = "同步数据")
public CommonResult syncData(){
driverInfoService.syncData();
return CommonResult.ok();
}
@PostMapping("/logout")
@Operation(summary = "登出系统")
public CommonResult<Boolean> logout(HttpServletRequest request) {
String token = SecurityFrameworkUtils.obtainAuthorization(request,
securityProperties.getTokenHeader(), securityProperties.getTokenParameter());
if (StrUtil.isNotBlank(token)) {
loginService.logout(token,1);
}
return success(true);
}
}

View File

@ -29,16 +29,18 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
return selectOne(AdminUserDO::getUsername, username);
}
default AdminUserDO selectByUsername(String username, Long tenantId) {
return selectOne(new LambdaQueryWrapperX<AdminUserDO>().eq(AdminUserDO::getUsername, username).eq(TenantBaseDO::getTenantId, tenantId).last("limit 1"));
default AdminUserDO selectByUsername(String username, Long tenantId,String userType) {
return selectOne(new LambdaQueryWrapperX<AdminUserDO>().eq(AdminUserDO::getUsername, username).eq(ObjectUtil.isNotEmpty(tenantId),TenantBaseDO::getTenantId, tenantId)
.eq(ObjectUtil.isNotEmpty(userType), AdminUserDO::getUserType, userType).last("limit 1"));
}
default AdminUserDO selectByEmail(String email) {
return selectOne(AdminUserDO::getEmail, email);
}
default AdminUserDO selectByEmail(String email, Long tenantId) {
return selectOne(Wrappers.<AdminUserDO>lambdaQuery().eq(AdminUserDO::getEmail, email).eq(TenantBaseDO::getTenantId, tenantId).last("limit 1"));
default AdminUserDO selectByEmail(String email, Long tenantId,String userType) {
return selectOne(Wrappers.<AdminUserDO>lambdaQuery().eq(AdminUserDO::getEmail, email).eq(ObjectUtil.isNotEmpty(tenantId),TenantBaseDO::getTenantId, tenantId)
.eq(ObjectUtil.isNotEmpty(userType), AdminUserDO::getUserType, userType).last("limit 1"));
}
default AdminUserDO selectByMobile(String mobile) {
@ -50,7 +52,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
} catch (Exception e) {
}
return getUserByMobileWithoutTenant(mobile, tenantId);
return getUserByMobileWithoutTenant(mobile, tenantId,null);
}
default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
@ -90,7 +92,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
AdminUserDO selectUserByPhone(String phone);
AdminUserDO getUserByMobileWithoutTenant(@Param("phoneNumber") String phoneNumber, @Param("tenantId") Long tenantId);
AdminUserDO getUserByMobileWithoutTenant(@Param("phoneNumber") String phoneNumber, @Param("tenantId") Long tenantId,@Param("userType") String userType);
int updateSetOpenId(@Param("userId") Long userId, @Param("openId") String openId);

View File

@ -29,6 +29,7 @@ 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;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.annotations.VisibleForTesting;
import com.xingyuv.captcha.model.common.ResponseModel;
import com.xingyuv.captcha.model.vo.CaptchaVO;
@ -42,6 +43,7 @@ import javax.annotation.Resource;
import javax.validation.Validator;
import java.util.*;
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
@ -250,6 +252,16 @@ public class AdminAuthServiceImpl implements AdminAuthService {
return AuthConvert.INSTANCE.convert(accessTokenDO);
}
private AuthLoginRespVO createTokenAfterLoginSuccessMember(Long userId, String username, LoginLogTypeEnum logType) {
// 插入登陆日志
createLoginLog(userId, username, logType, LoginResultEnum.SUCCESS);
// 创建访问令牌
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, getUserTypeMember().getValue(),
OAuth2ClientConstants.CLIENT_ID_DEFAULT, null);
// 构建返回结果
return AuthConvert.INSTANCE.convert(accessTokenDO);
}
private AuthLoginRespVO createTokenAfterLoginSuccessCustomer(Long userId, String username, LoginLogTypeEnum logType) {
// 插入登陆日志
createLoginLog(userId, username, logType, LoginResultEnum.SUCCESS);
@ -319,6 +331,10 @@ public class AdminAuthServiceImpl implements AdminAuthService {
return UserTypeEnum.ADMIN;
}
private UserTypeEnum getUserTypeMember() {
return UserTypeEnum.MEMBER;
}
/**
* 检测模块微信登录
@ -391,7 +407,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
//还可以获取其他信息
//根据openid判断数据库中是否有该用户
//根据openid查询用户信息
AdminUserDO wxUser = userService.getUserByMobileWithoutTenant(phoneNumber);
AdminUserDO wxUser = userService.getUserByUsername(phoneNumber, null, USER_TYPE_CUS);
//如果查不到则新增查到了则更新
UserSaveReqVO user = new UserSaveReqVO();
if (wxUser == null) {
@ -399,9 +415,10 @@ public class AdminAuthServiceImpl implements AdminAuthService {
user.setUsername(phoneNumber);
user.setNickname(phoneNumber);
user.setMobile(phoneNumber);
user.setUserType(USER_TYPE_CUS);
user.setPassword(passwordEncoder.encode("123456"));
user.setJcOpenId(openId);
user.setTenantId(180L);
// user.setTenantId(180L);
if (null!=inviteId){
//绑定上级
user.setInviteId(inviteId);
@ -415,10 +432,10 @@ public class AdminAuthServiceImpl implements AdminAuthService {
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(uid,ids);
// List<RoleDO> jcyh = roleService.getRoleListByCodes(Collections.singletonList("jcyh"));
// Set<Long> ids = new HashSet<>();
// ids.add(jcyh.get(0).getId());
// permissionService.assignUserRole(uid,ids);
}else {
//更新
user.setId(wxUser.getId());
@ -436,7 +453,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
}
// 生成token
return createTokenAfterLoginSuccess(wxUser.getId(), wxUser.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
return createTokenAfterLoginSuccessMember(wxUser.getId(), wxUser.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
}
/**

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.user;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
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.user.vo.profile.UserProfileUpdatePasswordReqVO;
@ -136,6 +137,14 @@ public interface AdminUserService extends IService<AdminUserDO> {
*/
AdminUserDO getUserByUsername(String username, Long tenantId);
/**
* 通过用户名查询用户
*
* @param username 用户名
* @return 用户对象信息
*/
AdminUserDO getUserByUsername(String username, Long tenantId, String userType);
/**
* 通过用户名查询用户---不带租户ID
*

View File

@ -116,7 +116,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
// });
// 1.2 校验正确性
validateUserForCreateOrUpdate(null, createReqVO.getUsername(),
createReqVO.getMobile(),createReqVO.getTenantId(), createReqVO.getEmail(), createReqVO.getDeptId(), createReqVO.getPostIds());
createReqVO.getMobile(),createReqVO.getTenantId(), createReqVO.getEmail(), createReqVO.getDeptId(), createReqVO.getPostIds(),createReqVO.getUserType());
// 2.1 插入用户
AdminUserDO user = BeanUtils.toBean(createReqVO, AdminUserDO.class);
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
@ -196,8 +196,8 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
public void updateUserProfile(Long id, UserProfileUpdateReqVO reqVO) {
// 校验正确性
validateUserExists(id);
validateEmailUnique(id, reqVO.getEmail(), reqVO.getTenantId());
validateMobileUnique(id, reqVO.getMobile(), reqVO.getTenantId());
validateEmailUnique(id, reqVO.getEmail(), reqVO.getTenantId(),null);
validateMobileUnique(id, reqVO.getMobile(), reqVO.getTenantId(),null);
// 执行更新
userMapper.updateById(BeanUtils.toBean(reqVO, AdminUserDO.class).setId(id));
}
@ -295,7 +295,12 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
}
@Override
public AdminUserDO getUserByUsername(String username,Long tenantId) {
return userMapper.selectByUsername(username,tenantId);
return userMapper.selectByUsername(username,tenantId,null);
}
@Override
@TenantIgnore
public AdminUserDO getUserByUsername(String username,Long tenantId,String userType) {
return userMapper.selectByUsername(username,tenantId,userType);
}
@Override
@ -402,11 +407,31 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
// 校验用户存在
AdminUserDO user = validateUserExists(id);
// 校验用户名唯一
validateUsernameUnique(id, username,tenantId);
validateUsernameUnique(id, username,tenantId,null);
// 校验手机号唯一
validateMobileUnique(id, mobile,tenantId);
validateMobileUnique(id, mobile,tenantId,null);
// 校验邮箱唯一
validateEmailUnique(id, email,tenantId);
validateEmailUnique(id, email,tenantId,null);
// 校验部门处于开启状态
deptService.validateDeptList(CollectionUtils.singleton(deptId));
// 校验岗位处于开启状态
postService.validatePostList(postIds);
return user;
});
}
private AdminUserDO validateUserForCreateOrUpdate(Long id, String username, String mobile,Long tenantId, String email,
Long deptId, Set<Long> postIds,String userType) {
// 关闭数据权限避免因为没有数据权限查询不到数据进而导致唯一校验不正确
return DataPermissionUtils.executeIgnore(() -> {
// 校验用户存在
AdminUserDO user = validateUserExists(id);
// 校验用户名唯一
validateUsernameUnique(id, username,null,userType);
// 校验手机号唯一
validateMobileUnique(id, mobile, null,userType);
// 校验邮箱唯一
validateEmailUnique(id, email, null,userType);
// 校验部门处于开启状态
deptService.validateDeptList(CollectionUtils.singleton(deptId));
// 校验岗位处于开启状态
@ -428,11 +453,11 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
}
@VisibleForTesting
void validateUsernameUnique(Long id, String username,Long tenantId) {
void validateUsernameUnique(Long id, String username,Long tenantId,String userType) {
if (StrUtil.isBlank(username)) {
return;
}
AdminUserDO user = userMapper.selectByUsername(username,tenantId);
AdminUserDO user = userMapper.selectByUsername(username,tenantId,userType);
if (user == null) {
return;
}
@ -446,11 +471,11 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
}
@VisibleForTesting
void validateEmailUnique(Long id, String email,Long tenantId) {
void validateEmailUnique(Long id, String email,Long tenantId,String userType) {
if (StrUtil.isBlank(email)) {
return;
}
AdminUserDO user = userMapper.selectByEmail(email,tenantId);
AdminUserDO user = userMapper.selectByEmail(email,tenantId,userType);
if (user == null) {
return;
}
@ -464,7 +489,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
}
@VisibleForTesting
void validateMobileUnique(Long id, String mobile, Long tenantId) {
void validateMobileUnique(Long id, String mobile, Long tenantId,String userType) {
if (StrUtil.isBlank(mobile)) {
return;
}
@ -475,7 +500,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
}catch (Exception e){
}
AdminUserDO user = userMapper.getUserByMobileWithoutTenant(mobile,tenantId);
AdminUserDO user = userMapper.getUserByMobileWithoutTenant(mobile,tenantId,userType);
if (user == null) {
return;
}
@ -594,7 +619,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
}catch (Exception e){
}
return userMapper.getUserByMobileWithoutTenant(phoneNumber,tenantId);
return userMapper.getUserByMobileWithoutTenant(phoneNumber,tenantId,null);
}
/**

View File

@ -72,6 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tenantId!=null">
and tenant_id = #{tenantId}
</if>
<if test="userType!=null">
and user_type = #{userType}
</if>
AND deleted = 0
limit 1
</select>