Procházet zdrojové kódy

外购存货流程BUG修改

yewc před 1 rokem
rodič
revize
185b499cd9

+ 77 - 0
zjugis-business/src/main/java/com/zjugis/business/controller/OutsourceApplyController.java

@@ -0,0 +1,77 @@
+package com.zjugis.business.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zjugis.business.bean.dto.OutsourceApplyDto;
+import com.zjugis.business.bean.entity.OutsourceApply;
+import com.zjugis.business.service.OutsourceApplyService;
+import com.zjugis.framework.common.pojo.CommonResult;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * (OUTSOURCE_APPLY)表控制层
+ *
+ * @author ljy
+ * @since 2024-03-12 18:51:36
+ */
+@RestController
+public class OutsourceApplyController {
+    /**
+     * 服务对象
+     */
+    @Resource
+    private OutsourceApplyService outsourceApplyService;
+
+    @GetMapping("/outsourceApply/page")
+    public CommonResult<Page<OutsourceApply>> page(@RequestBody OutsourceApplyDto outsourceApplyDto) {
+        return CommonResult.success(outsourceApplyService.page(outsourceApplyDto));
+    }
+
+
+    /**
+     * 通过主键查询单条数据
+     *
+     * @param id 主键
+     * @return 单条数据
+     */
+    @GetMapping("/outsourceApply")
+    public CommonResult<OutsourceApply> queryById(@RequestParam("id") String id) {
+        return CommonResult.success(outsourceApplyService.queryById(id));
+    }
+
+    /**
+     * 新增数据
+     *
+     * @param outsourceApply 实体
+     * @return 新增结果
+     */
+    @PostMapping("/outsourceApply")
+    public CommonResult<String> create(@RequestBody OutsourceApply outsourceApply) {
+        return CommonResult.success(outsourceApplyService.insert(outsourceApply));
+    }
+
+    /**
+     * 编辑数据
+     *
+     * @param outsourceApply 实体
+     * @return 编辑结果
+     */
+    @PutMapping("/outsourceApply")
+    public CommonResult update(@RequestBody OutsourceApply outsourceApply) {
+        return CommonResult.success(outsourceApplyService.update(outsourceApply));
+    }
+
+    /**
+     * 删除数据
+     *
+     * @return 删除是否成功
+     */
+    @DeleteMapping("/outsourceApply")
+    public CommonResult<Integer> deleteByIds(@RequestBody List<String> idList) {
+        return CommonResult.success(outsourceApplyService.deleteByIdList(idList));
+    }
+
+}
+

+ 57 - 0
zjugis-business/src/main/java/com/zjugis/business/service/OutsourceApplyService.java

@@ -0,0 +1,57 @@
+package com.zjugis.business.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zjugis.business.bean.dto.OutsourceApplyDto;
+import com.zjugis.business.bean.entity.OutsourceApply;
+
+import java.util.List;
+
+/**
+ * (OUTSOURCE_APPLY)表服务接口
+ *
+ * @author ljy
+ * @since 2024-03-12 18:51:40
+ */
+public interface OutsourceApplyService {
+
+    Page<OutsourceApply> page(OutsourceApplyDto outsourceApplyDto);
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    OutsourceApply queryById(String id);
+
+    OutsourceApply selectByInstanceId(String id);
+
+    /**
+     * 新增数据
+     *
+     * @param outsourceApply 实例对象
+     * @return 实例对象
+     */
+    String insert(OutsourceApply outsourceApply);
+
+    /**
+     * 修改数据
+     *
+     * @param outsourceApply 实例对象
+     * @return 实例对象
+     */
+    int update(OutsourceApply outsourceApply);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    int deleteById(String id);
+
+    int deleteByIdList(List<String> ids);
+
+    String process(String projectId);
+}
+

+ 130 - 0
zjugis-business/src/main/java/com/zjugis/business/service/impl/OutsourceApplyServiceImpl.java

@@ -0,0 +1,130 @@
+package com.zjugis.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zjugis.business.bean.dto.OutsourceApplyDto;
+import com.zjugis.business.bean.entity.OutsourceApply;
+import com.zjugis.business.constants.FlowStatusConstants;
+import com.zjugis.business.mapper.OutsourceApplyMapper;
+import com.zjugis.business.service.OutsourceApplyService;
+import com.zjugis.framework.common.pojo.CommonResult;
+import com.zjugis.framework.security.core.util.SecurityFrameworkUtils;
+import com.zjugis.framework.workflow.model.ProcessDto;
+import com.zjugis.framework.workflow.rpc.remote.WorkflowClient;
+import com.zjugis.framework.workflow.utils.UrlUtils;
+import com.zjugis.module.system.api.user.AdminUserApi;
+import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * (OUTSOURCE_APPLY)表服务实现类
+ *
+ * @author ljy
+ * @since 2024-03-12 18:51:40
+ */
+@Service
+public class OutsourceApplyServiceImpl implements OutsourceApplyService {
+    @Resource
+    private OutsourceApplyMapper outsourceApplyMapper;
+
+    @Autowired
+    private AdminUserApi adminUserApi;
+    @Autowired
+    private WorkflowClient workflowClient;
+
+
+    @Override
+    public Page<OutsourceApply> page(OutsourceApplyDto outsourceApplyDto) {
+        Page<OutsourceApply> page = new Page<>(outsourceApplyDto.getPageNo(),outsourceApplyDto.getPageSize());
+        QueryWrapper<OutsourceApply> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("ISVALID",1);
+        return outsourceApplyMapper.selectPage(page,queryWrapper);
+    }
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    @Override
+    public OutsourceApply queryById(String id) {
+        return outsourceApplyMapper.selectById(id);
+    }
+
+    @Override
+    public OutsourceApply selectByInstanceId(String id) {
+        QueryWrapper<OutsourceApply> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("INSTANCE_ID",id);
+        return outsourceApplyMapper.selectOne(queryWrapper);
+    }
+
+    /**
+     * 新增数据
+     *
+     * @param outsourceApply 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public String insert(OutsourceApply outsourceApply) {
+        outsourceApply.setIsvalid(1);
+        this.outsourceApplyMapper.insert(outsourceApply);
+        return outsourceApply.getId();
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param outsourceApply 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public int update(OutsourceApply outsourceApply) {
+        return this.outsourceApplyMapper.updateById(outsourceApply);
+    }
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    @Override
+    public int deleteById(String id) {
+        return this.outsourceApplyMapper.deleteById(id);
+    }
+
+
+    @Override
+    public int deleteByIdList(List<String> ids) {
+        return this.outsourceApplyMapper.deleteBatchIds(ids);
+    }
+
+    /**
+     * @param projectId
+     * @return
+     */
+    @Override
+    public String process(String projectId) {
+        String userId = SecurityFrameworkUtils.getLoginUserId();
+        CommonResult<AdminUserRespDTO> userResp = adminUserApi.getUser(userId);
+        String mark = "wbhtsq";
+        ProcessDto processDto = new ProcessDto();
+        processDto.setFlowTemplateMark(mark);
+        processDto.setPromoterId(userId);
+        String returnUrl = workflowClient.createProcess(processDto);
+        OutsourceApply entity = new OutsourceApply();
+        entity.setInstanceId(UrlUtils.getParam(returnUrl,"flowInstanceId"));
+        entity.setProjectId(projectId);
+        entity.setApplyWorker(userResp.getCheckedData().getNickname());
+        entity.setApplyWorkerId(userId);
+        entity.setFlowStatus(FlowStatusConstants.FLOW_NOT_START);
+        insert(entity);
+        return returnUrl;
+    }
+}
+