浏览代码

年计划生成月计划。年计划导入

QuietShadow 3 年之前
父节点
当前提交
163011c516

+ 81 - 0
src/main/java/com/steerinfo/ems/Utils/ExcelToolUtils.java

@@ -200,6 +200,87 @@ public class ExcelToolUtils {
         return result;
     }
 
+    /**
+     * 解析文件的方法.
+     *
+     * @param inputStream 文件输入流, 要解析的Excel文件输入流
+     * @param fileName    文件名.
+     * @param startRow    从第几行开始读取数据.
+     * @return List<String []> 集合中的一个元素对应一行解析的数据.
+     * 元素为字符串数组类型. 数组中的每个元素对应一列数据.
+     * @throws IOException
+     */
+    public static List<List<String[]>> parseExcels(InputStream inputStream, String fileName, int startRow)
+            throws IOException {
+
+        // 1. 定义excel对象变量
+        Workbook workbook = null;
+
+        //获取后缀
+        String suffix = fileName.substring(fileName.lastIndexOf("."));
+
+        // 2. 判断后缀.决定使用的解析方式. 决定如何创建具体的对象
+        if (".xls".equals(suffix)) {
+            // 2003
+            workbook = new HSSFWorkbook(inputStream);
+        } else if (".xlsx".equals(suffix)) {
+            // 2007
+            workbook = new XSSFWorkbook(inputStream);
+        } else {
+            // 未知内容
+            throw new MarketSlmException(500, "请选择xls或者xlsx文件!");
+        }
+        List<List<String[]>> result = new ArrayList<>();
+        for (int k = 0; k < workbook.getNumberOfSheets();k++) {
+            // 获取工作表  excel分为若干个表. sheet
+            Sheet sheet = workbook.getSheetAt(k);
+
+            if (sheet == null) {
+                return null;
+            }
+
+            // 获取表格中最后一行的行号
+            int lastRowNum = sheet.getLastRowNum();
+
+            // 最后一行的行号小于startRow
+            if (lastRowNum < startRow) {
+                throw new MarketSlmException(500, "请输入数据");
+            }
+            List<String[]> res = new ArrayList<>();
+            // 定义行变量和单元格变量
+            Row row = null;
+            Cell cell = null;
+            // 循环读取
+            try {
+                for (int rowNum = startRow; rowNum <= lastRowNum; rowNum++) {
+                    row = sheet.getRow(rowNum);
+                    // 获取当前行的第一列和最后一列的标记(列数)
+                    short firstCellNum = row.getFirstCellNum();//第一列从0开始
+                    short lastCellNum = row.getLastCellNum();//最后一列
+                    if (lastCellNum != 0) {
+                        String[] rowArray = new String[lastCellNum];
+                        for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNum++) {
+                            cell = row.getCell(cellNum);
+                            // 判断单元格是否有数据
+                            if (cell == null) {
+                                rowArray[cellNum] = null;
+                            } else {
+                                rowArray[cellNum] = parseCell(cell);
+                            }
+                        }
+                        if (rowArray[0] != null || !rowArray[0].equals("")) {
+                            res.add(rowArray);
+                        }
+                    }
+                }
+                result.add(res);
+            } catch (Exception e) {
+                throw new MarketSlmException(500, "文件存在隐藏行或合并列!");
+            }
+        }
+        return result;
+    }
+
     /**
      * 解析单元格
      *

+ 43 - 9
src/main/java/com/steerinfo/ems/emsprodplanyear/controller/EmsProdplanYearController.java

@@ -1,6 +1,7 @@
 package com.steerinfo.ems.emsprodplanyear.controller;
 
 import com.steerinfo.auth.utils.JwtUtil;
+import com.steerinfo.ems.Utils.ExcelToolUtils;
 import com.steerinfo.ems.emsprodplanmonth.mapper.EmsProdplanMonthMapper;
 import com.steerinfo.ems.emsprodplanmonth.model.EmsProdplanMonth;
 import com.steerinfo.ems.emsprodplanmonth.service.IEmsProdplanMonthService;
@@ -15,7 +16,9 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -176,6 +179,8 @@ public class EmsProdplanYearController extends BaseRESTfulController {
                     sumWeight = model.getWeight().intValue();
                     productid="发电量";
                     unit="006";
+                    // 发电厂合计
+                    workProcid = "AT1006";
                     break;
                 case "JCS" :
                     sumWeight = model.getWeight().intValue();
@@ -198,11 +203,11 @@ public class EmsProdplanYearController extends BaseRESTfulController {
                     sumWeight = model.getWeight().intValue();
                     if(model.getLine().equals("AT3009")) {
                         productid = "粗苯";
-                        workProcid = "AT2011";
+                        workProcid = "AT3009";
                     }
                     if (model.getLine().equals("AT3024")){
                         productid="焦油";
-                        workProcid = "AT2011";//model.setLine("AT2011");
+                        workProcid = "AT3024";//model.setLine("AT2011");
                     }
                     if(model.getLine().equals("AT3010")){
                         productid="硫铵";
@@ -210,7 +215,7 @@ public class EmsProdplanYearController extends BaseRESTfulController {
                     }
                     if(model.getLine().equals("AT3025")){
                         productid="硫酸";
-                        workProcid = "AT2011";
+                        workProcid = "AT3025";
                     }
                     if(model.getLine().equals("AT2012")){
                         productid="精煤";
@@ -260,7 +265,7 @@ public class EmsProdplanYearController extends BaseRESTfulController {
                 if(monList.size()<=0){
                     EmsProdplanMonth emsProdplanMonth = emsProdplanMonthService.add(monModel);
                 } else {
-                    if(model.getParentid().equals("LG") || model.getParentid().equals("JJZ")) {
+                    if((model.getParentid().equals("LG") && monModel.getProductid().equals("方坯")) || model.getParentid().equals("JJZ") || model.getParentid().equals("FDC")) {
                         monModel.setKxf_weight(monList.get(0).getKxf_weight().add(monModel.getKxf_weight()));
                         monModel.setWeightMonth(monList.get(0).getWeightMonth().add(monModel.getWeightMonth()));
                         monModel.setWeightDay(monList.get(0).getWeightDay().add(monModel.getWeightDay()));
@@ -405,6 +410,8 @@ public class EmsProdplanYearController extends BaseRESTfulController {
                 case "FDC" :
                     sumWeight = model.getWeight().intValue();
                     productid="发电量";
+                    // 发电厂合计
+                    workProcid = "AT1006";
                     unit="006";
                     break;
                 case "JCS" :
@@ -439,11 +446,12 @@ public class EmsProdplanYearController extends BaseRESTfulController {
                     sumWeight = model.getWeight().intValue();
                     if(model.getLine().equals("AT3009")) {
                         productid = "粗苯";
-                        workProcid = "AT2011";
+                        //workProcid = "AT2011";
+                        workProcid = "AT3009";
                     }
                     if (model.getLine().equals("AT3024")){
                         productid="焦油";
-                        workProcid = "AT2011";
+                        workProcid = "AT3024";
                     }
                     if(model.getLine().equals("AT3010")){
                         productid="硫铵";
@@ -451,7 +459,7 @@ public class EmsProdplanYearController extends BaseRESTfulController {
                     }
                     if(model.getLine().equals("AT3025")){
                         productid="硫酸";
-                        workProcid = "AT2011";
+                        workProcid = "AT3025";
                     }
                     if(model.getLine().equals("AT2012")){
                         productid="精煤";
@@ -494,8 +502,8 @@ public class EmsProdplanYearController extends BaseRESTfulController {
                 if(monList.size()<=0){
                         emsProdplanMonthService.add(monModel);
                 } else {
-                    if((model.getParentid().equals("LG")&&monModel.getProductid().equals("方坯")) || model.getParentid().equals("JJZ")) {
-                        if (k == 0){
+                    if((model.getParentid().equals("LG")&&monModel.getProductid().equals("方坯")) || model.getParentid().equals("JJZ") || model.getParentid().equals("FDC")) {
+                        if (i == 0){
                             monList.get(0).setWeightMonth(BigDecimal.valueOf(0));
                             monList.get(0).setWeightDay(BigDecimal.valueOf(0));
                         }
@@ -575,4 +583,30 @@ public class EmsProdplanYearController extends BaseRESTfulController {
 //        }
         return success();
     }
+    /**
+     * @MethodName excelimport
+     * @Author Shadow
+     * @Description 导入文件
+     * @Date 2021/12/30 15:20
+     **/
+
+    @PostMapping(value = "excelimport")
+    public RESTfulResult excelimport(@RequestParam("file") MultipartFile file) throws Exception {
+        RESTfulResult rs= null;
+        try {
+            if(file.isEmpty()){
+                return failed(null,"上传失败,请选择文件");
+            }
+            String fileNmae = file.getOriginalFilename();
+            File files =  ExcelToolUtils.multipartFileToFile(file);
+            rs = emsProdplanYearService.insertexcel(files);
+            ExcelToolUtils.delteTempFile(files);
+        } catch (Exception e){
+            e.printStackTrace();
+            rs.setCode("500");
+            rs.setMessage("服务端异常!");
+        }finally {
+        }
+        return rs;
+    }
 }

