Merge branch 'master' into dev

# Conflicts:
#	dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java
#	dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java
#	dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java
This commit is contained in:
Vinjor 2024-12-16 09:53:54 +08:00
commit 87eb50c282
38 changed files with 955 additions and 175 deletions

View File

@ -32,14 +32,12 @@ public class PropertyPosController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建企业管理-资产存放位置") @Operation(summary = "创建企业管理-资产存放位置")
@PreAuthorize("@ss.hasPermission('company:property-pos:create')")
public CommonResult<String> createPropertyPos(@RequestBody PropertyPosReqVO createReqVO) { public CommonResult<String> createPropertyPos(@RequestBody PropertyPosReqVO createReqVO) {
return success(propertyPosService.createPropertyPos(createReqVO)); return success(propertyPosService.createPropertyPos(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新企业管理-资产存放位置") @Operation(summary = "更新企业管理-资产存放位置")
@PreAuthorize("@ss.hasPermission('company:property-pos:update')")
public CommonResult<Boolean> updatePropertyPos(@RequestBody PropertyPosReqVO updateReqVO) { public CommonResult<Boolean> updatePropertyPos(@RequestBody PropertyPosReqVO updateReqVO) {
propertyPosService.updatePropertyPos(updateReqVO); propertyPosService.updatePropertyPos(updateReqVO);
return success(true); return success(true);
@ -48,7 +46,6 @@ public class PropertyPosController {
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除企业管理-资产存放位置") @Operation(summary = "删除企业管理-资产存放位置")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('company:property-pos:delete')")
public CommonResult<Boolean> deletePropertyPos(@RequestParam("id") String id) { public CommonResult<Boolean> deletePropertyPos(@RequestParam("id") String id) {
propertyPosService.deletePropertyPos(id); propertyPosService.deletePropertyPos(id);
return success(true); return success(true);
@ -57,7 +54,6 @@ public class PropertyPosController {
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得企业管理-资产存放位置") @Operation(summary = "获得企业管理-资产存放位置")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('company:property-pos:query')")
public CommonResult<PropertyPosRespVO> getPropertyPos(@RequestParam("id") String id) { public CommonResult<PropertyPosRespVO> getPropertyPos(@RequestParam("id") String id) {
PropertyPos propertyPos = propertyPosService.getPropertyPos(id); PropertyPos propertyPos = propertyPosService.getPropertyPos(id);
return success(BeanUtils.toBean(propertyPos, PropertyPosRespVO.class)); return success(BeanUtils.toBean(propertyPos, PropertyPosRespVO.class));
@ -65,7 +61,6 @@ public class PropertyPosController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得企业管理-资产存放位置分页") @Operation(summary = "获得企业管理-资产存放位置分页")
@PreAuthorize("@ss.hasPermission('company:property-pos:query')")
public CommonResult<IPage<?>> getPropertyPosPage(PropertyPosReqVO pageReqVO, public CommonResult<IPage<?>> getPropertyPosPage(PropertyPosReqVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
@ -81,7 +76,6 @@ public class PropertyPosController {
**/ **/
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "获得企业管理-资产存放位置列表") @Operation(summary = "获得企业管理-资产存放位置列表")
@PreAuthorize("@ss.hasPermission('company:property-pos:query')")
public CommonResult<List<?>> getPropertyPosList() { public CommonResult<List<?>> getPropertyPosList() {
return success(propertyPosService.list()); return success(propertyPosService.list());
} }
@ -94,7 +88,6 @@ public class PropertyPosController {
**/ **/
@GetMapping("/listByCorpId") @GetMapping("/listByCorpId")
@Operation(summary = "获得企业管理-资产存放位置列表") @Operation(summary = "获得企业管理-资产存放位置列表")
@PreAuthorize("@ss.hasPermission('company:property-deal:query')")
public CommonResult<List<PropertyPos>> getPositionByCorpId(String id){ public CommonResult<List<PropertyPos>> getPositionByCorpId(String id){
return success(propertyPosService.list(new LambdaQueryWrapper<PropertyPos>().eq(PropertyPos::getCorpId, id))); return success(propertyPosService.list(new LambdaQueryWrapper<PropertyPos>().eq(PropertyPos::getCorpId, id)));
} }

View File

@ -0,0 +1,77 @@
package cn.iocoder.yudao.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 检测相关和角色和其对应的权重
*
* 权重分配如下
* 检测业务管理员
* 检测站老板
* 检测官方
* 检测商户
* 经销商
* 合作商
* 引车员
* 环检员
* 外检员
* 外检底检
* 一审
* 环检预审
* 检测用户
* @author 小李
* @date 15:39 2024/12/15
**/
@AllArgsConstructor
@Getter
public enum InspectionRoleCommon {
/** 检测业务管理员 */
JIANCE("jiance", 1),
/** 检测站老板 */
JCBOSS("jcboss", 1),
/** 检测官方 */
JCGF("jcgf", 2),
/** 检测商户 */
JCSHOP("jcshop", 2),
/** 经销商 */
DEALERS("dealers", 2),
/** 合作商 */
PARTNERS("partners", 2),
/** 引车员 */
JCYCY("jcycy", 3),
/** 环检员 */
JCHJY("jchjy", 4),
/** 外检员 */
JCWJY("jcwjy", 4),
/** 外检底检 */
JCWJDJ("jcwjdj", 4),
/** 一审 */
JCYSZZ("jcyszz", 4),
/** 环检预审 */
JCHJYS("jchjys", 4),
/** 检测用户 */
JCYH("jcyh", 4),
/** 检测员工 */
JCWORKER("jcworker", 4);
/** 角色Code */
private final String code;
/** 角色权重 */
private final Integer weight;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.inspection.controller; package cn.iocoder.yudao.module.inspection.controller;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.core.controller.BaseController; import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.entity.InspectionFile; import cn.iocoder.yudao.module.inspection.entity.InspectionFile;
@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* inspectionFileController * inspectionFileController
@ -105,4 +107,19 @@ public class InspectionFileController extends BaseController
} }
return toAjax(inspectionFileService.deleteInspectionFileById(id)); return toAjax(inspectionFileService.deleteInspectionFileById(id));
} }
/**
* 根据id统计数量
*
* @author 小李
* @date 14:30 2024/12/14
* @param ids ids
**/
@GetMapping("/getCountByIds")
public CommonResult<?> getCountByIds(@RequestParam(value = "ids" ,required = false) List<Long> ids) {
if (CollUtil.isEmpty(ids)){
return null;
}
return success(inspectionFileService.getCountByIds(ids));
}
} }

View File

@ -275,6 +275,32 @@ public class InspectionInfoController extends BaseController {
public CommonResult isExamine(){ public CommonResult isExamine(){
return success(inspectionInfoService.isExamine()); return success(inspectionInfoService.isExamine());
} }
/**
* 获取某个工单针对当前操作用户某个状态的项目们
*
* @author 小李
* @date 10:48 2024/12/11
* @param id 工单ID
* @param status 状态
* @param flag 状态字段是否生效默认生效
**/
@GetMapping("/getWorkNodeByIdAndNow")
public CommonResult<?> getWorkNodeByIdAndNow(Long id, String status, @RequestParam(value = "flag", defaultValue = "true") Boolean flag){
return success(inspectionInfoService.getWorkNodeByIdAndNow(id, status, flag));
}
/**
* 判断是否可以修改引车员
*
* @author 小李
* @date 15:22 2024/12/11
* @param id 工单ID
**/
@GetMapping("/judgeUpdateLeadMan")
public CommonResult<?> judgeUpdateLeadMan(Long id){
return success(inspectionInfoService.judgeUpdateLeadMan(id));
}
/** /**
* 判断当前登陆人是否有重检重审退办理的权限app * 判断当前登陆人是否有重检重审退办理的权限app
* @return * @return

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.inspection.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.InspectionRoleCommon;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
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 org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 检测用的工具Controller
*
* @author 小李
* @date 15:36 2024/12/15
**/
@RestController
@RequestMapping("/admin-api/inspection/util")
public class InspectionUtilController {
@Resource
private PermissionApi permissionApi;
@Resource
private RoleApi roleApi;
/**
* 根据用户取出当前用户的角色只针对检测
*
* @author 小李
* @date 15:15 2024/12/15
**/
@GetMapping("/getRoleName")
public CommonResult<?> getRoleName(){
String name = "未知岗位";
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId());
if (CollUtil.isEmpty(roleIdsByUserId)){
return success(name);
}
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<RoleReqDTO> roles = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).collect(Collectors.toList());
List<InspectionRoleCommon> roleCommons = Arrays.asList(InspectionRoleCommon.values());
List<String> codes = roleCommons.stream().map(InspectionRoleCommon::getCode).collect(Collectors.toList());
List<RoleReqDTO> inspectionRoles = roles.stream().filter(item -> codes.contains(item.getCode())).collect(Collectors.toList());
if (CollUtil.isEmpty(inspectionRoles)){
return success(name);
}
Integer index = Integer.MAX_VALUE;
for (RoleReqDTO inspectionRole : inspectionRoles) {
InspectionRoleCommon inspectionRoleCommon = InspectionRoleCommon.valueOf(inspectionRole.getCode().toUpperCase());
if (ObjectUtil.isEmpty(inspectionRoleCommon)){
continue;
}
Integer weight = inspectionRoleCommon.getWeight();
if (weight < index){
index = weight;
name = inspectionRole.getName();
}
}
return success(name);
}
}

View File

@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.inspection.vo.SysDictData; import cn.iocoder.yudao.module.inspection.vo.*;
import cn.iocoder.yudao.module.label.vo.LabelRespVO; import cn.iocoder.yudao.module.label.vo.LabelRespVO;
import cn.iocoder.yudao.module.partner.entity.PartnerBalanceDetail; import cn.iocoder.yudao.module.partner.entity.PartnerBalanceDetail;
import cn.iocoder.yudao.module.partner.entity.PartnerWorker; import cn.iocoder.yudao.module.partner.entity.PartnerWorker;
@ -29,15 +29,13 @@ import com.github.pagehelper.PageHelper;
import cn.iocoder.yudao.module.core.controller.BaseController; import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.entity.*; import cn.iocoder.yudao.module.inspection.entity.*;
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService; import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
import cn.iocoder.yudao.module.inspection.vo.GoodsVo;
import cn.iocoder.yudao.module.inspection.vo.InspectionInfoVo;
import cn.iocoder.yudao.module.inspection.vo.OrderAppDetail;
import cn.iocoder.yudao.module.shop.entity.ShopCouponTemplate; import cn.iocoder.yudao.module.shop.entity.ShopCouponTemplate;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners; import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -754,4 +752,34 @@ public class PartnerOwnController extends BaseController {
return success(partnerList.staticsTable5(partners.getPartnerId(),startTime,endTime)); return success(partnerList.staticsTable5(partners.getPartnerId(),startTime,endTime));
} }
/**
* 根据inspection_info的id查有的项目名称
*
* @author 小李
* @date 14:52 2024/12/10
* @param ids inspection_info的id
**/
@GetMapping("/getProjectByIds")
public CommonResult<?> getProjectByIds(Long[] ids) {
return success(partnerList.getProjectByIds(ids));
}
/**
* 根据时间查订单
*
* @author 小李
* @date 14:39 2024/12/12
* @param startTime 开始时间 非必传
* @param endTime 结束时间 非必传
* @param pageNum 页码
* @param pageSize 条数
**/
@GetMapping("/getOrderByDate")
public CommonResult<?> getOrderByDate(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@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(startTime, endTime, page));
}
} }

View File

@ -113,13 +113,14 @@ public class ShopInspectionGoodsController extends BaseController
*/ */
@GetMapping("/partnerGoodsDetail") @GetMapping("/partnerGoodsDetail")
public CommonResult partnerGoodsDetail(Long goodsId) throws Exception { public CommonResult partnerGoodsDetail(Long goodsId) throws Exception {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); // 暂时注掉
LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>(); // LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
queryWrapper.eq(ShopMallPartners::getUserId,loginUser.getId()).eq(ShopMallPartners::getType,"jc").last("limit 1"); // LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
ShopMallPartners one = appInspectionPartnerService.getOne(queryWrapper); // queryWrapper.eq(ShopMallPartners::getUserId,loginUser.getId()).eq(ShopMallPartners::getType,"jc").last("limit 1");
if (ObjectUtils.isEmpty(one)){ // ShopMallPartners one = appInspectionPartnerService.getOne(queryWrapper);
throw new Exception("您不是商户"); // if (ObjectUtils.isEmpty(one)){
} // throw new Exception("您不是商户");
// }
return success(appInspectionPartnerService.goodsDetail(goodsId)); return success(appInspectionPartnerService.goodsDetail(goodsId));
} }

View File

@ -37,6 +37,7 @@ public class InspectionStepInfo extends Model<InspectionStepInfo> {
//创建人id //创建人id
private Integer creator; private Integer creator;
//更新时间 //更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date updateTime; private Date updateTime;
//更新人id //更新人id
private Integer updater; private Integer updater;

View File

@ -66,10 +66,13 @@ public interface AppInspectionPartnerMapper extends BaseMapper<ShopMallPartners>
Long getAppointNum(@Param("partnerId") Long partnerId,@Param("formDate") String formDate); Long getAppointNum(@Param("partnerId") Long partnerId,@Param("formDate") String formDate);
Long getPickNum(@Param("partnerId") Long partnerId,@Param("formDate") String formDate); Long getPickNum(@Param("partnerId") Long partnerId,@Param("formDate") String formDate);
/**
* 根据时间查订单
*
* @author 小李
* @date 14:39 2024/12/12
* @param startTime 开始时间 非必传
* @param endTime 结束时间 非必传
**/
IPage<OrderTable> getOrderByDate(@Param("startTime") String startTime, @Param("endTime") String endTime, Page<OrderTable> page);
} }

View File

@ -36,5 +36,5 @@ public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode>
* 批量修改检测状态 * 批量修改检测状态
* @param workNodes * @param workNodes
*/ */
void recheck(@Param("list") List<InspectionWorkNode> workNodes); void recheck(@Param("list") List<InspectionWorkNode> workNodes, @Param("status") String status);
} }

