Browse Source

Merge remote-tracking branch 'origin/dev' into dev

lazhaoqian 4 years ago
parent
commit
31fb19cd96
25 changed files with 794 additions and 96 deletions
  1. 3 0
      blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/entity/BladeFlow.java
  2. 12 0
      blade-ops/blade-flow/pom.xml
  3. 12 0
      blade-ops/blade-flow/src/main/java/org/springblade/flow/business/controller/WorkController.java
  4. 9 0
      blade-ops/blade-flow/src/main/java/org/springblade/flow/business/service/FlowBusinessService.java
  5. 77 0
      blade-ops/blade-flow/src/main/java/org/springblade/flow/business/service/impl/FlowBusinessServiceImpl.java
  6. 2 0
      blade-service-api/blade-deliver-goods-api/src/main/java/org/springblade/deliver/goods/entity/DeliveryItems.java
  7. 8 0
      blade-service-api/blade-desk-api/pom.xml
  8. 83 0
      blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/ProcessLeave.java
  9. 51 0
      blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/feign/IProcessLeaveClient.java
  10. 44 0
      blade-service-api/blade-project-api/src/main/java/org/springblade/project/feign/IProjectItemClient.java
  11. 6 0
      blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/OrderItems.java
  12. 6 0
      blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/entity/OrderItems.java
  13. 29 3
      blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsDescController.java
  14. 25 3
      blade-service/blade-client/src/main/java/org/springblade/client/corps/excel/CorpsExcel.java
  15. 56 41
      blade-service/blade-client/src/main/java/org/springblade/client/corps/service/impl/CorpsDescServiceImpl.java
  16. 24 3
      blade-service/blade-client/src/main/java/org/springblade/client/goods/controller/GoodsDescController.java
  17. 33 6
      blade-service/blade-client/src/main/java/org/springblade/client/goods/excel/GoodsExcel.java
  18. 60 40
      blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsDescServiceImpl.java
  19. 6 0
      blade-service/blade-desk/pom.xml
  20. 66 0
      blade-service/blade-desk/src/main/java/org/springblade/desk/controller/CheckController.java
  21. 16 0
      blade-service/blade-desk/src/main/java/org/springblade/desk/entity/ProcessLeave.java
  22. 54 0
      blade-service/blade-desk/src/main/java/org/springblade/desk/feign/ProcessClient.java
  23. 8 0
      blade-service/blade-desk/src/main/java/org/springblade/desk/service/ILeaveService.java
  24. 50 0
      blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/LeaveServiceImpl.java
  25. 54 0
      blade-service/blade-project/src/main/java/org/springblade/project/feign/ProjectItemClient.java

+ 3 - 0
blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/entity/BladeFlow.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.flow.core.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 import org.springblade.flow.core.constant.ProcessConstant;
 
@@ -175,5 +176,7 @@ public class BladeFlow implements Serializable {
 	public boolean isPass() {
 		return ProcessConstant.PASS_ALIAS.equals(flag) || ProcessConstant.PASS_COMMENT.equals(comment);
 	}
+	@TableField(exist = false)
+	private Long itemId;
 
 }

+ 12 - 0
blade-ops/blade-flow/pom.xml

@@ -68,6 +68,18 @@
             <artifactId>flowable-json-converter</artifactId>
             <version>${flowable.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-project-api</artifactId>
+            <version>2.8.2.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-desk</artifactId>
+            <version>2.8.2.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <build>

+ 12 - 0
blade-ops/blade-flow/src/main/java/org/springblade/flow/business/controller/WorkController.java

@@ -144,4 +144,16 @@ public class WorkController {
 		return R.success("删除任务成功");
 	}
 
+	/**
+	 * 审核完成任务
+	 *
+	 * @param flow 请假信息
+	 */
+	@PostMapping("checkCompleteTask")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "完成任务", notes = "传入流程信息")
+	public R checkCompleteTask(@ApiParam("任务信息") @RequestBody BladeFlow flow) {
+		return R.status(flowBusinessService.checkCompleteTask(flow));
+	}
+
 }

+ 9 - 0
blade-ops/blade-flow/src/main/java/org/springblade/flow/business/service/FlowBusinessService.java

@@ -69,4 +69,13 @@ public interface FlowBusinessService {
 	 * @return boolean
 	 */
 	boolean completeTask(BladeFlow leave);
+
+
+	/**
+	 * 请核完成任务
+	 *
+	 * @param leave 请假信息
+	 * @return boolean
+	 */
+	boolean checkCompleteTask(BladeFlow leave);
 }

