Browse Source

重写审批流, 绑定业务逻辑

1021934019@qq.com 3 years ago
parent
commit
14ce057ec9
20 changed files with 970 additions and 39 deletions
  1. 43 0
      blade-service-api/blade-check-api/src/main/java/com/blade/check/dto/AuditProecessDTO.java
  2. 126 0
      blade-service-api/blade-check-api/src/main/java/com/blade/check/entity/AuditProecess.java
  3. 87 0
      blade-service-api/blade-check-api/src/main/java/com/blade/check/feign/ICheckClient.java
  4. 36 0
      blade-service-api/blade-check-api/src/main/java/com/blade/check/vo/AuditProecessVO.java
  5. 71 21
      blade-service/blade-check/src/main/java/com.blade.check/controller/AuditPathsActsController.java
  6. 21 3
      blade-service/blade-check/src/main/java/com.blade.check/controller/AuditPathsController.java
  7. 142 0
      blade-service/blade-check/src/main/java/com.blade.check/controller/AuditProecessController.java
  8. 2 0
      blade-service/blade-check/src/main/java/com.blade.check/entity/AuditItems.java
  9. 2 1
      blade-service/blade-check/src/main/java/com.blade.check/entity/AuditItemsUsers.java
  10. 4 1
      blade-service/blade-check/src/main/java/com.blade.check/entity/AuditPaths.java
  11. 8 2
      blade-service/blade-check/src/main/java/com.blade.check/entity/AuditPathsActs.java
  12. 3 0
      blade-service/blade-check/src/main/java/com.blade.check/entity/AuditPathsLevels.java
  13. 131 0
      blade-service/blade-check/src/main/java/com.blade.check/entity/AuditProecess.java
  14. 42 0
      blade-service/blade-check/src/main/java/com.blade.check/mapper/AuditProecessMapper.java
  15. 32 0
      blade-service/blade-check/src/main/java/com.blade.check/mapper/AuditProecessMapper.xml
  16. 4 0
      blade-service/blade-check/src/main/java/com.blade.check/service/IAuditPathsActsService.java
  17. 44 0
      blade-service/blade-check/src/main/java/com.blade.check/service/IAuditProecessService.java
  18. 21 0
      blade-service/blade-check/src/main/java/com.blade.check/service/impl/AuditPathsActsServiceImpl.java
  19. 56 11
      blade-service/blade-check/src/main/java/com.blade.check/service/impl/AuditPathsServiceImpl.java
  20. 95 0
      blade-service/blade-check/src/main/java/com.blade.check/service/impl/AuditProecessServiceImpl.java

+ 43 - 0
blade-service-api/blade-check-api/src/main/java/com/blade/check/dto/AuditProecessDTO.java

@@ -0,0 +1,43 @@
+/*
+ *      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 com.blade.check.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.blade.check.entity.AuditPathsLevels;
+import com.blade.check.entity.AuditProecess;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 审批流记录数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-12-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AuditProecessDTO extends AuditProecess {
+	private static final long serialVersionUID = 1L;
+
+	@TableField(exist = false)
+	private List<AuditPathsLevels> pathsLevelsList;
+
+
+
+}

+ 126 - 0
blade-service-api/blade-check-api/src/main/java/com/blade/check/entity/AuditProecess.java

@@ -0,0 +1,126 @@
+/*
+ *      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 com.blade.check.entity;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 审批流记录实体类
+ *
+ * @author BladeX
+ * @since 2021-12-08
+ */
+@Data
+@ApiModel(value = "AuditProecess对象", description = "审批流记录")
+public class AuditProecess implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	/**
+	* 1:财务清核
+	*/
+		@ApiModelProperty(value = "1:财务清核")
+		private Long actId;
+	/**
+	* 业务id
+	*/
+		@ApiModelProperty(value = "业务id")
+		private Long billId;
+	/**
+	* 单据编号
+	*/
+		@ApiModelProperty(value = "单据编号")
+		private String billNo;
+	/**
+	* 审核路径名
+	*/
+		@ApiModelProperty(value = "审核路径名")
+		private Long pathId;
+	/**
+	* 审核级次1.2.3
+	*/
+		@ApiModelProperty(value = "审核级次1.2.3")
+		private Integer levelId;
+	/**
+	* 请核人ID
+	*/
+		@ApiModelProperty(value = "请核人ID")
+		private Long sendUserId;
+	/**
+	* 请核人姓名
+	*/
+		@ApiModelProperty(value = "请核人姓名")
+		private String sendName;
+	/**
+	* 请核时间
+	*/
+		@ApiModelProperty(value = "请核时间")
+		private LocalDateTime sendTime;
+	/**
+	* 请核备注
+	*/
+		@ApiModelProperty(value = "请核备注")
+		private String sendMsg;
+	/**
+	* 审核人ID
+	*/
+		@ApiModelProperty(value = "审核人ID")
+		private Long auditUserId;
+	/**
+	* 审核通过时间
+	*/
+		@ApiModelProperty(value = "审核通过时间")
+		private LocalDateTime auditItem;
+	/**
+	* 审核时间
+	*/
+		@ApiModelProperty(value = "审核时间")
+		private LocalDateTime auditOpTime;
+	/**
+	* 审核意见
+	*/
+		@ApiModelProperty(value = "审核意见")
+		private String auditMsg;
+	/**
+	* O提交、N未知状态、S待审、B审核退回、A审核通过
+	*/
+		@ApiModelProperty(value = "O提交、N未知状态、S待审、B审核退回、A审核通过")
+		private String auditStatus;
+	/**
+	* 业务日期
+	*/
+		@ApiModelProperty(value = "业务日期")
+		private LocalDateTime billTime;
+	/**
+	* 存储对应审批字段
+	*/
+		@ApiModelProperty(value = "存储对应审批字段")
+		private String fidStatus;
+	/**
+	* 第几次提交审批
+	*/
+		@ApiModelProperty(value = "第几次提交审批")
+		private Integer times;
+
+
+}