View File

@ -16,6 +16,8 @@ import cn.iocoder.yudao.module.inspection.query.PartnerListQuery;
import cn.iocoder.yudao.module.inspection.vo.*; import cn.iocoder.yudao.module.inspection.vo.*;
import cn.iocoder.yudao.module.shop.entity.ShopCouponTemplate; import cn.iocoder.yudao.module.shop.entity.ShopCouponTemplate;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners; import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -108,4 +110,23 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
//新检测金额折线图 //新检测金额折线图
JSONObject newChartLineInspectionAmount(String unit); JSONObject newChartLineInspectionAmount(String unit);
/**
* 根据inspection_info的id查有的项目名称
*
* @author 小李
* @date 14:52 2024/12/10
* @param ids inspection_info的id
**/
Map<Long, String> getProjectByIds(Long[] ids);
/**
* 根据时间查订单
*
* @author 小李
* @date 14:39 2024/12/12
* @param startTime 开始时间 非必传
* @param endTime 结束时间 非必传
**/
IPage<OrderTable> getOrderByDate(String startTime, String endTime, Page<OrderTable> page);
} }

View File

@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/** /**
* inspectionFileService接口 * inspectionFileService接口
* *
@ -63,4 +66,13 @@ public interface IInspectionFileService extends IService<InspectionFile>
* @return 分页结果 * @return 分页结果
*/ */
IPage<InspectionFile> selectInspectionFileList(Page<InspectionFile> page, InspectionFile inspectionFile); IPage<InspectionFile> selectInspectionFileList(Page<InspectionFile> page, InspectionFile inspectionFile);
/**
* 根据id统计数量
*
* @author 小李
* @date 14:30 2024/12/14
* @param ids ids
**/
Map<Long, Long> getCountByIds(List<Long> ids);
} }

View File

