From b00dd93dedca0c151a760fff48191b92ac572545 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期二, 20 一月 2026 18:16:14 +0800
Subject: [PATCH] 优化调整,及数据导入提交1

---
 fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutDataPR.java |  185 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 183 insertions(+), 2 deletions(-)

diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutDataPR.java b/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutDataPR.java
index 87f3c24..90d2b62 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutDataPR.java
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutDataPR.java
@@ -8,13 +8,15 @@
 import com.fzzy.igds.data.InoutData;
 import com.fzzy.igds.data.InoutParam;
 import com.fzzy.igds.domain.InoutRecord;
+import com.fzzy.igds.service.ExportService;
 import com.fzzy.igds.service.InoutRecordService;
 import com.fzzy.igds.utils.ContextUtil;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
-import java.util.Date;
+import java.util.*;
 
 /**
  * @Description 鍑哄叆搴撹鍗曢〉闈㈢鐞�
@@ -26,6 +28,8 @@
 
     @Resource
     private InoutRecordService inoutRecordService;
+    @Resource
+    private ExportService exportService;
 
     /**
      * inoutDataPR#pageInoutData
@@ -37,7 +41,7 @@
     public void pageInoutData(Page<InoutRecord> page, InoutParam param) {
         com.baomidou.mybatisplus.extension.plugins.pagination.Page<InoutRecord> corePage = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page.getPageNo(), page.getPageSize());
 
-        if(null == param) {
+        if (null == param) {
             param = new InoutParam();
         }
         inoutRecordService.listPageInout(corePage, param);
@@ -157,4 +161,181 @@
             return inoutRecordService.outWeightBill(data);
         }
     }
+
+    /**
+     * inoutDataPR#analysisExcel
+     *
+     * @param fileName
+     * @return
+     */
+    @Expose
+    public String analysisExcel(String fileName) {
+        return "瀵煎叆鍔熻兘寰呬笂绾匡紒锛�";
+//        try {
+//            List<InoutRecord> inoutRecords = exportService.readExcel(fileName);
+//            if (null == inoutRecords || inoutRecords.isEmpty()) {
+//                return "瀵煎叆澶辫触锛屽師鍥�-->鏈幏鍙栧埌excel涓枃妗f暟鎹紒";
+//            }
+//
+//
+//            for (InoutRecord inoutRecord : inoutRecords) {
+//
+//                //TODO 鍒ゆ柇鏁版嵁鏄惁姝e父鏁版嵁锛屾甯稿垯鏂板锛屽紓甯稿垯蹇界暐
+//                //璁剧疆鏁版嵁鐘舵�佸強娴佺▼
+//                inoutRecord.setRecordStatus(Constant.RECORD_STATUS_ADD);
+//                inoutRecord.setProgress(Constant.PROGRESS_RECORD);
+//
+//                inoutRecord.setCompleteTime(new Date());
+//
+//
+//                inoutRecord.setRegisterTime(DateUtils.addHours(new Date(), -2));
+//
+//
+//
+//
+//                inoutRecordService.addInoutRecord(inoutRecord);
+//            }
+//
+//
+//
+//
+//            return null;
+//        } catch (Exception e) {
+//            return "瀵煎叆澶辫触锛屽師鍥�-->" + e.getMessage();
+//        }
+
+
+//        // 璇诲彇鐨凟xcel鏂囦欢鏁版嵁
+//        List<NoticeInData> readResult = readExcel(fileName);
+//        if (null == readResult) {
+//            return new PageResponse<String>(RespCodeEnum.CODE_1111.getCode(),
+//                    "瀵煎叆澶辫触锛氭病鏈夎В鏋愬埌鏂囦欢涓暟鎹紒");
+//        }
+//
+//        // 鏌ヨ鍒扮殑鎵�鏈変緵搴斿晢淇℃伅
+//        InoutParam param = new InoutParam();
+//        param.setTagSupplier(Constant.TR_TRUE + "");
+//        List<InoutCustomer> allCustomer = inoutCommonService.listCustomer(param);
+//
+//        //鏂板缓浠诲姟瀛樻斁闆嗗悎
+//        List<NoticeInData> newCustomerTaskList = new ArrayList<>();
+//        Map<String, NoticeInData> newMap = new HashMap<>();
+//
+//        //瀛樻斁缂栫爜鍜屽悕绉颁笉涓�鑷寸殑淇℃伅
+//        StringBuilder stringBuilder = new StringBuilder();
+//
+//        //鐢╰empFlag鍦ㄥ悗闈㈡潵鍒ゆ柇瑙f瀽鍒扮殑瀹㈡埛鏄惁鍦ㄥ鎴疯〃涓瓨鍦�
+//        boolean tempFlag;
+//
+//        int max = 0;
+//        for (NoticeInData noticeInData : readResult) {
+//            //鑾峰彇瀹㈡埛浠诲姟鏁版嵁涓殑瀹㈡埛鍚嶇О鍜岀紪鐮�
+//            String customerName = noticeInData.getCustomerName();
+//            String customerId = noticeInData.getCustomerId();
+//            //鍒ゆ柇缂栫爜鏄惁涓虹┖,涓虹┖鍒欑粰鍑烘彁绀�,涓嶈繘琛屾搷浣�
+//            if(StringUtils.isEmpty(customerName)){
+//                stringBuilder.append("瀹㈡埛鈥�").append(customerName).append("鈥欎俊鎭笉瀹屾暣锛屼笉瀵煎叆姝ゆ潯鏁版嵁锛沑n");
+//                continue;
+//            }
+//
+//            tempFlag = true;
+//
+//            for (InoutCustomer customer : allCustomer) {
+//                //鑾峰彇渚涘簲鍟嗗悕绉板拰缂栫爜
+//                String name = customer.getName();
+//                String id = customer.getId();
+//                //鍒ゆ柇鍚嶇О鏄惁鐩稿悓
+//                if(customerName.equals(name)){
+//                    //鍚嶇О鐩稿悓锛屽垯瀹㈡埛鍦ㄨ〃涓瓨鍦�
+//                    tempFlag = false;
+//                    //鍒ゆ柇缂栫爜鏄惁鐩稿悓
+//                    if(StringUtils.isEmpty(customerId) || !id.equals(customerId)){
+//
+//                        noticeInData.setCustomerId(id);
+//                    }
+//                    noticeInData.setCompanyId(customer.getCompanyId());
+//                    //韬唤璇佸彿
+//                    if(StringUtils.isEmpty(noticeInData.getCardId())){
+//                        noticeInData.setCardId(customer.getCardId());
+//                    }
+//                    //鍦板潃
+//                    if(StringUtils.isEmpty(noticeInData.getAddress())){
+//                        noticeInData.setAddress(customer.getAddress());
+//                    }
+//                    //鐢佃瘽
+//                    if(StringUtils.isEmpty(noticeInData.getPhone())){
+//                        noticeInData.setPhone(customer.getPhone());
+//                    }
+//                    //涓�鍗¢�氬彿
+//                    if(StringUtils.isEmpty(noticeInData.getBankNum())){
+//                        noticeInData.setBankNum(customer.getBankNum());
+//                    }
+//                }
+//            }
+//
+//            if(tempFlag){
+//                if(max == 0){
+//                    max = Integer.parseInt(inoutCommonService.getMaxCustomerId(null));
+//                }
+//                max += 1;
+//                noticeInData.setCustomerId(max + "");
+//            }
+//
+//            newCustomerTaskList.add(noticeInData);
+//
+//            newMap.putIfAbsent(noticeInData.getCustomerName(), noticeInData);
+//        }
+//
+//        //鏇存柊瀹㈡埛淇℃伅琛�
+//        if(newMap.size() > 0){
+//            for (NoticeInData noticeInData : newMap.values()) {
+//                int i = inoutCommonService.updateCustomer(noticeInData);
+//                if (i == 0) {
+//                    //璇存槑娌℃湁鏇存柊鍒板鎴蜂俊鎭紝杩涜鏂板
+//                    InoutCustomer data = new InoutCustomer();
+//                    data.setId(noticeInData.getCustomerId());
+//                    data.setName(noticeInData.getCustomerName());
+//                    data.setCardId(noticeInData.getCardId());
+//                    data.setBankNum(noticeInData.getBankNum());
+//                    data.setAddress(noticeInData.getAddress());
+//                    data.setPhone(noticeInData.getPhone());
+//                    data.setTagSupplier(Constant.TR_TRUE + "");
+//                    customerService.saveOrUpdataData(data);
+//                }
+//            }
+//        }
+//
+//        //鍒ゆ柇浠诲姟闆嗗悎鏄惁涓虹┖
+//        if (newCustomerTaskList.isEmpty()) {
+//            return new PageResponse<String>(RespCodeEnum.CODE_1111.getCode(),
+//                    "瀵煎叆澶辫触锛乗n" + stringBuilder.toString());
+//        } else {
+//            //鏇存柊浠诲姟琛�
+//            int temp = 1;
+//            for (NoticeInData noticeInData : newCustomerTaskList) {
+//                //璁剧疆瀹㈡埛閫氱煡鍗曠殑缁勭粐缂栫爜绛変俊鎭�
+//                noticeInData.setCompanyId(ContextUtil.getCompanyId());
+//                noticeInData.setDeptId(ContextUtil.subDeptId(null));
+//                noticeInData.setCreateUser(ContextUtil.getLoginUserCName());
+//                if(temp < 10){
+//                    noticeInData.setId(ContextUtil.getTimeId() + "00" + temp);
+//                }else if(temp < 100){
+//                    noticeInData.setId(ContextUtil.getTimeId() + "0" + temp);
+//                }else {
+//                    noticeInData.setId(ContextUtil.getTimeId() + temp);
+//                }
+//
+//                //鏇存柊瀹㈡埛浠诲姟淇℃伅,濡傛灉鏇存柊澶辫触,鍒欒繘琛屾彃鍏ユ搷浣�
+//                inoutCommonService.updateNoticeIn(noticeInData);
+//                temp += 1;
+//            }
+//            if(StringUtils.isEmpty(stringBuilder.toString())){
+//                return new PageResponse<String>(RespCodeEnum.CODE_0000.getCode(), "鏁版嵁鍏ㄩ儴瀵煎叆鎴愬姛锛�");
+//            }else {
+//                String message = "鏁版嵁閮ㄥ垎瀵煎叆鎴愬姛锛乗n"+ stringBuilder.toString();
+//                return new PageResponse<String>(RespCodeEnum.CODE_0000.getCode(), message);
+//            }
+//
+//        }
+    }
 }

--
Gitblit v1.9.3