+ 87 - 0
blade-service-api/blade-check-api/src/main/java/com/blade/check/feign/ICheckClient.java

@@ -0,0 +1,87 @@
+package com.blade.check.feign;
+
+
+import com.blade.check.entity.AuditPathsLevels;
+import org.springblade.core.tool.api.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@FeignClient(
+	value = "blade-check"
+)
+/**
+ * 商品信息对外访问API
+ */
+public interface ICheckClient {
+
+	//通过唯一的actId查询审批等级
+	@GetMapping("/auditpathsacts/listLevelsByActId")
+	List<AuditPathsLevels> listLevelsByActId(@RequestParam("actId") int actId,@RequestParam("fidStatus") int fidStatus);
+
+	//通过actId查询是否开启审批
+	@GetMapping("/auditpathsacts/getActsByActId")
+	AuditPathsLevels getActsByActId(@RequestParam("actId") int actId,@RequestParam("fidStatus") int fidStatus);
+
+	/**
+	 * 获取商品信息
+	 *
+	 * @param Id
+	 * @return
+	 *//*
+	@GetMapping(GOODSD_ESCMESSAGE)
+	R<GoodsDescVO> selectGoodsMessage(@RequestParam("Id") Long Id);
+	*//**
+	 * 获取商品信息
+	 *
+	 * @param code
+	 * @return
+	 *//*
+	@GetMapping(GOODS_BY_CODE)
+	R<GoodsDesc> GoodsByCode(@RequestParam("code") String code);
+
+	*//**
+	 * 获取所有商品基础信息
+	 *
+	 * @return 商品集合
+	 *//*
+	@GetMapping(GOODS_BASIC)
+	R<List<GoodsDescVO>> selectGoodsBasic();
+
+	*//**
+	 * 根据商品id获取商品规格
+	 * @param goodId
+	 * @return
+	 *//*
+	@GetMapping(GET_SPECIFICATION)
+	R<List<String>> getSpecification(@RequestParam("goodId") Long goodId);
+
+	*//**
+	 * 获取商品id
+	 * @param code
+	 * @param cname
+	 * @param brand
+	 * @param brandItem
+	 * @param placeProduction
+	 * @param specsOne
+	 * @param specsTwo
+	 * @return
+	 *//*
+	@GetMapping(GET_GOOD_ID)
+	List<Long> getGoodId(@RequestParam(value = "code",required = false)String code,@RequestParam(value = "cname",required = false)String cname,
+						 @RequestParam(value = "brand",required = false)String brand,@RequestParam(value = "brandItem",required = false)String brandItem,
+						 @RequestParam(value = "placeProduction",required = false)String placeProduction,
+						 @RequestParam(value = "specsOne",required = false)String specsOne,@RequestParam(value = "specsTwo",required = false)String specsTwo);
+
+	*//**
+	 * 获取商品类别
+	 * @param goodId
+	 * @return
+	 *//*
+	@GetMapping(GOOD_TYPE_ID)
+	GoodsType goodTypeId(@RequestParam("goodId") Long goodId);*/
+
+
+}

+ 36 - 0
blade-service-api/blade-check-api/src/main/java/com/blade/check/vo/AuditProecessVO.java

@@ -0,0 +1,36 @@
+/*
+ *      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 com.blade.check.vo;
+
+import com.blade.check.entity.AuditProecess;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 审批流记录视图实体类
+ *
+ * @author BladeX
+ * @since 2021-12-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AuditProecessVO对象", description = "审批流记录")
+public class AuditProecessVO extends AuditProecess {
+	private static final long serialVersionUID = 1L;
+
+}

+ 71 - 21
blade-service/blade-check/src/main/java/com.blade.check/controller/AuditPathsActsController.java

@@ -16,6 +16,12 @@
  */
 package com.blade.check.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.blade.check.entity.AuditPaths;