+ 10 - 0
src/main/java/com/steerinfo/ems/emsprodplanyear/service/IEmsProdplanYearService.java

@@ -1,8 +1,10 @@
 package com.steerinfo.ems.emsprodplanyear.service;
 
 import com.steerinfo.ems.emsprodplanyear.model.EmsProdplanYear;
+import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.IBaseService;
 
+import java.io.File;
 import java.text.ParseException;
 import java.util.Date;
 import java.util.HashMap;
@@ -59,4 +61,12 @@ public interface IEmsProdplanYearService extends IBaseService<EmsProdplanYear, S
      * @return 每天的数量
      */
     public int[] avgWeight(Integer sumWeight,Integer day);
+
+    /**
+     * 年计划根据模板导入
+     * @param file
+     * @return
+     * @throws Exception
+     */
+    RESTfulResult insertexcel(File file) throws Exception;
 }

+ 304 - 0
src/main/java/com/steerinfo/ems/emsprodplanyear/service/impl/EmsProdplanYearServiceImpl.java

@@ -1,16 +1,24 @@
 package com.steerinfo.ems.emsprodplanyear.service.impl;
 
+import com.steerinfo.ems.Utils.ExcelToolUtils;
+import com.steerinfo.ems.Utils.MarketSlmException;
 import com.steerinfo.ems.emsprodplanyear.mapper.EmsProdplanYearMapper;
 import com.steerinfo.ems.emsprodplanyear.model.EmsProdplanYear;
 import com.steerinfo.ems.emsprodplanyear.service.IEmsProdplanYearService;
