Explorar o código

【泛微对接】【新增银行登记接口增加贷方,原币贷方字段】

wub hai 2 días
pai
achega
c31ee25004

+ 1 - 1
src/main/java/com/uas/eis/controller/ERPController.java

@@ -34,7 +34,7 @@ public class ERPController {
 
 
 
 
     @RequestMapping("/erp/saveAccountRegister")
     @RequestMapping("/erp/saveAccountRegister")
-    public ApiResult<String> save(@RequestBody AccountRegisterReq accountRegisterReq) {
+    public ApiResult<Map<Object, Object>> save(@RequestBody AccountRegisterReq accountRegisterReq) {
         Map<String, Object> modelMap = new HashMap<String, Object>();
         Map<String, Object> modelMap = new HashMap<String, Object>();
         return erpService.saveAccountRegister(accountRegisterReq);
         return erpService.saveAccountRegister(accountRegisterReq);
 //        modelMap.put("success", true);
 //        modelMap.put("success", true);

+ 3 - 1
src/main/java/com/uas/eis/service/ERPService.java

@@ -4,6 +4,8 @@ package com.uas.eis.service;
 import com.uas.eis.entity.fanwei.AccountRegisterReq;
 import com.uas.eis.entity.fanwei.AccountRegisterReq;
 import com.uas.eis.sdk.entity.ApiResult;
 import com.uas.eis.sdk.entity.ApiResult;
 
 
+import java.util.Map;
+
 /**
 /**
  * @author koul
  * @author koul
  * @email koul@usoftchina.com
  * @email koul@usoftchina.com
@@ -15,7 +17,7 @@ public interface ERPService {
 //
 //
 //    ApiResult<String> syncOriFactoryDelivery(String data);
 //    ApiResult<String> syncOriFactoryDelivery(String data);
 
 
-    ApiResult<String> saveAccountRegister(AccountRegisterReq accountRegisterReq);
+    ApiResult<Map<Object, Object>> saveAccountRegister(AccountRegisterReq accountRegisterReq);
 
 
     ApiResult<String> syncProduct(String data);
     ApiResult<String> syncProduct(String data);
 
 

+ 16 - 4
src/main/java/com/uas/eis/service/Impl/ERPServiceImpl.java

@@ -27,7 +27,10 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -228,7 +231,9 @@ public class ERPServiceImpl implements ERPService {
 
 
     @Override
     @Override
     @Transactional
     @Transactional
-    public ApiResult<String> saveAccountRegister(AccountRegisterReq accountRegisterReq) {
+    public ApiResult<Map<Object, Object>> saveAccountRegister(AccountRegisterReq accountRegisterReq) {
+
+        Map result = new HashMap();
         try {
         try {
             JSONObject jsonObject = new JSONObject();
             JSONObject jsonObject = new JSONObject();
             logger.info("saveAccountRegister-Begin:master {} ids {}");
             logger.info("saveAccountRegister-Begin:master {} ids {}");
@@ -283,6 +288,12 @@ public class ERPServiceImpl implements ERPService {
             if (accountRegisterMain.getAccountcode() == null || "".equals(accountRegisterMain.getAccountcode())){
             if (accountRegisterMain.getAccountcode() == null || "".equals(accountRegisterMain.getAccountcode())){
                 return ApiResponse.failRsp("102",type + " 账户编号为空!");
                 return ApiResponse.failRsp("102",type + " 账户编号为空!");
             }
             }
+            // 获取当前日期
+            LocalDate today = LocalDate.now();
+            // 格式化
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-mm-dd");
+            String formattedDate = today.format(formatter);
+            String ar_date = accountRegisterMain.getDate() == null || "".equals(accountRegisterMain.getDate()) ? formattedDate :  accountRegisterMain.getDate();
             String ar_type = accountRegisterMain.getType() == null ? "" : accountRegisterMain.getType();
             String ar_type = accountRegisterMain.getType() == null ? "" : accountRegisterMain.getType();
             String ar_currencytype = accountRegisterMain.getCurrencytype() == null ? "" : accountRegisterMain.getCurrencytype();
             String ar_currencytype = accountRegisterMain.getCurrencytype() == null ? "" : accountRegisterMain.getCurrencytype();
             String ar_accountcode = accountRegisterMain.getAccountcode() == null ? "" : accountRegisterMain.getAccountcode();
             String ar_accountcode = accountRegisterMain.getAccountcode() == null ? "" : accountRegisterMain.getAccountcode();
@@ -295,7 +306,7 @@ public class ERPServiceImpl implements ERPService {
             //String ar_cateid = accountRegisterMain.getType() == null ? "" : accountRegisterMain.getType();
             //String ar_cateid = accountRegisterMain.getType() == null ? "" : accountRegisterMain.getType();
             String Sql="insert into AccountRegister(ar_id,ar_code,ar_date,ar_type,ar_currencytype,ar_accountcode,ar_accountname,ar_accountcurrency,ar_accountrate" +
             String Sql="insert into AccountRegister(ar_id,ar_code,ar_date,ar_type,ar_currencytype,ar_accountcode,ar_accountname,ar_accountcurrency,ar_accountrate" +
                     ",ar_payment,ar_departmentcode,ar_departmentname,ar_cateid,ar_emid,ar_recordman,ar_status,ar_statuscode,ar_poststatus,ar_poststatuscode)" +
                     ",ar_payment,ar_departmentcode,ar_departmentname,ar_cateid,ar_emid,ar_recordman,ar_status,ar_statuscode,ar_poststatus,ar_poststatuscode)" +
-                    "values("+ar_id+",'"+code+"',to_date('"+accountRegisterMain.getDate()+"','yyyy-mm-dd'),'"+ar_type+"','"+ar_currencytype+"','"+ar_accountcode+"'," +
+                    "values("+ar_id+",'"+code+"',to_date('"+ar_date+"','yyyy-mm-dd'),'"+ar_type+"','"+ar_currencytype+"','"+ar_accountcode+"'," +
                     "'"+ar_accountname+"','"+ar_accountcurrency+"',"+accountRegisterMain.getAccountrate()+"," +
                     "'"+ar_accountname+"','"+ar_accountcurrency+"',"+accountRegisterMain.getAccountrate()+"," +
                     accountRegisterMain.getPayment() +",'"+ar_departmentcode+"','"+ar_departmentname+"',"+accountRegisterMain.getCateid() +"," +
                     accountRegisterMain.getPayment() +",'"+ar_departmentcode+"','"+ar_departmentname+"',"+accountRegisterMain.getCateid() +"," +
                     "1033922,'管理员','在录入','ENTERING','未过账','UNPOST')";
                     "1033922,'管理员','在录入','ENTERING','未过账','UNPOST')";
@@ -391,13 +402,14 @@ public class ERPServiceImpl implements ERPService {
                 }
                 }
             }
             }
             updateErrorString(ar_id);
             updateErrorString(ar_id);
+            result.put("code", code);
+            result.put("date", ar_date);
         }catch (Exception e){
         }catch (Exception e){
             JSONObject jsonObject = new JSONObject();
             JSONObject jsonObject = new JSONObject();
             jsonObject.put("message", e.getMessage());
             jsonObject.put("message", e.getMessage());
             return ApiResponse.failRsp("101",jsonObject.getString("message"));
             return ApiResponse.failRsp("101",jsonObject.getString("message"));
         }
         }
-
-        return ApiResponse.successRsp("0","同步银行登记成功");
+        return ApiResponse.successRsp("0","同步银行登记成功","",result);
     }
     }