Przeglądaj źródła

【泛微对接】【新增银行登记接口增加账套字段】

wub 1 miesiąc temu
rodzic
commit
39c14659ea

+ 23 - 10
src/main/java/com/uas/eis/service/Impl/ERPServiceImpl.java

@@ -287,7 +287,7 @@ public class ERPServiceImpl implements ERPService {
                 return ApiResponse.failRsp("102","第" + err_out + "条明细行科目不是末级科目,不能保存明细行!");
             }
             Object date = (Object) accountRegisterMain.getDate();
-            baseDao.checkCloseMonth("MONTH-B", date);
+            //baseDao.checkCloseMonth("MONTH-B", date);
 
             boolean bool = baseDao.checkIf(master+"PeriodsDetail", "pd_code='MONTH-B' and pd_status=99 and pd_detno=to_char(to_date('" + date
                     + "','yyyy-mm-dd hh24:mi:ss'), 'yyyymm')");
@@ -346,8 +346,21 @@ public class ERPServiceImpl implements ERPService {
                 }
             }
             baseDao.execute(sqls);
-            String defaultCurr =  baseDao.getDBSetting(caller, "fyCurr");
-            if(defaultCurr != null){
+
+
+            //String defaultCurr =  baseDao.getDBSetting(caller, "fyCurr");
+
+            String defaultCurr="RMB";
+            int count_fyCurr = baseDao.getCount("select count(1) from "+master+"configs where caller='" + caller + "' and code='fyCurr'");
+            if (count_fyCurr>0) {
+                Configs config = baseDao.getJdbcTemplate().queryForObject("select *  from "+master+"configs where caller=? and code=?",
+                        new BeanPropertyRowMapper<Configs>(Configs.class), caller, code);
+                if (config != null) {
+                    defaultCurr = config.getData();
+                }
+            }
+
+            if(defaultCurr != null ){
                 baseDao.execute("update "+master+"accountregisterdetail set ard_currency='"+defaultCurr+"' WHERE ard_arid in (select ar_id from "+master+"accountregister where ar_id=" + ar_id +" and nvl(ar_currencytype,0)<>0 and ar_type='费用') and nvl(ard_currency,' ')=' '");
             }
             baseDao.execute("update "+master+"accountregisterdetail set ard_rate=(select cm_crrate from "+master+"CurrencysMonth,"+master+"accountregister where ard_arid=ar_id and cm_crname=ard_currency "
@@ -414,7 +427,7 @@ public class ERPServiceImpl implements ERPService {
                     }
                 }
             }
-            updateErrorString(ar_id);
+            updateErrorString(ar_id,master);
             result.put("code", code);
             result.put("date", ar_date);
         }catch (Exception e){
@@ -426,32 +439,32 @@ public class ERPServiceImpl implements ERPService {
     }
 
 
-    public void updateErrorString(int id) {
+    public void updateErrorString(int id,String master) {
         // 多辅助核算项的核算明细按照科目编号中辅助核算名称顺序重排
         SqlRowList detailList = baseDao
                 .queryForRowSet(
-                        "select ard_id,ca_assname from accountregisterdetail left join category on ard_catecode=ca_code where ard_arid=? and ca_assname is not null and instr(ca_assname,'#')>0",
+                        "select ard_id,ca_assname from "+master+"accountregisterdetail left join "+master+"category on ard_catecode=ca_code where ard_arid=? and ca_assname is not null and instr(ca_assname,'#')>0",
                         id);
         while (detailList.next()) {
             String[] assNames = detailList.getString("ca_assname").split("#");
             int index = 1;
             for (String assName : assNames) {
-                baseDao.execute("update accountregisterdetailass set ars_detno=? where ars_ardid=? and ars_asstype=? and ars_detno<>?",
+                baseDao.execute("update "+master+"accountregisterdetailass set ars_detno=? where ars_ardid=? and ars_asstype=? and ars_detno<>?",
                         index, detailList.getObject("ard_id"), assName, index);
                 index++;
             }
         }
         // 单据类型为 费用 或者其它收款 或者其它付款
-        baseDao.updateByCondition("AccountRegister", "ar_errstring = null", "ar_id=" + id);
+        baseDao.updateByCondition(master+"AccountRegister", "ar_errstring = null", "ar_id=" + id);
         SqlRowList rs = baseDao
                 .queryForRowSet(
                         "SELECT abs((ROUND(AR_DEPOSIT*AR_ACCOUNTRATE,2)+SUM_DEBIT)-(ROUND(AR_PAYMENT*AR_ACCOUNTRATE,2)+SUM_CREDIT)) amount, round((AR_DEPOSIT+AR_PAYMENT)*AR_ACCOUNTRATE,2) bbamount "
                                 + "FROM (SELECT NVL(AR_ACCOUNTRATE,1) AR_ACCOUNTRATE,NVL(AR_PAYMENT,0) AR_PAYMENT,NVL(AR_DEPOSIT,0) AR_DEPOSIT,round(NVL(ARDDEBIT,0),2) SUM_DEBIT,round(NVL(ARDCREDIT,0),2) sum_credit "
-                                + "FROM ACCOUNTREGISTER LEFT JOIN (SELECT SUM(NVL(ARD_DEBIT,0)) ARDDEBIT,SUM(NVL(ARD_CREDIT,0)) ARDCREDIT,ARD_ARID FROM ACCOUNTREGISTERDETAIL GROUP BY ARD_ARID) on ar_id=ard_arid "
+                                + "FROM "+master+"ACCOUNTREGISTER LEFT JOIN (SELECT SUM(NVL(ARD_DEBIT,0)) ARDDEBIT,SUM(NVL(ARD_CREDIT,0)) ARDCREDIT,ARD_ARID FROM "+master+"ACCOUNTREGISTERDETAIL GROUP BY ARD_ARID) on ar_id=ard_arid "
                                 + "where ar_id=? and ar_type in ('费用','其它收款','其它付款'))", id);
         if (rs.next()) {
             if (rs.getGeneralDouble("amount") >= 0.01) {
-                baseDao.updateByCondition("AccountRegister",
+                baseDao.updateByCondition(master+"AccountRegister",
                         "ar_errstring = '不平衡(" + rs.getGeneralDouble("amount") + "),本币(" + rs.getGeneralDouble("bbamount") + ")'", "ar_id="
                                 + id);
             }