|
@@ -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;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|