+import com.blade.check.entity.AuditPathsLevels;
+import com.blade.check.service.IAuditPathsLevelsService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -25,6 +31,7 @@ import javax.validation.Valid;
 
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springframework.web.bind.annotation.*;
@@ -34,6 +41,8 @@ import com.blade.check.vo.AuditPathsActsVO;
 import com.blade.check.service.IAuditPathsActsService;
 import org.springblade.core.boot.ctrl.BladeController;
 
+import java.util.List;
+
 /**
  * 审批流配置明细表 控制器
  *
@@ -48,31 +57,74 @@ public class AuditPathsActsController extends BladeController {
 
 	private final IAuditPathsActsService auditPathsActsService;
 
+	private final IAuditPathsLevelsService auditPathsLevelsService;
+
+
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "列表-审批流配置明细表", notes = "传入auditPathsActs")
+	public R<IPage<AuditPathsActs>> list(AuditPathsActs auditPathsActs, Query query)
+	{
+		LambdaQueryWrapper<AuditPathsActs> lambdaQueryWrapper=new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(AuditPathsActs::getTenantId, AuthUtil.getTenantId());
+		lambdaQueryWrapper.like(StringUtils.isNotBlank(auditPathsActs.getActName()),AuditPathsActs::getActName,auditPathsActs.getActName());
+		IPage<AuditPathsActs> pages = auditPathsActsService.page(Condition.getPage(query), lambdaQueryWrapper);
+		return R.data(pages);
+	}
+
+	@PostMapping("modify")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "保存-审批流配置明细表", notes = "传入auditPathsActs")
+	public R modify(@RequestBody List<AuditPathsActs> auditPathsActsList)
+	{
+		if(CollectionUtils.isEmpty(auditPathsActsList))
+		{
+			throw new SecurityException("传入数据为空");
+		}
+		auditPathsActsService.modify(auditPathsActsList);
+		return R.success("操作成功");
+	}
+
+	@GetMapping("listLevelsByActId")
+    public List<AuditPathsLevels> listLevelsByActId(@ApiParam(value = "feign接口专用,前端勿调", required = true) @RequestParam int actId,@ApiParam(value = "feign接口专用,前端勿调", required = true) @RequestParam String fidStatus)
+	{
+		AuditPathsActs pathsActs = auditPathsActsService.getOne(new LambdaQueryWrapper<AuditPathsActs>().eq(AuditPathsActs::getActId, actId).eq(AuditPathsActs::getFidStatus,fidStatus).eq(AuditPathsActs::getTenantId,AuthUtil.getTenantId()));
+		Long pathId = pathsActs.getPathId();
+		List<AuditPathsLevels> levelsList = auditPathsLevelsService.list(new LambdaQueryWrapper<AuditPathsLevels>().eq(AuditPathsLevels::getTenantId,AuthUtil.getTenantId()).eq(AuditPathsLevels::getPathId, pathId));
+		return levelsList;
+	}
+
+	@GetMapping("getActsByActId")
+	public AuditPathsActs getActsByActId(@ApiParam(value = "feign接口专用,前端勿调", required = true) @RequestParam int actId,@ApiParam(value = "feign接口专用,前端勿调", required = true) @RequestParam String fidStatus)
+	{
+		LambdaQueryWrapper<AuditPathsActs> auditPathsActsLambdaQueryWrapper=new LambdaQueryWrapper<>();
+		auditPathsActsLambdaQueryWrapper
+			.eq(AuditPathsActs::getFidStatus,fidStatus)
+			.eq(AuditPathsActs::getTenantId,AuthUtil.getTenantId())
+			.eq(AuditPathsActs::getActId,actId);
+	return 	auditPathsActsService.getOne(auditPathsActsLambdaQueryWrapper);
+	}
+
+
+
+
 	/**
 	 * 详情
-	 */
 	@GetMapping("/detail")
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "详情", notes = "传入auditPathsActs")
 	public R<AuditPathsActs> detail(AuditPathsActs auditPathsActs) {
 		AuditPathsActs detail = auditPathsActsService.getOne(Condition.getQueryWrapper(auditPathsActs));
 		return R.data(detail);
-	}
+	}*/
 
 	/**
 	 * 分页 审批流配置明细表
 	 */
-	@GetMapping("/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页", notes = "传入auditPathsActs")
-	public R<IPage<AuditPathsActs>> list(AuditPathsActs auditPathsActs, Query query) {
-		IPage<AuditPathsActs> pages = auditPathsActsService.page(Condition.getPage(query), Condition.getQueryWrapper(auditPathsActs));
-		return R.data(pages);
-	}
+
 
 	/**
 	 * 自定义分页 审批流配置明细表
-	 */
 	@GetMapping("/page")
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入auditPathsActs")
@@ -80,20 +132,18 @@ public class AuditPathsActsController extends BladeController {
 		IPage<AuditPathsActsVO> pages = auditPathsActsService.selectAuditPathsActsPage(Condition.getPage(query), auditPathsActs);
 		return R.data(pages);
 	}
