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

+ 49 - 22
src/custom/restcontroller/webmanage/sale/paybill/Paybill.java

@@ -17,6 +17,7 @@ import common.data.Rows;
 import common.data.SQLFactory;
 import restcontroller.R;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 
 @API(title = "打款凭证")
@@ -168,7 +169,7 @@ public class Paybill extends Controller {
     }
 
     @API(title = "审核", apiversion = R.ID20221226153304.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20221226152904.v1.class, R.ID20221010102903.v1.class, R.ID20230111103403.v1.class, R.ID20230202100104.v1.class})
+    @CACHEING_CLEAN(apiversions = {R.ID20221226152904.v1.class, R.ID20221009102903.v1.class, R.ID20230111103403.v1.class, R.ID20230202100104.v1.class})
     public String check() throws YosException {
         ArrayList<String> sqlList = new ArrayList<>();
         Long sa_paybillid = content.getLong("sa_paybillid");
@@ -193,34 +194,28 @@ public class Paybill extends Controller {
         sqlList.add(DataContrlLog.createLog(this, "sa_paybill", sa_paybillid, "审核", "打款凭证审核").getSQL());
         long sys_enterpriseid = rows.get(0).getLong("sys_enterpriseid");
         String billno = rows.get(0).getString("billno");
-        CashbillEntity cashbillEntity = new CashbillEntity();
-        cashbillEntity.setOwnerid(sa_paybillid);
-        cashbillEntity.setOwnertable("sa_paybill");
-        cashbillEntity.setSource("打款凭证");
-        cashbillEntity.setSourcenote(billno);
-        cashbillEntity.setRemarks(rows.get(0).getString("remarks"));
+        String remarks = rows.get(0).getString("remarks");
         for (Row row : accountclassRows) {
-            cashbillEntity.setAmount(row.getBigDecimal("amount"));
-            sqlList.addAll(Accountbalance.createCashbillIncome(this, sys_enterpriseid, row.getLong("sa_accountclassid"), cashbillEntity, false));
+            BigDecimal amount = row.getBigDecimal("amount");
+            sqlList.addAll(createCashbillIncome(this, sys_enterpriseid, row.getLong("sa_accountclassid"), remarks, amount,sa_paybillid,billno));
         }
         dbConnect.runSqlUpdate(sqlList);
-        String message="打款单审核:“您的打款单"+billno+"关联的收入凭证已审核,款已打入您的账户,请及时查收!”";
-        sendMsg(message, sa_paybillid, sys_enterpriseid);
         return getSucReturnObject().toString();
     }
 
-    public void sendMsg(String content, Long sa_paybillid, Long sys_enterpriseid) throws YosException {
+//    public void sendMsg(String content, Long sa_paybillid, Long sys_enterpriseid) throws YosException {
+//
+//        ArrayList<Long> userList = getEnterpriseHrs(sys_enterpriseid).toArrayList("userid", new ArrayList<>());
+//        Remind remind = new Remind(this);
+//        remind.setTitle("打款消息");
+//        remind.setContent(content);
+//        remind.setType("应用");
+//        remind.setObjectid(sa_paybillid);
+//        remind.setObjectname("sa_paybill");
+//        remind.setTouserid(userList);
+//        remind.sendByDialogMsg().createSys_message();
+//    }
 
-        ArrayList<Long> userList = getEnterpriseHrs(sys_enterpriseid).toArrayList("userid", new ArrayList<>());
-        Remind remind = new Remind(this);
-        remind.setTitle("打款消息");
-        remind.setContent(content);
-        remind.setType("应用");
-        remind.setObjectid(sa_paybillid);
-        remind.setObjectname("sa_paybill");
-        remind.setTouserid(userList);
-        remind.sendByDialogMsg().createSys_message();
-    }
     @API(title = "详情", apiversion = R.ID20221226153404.v1.class)
     public String queryById() throws YosException {
         Long sa_paybillid = content.getLong("sa_paybillid");
@@ -262,4 +257,36 @@ public class Paybill extends Controller {
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         return getSucReturnObject().setData(rows).toString();
     }
+
+    public static ArrayList<String> createCashbillIncome(Controller controller, long sys_enterpriseid, long sa_accountclassid,String remarks,BigDecimal amount,Long sa_paybillid,String billno) throws YosException {
+        ArrayList<String> sqlList = new ArrayList<>();
+        long sa_cashbillid = controller.createTableID("sa_cashbill");
+        String billcode = controller.createBillCode("cashbill");
+        SQLFactory sqlFactory = new SQLFactory(controller, "收支凭证新增");
+        sqlFactory.addParameter("billno", billcode);
+        sqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
+        sqlFactory.addParameter("sa_accountclassid", sa_accountclassid);
+        sqlFactory.addParameter("type", 1);
+        sqlFactory.addParameter("siteid", controller.siteid);
+        sqlFactory.addParameter("remarks", remarks);
+        sqlFactory.addParameter("amount", amount);
+        sqlFactory.addParameter("sa_cashbillid", sa_cashbillid);
+        sqlFactory.addParameter("userid", controller.userid);
+        sqlFactory.addParameter("username", controller.username);
+        sqlFactory.addParameter("ownertable", "sa_paybill");
+        sqlFactory.addParameter("ownerid", sa_paybillid);
+        sqlFactory.addParameter("source", "打款凭证");
+        sqlFactory.addParameter("sourcenote", billno);
+        sqlFactory.addParameter("sa_cashbillid_rebate", "null");
+        sqlFactory.addParameter("status", "审核");
+        sqlFactory.addParameter("class", "货款");
+        sqlFactory.addParameter("status", "新建");
+        sqlFactory.addParameter("checkby", "null");
+        sqlFactory.addParameter("checkdate", "null");
+        sqlFactory.addParameter("balance", 0);
+        sqlList.add(sqlFactory.getSQL());
+        String content = "您有一项来自【打款凭证】金额为" + amount + "的【收入】凭证";
+        new Accountbalance().sendMsg(controller, content, sa_paybillid, sys_enterpriseid);
+        return sqlList;
+    }
 }

+ 7 - 0
src/custom/restcontroller/webmanage/sale/paybill/SQL/收支凭证新增.sql

@@ -0,0 +1,7 @@
+insert into sa_cashbill (siteid, sa_cashbillid, createuserid, createby, createdate, billno, changeuserid, changeby,
+                         changedate, checkby, checkdate,
+                         sys_enterpriseid, sa_accountclassid, type, remarks, amount, status, source, sourcenote,
+                         ownertable, ownerid, balance, sa_cashbillid_rebate,class)
+values ($siteid$, $sa_cashbillid$, $userid$, $username$, CURRENT_TIME, $billno$, $userid$, $username$, CURRENT_TIME,
+        $checkby$, $checkdate$, $sys_enterpriseid$, $sa_accountclassid$, $type$, $remarks$,
+        $amount$, $status$, $source$, $sourcenote$, $ownertable$, $ownerid$, $balance$, $sa_cashbillid_rebate$,$class$);