zouxuan 4 年之前
父节点
当前提交
3d102f79d8

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/FinancialExpenditureDao.java

@@ -23,4 +23,15 @@ public interface FinancialExpenditureDao extends BaseDAO<Long, FinancialExpendit
      * @return
      */
     List<FinancialExpenditure> getCooperationExpenditure();
+
+    /**
+     * @describe
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/9/16
+     * @time 11:38
+     * @param collect:
+     * @return java.lang.Integer
+     */
+    List<String> countBydingTalk(@Param("collect") List<Object> collect);
 }

+ 17 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java

@@ -34,6 +34,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, FinancialExpenditure> implements FinancialExpenditureService {
@@ -60,7 +61,17 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
 		Map<String, Integer> phoneMap = getMap("sys_user", "phone_", "id_", true, String.class, Integer.class);
 		for (String e : sheetsListMap.keySet()) {
 			List<Map<String, Object>> sheet = sheetsListMap.get(e);
+			List<Object> collect = sheet.stream().map(m -> m.get("钉钉流程编号")).collect(Collectors.toList());
+			if(collect == null || collect.size() == 0){
+				continue;
+			}
+			List<String> list = financialExpenditureDao.countBydingTalk(collect);
+			if(list != null && list.size() > 0){
+				throw new BizException("导入数据错误  重复的钉钉流程编号:{}",list.get(0));
+			}
+
 			valueIsNull: for (Map<String, Object> row : sheet) {
+
 				if (row.size() == 0){
 					continue;
 				}
@@ -93,6 +104,12 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
 						}
 						continue;
 					}
+					if (columnValue.equals("dingtalkProcessNo")) {
+						if(StringUtils.isEmpty(row.get(s).toString())){
+							LOGGER.error("支出记录导入异常:钉钉流程编号不可为空 param:{}",objectMap);
+							continue valueIsNull;
+						}
+					}
 					if (columnValue.equals("feeProject")) {
 						for (FeeProjectEnum feeProject : FeeProjectEnum.values()) {
 							if (feeProject.getDesc().equals(row.get(s).toString())) {

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/FinancialExpenditureMapper.xml

@@ -195,4 +195,11 @@
         SELECT organ_id_,cooperation_organ_id_, type_, SUM(amount_) amount_ FROM financial_expenditure WHERE del_flag_ =0
         GROUP BY organ_id_,cooperation_organ_id_,type_
     </select>
+    <select id="countBydingTalk" resultType="java.lang.String">
+        SELECT dingtalk_process_no_ FROM financial_expenditure WHERE dingtalk_process_no_ IN
+        <foreach collection="collect" separator="," open="(" close=")" item="item">
+            #{item}
+        </foreach>
+        GROUP BY dingtalk_process_no_
+    </select>
 </mapper>

+ 1 - 2
mec-web/src/main/resources/columnMapper.ini

@@ -13,12 +13,11 @@
 商品采购价2(元) = agreeCostPrice
 
 [财务支出导入模板]
-批次号 = batchNo
 财务流程编号 = financialProcessNo
 钉钉流程编号 = dingtalkProcessNo
 费用归属分部 = organName
 费用归属学校 = cooperationOrganName
-申请人(手机号) = phone
+申请人 = applyUser
 费用类型 = type
 费用项目 = feeProject
 付款金额 = amount