diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/InspectionSocket.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/InspectionSocket.java new file mode 100644 index 00000000..1554b927 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/InspectionSocket.java @@ -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 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); + } + } + + +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/DlInspectionProjectController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/DlInspectionProjectController.java index 076a74f4..dc64cb61 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/DlInspectionProjectController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/DlInspectionProjectController.java @@ -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 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 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 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 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> getDlInspectionProjectPage(@Valid DlInspectionProjectPageReqVO pageReqVO, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java index 5b7aee92..adb7f370 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java @@ -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 page = new Page<>(pageNum, pageSize); - IPage list = inspectionInfoService.selectInspectionInfoList(page,inspectionInfo); + IPage 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 page = new Page<>(pageNum, pageSize); - IPage list = inspectionInfoService.selectInspectionInfoList(page,inspectionInfo); + IPage list = inspectionInfoService.selectInspectionInfoList(page, inspectionInfo); ExcelUtil util = new ExcelUtil(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 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)); + } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java index 878063bd..ce67a2df 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java @@ -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())); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DlInspectionProject.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DlInspectionProject.java index 7e68bd8c..e96e64fb 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DlInspectionProject.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DlInspectionProject.java @@ -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 projectRoyaltyList; } \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java index 2805635b..cce9aa5d 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java @@ -148,6 +148,13 @@ public class InspectionInfo extends TenantBaseDO private Integer nowOrderNum; /** 开始检测时需要 传入 选择项目的id、角色id、排序 */ + @TableField(exist = false) private List inspectionWorkNodes; + /** 流程节点id*/ + @TableField(exist = false) private String workNodeId; + @TableField(exist = false) + private Long dealUserId; + @TableField(exist = false) + private String workNodeStatus; } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionStepInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionStepInfo.java index da0dfb83..9fdaa285 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionStepInfo.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionStepInfo.java @@ -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 { //步骤号 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 { private Date updateTime; //更新人id private Integer updater; + @TableField(exist = false) + private String nickname; } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionWorkNode.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionWorkNode.java index 3245b5d0..4c1536fe 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionWorkNode.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionWorkNode.java @@ -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; } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/ProjectRoyalty.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/ProjectRoyalty.java new file mode 100644 index 00000000..d5f70693 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/ProjectRoyalty.java @@ -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; + +} \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionInfoMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionInfoMapper.java index 4bf9c11b..a2307a85 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionInfoMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionInfoMapper.java @@ -87,4 +87,10 @@ public interface InspectionInfoMapper extends BaseMapper , @Param("roleId") Long roleId, @Param("endTime")String endTime); + /** + * 查询当前用户符合条件的工单 + * @param page + * @return + */ + IPage selectByUser(@Param("page") IPage page, @Param("roleIds") List roleIds,@Param("inspectionInfo") InspectionInfo inspectionInfo); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionStepInfoMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionStepInfoMapper.java index 4a0c1da7..7832b037 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionStepInfoMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionStepInfoMapper.java @@ -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 { + List listByInspectionInfoId(Long inspectionInfoId); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java index 088f2325..3340c22a 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java @@ -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; /** *

@@ -15,4 +20,13 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface InspectionWorkNodeMapper extends BaseMapper { + /** + * 根据检测id获取检测流程 + * @param inspectionId + * @return + */ + List getWeorkNodesById(Integer inspectionId); + + IPage getRoyaltyList(@Param("page")IPage page,@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode); + Map getRoyaltySum(@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/ProjectRoyaltyMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/ProjectRoyaltyMapper.java new file mode 100644 index 00000000..c58cf383 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/ProjectRoyaltyMapper.java @@ -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 { + + void insertBatch(@Param("createReq") List createReq); + + void deleteByProjectId(String projectId); + + List selectListByProjrctId(@Param("projectId")String projectId,@Param("parentId") String parentId); + + void updtaBatch(@Param("list") List createReq); +} \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java index 2f219ee3..ef2fb65e 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java @@ -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 Map workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime); + /** + * 根据当前登陆人获取可以选择的工单 + * @return + */ + IPage geStelectInspection(IPage page,InspectionInfo inspectionInfo); + + /** + * 获取工单详情 + * @param id + * @return + */ + DlInspectionWorkNodeVo getWorkNode(Integer inspectionId, String workNodeId); + + /** + * 根据工单id获取工单流程 + * @param inspectionId + * @return + */ + List getWeorkNodesById(Integer inspectionId); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java index b9697e6e..d1d16fb2 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java @@ -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; + /** *

* 检测流程表 服务类 @@ -12,5 +16,35 @@ import com.baomidou.mybatisplus.extension.service.IService; * @since 2024-10-31 */ public interface IInspectionWorkNodeService extends IService { + /** + * 员工接单 + * @param inspectionId + * @param workNodeId + */ + void updateInspectionWorkNode(Integer inspectionId, String workNodeId); + /** + * 更新流程图片 步骤信息 + * @param inspectionWorkNode + */ + void updateImageAndStep(InspectionWorkNode inspectionWorkNode); + + /** + * 根据检测id获取流程信息 + * @param inspectionId + * @return + */ + List getWeorkNodesById(Integer inspectionId); + + boolean orImages(Integer inspectionId, String workNodeId); + + /** + * 分页查询提成 + * @param page + * @param inspectionWorkNode + * @return + */ + IPage getRoyaltyList(IPage page, InspectionWorkNode inspectionWorkNode); + + Map getRoyaltySum(InspectionWorkNode inspectionWorkNode); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/InspectionStepInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/InspectionStepInfoService.java index 86698b11..f39b7ad3 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/InspectionStepInfoService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/InspectionStepInfoService.java @@ -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 { + List listByInspectionInfoId(Long inspectionInfoId); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/ProjectRoyaltyService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/ProjectRoyaltyService.java new file mode 100644 index 00000000..e4126fa7 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/ProjectRoyaltyService.java @@ -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 createReq); + + /** + * 根据项目id删除检测项目子表(项目提成) + * @param projectId + */ + void deleteInsertProjectRoyalty(String projectId); + + /** + * 根据项目id查询检测项目子表(项目提成) + * @param projectId + * @return + */ + List getProjectRoyaltyList(String projectId); + + /** + * 批量更新检测项目子表(项目提成) + * @param createReq + */ + void updtaBatch(List 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 getProjectRoyaltyPage(ProjectRoyaltyPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java index 0e4d20d1..0270ca59 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java @@ -117,6 +117,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl partnerList(Page page, PartnerListQuery partnerListQuery) { @@ -195,11 +197,9 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl 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 queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(InspectionStepInfo::getInspectionInfoId,inspectionInfoId).orderByAsc(InspectionStepInfo::getStepNum); - List list = stepInfoService.list(queryWrapper); + queryWrapper.orderBy(true, false, InspectionStepInfo::getId); + List list = stepInfoService.listByInspectionInfoId(inspectionInfoId); if (CollectionUtil.isNotEmpty(list)){ res.setStepInfos(list); } @@ -1732,7 +1734,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl() @@ -41,29 +54,49 @@ public class DlInspectionProjectServiceImpl extends ServiceImpl projectRoyaltyList = createReqVO.getProjectRoyaltyList(); + //设置项目id + List 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 projectRoyaltyList = updateReqVO.getProjectRoyaltyList(); + //设置项目id + List 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 projectRoyaltyList = projectRoyaltyService.getProjectRoyaltyList(id); + dlInspectionProject.setProjectRoyaltyList(projectRoyaltyList); + return dlInspectionProject; } @Override diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java index b03566c8..461a7ba5 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java @@ -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 implements IInspectionInfoService -{ +public class InspectionInfoServiceImpl extends ServiceImpl implements IInspectionInfoService { @Autowired private AdminUserService userService; @Autowired @@ -72,8 +81,17 @@ public class InspectionInfoServiceImpl extends ServiceImpl selectInspectionInfoList(Page page, InspectionInfo inspectionInfo) - { - return baseMapper.selectInspectionInfoList(page,inspectionInfo); + public IPage selectInspectionInfoList(Page page, InspectionInfo inspectionInfo) { + return baseMapper.selectInspectionInfoList(page, inspectionInfo); } /** @@ -108,20 +124,17 @@ public class InspectionInfoServiceImpl extends ServiceImpl 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 queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerCustomerInfo::getPartnerId,inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId,orderInfo.getUserId()); + LambdaQueryWrapper 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 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 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 workerQueryWrapper =new LambdaQueryWrapper<>(); - workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId()); + LambdaQueryWrapper 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 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 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 pageWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page 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 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 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 pageDelWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page 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 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 geStelectInspection(IPage page, InspectionInfo inspectionInfo) { + //获取当前登录人 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + //获取当前登陆人的角色 + List byUserId = roleService.getByUserId(loginUser.getId()); + List 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 inspectionStepInfos = inspectionStepInfoService.list(new LambdaQueryWrapper() + .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 getWeorkNodesById(Integer inspectionId) { + return workNodeService.getWeorkNodesById(inspectionId); } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionStepInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionStepInfoServiceImpl.java index 4634e3ec..6d981baf 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionStepInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionStepInfoServiceImpl.java @@ -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 implements InspectionStepInfoService { + @Override + public List listByInspectionInfoId(Long inspectionInfoId) { + return baseMapper.listByInspectionInfoId(inspectionInfoId); + } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java index 69c91b68..e4152001 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java @@ -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; /** *

@@ -16,5 +41,337 @@ import org.springframework.stereotype.Service; */ @Service public class InspectionWorkNodeServiceImpl extends ServiceImpl 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() + .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 queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(InspectionWorkNode::getInspectionInfoId, workNode.getInspectionInfoId()); + List 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() + .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 listByUserId = roleService.getListByUserId(nextNode.getRoleId()); + sendSocketMessage(listByUserId); + } + + //将节点状态改为已完成 + inspectionWorkNode.setStatus("2"); + //更新流程节点表 + baseMapper.updateById(inspectionWorkNode); + //更细工单状态 + inspectionInfoService.updateById(inspectionInfo); + } + + private InspectionWorkNode getNextNode(List inspectionWorkNodes, InspectionWorkNode workNode) { + for (InspectionWorkNode node : inspectionWorkNodes) { + if (node.getOrderNum() == workNode.getOrderNum() + 1) { + return node; + } + } + return null; + } + + /** + * 根据检测id获取流程信息 + * + * @param inspectionId + * @return + */ + @Override + public List 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 workNodes = getWeorkNodesById(inspectionId); + if (!hasNextNode(workNodes, workNode)) { + return true; + } + return false; + } + + /** + * 分页查询提成 + * + * @param page + * @param inspectionWorkNode + * @return + */ + @Override + public IPage 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 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() + .set("status", "0") + .eq("inspection_info_id", inspectionWorkNode.getInspectionInfoId()) + .ge("order_num", workNode.getOrderNum())); + + //跟新工单表 + inspectionInfoService.updateById(info); + + //获取重审的节点的roleID + Integer roleId = workNode.getRoleId(); + List 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 listByUserId) { + if (CollUtil.isNotEmpty(listByUserId)) { + for (UserDTO userDTO : listByUserId) { + try { + inspectionSocket.sendMessage("接工单", userDTO.getId().toString()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + } +} \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/ProjectRoyaltyServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/ProjectRoyaltyServiceImpl.java new file mode 100644 index 00000000..47eb57d2 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/ProjectRoyaltyServiceImpl.java @@ -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 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 createReq) { + projectRoyaltyMapper.insertBatch(createReq); + } + + /** + * 根据项目id删除检测项目子表(项目提成) + * + * @param projectId + */ + @Override + public void deleteInsertProjectRoyalty(String projectId) { + projectRoyaltyMapper.deleteByProjectId(projectId); + } + + /** + * 根据项目id查询检测项目子表(项目提成) + * + * @param projectId + * @return + */ + @Override + public List 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 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); +// } + + +} \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/DlInspectionProjectSaveReqVO.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/DlInspectionProjectSaveReqVO.java index 935351f2..b3aa1f4b 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/DlInspectionProjectSaveReqVO.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/DlInspectionProjectSaveReqVO.java @@ -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 projectRoyaltyList; } \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/DlInspectionWorkNodeVo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/DlInspectionWorkNodeVo.java new file mode 100644 index 00000000..b79bd971 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/DlInspectionWorkNodeVo.java @@ -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 steps; +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ProjectRoyaltyPageReqVO.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ProjectRoyaltyPageReqVO.java new file mode 100644 index 00000000..a1faf348 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ProjectRoyaltyPageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ProjectRoyaltyRespVO.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ProjectRoyaltyRespVO.java new file mode 100644 index 00000000..a6a51584 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ProjectRoyaltyRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ProjectRoyaltySaveReqVO.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ProjectRoyaltySaveReqVO.java new file mode 100644 index 00000000..bd8c0776 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ProjectRoyaltySaveReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java index d46b8020..1dfda244 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java @@ -153,9 +153,9 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl ids = new HashSet<>(); - ids.add(role.getId()); - permissionService.assignUserRole(uid, ids); +// Set ids = new HashSet<>(); +// ids.add(role.getId()); +// permissionService.assignUserRole(uid, ids); } else { throw new RuntimeException("无法找到角色 'jcyh'"); } diff --git a/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml b/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml new file mode 100644 index 00000000..67fd11ec --- /dev/null +++ b/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml @@ -0,0 +1,107 @@ + + + + + + + + diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml index 85d4c0a5..5d85b81f 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml @@ -266,4 +266,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by ins.start_time desc + diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/InspectionStepInfoMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/InspectionStepInfoMapper.xml new file mode 100644 index 00000000..bf787034 --- /dev/null +++ b/dl-module-inspection/src/main/resources/mapper/inspection/InspectionStepInfoMapper.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/ProjectRoyaltyMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/ProjectRoyaltyMapper.xml new file mode 100644 index 00000000..2e55db6e --- /dev/null +++ b/dl-module-inspection/src/main/resources/mapper/inspection/ProjectRoyaltyMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + INSERT INTO inspection_project_royalty (project_id, goods_id, royalty_amount, deleted, create_time) VALUES + + (#{item.projectId},#{item.goodsId},#{item.royaltyAmount},0, NOW()) + + + + UPDATE inspection_project_royalty + SET royalty_amount = + CASE + + WHEN id = #{item.id} THEN #{item.royaltyAmount} + + ELSE royalty_amount + END + WHERE id IN + + #{item.id} + + + + delete from inspection_project_royalty where project_id = #{projectId} + + + + \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 6f0b41ab..6cfcf056 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -219,6 +219,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); -// SysUser user = SecurityUtils.getLoginUser().getUser(); -// queryWrapper.eq(PartnerWorker::getUserId,user.getUserId()); -// PartnerWorker worker = jcWorkerService.getOne(queryWrapper); -// if (ObjectUtil.isNotEmpty(worker)){ -// LambdaQueryWrapper 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 menus = menuService.selectMenuTreeByUserId(userId); -// return AjaxResult.success(menuService.buildMenus(menus)); -// } + + + /** + * 获取检测工用户信息 + * + * @return 用户信息 + */ + @GetMapping("/getJcWorkerInfo") + public CommonResult getJcWorkerInfo() + { + LoginUser user = SecurityFrameworkUtils.getLoginUser(); + Map map = new HashMap<>(); + map.put("partnerId", user.getTenantId()); + map.put("user", user); + return CommonResult.success(map); + } + @PostMapping("/wxLogin") public CommonResult wxLogin(@RequestBody WxLoginBody wxLoginBody) { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java index 1ee41bef..89a6964b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java @@ -43,6 +43,8 @@ public interface UserRoleMapper extends BaseMapperX { IPage selectListByRoleId(@Param("page") Page page,@Param("role") RolePageReqVO role); + List selectByRoleId(Integer roleId); + /** * 通过用户id查询用户关联角色code * @author PQZ diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java index 15be2569..c371300e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java @@ -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 { } 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 selectPage(UserPageReqVO reqVO, Collection deptIds) { @@ -65,7 +75,7 @@ public interface AdminUserMapper extends BaseMapperX { 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); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java index 0c1ac00d..e0bc9022 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java @@ -175,4 +175,11 @@ public interface RoleService { * @return */ List getByUserId(Long userId); + + /** + * 根据角色id查询用户 + * @param roleId + * @return + */ + List getListByUserId(Integer roleId); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java index 882d326e..73ff7d1b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java @@ -372,6 +372,18 @@ public class RoleServiceImpl implements RoleService { return userRoleDOS; } + /** + * 根据角色id查询用户 + * + * @param roleId + * @return + */ + @Override + public List getListByUserId(Integer roleId) { + List userDTOS = userRoleMapper.selectByRoleId(roleId); + return userDTOS; + } + /** * 获得自身的代理对象,解决 AOP 生效问题 * diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index e3c2878f..53b12a1a 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -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 + and tenant_id = #{tenantId} + AND deleted = 0 + limit 1 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml index c9850c51..7525388f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml @@ -48,4 +48,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item} +