-
+    */
 	/**
 	 * 新增 审批流配置明细表
-	 */
 	@PostMapping("/save")
 	@ApiOperationSupport(order = 4)
 	@ApiOperation(value = "新增", notes = "传入auditPathsActs")
 	public R save(@Valid @RequestBody AuditPathsActs auditPathsActs) {
 		return R.status(auditPathsActsService.save(auditPathsActs));
-	}
+	}*/
 
 	/**
 	 * 修改 审批流配置明细表
-	 */
 	@PostMapping("/update")
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "修改", notes = "传入auditPathsActs")
@@ -101,9 +151,9 @@ public class AuditPathsActsController extends BladeController {
 		return R.status(auditPathsActsService.updateById(auditPathsActs));
 	}
 
-	/**
+	*//**
 	 * 新增或修改 审批流配置明细表
-	 */
+	 *//*
 	@PostMapping("/submit")
 	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "新增或修改", notes = "传入auditPathsActs")
@@ -111,16 +161,16 @@ public class AuditPathsActsController extends BladeController {
 		return R.status(auditPathsActsService.saveOrUpdate(auditPathsActs));
 	}
 
-	
-	/**
+
+	*//**
 	 * 删除 审批流配置明细表
-	 */
+	 *//*
 	@PostMapping("/remove")
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "删除", notes = "传入ids")
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
 		return R.status(auditPathsActsService.removeByIds(Func.toLongList(ids)));
-	}
+	}*/
+
 
-	
 }

+ 21 - 3
blade-service/blade-check/src/main/java/com.blade.check/controller/AuditPathsController.java

@@ -19,7 +19,9 @@ package com.blade.check.controller;
 import com.alibaba.cloud.commons.lang.StringUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.blade.check.entity.AuditPathsActs;
 import com.blade.check.entity.AuditPathsLevels;
