Browse Source

审批流修改

1021934019@qq.com 4 years ago
parent
commit
3e50ea1dfa

+ 2 - 0
blade-service-api/blade-deliver-goods-api/src/main/java/org/springblade/deliver/goods/entity/DeliveryItems.java

@@ -270,6 +270,8 @@ public class DeliveryItems implements Serializable {
 		@ApiModelProperty(value = "商品类别名称")
 		private String priceCategoryNames;
 
+		@ApiModelProperty(value = "箱号")
+		private String cntrNo;
 
 
 }

+ 4 - 1
blade-service/blade-client/src/main/java/org/springblade/client/corps/service/impl/CorpsDescServiceImpl.java

@@ -1,5 +1,6 @@
 package org.springblade.client.corps.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -186,7 +187,9 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
 			corpsDesc.setAccountNameFcy(e.getAccountNameFcy());
 			corpsDesc.setTenantId(AuthUtil.getTenantId());
 			corpsDesc.setAccountNoFcy(e.getAccountNoFcy());
-			QueryWrapper<CorpsDesc> queryWrapper = Condition.getQueryWrapper(corpsDesc);
+			//名称相等视为重复数据
+			LambdaQueryWrapper<CorpsDesc> queryWrapper = new LambdaQueryWrapper<>();
+			queryWrapper.eq(CorpsDesc::getCname,corpsDesc.getCname());
 			CorpsDesc selectOne = baseMapper.selectOne(queryWrapper);
 			if(selectOne==null)
 			{

+ 3 - 1
blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsDescServiceImpl.java

@@ -339,7 +339,9 @@ public class GoodsDescServiceImpl extends ServiceImpl<GoodsDescMapper, GoodsDesc
 			goodsDesc.setPackgeunit(e.getPackgeunit());
 			goodsDesc.setRemarks(e.getRemarks());
 			goodsDesc.setGoodsTypeId(e.getTypeId());
-			QueryWrapper<GoodsDesc> queryWrapper = Condition.getQueryWrapper(goodsDesc);
+			//如果名称相等 就认为重复
+			LambdaQueryWrapper<GoodsDesc> queryWrapper = new LambdaQueryWrapper<>();
+			queryWrapper.eq(GoodsDesc::getCname,goodsDesc.getCname());
 			GoodsDesc one = goodsDescMapper.selectOne(queryWrapper);
 			if(one==null)
 			{

+ 66 - 0
blade-service/blade-desk/src/main/java/org/springblade/desk/controller/CheckController.java

@@ -0,0 +1,66 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.desk.controller;
+
+import lombok.AllArgsConstructor;
+import org.springblade.common.cache.CacheNames;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.tenant.annotation.NonDS;
+import org.springblade.core.tool.api.R;
+import org.springblade.desk.entity.ProcessLeave;
+import org.springblade.desk.service.ILeaveService;
+import org.springblade.system.user.cache.UserCache;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * 控制器
+ *
+ * @author Chill
+ */
+@NonDS
+@ApiIgnore
+@RestController
+@RequestMapping("/process/check")
+@AllArgsConstructor
+public class CheckController extends BladeController implements CacheNames {
+
+	private final ILeaveService leaveService;
+
+	/**
+	 * 详情
+	 *
+	 * @param businessId 主键
+	 */
+	@GetMapping("detail")
+	public R<ProcessLeave> detail(Long businessId) {
+		ProcessLeave detail = leaveService.getById(businessId);
+		detail.getFlow().setAssigneeName(UserCache.getUser(detail.getCreateUser()).getName());
+		return R.data(detail);
+	}
+
+	/**
+	 * 新增或修改
+	 *
+	 * @param leave 请假信息
+	 */
+	@PostMapping("start-process")
+	public R startProcess(@RequestBody ProcessLeave leave) {
+		return R.status(leaveService.startCheckProcess(leave));
+	}
+
+}

+ 11 - 0
blade-service/blade-desk/src/main/java/org/springblade/desk/entity/ProcessLeave.java

@@ -56,9 +56,20 @@ public class ProcessLeave extends FlowEntity {
 	 */
 	private String reason;
 	/**
+	 * 第一级审批人
+	 */
+	private String checkUser;
+
+	/**
+	 * 第二级审批人
+	 */
+	private String checkSecondsUser;
+
+	/**
 	 * 审批人
 	 */
 	private String taskUser;
+
 	/**
 	 * 流程申请时间
 	 */

+ 8 - 0
blade-service/blade-desk/src/main/java/org/springblade/desk/service/ILeaveService.java

@@ -34,4 +34,12 @@ public interface ILeaveService extends BaseService<ProcessLeave> {
 	 */
 	boolean startProcess(ProcessLeave leave);
 
+	/**
+	 * 开启流程
+	 *
+	 * @param check
+	 * @return boolean
+	 */
+	boolean startCheckProcess(ProcessLeave check);
+
 }

+ 34 - 0
blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/LeaveServiceImpl.java

@@ -78,4 +78,38 @@ public class LeaveServiceImpl extends BaseServiceImpl<LeaveMapper, ProcessLeave>
 		return true;
 	}
 
+	@Override
+	@Transactional
+	public boolean startCheckProcess(ProcessLeave check)
+	{
+		String businessTable = FlowUtil.getBusinessTable(ProcessConstant.LEAVE_KEY);
+		if (Func.isEmpty(check.getId())) {
+			// 保存leave
+			check.setApplyTime(DateUtil.now());
+			save(check);
+			// 启动流程
+			String CheckUser = TaskUtil.getTaskUser(check.getCheckUser());
+			String CheckSecondsUser = TaskUtil.getTaskUser(check.getCheckSecondsUser());
+			String applyUser = TaskUtil.getTaskUser(String.valueOf(AuthUtil.getUserId()));
+			Kv variables = Kv.create()
+				.set(ProcessConstant.TASK_VARIABLE_CREATE_USER, AuthUtil.getUserName())
+				.set("CheckUser", CheckUser)
+				.set("CheckSecondsUser", CheckSecondsUser)
+				.set("applyUser",applyUser );
+			R<BladeFlow> result = flowClient.startProcessInstanceById(check.getProcessDefinitionId(), FlowUtil.getBusinessKey(businessTable, String.valueOf(check.getId())), variables);
+			if (result.isSuccess()) {
+				log.debug("流程已启动,流程ID:" + result.getData().getProcessInstanceId());
+				// 返回流程id写入leave
+				check.setProcessInstanceId(result.getData().getProcessInstanceId());
+				updateById(check);
+			} else {
+				throw new ServiceException("操作失败,请关闭页面再次尝试");
+			}
+		} else {
+
+			updateById(check);
+		}
+		return true;
+	}
+
 }