This commit is contained in:
xyc 2025-07-02 17:59:31 +08:00
parent 9ddfaceb62
commit 53944642e2
17 changed files with 530 additions and 154 deletions

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

@ -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

@ -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

@ -218,4 +218,14 @@ public class InspectionInfo extends TenantBaseDO
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

@ -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

@ -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

@ -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;
@ -612,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) {
@ -628,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);
}
/**
* 根据当前登陆人获取可以选择的工单
*

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

@ -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
@ -700,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>