@ -113,6 +113,25 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
*/ */
Boolean isExamine(); Boolean isExamine();
/**
* 获取某个工单针对当前操作用户某个状态的项目们
*
* @author 小李
* @date 10:48 2024/12/11
* @param id 工单ID
* @param status 状态
**/
Map<String, String> getWorkNodeByIdAndNow(Long id, String status, Boolean flag);
/**
* 判断是否可以修改引车员
*
* @author 小李
* @date 15:22 2024/12/11
* @param id 工单ID
**/
Boolean judgeUpdateLeadMan(Long id);
/** /**
* 获取当前登陆人的角色列表 * 获取当前登陆人的角色列表
* @return * @return

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.inspection.service.impl; package cn.iocoder.yudao.module.inspection.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
@ -62,6 +63,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -124,6 +127,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
private IInspectionWorkNodeService inspectionWorkNodeService; private IInspectionWorkNodeService inspectionWorkNodeService;
@Autowired @Autowired
private IShopMallPartnersService partnersService; private IShopMallPartnersService partnersService;
@Resource
private DlInspectionProjectService projectService;
@Override @Override
public IPage<PartnerListVo> partnerList(Page<PartnerListVo> page, PartnerListQuery partnerListQuery) { public IPage<PartnerListVo> partnerList(Page<PartnerListVo> page, PartnerListQuery partnerListQuery) {
@ -136,11 +141,12 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
@Override @Override
public List<ShopInspectionCategory> categoryList(Long partnerId) { public List<ShopInspectionCategory> categoryList(Long partnerId) {
LoginUser user = SecurityFrameworkUtils.getLoginUser(); // 暂时去掉
ShopMallPartners partners = baseMapper.selectById(partnerId); // LoginUser user = SecurityFrameworkUtils.getLoginUser();
if (!partners.getUserId().equals(user.getId())){ // ShopMallPartners partners = baseMapper.selectById(partnerId);
return null; // if (!partners.getUserId().equals(user.getId())){
} // return null;
// }
List<ShopInspectionCategory> shopInspectionCategories = baseMapper.partnerCategoryList(partnerId); List<ShopInspectionCategory> shopInspectionCategories = baseMapper.partnerCategoryList(partnerId);
for (ShopInspectionCategory shopInspectionCategory : shopInspectionCategories) { for (ShopInspectionCategory shopInspectionCategory : shopInspectionCategories) {
LambdaQueryWrapper<InspectionCategoryTemplate> templateLambdaQueryWrapper =new LambdaQueryWrapper<>(); LambdaQueryWrapper<InspectionCategoryTemplate> templateLambdaQueryWrapper =new LambdaQueryWrapper<>();
@ -1077,11 +1083,12 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
@Override @Override
public ShopInspectionGoods goodsDetail(Long goodsId) { public ShopInspectionGoods goodsDetail(Long goodsId) {
ShopInspectionGoods goods = goodsService.getById(goodsId); ShopInspectionGoods goods = goodsService.getById(goodsId);
LoginUser user = SecurityFrameworkUtils.getLoginUser(); // 暂时注掉
ShopMallPartners partners = baseMapper.selectById(goods.getPartnerId()); // LoginUser user = SecurityFrameworkUtils.getLoginUser();
if (!partners.getUserId().equals(user.getId())){ // ShopMallPartners partners = baseMapper.selectById(goods.getPartnerId());
return null; // if (!partners.getUserId().equals(user.getId())){
} // return null;
// }
LambdaQueryWrapper<InspectionGoodsSku> queryWrapper =new LambdaQueryWrapper<>(); LambdaQueryWrapper<InspectionGoodsSku> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(InspectionGoodsSku::getGoodsId,goodsId); queryWrapper.eq(InspectionGoodsSku::getGoodsId,goodsId);
List<InspectionGoodsSku> list = skuService.list(queryWrapper); List<InspectionGoodsSku> list = skuService.list(queryWrapper);
@ -1458,6 +1465,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
public InspectionInfoVo inspectionDetail(Long inspectionInfoId) { public InspectionInfoVo inspectionDetail(Long inspectionInfoId) {
InspectionInfo info = inspectionInfoService.getById(inspectionInfoId); InspectionInfo info = inspectionInfoService.getById(inspectionInfoId);
OrderInfo order = orderService.getById(info.getInspectionOrderId()); OrderInfo order = orderService.getById(info.getInspectionOrderId());
InspectionGoodsSku sku = skuService.getById(order.getSkuId());
AdminUserDO buyUser = userService.getUser(info.getUserId()); AdminUserDO buyUser = userService.getUser(info.getUserId());
AdminUserDO worker = userService.getUser(info.getWorkId()); AdminUserDO worker = userService.getUser(info.getWorkId());
InspectionInfoVo res =new InspectionInfoVo(); InspectionInfoVo res =new InspectionInfoVo();
@ -1485,7 +1493,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
res.setStatus(info.getStatus()); res.setStatus(info.getStatus());
res.setGoodsId(order.getGoodsId()); res.setGoodsId(order.getGoodsId());
res.setGoodsPrice(order.getGoodsPrice()); res.setGoodsPrice(order.getGoodsPrice());
res.setGoodsName(order.getGoodsTitle()); res.setGoodsName(sku.getSkuName());
res.setIsOnline(order.getIsOnline()); res.setIsOnline(order.getIsOnline());
res.setIsRetrial(info.getIsRetrial()); res.setIsRetrial(info.getIsRetrial());
res.setIsPass(info.getIsPass()); res.setIsPass(info.getIsPass());
@ -1898,4 +1906,58 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
return res; return res;
} }
/**
* 根据inspection_info的id查有的项目名称
*
* @author 小李
* @date 14:52 2024/12/10
* @param ids inspection_info的id
**/
@Override
public Map<Long, String> getProjectByIds(Long[] ids){
List<InspectionWorkNode> inspectionWorkNodes = inspectionWorkNodeService.
list(new LambdaQueryWrapper<InspectionWorkNode>()
.in(InspectionWorkNode::getInspectionInfoId, Arrays.asList(ids)));
if (ObjectUtil.isEmpty(inspectionWorkNodes)){
return null;
}
List<String> projectIds = inspectionWorkNodes.stream().map(InspectionWorkNode::getProjectId).collect(Collectors.toList());
if (CollUtil.isEmpty(projectIds)){
return null;
}
List<DlInspectionProject> projects = projectService.listByIds(projectIds);
if (CollUtil.isEmpty(projects)){
return null;
}
Map<String, String> projectMap = projects.stream().collect(Collectors.toMap(DlInspectionProject::getId, DlInspectionProject::getProjectName));
Map<Long, String> result = new HashMap<>();
Map<Long, List<String>> map = inspectionWorkNodes.stream().collect(Collectors
.groupingBy(InspectionWorkNode::getInspectionInfoId,
Collectors.mapping(InspectionWorkNode::getProjectId, Collectors.toList())));
for (Long id : ids) {
List<String> values = map.get(id);
String names = values.stream().filter(projectMap::containsKey).map(projectMap::get).collect(Collectors.joining(","));
result.put(id, names);
}
return result;
}
/**
* 根据时间查订单
*
* @author 小李
* @date 14:39 2024/12/12
* @param startTime 开始时间 非必传
* @param endTime 结束时间 非必传
**/
@Override
public IPage<OrderTable> getOrderByDate(String startTime, String endTime, Page<OrderTable> page){
if (StringUtils.isEmpty(startTime)){
startTime = DateUtil.format(new Date(), "yyyy-MM-dd");
endTime = DateUtil.format(new Date(), "yyyy-MM-dd");
}
startTime = startTime + " 00:00:00";
endTime = endTime + " 23:59:59";
return baseMapper.getOrderByDate(startTime, endTime, page);
}
} }

View File