+import com.blade.check.service.IAuditPathsActsService;
 import com.blade.check.service.IAuditPathsLevelsService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -30,6 +32,7 @@ import javax.validation.Valid;
 
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springframework.web.bind.annotation.*;
@@ -57,6 +60,8 @@ public class AuditPathsController extends BladeController {
 
 	private final IAuditPathsLevelsService auditPathsLevelsService;
 
+	private final IAuditPathsActsService auditPathsActsService;
+
 	/**
 	 * 详情
 	 */
@@ -79,17 +84,18 @@ public class AuditPathsController extends BladeController {
 	public R<IPage<AuditPaths>> list(AuditPaths auditPaths, Query query) {
 		LambdaQueryWrapper<AuditPaths> lambdaQueryWrapper=new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.like(StringUtils.isNotBlank(auditPaths.getPathName()),AuditPaths::getPathName,auditPaths.getPathName())
+			.eq(AuditPaths::getTenantId, AuthUtil.getTenantId())
 			.orderByDesc(AuditPaths::getOpDate);
 		IPage<AuditPaths> pages = auditPathsService.page(Condition.getPage(query),lambdaQueryWrapper);
 		return R.data(pages);
 	}
 
 	/**
-	 *  新增或编辑审批流配置
+	 *  新增或编辑-审批流配置
 	 * */
 	 @PostMapping("/modify")
 	 @ApiOperationSupport(order = 3)
-	 @ApiOperation(value = "新增或编辑审批流配置", notes = "传入auditPaths")
+	 @ApiOperation(value = "新增或编辑-审批流配置", notes = "传入auditPaths")
 		public R modify(@Valid @RequestBody AuditPaths auditPaths)
 	 {
 			return R.data(auditPathsService.modify(auditPaths));
@@ -99,12 +105,24 @@ public class AuditPathsController extends BladeController {
 
 
 	/**
-	 * 删除 审批流配置主表
+	 * 删除-审批流配置主表
 	 */
 	@PostMapping("/remove")
 	@ApiOperationSupport(order = 4)
 	@ApiOperation(value = "删除-审批流配置主表", notes = "传入ids")
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		//todo 有进行中的禁止删除
+		List<Long> pathIds = Func.toLongList(ids);
+		pathIds.forEach(e->{
+			LambdaQueryWrapper<AuditPathsActs> lambdaQueryWrapper=new LambdaQueryWrapper<>();
+			lambdaQueryWrapper.eq(AuditPathsActs::getTenantId,AuthUtil.getTenantId())
+				.eq(AuditPathsActs::getPathId,e);
+			AuditPathsActs pathsActs = auditPathsActsService.getOne(lambdaQueryWrapper);
+			if(pathsActs!=null)
+			{
+				throw new SecurityException("审批已被使用无法删除");
+			}
+		});
 		return R.status(auditPathsService.removeByIds(Func.toLongList(ids)));
 	}
 

+ 142 - 0
blade-service/blade-check/src/main/java/com.blade.check/controller/AuditProecessController.java

@@ -0,0 +1,142 @@
+/*
+ *      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 com.blade.check.controller;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.blade.check.dto.AuditProecessDTO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.blade.check.entity.AuditProecess;
+import com.blade.check.vo.AuditProecessVO;
+import com.blade.check.service.IAuditProecessService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 审批流记录 控制器
+ *
+ * @author BladeX
+ * @since 2021-12-08
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/auditproecess")
+@Api(value = "审批流记录", tags = "审批流记录接口")
+public class AuditProecessController extends BladeController {
+
+	private final IAuditProecessService auditProecessService;
+
+	/**
+	 * 分页 审批流记录
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "列表-审批流记录", notes = "传入auditProecess")
+	public R<IPage<AuditProecess>> list(AuditProecess auditProecess, Query query) {
+		IPage<AuditProecess> pages = auditProecessService.page(Condition.getPage(query), Condition.getQueryWrapper(auditProecess));
+		return R.data(pages);
+	}
+
+	@PostMapping("createFinanceProcess")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "开启-审批流记录", notes = "传入auditProecessDTO")
+	public R<IPage<AuditProecess>> createFinanceProcess(@RequestBody  AuditProecessDTO auditProecessDTO)
+	{
+        if(CollectionUtils.isEmpty(auditProecessDTO.getPathsLevelsList()))
+        {
+        	throw new SecurityException("传入审批等级列表失败");
+		}
+		auditProecessService.createFinanceProcess(auditProecessDTO);
+        return R.success("操作成功");
+	}
+
+
+	/**
+	 * 详情
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入auditProecess")
+	public R<AuditProecess> detail(AuditProecess auditProecess) {
+		AuditProecess detail = auditProecessService.getOne(Condition.getQueryWrapper(auditProecess));
+		return R.data(detail);
+	}*/
+
+
+
+	/**
+	 * 自定义分页 审批流记录
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入auditProecess")
+	public R<IPage<AuditProecessVO>> page(AuditProecessVO auditProecess, Query query) {
+		IPage<AuditProecessVO> pages = auditProecessService.selectAuditProecessPage(Condition.getPage(query), auditProecess);
+		return R.data(pages);
+	}
+
+	*//**
+	 * 新增 审批流记录
+	 *//*
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入auditProecess")
+	public R save(@Valid @RequestBody AuditProecess auditProecess) {
+		return R.status(auditProecessService.save(auditProecess));
+	}
+
+	*//**
+	 * 修改 审批流记录
+	 *//*
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入auditProecess")
+	public R update(@Valid @RequestBody AuditProecess auditProecess) {
+		return R.status(auditProecessService.updateById(auditProecess));
+	}
+
+	*//**
+	 * 新增或修改 审批流记录
+	 *//*
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入auditProecess")
+	public R submit(@Valid @RequestBody AuditProecess auditProecess) {
+		return R.status(auditProecessService.saveOrUpdate(auditProecess));
+	}
+
+
+	*//**
+	 * 删除 审批流记录
+	 *//*
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(auditProecessService.removeByIds(Func.toLongList(ids)));
+	}*/
+
+
+}

+ 2 - 0
blade-service/blade-check/src/main/java/com.blade.check/entity/AuditItems.java

@@ -150,5 +150,7 @@ public class AuditItems implements Serializable {
 		@ApiModelProperty(value = "第几次提交审批")
 		private Integer times;
 
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
 
 }

+ 2 - 1
blade-service/blade-check/src/main/java/com.blade.check/entity/AuditItemsUsers.java

@@ -70,5 +70,6 @@ public class AuditItemsUsers implements Serializable {
 		@ApiModelProperty(value = "第几次提交审批")
 		private Integer times;
 
-
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
 }

+ 4 - 1
blade-service/blade-check/src/main/java/com.blade.check/entity/AuditPaths.java

@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import java.io.Serializable;
+import java.util.Date;
 import java.util.List;
 
 import lombok.Data;
@@ -66,7 +67,7 @@ public class AuditPaths implements Serializable {
 	* 维护时间
 	*/
 		@ApiModelProperty(value = "维护时间")
-		private LocalDateTime opDate;
+		private Date opDate;
 	/**
 	* 承包单位id
 	*/
@@ -88,4 +89,6 @@ public class AuditPaths implements Serializable {
 		private List<AuditPathsLevels> auditPathsLevels;
 
 
+		@ApiModelProperty(value = "租户id")
+		private String tenantId;
 }

+ 8 - 2
blade-service/blade-check/src/main/java/com.blade.check/entity/AuditPathsActs.java

@@ -46,8 +46,8 @@ public class AuditPathsActs implements Serializable {
 	/**
 	* 活动号
 	*/
-		@ApiModelProperty(value = "活动号")
-		private Integer actId;
+		@ApiModelProperty(value = "1:代表财务清核 ")
+		private int actId;
 	/**
 	* 审核条件(O是正常审批,I非正常审批)
 	*/
@@ -64,5 +64,11 @@ public class AuditPathsActs implements Serializable {
 		@ApiModelProperty(value = "存储对应审批字段")
 		private String fidStatus;
 
+		@ApiModelProperty(value = "活动名")
+		private String actName;
+
+		@ApiModelProperty(value = "租户id")
+		private String tenantId;
+
 
 }

+ 3 - 0
blade-service/blade-check/src/main/java/com.blade.check/entity/AuditPathsLevels.java

@@ -74,5 +74,8 @@ public class AuditPathsLevels implements Serializable {
 		@ApiModelProperty(value = "备注")
 		private String remarks;
 
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
 
 }

+ 131 - 0
blade-service/blade-check/src/main/java/com.blade.check/entity/AuditProecess.java

@@ -0,0 +1,131 @@
+/*
+ *      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 com.blade.check.entity;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 审批流记录实体类
+ *
+ * @author BladeX
+ * @since 2021-12-08
+ */
+@Data
+@ApiModel(value = "AuditProecess对象", description = "审批流记录")
+public class AuditProecess implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	/**
+	* 1:财务清核
+	*/
+		@ApiModelProperty(value = "1:财务清核")
+		private int actId;
+	/**
+	* 业务id
+	*/
+		@ApiModelProperty(value = "业务id")
+		private Long billId;
+	/**
+	* 单据编号
+	*/
+		@ApiModelProperty(value = "单据编号")
+		private String billNo;
+	/**
+	* 审核路径名
+	*/
+		@ApiModelProperty(value = "审核路径名")
+		private Long pathId;
+	/**
+	* 审核级次1.2.3
+	*/
+		@ApiModelProperty(value = "审核级次1.2.3")
+		private Integer levelId;
+	/**
+	* 请核人ID
+	*/
+		@ApiModelProperty(value = "请核人ID")
+		private Long sendUserId;
+	/**
+	* 请核人姓名
+	*/
+		@ApiModelProperty(value = "请核人姓名")
+		private String sendName;
+	/**
+	* 请核时间
+	*/
+		@ApiModelProperty(value = "请核时间")
+		private Date sendTime;
+	/**
+	* 请核备注
+	*/
+		@ApiModelProperty(value = "请核备注")
+		private String sendMsg;
+	/**
+	* 审核人ID
+	*/
+		@ApiModelProperty(value = "审核人ID")
+		private String auditUserId;
+	/**
+	* 审核通过时间
+	*/
+		@ApiModelProperty(value = "审核通过时间")
+		private LocalDateTime auditItem;
+	/**
+	* 审核时间
+	*/
+		@ApiModelProperty(value = "审核时间")
+		private LocalDateTime auditOpTime;
+	/**
+	* 审核意见
+	*/
+		@ApiModelProperty(value = "审核意见")
+		private String auditMsg;
+	/**
+	* O提交、N未知状态、S待审、B审核退回、A审核通过
+	*/
+		@ApiModelProperty(value = "O提交、N未知状态、S待审、B审核退回、A审核通过")
+		private String auditStatus;
+	/**
+	* 业务日期
+	*/
+		@ApiModelProperty(value = "业务日期")
+		private LocalDateTime billTime;
+	/**
+	* 存储对应审批字段
+	*/
+		@ApiModelProperty(value = "存储对应审批字段")
+		private String fidStatus;
+	/**
+	* 第几次提交审批
+	*/
+		@ApiModelProperty(value = "第几次提交审批")
+		private Integer times;
+
+	    @ApiModelProperty(value = "租户id")
+		private String tenantId;
+
+
+}

+ 42 - 0
blade-service/blade-check/src/main/java/com.blade.check/mapper/AuditProecessMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      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 com.blade.check.mapper;
+
+import com.blade.check.entity.AuditProecess;
+import com.blade.check.vo.AuditProecessVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 审批流记录 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-12-08
+ */
+public interface AuditProecessMapper extends BaseMapper<AuditProecess> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param auditProecess
+	 * @return
+	 */
+	List<AuditProecessVO> selectAuditProecessPage(IPage page, AuditProecessVO auditProecess);
+
+}

+ 32 - 0
blade-service/blade-check/src/main/java/com.blade.check/mapper/AuditProecessMapper.xml

@@ -0,0 +1,32 @@
+<?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.blade.check.mapper.AuditProecessMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="auditProecessResultMap" type="com.blade.check.entity.AuditProecess">
+        <id column="id" property="id"/>
+        <result column="act_id" property="actId"/>
+        <result column="bill_id" property="billId"/>
+        <result column="bill_no" property="billNo"/>
+        <result column="path_id" property="pathId"/>
+        <result column="level_id" property="levelId"/>
+        <result column="send_user_id" property="sendUserId"/>
+        <result column="send_name" property="sendName"/>
+        <result column="send_time" property="sendTime"/>
+        <result column="send_msg" property="sendMsg"/>
+        <result column="audit_user_id" property="auditUserId"/>
+        <result column="audit_item" property="auditItem"/>
+        <result column="audit_op_time" property="auditOpTime"/>
+        <result column="audit_msg" property="auditMsg"/>
+        <result column="audit_status" property="auditStatus"/>
+        <result column="bill_time" property="billTime"/>
+        <result column="fid_status" property="fidStatus"/>
+        <result column="times" property="times"/>
+    </resultMap>
+
+
+    <select id="selectAuditProecessPage" resultMap="auditProecessResultMap">
+        select * from audit_proecess where is_deleted = 0
+    </select>
+
+</mapper>

+ 4 - 0
blade-service/blade-check/src/main/java/com.blade.check/service/IAuditPathsActsService.java

@@ -21,6 +21,8 @@ import com.blade.check.vo.AuditPathsActsVO;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import java.util.List;
+
 /**
  * 审批流配置明细表 服务类
  *
@@ -38,4 +40,6 @@ public interface IAuditPathsActsService extends IService<AuditPathsActs> {
 	 */
 	IPage<AuditPathsActsVO> selectAuditPathsActsPage(IPage<AuditPathsActsVO> page, AuditPathsActsVO auditPathsActs);
 
+
+	void modify(List<AuditPathsActs> list);
 }

+ 44 - 0
blade-service/blade-check/src/main/java/com.blade.check/service/IAuditProecessService.java

@@ -0,0 +1,44 @@
+/*
+ *      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 com.blade.check.service;
+
+import com.blade.check.dto.AuditProecessDTO;
+import com.blade.check.entity.AuditProecess;
+import com.blade.check.vo.AuditProecessVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 审批流记录 服务类
+ *
+ * @author BladeX
+ * @since 2021-12-08
+ */
+public interface IAuditProecessService extends IService<AuditProecess> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param auditProecess
+	 * @return
+	 */
+	IPage<AuditProecessVO> selectAuditProecessPage(IPage<AuditProecessVO> page, AuditProecessVO auditProecess);
+
+	void  createFinanceProcess(AuditProecessDTO auditProecessDTO);
+
+}

