Commit 3ab50131 by 赵剑炜

联调工作流

parent 62fed874
......@@ -45,3 +45,16 @@ Thumbs.db
/.idea/artifacts/jyzb3.xml
/jyzb-mq/jyzb-mq-consumer/target/classes/application.yml
/jyzb-mq/jyzb-mq-producer/target/classes/application.yml
/jyzb-mq/jyzb-mq-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
/jyzb-mq/jyzb-mq-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
/jyzb-mq/jyzb-mq-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
/jyzb-mq/jyzb-mq-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
/jyzb-mq/jyzb-mq-consumer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
/jyzb-mq/jyzb-mq-producer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
/jyzb-mq/jyzb-mq-producer/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
/jyzb-mq/jyzb-mq-producer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
/jyzb-mq/jyzb-mq-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
/jyzb-mq/jyzb-mq-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
/jyzb-mq/jyzb-mq-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
/jyzb-mq/jyzb-mq-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
/jyzb-boot/src/main/resources/application.yml
//package com.junmp.jyzb.api.bean.dto;
//
//import lombok.Data;
//
//@Data
//public class EquipmentSizeDto {
// /**
// * 号型ID
// */
// private String id;
//
// /**
// * 号型名称
// */
// private String name;
//}
//package com.junmp.jyzb.api.bean.dto;
//
//import lombok.Data;
//
//@Data
//public class EquipmentSupplierDto {
// /**
// * 类型ID
// */
// private String id;
//
// /**
// * 类型名称
// */
// private String name;
//}
//package com.junmp.jyzb.api.bean.dto;
//
//import lombok.Data;
//
//@Data
//public class EquipmentTypeDto {
// /**
// * 类型ID
// */
// private String id;
//
// /**
// * 类型名称
// */
// private String name;
//
//}
......@@ -100,7 +100,7 @@ public class Inventory implements Serializable {
* 质保期
*/
@TableField("warranty_period")
private int warrantyPeriod;
private long warrantyPeriod;
/**
* 维保期
......@@ -113,7 +113,11 @@ public class Inventory implements Serializable {
*/
@TableField("fix_count")
private int fixCount;
/**
* 维修次数
*/
@TableField("term_state")
private int TermState;
/**
* 位置类型
*/
......
package com.junmp.jyzb.task;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.junmp.jyzb.api.util.GenCodeUtil;
import com.junmp.jyzb.entity.Company;
import com.junmp.jyzb.entity.Inventory;
import com.junmp.jyzb.entity.ProductSku;
import com.junmp.jyzb.mapper.ExpireMapper;
import com.junmp.jyzb.mapper.MsgMapper;
import com.junmp.jyzb.service.InventoryService;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.job.api.JobAction;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -17,8 +28,8 @@ import java.util.Map;
* @Author: Zhaojw
* @Description: 过期物资消息提醒
* @DateTime: 2023/7/14 16:25
* @Params:
* @Return
* @Params:
* @Return
*/
@Slf4j
@Component
......@@ -27,13 +38,48 @@ public class InvExpireMsg implements JobAction {
@Resource
private ExpireMapper ExpireMapper;
@Resource
private ExpireMapper InvertoryMapper;
private InventoryService inventoryService;
@Override
public void action() {
Company company = new Company();
// int InvCount=
Map<String,Object> oneMsg = ExpireMapper.QueryTop1000ExpireInv();
LambdaQueryWrapper<Inventory> wrapper = new LambdaQueryWrapper<>();
// 分页参数
int pageSize = 1000; // 每页记录数,可以根据需求调整
int currentPage = 1; // 当前页数
//所有待判断的物资
wrapper.eq( Inventory::getTermState, 0);
long termCount= inventoryService.count(wrapper);
if (termCount>0)
{
// 分页查询
while ((currentPage - 1) * pageSize < termCount) {
processPageData( currentPage, pageSize);
currentPage++;
}
}
}
// 处理每页数据
private void processPageData(long pageSize, long currentPage)
{
LocalDate localdate =LocalDate.now();
// 使用LambdaQueryWrapper构建查询条件
LambdaQueryWrapper<Inventory> wrapper = Wrappers.lambdaQuery();
wrapper.eq( Inventory::getTermState, 0);
wrapper.apply("production_date <= DATE_SUB({0}, INTERVAL warranty_period DAY)", localdate);
//获取过质保期的物资信息
List<Inventory> page= inventoryService.page(PageFactory.getDefaultPage(pageSize,currentPage),wrapper).getRecords();
page.forEach(o->o.setTermState(1));
inventoryService.saveOrUpdateBatch(page);
// Page<Inventory> page = inventoryService.page(PageFactory.getDefaultPage(), wrapper)
}
}
......@@ -77,7 +77,7 @@ public class BpmnController {
}
/**
* 编辑表单
* 修改表单
*/
@ApiOperation("修改表单")
@PutMapping("updateForm")
......@@ -85,7 +85,16 @@ public class BpmnController {
return WorkProcessService.updateForm(process);
}
/**
* 编辑表单
* 修改表单名称和备注
*/
@ApiOperation("修改表单名称和备注")
@PostMapping("updateFormName")
public ApiRes<Boolean> updateFormName(@RequestBody UpdateProcessVO process) throws JsonProcessingException {
return ApiRes.success(WorkProcessService.updateFormName(process));
}
/**
* 转交
*/
@ApiOperation("轉交")
@PutMapping("turn")
......@@ -103,7 +112,6 @@ public class BpmnController {
public PageResult<HistoryProcessInstanceVO> applyList(@RequestBody ApplyDTO ApplyDTO) {
return WorkProcessService.applyList(ApplyDTO);
}
@ApiOperation("查看我的待办")
@PostMapping("toDoList")
public PageResult<TaskVO> toDoList(@RequestBody TaskDTO taskDTO){
......
......@@ -32,7 +32,16 @@ public interface WorkProcessService {
*
* @return
*/
ResponseResult updateForm(UpdateProcessVO process) throws JsonProcessingException;
ResponseResult updateForm(UpdateProcessVO process)
throws JsonProcessingException;
/**
* 编辑表单名称
*
* @return
*/
Boolean updateFormName(UpdateProcessVO process);
ResponseResult turn(TurnVo turns);
/**
......
......@@ -28,6 +28,8 @@ import com.junmp.junmpProcess.vo.*;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import com.junmp.v2.auth.api.bean.login.LoginUser;
import com.junmp.v2.auth.api.context.LoginContext;
import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.factory.PageResultFactory;
......@@ -231,7 +233,24 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
}
/**
* @Author: Zhaojw
* @Description: 修改表单名称
* @DateTime: 2023/7/21 14:30
* @Params:
* @Return
*/
public Boolean updateFormName(UpdateProcessVO process) {
ProcessTemplates processTemplates = processTemplateService.getById(process.getTemplateId());
processTemplates.setFormName(process.getFormName());
processTemplates.setRemark(process.getRemark());
processTemplates.setUpdated(new Date());
return processTemplateService.updateById(processTemplates);//更新表单明细表信息
}
/**
* 编辑表单详情
*
......@@ -243,12 +262,21 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
ObjectMapper objectMapper = new ObjectMapper();
JsonNode processJsonNode = objectMapper.readTree(process.getProcessJson());
JsonNode formJsonNode = objectMapper.readTree(process.getFormJson());
String formName=process.getFormName().toString();
String formName="";
String templateId = idWorker.nextId()+"";
ProcessTemplates processTemplates = processTemplateService.getById(process.getFormId());
processTemplates.setFormName(process.getFormName());
processTemplates.setFormJson(process.getFormJson());
processTemplates.setProcessJson(process.getProcessJson());
ProcessTemplates processTemplates = processTemplateService.getById(process.getTemplateId());
if (ObjectUtil.isNotEmpty(process.getFormName()))
{
formName= process.getFormName().toString();
processTemplates.setFormName(process.getFormName());
}
processTemplates.setFormJson(formJsonNode.toString());
processTemplates.setProcessJson(processJsonNode.toString());
String fj=process.getFormJson().toString();
// processTemplates.setFormJson(process.getFormJson().toString());
processTemplates.setProcessJson(process.getProcessJson().toString());
processTemplates.setUpdated(new Date());
processTemplateService.updateById(processTemplates);//更新表单明细表信息
BpmnModel bpmnModel = toBpmn(processJsonNode,formJsonNode,formName,templateId);
......@@ -505,19 +533,19 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
public ResponseResult start(StartProcessInstanceDTO processInstanceDto) {
try {
LoginUser StartUser= LoginContext.getContext().getLoginUser();
JSONObject formData = processInstanceDto.getFormData();
JunmpUserInfo startUserInfo = processInstanceDto.getStartUserInfo();
Authentication.setAuthenticatedUserId(startUserInfo.getUserId());
// JunmpUserInfo startUserInfo = processInstanceDto.getStartUserInfo();
Authentication.setAuthenticatedUserId(StartUser.getUserId().toString());
Map<String,Object> processVariables= new HashMap<>();
processVariables.put(FORM_VAR,formData);
processVariables.put(START_USER_INFO,JSONObject.toJSONString(startUserInfo));
processVariables.put(START_USER_INFO,JSONObject.toJSONString(StartUser));
processVariables.put(PROCESS_STATUS,BUSINESS_STATUS_1);
// processVariables.put("initiator",JSONObject.toJSONString(startUserInfo));
ArrayList<JunmpUserInfo> userInfos = CollUtil.newArrayList(startUserInfo);
ArrayList<LoginUser> userInfos = CollUtil.newArrayList(StartUser);
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
processVariables.putAll(formValue);
......@@ -526,10 +554,9 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
ProcessInstanceBuilder processInstanceBuilder = runtimeService.createProcessInstanceBuilder();
ProcessInstance processInstance = processInstanceBuilder
.processDefinitionId(processInstanceDto.getProcessDefinitionId())
.variable("initiator",startUserInfo.getUserId())
.variable("initiator",StartUser.getUserId())
.variables(processVariables)
.businessStatus(BUSINESS_STATUS_1)
.start();
//手动完成第一个任务
......@@ -562,19 +589,16 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
*/
@Override
public PageResult<HistoryProcessInstanceVO> applyList(ApplyDTO applyDTO) {
LoginUser StartUser= LoginContext.getContext().getLoginUser();
PageResult<HistoryProcessInstanceVO> pageResult=new PageResult<HistoryProcessInstanceVO>();
// List<Task> tasks = taskService.createTaskQuery()
// .taskCandidateOrAssigned(applyDTO.getCurrentUserInfo().getId())
// .list();
// List<Task> list = taskService.createTaskQuery().processInstanceId(processInstanceId).list();
List<HistoricProcessInstance> historicProcessInstances =
historyService.createHistoricProcessInstanceQuery()
.includeProcessVariables()
.startedBy(applyDTO.getCurrentUserInfo().getId())
.startedBy(StartUser.getUserId().toString())
.orderByProcessInstanceStartTime().desc()
.listPage((applyDTO.getPageNo() - 1) * applyDTO.getPageSize(), applyDTO.getPageSize());
long count = historyService.createHistoricProcessInstanceQuery()
.startedBy(applyDTO.getCurrentUserInfo().getId()).count();
.startedBy(StartUser.getUserId().toString()).count();
List<HistoryProcessInstanceVO> historyProcessInstanceVOS = new ArrayList<>();
Page<HistoryProcessInstanceVO> page = new Page<>();
for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
......@@ -618,11 +642,12 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
*/
@Override
public PageResult<TaskVO> toDoList(TaskDTO taskDTO) {
List<Task> tasks = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getUserId())
LoginUser StartUser= LoginContext.getContext().getLoginUser();
List<Task> tasks = taskService.createTaskQuery().taskAssignee(StartUser.getUserId().toString())
.includeProcessVariables()
.orderByTaskCreateTime().desc()
.listPage((taskDTO.getPageNo() - 1) * taskDTO.getPageSize(), taskDTO.getPageSize());
long count = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getUserId()).count();
long count = taskService.createTaskQuery().taskAssignee(StartUser.getUserId().toString()).count();
List<TaskVO> taskVOS= new ArrayList<>();
Page<TaskVO> page =new Page<>();
for (Task task : tasks) {
......@@ -665,14 +690,15 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
*/
@Override
public Result<Page<TaskVO>> doneList(TaskDTO taskDTO) {
LoginUser StartUser= LoginContext.getContext().getLoginUser();
List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery()
.taskAssignee(taskDTO.getCurrentUserInfo().getUserId())
.taskAssignee(StartUser.getUserId().toString())
.finished()
.includeProcessVariables()
.orderByTaskCreateTime().desc()
.listPage((taskDTO.getPageNo() - 1) * taskDTO.getPageSize(), taskDTO.getPageSize());
long count = historyService.createHistoricTaskInstanceQuery()
.taskAssignee(taskDTO.getCurrentUserInfo().getUserId()).count();
.taskAssignee(StartUser.getUserId().toString()).count();
List<TaskVO> taskVOS = new ArrayList<>();
Page<TaskVO> page = new Page<>();
for (HistoricTaskInstance task : tasks) {
......@@ -714,8 +740,9 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
@Override
public ResponseResult revoke(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
LoginUser StartUser= LoginContext.getContext().getLoginUser();
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(StartUser.getUserId().toString());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
......@@ -747,7 +774,8 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
}
@Override
public ResponseResult agree(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
LoginUser StartUser= LoginContext.getContext().getLoginUser();
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
......@@ -766,7 +794,7 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
}
runtimeService.setVariables(task.getProcessInstanceId(), map);//设置进入当前流程
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
Authentication.setAuthenticatedUserId(StartUser.getUserId().toString());
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
......@@ -809,7 +837,8 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
@Override
public Result delegateTask(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
LoginUser StartUser= LoginContext.getContext().getLoginUser();
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
......@@ -824,7 +853,7 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
}
runtimeService.setVariables(task.getProcessInstanceId(), map);
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
Authentication.setAuthenticatedUserId(StartUser.getUserId().toString());
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
......@@ -845,7 +874,8 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
@Override
public Result resolveTask(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
LoginUser StartUser= LoginContext.getContext().getLoginUser();
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
......@@ -860,7 +890,7 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
}
runtimeService.setVariables(task.getProcessInstanceId(), map);
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
Authentication.setAuthenticatedUserId(StartUser.getUserId().toString());
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
......@@ -880,8 +910,9 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
@Override
public ResponseResult refuse(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
LoginUser StartUser= LoginContext.getContext().getLoginUser();
Authentication.setAuthenticatedUserId(StartUser.getUserId().toString());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
......@@ -916,8 +947,9 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
@Override
public Result assignee(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
LoginUser StartUser= LoginContext.getContext().getLoginUser();
Authentication.setAuthenticatedUserId(StartUser.getUserId().toString());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
......@@ -950,8 +982,8 @@ public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper,
@Override
public Result rollback(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
LoginUser StartUser= LoginContext.getContext().getLoginUser();
Authentication.setAuthenticatedUserId(StartUser.getUserId().toString());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
......
......@@ -4,8 +4,9 @@ import lombok.Data;
@Data
public class UpdateProcessVO {
private String formId;
private String templateId;
private String formJson;
private String formName;
private String processJson;
private String remark;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论