@ -4,8 +4,11 @@ import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -13,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.iocoder.yudao.util.DateUtils; import cn.iocoder.yudao.util.DateUtils;
import cn.iocoder.yudao.module.inspection.entity.WarnMessage; import cn.iocoder.yudao.module.inspection.entity.WarnMessage;
import cn.iocoder.yudao.module.inspection.service.IWarnMessageService; import cn.iocoder.yudao.module.inspection.service.IWarnMessageService;
import io.prometheus.client.CollectorRegistry;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cn.iocoder.yudao.module.inspection.mapper.InspectionEquInfoMapper; import cn.iocoder.yudao.module.inspection.mapper.InspectionEquInfoMapper;
@ -30,6 +34,7 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
{ {
@Autowired @Autowired
private IWarnMessageService messageService; private IWarnMessageService messageService;
private CollectorRegistry collectorRegistry;
/** /**
* 查询equInfo * 查询equInfo
@ -92,14 +97,16 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
* @return 结果 * @return 结果
*/ */
@Override @Override
@DSTransactional
public int updateInspectionEquInfo(InspectionEquInfo inspectionEquInfo) public int updateInspectionEquInfo(InspectionEquInfo inspectionEquInfo)
{ {
LambdaQueryWrapper<WarnMessage> queryWrapper =new LambdaQueryWrapper<>(); LambdaQueryWrapper<WarnMessage> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(WarnMessage::getType,"equ").eq(WarnMessage::getObjectId,inspectionEquInfo.getId()); queryWrapper.eq(WarnMessage::getType,"equ").eq(WarnMessage::getObjectId,inspectionEquInfo.getId());
WarnMessage one = messageService.getOne(queryWrapper); List<WarnMessage> list = messageService.list(queryWrapper);
if (ObjectUtil.isNotEmpty(one)){ if (CollUtil.isNotEmpty(list)){
//更新处理 //更新处理
messageService.removeById(one.getId()); List<Long> ids = list.stream().map(WarnMessage::getId).collect(Collectors.toList());
messageService.removeBatchByIds(ids);
} }
if (ObjectUtil.isNotEmpty(inspectionEquInfo.getNextCheckTime())){ if (ObjectUtil.isNotEmpty(inspectionEquInfo.getNextCheckTime())){
//同时处理提醒信息 //同时处理提醒信息

View File

@ -16,6 +16,8 @@ import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* inspectionFileService业务层处理 * inspectionFileService业务层处理
@ -160,12 +162,32 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
@Override @Override
public IPage<InspectionFile> selectInspectionFileList(Page<InspectionFile> page, InspectionFile inspectionFile) { public IPage<InspectionFile> selectInspectionFileList(Page<InspectionFile> page, InspectionFile inspectionFile) {
// 创建一个空的 QueryWrapper // 创建一个空的 QueryWrapper
QueryWrapper<InspectionFile> queryWrapper = new QueryWrapper<>(); LambdaQueryWrapper<InspectionFile> queryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isNotEmpty(inspectionFile.getFatherId())) { if (ObjectUtil.isNotEmpty(inspectionFile.getFatherId())) {
queryWrapper.eq("father_id", inspectionFile.getFatherId()); queryWrapper.eq(InspectionFile::getFatherId, inspectionFile.getFatherId());
}
queryWrapper.orderByAsc(InspectionFile::getType);
queryWrapper.orderByDesc(InspectionFile::getCreateTime);
if (ObjectUtil.isNotEmpty(inspectionFile.getFileName())){
queryWrapper.like(InspectionFile::getFileName, inspectionFile.getFileName());
} }
// 直接调用 MyBatis-Plus page 方法进行分页查询 // 直接调用 MyBatis-Plus page 方法进行分页查询
return this.page(page, queryWrapper); // 返回符合条件的分页查询结果 return this.page(page, queryWrapper); // 返回符合条件的分页查询结果
} }
/**
* 根据id统计数量
*
* @author 小李
* @date 14:30 2024/12/14
* @param ids ids
**/
@Override
public Map<Long, Long> getCountByIds(List<Long> ids){
List<InspectionFile> inspectionFiles = baseMapper.selectList(new LambdaQueryWrapper<InspectionFile>().in(InspectionFile::getFatherId, ids));
return inspectionFiles.stream().collect(Collectors.groupingBy(
InspectionFile::getFatherId,
Collectors.counting()
));
}
} }

View File

@ -8,10 +8,7 @@ import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.afterturn.easypoi.word.WordExportUtil; import cn.afterturn.easypoi.word.WordExportUtil;
@ -73,6 +70,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS; import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
/** /**
* 请填写功能名称Service业务层处理 * 请填写功能名称Service业务层处理
@ -115,6 +113,9 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
private InspectionSocket inspectionSocket; private InspectionSocket inspectionSocket;
@Resource @Resource
private RoleMapper roleMapper; private RoleMapper roleMapper;
@Resource
@Lazy
private DlInspectionProjectService projectService;
@Autowired @Autowired
private FileService fileService; private FileService fileService;
@ -211,11 +212,11 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
} }
inspectionInfo.setCategoryId(goods.getGoodsCategoryId()); inspectionInfo.setCategoryId(goods.getGoodsCategoryId());
if (ObjectUtil.isNotNull(inspectionInfo.getAdditionalRecording()) && inspectionInfo.getAdditionalRecording() == 1){ if (ObjectUtil.isNotNull(inspectionInfo.getAdditionalRecording()) && inspectionInfo.getAdditionalRecording() == 1) {
inspectionInfo.setStatus("1"); inspectionInfo.setStatus("1");
inspectionInfo.setIsPass("1"); inspectionInfo.setIsPass("1");
inspectionInfo.setEndTime(inspectionInfo.getStartTime()); inspectionInfo.setEndTime(inspectionInfo.getStartTime());
}else { } else {
inspectionInfo.setStatus("0"); inspectionInfo.setStatus("0");
} }
inspectionInfo.setWorkId(workerUser.getId()); inspectionInfo.setWorkId(workerUser.getId());
@ -336,7 +337,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
// Integer roleId = inspectionWorkNodes.get(0).getRoleId(); // Integer roleId = inspectionWorkNodes.get(0).getRoleId();
List<Integer> roleIds = new ArrayList<>(); List<Integer> roleIds = new ArrayList<>();
/*获取所有的角色id*/ /*获取所有的角色id*/
if(CollUtil.isNotEmpty(inspectionWorkNodes)){ if (CollUtil.isNotEmpty(inspectionWorkNodes)) {
roleIds = inspectionWorkNodes.stream().map(inspectionWorkNode -> inspectionWorkNode.getRoleId()).collect(Collectors.toList()); roleIds = inspectionWorkNodes.stream().map(inspectionWorkNode -> inspectionWorkNode.getRoleId()).collect(Collectors.toList());
} }
//根据角色id获取所有用户 //根据角色id获取所有用户
@ -574,6 +575,78 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
return false; return false;
} }
/**
* 获取某个工单针对当前操作用户某个状态的项目们
*
* @param id 工单ID
* @param status 状态
* @author 小李
* @date 10:48 2024/12/11
**/
@Override
public Map<String, String> getWorkNodeByIdAndNow(Long id, String status, Boolean flag) {
Long userId = SecurityFrameworkUtils.getLoginUserId();
List<UserRoleDO> roles = roleService.getByUserId(userId);
if (CollUtil.isEmpty(roles)) {
throw exception0(500, "查询角色为空");
}
List<Long> roleIds = roles.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
LambdaQueryWrapper<InspectionWorkNode> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InspectionWorkNode::getInspectionInfoId, id);
if (flag) {
wrapper.eq(InspectionWorkNode::getStatus, status);
}
InspectionInfo inspectionInfo = baseMapper.selectById(id);
if (!inspectionInfo.getLeadManId().equals(userId)) {
wrapper.in(InspectionWorkNode::getRoleId, roleIds);
}
List<InspectionWorkNode> workNodes = workNodeService.list(wrapper);
if (CollUtil.isEmpty(workNodes)) {
throw exception0(500, "没有项目需要操作");
}
List<String> projectIds = workNodes.stream().map(InspectionWorkNode::getProjectId).collect(Collectors.toList());
if (CollUtil.isEmpty(projectIds)) {
throw exception0(500, "没有项目需要操作");
}
List<DlInspectionProject> projects = projectService.listByIds(projectIds);
if (CollUtil.isEmpty(projects)) {
throw exception0(500, "没有项目需要操作");
}
Map<String, String> map = projects.stream().collect(Collectors.toMap(DlInspectionProject::getId, DlInspectionProject::getProjectName));
Map<String, String> result = new HashMap<>();
workNodes.forEach(item -> {
result.put(item.getId(), map.get(item.getProjectId()));
});
return result;
}
/**
* 判断是否可以修改引车员
*
* @author 小李
* @date 15:22 2024/12/11
* @param id 工单ID
**/
@Override
public Boolean judgeUpdateLeadMan(Long id){
boolean result = true;
InspectionInfo inspectionInfo = baseMapper.selectById(id);
if (!inspectionInfo.getStatus().equals("2")){
result = false;
}
if (!result){
List<InspectionWorkNode> list = workNodeService.list(new LambdaQueryWrapper<InspectionWorkNode>().eq(InspectionWorkNode::getInspectionInfoId, id));
Set<String> status = list.stream().map(InspectionWorkNode::getStatus).collect(Collectors.toSet());
if (status.contains("3")){
result = true;
}
}
if (result){
result = inspectionInfo.getCreator().equals(SecurityFrameworkUtils.getLoginUserId()+"");
}
return result;
}
/** /**
* 获取当前登陆人的角色列表 * 获取当前登陆人的角色列表
* *

View File

@ -28,9 +28,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.time.LocalDateTime;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -80,7 +79,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
throw new RuntimeException("流程不存在"); throw new RuntimeException("流程不存在");
} }
//判断当前流程是否已被接单 //判断当前流程是否已被接单
if (!workNode.getStatus().equals("0")) { if (!workNode.getStatus().equals("0") && !workNode.getStatus().equals("3")) {
throw new RuntimeException("当前流程已被接单"); throw new RuntimeException("当前流程已被接单");
} }
//修改流程相关信息 //修改流程相关信息
@ -90,6 +89,21 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
//更新 //更新
this.updateById(workNode); this.updateById(workNode);
// 插入步骤信息
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
inspectionStepInfo.setInspectionInfoId(inspectionId);
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
.eq(DlInspectionProject::getId, workNode.getProjectId()));
if (ObjectUtil.isNotNull(project)) {
inspectionStepInfo.setTitle(project.getProjectName());
} else {
inspectionStepInfo.setTitle("检测项目");
}
inspectionStepInfo.setCreateTime(DateUtil.date());
inspectionStepInfo.setCreator(Integer.parseInt(SecurityFrameworkUtils.getLoginUserId() + ""));
inspectionStepInfo.setWorkNodeId(workNodeId);
inspectionStepService.save(inspectionStepInfo);
//查询用户 信息 //查询用户 信息
//修改工单表中当前施工人 //修改工单表中当前施工人
// inspectionInfo.setWorkId(workerUser.getId()); // inspectionInfo.setWorkId(workerUser.getId());
@ -143,6 +157,16 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
// 更新流程 // 更新流程
// this.updateById(workNode); // this.updateById(workNode);
baseMapper.cancelAnOrder(workNode); baseMapper.cancelAnOrder(workNode);
// 删除步骤信息
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
.eq(DlInspectionProject::getId, workNode.getProjectId()));
inspectionStepService.remove(new LambdaQueryWrapper<InspectionStepInfo>()
.and(i ->
i.eq(InspectionStepInfo::getInspectionInfoId, inspectionId)
.eq(InspectionStepInfo::getWorkNodeId, workNodeId)
.eq(InspectionStepInfo::getTitle, project.getProjectName())
));
} }
/** /**
@ -179,40 +203,52 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
LambdaQueryWrapper<InspectionWorkNode> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<InspectionWorkNode> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(InspectionWorkNode::getInspectionInfoId, workNode.getInspectionInfoId()); queryWrapper.eq(InspectionWorkNode::getInspectionInfoId, workNode.getInspectionInfoId());
//是否还有进行中或者待开始的状态 //是否还有进行中或者待开始的状态
queryWrapper.in(InspectionWorkNode::getStatus, "0","1"); queryWrapper.in(InspectionWorkNode::getStatus, "0", "1");
List<InspectionWorkNode> inspectionWorkNodes = this.list(queryWrapper); List<InspectionWorkNode> inspectionWorkNodes = this.list(queryWrapper);
boolean flag = true; boolean flag = true;
//判断是否是最后一个流程 //判断是否是最后一个流程
if (inspectionWorkNodes.size() == 1 && inspectionWorkNodes.get(0).getId().equals(workNode.getId())){ if (inspectionWorkNodes.size() == 1 && inspectionWorkNodes.get(0).getId().equals(workNode.getId())) {
flag = false; flag = false;
} }
// 更新或插入步骤信息
// 插入步骤信息
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
//根据projectId查询项目名称
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>() DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
.eq(DlInspectionProject::getId, workNode.getProjectId())); .eq(DlInspectionProject::getId, workNode.getProjectId()));
String stepTitle = ""; List<InspectionStepInfo> stepInfos = inspectionStepService.list(new LambdaQueryWrapper<InspectionStepInfo>()
if (ObjectUtil.isNotNull(project)) { .and(i -> i.eq(InspectionStepInfo::getInspectionInfoId, workNode.getInspectionInfoId())
inspectionStepInfo.setTitle(project.getProjectName()); .eq(InspectionStepInfo::getWorkNodeId, workNode.getId())
.eq(InspectionStepInfo::getTitle, ObjectUtil.isNotEmpty(project) ? project.getProjectName() : workNode.getProjectName())
));
InspectionStepInfo stepInfo = new InspectionStepInfo();
if (CollUtil.isNotEmpty(stepInfos)){
List<InspectionStepInfo> sorted = stepInfos.stream()
.sorted(Comparator.comparing(InspectionStepInfo::getCreateTime).reversed()).collect(Collectors.toList());
stepInfo = sorted.get(0);
}
if (ObjectUtil.isNotEmpty(stepInfo)) {
stepInfo.setUpdateTime(DateUtil.date());
stepInfo.setUpdater(Integer.parseInt(SecurityFrameworkUtils.getLoginUserId() + ""));
} else { } else {
inspectionStepInfo.setTitle("项目检测完成"); stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
if (ObjectUtil.isNotNull(project)) {
stepInfo.setTitle(project.getProjectName());
} else {
stepInfo.setTitle("项目检测完成");
}
stepInfo.setWorkNodeId(workNode.getId());
stepInfo.setCreateTime(DateUtil.date());
stepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
stepInfo.setUpdater(Integer.parseInt(String.valueOf(loginUser.getId())));
stepInfo.setUpdateTime(DateUtil.date());
} }
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getRemark())) { if (ObjectUtil.isNotEmpty(inspectionWorkNode.getRemark())) {
inspectionStepInfo.setContent(inspectionWorkNode.getRemark()); stepInfo.setContent(inspectionWorkNode.getRemark());
} }
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getDealImages())) { if (ObjectUtil.isNotEmpty(inspectionWorkNode.getDealImages())) {
inspectionStepInfo.setImages(inspectionWorkNode.getDealImages()); stepInfo.setImages(inspectionWorkNode.getDealImages());
} }
inspectionStepInfo.setWorkNodeId(workNode.getId()); inspectionStepService.saveOrUpdate(stepInfo);
inspectionStepInfo.setCreateTime(DateUtil.date());
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
inspectionStepService.save(inspectionStepInfo);
if (!flag) { if (!flag) {
stepTitle = "检测结束";
//设置工单状态为已完成 //设置工单状态为已完成
inspectionInfo.setStatus("1"); inspectionInfo.setStatus("1");
//设置工单通过 //设置工单通过
@ -223,12 +259,12 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
inspectionInfo.setMakeCert("1"); inspectionInfo.setMakeCert("1");
//步骤结束 //步骤结束
inspectionStepInfo = new InspectionStepInfo(); stepInfo = new InspectionStepInfo();
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId()))); stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
inspectionStepInfo.setTitle(stepTitle); stepInfo.setTitle("检测结束");
inspectionStepInfo.setCreateTime(DateUtil.date()); stepInfo.setCreateTime(DateUtil.date());
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId()))); stepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
inspectionStepService.save(inspectionStepInfo); inspectionStepService.save(stepInfo);
} }
// else { // else {
// //修改工单表当前流程 // //修改工单表当前流程
@ -314,7 +350,11 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
//获取当前登陆人 //获取当前登陆人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//将传递过来的流程节点全部改为未进行 //将传递过来的流程节点全部改为未进行
baseMapper.recheck(workNodes.getWorkNodes()); String status = "0";
if (CollUtil.isNotEmpty(workNodes.getWorkNodes()) && ObjectUtil.isNotEmpty(workNodes.getWorkNodes().get(0).getStatus())){
status = workNodes.getWorkNodes().get(0).getStatus();
}
baseMapper.recheck(workNodes.getWorkNodes(), status);
//将检测工单设置为重审 //将检测工单设置为重审
InspectionInfo info = inspectionInfoService.getById(workNodes.getInspectionInfoId()); InspectionInfo info = inspectionInfoService.getById(workNodes.getInspectionInfoId());
info.setIsRetrial("1"); info.setIsRetrial("1");
@ -345,7 +385,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
List<Integer> roleIds = new ArrayList<>(); List<Integer> roleIds = new ArrayList<>();
/*获取所有的角色id*/ /*获取所有的角色id*/
if(CollUtil.isNotEmpty(workNodes.getWorkNodes())){ if (CollUtil.isNotEmpty(workNodes.getWorkNodes())) {
roleIds = workNodes.getWorkNodes().stream().map(inspectionWorkNode -> inspectionWorkNode.getRoleId()).collect(Collectors.toList()); roleIds = workNodes.getWorkNodes().stream().map(inspectionWorkNode -> inspectionWorkNode.getRoleId()).collect(Collectors.toList());
} }
//根据角色id获取所有用户 //根据角色id获取所有用户
@ -431,7 +471,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
* *
* @param inspectionWorkNode * @param inspectionWorkNode
*/ */
public void retrial(InspectionWorkNode inspectionWorkNode){ public void retrial(InspectionWorkNode inspectionWorkNode) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//通过流程节点id查询流程 //通过流程节点id查询流程
InspectionWorkNode workNode = this.getById(inspectionWorkNode.getId()); InspectionWorkNode workNode = this.getById(inspectionWorkNode.getId());
@ -454,7 +494,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
Integer roleId = workNode.getRoleId(); Integer roleId = workNode.getRoleId();
List<UserDTO> listByUserId = roleService.getListByUserId(roleId); List<UserDTO> listByUserId = roleService.getListByUserId(roleId);
List<Long> ids = listByUserId.stream().map(UserDTO::getId).collect(Collectors.toList()); List<Long> ids = listByUserId.stream().map(UserDTO::getId).collect(Collectors.toList());
if (ObjectUtil.isNotNull(info.getLeadManId())){ if (ObjectUtil.isNotNull(info.getLeadManId())) {
ids.add(info.getLeadManId()); ids.add(info.getLeadManId());
} }
sendSocketMessage(ids); sendSocketMessage(ids);

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.inspection.vo;
import lombok.Data;
/**
* 用于当日订单详情
*
* @author 小李
* @date 14:41 2024/12/12
**/
@Data
public class OrderTable {
/** 工单ID */
private Long id;
/** 车牌号 */
private String carNum;
/** 检测类型 */
private String type;
/** 检测状态 */
private String status;
/** 检测结果 */
private String result;
/** 是否支付 */
private String pay;
/** 支付方式 */
private String payType;
}

View File

@ -8,7 +8,7 @@
</update> </update>
<update id="recheck"> <update id="recheck">
UPDATE inspection_work_node UPDATE inspection_work_node
SET status = '0', deal_user_id = null, deal_user_name = null, deal_images = null, remark = null,type = null SET status = #{status}, deal_user_id = null, deal_user_name = null, deal_images = null, remark = null,type = null
WHERE id in ( WHERE id in (
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
#{item.id} #{item.id}

View File

@ -345,8 +345,10 @@ FROM
FROM FROM
shop_inspection_category cate shop_inspection_category cate
INNER JOIN inspection_category_template template on template.category_id = cate.id INNER JOIN inspection_category_template template on template.category_id = cate.id
<if test="partnerId == null">
left JOIN shop_inspection_goods goods ON goods.goods_category_id = cate.id and goods.partner_id = #{partnerId} left JOIN shop_inspection_goods goods ON goods.goods_category_id = cate.id and goods.partner_id = #{partnerId}
where goods.id is null where goods.id is null
</if>
group by cate.id group by cate.id
ORDER BY cate.order_num ORDER BY cate.order_num
@ -524,4 +526,54 @@ FROM
</if> </if>
order by pw.create_time desc order by pw.create_time desc
</select> </select>
<select id="getOrderByDate" resultType="cn.iocoder.yudao.module.inspection.vo.OrderTable">
SELECT t.id,
t.carNum,
t.type,
t.pay,
t.payType,
CASE
WHEN t.status = '已完成' AND t.is_pass = 0 THEN '不合格'
WHEN t.status = '已完成' AND t.is_pass = 1 THEN '合格'
WHEN t.status = '已完成' THEN '未知'
ELSE ''
END AS result,
t.status
FROM (SELECT ii.id,
ii.car_num AS carNum,
oi.sku_name AS type,
oi.pay_type as payType,
CASE
WHEN oi.pay_type IS NULL THEN '未支付'
ELSE '已支付'
END AS pay,
CASE
WHEN oi.pay_type IS NOT NULL THEN '已完成'
WHEN has_status_0_or_null THEN '检测中'
WHEN (ii.status = 0 OR ii.status = 2) AND has_status_1 THEN '检测中'
WHEN (COALESCE(max_iwn_status, 0) = 2 OR ii.status = 1) THEN '已完成'
WHEN (ii.status = 0 OR ii.status = 2) AND COALESCE(max_iwn_status, 0) = 0 THEN '待检测'
ELSE '未知状态' -- 这是为了处理任何未预期的情况
END AS status,
ii.is_pass,
COALESCE(max_iwn_status, 0) AS max_iwn_status,
oi.create_time
FROM order_info oi
INNER JOIN
inspection_info ii
ON
oi.id = ii.inspection_order_id
LEFT JOIN (SELECT inspection_info_id,
MAX(COALESCE(status, 0)) AS max_iwn_status,
MAX(CASE WHEN COALESCE(status, 0) = 1 THEN 1 ELSE 0 END) AS has_status_1,
MAX(CASE WHEN COALESCE(status, 0) = 0 THEN 1 ELSE 0 END) AS has_status_0_or_null
FROM inspection_work_node
GROUP BY inspection_info_id) iwn_agg
ON
ii.id = iwn_agg.inspection_info_id
WHERE oi.create_time BETWEEN #{startTime} AND #{endTime}
AND oi.deleted = '0') t
ORDER BY t.create_time DESC
</select>
</mapper> </mapper>

View File

@ -269,14 +269,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by ins.start_time desc order by ins.start_time desc
</select> </select>
<select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo"> <select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT *
FROM (
SELECT SELECT
ii.*, ii.*,
iwn.id AS workNodeId, iwn.id AS workNodeId,
iwn.status AS workNodeStatus, iwn.status AS workNodeStatus,
oi.order_no AS orderNo, oi.order_no AS orderNo,
oi.phonenumber AS buyPhone, oi.phonenumber AS buyPhone,
oi.goods_title as goodsTitle,
oi.sku_name as skuName,
ip.project_name AS projectName, ip.project_name AS projectName,
su.nickname AS leadManName su.nickname AS leadManName,
ROW_NUMBER() OVER (PARTITION BY ii.id ORDER BY iwn.update_time DESC) as rn -- 根据需要调整排序逻辑
FROM FROM
inspection_info ii inspection_info ii
LEFT JOIN LEFT JOIN
@ -292,7 +297,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="inspectionInfo.carNum != null"> <if test="inspectionInfo.carNum != null">
AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%') AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')
</if> </if>
<!-- 待接受 --> <!-- 待支付 -->
<if test="inspectionInfo.status == '0'.toString()">
AND (oi.pay_time is null)
ORDER BY iwn.update_time DESC
</if>
<!-- 待接受(待检测) -->
<if test="inspectionInfo.status == 1"> <if test="inspectionInfo.status == 1">
AND <!-- 工单负责人或角色ID匹配 --> AND <!-- 工单负责人或角色ID匹配 -->
(ii.lead_man_id = #{inspectionInfo.leadManId} (ii.lead_man_id = #{inspectionInfo.leadManId}
@ -305,20 +315,99 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-- AND ii.now_order_num = iwn.order_num -- AND ii.now_order_num = iwn.order_num
ORDER BY ii.create_time DESC ORDER BY ii.create_time DESC
</if> </if>
<!-- 进行中 --> <!-- 进行中(检测中) -->
<if test="inspectionInfo.status == 2"> <if test="inspectionInfo.status == 2">
AND ii.status = '0' AND (ii.status = '0' OR ii.status = '2')
AND iwn.status = '1' AND iwn.status = '1'
AND iwn.deal_user_id = #{inspectionInfo.dealUserId} AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC ORDER BY iwn.update_time DESC
</if> </if>
<!-- 已完成 --> <!-- 待重检 -->
<if test="inspectionInfo.status == 3"> <if test="inspectionInfo.status == 3">
AND <!-- 工单负责人或角色ID匹配 -->
(ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
AND ii.status = '2'
-- AND iwn.status = '1'
-- AND ii.now_order_num = iwn.order_num
ORDER BY ii.update_time DESC
</if>
<!-- 待复检 -->
<if test="inspectionInfo.status == 4">
AND <!-- 工单负责人或角色ID匹配 -->
(ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
-- AND ii.status = '2'
AND iwn.status = '3'
-- AND ii.now_order_num = iwn.order_num
ORDER BY ii.update_time DESC
</if>
<!-- 已完成 -->
<if test="inspectionInfo.status == 5">
AND iwn.status = '2' AND iwn.status = '2'
AND iwn.deal_user_id = #{inspectionInfo.dealUserId} AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC ORDER BY iwn.update_time DESC
</if> </if>
</where> </where>
</select> ) AS subquery
WHERE rn = 1;
<!-- 之前的查询,修改为了一个工单只出现一条,不分项目 -->
<!-- SELECT-->
<!-- ii.*,-->
<!-- iwn.id AS workNodeId,-->
<!-- iwn.status AS workNodeStatus,-->
<!-- oi.order_no AS orderNo,-->
<!-- oi.phonenumber AS buyPhone,-->
<!-- ip.project_name AS projectName,-->
<!-- su.nickname AS leadManName-->
<!-- FROM-->
<!-- inspection_info ii-->
<!-- LEFT JOIN-->
<!-- inspection_work_node iwn ON ii.id = iwn.inspection_info_id-->
<!-- LEFT JOIN-->
<!-- order_info oi ON ii.inspection_order_id = oi.id-->
<!-- LEFT JOIN-->
<!-- inspection_project ip ON iwn.project_id = ip.id-->
<!-- LEFT JOIN-->
<!-- system_users su ON ii.lead_man_id = su.id-->
<!-- <where>-->
<!-- &lt;!&ndash; 车牌号模糊查询 &ndash;&gt;-->
<!-- <if test="inspectionInfo.carNum != null">-->
<!-- AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')-->
<!-- </if>-->
<!-- &lt;!&ndash; 待接受 &ndash;&gt;-->
<!-- <if test="inspectionInfo.status == 1">-->
<!-- AND &lt;!&ndash; 工单负责人或角色ID匹配 &ndash;&gt;-->
<!-- (ii.lead_man_id = #{inspectionInfo.leadManId}-->
<!-- OR iwn.role_id IN-->
<!-- <foreach collection="roleIds" item="roleId" open="(" separator="," close=")">-->
<!-- #{roleId}-->
<!-- </foreach>)-->
<!-- AND ii.status = '0'-->
<!-- AND iwn.status = '0'-->
<!-- &#45;&#45; AND ii.now_order_num = iwn.order_num-->
<!-- ORDER BY ii.create_time DESC-->
<!-- </if>-->
<!-- &lt;!&ndash; 进行中 &ndash;&gt;-->
<!-- <if test="inspectionInfo.status == 2">-->
<!-- AND ii.status = '0'-->
<!-- AND iwn.status = '1'-->
<!-- AND iwn.deal_user_id = #{inspectionInfo.dealUserId}-->
<!-- ORDER BY iwn.update_time DESC-->
<!-- </if>-->
<!-- &lt;!&ndash; 已完成 &ndash;&gt;-->
<!-- <if test="inspectionInfo.status == 3">-->
<!-- AND iwn.status = '2'-->
<!-- AND iwn.deal_user_id = #{inspectionInfo.dealUserId}-->
<!-- ORDER BY iwn.update_time DESC-->
<!-- </if>-->
<!-- </where>-->
</select>
</mapper> </mapper>

View File

@ -51,13 +51,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INNER JOIN shop_mall_partners smp ON smp.partner_id = sig.partner_id AND smp.is_banned = '0' INNER JOIN shop_mall_partners smp ON smp.partner_id = sig.partner_id AND smp.is_banned = '0'
INNER JOIN shop_inspection_category sic ON sic.id = sig.goods_category_id INNER JOIN shop_inspection_category sic ON sic.id = sig.goods_category_id
<where> <where>
and sig.deleted = '0' and smp.deleted = '0' and sic.deleted = '0'
<if test="vo.id != null "> and sig.id = #{vo.id}</if> <if test="vo.id != null "> and sig.id = #{vo.id}</if>
<if test="vo.title != null and title != ''"> and sig.title like concat('%', #{vo.title}, '%')</if> <if test="vo.title != null and vo.title != ''"> and sig.title like concat('%', #{vo.title}, '%')</if>
<if test="vo.goodsCategoryId!= null "> and sig.goods_category_id = #{vo.goodsCategoryId}</if> <if test="vo.goodsCategoryId!= null "> and sig.goods_category_id = #{vo.goodsCategoryId}</if>
<if test="vo.partnerName!= null "> and smp.partner_name like concat('%',#{vo.partnerName},'%')</if> <if test="vo.partnerName!= null "> and smp.partner_name like concat('%',#{vo.partnerName},'%')</if>
<if test="vo.partnerId!= null "> and sig.partner_id = #{vo.partnerId}</if> <if test="vo.partnerId!= null "> and sig.partner_id = #{vo.partnerId}</if>
<if test="vo.isListing != null and vo.isListing != ''">and sig.is_listing = #{vo.isListing}</if>
</where> </where>
ORDER BY FIELD(sig.listing_status,1,2,3,0), create_time desc ORDER BY sig.is_listing, sig.create_time desc
</select> </select>
</mapper> </mapper>

View File

@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warnMessage.title != null and warnMessage.title != ''"> and title = #{warnMessage.title}</if> <if test="warnMessage.title != null and warnMessage.title != ''"> and title = #{warnMessage.title}</if>
<if test="warnMessage.partnerId != null "> and partner_id = #{warnMessage.partnerId}</if> <if test="warnMessage.partnerId != null "> and partner_id = #{warnMessage.partnerId}</if>
<if test="warnMessage.isRead != null and warnMessage.isRead != ''"> and is_read = #{warnMessage.isRead}</if> <if test="warnMessage.isRead != null and warnMessage.isRead != ''"> and is_read = #{warnMessage.isRead}</if>
and deleted = '0'
</where> </where>
order by create_time desc order by create_time desc
</select> </select>

View File

@ -45,6 +45,12 @@ public class DriveSchoolSwiperController extends BaseController
@GetMapping("/pclist") @GetMapping("/pclist")
@PermitAll @PermitAll
public CommonResult pclist(DriveSchoolSwiper driveSchoolSwiper) { public CommonResult pclist(DriveSchoolSwiper driveSchoolSwiper) {
if(driveSchoolSwiper.getPageNum() == null) {
driveSchoolSwiper.setPageNum(1);
}
if(driveSchoolSwiper.getPageSize() == null) {
driveSchoolSwiper.setPageSize(100);
}
Page<DriveSchoolSwiper> page = new Page<>(driveSchoolSwiper.getPageNum(), driveSchoolSwiper.getPageSize()); Page<DriveSchoolSwiper> page = new Page<>(driveSchoolSwiper.getPageNum(), driveSchoolSwiper.getPageSize());
IPage<DriveSchoolSwiper> driveSchoolSeparateIPage = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper, page); IPage<DriveSchoolSwiper> driveSchoolSeparateIPage = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper, page);

View File

@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.repository.query.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;

View File

@ -99,9 +99,9 @@ public class DriveSchoolPayServiceImpl implements DriveSchoolPayService
IPage<DriveSchoolPay> driveSchoolPayIPage = driveSchoolPayMapper.stuList(driveSchoolPay, page); IPage<DriveSchoolPay> driveSchoolPayIPage = driveSchoolPayMapper.stuList(driveSchoolPay, page);
List<DriveSchoolPay> driveSchoolPays = driveSchoolPayIPage.getRecords(); List<DriveSchoolPay> driveSchoolPays = driveSchoolPayIPage.getRecords();
ArrayList<DriveSchoolPay> collect = driveSchoolPays.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DriveSchoolPay::getIdentity))), ArrayList::new)); // ArrayList<DriveSchoolPay> collect = driveSchoolPays.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DriveSchoolPay::getIdentity))), ArrayList::new));
for (DriveSchoolPay schoolPay : collect) { for (DriveSchoolPay schoolPay : driveSchoolPays) {
Long userId = schoolPay.getUserId(); Long userId = schoolPay.getUserId();
AdminUserRespDTO sysUser = userApi.getUser(userId); AdminUserRespDTO sysUser = userApi.getUser(userId);
//SysUser sysUser = sysUserMapper.selectUserById(userId); //SysUser sysUser = sysUserMapper.selectUserById(userId);
@ -110,8 +110,8 @@ public class DriveSchoolPayServiceImpl implements DriveSchoolPayService
} }
} }
//根据时间倒序排序 //根据时间倒序排序
collect.sort(Comparator.comparing(DriveSchoolPay::getCreateTime).reversed()); driveSchoolPays.sort(Comparator.comparing(DriveSchoolPay::getCreateTime).reversed());
driveSchoolPayIPage.setRecords(collect); driveSchoolPayIPage.setRecords(driveSchoolPays);
return driveSchoolPayIPage; return driveSchoolPayIPage;
} }