+ 21 - 0
blade-service/blade-check/src/main/java/com.blade.check/service/impl/AuditPathsActsServiceImpl.java

@@ -21,9 +21,12 @@ import com.blade.check.vo.AuditPathsActsVO;
 import com.blade.check.mapper.AuditPathsActsMapper;
 import com.blade.check.service.IAuditPathsActsService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import java.util.List;
+
 /**
  * 审批流配置明细表 服务实现类
  *
@@ -38,4 +41,22 @@ public class AuditPathsActsServiceImpl extends ServiceImpl<AuditPathsActsMapper,
 		return page.setRecords(baseMapper.selectAuditPathsActsPage(page, auditPathsActs));
 	}
 
+	@Override
+	public void modify(List<AuditPathsActs> list)
+	{
+		list.forEach(e->{
+			//新增
+			if(e.getId()==null)
+			{
+				e.setTenantId(AuthUtil.getTenantId());
+				baseMapper.insert(e);
+			}
+			//编辑
+			else
+			{
+				baseMapper.updateById(e);
+			}
+		});
+	}
+
 }

+ 56 - 11
blade-service/blade-check/src/main/java/com.blade.check/service/impl/AuditPathsServiceImpl.java

@@ -16,19 +16,25 @@
  */
 package com.blade.check.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.blade.check.entity.AuditPaths;
 import com.blade.check.entity.AuditPathsLevels;
