Просмотр исходного кода

新增营销宝单点登录接口

shenjingwei 2 месяцев назад
Родитель
Сommit
fc26c82781

+ 5 - 0
src/custom/restcontroller/R.java

@@ -7215,6 +7215,11 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID2026022713482701 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 26 - 0
src/custom/restcontroller/webmanage/sale/customer/CustomerMD.java

@@ -0,0 +1,26 @@
+package restcontroller.webmanage.sale.customer;
+
+import com.alibaba.fastjson2.JSONObject;
+import common.Controller;
+import common.YosException;
+import common.annotation.API;
+import common.data.QuerySQL;
+import common.data.Rows;
+import common.data.SQLFactory;
+import restcontroller.R;
+
+@API(title = "美大总部终端客户管理")
+public class CustomerMD extends Controller {
+    public CustomerMD(JSONObject content) throws YosException {
+        super(content);
+    }
+
+    @API(title = "客户_列表查询", apiversion = R.ID2026022713482701.v1.class)
+    public String sa_customers_querylist() throws YosException {
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_customers");
+        querySQL.setSiteid(siteid);
+        querySQL.setPage(pageSize, pageNumber);
+        Rows rows = querySQL.query();
+        return getSucReturnObject().setData(rows).toString();
+    }
+}

+ 22 - 5
src/custom/restcontroller/webmanage/sale/dbstockbill/dbstockbill.java

@@ -15,7 +15,9 @@ import common.data.*;
 import restcontroller.R;
 
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 
 public class dbstockbill extends Controller {
@@ -230,12 +232,13 @@ public class dbstockbill extends Controller {
             } else {
                 return getErrReturnObject().setErrMsg("货品" + row.getString("itemname") + "序列号不存在").toString();
             }
-
         }
 
         /******************* 检查序列号是否有效 ********************/
