Merge branch '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/mapper/InspectionWorkNodeMapper.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 # dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java # yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml
This commit is contained in:
commit
a0675bb828
@ -0,0 +1,99 @@
|
||||
package cn.iocoder.yudao.module.appBase.controller.admin;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
/**`1
|
||||
* @Author: chuxia0811
|
||||
* @Date: 2023/7/9 10:21
|
||||
* @Description :
|
||||
*/
|
||||
@ServerEndpoint(value = "/websocket/inspection/{userId}")
|
||||
@Component
|
||||
public class InspectionSocket {
|
||||
private final static Logger log = LoggerFactory.getLogger(InspectionSocket.class);
|
||||
// 保存链接的session,key为用户名,value为对应的session名
|
||||
public static ConcurrentHashMap<String, Session> sessionMap = new ConcurrentHashMap<>();
|
||||
//关键代码,设置一个静态上下文属性appcontext
|
||||
private static ApplicationContext appcontext;
|
||||
public static void setAppcontext(ApplicationContext appcontext) {
|
||||
InspectionSocket.appcontext = appcontext;
|
||||
}
|
||||
public static ApplicationContext getAppcontext() {
|
||||
return appcontext;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建连接
|
||||
* 用于监听建立连接,当有客户端与该服务端点建立连接时,将会自回调该注解标注的方法
|
||||
* @param session
|
||||
* @param userId
|
||||
*/
|
||||
@OnOpen
|
||||
public void onOpen(Session session, @PathParam(value = "userId") String userId) {
|
||||
this.sessionMap.put(userId,session);
|
||||
log.info("用户{}已创建连接", userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于监听客户端向服务端发送消息,当客户端与服务端发送消息时,将会回调该注解标注的方法
|
||||
* {
|
||||
* Stringitude:124.11,
|
||||
* latitude:125.33,
|
||||
* positionInfo:"山东省济南市市中区八一立交桥"
|
||||
* }
|
||||
* @param msg
|
||||
* @param userId
|
||||
*/
|
||||
@OnMessage
|
||||
public void onMessage(String msg,@PathParam(value = "userId") String userId){
|
||||
System.out.println("消息通知+"+userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于监听连接关闭,当客户端与该服务端点断开连接时,将会回调该注解标注的方法
|
||||
* @param session
|
||||
* @param userId
|
||||
*/
|
||||
@OnClose
|
||||
public void onClose(Session session,@PathParam(value = "userId") String userId){
|
||||
this.sessionMap.remove(userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于监听该连接上的任何错误,当客户端与该服务端点的连接发生任何异常,都将回调该注解标注的方法
|
||||
* 注意该方法的参数必选Throwable,可选Sessiion以及0-n个String参数,且String参数需要使用@PathParam注解标注
|
||||
* @param throwable
|
||||
* @param driverId
|
||||
*/
|
||||
@OnError
|
||||
public void onError(Throwable throwable,@PathParam(value = "driverId") String driverId){
|
||||
log.error("用户{}连接发生异常", driverId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送给指定的用户
|
||||
* @param message
|
||||
*/
|
||||
public void sendMessage(String message, String userId) throws IOException {
|
||||
if (sessionMap.containsKey(userId)){
|
||||
Session session = sessionMap.get(userId);
|
||||
session.getAsyncRemote().sendText(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -39,14 +39,14 @@ public class DlInspectionProjectController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建检测项目")
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:create')")
|
||||
public CommonResult<String> createDlInspectionProject(@Valid @RequestBody DlInspectionProjectSaveReqVO createReqVO) {
|
||||
return success(dlInspectionProjectService.createDlInspectionProject(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新检测项目")
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:update')")
|
||||
public CommonResult<Boolean> updateDlInspectionProject(@Valid @RequestBody DlInspectionProjectSaveReqVO updateReqVO) {
|
||||
dlInspectionProjectService.updateDlInspectionProject(updateReqVO);
|
||||
return success(true);
|
||||
@ -55,7 +55,7 @@ public class DlInspectionProjectController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除检测项目")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:delete')")
|
||||
public CommonResult<Boolean> deleteDlInspectionProject(@RequestParam("id") String id) {
|
||||
dlInspectionProjectService.deleteDlInspectionProject(id);
|
||||
return success(true);
|
||||
@ -64,7 +64,7 @@ public class DlInspectionProjectController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得检测项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:query')")
|
||||
public CommonResult<DlInspectionProjectRespVO> getDlInspectionProject(@RequestParam("id") String id) {
|
||||
DlInspectionProject dlInspectionProject = dlInspectionProjectService.getDlInspectionProject(id);
|
||||
return success(BeanUtils.toBean(dlInspectionProject, DlInspectionProjectRespVO.class));
|
||||
@ -72,7 +72,7 @@ public class DlInspectionProjectController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得检测项目分页")
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:query')")
|
||||
public CommonResult<IPage<DlInspectionProjectRespVO>> getDlInspectionProjectPage(@Valid DlInspectionProjectPageReqVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
|
@ -4,8 +4,12 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionWorkNodeService;
|
||||
import cn.iocoder.yudao.util.ExcelUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -22,22 +26,23 @@ import cn.iocoder.yudao.module.core.controller.BaseController;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin-api/system/info")
|
||||
public class InspectionInfoController extends BaseController
|
||||
{
|
||||
public class InspectionInfoController extends BaseController {
|
||||
@Autowired
|
||||
private IInspectionInfoService inspectionInfoService;
|
||||
|
||||
@Autowired
|
||||
private IInspectionWorkNodeService inspectionWorkNodeService;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:list')")
|
||||
@GetMapping("/list")
|
||||
public CommonResult list(InspectionInfo inspectionInfo,
|
||||
@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<InspectionInfo> page = new Page<>(pageNum, pageSize);
|
||||
IPage<InspectionInfo> list = inspectionInfoService.selectInspectionInfoList(page,inspectionInfo);
|
||||
IPage<InspectionInfo> list = inspectionInfoService.selectInspectionInfoList(page, inspectionInfo);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@ -47,11 +52,10 @@ public class InspectionInfoController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('system:info:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, InspectionInfo inspectionInfo,
|
||||
@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<InspectionInfo> page = new Page<>(pageNum, pageSize);
|
||||
IPage<InspectionInfo> list = inspectionInfoService.selectInspectionInfoList(page,inspectionInfo);
|
||||
IPage<InspectionInfo> list = inspectionInfoService.selectInspectionInfoList(page, inspectionInfo);
|
||||
ExcelUtil<InspectionInfo> util = new ExcelUtil<InspectionInfo>(InspectionInfo.class);
|
||||
util.exportExcel(response, list.getRecords(), "【请填写功能名称】数据");
|
||||
}
|
||||
@ -61,8 +65,7 @@ public class InspectionInfoController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public CommonResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public CommonResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(inspectionInfoService.selectInspectionInfoById(id));
|
||||
}
|
||||
|
||||
@ -79,7 +82,7 @@ public class InspectionInfoController extends BaseController
|
||||
* 清账
|
||||
*/
|
||||
@PostMapping("/settleAccounts")
|
||||
public CommonResult settleAccounts(Long InspectionId){
|
||||
public CommonResult settleAccounts(Long InspectionId) {
|
||||
inspectionInfoService.settleAccounts(InspectionId);
|
||||
return success();
|
||||
}
|
||||
@ -92,10 +95,138 @@ public class InspectionInfoController extends BaseController
|
||||
|
||||
|
||||
@PostMapping("/del")
|
||||
public CommonResult remove(@RequestParam("id") Long id)
|
||||
{
|
||||
public CommonResult remove(@RequestParam("id") Long id) {
|
||||
return toAjax(inspectionInfoService.deleteInspectionInfoByIds(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前登陆人获取可以选择的工单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("geStelectInspection")
|
||||
public CommonResult geStelectInspection(InspectionInfo inspectionInfo,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
|
||||
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
|
||||
return success(inspectionInfoService.geStelectInspection(page, inspectionInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工单详情
|
||||
*
|
||||
* @param inspectionId 工单id
|
||||
* @param workNodeId 节点id (geStelectInspection这个方法中返回了)
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getInspectionInfo")
|
||||
public CommonResult getInspectionInfo(Integer inspectionId, String workNodeId) {
|
||||
return success(inspectionInfoService.getWorkNode(inspectionId, workNodeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工接单
|
||||
*
|
||||
* @param inspectionId 工单id
|
||||
* @param workNodeId 节点id (geStelectInspection这个方法中返回了)
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("orderTaking")
|
||||
public CommonResult orderTaking(Integer inspectionId, String workNodeId) {
|
||||
inspectionWorkNodeService.updateInspectionWorkNode(inspectionId, workNodeId);
|
||||
return success("接单成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目操作(退办理、重审、项目完成)
|
||||
*
|
||||
* @param inspectionWorkNode
|
||||
*/
|
||||
@PostMapping("controls")
|
||||
public CommonResult controls(@RequestBody InspectionWorkNode inspectionWorkNode) {
|
||||
inspectionWorkNodeService.updateImageAndStep(inspectionWorkNode);
|
||||
return success("操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过工单id获取工单流程
|
||||
*
|
||||
* @param inspectionId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getWeorkNodesById")
|
||||
public CommonResult getWeorkNodesById(Integer inspectionId) {
|
||||
return success(inspectionInfoService.getWeorkNodesById(inspectionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否需要上传图片
|
||||
*
|
||||
* @param inspectionId
|
||||
* @param workNodeId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("orImages")
|
||||
public CommonResult orImages(Integer inspectionId, String workNodeId) {
|
||||
return success(inspectionWorkNodeService.orImages(inspectionId, workNodeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询节点提成
|
||||
*
|
||||
* @param inspectionWorkNode
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getRoyaltyList")
|
||||
public CommonResult getRoyaltyList(InspectionWorkNode inspectionWorkNode,
|
||||
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
|
||||
IPage page = new Page(pageNum, pageSize);
|
||||
return success(inspectionWorkNodeService.getRoyaltyList(page, inspectionWorkNode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取提成总金额
|
||||
*
|
||||
* @param inspectionWorkNode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getRoyaltySum")
|
||||
public CommonResult getRoyaltySum(InspectionWorkNode inspectionWorkNode) {
|
||||
return success(inspectionWorkNodeService.getRoyaltySum(inspectionWorkNode));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* app分页查询节点提成
|
||||
*
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getRoyaltyListApp")
|
||||
public CommonResult getRoyaltyListApp(InspectionWorkNode inspectionWorkNode,
|
||||
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
|
||||
//获取当前登陆人
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
inspectionWorkNode.setDealUserId(loginUser.getId());
|
||||
IPage page = new Page(pageNum, pageSize);
|
||||
return success(inspectionWorkNodeService.getRoyaltyList(page, inspectionWorkNode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取提成总金额app
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getRoyaltySumApp")
|
||||
public CommonResult getRoyaltySumApp(InspectionWorkNode inspectionWorkNode) {
|
||||
//获取当前登陆人
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
inspectionWorkNode.setDealUserId(loginUser.getId());
|
||||
return success(inspectionWorkNodeService.getRoyaltySum(inspectionWorkNode));
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ public class ShopInspectionGoodsController extends BaseController
|
||||
*/
|
||||
@GetMapping("/partnerGoodsListCol")
|
||||
public CommonResult partnerGoodsListCol() throws Exception {
|
||||
ShopMallPartners partners = appInspectionPartnerService.shopInfo();
|
||||
ShopMallPartners partners = appInspectionPartnerService.shopInfoByUserId();
|
||||
return success(shopInspectionGoodsService.partnerGoodsListCol(partners.getPartnerId()));
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,13 @@ package cn.iocoder.yudao.module.inspection.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检测项目
|
||||
*
|
||||
@ -38,4 +41,6 @@ public class DlInspectionProject extends TenantBaseDO {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ProjectRoyalty> projectRoyaltyList;
|
||||
}
|
@ -148,6 +148,13 @@ public class InspectionInfo extends TenantBaseDO
|
||||
private Integer nowOrderNum;
|
||||
|
||||
/** 开始检测时需要 传入 选择项目的id、角色id、排序 */
|
||||
@TableField(exist = false)
|
||||
private List<InspectionWorkNode> inspectionWorkNodes;
|
||||
/** 流程节点id*/
|
||||
@TableField(exist = false)
|
||||
private String workNodeId;
|
||||
@TableField(exist = false)
|
||||
private Long dealUserId;
|
||||
@TableField(exist = false)
|
||||
private String workNodeStatus;
|
||||
}
|
||||
|
@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.inspection.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@ -30,7 +32,7 @@ public class InspectionStepInfo extends Model<InspectionStepInfo> {
|
||||
//步骤号
|
||||
private Integer stepNum;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
//创建人id
|
||||
private Integer creator;
|
||||
@ -38,5 +40,7 @@ public class InspectionStepInfo extends Model<InspectionStepInfo> {
|
||||
private Date updateTime;
|
||||
//更新人id
|
||||
private Integer updater;
|
||||
@TableField(exist = false)
|
||||
private String nickname;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.inspection.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
@ -75,7 +76,26 @@ public class InspectionWorkNode extends TenantBaseDO {
|
||||
/**
|
||||
* 处理人员工表id
|
||||
*/
|
||||
private Integer dealUserId;
|
||||
private Long dealUserId;
|
||||
|
||||
/**
|
||||
* 状态(0-待开始 1-进行中 2-已完成)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
/**
|
||||
* 1-退办理 2-选择重审 3-项目完成
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer selectType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String projectName;
|
||||
@TableField(exist = false)
|
||||
private String rescueStartMonth;
|
||||
@TableField(exist = false)
|
||||
private String rescueStart;
|
||||
@TableField(exist = false)
|
||||
private String rescueEnd;
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.inspection.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 检测项目子表(项目提成) DO
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@TableName("inspection_project_royalty")
|
||||
@KeySequence("inspection_project_royalty_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProjectRoyalty extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 检测项目主键
|
||||
*/
|
||||
private String projectId;
|
||||
/**
|
||||
* 商品主键
|
||||
*/
|
||||
private Long goodsId;
|
||||
/**
|
||||
* 提成金额 单位:分
|
||||
*/
|
||||
private Long royaltyAmount;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String title;
|
||||
|
||||
}
|
@ -87,4 +87,10 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
|
||||
, @Param("roleId") Long roleId, @Param("endTime")String endTime);
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前用户符合条件的工单
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
IPage<InspectionInfo> selectByUser(@Param("page") IPage page, @Param("roleIds") List<Long> roleIds,@Param("inspectionInfo") InspectionInfo inspectionInfo);
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionStepInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (InspectionStepInfo)表数据库访问层
|
||||
*
|
||||
@ -13,5 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface InspectionStepInfoMapper extends BaseMapper<InspectionStepInfo> {
|
||||
|
||||
List<InspectionStepInfo> listByInspectionInfoId(Long inspectionInfoId);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,12 @@ package cn.iocoder.yudao.module.inspection.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -15,4 +20,13 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode> {
|
||||
|
||||
/**
|
||||
* 根据检测id获取检测流程
|
||||
* @param inspectionId
|
||||
* @return
|
||||
*/
|
||||
List<InspectionWorkNode> getWeorkNodesById(Integer inspectionId);
|
||||
|
||||
IPage<Map> getRoyaltyList(@Param("page")IPage page,@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode);
|
||||
Map getRoyaltySum(@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode);
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.inspection.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty;
|
||||
import cn.iocoder.yudao.module.inspection.vo.ProjectRoyaltyPageReqVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 检测项目子表(项目提成) Mapper
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProjectRoyaltyMapper extends BaseMapper<ProjectRoyalty> {
|
||||
|
||||
void insertBatch(@Param("createReq") List<ProjectRoyalty> createReq);
|
||||
|
||||
void deleteByProjectId(String projectId);
|
||||
|
||||
List<ProjectRoyalty> selectListByProjrctId(@Param("projectId")String projectId,@Param("parentId") String parentId);
|
||||
|
||||
void updtaBatch(@Param("list") List<ProjectRoyalty> createReq);
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.inspection.service;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionWorkNodeVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -75,4 +77,23 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
|
||||
|
||||
Map<String,Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
|
||||
|
||||
/**
|
||||
* 根据当前登陆人获取可以选择的工单
|
||||
* @return
|
||||
*/
|
||||
IPage<InspectionInfo> geStelectInspection(IPage page,InspectionInfo inspectionInfo);
|
||||
|
||||
/**
|
||||
* 获取工单详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
DlInspectionWorkNodeVo getWorkNode(Integer inspectionId, String workNodeId);
|
||||
|
||||
/**
|
||||
* 根据工单id获取工单流程
|
||||
* @param inspectionId
|
||||
* @return
|
||||
*/
|
||||
List<InspectionWorkNode> getWeorkNodesById(Integer inspectionId);
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
package cn.iocoder.yudao.module.inspection.service;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 检测流程表 服务类
|
||||
@ -12,5 +16,35 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @since 2024-10-31
|
||||
*/
|
||||
public interface IInspectionWorkNodeService extends IService<InspectionWorkNode> {
|
||||
/**
|
||||
* 员工接单
|
||||
* @param inspectionId
|
||||
* @param workNodeId
|
||||
*/
|
||||
void updateInspectionWorkNode(Integer inspectionId, String workNodeId);
|
||||
|
||||
/**
|
||||
* 更新流程图片 步骤信息
|
||||
* @param inspectionWorkNode
|
||||
*/
|
||||
void updateImageAndStep(InspectionWorkNode inspectionWorkNode);
|
||||
|
||||
/**
|
||||
* 根据检测id获取流程信息
|
||||
* @param inspectionId
|
||||
* @return
|
||||
*/
|
||||
List<InspectionWorkNode> getWeorkNodesById(Integer inspectionId);
|
||||
|
||||
boolean orImages(Integer inspectionId, String workNodeId);
|
||||
|
||||
/**
|
||||
* 分页查询提成
|
||||
* @param page
|
||||
* @param inspectionWorkNode
|
||||
* @return
|
||||
*/
|
||||
IPage<Map> getRoyaltyList(IPage page, InspectionWorkNode inspectionWorkNode);
|
||||
|
||||
Map getRoyaltySum(InspectionWorkNode inspectionWorkNode);
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.inspection.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionStepInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (InspectionStepInfo)表服务接口
|
||||
*
|
||||
@ -11,5 +13,6 @@ import cn.iocoder.yudao.module.inspection.entity.InspectionStepInfo;
|
||||
*/
|
||||
public interface InspectionStepInfoService extends IService<InspectionStepInfo> {
|
||||
|
||||
List<InspectionStepInfo> listByInspectionInfoId(Long inspectionInfoId);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.inspection.service;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty;
|
||||
import cn.iocoder.yudao.module.inspection.vo.ProjectRoyaltyPageReqVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.ProjectRoyaltySaveReqVO;
|
||||
|
||||
/**
|
||||
* 检测项目子表(项目提成) Service 接口
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
public interface ProjectRoyaltyService {
|
||||
|
||||
/**
|
||||
* 创建检测项目子表(项目提成)
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createProjectRoyalty(@Valid ProjectRoyaltySaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 批量创建检测项目子表(项目提成)
|
||||
*
|
||||
* @param createReq 创建信息
|
||||
*/
|
||||
void batchInsertProjectRoyalty(@Valid List<ProjectRoyalty> createReq);
|
||||
|
||||
/**
|
||||
* 根据项目id删除检测项目子表(项目提成)
|
||||
* @param projectId
|
||||
*/
|
||||
void deleteInsertProjectRoyalty(String projectId);
|
||||
|
||||
/**
|
||||
* 根据项目id查询检测项目子表(项目提成)
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
List<ProjectRoyalty> getProjectRoyaltyList(String projectId);
|
||||
|
||||
/**
|
||||
* 批量更新检测项目子表(项目提成)
|
||||
* @param createReq
|
||||
*/
|
||||
void updtaBatch(List<ProjectRoyalty> createReq);
|
||||
|
||||
// /**
|
||||
// * 更新检测项目子表(项目提成)
|
||||
// *
|
||||
// * @param updateReqVO 更新信息
|
||||
// */
|
||||
// void updateProjectRoyalty(@Valid ProjectRoyaltySaveReqVO updateReqVO);
|
||||
//
|
||||
// /**
|
||||
// * 删除检测项目子表(项目提成)
|
||||
// *
|
||||
// * @param id 编号
|
||||
// */
|
||||
// void deleteProjectRoyalty(Long id);
|
||||
//
|
||||
// /**
|
||||
// * 获得检测项目子表(项目提成)
|
||||
// *
|
||||
// * @param id 编号
|
||||
// * @return 检测项目子表(项目提成)
|
||||
// */
|
||||
// ProjectRoyalty getProjectRoyalty(Long id);
|
||||
//
|
||||
// /**
|
||||
// * 获得检测项目子表(项目提成)分页
|
||||
// *
|
||||
// * @param pageReqVO 分页查询
|
||||
// * @return 检测项目子表(项目提成)分页
|
||||
// */
|
||||
// PageResult<ProjectRoyalty> getProjectRoyaltyPage(ProjectRoyaltyPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -117,6 +117,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
private PermissionService permissionService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private IInspectionWorkNodeService inspectionWorkNodeService;
|
||||
|
||||
@Override
|
||||
public IPage<PartnerListVo> partnerList(Page<PartnerListVo> page, PartnerListQuery partnerListQuery) {
|
||||
@ -195,11 +197,9 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
*/
|
||||
@Override
|
||||
public ShopMallPartners shopInfoByUserId() throws Exception {
|
||||
LoginUser user = SecurityFrameworkUtils.getLoginUser();
|
||||
ShopMallPartners partner = new ShopMallPartners();
|
||||
LambdaQueryWrapper<ShopMallPartners> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ShopMallPartners::getUserId, user.getId());
|
||||
partner = this.getOne(queryWrapper);
|
||||
queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).last("limit 1");
|
||||
ShopMallPartners partner = this.getOne(queryWrapper);
|
||||
if (ObjectUtil.isEmpty(partner)){
|
||||
throw new Exception("未查询到信息");
|
||||
}
|
||||
@ -1452,14 +1452,15 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
InspectionInfo info = inspectionInfoService.getById(inspectionInfoId);
|
||||
OrderInfo order = orderService.getById(info.getInspectionOrderId());
|
||||
AdminUserDO buyUser = userService.getUser(info.getUserId());
|
||||
PartnerWorker temp = partnerWorkerService.getById(info.getWorkId());
|
||||
AdminUserDO worker = userService.getUser(temp.getUserId());
|
||||
AdminUserDO worker = userService.getUser(info.getWorkId());
|
||||
InspectionInfoVo res =new InspectionInfoVo();
|
||||
BeanUtils.copyProperties(order,res);
|
||||
res.setInspectionId(info.getId());
|
||||
res.setWorkerAvatar(Optional.ofNullable(worker.getAvatar()).orElse(null));
|
||||
res.setWorkerName(Optional.ofNullable(worker.getNickname()).orElse(null));
|
||||
res.setWorkerPhone(worker.getMobile());
|
||||
if (ObjectUtil.isNotNull(worker)) {
|
||||
res.setWorkerAvatar(Optional.ofNullable(worker.getAvatar()).orElse(null));
|
||||
res.setWorkerName(Optional.ofNullable(worker.getNickname()).orElse(null));
|
||||
res.setWorkerPhone(worker.getMobile());
|
||||
}
|
||||
res.setBuyUserName(Optional.ofNullable(buyUser.getNickname()).orElse(""));
|
||||
res.setBuyUserPhone(buyUser.getMobile());
|
||||
res.setCarNum(info.getCarNum());
|
||||
@ -1480,7 +1481,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
res.setGoodsImage(goods.getImage());
|
||||
LambdaQueryWrapper<InspectionStepInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(InspectionStepInfo::getInspectionInfoId,inspectionInfoId).orderByAsc(InspectionStepInfo::getStepNum);
|
||||
List<InspectionStepInfo> list = stepInfoService.list(queryWrapper);
|
||||
queryWrapper.orderBy(true, false, InspectionStepInfo::getId);
|
||||
List<InspectionStepInfo> list = stepInfoService.listByInspectionInfoId(inspectionInfoId);
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
res.setStepInfos(list);
|
||||
}
|
||||
@ -1732,7 +1734,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
AdminUserDO buyUser = userService.getUser(inspectionInfo.getUserId());
|
||||
PartnerWorker worker = partnerWorkerService.getById(inspectionInfo.getWorkId());
|
||||
ShopMallPartners partner = this.getById(orderInfo.getPartnerId());
|
||||
AdminUserDO workerUser = userService.getUser(worker.getUserId());
|
||||
AdminUserDO workerUser = userService.getUser(inspectionInfo.getWorkId());
|
||||
String inspection_work_order = configService.selectConfigByKey("inspection_work_order");
|
||||
String payType = "未知";
|
||||
if (StringUtils.isNotEmpty(orderInfo.getPayType())){
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cn.iocoder.yudao.module.inspection.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty;
|
||||
import cn.iocoder.yudao.module.inspection.mapper.DlInspectionProjectMapper;
|
||||
import cn.iocoder.yudao.module.inspection.mapper.ProjectRoyaltyMapper;
|
||||
import cn.iocoder.yudao.module.inspection.service.DlInspectionProjectService;
|
||||
import cn.iocoder.yudao.module.inspection.service.ProjectRoyaltyService;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectRespVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectSaveReqVO;
|
||||
@ -12,9 +16,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.github.yulichang.method.SqlMethod.collect;
|
||||
|
||||
|
||||
/**
|
||||
@ -29,7 +38,11 @@ public class DlInspectionProjectServiceImpl extends ServiceImpl<DlInspectionProj
|
||||
@Resource
|
||||
private DlInspectionProjectMapper dlInspectionProjectMapper;
|
||||
|
||||
@Resource
|
||||
private ProjectRoyaltyService projectRoyaltyService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createDlInspectionProject(DlInspectionProjectSaveReqVO createReqVO) {
|
||||
//查询项目名称是否存在
|
||||
DlInspectionProject dlInspectionProject1 = baseMapper.selectOne(new LambdaQueryWrapper<DlInspectionProject>()
|
||||
@ -41,29 +54,49 @@ public class DlInspectionProjectServiceImpl extends ServiceImpl<DlInspectionProj
|
||||
DlInspectionProject dlInspectionProject = BeanUtils.toBean(createReqVO, DlInspectionProject.class);
|
||||
dlInspectionProject.setDeleted(false);
|
||||
dlInspectionProjectMapper.insert(dlInspectionProject);
|
||||
|
||||
//插入项目子表
|
||||
List<ProjectRoyalty> projectRoyaltyList = createReqVO.getProjectRoyaltyList();
|
||||
//设置项目id
|
||||
List<ProjectRoyalty> collect = projectRoyaltyList.stream().map(item -> item.setProjectId(dlInspectionProject.getId())).collect(Collectors.toList());
|
||||
projectRoyaltyService.batchInsertProjectRoyalty(collect);
|
||||
// 返回
|
||||
return dlInspectionProject.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDlInspectionProject(DlInspectionProjectSaveReqVO updateReqVO) {
|
||||
|
||||
// 更新
|
||||
DlInspectionProject updateObj = BeanUtils.toBean(updateReqVO, DlInspectionProject.class);
|
||||
dlInspectionProjectMapper.updateById(updateObj);
|
||||
|
||||
//删除项目子表
|
||||
projectRoyaltyService.deleteInsertProjectRoyalty(updateReqVO.getId());
|
||||
//插入项目子表
|
||||
List<ProjectRoyalty> projectRoyaltyList = updateReqVO.getProjectRoyaltyList();
|
||||
//设置项目id
|
||||
List<ProjectRoyalty> collect = projectRoyaltyList.stream().map(item -> item.setProjectId(updateReqVO.getId())).collect(Collectors.toList());
|
||||
projectRoyaltyService.batchInsertProjectRoyalty(collect);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDlInspectionProject(String id) {
|
||||
// 删除
|
||||
dlInspectionProjectMapper.deleteById(id);
|
||||
//删除项目子表
|
||||
projectRoyaltyService.deleteInsertProjectRoyalty(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DlInspectionProject getDlInspectionProject(String id) {
|
||||
return dlInspectionProjectMapper.selectById(id);
|
||||
DlInspectionProject dlInspectionProject = dlInspectionProjectMapper.selectById(id);
|
||||
List<ProjectRoyalty> projectRoyaltyList = projectRoyaltyService.getProjectRoyaltyList(id);
|
||||
dlInspectionProject.setProjectRoyaltyList(projectRoyaltyList);
|
||||
return dlInspectionProject;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,22 +2,32 @@ package cn.iocoder.yudao.module.inspection.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.appBase.controller.admin.InspectionSocket;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionWorkNodeVo;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
|
||||
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
|
||||
import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
|
||||
import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService;
|
||||
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.util.SendSmsUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -49,8 +59,7 @@ import javax.annotation.Resource;
|
||||
* @date 2023-08-13
|
||||
*/
|
||||
@Service
|
||||
public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,InspectionInfo> implements IInspectionInfoService
|
||||
{
|
||||
public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper, InspectionInfo> implements IInspectionInfoService {
|
||||
@Autowired
|
||||
private AdminUserService userService;
|
||||
@Autowired
|
||||
@ -72,8 +81,17 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
private IDelOrderInfoService delInspectionOrderService;
|
||||
@Autowired
|
||||
private IDelInspectionInfoService delInspectionInfoService;
|
||||
@Autowired
|
||||
private IInspectionWorkNodeService workNodeService;
|
||||
@Autowired
|
||||
private InspectionStepInfoService inspectionStepInfoService;
|
||||
@Resource
|
||||
private CustomerMainService customerMainService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private InspectionSocket inspectionSocket;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
@ -81,8 +99,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public InspectionInfo selectInspectionInfoById(Long id)
|
||||
{
|
||||
public InspectionInfo selectInspectionInfoById(Long id) {
|
||||
return baseMapper.selectInspectionInfoById(id);
|
||||
}
|
||||
|
||||
@ -93,9 +110,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public IPage<InspectionInfo> selectInspectionInfoList(Page<InspectionInfo> page, InspectionInfo inspectionInfo)
|
||||
{
|
||||
return baseMapper.selectInspectionInfoList(page,inspectionInfo);
|
||||
public IPage<InspectionInfo> selectInspectionInfoList(Page<InspectionInfo> page, InspectionInfo inspectionInfo) {
|
||||
return baseMapper.selectInspectionInfoList(page, inspectionInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,20 +124,17 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertInspectionInfo(InspectionInfo inspectionInfo) throws Exception {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
ShopMallPartners partners = appInspectionPartnerService.shopInfo();
|
||||
LambdaQueryWrapper<PartnerWorker> workerQueryWrapper =new LambdaQueryWrapper<>();
|
||||
workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId());
|
||||
PartnerWorker worker = workerService.getOne(workerQueryWrapper);
|
||||
if (ObjectUtils.isNotEmpty(worker)){
|
||||
inspectionInfo.setWorkId(worker.getId());
|
||||
}else {
|
||||
throw new Exception("请先将接待员加入员工");
|
||||
ShopMallPartners partners = appInspectionPartnerService.shopInfoByUserId();
|
||||
|
||||
if (ObjectUtils.isEmpty(inspectionInfo.getInspectionWorkNodes())) {
|
||||
throw new RuntimeException("请选择检测项目");
|
||||
}
|
||||
AdminUserDO workerUser =userService.getUser(worker.getUserId());
|
||||
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户";
|
||||
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"无";
|
||||
//当前登陆人 就是检测人
|
||||
AdminUserDO workerUser = userService.getUser(loginUser.getId());
|
||||
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户";
|
||||
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "无";
|
||||
AdminUserDO user = userService.getUserByMobile(buyPhone);
|
||||
if (ObjectUtils.isEmpty(user)){
|
||||
if (ObjectUtils.isEmpty(user)) {
|
||||
//新增用户
|
||||
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
||||
userSaveReqVO.setNickname(buyName);
|
||||
@ -135,13 +148,13 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
user.setNickname(buyName);
|
||||
user.setUsername(buyPhone);
|
||||
user.setMobile(buyPhone);
|
||||
}else {
|
||||
} else {
|
||||
inspectionInfo.setUserId(user.getId());
|
||||
}
|
||||
InspectionGoodsSku sku = skuService.getById(inspectionInfo.getSkuId());
|
||||
ShopInspectionGoods goods = goodsService.getById(sku.getGoodsId());
|
||||
ShopMallPartners partner = appInspectionPartnerService.getById(goods.getPartnerId());
|
||||
OrderInfo orderInfo =new OrderInfo();
|
||||
OrderInfo orderInfo = new OrderInfo();
|
||||
orderInfo.setPartnerId(partners.getPartnerId());
|
||||
orderInfo.setGoodsId(Long.parseLong(goods.getId().toString()));
|
||||
orderInfo.setGoodsTitle(goods.getTitle());
|
||||
@ -158,7 +171,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
orderInfo.setIsOnline("0");
|
||||
orderInfo.setPhonenumber(user.getMobile());
|
||||
orderInfo.setPartnerName(partner.getPartnerName());
|
||||
orderInfo.setOrderNo("线下订单-"+System.currentTimeMillis());
|
||||
orderInfo.setOrderNo("线下订单-" + System.currentTimeMillis());
|
||||
//赊账的情况
|
||||
orderInfo.setOrderStatus("0");
|
||||
orderInfoService.save(orderInfo);
|
||||
@ -169,9 +182,10 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
inspectionInfo.setStartTime(new Date());
|
||||
inspectionInfo.setCategoryId(goods.getGoodsCategoryId());
|
||||
inspectionInfo.setStatus("0");
|
||||
inspectionInfo.setYear(DateUtil.format(inspectionInfo.getStartTime(),"yyyy"));
|
||||
inspectionInfo.setMonth(DateUtil.format(inspectionInfo.getStartTime(),"yyyy-MM"));
|
||||
inspectionInfo.setDay(DateUtil.format(inspectionInfo.getStartTime(),"yyyy-MM-dd"));
|
||||
inspectionInfo.setWorkId(workerUser.getId());
|
||||
inspectionInfo.setYear(DateUtil.format(inspectionInfo.getStartTime(), "yyyy"));
|
||||
inspectionInfo.setMonth(DateUtil.format(inspectionInfo.getStartTime(), "yyyy-MM"));
|
||||
inspectionInfo.setDay(DateUtil.format(inspectionInfo.getStartTime(), "yyyy-MM-dd"));
|
||||
try {
|
||||
//开始检测短信发送
|
||||
// 获取当前日期和时间
|
||||
@ -182,18 +196,18 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
|
||||
// 将当前时间转换为指定格式
|
||||
String formattedTime = currentTime.format(formatter);
|
||||
if (PhoneValidator.isValid(orderInfo.getPhonenumber())){
|
||||
SendSmsUtil.sendMsgCommon(new String[]{formattedTime},orderInfo.getPhonenumber(),"1400852709","机动车管家小程序","1961713");
|
||||
if (PhoneValidator.isValid(orderInfo.getPhonenumber())) {
|
||||
SendSmsUtil.sendMsgCommon(new String[]{formattedTime}, orderInfo.getPhonenumber(), "1400852709", "机动车管家小程序", "1961713");
|
||||
}
|
||||
}catch (Exception ignored){
|
||||
} catch (Exception ignored) {
|
||||
log.error(ignored.getMessage());
|
||||
}
|
||||
//增加客户信息
|
||||
LambdaQueryWrapper<PartnerCustomerInfo> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PartnerCustomerInfo::getPartnerId,inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId,orderInfo.getUserId());
|
||||
LambdaQueryWrapper<PartnerCustomerInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PartnerCustomerInfo::getPartnerId, inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId, orderInfo.getUserId());
|
||||
PartnerCustomerInfo customerInfo = customerInfoService.getOne(queryWrapper);
|
||||
if (ObjectUtil.isEmpty(customerInfo)){
|
||||
customerInfo =new PartnerCustomerInfo();
|
||||
if (ObjectUtil.isEmpty(customerInfo)) {
|
||||
customerInfo = new PartnerCustomerInfo();
|
||||
customerInfo.setPartnerId(inspectionInfo.getPartnerId());
|
||||
customerInfo.setUserId(user.getId());
|
||||
customerInfo.setCustomerPhone(user.getMobile());
|
||||
@ -201,19 +215,48 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
customerInfo.setSex("0");
|
||||
customerInfo.setUserAge(user.getUserAge());
|
||||
// 设置客户来源
|
||||
CustomerMain customerMain = new CustomerMain();
|
||||
customerMain.setDataFrom("01");
|
||||
customerMainService.saveOrUpdate(customerMain);
|
||||
try {
|
||||
customerInfoService.insertPartnerCustomerInfo(customerInfo);
|
||||
}catch (Exception ignored){
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//追加订单明细记录
|
||||
orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(),"线下订单创建",new Date(),0L,"1"));
|
||||
return baseMapper.insert(inspectionInfo);
|
||||
orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(), "线下订单创建", new Date(), 0L, "1"));
|
||||
//默认当前流程的顺序为1
|
||||
inspectionInfo.setNowOrderNum(1);
|
||||
//添加检测工单
|
||||
baseMapper.insert(inspectionInfo);
|
||||
//补充检测流程
|
||||
List<InspectionWorkNode> inspectionWorkNodes = inspectionInfo.getInspectionWorkNodes();
|
||||
//将检测工单流程补充检测工单id
|
||||
inspectionWorkNodes.stream().forEach(inspectionWorkNode -> {
|
||||
//检测工单id
|
||||
inspectionWorkNode.setInspectionInfoId(inspectionInfo.getId());
|
||||
//将节点状态设置为未开始
|
||||
inspectionWorkNode.setStatus("0");
|
||||
});
|
||||
|
||||
workNodeService.saveBatch(inspectionWorkNodes);
|
||||
//获取第一个节点的角色
|
||||
Integer roleId = inspectionWorkNodes.get(0).getRoleId();
|
||||
//根据角色id获取所有用户
|
||||
List<UserDTO> listByUserId = roleService.getListByUserId(roleId);
|
||||
if (CollUtil.isNotEmpty(listByUserId)) {
|
||||
for (UserDTO userDTO : listByUserId) {
|
||||
inspectionSocket.sendMessage("接工单", userDTO.getId().toString());
|
||||
}
|
||||
}
|
||||
|
||||
//检测步骤表插入检测开始
|
||||
InspectionStepInfo stepInfo = new InspectionStepInfo();
|
||||
stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(inspectionInfo.getId())));
|
||||
stepInfo.setTitle("检测开始");
|
||||
stepInfo.setCreateTime(new Date());
|
||||
stepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||
boolean save = inspectionStepInfoService.save(stepInfo);
|
||||
return save ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -243,19 +286,19 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
public int updateInspectionInfo(InspectionInfo inspectionInfo) throws Exception {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
ShopMallPartners partners = appInspectionPartnerService.shopInfo();
|
||||
LambdaQueryWrapper<PartnerWorker> workerQueryWrapper =new LambdaQueryWrapper<>();
|
||||
workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId());
|
||||
LambdaQueryWrapper<PartnerWorker> workerQueryWrapper = new LambdaQueryWrapper<>();
|
||||
workerQueryWrapper.eq(PartnerWorker::getUserId, loginUser.getId()).eq(PartnerWorker::getPartnerId, partners.getPartnerId());
|
||||
PartnerWorker worker = workerService.getOne(workerQueryWrapper);
|
||||
AdminUserDO workerUser =userService.getUser(worker.getUserId());
|
||||
if (ObjectUtils.isNotEmpty(worker)){
|
||||
inspectionInfo.setWorkId(worker.getId());
|
||||
}else {
|
||||
throw new Exception("请先将接待员加入员工");
|
||||
}
|
||||
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户";
|
||||
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"无";
|
||||
AdminUserDO workerUser = userService.getUser(loginUser.getId());
|
||||
// if (ObjectUtils.isNotEmpty(worker)) {
|
||||
inspectionInfo.setWorkId(workerUser.getId());
|
||||
// } else {
|
||||
// throw new Exception("请先将接待员加入员工");
|
||||
// }
|
||||
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户";
|
||||
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "无";
|
||||
AdminUserDO user = userService.getUserByMobile(buyPhone);
|
||||
if (ObjectUtils.isEmpty(user)){
|
||||
if (ObjectUtils.isEmpty(user)) {
|
||||
//新增用户
|
||||
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
||||
userSaveReqVO.setNickname(buyName);
|
||||
@ -264,7 +307,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
userSaveReqVO.setPassword("123456");
|
||||
Long uid = userService.createUser(userSaveReqVO);
|
||||
inspectionInfo.setUserId(uid);
|
||||
}else {
|
||||
} else {
|
||||
inspectionInfo.setUserId(user.getId());
|
||||
}
|
||||
InspectionGoodsSku sku = skuService.getById(inspectionInfo.getSkuId());
|
||||
@ -284,17 +327,16 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteInspectionInfoByIds(Long id)
|
||||
{
|
||||
public int deleteInspectionInfoByIds(Long id) {
|
||||
InspectionInfo info = this.getById(id);
|
||||
baseMapper.deleteInspectionInfoById(id);
|
||||
OrderInfo orderInfo = orderInfoService.getById(info.getInspectionOrderId());
|
||||
orderInfoService.removeById(info.getInspectionOrderId());
|
||||
//往回收站插入
|
||||
DelInspectionInfo delInspectionInfo =new DelInspectionInfo();
|
||||
DelOrderInfo delInspectionOrder =new DelOrderInfo();
|
||||
BeanUtils.copyProperties(info,delInspectionInfo);
|
||||
BeanUtils.copyProperties(orderInfo,delInspectionOrder);
|
||||
DelInspectionInfo delInspectionInfo = new DelInspectionInfo();
|
||||
DelOrderInfo delInspectionOrder = new DelOrderInfo();
|
||||
BeanUtils.copyProperties(info, delInspectionInfo);
|
||||
BeanUtils.copyProperties(orderInfo, delInspectionOrder);
|
||||
delInspectionInfoService.insertDelInspectionInfo(delInspectionInfo);
|
||||
delInspectionOrderService.insertDelOrderInfo(delInspectionOrder);
|
||||
return 1;
|
||||
@ -307,32 +349,86 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteInspectionInfoById(Long id)
|
||||
{
|
||||
public int deleteInspectionInfoById(Long id) {
|
||||
return baseMapper.deleteInspectionInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InspectionInfo> workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime){
|
||||
return baseMapper.workOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
|
||||
public List<InspectionInfo> workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
|
||||
return baseMapper.workOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
return baseMapper.pageWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InspectionInfo> delworkOrder(Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime){
|
||||
return baseMapper.delworkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
|
||||
public List<InspectionInfo> delworkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
|
||||
return baseMapper.delworkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<InspectionInfo> pageDelWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page<InspectionInfo> page) {
|
||||
return baseMapper.pageDelWorkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime,page);
|
||||
return baseMapper.pageDelWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
|
||||
return baseMapper.workOrderData(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
|
||||
return baseMapper.workOrderData(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前登陆人获取可以选择的工单
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<InspectionInfo> geStelectInspection(IPage page, InspectionInfo inspectionInfo) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
//获取当前登陆人的角色
|
||||
List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
|
||||
List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
|
||||
if (!"1".equals(inspectionInfo.getStatus())) {
|
||||
//进行中 已完成
|
||||
inspectionInfo.setDealUserId(loginUser.getId());
|
||||
}
|
||||
return baseMapper.selectByUser(page, roleIds, inspectionInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工单详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public DlInspectionWorkNodeVo getWorkNode(Integer inspectionId, String workNodeId) {
|
||||
//查询工单
|
||||
InspectionInfo inspectionInfo = this.getById(inspectionId);
|
||||
//根据工单id查询流程节点
|
||||
InspectionWorkNode inspectionWorkNode = workNodeService.getById(workNodeId);
|
||||
//根据工单id查询步骤
|
||||
List<InspectionStepInfo> inspectionStepInfos = inspectionStepInfoService.list(new LambdaQueryWrapper<InspectionStepInfo>()
|
||||
.eq(InspectionStepInfo::getInspectionInfoId, inspectionId));
|
||||
|
||||
DlInspectionWorkNodeVo dlInspectionWorkNodeVo = new DlInspectionWorkNodeVo();
|
||||
dlInspectionWorkNodeVo.setInspectionInfo(inspectionInfo);
|
||||
dlInspectionWorkNodeVo.setNode(inspectionWorkNode);
|
||||
dlInspectionWorkNodeVo.setSteps(inspectionStepInfos);
|
||||
return dlInspectionWorkNodeVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工单id获取工单流程
|
||||
*
|
||||
* @param inspectionId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<InspectionWorkNode> getWeorkNodesById(Integer inspectionId) {
|
||||
return workNodeService.getWeorkNodesById(inspectionId);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.inspection.mapper.InspectionStepInfoMapper;
|
||||
import cn.iocoder.yudao.module.inspection.service.InspectionStepInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (InspectionStepInfo)表服务实现类
|
||||
*
|
||||
@ -15,5 +17,9 @@ import org.springframework.stereotype.Service;
|
||||
@Service("inspectionStepInfoService")
|
||||
public class InspectionStepInfoServiceImpl extends ServiceImpl<InspectionStepInfoMapper, InspectionStepInfo> implements InspectionStepInfoService {
|
||||
|
||||
@Override
|
||||
public List<InspectionStepInfo> listByInspectionInfoId(Long inspectionInfoId) {
|
||||
return baseMapper.listByInspectionInfoId(inspectionInfoId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,35 @@
|
||||
package cn.iocoder.yudao.module.inspection.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.appBase.controller.admin.InspectionSocket;
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionStepInfo;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
|
||||
import cn.iocoder.yudao.module.inspection.mapper.InspectionWorkNodeMapper;
|
||||
import cn.iocoder.yudao.module.inspection.service.DlInspectionProjectService;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionWorkNodeService;
|
||||
import cn.iocoder.yudao.module.inspection.service.InspectionStepInfoService;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -16,5 +41,337 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNodeMapper, InspectionWorkNode> implements IInspectionWorkNodeService {
|
||||
@Autowired
|
||||
private IInspectionInfoService inspectionInfoService;
|
||||
@Autowired
|
||||
private AdminUserService userService;
|
||||
@Autowired
|
||||
private DlInspectionProjectService inspectionProjectService;
|
||||
@Autowired
|
||||
private InspectionStepInfoService inspectionStepService;
|
||||
@Autowired
|
||||
private InspectionSocket inspectionSocket;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
}
|
||||
/**
|
||||
* 员工接单
|
||||
*
|
||||
* @param inspectionId
|
||||
* @param workNodeId
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateInspectionWorkNode(Integer inspectionId, String workNodeId) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
//当前登陆人 就是检测人
|
||||
AdminUserDO workerUser = userService.getUser(loginUser.getId());
|
||||
//根据工单id获取工单
|
||||
InspectionInfo inspectionInfo = inspectionInfoService.getById(inspectionId);
|
||||
if (ObjectUtil.isNull(inspectionInfo)) {
|
||||
throw new RuntimeException("工单不存在");
|
||||
}
|
||||
//根据流程id获取流程
|
||||
InspectionWorkNode workNode = this.getById(workNodeId);
|
||||
if (ObjectUtil.isNull(workNode)) {
|
||||
throw new RuntimeException("流程不存在");
|
||||
}
|
||||
//判断当前流程是否已被接单
|
||||
if (!workNode.getStatus().equals("0")) {
|
||||
throw new RuntimeException("当前流程已被接单");
|
||||
}
|
||||
//修改流程相关信息
|
||||
workNode.setDealUserId(workerUser.getId());
|
||||
workNode.setDealUserName(workerUser.getNickname());
|
||||
workNode.setStatus("1");
|
||||
//更新
|
||||
this.updateById(workNode);
|
||||
|
||||
//查询用户 信息
|
||||
//修改工单表中当前施工人
|
||||
inspectionInfo.setWorkId(workerUser.getId());
|
||||
inspectionInfo.setWorkerName(workerUser.getNickname());
|
||||
inspectionInfo.setWorkerPhone(workerUser.getMobile());
|
||||
inspectionInfoService.updateById(inspectionInfo);
|
||||
|
||||
//新增步骤
|
||||
//根据projectId查询项目名称
|
||||
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
||||
.eq(DlInspectionProject::getId, workNode.getProjectId()));
|
||||
|
||||
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
|
||||
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(inspectionInfo.getId())));
|
||||
if (ObjectUtil.isNotNull(project)) {
|
||||
inspectionStepInfo.setTitle(project.getProjectName() + "项目开始检测");
|
||||
} else {
|
||||
inspectionStepInfo.setTitle("项目检测开始");
|
||||
}
|
||||
inspectionStepInfo.setCreateTime(DateUtil.date());
|
||||
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(workerUser.getId())));
|
||||
inspectionStepService.save(inspectionStepInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新流程图片 步骤信息
|
||||
*
|
||||
* @param inspectionWorkNode
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateImageAndStep(InspectionWorkNode inspectionWorkNode) {
|
||||
//获取当前登陆人
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
switch (inspectionWorkNode.getSelectType()) {
|
||||
case 1:
|
||||
//退办理
|
||||
returnInspectionInfo(inspectionWorkNode);
|
||||
return;
|
||||
case 2:
|
||||
//选择重审
|
||||
retrial(inspectionWorkNode);
|
||||
return;
|
||||
default:
|
||||
//项目完成
|
||||
break;
|
||||
}
|
||||
//根据流程id获取流程
|
||||
InspectionWorkNode workNode = this.getById(inspectionWorkNode.getId());
|
||||
|
||||
//根据工单id查询工单
|
||||
InspectionInfo inspectionInfo = inspectionInfoService.selectInspectionInfoById(workNode.getInspectionInfoId());
|
||||
|
||||
//判断是否是最后一个项目 根据工单id查询
|
||||
//根据工单id查询流程列表
|
||||
LambdaQueryWrapper<InspectionWorkNode> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(InspectionWorkNode::getInspectionInfoId, workNode.getInspectionInfoId());
|
||||
List<InspectionWorkNode> inspectionWorkNodes = this.list(queryWrapper);
|
||||
//判断当前是否是最后一个项目 根据顺序号判断
|
||||
boolean flag = hasNextNode(inspectionWorkNodes, workNode);
|
||||
|
||||
// 插入步骤信息
|
||||
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
|
||||
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
|
||||
|
||||
//根据projectId查询项目名称
|
||||
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
||||
.eq(DlInspectionProject::getId, workNode.getProjectId()));
|
||||
String stepTitle = "";
|
||||
if (ObjectUtil.isNotNull(project)) {
|
||||
inspectionStepInfo.setTitle(project.getProjectName() + "项目检测完成");
|
||||
} else {
|
||||
inspectionStepInfo.setTitle("项目检测完成");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getRemark())) {
|
||||
inspectionStepInfo.setContent(inspectionWorkNode.getRemark());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getDealImages())) {
|
||||
inspectionStepInfo.setImages(inspectionWorkNode.getDealImages());
|
||||
}
|
||||
inspectionStepInfo.setCreateTime(DateUtil.date());
|
||||
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||
inspectionStepService.save(inspectionStepInfo);
|
||||
if (!flag) {
|
||||
stepTitle = "检测结束";
|
||||
//设置工单状态为已完成
|
||||
inspectionInfo.setStatus("1");
|
||||
//设置工单通过
|
||||
inspectionInfo.setIsPass("1");
|
||||
//设置工单结束时间
|
||||
inspectionInfo.setEndTime(DateUtil.date());
|
||||
//设置制证完成
|
||||
inspectionInfo.setMakeCert("1");
|
||||
|
||||
//步骤结束
|
||||
inspectionStepInfo = new InspectionStepInfo();
|
||||
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
|
||||
inspectionStepInfo.setTitle(stepTitle);
|
||||
inspectionStepInfo.setCreateTime(DateUtil.date());
|
||||
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||
inspectionStepService.save(inspectionStepInfo);
|
||||
} else {
|
||||
//修改工单表当前流程
|
||||
inspectionInfo.setNowOrderNum(workNode.getOrderNum() + 1);
|
||||
//获取下一节点
|
||||
InspectionWorkNode nextNode = getNextNode(inspectionWorkNodes, workNode);
|
||||
List<UserDTO> listByUserId = roleService.getListByUserId(nextNode.getRoleId());
|
||||
sendSocketMessage(listByUserId);
|
||||
}
|
||||
|
||||
//将节点状态改为已完成
|
||||
inspectionWorkNode.setStatus("2");
|
||||
//更新流程节点表
|
||||
baseMapper.updateById(inspectionWorkNode);
|
||||
//更细工单状态
|
||||
inspectionInfoService.updateById(inspectionInfo);
|
||||
}
|
||||
|
||||
private InspectionWorkNode getNextNode(List<InspectionWorkNode> inspectionWorkNodes, InspectionWorkNode workNode) {
|
||||
for (InspectionWorkNode node : inspectionWorkNodes) {
|
||||
if (node.getOrderNum() == workNode.getOrderNum() + 1) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据检测id获取流程信息
|
||||
*
|
||||
* @param inspectionId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<InspectionWorkNode> getWeorkNodesById(Integer inspectionId) {
|
||||
return baseMapper.getWeorkNodesById(inspectionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean orImages(Integer inspectionId, String workNodeId) {
|
||||
/*获取当前节点*/
|
||||
InspectionWorkNode workNode = getById(workNodeId);
|
||||
if (workNode.getOrderNum() == 1) {
|
||||
return true;
|
||||
}
|
||||
/*获取所有流程*/
|
||||
List<InspectionWorkNode> workNodes = getWeorkNodesById(inspectionId);
|
||||
if (!hasNextNode(workNodes, workNode)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询提成
|
||||
*
|
||||
* @param page
|
||||
* @param inspectionWorkNode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<Map> getRoyaltyList(IPage page, InspectionWorkNode inspectionWorkNode) {
|
||||
return baseMapper.getRoyaltyList(page, inspectionWorkNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getRoyaltySum(InspectionWorkNode inspectionWorkNode) {
|
||||
return baseMapper.getRoyaltySum(inspectionWorkNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断传入的 InspectionWorkNode 对象是否在集合中有后续项目
|
||||
*
|
||||
* @param nodes InspectionWorkNode 对象的集合
|
||||
* @param currentNode 当前需要判断的 InspectionWorkNode 对象
|
||||
* @return 如果存在后续项目返回 true,否则返回 false
|
||||
*/
|
||||
public boolean hasNextNode(List<InspectionWorkNode> nodes, InspectionWorkNode currentNode) {
|
||||
int currentOrderNum = currentNode.getOrderNum();
|
||||
|
||||
// 遍历集合中的所有节点,检查是否有 orderNum 大于当前节点的
|
||||
for (InspectionWorkNode node : nodes) {
|
||||
if (node.getOrderNum() > currentOrderNum) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退办理
|
||||
*
|
||||
* @param inspectionWorkNode
|
||||
*/
|
||||
public void returnInspectionInfo(InspectionWorkNode inspectionWorkNode) {
|
||||
// 获取当前登录人
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
//通过工单id获取工单
|
||||
InspectionInfo info = inspectionInfoService.getById(inspectionWorkNode.getInspectionInfoId());
|
||||
info.setIsPass("0");
|
||||
info.setEndTime(DateUtil.date());
|
||||
info.setStatus("1");
|
||||
inspectionInfoService.updateById(info);
|
||||
|
||||
//插入步骤信息
|
||||
InspectionStepInfo stepInfo = new InspectionStepInfo();
|
||||
stepInfo.setInspectionInfoId(Integer.parseInt(inspectionWorkNode.getInspectionInfoId().toString()));
|
||||
stepInfo.setTitle("退办理");
|
||||
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getRemark())) {
|
||||
stepInfo.setContent(inspectionWorkNode.getRemark());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getDealImages())) {
|
||||
stepInfo.setImages(inspectionWorkNode.getDealImages());
|
||||
}
|
||||
stepInfo.setCreateTime(DateUtil.date());
|
||||
stepInfo.setCreator(Integer.parseInt(loginUser.getId().toString()));
|
||||
inspectionStepService.save(stepInfo);
|
||||
|
||||
stepInfo = new InspectionStepInfo();
|
||||
stepInfo.setInspectionInfoId(Integer.parseInt(inspectionWorkNode.getInspectionInfoId().toString()));
|
||||
stepInfo.setTitle("检测结束");
|
||||
stepInfo.setCreateTime(DateUtil.date());
|
||||
stepInfo.setCreator(Integer.parseInt(loginUser.getId().toString()));
|
||||
inspectionStepService.save(stepInfo);
|
||||
|
||||
//将流程节点改为已完成
|
||||
InspectionWorkNode byId = this.getById(inspectionWorkNode.getId());
|
||||
byId.setStatus("2");
|
||||
baseMapper.updateById(byId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重审
|
||||
*
|
||||
* @param inspectionWorkNode
|
||||
*/
|
||||
public void retrial(InspectionWorkNode inspectionWorkNode){
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
//通过流程节点id查询流程
|
||||
InspectionWorkNode workNode = this.getById(inspectionWorkNode.getId());
|
||||
//通过工单id获取工单
|
||||
InspectionInfo info = inspectionInfoService.getById(inspectionWorkNode.getInspectionInfoId());
|
||||
info.setIsRetrial("1");
|
||||
info.setIsPass("0");
|
||||
info.setNowOrderNum(workNode.getOrderNum());
|
||||
|
||||
// 将选择的重审项目之后的所有项目设置为待开始
|
||||
this.update(new UpdateWrapper<InspectionWorkNode>()
|
||||
.set("status", "0")
|
||||
.eq("inspection_info_id", inspectionWorkNode.getInspectionInfoId())
|
||||
.ge("order_num", workNode.getOrderNum()));
|
||||
|
||||
//跟新工单表
|
||||
inspectionInfoService.updateById(info);
|
||||
|
||||
//获取重审的节点的roleID
|
||||
Integer roleId = workNode.getRoleId();
|
||||
List<UserDTO> listByUserId = roleService.getListByUserId(roleId);
|
||||
sendSocketMessage(listByUserId);
|
||||
|
||||
// 添加步骤信息表
|
||||
InspectionStepInfo stepInfo = new InspectionStepInfo();
|
||||
stepInfo.setInspectionInfoId(Integer.parseInt(inspectionWorkNode.getInspectionInfoId().toString()));
|
||||
stepInfo.setTitle("重审");
|
||||
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getRemark())) {
|
||||
stepInfo.setContent(inspectionWorkNode.getRemark());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getDealImages())) {
|
||||
stepInfo.setImages(inspectionWorkNode.getDealImages());
|
||||
}
|
||||
stepInfo.setCreateTime(DateUtil.date());
|
||||
stepInfo.setCreator(Integer.parseInt(loginUser.getId().toString()));
|
||||
inspectionStepService.save(stepInfo);
|
||||
}
|
||||
|
||||
public void sendSocketMessage(List<UserDTO> listByUserId) {
|
||||
if (CollUtil.isNotEmpty(listByUserId)) {
|
||||
for (UserDTO userDTO : listByUserId) {
|
||||
try {
|
||||
inspectionSocket.sendMessage("接工单", userDTO.getId().toString());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package cn.iocoder.yudao.module.inspection.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty;
|
||||
import cn.iocoder.yudao.module.inspection.mapper.ProjectRoyaltyMapper;
|
||||
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
|
||||
import cn.iocoder.yudao.module.inspection.service.ProjectRoyaltyService;
|
||||
import cn.iocoder.yudao.module.inspection.vo.ProjectRoyaltySaveReqVO;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检测项目子表(项目提成) Service 实现类
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProjectRoyaltyServiceImpl extends ServiceImpl<ProjectRoyaltyMapper, ProjectRoyalty> implements ProjectRoyaltyService {
|
||||
|
||||
@Resource
|
||||
private ProjectRoyaltyMapper projectRoyaltyMapper;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private AppInspectionPartnerService appInspectionPartnerService;
|
||||
|
||||
@Override
|
||||
public Long createProjectRoyalty(ProjectRoyaltySaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ProjectRoyalty projectRoyalty = BeanUtils.toBean(createReqVO, ProjectRoyalty.class);
|
||||
projectRoyaltyMapper.insert(projectRoyalty);
|
||||
// 返回
|
||||
return projectRoyalty.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量创建检测项目子表(项目提成)
|
||||
*
|
||||
* @param createReq 创建信息
|
||||
*/
|
||||
@Override
|
||||
public void batchInsertProjectRoyalty(List<ProjectRoyalty> createReq) {
|
||||
projectRoyaltyMapper.insertBatch(createReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目id删除检测项目子表(项目提成)
|
||||
*
|
||||
* @param projectId
|
||||
*/
|
||||
@Override
|
||||
public void deleteInsertProjectRoyalty(String projectId) {
|
||||
projectRoyaltyMapper.deleteByProjectId(projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目id查询检测项目子表(项目提成)
|
||||
*
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ProjectRoyalty> getProjectRoyaltyList(String projectId) {
|
||||
try {
|
||||
ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
|
||||
return baseMapper.selectListByProjrctId(projectId, one.getPartnerId().toString());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新检测项目子表(项目提成)
|
||||
*
|
||||
* @param createReq
|
||||
*/
|
||||
@Override
|
||||
public void updtaBatch(List<ProjectRoyalty> createReq) {
|
||||
projectRoyaltyMapper.updtaBatch(createReq);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void updateProjectRoyalty(ProjectRoyaltySaveReqVO updateReqVO) {
|
||||
// // 校验存在
|
||||
// validateProjectRoyaltyExists(updateReqVO.getId());
|
||||
// // 更新
|
||||
// ProjectRoyalty updateObj = BeanUtils.toBean(updateReqVO, ProjectRoyalty.class);
|
||||
// projectRoyaltyMapper.updateById(updateObj);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void deleteProjectRoyalty(Long id) {
|
||||
// // 校验存在
|
||||
// validateProjectRoyaltyExists(id);
|
||||
// // 删除
|
||||
// projectRoyaltyMapper.deleteById(id);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public ProjectRoyalty getProjectRoyalty(Long id) {
|
||||
// return projectRoyaltyMapper.selectById(id);
|
||||
// }
|
||||
|
||||
|
||||
}
|
@ -1,13 +1,18 @@
|
||||
package cn.iocoder.yudao.module.inspection.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 检测项目新增/修改 Request VO")
|
||||
@Data
|
||||
public class DlInspectionProjectSaveReqVO extends DlInspectionProject {
|
||||
|
||||
|
||||
/**
|
||||
* 项目提成
|
||||
*/
|
||||
private List<ProjectRoyalty> projectRoyaltyList;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.inspection.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionStepInfo;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DlInspectionWorkNodeVo {
|
||||
/**
|
||||
* 检测单
|
||||
*/
|
||||
private InspectionInfo inspectionInfo;
|
||||
/**
|
||||
* 流程节点
|
||||
*/
|
||||
private InspectionWorkNode node;
|
||||
/**
|
||||
* 步骤
|
||||
*/
|
||||
private List<InspectionStepInfo> steps;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.inspection.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 检测项目子表(项目提成)分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProjectRoyaltyPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "检测项目主键", example = "21579")
|
||||
private String projectId;
|
||||
|
||||
@Schema(description = "商品主键", example = "3154")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "提成金额 单位:分")
|
||||
private Long royaltyAmount;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.inspection.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 检测项目子表(项目提成) Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ProjectRoyaltyRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18948")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "检测项目主键", example = "21579")
|
||||
@ExcelProperty("检测项目主键")
|
||||
private String projectId;
|
||||
|
||||
@Schema(description = "商品主键", example = "3154")
|
||||
@ExcelProperty("商品主键")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "提成金额 单位:分")
|
||||
@ExcelProperty("提成金额 单位:分")
|
||||
private Long royaltyAmount;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.inspection.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 检测项目子表(项目提成)新增/修改 Request VO")
|
||||
@Data
|
||||
public class ProjectRoyaltySaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18948")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "检测项目主键", example = "21579")
|
||||
private String projectId;
|
||||
|
||||
@Schema(description = "商品主键", example = "3154")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "提成金额 单位:分")
|
||||
private Long royaltyAmount;
|
||||
|
||||
}
|
@ -153,9 +153,9 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
|
||||
userSaveReqVO.setPassword("123456");
|
||||
Long uid = userService.createUser(userSaveReqVO);
|
||||
user.setId(uid);
|
||||
Set<Long> ids = new HashSet<>();
|
||||
ids.add(role.getId());
|
||||
permissionService.assignUserRole(uid, ids);
|
||||
// Set<Long> ids = new HashSet<>();
|
||||
// ids.add(role.getId());
|
||||
// permissionService.assignUserRole(uid, ids);
|
||||
} else {
|
||||
throw new RuntimeException("无法找到角色 'jcyh'");
|
||||
}
|
||||
|
@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.inspection.mapper.InspectionWorkNodeMapper">
|
||||
|
||||
<select id="getWeorkNodesById" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode"
|
||||
parameterType="java.lang.Integer">
|
||||
SELECT wn.*,ip.project_name AS projectName
|
||||
FROM inspection_work_node wn
|
||||
LEFT JOIN inspection_project ip ON ip.id = wn.project_id
|
||||
WHERE wn.inspection_info_id = #{inspectionId}
|
||||
ORDER BY wn.order_num ASC
|
||||
</select>
|
||||
<select id="getRoyaltyList" resultType="java.util.Map">
|
||||
SELECT
|
||||
node.id AS node_id,
|
||||
node.project_id,
|
||||
proj.project_name AS projectName, -- Assuming there's a project name in the inspection project table
|
||||
node.deal_user_name AS handlerName,
|
||||
IFNULL(royalty.royalty_amount, 0) / 100 AS royaltyAmount,
|
||||
node.update_time AS node_create_time,
|
||||
node.update_time AS royalty_create_time
|
||||
FROM
|
||||
inspection_work_node AS node
|
||||
LEFT JOIN
|
||||
system_users AS users
|
||||
ON node.deal_user_id = users.id
|
||||
LEFT JOIN
|
||||
inspection_project AS proj -- Assuming this is the table for project details
|
||||
ON node.project_id = proj.id
|
||||
LEFT JOIN
|
||||
inspection_info AS info
|
||||
ON node.inspection_info_id = info.id
|
||||
LEFT JOIN
|
||||
order_info orders
|
||||
ON info.inspection_order_id = orders.id
|
||||
LEFT JOIN
|
||||
inspection_project_royalty AS royalty
|
||||
ON node.project_id = royalty.project_id and orders.goods_id = royalty.goods_id
|
||||
<where>
|
||||
node.status = '2' AND info.status = '1'
|
||||
<if test="inspectionWorkNode.createTime != null">
|
||||
AND node.create_time = #{inspectionWorkNode.createTime}
|
||||
</if>
|
||||
<if test="inspectionWorkNode.projectId != null">
|
||||
AND node.project_id = #{inspectionWorkNode.projectId}
|
||||
</if>
|
||||
<if test="inspectionWorkNode.dealUserId != null">
|
||||
AND node.deal_user_id = #{inspectionWorkNode.dealUserId}
|
||||
</if>
|
||||
<if test="inspectionWorkNode.dealUserName != null">
|
||||
AND node.deal_user_name LIKE CONCAT('%', #{inspectionWorkNode.dealUserName} , '%')
|
||||
</if>
|
||||
<if test="inspectionWorkNode.rescueStartMonth != null">
|
||||
AND DATE_FORMAT(info.end_time, '%Y-%m') = #{inspectionWorkNode.rescueStartMonth}
|
||||
</if>
|
||||
<if test="inspectionWorkNode.rescueStart != null and inspectionWorkNode.rescueEnd != null">
|
||||
AND info.end_time BETWEEN #{inspectionWorkNode.rescueStart} AND #{inspectionWorkNode.rescueEnd}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
info.end_time DESC;
|
||||
</select>
|
||||
<select id="getRoyaltySum" resultType="java.util.Map">
|
||||
SELECT
|
||||
IFNULL(SUM(IFNULL(royalty.royalty_amount, 0) / 100 ),0)AS royaltyAmountSum
|
||||
FROM
|
||||
inspection_work_node AS node
|
||||
LEFT JOIN
|
||||
system_users AS users
|
||||
ON node.deal_user_id = users.id
|
||||
LEFT JOIN
|
||||
inspection_project AS proj -- Assuming this is the table for project details
|
||||
ON node.project_id = proj.id
|
||||
LEFT JOIN
|
||||
inspection_info AS info
|
||||
ON node.inspection_info_id = info.id
|
||||
LEFT JOIN
|
||||
order_info orders
|
||||
ON info.inspection_order_id = orders.id
|
||||
LEFT JOIN
|
||||
inspection_project_royalty AS royalty
|
||||
ON node.project_id = royalty.project_id and orders.goods_id = royalty.goods_id
|
||||
<where>
|
||||
node.status = '2' AND info.status = '1'
|
||||
<if test="inspectionWorkNode.createTime != null">
|
||||
AND node.create_time = #{inspectionWorkNode.createTime}
|
||||
</if>
|
||||
<if test="inspectionWorkNode.projectId != null">
|
||||
AND node.project_id = #{inspectionWorkNode.projectId}
|
||||
</if>
|
||||
<if test="inspectionWorkNode.dealUserId != null">
|
||||
AND node.deal_user_id = #{inspectionWorkNode.dealUserId}
|
||||
</if>
|
||||
<if test="inspectionWorkNode.dealUserName != null">
|
||||
AND node.deal_user_name LIKE CONCAT('%', #{inspectionWorkNode.dealUserName} , '%')
|
||||
</if>
|
||||
<if test="inspectionWorkNode.rescueStartMonth != null">
|
||||
AND DATE_FORMAT(info.end_time, '%Y-%m') = #{inspectionWorkNode.rescueStartMonth}
|
||||
</if>
|
||||
<if test="inspectionWorkNode.rescueStart != null and inspectionWorkNode.rescueEnd != null">
|
||||
AND info.end_time BETWEEN #{inspectionWorkNode.rescueStart} AND #{inspectionWorkNode.rescueEnd}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
node.create_time DESC;
|
||||
</select>
|
||||
</mapper>
|
@ -266,4 +266,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
order by ins.start_time desc
|
||||
</select>
|
||||
<select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
SELECT
|
||||
ii.*,
|
||||
iwn.id AS workNodeId,
|
||||
iwn.status AS workNodeStatus,
|
||||
oi.order_no AS orderNo,
|
||||
oi.phonenumber AS buyPhone
|
||||
FROM
|
||||
inspection_info ii
|
||||
JOIN
|
||||
inspection_work_node iwn ON ii.id = iwn.inspection_info_id
|
||||
JOIN order_info oi ON ii.inspection_order_id = oi.id
|
||||
<where>
|
||||
-- ii.status = '0' -- 工单正在进行中
|
||||
-- ii.now_order_num = iwn.order_num -- 当前工单步骤与流程节点顺序一致
|
||||
-- AND iwn.status = '0' -- 流程节点状态为待开始
|
||||
iwn.role_id IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
<if test="inspectionInfo.carNum != null">
|
||||
AND ii.car_num like concat('%',#{inspectionInfo.carNum},'%')
|
||||
</if>
|
||||
-- 待接受
|
||||
<if test="inspectionInfo.status == 1">
|
||||
AND ii.status = '0' AND iwn.status = '0' AND ii.now_order_num = iwn.order_num
|
||||
</if>
|
||||
-- 进行中
|
||||
<if test="inspectionInfo.status == 2">
|
||||
AND ii.status = '0' AND iwn.status = '1' AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||
</if>
|
||||
-- 已完成
|
||||
<if test="inspectionInfo.status == 3">
|
||||
AND iwn.status = '2' AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ii.create_time DESC
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.inspection.mapper.InspectionStepInfoMapper">
|
||||
|
||||
<select id="listByInspectionInfoId" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionStepInfo"
|
||||
parameterType="java.lang.Long">
|
||||
SELECT isi.* ,u.nickname AS nickname
|
||||
FROM inspection_step_info isi
|
||||
LEFT JOIN system_users u ON u.id = isi.creator
|
||||
WHERE isi.inspection_info_id = #{inspectionInfoId}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.inspection.mapper.ProjectRoyaltyMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO inspection_project_royalty (project_id, goods_id, royalty_amount, deleted, create_time) VALUES
|
||||
<foreach collection="createReq" item="item" separator=",">
|
||||
(#{item.projectId},#{item.goodsId},#{item.royaltyAmount},0, NOW())
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updtaBatch">
|
||||
UPDATE inspection_project_royalty
|
||||
SET royalty_amount =
|
||||
CASE
|
||||
<foreach collection="list" item="item" index="index">
|
||||
WHEN id = #{item.id} THEN #{item.royaltyAmount}
|
||||
</foreach>
|
||||
ELSE royalty_amount
|
||||
END
|
||||
WHERE id IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
<delete id="deleteByProjectId" parameterType="java.lang.String">
|
||||
delete from inspection_project_royalty where project_id = #{projectId}
|
||||
</delete>
|
||||
<select id="selectListByProjrctId" resultType="cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty"
|
||||
parameterType="java.lang.String">
|
||||
SELECT g.id id,
|
||||
g.title title,
|
||||
COALESCE(r.royalty_amount / 100, 0) AS royalty_amount
|
||||
FROM shop_inspection_goods g
|
||||
LEFT JOIN inspection_project_royalty r
|
||||
ON g.id = r.goods_id
|
||||
AND r.deleted = 0
|
||||
AND r.project_id = #{projectId}
|
||||
WHERE g.deleted = 0
|
||||
AND g.partner_id = #{parentId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -219,6 +219,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// 门店信息
|
||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||
DeptRespDTO dept = deptApi.getDept(deptId);
|
||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.security.config.SecurityProperties;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerWorker;
|
||||
import cn.iocoder.yudao.util.RedisCache;
|
||||
import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
|
||||
import cn.iocoder.yudao.module.rescue.domain.LoginBody;
|
||||
@ -81,8 +82,6 @@ public class SysLoginController {
|
||||
|
||||
@Resource
|
||||
private PermissionApi permissionApi;
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Resource
|
||||
private RoleApi roleApi;
|
||||
@ -577,50 +576,23 @@ public class SysLoginController {
|
||||
map.put("driverInfo", driverInfo);
|
||||
return success(map);
|
||||
}
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取检测工用户信息
|
||||
// *
|
||||
// * @return 用户信息
|
||||
// */
|
||||
// @GetMapping("/getJcWorkerInfo")
|
||||
// public AjaxResult getJcWorkerInfo()
|
||||
// {
|
||||
// AjaxResult ajax = success();
|
||||
// LambdaQueryWrapper<PartnerWorker> queryWrapper =new LambdaQueryWrapper<>();
|
||||
// SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
// queryWrapper.eq(PartnerWorker::getUserId,user.getUserId());
|
||||
// PartnerWorker worker = jcWorkerService.getOne(queryWrapper);
|
||||
// if (ObjectUtil.isNotEmpty(worker)){
|
||||
// LambdaQueryWrapper<ShopMallPartners> queryWrapper1 =new LambdaQueryWrapper<>();
|
||||
// queryWrapper1.eq(ShopMallPartners::getPartnerId,worker.getPartnerId()).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0");
|
||||
// ShopMallPartners partner = partnersService.getOne(queryWrapper1);
|
||||
// if (ObjectUtil.isEmpty(partner)){
|
||||
// return error("信息有误");
|
||||
// }
|
||||
// ajax.put("partnerInfo", partner);
|
||||
// }else {
|
||||
// return error("信息有误");
|
||||
// }
|
||||
// SysUser sysUser = userService.selectUserById(user.getUserId());
|
||||
//
|
||||
// ajax.put("user", sysUser);
|
||||
//
|
||||
// return ajax;
|
||||
// }
|
||||
// /**
|
||||
// * 获取路由信息
|
||||
// *
|
||||
// * @return 路由信息
|
||||
// */
|
||||
// @GetMapping("getRouters")
|
||||
// public CommonResult getRouters()
|
||||
// {
|
||||
// Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
// List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||
// return AjaxResult.success(menuService.buildMenus(menus));
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 获取检测工用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("/getJcWorkerInfo")
|
||||
public CommonResult getJcWorkerInfo()
|
||||
{
|
||||
LoginUser user = SecurityFrameworkUtils.getLoginUser();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("partnerId", user.getTenantId());
|
||||
map.put("user", user);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/wxLogin")
|
||||
public CommonResult wxLogin(@RequestBody WxLoginBody wxLoginBody) {
|
||||
|
@ -43,6 +43,8 @@ public interface UserRoleMapper extends BaseMapperX<UserRoleDO> {
|
||||
|
||||
IPage<UserDTO> selectListByRoleId(@Param("page") Page<UserDTO> page,@Param("role") RolePageReqVO role);
|
||||
|
||||
List<UserDTO> selectByRoleId(Integer roleId);
|
||||
|
||||
/**
|
||||
* 通过用户id查询用户关联角色code
|
||||
* @author PQZ
|
||||
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.system.dal.mysql.user;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.app.user.UserInfoVO;
|
||||
@ -30,7 +32,15 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
}
|
||||
|
||||
default AdminUserDO selectByMobile(String mobile) {
|
||||
return getUserByMobileWithoutTenant(mobile);
|
||||
Long tenantId=null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
tenantId = loginUser.getTenantId();
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return getUserByMobileWithoutTenant(mobile,tenantId);
|
||||
}
|
||||
|
||||
default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
|
||||
@ -65,7 +75,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
|
||||
AdminUserDO selectUserByPhone(String phone);
|
||||
|
||||
AdminUserDO getUserByMobileWithoutTenant(String phoneNumber);
|
||||
AdminUserDO getUserByMobileWithoutTenant(@Param("phoneNumber") String phoneNumber,@Param("tenantId") Long tenantId);
|
||||
|
||||
int updateSetOpenId(@Param("userId")Long userId,@Param("openId")String openId);
|
||||
|
||||
|
@ -175,4 +175,11 @@ public interface RoleService {
|
||||
* @return
|
||||
*/
|
||||
List<UserRoleDO> getByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据角色id查询用户
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> getListByUserId(Integer roleId);
|
||||
}
|
||||
|
@ -372,6 +372,18 @@ public class RoleServiceImpl implements RoleService {
|
||||
return userRoleDOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id查询用户
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserDTO> getListByUserId(Integer roleId) {
|
||||
List<UserDTO> userDTOS = userRoleMapper.selectByRoleId(roleId);
|
||||
return userDTOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得自身的代理对象,解决 AOP 生效问题
|
||||
*
|
||||
|
@ -10,6 +10,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
@ -298,6 +300,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
|
||||
@Override
|
||||
public AdminUserDO getUserByMobile(String mobile) {
|
||||
|
||||
return userMapper.selectByMobile(mobile);
|
||||
}
|
||||
|
||||
@ -451,7 +454,15 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
if (StrUtil.isBlank(mobile)) {
|
||||
return;
|
||||
}
|
||||
AdminUserDO user = userMapper.getUserByMobileWithoutTenant(mobile);
|
||||
Long tenantId=null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
tenantId = loginUser.getTenantId();
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
AdminUserDO user = userMapper.getUserByMobileWithoutTenant(mobile,tenantId);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
@ -562,7 +573,15 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
|
||||
@Override
|
||||
public AdminUserDO getUserByMobileWithoutTenant(String phoneNumber) {
|
||||
return userMapper.getUserByMobileWithoutTenant(phoneNumber);
|
||||
Long tenantId=null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
tenantId = loginUser.getTenantId();
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return userMapper.getUserByMobileWithoutTenant(phoneNumber,tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,6 +69,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
system_users
|
||||
WHERE
|
||||
mobile = #{phoneNumber}
|
||||
<if test="tenantId!=null">
|
||||
and tenant_id = #{tenantId}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -48,4 +48,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectByRoleId" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
system_users
|
||||
WHERE
|
||||
id IN (
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
system_user_role sur
|
||||
WHERE
|
||||
sur.role_id = #{roleId})
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user