+import com.blade.check.mapper.AuditPathsLevelsMapper;
 import com.blade.check.vo.AuditPathsVO;
 import com.blade.check.mapper.AuditPathsMapper;
 import com.blade.check.service.IAuditPathsService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 审批流配置主表 服务实现类
@@ -39,6 +45,9 @@ import java.util.List;
 @Service
 public class AuditPathsServiceImpl extends ServiceImpl<AuditPathsMapper, AuditPaths> implements IAuditPathsService {
 
+	@Autowired
+	private AuditPathsLevelsMapper auditPathsLevelsMapper;
+
 	@Override
 	public IPage<AuditPathsVO> selectAuditPathsPage(IPage<AuditPathsVO> page, AuditPathsVO auditPaths) {
 		return page.setRecords(baseMapper.selectAuditPathsPage(page, auditPaths));
@@ -48,21 +57,13 @@ public class AuditPathsServiceImpl extends ServiceImpl<AuditPathsMapper, AuditPa
 	@Transactional
 	public AuditPaths modify(AuditPaths auditPaths)
 	{
+
+
 		List<AuditPathsLevels> auditPathsLevels = auditPaths.getAuditPathsLevels();
 		if(CollectionUtils.isEmpty(auditPathsLevels))
 		{
 			throw new SecurityException("无级次信息,请检查数据后提交");
 		}
-		//新增
-		if(auditPaths.getId()==null)
-		{
-
-		}
-		else
-		{
-
-		}
-
 		//校验最后一级审核个数
 		long lastCount = auditPathsLevels.stream().filter(e -> e.getIffinalItem().equals("T")).count();
 		if(lastCount>1)
@@ -76,7 +77,51 @@ public class AuditPathsServiceImpl extends ServiceImpl<AuditPathsMapper, AuditPa
 			throw new SecurityException("审核级次中存在未补充审批人或者角色");
 		}
 
-		return null;
+		//新增操作
+		if(auditPaths.getId()==null)
+		{
+			auditPaths.setOpUserName(AuthUtil.getUserName());
+			auditPaths.setOpUserId(AuthUtil.getUserId());
+			auditPaths.setOpDate(new Date());
+			auditPaths.setTenantId(AuthUtil.getTenantId());
+			baseMapper.insert(auditPaths);
+			auditPathsLevels.forEach(e->{
+				e.setPathId(auditPaths.getId());
+				e.setTenantId(AuthUtil.getTenantId());
+				auditPathsLevelsMapper.insert(e);
+			});
+		}
+		//修改操作
+		else
+		{
+			//如果是修改操作,需要删除之前的审核路径
+			LambdaQueryWrapper<AuditPathsLevels> auditPathsLevelsLambdaQueryWrapper=new LambdaQueryWrapper<>();
+			auditPathsLevelsLambdaQueryWrapper.eq(AuditPathsLevels::getPathId,auditPaths.getId());
+			List<Long> ids = auditPathsLevelsMapper.selectList(auditPathsLevelsLambdaQueryWrapper).stream().map(AuditPathsLevels::getId).collect(Collectors.toList());
+            if(CollectionUtils.isNotEmpty(ids))
+            {
+				auditPathsLevelsMapper.deleteBatchIds(ids);
+			}
+
+			baseMapper.updateById(auditPaths);
+			auditPathsLevels.forEach(lt->{
+                //新增
+				if(lt.getId()!=null)
+				{
+					lt.setPathId(auditPaths.getId());
+					lt.setTenantId(AuthUtil.getTenantId());
+					auditPathsLevelsMapper.insert(lt);
+				}
+				//修改
+				else
+				{
+					auditPathsLevelsMapper.updateById(lt);
+				}
+
+			});
+
+		}
+		return auditPaths;
 	}
 
 }