-        Rows skurows = dbConnect.runSqlQuery("select * from sa_itemsku where siteid='" + siteid + "'");
-        RowsMap skurowsmap = skurows.toRowsMap("sku");
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_itemsku");
+        querySQL.setWhere("siteid",siteid);
+        querySQL.setWhere("sku",dbstockbilldetailskus.toArrayList("sku"));
+        RowsMap skurowsmap = querySQL.query().toRowsMap("sku");
         for (Row row : dbstockbilldetailskus) {
             if (!skurowsmap.containsKey(row.getString("sku"))) {
                 return getErrReturnObject().setErrMsg("序列号" + row.getString("sku") + "不存在于序列号表中").toString();
@@ -278,6 +281,7 @@ public class dbstockbill extends Controller {
         insertSQL.setValue("checkby", username);
         insertSQL.setDateValue("checkdate");
         insertSQL.setValue("billdate", dbstockbillrows.get(0).getString("billdate"));
+        insertSQL.setValue("period", getPeriod(dbstockbillrows.get(0).getDate("billdate")));
         sqllist.add(insertSQL.getSQL());
 
         int i = 1;
@@ -333,6 +337,7 @@ public class dbstockbill extends Controller {
             insertSQL.setValue("checkby", username);
             insertSQL.setDateValue("checkdate");
             insertSQL.setValue("billdate", dbstockbillrows.get(0).getString("billdate"));
+            insertSQL.setValue("period", getPeriod(dbstockbillrows.get(0).getDate("billdate")));
             sqllist.add(insertSQL.getSQL());
             int j = 1;
             for (Row row : dbstockbilldetailrows) {
@@ -384,6 +389,16 @@ public class dbstockbill extends Controller {
         return getSucReturnObject().toString();
     }
 
+    public String getPeriod(Date date) throws YosException {
+        String preioddate = new SimpleDateFormat("yyyy-MM-dd").format(date);
+        Rows rows = dbConnect.runSqlQuery("select CONCAT_WS('-', year, LPAD(month, 2, '0')) period from st_period where begdate<='" + preioddate + "' and enddate>='" + preioddate + "'");
+        if (rows.size() != 1) {
+            throw new YosException("单据日期所属会计期间未生成");
+        } else {
+            return rows.get(0).getString("period");
+        }
+    }
+
     @API(title = "反审核", apiversion = R.ID2025061914490803.v1.class)
     @CACHEING_CLEAN(apiClass = {dbstockbill.class, dbstockbilldetail.class})
     public String uncheck() throws YosException {
@@ -394,8 +409,10 @@ public class dbstockbill extends Controller {
         RowsMap dbstockbilldetailrowsMap = dbstockbilldetailrows.toRowsMap("st_dbstockbilldetailid");
 
         /******************* 检查序列号是否有效 ********************/
-        Rows skurows = dbConnect.runSqlQuery("select * from sa_itemsku where siteid='" + siteid + "'");
-        RowsMap skurowsmap = skurows.toRowsMap("sku");
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_itemsku");
+        querySQL.setWhere("siteid",siteid);
+        querySQL.setWhere("sku",dbstockbilldetailskus.toArrayList("sku"));
+        RowsMap skurowsmap = querySQL.query().toRowsMap("sku");
         for (Row row : dbstockbilldetailskus) {
             if (!skurowsmap.containsKey(row.getString("sku"))) {
                 return getErrReturnObject().setErrMsg("序列号" + row.getString("sku") + "不存在于序列号表中").toString();

+ 14 - 1
src/custom/restcontroller/webmanage/sale/dbstockbill/dbstockbillreceive.java

@@ -10,7 +10,9 @@ import common.data.*;
 import restcontroller.R;
 
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 
 public class dbstockbillreceive extends Controller {
     public dbstockbillreceive(JSONObject content) throws YosException {
@@ -123,7 +125,8 @@ public class dbstockbillreceive extends Controller {
         insertSQL.setDateValue("createdate");
         insertSQL.setValue("checkby", username);
         insertSQL.setDateValue("checkdate");
-        insertSQL.setValue("billdate", rows.get(0).getLong("billdate"));
+        insertSQL.setValue("billdate", rows.get(0).getString("billdate"));
+        insertSQL.setValue("period", getPeriod(rows.get(0).getDate("billdate")));
         sqllist.add(insertSQL.getSQL());
         int j = 1;
         for (Row row : dbstockbilldetail) {
@@ -165,6 +168,16 @@ public class dbstockbillreceive extends Controller {
         return getSucReturnObject().toString();
     }
 
+    public String getPeriod(Date date) throws YosException {
+        String preioddate = new SimpleDateFormat("yyyy-MM-dd").format(date);
+        Rows rows = dbConnect.runSqlQuery("select CONCAT_WS('-', year, LPAD(month, 2, '0')) period from st_period where begdate<='" + preioddate + "' and enddate>='" + preioddate + "'");
+        if (rows.size() != 1) {
+            throw new YosException("单据日期所属会计期间未生成");
+        } else {
+            return rows.get(0).getString("period");
+        }
+    }
+
     public ArrayList<String> updateIcinvbal(boolean ischeck, boolean isinstock, Rows dbstockbilldetail) throws YosException {
         ArrayList<String> sqlList = new ArrayList();
         ArrayList<Long> itemids = new ArrayList<Long>();

+ 14 - 1
src/custom/restcontroller/webmanage/sale/sendrepair/sendrepair.java

@@ -16,7 +16,9 @@ import org.apache.commons.lang.StringUtils;
 import restcontroller.R;
 
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 
 @API(title = "送修单")
 public class sendrepair extends Controller {
@@ -834,7 +836,7 @@ public class sendrepair extends Controller {
      */
     public ArrayList<String> updatefitemno(boolean istrue, Row sendrepairdetail) throws YosException {
         ArrayList<String> sqlList = new ArrayList<>();
-        Rows skurows = dbConnect.runSqlQuery("select * from sa_itemsku where sku='" + sendrepairdetail.getString("sku") + "' and status!='报废'");
+        Rows skurows = dbConnect.runSqlQuery("select * from sa_itemsku where siteid='"+siteid+"' and sku='" + sendrepairdetail.getString("sku") + "' and status!='报废'");
         if (skurows.isEmpty()) {
             throw new YosException("序列号不存在或已作废");
         }
@@ -1008,6 +1010,7 @@ public class sendrepair extends Controller {
             insertSQL.setValue("createby", username);
             insertSQL.setDateValue("createdate");
             insertSQL.setDateValue("billdate");
+            insertSQL.setValue("period", getPeriod(getDate()));
             insertSQL.setValue("checkby", username);
             insertSQL.setDateValue("checkdate");
             sqlList.add(insertSQL.getSQL());
@@ -1054,6 +1057,16 @@ public class sendrepair extends Controller {
         return sqlList;
     }
 
+    public String getPeriod(Date date) throws YosException {
+        String preioddate = new SimpleDateFormat("yyyy-MM-dd").format(date);
+        Rows rows = dbConnect.runSqlQuery("select CONCAT_WS('-', year, LPAD(month, 2, '0')) period from st_period where begdate<='" + preioddate + "' and enddate>='" + preioddate + "'");
+        if (rows.size() != 1) {
+            throw new YosException("单据日期所属会计期间未生成");
+        } else {
+            return rows.get(0).getString("period");
+        }
+    }
+
     /**
      * 正品入库
      */

+ 1 - 1
src/resources/application.yaml

@@ -10,6 +10,6 @@ system:
     driver: "com.mysql.cj.jdbc.Driver"
     username: "root"
     password: "root"
-    url: "jdbc:mysql://localhost:3306/mdyos"
+    url: "jdbc:mysql://localhost:2206/mdyos"
     #url: jdbc:mysql://host.docker.internal:3306/yos3
     servicename: "mysql80"