郭齐峰 2 лет назад
Родитель
Сommit
a738fec81a

+ 36 - 15
src/custom/restcontroller/sale/cashbill/cashbill.java

@@ -101,9 +101,9 @@ public class cashbill extends Controller {
         try {
 
             // 华为云
-            e = getPostExcelFactory(content.getLong("attachmentid"));
+            //e = getPostExcelFactory(content.getLong("attachmentid"));
             // 本地
-            //e = getPostExcelFactory();
+            e = getPostExcelFactory();
 
             // Rows keyRow = dbConnect.runSqlQuery("select fagentnum,faddress from tagents
             // where 1=2");
@@ -139,56 +139,77 @@ public class cashbill extends Controller {
                 if (StringUtils.isEmpty(row.getString("agentnum"))) {
                     iserr = true;
                     msg = msg + "【经销商编码为空】";
+                    row.put("msg", "错误信息:" + msg);
+                    rowserr.add(row);
+                    continue;
                 }
                 if (StringUtils.isEmpty(row.getString("accountname"))) {
                     iserr = true;
                     msg = msg + "【账户名称为空】";
-
+                    row.put("msg", "错误信息:" + msg);
+                    rowserr.add(row);
+                    continue;
                 }
                 if (!isBigDecimal(row.getString("amount"))) {
                     iserr = true;
                     msg = msg + "【金额错误:" + row.getString("amount") + "】";
-
+                    row.put("msg", "错误信息:" + msg);
+                    rowserr.add(row);
+                    continue;
                 }
                 if (StringUtils.isEmpty(row.getString("type"))) {
                     iserr = true;
                     msg = msg + "【分类为空】";
-
+                    row.put("msg", "错误信息:" + msg);
+                    rowserr.add(row);
+                    continue;
                 }
                 if (!agentRowsMap.containsKey(row.getString("agentnum"))) {
                     iserr = true;
                     msg = msg + "【该经销商编码找不到匹配的经销商】";
+                    row.put("msg", "错误信息:" + msg);
+                    rowserr.add(row);
+                    continue;
                 } else {
                     if (agentRowsMap.get(row.getString("agentnum")).isEmpty()) {
                         iserr = true;
                         msg = msg + "【该经销商编码找不到匹配的经销商】";
+                        row.put("msg", "错误信息:" + msg);
+                        rowserr.add(row);
+                        continue;
                     }
                 }
                 if (!accountclassRowsMap.containsKey(row.getString("accountname"))) {
                     iserr = true;
                     msg = msg + "【该账户名称找不到匹配的账户】";
+                    row.put("msg", "错误信息:" + msg);
+                    rowserr.add(row);
+                    continue;
                 } else {
                     if (accountclassRowsMap.get(row.getString("accountname")).isEmpty()) {
                         iserr = true;
                         msg = msg + "【该账户名称找不到匹配的账户】";
+                        row.put("msg", "错误信息:" + msg);
+                        rowserr.add(row);
+                        continue;
                     }
                 }
                 if (StringUtils.isEmpty(row.getString("period"))) {
                     if (type.equals("收入")) {
                         iserr = true;
                         msg = msg + "【未填写归属日期】";
+                        row.put("msg", "错误信息:" + msg);
+                        rowserr.add(row);
+                        continue;
                     } else if (type.equals("支出") && row.getString("subclass").equals("拨款")) {
                         iserr = true;
                         msg = msg + "【未填写归属日期】";
+                        row.put("msg", "错误信息:" + msg);
+                        rowserr.add(row);
+                        continue;
                     }
                 }
-
-                if (iserr) {
-                    row.put("msg", "错误信息:" + msg);
-                    rowserr.add(row);
-                } else {
-                    rowssuc.add(row);
-                }
+                rowssuc.add(row);
 
 //				if (!msg.equals("111")) {
 //					XSSFWorkbook xssfFWorkbook = e.getXssfWorkbook();
@@ -289,7 +310,7 @@ public class cashbill extends Controller {
                 if (!aa.isEmpty()) {
                     url = aa.get(0).getString("url");
                 }
-                return getSucReturnObject().setData(url).toString();
+                return getErrReturnObject().setErrMsg(url).toString();
 
             }
 
@@ -457,7 +478,7 @@ public class cashbill extends Controller {
                 where = where + " and ifnull(t3.isrebate,0) ='" + whereObject.getLongValue("isrebate") + "'";
             }
             if (whereObject.containsKey("remarks") && !"".equals(whereObject.getString("remarks"))) {
-                where = where+" and t1.remarks like'%"+whereObject.getString("remarks") + "%' ";
+                where = where + " and t1.remarks like'%" + whereObject.getString("remarks") + "%' ";
             }
             if (whereObject.containsKey("agentinfo") && !"".equals(whereObject.getString("agentinfo"))) {
                 where = where + " and(t2.enterprisename like'%" + whereObject.getString("agentinfo") + "%'"
@@ -525,7 +546,7 @@ public class cashbill extends Controller {
                 where = where + " and ifnull(t3.isrebate,0) ='" + whereObject.getLongValue("isrebate") + "'";
             }
             if (whereObject.containsKey("remarks") && !"".equals(whereObject.getString("remarks"))) {
-                where = where+" and t1.remarks like'%"+whereObject.getString("remarks") + "%' ";
+                where = where + " and t1.remarks like'%" + whereObject.getString("remarks") + "%' ";
             }
             if (whereObject.containsKey("agentinfo") && !"".equals(whereObject.getString("agentinfo"))) {
                 where = where + " and(t2.enterprisename like'%" + whereObject.getString("agentinfo") + "%'"

+ 45 - 44
src/custom/restcontroller/webmanage/sale/itempriceadjust/ItempriceadjustItemprice.java

@@ -212,7 +212,7 @@ public class ItempriceadjustItemprice extends Controller {
         sqlFactory.addParameter("siteid", siteid);
         sqlList.add(sqlFactory.getSQL());
         for (Object o : sa_itempriceadjust_itemsids) {
-            String sql = "update sa_itempriceadjust_items set rowno=rowno-1 where siteid = '" + siteid + "' and sa_itempriceadjustid="+sa_itempriceadjustid+" and sa_itempriceadjust_itemsid > " + o;
+            String sql = "update sa_itempriceadjust_items set rowno=rowno-1 where siteid = '" + siteid + "' and sa_itempriceadjustid=" + sa_itempriceadjustid + " and sa_itempriceadjust_itemsid > " + o;
             sqlList.add(sql);
             sql = DataContrlLog.createLog(this, "sa_itempriceadjust_itemprice", Long.parseLong(o.toString()), "更新", "商品调价单商品删除:" + o).getSQL();
             sqlList.add(sql);
@@ -280,7 +280,6 @@ public class ItempriceadjustItemprice extends Controller {
                     if (itemnoRowsMap.containsKey(itemno)) {
                         row.put("itemid", itemnoRowsMap.get(itemno).get(0).getLong("itemid"));
                         row.put("oldmarketprice", itemnoRowsMap.get(itemno).get(0).getBigDecimal("marketprice"));
-                        rowssuc.add(row);
                     } else {
                         iserr = true;
                         row.put("msg", "错误信息:不存在商品编号为" + itemno + "的商品");
@@ -297,50 +296,10 @@ public class ItempriceadjustItemprice extends Controller {
                     iserr = true;
                     row.put("msg", "错误信息:商品调整价不能为空");
                     rowserr.add(row);
+                    continue;
                 }
+                rowssuc.add(row);
 
-
-            }
-            if (iserr) {
-                ExcelFactory excelFactory = new ExcelFactory("调价单导入错误信息");
-                HashMap<String, String> map = new HashMap<String, String>();
-                map.put("itemno", "商品编号");
-                map.put("remarks", "备注");
-                map.put("price1", "调整价1");
-                map.put("price2", "调整价2");
-                map.put("price3", "调整价3");
-                map.put("price4", "调整价4");
-                map.put("price5", "调整价5");
-                map.put("msg", "错误信息");
-                ArrayList<String> colNameList = new ArrayList<String>();
-                HashMap<String, Class> keytypemap = new HashMap<String, Class>();
-                colNameList.add("itemno");
-                colNameList.add("remarks");
-                colNameList.add("price1");
-                colNameList.add("price2");
-                colNameList.add("price3");
-                colNameList.add("price4");
-                colNameList.add("price5");
-                colNameList.add("msg");
-                keytypemap.put("itemno", String.class);
-                keytypemap.put("remarks", String.class);
-                keytypemap.put("price1", BigDecimal.class);
-                keytypemap.put("price2", BigDecimal.class);
-                keytypemap.put("price3", BigDecimal.class);
-                keytypemap.put("price4", BigDecimal.class);
-                keytypemap.put("price5", BigDecimal.class);
-                keytypemap.put("msg", String.class);
-                rowserr.setFieldList(colNameList);
-                rowserr.setFieldTypeMap(keytypemap);
-                addSheet(excelFactory, "Sheet1", rowserr, map);
-
-                Rows aa = uploadExcelToObs(excelFactory);
-                String url = "";
-                if (!aa.isEmpty()) {
-                    url = aa.get(0).getString("url");
-                }
-                dbConnect.runSqlUpdate("delete from sa_itempriceadjust where  sa_itempriceadjustid=" + sa_itempriceadjustid);
-                return getSucReturnObject().setData(url).toString();
             }
 
             if (!rowssuc.isEmpty()) {
@@ -405,6 +364,48 @@ public class ItempriceadjustItemprice extends Controller {
             } else {
                 dbConnect.runSqlUpdate("delete from sa_itempriceadjust where  sa_itempriceadjustid=" + sa_itempriceadjustid);
             }
+
+            if (iserr) {
+                ExcelFactory excelFactory = new ExcelFactory("调价单导入错误信息");
+                HashMap<String, String> map = new HashMap<String, String>();
+                map.put("itemno", "商品编号");
+                map.put("remarks", "备注");
+                map.put("price1", "调整价1");
+                map.put("price2", "调整价2");
+                map.put("price3", "调整价3");
+                map.put("price4", "调整价4");
+                map.put("price5", "调整价5");
+                map.put("msg", "错误信息");
+                ArrayList<String> colNameList = new ArrayList<String>();
+                HashMap<String, Class> keytypemap = new HashMap<String, Class>();
+                colNameList.add("itemno");
+                colNameList.add("remarks");
+                colNameList.add("price1");
+                colNameList.add("price2");
+                colNameList.add("price3");
+                colNameList.add("price4");
+                colNameList.add("price5");
+                colNameList.add("msg");
+                keytypemap.put("itemno", String.class);
+                keytypemap.put("remarks", String.class);
+                keytypemap.put("price1", BigDecimal.class);
+                keytypemap.put("price2", BigDecimal.class);
+                keytypemap.put("price3", BigDecimal.class);
+                keytypemap.put("price4", BigDecimal.class);
+                keytypemap.put("price5", BigDecimal.class);
+                keytypemap.put("msg", String.class);
+                rowserr.setFieldList(colNameList);
+                rowserr.setFieldTypeMap(keytypemap);
+                addSheet(excelFactory, "Sheet1", rowserr, map);
+
+                Rows aa = uploadExcelToObs(excelFactory);
+                String url = "";
+                if (!aa.isEmpty()) {
+                    url = aa.get(0).getString("url");
+                }
+                dbConnect.runSqlUpdate("delete from sa_itempriceadjust where  sa_itempriceadjustid=" + sa_itempriceadjustid);
+                return getSucReturnObject().setData(url).toString();
+            }
         } catch (Exception e1) {
             dbConnect.runSqlUpdate("delete from sa_itempriceadjust where  sa_itempriceadjustid=" + sa_itempriceadjustid);
             e1.printStackTrace();