Kaynağa Gözat

流程办理添加采购单号和金额

yzc 1 yıl önce
ebeveyn
işleme
7735ce9e2a

+ 27 - 0
hx-common/src/main/java/com/fjhx/common/controller/flow/FlowExampleByWdlyController.java

@@ -0,0 +1,27 @@
+package com.fjhx.common.controller.flow;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.common.entity.flow.vo.FlowExampleVoByWdly;
+import com.fjhx.common.service.flow.FlowExampleByWdlyService;
+import com.fjhx.flow.entity.flow.dto.FlowExampleSelectDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/flowExampleByWdly")
+public class FlowExampleByWdlyController {
+
+    @Autowired
+    private FlowExampleByWdlyService flowExampleByWdlyService;
+
+    /**
+     * 获取待处理流程实例
+     */
+    @PostMapping("getToBeProcessedPage")
+    public Page<FlowExampleVoByWdly> getToBeProcessedPage(@RequestBody FlowExampleSelectDto dto) {
+        return flowExampleByWdlyService.getToBeProcessedPage(dto);
+    }
+}

+ 22 - 0
hx-common/src/main/java/com/fjhx/common/entity/flow/vo/FlowExampleVoByWdly.java

@@ -0,0 +1,22 @@
+package com.fjhx.common.entity.flow.vo;
+
+import com.fjhx.flow.entity.flow.vo.FlowExampleVo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+@Getter
+@Setter
+public class FlowExampleVoByWdly extends FlowExampleVo {
+
+    /**
+     * 采购编号
+     */
+    private String code;
+
+    /**
+     * 采购金额
+     */
+    private BigDecimal amount;
+}

+ 14 - 0
hx-common/src/main/java/com/fjhx/common/mapper/flow/FlowExampleByWdlyMapper.java

@@ -0,0 +1,14 @@
+package com.fjhx.common.mapper.flow;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.common.entity.flow.vo.FlowExampleVoByWdly;
+import com.fjhx.flow.entity.flow.po.FlowExample;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.apache.ibatis.annotations.Param;
+
+public interface FlowExampleByWdlyMapper extends BaseMapper<FlowExample> {
+
+    Page<FlowExampleVoByWdly> selectExample(@Param("page") Page<Object> page, @Param("ew") IWrapper<FlowExample> wrapper);
+
+}

+ 11 - 0
hx-common/src/main/java/com/fjhx/common/service/flow/FlowExampleByWdlyService.java

@@ -0,0 +1,11 @@
+package com.fjhx.common.service.flow;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.common.entity.flow.vo.FlowExampleVoByWdly;
+import com.fjhx.flow.entity.flow.dto.FlowExampleSelectDto;
+
+public interface FlowExampleByWdlyService {
+
+    Page<FlowExampleVoByWdly> getToBeProcessedPage(FlowExampleSelectDto dto);
+
+}

+ 48 - 0
hx-common/src/main/java/com/fjhx/common/service/flow/impl/FlowExampleByWdlyServiceImpl.java

@@ -0,0 +1,48 @@
+package com.fjhx.common.service.flow.impl;
+
+import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.common.constant.SourceConstant;
+import com.fjhx.common.entity.flow.vo.FlowExampleVoByWdly;
+import com.fjhx.common.mapper.flow.FlowExampleByWdlyMapper;
+import com.fjhx.common.service.flow.FlowExampleByWdlyService;
+import com.fjhx.flow.entity.flow.dto.FlowExampleSelectDto;
+import com.fjhx.flow.entity.flow.po.FlowDefinition;
+import com.fjhx.flow.entity.flow.po.FlowExample;
+import com.fjhx.flow.entity.flow.vo.FlowExampleVo;
+import com.ruoyi.common.core.domain.BasePo;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.common.utils.wrapper.SqlField;
+import com.ruoyi.system.utils.UserUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class FlowExampleByWdlyServiceImpl extends ServiceImpl<FlowExampleByWdlyMapper, FlowExample> implements FlowExampleByWdlyService {
+
+    @Override
+    public Page<FlowExampleVoByWdly> getToBeProcessedPage(FlowExampleSelectDto dto) {
+        IWrapper<FlowExample> wrapper = IWrapper.getWrapper();
+        wrapper.lt("fe", FlowExample::getStatus, 2);
+        wrapper.eq("fe", FlowExample::getHandleUserId, SecurityUtils.getUserId());
+
+        wrapper.eq("fd", FlowDefinition::getFlowInfoId, dto.getFlowInfoId())
+                .keyword(dto,
+                        new SqlField("fe", FlowExample::getTitle),
+                        new SqlField("json_unquote( p.victoriatourist_json -> '$.contractCode' )")
+                )
+                .orderByDesc("fe", FlowExample::getId);
+
+        DynamicDataSourceContextHolder.push(SourceConstant.BASE);
+        Page<FlowExampleVoByWdly> page = baseMapper.selectExample(dto.getPage(), wrapper);
+        DynamicDataSourceContextHolder.poll();
+        List<FlowExampleVoByWdly> records = page.getRecords();
+
+        // 赋值流程发起人名称
+        UserUtil.assignmentNickName(records, BasePo::getCreateUser, FlowExampleVo::setCreateUserName);
+        return page;
+    }
+}

+ 24 - 0
hx-common/src/main/resources/mapper/flow/FlowExampleByWdlyMapper.xml

@@ -0,0 +1,24 @@
+<?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="com.fjhx.common.mapper.flow.FlowExampleByWdlyMapper">
+
+    <select id="selectExample" resultType="com.fjhx.common.entity.flow.vo.FlowExampleVoByWdly">
+        select fe.id,
+               fi.flow_key,
+               fi.flow_name,
+               fe.title,
+               fe.status,
+               fe.create_user,
+               fe.create_time,
+               fe.business_id,
+               fe.version,
+               json_unquote( p.victoriatourist_json -> '$.contractCode' ) AS code,
+               p.amount
+        from flow_info fi
+                 inner join flow_definition fd on fd.flow_info_id = fi.id
+                 inner join flow_example fe on fe.definition_id = fd.id
+                 LEFT JOIN bytesailing_purchase.purchase p ON p.flow_id = fe.id
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>