+ 77 - 0
blade-ops/blade-flow/src/main/java/org/springblade/flow/business/service/impl/FlowBusinessServiceImpl.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.flow.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import lombok.AllArgsConstructor;
 import org.flowable.engine.HistoryService;
@@ -31,13 +32,17 @@ import org.springblade.core.tool.support.Kv;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.StringPool;
 import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.desk.entity.ProcessLeave;
+import org.springblade.desk.feign.IProcessLeaveClient;
 import org.springblade.flow.business.service.FlowBusinessService;
 import org.springblade.flow.core.constant.ProcessConstant;
 import org.springblade.flow.core.entity.BladeFlow;
 import org.springblade.flow.core.utils.TaskUtil;
 import org.springblade.flow.engine.constant.FlowEngineConstant;
 import org.springblade.flow.engine.utils.FlowCache;
+import org.springblade.project.feign.IProjectItemClient;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.LinkedList;
 import java.util.List;
@@ -54,6 +59,8 @@ public class FlowBusinessServiceImpl implements FlowBusinessService {
 
 	private final TaskService taskService;
 	private final HistoryService historyService;
+	private final IProjectItemClient projectItemClient;
+	private final IProcessLeaveClient processClient;
 
 	@Override
 	public IPage<BladeFlow> selectClaimPage(IPage<BladeFlow> page, BladeFlow bladeFlow) {
@@ -262,6 +269,76 @@ public class FlowBusinessServiceImpl implements FlowBusinessService {
 		return true;
 	}
 
+	@Override
+	@Transactional
+	public boolean checkCompleteTask(BladeFlow flow)
+	{
+		ProcessLeave processLeave = processClient.findById(Long.valueOf(flow.getBusinessId()));
+		Long currentUserId = AuthUtil.getUserId();
+		//任务id
+		Long itemId = processLeave.getItemId();
+		//驳回调整人
+		String taskUser = processLeave.getTaskUser();
+		//第一审核人
+		String checkUser = processLeave.getCheckUser();
+		//第二审核人
+		String checkSecondsUser = processLeave.getCheckSecondsUser();
+
+		//是否为调整人?
+		if(String.valueOf(currentUserId).equals(taskUser))
+		{
+			//重新申请
+			if(flow.getFlag()!=null&&flow.getFlag().equals("ok"))
+			{
+				projectItemClient.check(itemId,1,null,null,null,null);
+			}
+			//驳回按钮
+			else
+			{
+				projectItemClient.check(itemId,0,null,null,null,null);
+			}
+		}
+
+		//是否为第一审核人?
+		if(String.valueOf(currentUserId).equals(checkUser))
+		{
+			//通过按钮
+			if(flow.getFlag()!=null&&flow.getFlag().equals("ok"))
+			{
+				projectItemClient.check(itemId,2,null,null,null,null);
+			}
+
+		}
+
+		//是否为第二审核人?
+		if(String.valueOf(currentUserId).equals(checkSecondsUser))
+		{
+			//通过按钮
+			if(flow.getFlag()!=null&&flow.getFlag().equals("ok"))
+			{
+				projectItemClient.check(itemId,3,null,null,null,null);
+			}
+
+		}
+
+		String taskId = flow.getTaskId();
+		String processInstanceId = flow.getProcessInstanceId();
+		String comment = Func.toStr(flow.getComment(), ProcessConstant.PASS_COMMENT);
+		// 增加评论
+		if (StringUtil.isNoneBlank(processInstanceId, comment)) {
+			taskService.addComment(taskId, processInstanceId, comment);
+		}
+		// 创建变量
+		Map<String, Object> variables = flow.getVariables();
+		if (variables == null) {
+			variables = Kv.create();
+		}
+		variables.put(ProcessConstant.PASS_KEY, flow.isPass());
+		// 完成任务
+		taskService.complete(taskId, variables);
+		return true;
+	}
+
 	/**
 	 * 构建流程
 	 *

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

+ 8 - 0
blade-service-api/blade-desk-api/pom.xml

@@ -12,6 +12,14 @@
     <artifactId>blade-desk-api</artifactId>
     <name>${project.artifactId}</name>
     <version>2.8.2.RELEASE</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-flow-api</artifactId>
+            <version>2.8.2.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
     <packaging>jar</packaging>
 
 </project>

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

@@ -0,0 +1,83 @@
+/*
+ *      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.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.flow.core.entity.FlowEntity;
+
+import java.util.Date;
+
+/**
+ * 请假流程实体类
+ *
+ * @author Chill
+ */
+@Data
+@TableName("blade_process_leave")
+@EqualsAndHashCode(callSuper = true)
+public class ProcessLeave extends FlowEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 流程定义id
+	 */
+	private String processDefinitionId;
+	/**
+	 * 流程实例id
+	 */
+	private String processInstanceId;
+	/**
+	 * 请假开始时间
+	 */
+	private Date startTime;
+	/**
+	 * 请假结束时间
+	 */
+	private Date endTime;
+	/**
+	 * 请假理由
+	 */
+	private String reason;
+	/**
+	 * 第一级审批人
+	 */
+	private String checkUser;
+
+	/**
+	 * 第二级审批人
+	 */
+	private String checkSecondsUser;
+
+	/**
+	 * 审批人
+	 */
+	private String taskUser;
+
+	/**
+	 * 流程申请时间
+	 */
+	private Date applyTime;
+
+	/**
+	 * 关联表id
+	 */
+	private Long itemId;
+
+}

+ 51 - 0
blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/feign/IProcessLeaveClient.java

@@ -0,0 +1,51 @@
+/*
+ *      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.feign;
+
+import org.springblade.core.launch.constant.AppConstant;
+import org.springblade.core.mp.support.BladePage;
+import org.springblade.desk.entity.Notice;
+import org.springblade.desk.entity.ProcessLeave;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * ProcessLive Feign接口类
+ *
+ * @author Chill
+ */
+@FeignClient(
+	value = AppConstant.APPLICATION_DESK_NAME
+)
+public interface IProcessLeaveClient {
+
+	String API_PREFIX = "/client";
+	String FIND_BY_ID = API_PREFIX + "/findById";
+
+	/**
+	 * 获取审批流对象
+	 *
+	 * @param
+	 * @param
+	 * @return
+	 */
+	@GetMapping(FIND_BY_ID)
+	public ProcessLeave findById(@RequestParam(value = "id",required = true) Long id);
+
+
+}

+ 44 - 0
blade-service-api/blade-project-api/src/main/java/org/springblade/project/feign/IProjectItemClient.java

@@ -0,0 +1,44 @@
+package org.springblade.project.feign;
+
+
+import org.springblade.core.tool.api.R;
+import org.springblade.project.entity.ServiceProjectItem;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Date;
+import java.util.List;
+
+@FeignClient(
+	value = "trade-project"
+)
+/**
+ * 商品信息对外访问API
+ */
+public interface IProjectItemClient {
+	String API_PREFIX = "/client";
+	String UPDATE_ITEM_STATUS=API_PREFIX+"updateItemStatus";
+	String FIND_ITEM_BY_ID=API_PREFIX+"findItemById";
+
+	/**
+	 * 修改主营项目明细状态
+	 * */
+	@PostMapping(UPDATE_ITEM_STATUS)
+	public R  check(@RequestParam(name = "id", required = true) Long itemId
+		,@RequestParam(name = "status", required = true) int status
+		,@RequestParam(name = "accountName", required = false) String accountName
+		,@RequestParam(name = "accountBank", required = false) String accountBank
+		,@RequestParam(name = "payTime", required = false) Date payTime
+		,@RequestParam(name = "accountNo", required = false) String accountNo);
+
+
+	/**
+	 * 通过id查询主营项目明细
+	 * */
+	@GetMapping(FIND_ITEM_BY_ID)
+	public ServiceProjectItem findItemById(@RequestParam(name = "id", required = true) Long itemId);
+
+
+}

+ 6 - 0
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/OrderItems.java

@@ -322,4 +322,10 @@ public class OrderItems implements Serializable {
 	 */
 	@ApiModelProperty(value = "商品类别名称")
 	private String priceCategoryNames;
+
+	/**
+	 * 箱号
+	 */
+	@ApiModelProperty(value = "箱号")
+	private String cntrNo;
 }

+ 6 - 0
blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/entity/OrderItems.java

@@ -301,4 +301,10 @@ public class OrderItems extends OrderBase {
 	 */
 	@ApiModelProperty(value = "商品类别名称")
 	private String priceCategoryNames;
+
+	/**
+	 * 箱号
+	 */
+	@ApiModelProperty(value = "箱号")
+	private String cntrNo;
 }

+ 29 - 3
blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsDescController.java

@@ -1,6 +1,7 @@
 package org.springblade.client.corps.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
@@ -11,6 +12,7 @@ import org.springblade.client.corps.excel.CorpsExcel;
 import org.springblade.client.corps.excel.CorpsImport;
 import org.springblade.client.corps.service.ICorpsDescService;
 import org.springblade.client.entity.CorpsDesc;
+import org.springblade.client.goods.excel.GoodsExcel;
 import org.springblade.client.vo.CorpsDescVO;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.excel.util.ExcelUtil;
@@ -22,7 +24,10 @@ import org.springblade.core.tool.utils.Func;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 客户详情 控制器
@@ -141,9 +146,30 @@ public class CorpsDescController extends BladeController {
 	@PostMapping("/import-desc")
 	@ApiOperationSupport(order = 12)
 	@ApiOperation(value = "导入客户资料", notes = "传入excel")
-	public R importUser(MultipartFile file) {
-		CorpsImport corpsImport = new CorpsImport(corpsDescService,false);
-		ExcelUtil.save(file, corpsImport, CorpsExcel.class);
+	public R importUser(MultipartFile file,String typeId) {
+		List<CorpsExcel> excelList = ExcelUtil.read(file, CorpsExcel.class);
+		if(CollectionUtils.isEmpty(excelList))
+		{
+			throw new SecurityException("数据不能为空");
+		}
+		excelList.forEach(e->{
+			e.setTypeId(typeId);
+		});
+		corpsDescService.importUser(excelList,false);
 		return R.success("操作成功");
 	}
+
+
+	/**
+	 * 导出模板
+	 */
+	@GetMapping("/export-template")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "导出模板")
+	public void exportPrice(HttpServletResponse response) {
+		List<CorpsExcel> list = new ArrayList<>();
+		ExcelUtil.export(response, "客户导入模板", "客户导入数据表", list, CorpsExcel.class);
+	}
+
+
 }

+ 25 - 3
blade-service/blade-client/src/main/java/org/springblade/client/corps/excel/CorpsExcel.java

@@ -16,12 +16,34 @@ import java.math.BigDecimal;
 public class CorpsExcel implements Serializable {
 	private static final long serialVersionUID = 1L;
 
-	@ExcelProperty("客户编号")
+	@ExcelProperty("客户编号(必填)")
 	private String code;
 
-	@ExcelProperty("客户名称")
+	@ExcelProperty("客户名称(必填)")
 	private String cname;
 
+
+
+	@ExcelProperty("英文名")
+	private String enname;
+
+	@ExcelProperty("代理品牌")
+	private String goodtypes;
+
+	@ExcelProperty("所属公司")
+	private String belongtocompany;
+
+	@ExcelProperty("企业类型")
+	private String companytype;
+
+	@ExcelProperty("代理区域")
+	private String belongtoarea;
+
+	@ExcelProperty("职位")
+	private String position;
+
+
+
 	@ExcelProperty("联系人")
 	private String attn;
 
@@ -49,6 +71,6 @@ public class CorpsExcel implements Serializable {
 	@ExcelProperty("外币银行账号")
 	private String accountNoFcy;
 
-	@ExcelProperty("类型id")
+	@ExcelProperty("typeId,不用填写")
 	private String typeId;
 }

+ 56 - 41
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;
@@ -167,50 +168,64 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
 	@Transactional
 	public void importUser(List<CorpsExcel> data, Boolean isCovered)
 	{
-		if(org.springframework.util.CollectionUtils.isEmpty(data))
-		{
-			throw new SecurityException("导入数据不能为空");
-		}
-		data.forEach(e->{
-			CorpsDesc corpsDesc=new CorpsDesc();
-			corpsDesc.setCode(e.getCode());
-			corpsDesc.setCname(e.getCname());
-			corpsDesc.setAttn(e.getAttn());
-			corpsDesc.setAttn(e.getAttn());
-			corpsDesc.setTel(e.getTel());
-			corpsDesc.setAddr(e.getAddr());
-			corpsDesc.setAccountBank(e.getAccountBank());
-			corpsDesc.setAccountName(e.getAccountName());
-			corpsDesc.setAccountNo(e.getAccountNo());
-			corpsDesc.setAccountBankFcy(e.getAccountBankFcy());
-			corpsDesc.setAccountNameFcy(e.getAccountNameFcy());
-			corpsDesc.setTenantId(AuthUtil.getTenantId());
-			corpsDesc.setAccountNoFcy(e.getAccountNoFcy());
-			QueryWrapper<CorpsDesc> queryWrapper = Condition.getQueryWrapper(corpsDesc);
-			CorpsDesc selectOne = baseMapper.selectOne(queryWrapper);
-			if(selectOne==null)
+		try {
+			if(org.springframework.util.CollectionUtils.isEmpty(data))
 			{
-				corpsDesc.setCreateTime(new Date());
-				corpsDesc.setCreateUser(AuthUtil.getUserId());
-				corpsDesc.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
-				baseMapper.insert(corpsDesc);
-
-				CorpsTypeDesc middle=new CorpsTypeDesc();
-				middle.setCorpId(corpsDesc.getId());
-				middle.setCorpTypeId(Long.valueOf(e.getTypeId()));
-				middle.setCreateTime(new Date());
-				middle.setCreateUser(AuthUtil.getUserId());
-				middle.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
-				middleMapper.insert(middle);
-			}
-			else
-			{
-				selectOne.setUpdateTime(new Date());
-				selectOne.setUpdateUser(AuthUtil.getUserId());
-				baseMapper.updateById(selectOne);
+				throw new SecurityException("导入数据不能为空");
 			}
+			data.forEach(e->{
+				CorpsDesc corpsDesc=new CorpsDesc();
+				corpsDesc.setCode(e.getCode());
+				corpsDesc.setCname(e.getCname());
+				corpsDesc.setAttn(e.getAttn());
+				corpsDesc.setAttn(e.getAttn());
+				corpsDesc.setTel(e.getTel());
+				corpsDesc.setAddr(e.getAddr());
+				corpsDesc.setAccountBank(e.getAccountBank());
+				corpsDesc.setAccountName(e.getAccountName());
+				corpsDesc.setAccountNo(e.getAccountNo());
+				corpsDesc.setAccountBankFcy(e.getAccountBankFcy());
+				corpsDesc.setAccountNameFcy(e.getAccountNameFcy());
+				corpsDesc.setTenantId(AuthUtil.getTenantId());
+				corpsDesc.setAccountNoFcy(e.getAccountNoFcy());
+				corpsDesc.setEnname(e.getEnname());
+				corpsDesc.setGoodtypes(e.getGoodtypes());
+				corpsDesc.setBelongtocompany(e.getBelongtocompany());
+				corpsDesc.setBelongtoarea(e.getBelongtoarea());
+				corpsDesc.setCompanytype(e.getCompanytype());
+				corpsDesc.setPosition(e.getPosition());
+				//名称相等视为重复数据
+				LambdaQueryWrapper<CorpsDesc> queryWrapper = new LambdaQueryWrapper<>();
+				queryWrapper.eq(CorpsDesc::getCname,corpsDesc.getCname());
+				queryWrapper.eq(CorpsDesc::getIsDeleted,0);
+				CorpsDesc selectOne = baseMapper.selectOne(queryWrapper);
+				if(selectOne==null)
+				{
+					corpsDesc.setCreateTime(new Date());
+					corpsDesc.setCreateUser(AuthUtil.getUserId());
+					corpsDesc.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+					baseMapper.insert(corpsDesc);
 
-		});
+					CorpsTypeDesc middle=new CorpsTypeDesc();
+					middle.setCorpId(corpsDesc.getId());
+					middle.setCorpTypeId(Long.valueOf(e.getTypeId()));
+					middle.setCreateTime(new Date());
+					middle.setCreateUser(AuthUtil.getUserId());
+					middle.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+					middleMapper.insert(middle);
+				}
+				else
+				{
+					corpsDesc.setId(selectOne.getId());
+					corpsDesc.setUpdateTime(new Date());
+					corpsDesc.setUpdateUser(AuthUtil.getUserId());
+					baseMapper.updateById(corpsDesc);
+				}
+
+			});
+		} catch (Exception e) {
+			throw new SecurityException("请检查导入数据");
+		}
 	}
 
 

+ 24 - 3
blade-service/blade-client/src/main/java/org/springblade/client/goods/controller/GoodsDescController.java

@@ -25,6 +25,8 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
+
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
 import org.springblade.client.corps.excel.CorpsExcel;
@@ -55,6 +57,7 @@ import org.springblade.client.goods.service.IGoodsDescService;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -275,10 +278,28 @@ public class GoodsDescController extends BladeController {
 	@PostMapping("/import-desc")
 	@ApiOperationSupport(order = 12)
 	@ApiOperation(value = "导入商品资料", notes = "传入excel")
-	public R importUser(MultipartFile file) {
-		GoodsImport corpsImport = new GoodsImport(goodsDescService,false);
-		ExcelUtil.save(file, corpsImport, GoodsExcel.class);
+	public R importUser(MultipartFile file,String typeId) {
+		List<GoodsExcel> excelList = ExcelUtil.read(file, GoodsExcel.class);
+		if(CollectionUtils.isEmpty(excelList))
+		{
+			throw new SecurityException("数据不能为空");
+		}
+		excelList.forEach(e->{
+			e.setTypeId(typeId);
+		});
+		goodsDescService.importGoods(excelList,false);
 		return R.success("操作成功");
 	}
 
+	/**
+	 * 导出模板
+	 */
+	@GetMapping("/export-template")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "导出模板")
+	public void exportPrice(HttpServletResponse response) {
+		List<GoodsExcel> list = new ArrayList<>();
+		ExcelUtil.export(response, "商品导入模板", "商品导入数据表", list, GoodsExcel.class);
+	}
+
 }

+ 33 - 6
blade-service/blade-client/src/main/java/org/springblade/client/goods/excel/GoodsExcel.java

@@ -15,14 +15,35 @@ import java.io.Serializable;
 public class GoodsExcel implements Serializable {
 	private static final long serialVersionUID = 1L;
 
-	@ExcelProperty("商品编码")
+	@ExcelProperty("商品编码(必填)")
 	private String code;
 
-	@ExcelProperty("商品名称")
+	@ExcelProperty("商品名称(必填)")
 	private String cname;
 
-	@ExcelProperty("规格编码")
-	private String Typeno;
+	@ExcelProperty("英文名称")
+	private String ename;
+
+	@ExcelProperty("中文描述")
+	private String nameDescription;
+
+	@ExcelProperty("英文描述")
+	private String cnameDescription;
+
+	@ExcelProperty("海关编码")
+	private String customCode;
+
+	@ExcelProperty("海关中文")
+	private String customName;
+
+	@ExcelProperty("海关英文")
+	private String customEname;
+
+	@ExcelProperty("退税率(小数 或者 整数)")
+	private String customRate;
+
+	@ExcelProperty("规格编码(必填)")
+	private String typeNo;
 
 	@ExcelProperty("品牌")
 	private String brand;
@@ -33,7 +54,7 @@ public class GoodsExcel implements Serializable {
 	@ExcelProperty("规格尺寸")
 	private String specs;
 
-	@ExcelProperty("0:商品/产品  1:事务")
+	@ExcelProperty("type,不需要填")
 	private String type;
 
 
@@ -53,6 +74,12 @@ public class GoodsExcel implements Serializable {
 	@ExcelProperty("备注")
 	private String remarks;
 
-	@ExcelProperty("类id")
+	@ExcelProperty("类id,不用填写")
 	private String typeId;
+
+
+
+
+
+
 }

+ 60 - 40
blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsDescServiceImpl.java

@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 /**
@@ -320,48 +321,67 @@ public class GoodsDescServiceImpl extends ServiceImpl<GoodsDescMapper, GoodsDesc
 	@Transactional
 	public void importGoods(List<GoodsExcel> data, Boolean isCovered)
 	{
-		if(org.springframework.util.CollectionUtils.isEmpty(data))
-		{
-			throw new SecurityException("导入数据不能为空");
-		}
-		data.forEach(e->{
-			GoodsDesc goodsDesc=new GoodsDesc();
-			goodsDesc.setCode(e.getCode());
-			goodsDesc.setCname(e.getCname());
-			goodsDesc.setTypeno(e.getTypeno());
-			goodsDesc.setBrand(e.getBrand());
-			goodsDesc.setBrandItem(e.getBrandItem());
-			goodsDesc.setSpecs(e.getSpecs());
-			goodsDesc.setType(Long.valueOf(e.getType()));
-			goodsDesc.setCategory(e.getCategory());
-			goodsDesc.setCategoryitem(e.getCategoryitem());
-			goodsDesc.setUnit(e.getUnit());
-			goodsDesc.setPackgeunit(e.getPackgeunit());
-			goodsDesc.setRemarks(e.getRemarks());
-			QueryWrapper<GoodsDesc> queryWrapper = Condition.getQueryWrapper(goodsDesc);
-			GoodsDesc one = goodsDescMapper.selectOne(queryWrapper);
-			if(one==null)
-			{
-				goodsDesc.setCreateTime(new Date());
-				goodsDesc.setCreateUser(AuthUtil.getUserId());
-				goodsDesc.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
-				goodsDescMapper.insert(goodsDesc);
-
-				GoodsTypeDesc goodsTypeDes=new GoodsTypeDesc();
-				goodsTypeDes.setGoodsId(goodsDesc.getId());
-				goodsTypeDes.setGoodsTypeId(Long.valueOf(e.getTypeId()));
-				goodsTypeDes.setCreateTime(new Date());
-				goodsTypeDes.setCreateUser(AuthUtil.getUserId());
-				goodsTypeDes.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
-				goodsTypeDescMapper.insert(goodsTypeDes);
-			}
-			else
+		try {
+			if(org.springframework.util.CollectionUtils.isEmpty(data))
 			{
-				one.setUpdateTime(new Date());
-				one.setUpdateUser(AuthUtil.getUserId());
-				goodsDescMapper.updateById(one);
+				throw new SecurityException("导入数据不能为空");
 			}
-		});
+			data.forEach(e->{
+				GoodsDesc goodsDesc=new GoodsDesc();
+				goodsDesc.setCode(e.getCode());
+				goodsDesc.setCname(e.getCname());
+				goodsDesc.setTypeno(e.getTypeNo());
+				goodsDesc.setBrand(e.getBrand());
+				goodsDesc.setBrandItem(e.getBrandItem());
+				goodsDesc.setSpecs(e.getSpecs());
+				goodsDesc.setType(0L);
+				goodsDesc.setCategory(e.getCategory());
+				goodsDesc.setCategoryitem(e.getCategoryitem());
+				goodsDesc.setUnit(e.getUnit());
+				goodsDesc.setPackgeunit(e.getPackgeunit());
+				goodsDesc.setRemarks(e.getRemarks());
+				goodsDesc.setGoodsTypeId(e.getTypeId());
+				goodsDesc.setEname(e.getEname());
+				goodsDesc.setNameDescription(e.getNameDescription());
+				goodsDesc.setCnameDescription(e.getCnameDescription());
+				goodsDesc.setCustomCode(e.getCustomCode());
+				goodsDesc.setCustomName(e.getCustomName());
+				goodsDesc.setCustomEname(e.getCustomEname());
+				if(e.getCustomRate()!=null)
+				{
+					goodsDesc.setCustomRate(new BigDecimal(e.getCustomRate()));
+				}
+				//如果名称相等 就认为重复
+				LambdaQueryWrapper<GoodsDesc> queryWrapper = new LambdaQueryWrapper<>();
+				queryWrapper.eq(GoodsDesc::getCname,goodsDesc.getCname());
+				queryWrapper.eq(GoodsDesc::getIsDeleted,0);
+				GoodsDesc one = goodsDescMapper.selectOne(queryWrapper);
+				if(one==null)
+				{
+					goodsDesc.setCreateTime(new Date());
+					goodsDesc.setCreateUser(AuthUtil.getUserId());
+					goodsDesc.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+					goodsDescMapper.insert(goodsDesc);
+
+					GoodsTypeDesc goodsTypeDes=new GoodsTypeDesc();
+					goodsTypeDes.setGoodsId(goodsDesc.getId());
+					goodsTypeDes.setGoodsTypeId(Long.valueOf(e.getTypeId()));
+					goodsTypeDes.setCreateTime(new Date());
+					goodsTypeDes.setCreateUser(AuthUtil.getUserId());
+					goodsTypeDes.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+					goodsTypeDescMapper.insert(goodsTypeDes);
+				}
+				else
+				{
+					goodsDesc.setId(one.getId());
+					goodsDesc.setUpdateTime(new Date());
+					goodsDesc.setUpdateUser(AuthUtil.getUserId());
+					goodsDescMapper.updateById(goodsDesc);
+				}
+			});
+		} catch (Exception e) {
+			throw new SecurityException("请仔细检查导入数据");
+		}
 	}
 
 }

+ 6 - 0
blade-service/blade-desk/pom.xml

@@ -55,6 +55,12 @@
             <groupId>com.qiniu</groupId>
             <artifactId>qiniu-java-sdk</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-project-api</artifactId>
+            <version>2.8.2.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
         <!--<dependency>
             <groupId>org.springblade</groupId>
             <artifactId>blade-starter-transaction</artifactId>

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

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

@@ -56,12 +56,28 @@ public class ProcessLeave extends FlowEntity {
 	 */
 	private String reason;
 	/**
+	 * 第一级审批人
+	 */
+	private String checkUser;
+
+	/**
+	 * 第二级审批人
+	 */
+	private String checkSecondsUser;
+
+	/**
 	 * 审批人
 	 */
 	private String taskUser;
+
 	/**
 	 * 流程申请时间
 	 */
 	private Date applyTime;
 
+	/**
+	 * 关联表id
+	 */
+	private Long itemId;
+
 }

+ 54 - 0
blade-service/blade-desk/src/main/java/org/springblade/desk/feign/ProcessClient.java

@@ -0,0 +1,54 @@
+/*
+ *      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.feign;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.support.BladePage;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tenant.annotation.NonDS;
+import org.springblade.desk.entity.Notice;
+import org.springblade.desk.entity.ProcessLeave;
+import org.springblade.desk.service.ILeaveService;
+import org.springblade.desk.service.INoticeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * Notice Feign
+ *
+ * @author Chill
+ */
+@NonDS
+@ApiIgnore()
+@RestController
+@AllArgsConstructor
+public class ProcessClient implements IProcessLeaveClient {
+
+	@Autowired
+	private ILeaveService leaveService;
+
+	@Override
+	@GetMapping(FIND_BY_ID)
+	public ProcessLeave findById(Long id)
+	{
+		return leaveService.getById(id);
+	}
+}

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

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

@@ -16,6 +16,7 @@
  */
 package org.springblade.desk.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springblade.core.log.exception.ServiceException;
@@ -33,6 +34,8 @@ import org.springblade.flow.core.entity.BladeFlow;
 import org.springblade.flow.core.feign.IFlowClient;
 import org.springblade.flow.core.utils.FlowUtil;
 import org.springblade.flow.core.utils.TaskUtil;
+import org.springblade.project.entity.ServiceProjectItem;
+import org.springblade.project.feign.IProjectItemClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -48,6 +51,8 @@ public class LeaveServiceImpl extends BaseServiceImpl<LeaveMapper, ProcessLeave>
 
 	private final IFlowClient flowClient;
 
+	private final IProjectItemClient projectItemClient;
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	// @GlobalTransactional
@@ -78,4 +83,49 @@ public class LeaveServiceImpl extends BaseServiceImpl<LeaveMapper, ProcessLeave>
 		return true;
 	}
 
+	@Override
+	@Transactional
+	public boolean startCheckProcess(ProcessLeave check)
+	{
+		ServiceProjectItem item = projectItemClient.findItemById(check.getItemId());
+		if(item.getStatus()>0)
+		{
+			throw new ServiceException("已请核的禁止重复提交");
+		}
+		R res = projectItemClient.check(check.getItemId(), 1, null, null, null, null);
+		if(!res.isSuccess())
+		{
+			throw new ServiceException("请求调用请核失败");
+		}
+		check.setTaskUser(String.valueOf(AuthUtil.getUserId()));
+		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;
+	}
+
 }

+ 54 - 0
blade-service/blade-project/src/main/java/org/springblade/project/feign/ProjectItemClient.java

@@ -0,0 +1,54 @@
+package org.springblade.project.feign;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.client.entity.GoodsDesc;
+import org.springblade.client.feign.IGoodsDescClient;
+
+import org.springblade.client.vo.GoodsDescVO;
+import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.core.tenant.annotation.NonDS;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.project.entity.ServiceProjectItem;
+import org.springblade.project.service.ServiceProjectItemService;
+import org.springblade.project.service.ServiceProjectService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.Date;
+import java.util.List;
+
+
+@NonDS
+@RestController
+@AllArgsConstructor
+public class ProjectItemClient implements IProjectItemClient
+{
+	@Autowired
+	private ServiceProjectService serviceProjectService;
+	@Autowired
+	private ServiceProjectItemService serviceProjectItemService;
+
+	@Override
+	@PostMapping(UPDATE_ITEM_STATUS)
+	public R check(Long itemId, int status, String accountName, String accountBank, Date payTime, String accountNo)
+	{
+		serviceProjectService.updateItemStatus(itemId,status,accountName,accountBank,accountNo,payTime);
+		return R.success("操作成功");
+	}
+
+	@Override
+	@GetMapping(FIND_ITEM_BY_ID)
+	public ServiceProjectItem findItemById(Long itemId)
+	{
+		return	serviceProjectItemService.getById(itemId);
+	}
+
+
+}