View File

@ -111,24 +111,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM drive_school_swiper FROM drive_school_swiper
<where> <where>
deleted = 0 deleted = 0
<if test="driveSchoolSwiper != null">
<if test="driveSchoolSwiper.swiperName != null and driveSchoolSwiper.swiperName != ''"> <if test="entity.swiperName != null and entity.swiperName != ''">
AND swiper_name LIKE CONCAT('%', #{driveSchoolSwiper.swiperName}, '%') AND swiper_name LIKE CONCAT('%', #{entity.swiperName}, '%')
</if> </if>
<if test="driveSchoolSwiper.swiperPicture != null and driveSchoolSwiper.swiperPicture != ''"> <if test="entity.swiperPicture != null and entity.swiperPicture != ''">
AND swiper_picture = #{driveSchoolSwiper.swiperPicture} AND swiper_picture = #{entity.swiperPicture}
</if> </if>
<if test="driveSchoolSwiper.jumpUrl != null and driveSchoolSwiper.jumpUrl != ''"> <if test="entity.jumpUrl != null and entity.jumpUrl != ''">
AND jump_url = #{driveSchoolSwiper.jumpUrl} AND jump_url = #{entity.jumpUrl}
</if> </if>
<if test="driveSchoolSwiper.deptId != null"> <if test="entity.deptId != null">
AND dept_id = #{driveSchoolSwiper.deptId} AND dept_id = #{entity.deptId}
</if>
<if test="driveSchoolSwiper.listOrder != null">
AND list_order = #{driveSchoolSwiper.listOrder}
</if> </if>
<if test="entity.listOrder != null">
AND list_order = #{entity.listOrder}
</if> </if>
</where> </where>
ORDER BY list_order ASC ORDER BY list_order ASC
</select> </select>

View File

@ -80,7 +80,7 @@ public enum RecordTypeEnum {
/** 删除工单 */ /** 删除工单 */
SCGG("scgg", "删除工单"), SCGG("scgg", "删除工单"),
/** 删除工单 */ /** 交车 */
JC("jc", "交车"), JC("jc", "交车"),
/** 内返派工 */ /** 内返派工 */

View File

@ -19,18 +19,14 @@ public enum TicketsStatusEnum {
* 施工中 * 施工中
*/ */
WORKING("05","施工中"), WORKING("05","施工中"),
/**
* 未结账
*/
NO_PAY("01","未结账"),
/** /**
* 待通知客户取车 * 待通知客户取车
*/ */
WAITING_NOTICE("07","待通知客户取车"), WAITING_NOTICE("07","待通知客户取车"),
/** /**
* 已交车 * 未结账
*/ */
OVER("08","已交车"), NO_PAY("01","未结账"),
/** /**
* 挂单/记账 * 挂单/记账
*/ */
@ -39,6 +35,10 @@ public enum TicketsStatusEnum {
* 已结账 * 已结账
*/ */
CHECK_OUT("02","已结账"), CHECK_OUT("02","已结账"),
/**
* 已交车
*/
OVER("08","已交车"),
/** /**
* 已作废 * 已作废
*/ */

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 针对表dl_repair_tickets(维修工单表)的数据库操作Mapper * 针对表dl_repair_tickets(维修工单表)的数据库操作Mapper
* *
@ -43,6 +45,7 @@ public interface DlRepairTicketsMapper extends BaseMapper<DlRepairTickets> {
**/ **/
IPage<DlRepairTickets> getPageTypeAll(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page); IPage<DlRepairTickets> getPageTypeAll(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
/** /**
* 根据条件查询指定工单数量 * 根据条件查询指定工单数量
* @author vinjor-M * @author vinjor-M
@ -51,7 +54,7 @@ public interface DlRepairTicketsMapper extends BaseMapper<DlRepairTickets> {
* @param recordCode 操作记录code * @param recordCode 操作记录code
* @return java.lang.Long * @return java.lang.Long
**/ **/
Long selectCountByParams(@Param("nowDate")String dayDate, @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime); List<String> selectTicketIdByParams(@Param("nowDate")String dayDate, @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime);
} }

View File

@ -173,7 +173,7 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @date 11:30 2024/10/24 * @date 11:30 2024/10/24
* @return java.util.Map<java.lang.String,java.lang.Integer> * @return java.util.Map<java.lang.String,java.lang.Integer>
**/ **/
Map<String,Long> getBossNum(String selectType,String startDate,String endDate); Map<String,Object> getBossNum(String selectType,String startDate,String endDate);
/** /**
* 服务顾问通知客户取车 * 服务顾问通知客户取车

View File

@ -978,6 +978,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
@Override @Override
public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page) { public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page) {
String userRoleCode = getUserRole(); String userRoleCode = getUserRole();
if(null!=repairTicketsReqVO.getIdList() && repairTicketsReqVO.getIdList().size()>0){
//根据id集和查询
DlRepairTicketsReqVO queryObj = new DlRepairTicketsReqVO();
queryObj.setIdList(repairTicketsReqVO.getIdList());
return baseMapper.getPageTypeAll(queryObj, page);
}
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) { if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
//维修管理员看所有数据 //维修管理员看所有数据
} else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) { } else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
@ -1024,7 +1030,57 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
//查待处理 //查待处理
return baseMapper.getPageType(repairTicketsReqVO, page); return baseMapper.getPageType(repairTicketsReqVO, page);
} else { } else {
//查所有 //查所有,
if(("jinchang".equals(repairTicketsReqVO.getTicketsStatus()) ||
"yijungong".equals(repairTicketsReqVO.getTicketsStatus()) ||
"yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())) && StringUtils.isNotEmpty(repairTicketsReqVO.getStartDate())){
//如果是查询进场已竣工已交车三个状态同时选了时间范围的需要单独处理
String startDate = repairTicketsReqVO.getStartDate()+" 00:00:00";
String endDate = repairTicketsReqVO.getEndDate()+" 23:59:59";
List<String> idList = new ArrayList<>();
if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){
//已竣工
idList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.ZJ.getCode(),startDate,endDate);
}else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){
//已交车
idList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.JC.getCode(),startDate,endDate);
}else {
//进厂
repairTicketsReqVO.setStartDate(startDate);
repairTicketsReqVO.setEndDate(endDate);
}
if(null!=idList && !idList.isEmpty()){
repairTicketsReqVO.setIdList(idList);
//时间查询条件置空
repairTicketsReqVO.setStartDate(null);
repairTicketsReqVO.setEndDate(null);
}
}else {
//否则查询时间不生效按维修状态查
List<String> statusList = new ArrayList<>();
if("weixiuzhong".equals(repairTicketsReqVO.getTicketsStatus())){
//维修中
statusList.add(TicketsStatusEnum.WORKING.getCode());
}else if("weijiesuan".equals(repairTicketsReqVO.getTicketsStatus())){
//未结算
statusList = Arrays.asList("04","05","07","01");
}else if("zaichang".equals(repairTicketsReqVO.getTicketsStatus())){
//在厂
statusList = Arrays.asList("04","05","07","01","06","02");
}else if("jinchang".equals(repairTicketsReqVO.getTicketsStatus())){
//进厂
statusList.add(TicketsStatusEnum.NO_WORK.getCode());
}else if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){
//已竣工
statusList.add(TicketsStatusEnum.WAITING_NOTICE.getCode());
}else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){
//已交车
statusList.add(TicketsStatusEnum.OVER.getCode());
}
if(!statusList.isEmpty()){
repairTicketsReqVO.setStatusList(statusList);
}
}
return baseMapper.getPageTypeAll(repairTicketsReqVO, page); return baseMapper.getPageTypeAll(repairTicketsReqVO, page);
} }
} }
@ -1550,54 +1606,86 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
* @date 11:30 2024/10/24 * @date 11:30 2024/10/24
**/ **/
@Override @Override
public Map<String, Long> getBossNum(String selectType,String startDate,String endDate) { public Map<String, Object> getBossNum(String selectType,String startDate,String endDate) {
Map<String, Long> rtnMap = new HashMap<>(); Map<String, Object> rtnMap = new HashMap<>();
//维修中---当前这一时刻 //维修中---当前这一时刻
long workingNum = 0; long workingNum = 0;
List<String> workingIdList = new ArrayList<>();
//在厂数--当前这一时刻 //在厂数--当前这一时刻
long inCompanyNum = 0; long inCompanyNum = 0;
List<String> inCompanyIdList = new ArrayList<>();
//进场数 //进场数
long newOrderNum=0; long newOrderNum=0;
List<String> newOrderIdList = new ArrayList<>();
//已完成 //已完成
long overNum=0; long overNum=0;
List<String> overIdList = new ArrayList<>();
//已交车 //已交车
long giveCusNum=0; long giveCusNum=0;
List<String> giveCusIdList = new ArrayList<>();
//未结算
long noPayNum=0;
List<String> noPayIdList = new ArrayList<>();
List<DlRepairTickets> repairTickets = this.list(); List<DlRepairTickets> repairTickets = this.list();
if (!repairTickets.isEmpty()) { if (!repairTickets.isEmpty()) {
workingNum = repairTickets.stream().filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus())).count(); workingIdList = repairTickets.stream().filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList());
inCompanyNum = repairTickets.stream().filter(item -> TicketsStatusEnum.NO_PAY.getCode().equals(item.getTicketsStatus())).count(); workingNum = workingIdList.size();
//只要没交车都算在厂
List<String> inCompanyCodeList = Arrays.asList("04","05","07","01","06","02");
inCompanyIdList = repairTickets.stream().filter(item -> inCompanyCodeList.contains(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList());
inCompanyNum = inCompanyIdList.size();
//只要没结算都是未结算
List<String> noPayCodeList = Arrays.asList("04","05","07","01");
noPayIdList = repairTickets.stream().filter(item -> noPayCodeList.contains(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList());
noPayNum = noPayIdList.size();
LocalDateTime currentTime = LocalDateTime.now(); LocalDateTime currentTime = LocalDateTime.now();
if("today".equals(selectType)){ if("today".equals(selectType)){
String nowDayStr = DateUtil.formatDate(new Date()); String nowDayStr = DateUtil.formatDate(new Date());
//查当日进厂数已完成已交车 //查当日进厂数已完成已交车
newOrderNum = repairTickets.stream().filter(item -> item.getCreateTime().toLocalDate().equals(currentTime.toLocalDate())).count(); newOrderIdList = repairTickets.stream().filter(item -> item.getCreateTime().toLocalDate().equals(currentTime.toLocalDate())).map(DlRepairTickets::getId).collect(Collectors.toList());
newOrderNum = newOrderIdList.size();
//查当日已完成的总检完成的 //查当日已完成的总检完成的
overNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.ZJ.getCode(),null,null); overIdList = repairTicketsMapper.selectTicketIdByParams(nowDayStr,RecordTypeEnum.ZJ.getCode(),null,null);
//查当日已交车的已结算的 overNum = overIdList.size();
giveCusNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.JS.getCode(),null,null); //查当日已交车的
giveCusIdList = repairTicketsMapper.selectTicketIdByParams(nowDayStr,RecordTypeEnum.JC.getCode(),null,null);
giveCusNum = giveCusIdList.size();
}else if("all".equals(selectType)){ }else if("all".equals(selectType)){
//查累计进厂数已完成已交车 //查累计进厂数已完成已交车
newOrderIdList = repairTickets.stream().map(DlRepairTickets::getId).collect(Collectors.toList());
newOrderNum = repairTickets.size(); newOrderNum = repairTickets.size();
//查累计已完成的总检完成的 //查累计已完成的总检完成的
overNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.ZJ.getCode(),null,null); overIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.ZJ.getCode(),null,null);
overNum = overIdList.size();
//查累计已交车的已结算的 //查累计已交车的已结算的
giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JS.getCode(),null,null); giveCusIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.JC.getCode(),null,null);
giveCusNum = giveCusIdList.size();
}else { }else {
//查某个时间范围内进厂数已完成已交车 //查某个时间范围内进厂数已完成已交车
LocalDateTime startTime = LocalDateTime.parse(startDate+" 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); LocalDateTime startTime = LocalDateTime.parse(startDate+" 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
LocalDateTime endTime = LocalDateTime.parse(endDate+" 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); LocalDateTime endTime = LocalDateTime.parse(endDate+" 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
newOrderNum = repairTickets.stream().filter(item -> item.getCreateTime().isAfter(startTime) && item.getCreateTime().isBefore(endTime)).count(); newOrderIdList = repairTickets.stream().filter(item -> item.getCreateTime().isAfter(startTime) && item.getCreateTime().isBefore(endTime)).map(DlRepairTickets::getId).collect(Collectors.toList());
newOrderNum = newOrderIdList.size();
//查某区间范围内已完成的总检完成的 //查某区间范围内已完成的总检完成的
overNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.ZJ.getCode(), startDate+" 00:00:00", endDate+" 23:59:59"); overIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.ZJ.getCode(), startDate+" 00:00:00", endDate+" 23:59:59");
//查某区间范围内已交车的已结算的 overNum = overIdList.size();
giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JS.getCode(), startDate+" 00:00:00", endDate+" 23:59:59"); //查某区间范围内已交车的
giveCusIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.JC.getCode(), startDate+" 00:00:00", endDate+" 23:59:59");
giveCusNum = giveCusIdList.size();
} }
} }
rtnMap.put("workingNum", workingNum); rtnMap.put("workingNum", workingNum);
rtnMap.put("workingIdList", workingIdList);
rtnMap.put("inCompanyNum", inCompanyNum); rtnMap.put("inCompanyNum", inCompanyNum);
rtnMap.put("inCompanyIdList", inCompanyIdList);
rtnMap.put("newOrderNum", newOrderNum); rtnMap.put("newOrderNum", newOrderNum);
rtnMap.put("newOrderIdList", newOrderIdList);
rtnMap.put("overNum", overNum); rtnMap.put("overNum", overNum);
rtnMap.put("overIdList", overIdList);
rtnMap.put("giveCusNum", giveCusNum); rtnMap.put("giveCusNum", giveCusNum);
rtnMap.put("giveCusIdList", giveCusIdList);
rtnMap.put("noPayNum", noPayNum);
rtnMap.put("noPayIdList", noPayIdList);
return rtnMap; return rtnMap;
} }