+import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import com.steerinfo.framework.user.UserPayload;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.regex.Pattern;
 
 /**
  * EmsProdplanYear服务实现:
@@ -81,4 +89,300 @@ public class EmsProdplanYearServiceImpl extends BaseServiceImpl<EmsProdplanYear,
         weightArr[day-1] =sumWeight - (avgWeight * ( day - 1));
         return weightArr;
     }
+    @Override
+    public RESTfulResult insertexcel(File file) throws Exception {
+        RESTfulResult rs = new RESTfulResult("200", "数据导入成功,不规范数据已自动剔除");
+        rs.setCode("200");
+        List<EmsProdplanYear> lsp = null;
+        try {
+            lsp = createCheckCar(file);
+            if (lsp.size()>0)
+            {
+                int spm = emsProdplanYearMapper.batchInsert(lsp);
+            }
+            else
+            {
+                rs.setMessage("导入失败,导入数据已经存在!");
+                rs.setCode("500");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            rs.setCode("500");
+            rs.setMessage(e.getMessage());
+        } finally {
+
+        }
+        return rs;
+    }
+    public  List<EmsProdplanYear> createCheckCar(File file ) throws Exception, IOException {
+        UserPayload payload = UserPayload.getCurrUser();
+        FileInputStream is = null;
+        String fileName = file.getName();
+        // 解决fileName兼容性问题
+        int lastindex = fileName.lastIndexOf("\\");
+        fileName = fileName.substring(lastindex + 1);
+        List<EmsProdplanYear> lists = new ArrayList<>();
+        if (fileName != null && fileName.length() > 0) {
+            is = new FileInputStream(file);
+        }
+        List<List<String[]>> list = ExcelToolUtils.parseExcels(is, fileName, 0);
+
+        // SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            String name = fileName.substring(2, 4);
+            for (int i = 1; i < list.size(); i++) {
+                for(int j = 1; j < list.get(i).size(); j++) {
+                    String[] arr = list.get(i).get(j);
+                    String[] arr1 = list.get(i).get(0);
+                //String steel = emsGmPcJhMapper.selectsteelcode(arr[1], arr[0]);
+                //
+                //String heat = emsGmPcJhMapper.selectheatno(arr[0]);
+
+                EmsProdplanYear spp = new EmsProdplanYear();
+                ////查询是已经有数据了,有数据不执行导入功能
+                //String v1 = emsGmPcJhMapper.select4(arr[0]);
+                //if (Integer.valueOf(v1)>0) {
+                //    continue;
+                //}
+                //AT2005 = "G-G1-";
+                //AT2006 = "G-G2-";
+                //AT2004 = "G-L1-";
+                //AT2007 = "G-X1-";
+                //Pattern pattern = Pattern.compile("^-?[0-9]+"); //这个也行
+                //Pattern pattern = Pattern.compile("^-?\\d+(\\.\\d+)?$");//这个也行
+                //正整数
+                Pattern pattern = Pattern.compile("[0-9]*");
+                if(arr[0].length()>8 || !pattern.matcher(arr[0]).matches()){
+                    throw new MarketSlmException(500,"排产日期(编号)有误!");
+                }
+                StringBuffer s=new StringBuffer(arr[0]).insert(4,"-").insert(7,"-");
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                simpleDateFormat.setLenient(false);
+                //spp.setJhTime(simpleDateFormat.parse(s.toString()));
+                spp.setStartTime(arr[0]);
+                //switch (name) {
+                //    case "型钢" :
+                //        if(arr[1].contains("一")){
+                //            spp.setType("G-X1-");
+                //            spp.setWorkprocType("AT2007");
+                //        } else {
+                //            spp.setType("G-X2-");
+                //        }
+                //        break;
+                //    case "钢坯" :
+                //        spp.setType("G-L1-");
+                //        spp.setWorkprocType("AT2004");
+                //        break;
+                //    case "高线" :
+                //        if(arr[1].contains("一")){
+                //            spp.setType("G-G1-");
+                //            spp.setWorkprocType("AT2005");
+                //        } else {
+                //            spp.setType("G-G2-");
+                //            spp.setWorkprocType("AT2006");
+                //        }
+                //        break;
+                //    default: throw new Exception("请选择模板文件");
+                //}
+                String maxid = "";
+                String strh =maxid.substring(maxid.length() -2,maxid.length());
+                Integer seq = Integer.parseInt(strh)+(i-1);
+                spp.setId(maxid.replace("-"+strh,seq<10?"-0"+seq.toString():"-"+seq.toString()));
+                //spp.setState("0");
+                //spp.setCreateMan(payload.getUserName());
+                //spp.setCreateTime(new Date());
+                //spp.setUnitid("008");
+                //for(int j =1;j<arr1.length;j++) {
+                //    switch (arr1[j].trim()) {
+                //        case "规格" :
+                //            spp.setSpecifications(arr[j]);
+                //            break;
+                //        case "钢种" :
+                //            spp.setGrades(arr[j]);
+                //            break;
+                //        case "长度" :
+                //            spp.setLengths(new BigDecimal(arr[j]));
+                //            break;
+                //        case "运输方式" :
+                //            spp.setTransportType(arr[j]);
+                //            break;
+                //        case "用途" :
+                //            spp.setPurpose(arr[j]);
+                //            break;
+                //        case "订单量" :
+                //            if(!pattern.matcher(arr[j]).matches()){
+                //                throw new MarketSlmException(500,"订单量有误,请仔细检查");
+                //            }
+                //            spp.setKxfWeight(new BigDecimal(arr[j]));
+                //            spp.setYxfWeight(new BigDecimal("0"));
+                //            spp.setPlanWeight(new BigDecimal(arr[j]));
+                //            break;
+                //        case "交货日期" :
+                //            spp.setDeliveryDate(simpleDateFormat.parse(arr[j]));
+                //            break;
+                //        case "备注" :
+                //            spp.setMemo(arr[j]);
+                //            break;
+                //        case "分厂" : continue;
+                //        case "应急标识" :
+                //            if(arr[j] != null && "应急".equals(arr[j].trim()) ) {
+                //                spp.setTag("1");
+                //                break;
+                //            }
+                //            spp.setTag("0");
+                //            break;
+                //        default:
+                //            throw new MarketSlmException(500,"模板文件存在模板外的列,请仔细检查!!");
+                //    }
+                //}
+                //spp.setSteelCode(steel);
+                //spp.setHeatno(heat);
+                //for (int j=2;j<10;j++)
+                //{
+                //    if (arr1[j].equals("屈服强度ReH"))
+                //    {
+                //        spp.setQltyVal1(arr[j]);
+                //        spp.setQltyCfnm("屈服强度R(eH)");
+                //        spp.setQltyCd("qy0001");
+                //        List<Map<String,Object>> rows = qcmQltyJudgeMapper.selectstd(spp.getSteelCode(), spp.getQltyCd());
+                //        if(rows.size()>0)
+                //        {
+                //            if(rows.get(0).get("QLTY_MIN")!=null)
+                //            {
+                //                spp.setQltyMin(rows.get(0).get("QLTY_MIN").toString());
+                //            }
+                //            if(rows.get(0).get("QLTY_MAX")!=null)
+                //            {
+                //                spp.setQltyMax(rows.get(0).get("QLTY_MAX").toString());
+                //            }
+                //        }
+                //        EmsGmPcJh spp1 = new EmsGmPcJh();
+                //        BeanUtils.copyProperties(spp,spp1);
+                //        lists.add(spp1);
+                //    }
+                //    if (arr1[j].equals("屈服强度ReL"))
+                //    {
+                //        spp.setQltyVal1(arr[j]);
+                //        spp.setQltyCfnm("屈服强度R(eL)");
+                //        spp.setQltyCd("qy0002");
+                //        List<Map<String,Object>> rows = qcmQltyJudgeMapper.selectstd(spp.getSteelCode(), spp.getQltyCd());
+                //        if(rows!=null&&!"".equals(rows.toString()))
+                //        {
+                //            if(rows.get(0).get("QLTY_MIN")!=null)
+                //            {
+                //                spp.setQltyMin(rows.get(0).get("QLTY_MIN").toString());
+                //            }
+                //            if(rows.get(0).get("QLTY_MIN")!=null)
+                //            {
+                //                spp.setQltyMax(rows.get(0).get("QLTY_MAX").toString());
+                //            }
+                //        }
+                //        EmsGmPcJh spp1 = new EmsGmPcJh();
+                //        BeanUtils.copyProperties(spp,spp1);
+                //        lists.add(spp1);
+                //    }
+                //    if (arr1[j].equals("抗拉强度Rm"))
+                //    {
+                //        spp.setQltyVal1(arr[j]);
+                //        spp.setQltyCfnm("抗拉强度Rm");
+                //        spp.setQltyCd("qy0003");
+                //        List<Map<String,Object>> rows = qcmQltyJudgeMapper.selectstd(spp.getSteelCode(), spp.getQltyCd());
+                //        if(rows.get(0).get("QLTY_MIN")!=null)
+                //        {
+                //            spp.setQltyMin(rows.get(0).get("QLTY_MIN").toString());
+                //        }
+                //        if(rows.get(0).get("QLTY_MAX")!=null)
+                //        {
+                //            spp.setQltyMax(rows.get(0).get("QLTY_MAX").toString());
+                //        }
+                //        EmsGmPcJh spp1 = new EmsGmPcJh();
+                //        BeanUtils.copyProperties(spp,spp1);
+                //        lists.add(spp1);
+                //    }
+                //
+                //    if (arr1[j].equals("断后伸长率%"))
+                //    {
+                //        spp.setQltyVal1(arr[j]);
+                //        spp.setQltyCfnm("断后伸长率%");
+                //        spp.setQltyCd("qy0004");
+                //        List<Map<String,Object>> rows = qcmQltyJudgeMapper.selectstd(spp.getSteelCode(), spp.getQltyCd());
+                //        if(rows.get(0).get("QLTY_MIN")!=null)
+                //        {
+                //            spp.setQltyMin(rows.get(0).get("QLTY_MIN").toString());
+                //        }
+                //        if(rows.get(0).get("QLTY_MAX")!=null)
+                //        {
+                //            spp.setQltyMax(rows.get(0).get("QLTY_MAX").toString());
+                //        }
+                //        EmsGmPcJh spp1 = new EmsGmPcJh();
+                //        BeanUtils.copyProperties(spp,spp1);
+                //        lists.add(spp1);
+                //    }
+                //
+                //    if (arr1[j].equals("冲击试验温度"))
+                //    {
+                //        spp.setQltyVal1(arr[j]);
+                //        spp.setQltyCfnm("冲击试验温度");
+                //        spp.setQltyCd("qy0005");
+                //        List<Map<String,Object>> rows = qcmQltyJudgeMapper.selectstd(spp.getSteelCode(), spp.getQltyCd());
+                //        if(rows.get(0).get("QLTY_MIN")!=null)
+                //        {
+                //            spp.setQltyMin(rows.get(0).get("QLTY_MIN").toString());
+                //        }
+                //        if(rows.get(0).get("QLTY_MAX")!=null)
+                //        {
+                //            spp.setQltyMax(rows.get(0).get("QLTY_MAX").toString());
+                //        }
+                //        EmsGmPcJh spp1 = new EmsGmPcJh();
+                //        BeanUtils.copyProperties(spp,spp1);
+                //        lists.add(spp1);
+                //    }
+                //    if (arr1[j].equals("冷弯"))
+                //    {
+                //        spp.setQltyVal1(arr[j]);
+                //        spp.setQltyCfnm("冷弯");
+                //        spp.setQltyCd("qy0009");
+                //        List<Map<String,Object>> rows = qcmQltyJudgeMapper.selectstd(spp.getSteelCode(), spp.getQltyCd());
+                //        if(rows.get(0).get("QLTY_MIN")!=null)
+                //        {
+                //            spp.setQltyMin(rows.get(0).get("QLTY_MIN").toString());
+                //        }
+                //        if(rows.get(0).get("QLTY_MAX")!=null)
+                //        {
+                //            spp.setQltyMax(rows.get(0).get("QLTY_MAX").toString());
+                //        }
+                //        EmsGmPcJh spp1 = new EmsGmPcJh();
+                //        BeanUtils.copyProperties(spp,spp1);
+                //        lists.add(spp1);
+                //    }
+                //    if (arr1[j].equals("冲击吸收功J1"))
+                //    {
+                //        spp.setQltyVal1(arr[j]);
+                //        spp.setQltyVal2(arr[j+1]);
+                //        spp.setQltyVal3(arr[j+2]);
+                //        spp.setQltyCfnm("冲击");
+                //        spp.setQltyCd("qy0006");
+                //        List<Map<String,Object>> rows = qcmQltyJudgeMapper.selectstd(spp.getSteelCode(), spp.getQltyCd());
+                //        if(rows.get(0).get("QLTY_MIN")!=null)
+                //        {
+                //            spp.setQltyMin(rows.get(0).get("QLTY_MIN").toString());
+                //        }
+                //        if(rows.get(0).get("QLTY_MAX")!=null)
+                //        {
+                //            spp.setQltyMax(rows.get(0).get("QLTY_MAX").toString());
+                //        }
+                //        EmsGmPcJh spp1 = new EmsGmPcJh();
+                //        BeanUtils.copyProperties(spp,spp1);
+                //        lists.add(spp1);
+                //    }
+
+                //}
+                lists.add(spp);
+                }
+            }
+        } catch (Exception e){
+            throw new MarketSlmException(500,"导入失败,请检查文档中是否有错误数据。");
+        }
+        return lists;
+    }
 }

+ 2 - 1
src/main/java/com/steerinfo/task/SpringCronTask.java

@@ -253,7 +253,8 @@ public class SpringCronTask implements SchedulingConfigurer{
 					tRmWorkprocProductValueService.setDate(new Date()); // 产品实绩产量、产品计划数据维护
 					tRmWorkprocMaterialValueService.setDate(new Date()); // 原材料数据维护
 					 //新的业务逻辑,从报表获取数据。
-					 DateFormat dateForm = new SimpleDateFormat("YYYY-MM-dd");
+					 //这里是傻逼bug,YYYY-MM-dd 将本周定位下一年。yyyy-MM-dd 是将以天作为年期限。
+					 DateFormat dateForm = new SimpleDateFormat("yyyy-MM-dd");
 					 Calendar calendar=Calendar.getInstance();
 					 calendar.set(Calendar.HOUR_OF_DAY,-24*7);
 					 HashMap<String,Object> hs =new HashMap<>(8);