+ 95 - 0
blade-service/blade-check/src/main/java/com.blade.check/service/impl/AuditProecessServiceImpl.java

@@ -0,0 +1,95 @@
+/*
+ *      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 com.blade.check.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.blade.check.dto.AuditProecessDTO;
+import com.blade.check.entity.AuditPathsActs;
+import com.blade.check.entity.AuditPathsLevels;
+import com.blade.check.entity.AuditProecess;
+import com.blade.check.mapper.AuditPathsActsMapper;
+import com.blade.check.vo.AuditProecessVO;
+import com.blade.check.mapper.AuditProecessMapper;
+import com.blade.check.service.IAuditProecessService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 审批流记录 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-12-08
+ */
+@Service
+public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, AuditProecess> implements IAuditProecessService
+{
+    private AuditPathsActsMapper auditPathsActsMapper;
+
+	@Override
+	public IPage<AuditProecessVO> selectAuditProecessPage(IPage<AuditProecessVO> page, AuditProecessVO auditProecess) {
+		return page.setRecords(baseMapper.selectAuditProecessPage(page, auditProecess));
+	}
+
+	@Override
+	@Transactional
+	public void createFinanceProcess(AuditProecessDTO auditProecessDTO)
+	{
+		List<AuditPathsLevels> pathsLevelsList = auditProecessDTO.getPathsLevelsList();
+		pathsLevelsList.forEach(e->{
+			AuditProecess auditProecess=new AuditProecess();
+			auditProecess.setActId(auditProecessDTO.getActId());
+			auditProecess.setBillId(auditProecessDTO.getBillId());
+			auditProecess.setBillNo(auditProecessDTO.getBillNo());
+			auditProecess.setPathId(e.getPathId());
+			auditProecess.setLevelId(e.getLevelId());
+			auditProecess.setSendUserId(auditProecessDTO.getSendUserId());
+			auditProecess.setSendName(auditProecessDTO.getSendName());
+			auditProecess.setSendTime(auditProecessDTO.getSendTime());
+			auditProecess.setSendMsg(auditProecessDTO.getSendMsg());
+			auditProecess.setAuditUserId(e.getAuditUserId());
+			if(e.getLevelId()==1)
+			{
+				auditProecess.setAuditStatus("Q");
+			}
+			//除了第一级是待审,其他都N
+			else
+			{
+				auditProecess.setAuditStatus("N");
+			}
+			LambdaQueryWrapper<AuditPathsActs> actsLambdaQueryWrapper=new LambdaQueryWrapper<>();
+			actsLambdaQueryWrapper
+				.eq(AuditPathsActs::getPathId,e.getPathId())
+				.eq(AuditPathsActs::getTenantId, AuthUtil.getTenantId())
+				.eq(AuditPathsActs::getActId,auditProecessDTO.getActId());
+			AuditPathsActs auditPathsActs = auditPathsActsMapper.selectOne(actsLambdaQueryWrapper);
+			if(auditPathsActs!=null)
+			{
+				auditProecess.setFidStatus(auditPathsActs.getFidStatus());
+			}
+			auditProecess.setTenantId(AuthUtil.getTenantId());
+			baseMapper.insert(auditProecess);
+		});
+	}
+
+}