View File

@ -42,4 +42,14 @@ public class DlRepairTicketsReqVO extends DlRepairTickets {
/** 客户来源 */ /** 客户来源 */
private String cusFrom; private String cusFrom;
/** 查询开始日期 */
private String startDate;
/** 查询结束日期 */
private String endDate;
/** 工单状态集和 */
private List<String> statusList;
/** 工单id集和 */
private List<String> idList;
} }

View File

@ -369,11 +369,28 @@
) )
</if> </if>
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0"> <if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
and drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]} and (drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]})
</if>
<if test="map.startDate != null and map.startDate != ''">
and (drt.create_time &gt;= #{map.startDate} and drt.create_time &lt;= #{map.endDate})
</if> </if>
<if test="map.repairType !=null and map.repairType !=''"> <if test="map.repairType !=null and map.repairType !=''">
AND (drt.repair_type=#{map.repairType}) AND (drt.repair_type=#{map.repairType})
</if> </if>
<if test="map.statusList !=null and map.statusList.size > 0">
AND (drt.tickets_status IN
<foreach collection="map.statusList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
)
</if>
<if test="map.idList !=null and map.idList.size > 0">
AND (drt.id IN
<foreach collection="map.idList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
)
</if>
<if test="map.cusFrom != null and map.cusFrom!=''"> <if test="map.cusFrom != null and map.cusFrom!=''">
<choose> <choose>
<when test="map.cusFrom == '06'"> <when test="map.cusFrom == '06'">
@ -405,9 +422,10 @@
GROUP BY drt.id GROUP BY drt.id
order by drt.update_time desc order by drt.update_time desc
</select> </select>
<select id="selectCountByParams" resultType="java.lang.Long">
<select id="selectTicketIdByParams" resultType="java.lang.String">
SELECT SELECT
COUNT(DISTINCT drt.id) DISTINCT drt.id
FROM FROM
dl_repair_tickets drt dl_repair_tickets drt
LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id

View File

@ -193,7 +193,6 @@ public class SysLoginController {
return success(loginService.login(authLoginReqVO)); return success(loginService.login(authLoginReqVO));
} }
/** /**
* 汽修小程序登录方法 * 汽修小程序登录方法
* *

View File

@ -117,7 +117,7 @@ public class AuthController {
if (loginBody.getTypes().equals("3") && !roleNames.contains("教练")){ if (loginBody.getTypes().equals("3") && !roleNames.contains("教练")){
return error(new ErrorCode(2_002_000_005, "当前登录用户未分配教练角色")); return error(new ErrorCode(2_002_000_005, "当前登录用户未分配教练角色"));
} }
if (loginBody.getTypes().equals("2") && !roleNames.contains("驾校管理员")){ if (loginBody.getTypes().equals("2") && !roleNames.contains("驾校业务管理员")){
return error(new ErrorCode(2_002_000_005, "当前登录用户未分配驾校管理员角色")); return error(new ErrorCode(2_002_000_005, "当前登录用户未分配驾校管理员角色"));
} }

View File

@ -303,6 +303,9 @@ yudao:
- /app-api/** #小程序端接口,不区分租户 - /app-api/** #小程序端接口,不区分租户
- /repair/tickets/print/** - /repair/tickets/print/**
- /admin-api/repair/tickets/print/** - /admin-api/repair/tickets/print/**
- /admin-api/jx/auth/**
- /admin-api/jx/**
- /admin-api/jx/auth/getAppInfo
ignore-tables: ignore-tables:
- system_tenant - system_tenant
- system_tenant_package - system_tenant_package