parent
							
								
									ac4655d347
								
							
						
					
					
						commit
						0eb3a8621e
					
				|  | @ -0,0 +1,98 @@ | |||
| package tqq9.lc123.cloud.app.api.plugin; | ||||
| 
 | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.openapi.api.plugin.ApiSavePlugin; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWUtils; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 泛微其他入申请导入接口插件 | ||||
|  */ | ||||
| public class FWOtheroutApplySavePlugin implements ApiSavePlugin { | ||||
| 
 | ||||
|     @Override | ||||
|     public List<Map<String, Object>> preHandleRequestData(List<Map<String, Object>> reqData) { | ||||
|         for (Map<String, Object> reqDatum : reqData) { | ||||
|             //组织 | ||||
|             Map<String, Object> org = (Map<String, Object>) reqDatum.get("org"); | ||||
|             String orgnumber = (String) org.get("number"); | ||||
|             DynamicObject kdOrg = FWUtils.getKdOrgByFsOrgNumber(orgnumber); | ||||
|             org.put("number", kdOrg.getString("number")); | ||||
|             reqDatum.put("org", org); | ||||
|             //单据类型 | ||||
|             Map<String, Object> map = new HashMap<>(); | ||||
|             map.put("number", "tqq9_otheroutapply_BT"); | ||||
|             reqDatum.put("tqq9_billtype", map); | ||||
|             //业务类型 | ||||
|             Map<String, Object> map1 = new HashMap<>();//库存事务 | ||||
|             Map<String, Object> tqq9_biztype = (Map<String, Object>) reqDatum.get("tqq9_biztype"); | ||||
|             Object biztypenumber = tqq9_biztype.get("number"); | ||||
|             if("0".equals(biztypenumber)){ | ||||
|                 tqq9_biztype.put("number", "351"); | ||||
|                 map1.put("number", "351.1"); | ||||
|             }else if("1".equals(biztypenumber)){ | ||||
|                 tqq9_biztype.put("number", "355"); | ||||
|                 map1.put("number", "355.1"); | ||||
|             }else if("2".equals(biztypenumber)){ | ||||
|                 tqq9_biztype.put("number", "612"); | ||||
|                 map1.put("number", "612.1"); | ||||
|             }else if("3".equals(biztypenumber)){ | ||||
|                 tqq9_biztype.put("number", "613"); | ||||
|                 map1.put("number", "613.1"); | ||||
|             }else if("4".equals(biztypenumber)){ | ||||
|                 tqq9_biztype.put("number", "614"); | ||||
|                 map1.put("number", "614.1"); | ||||
|             }else if("5".equals(biztypenumber)){ | ||||
|                 tqq9_biztype.put("number", "615"); | ||||
|                 map1.put("number", "615.1"); | ||||
|             }else if("6".equals(biztypenumber)){ | ||||
|                 tqq9_biztype.put("number", "616"); | ||||
|                 map1.put("number", "616.1"); | ||||
|             }else if("7".equals(biztypenumber)){ | ||||
|                 tqq9_biztype.put("number", "617"); | ||||
|                 map1.put("number", "617.1"); | ||||
|             } | ||||
|             //库存事务赋值 | ||||
|             reqDatum.put("tqq9_kcsw", map1); | ||||
|             //接收人 | ||||
|             Map<String, Object> tqq9_user = (Map<String, Object>) reqDatum.get("tqq9_user"); | ||||
|             String tqq9_user_number = (String) tqq9_user.get("number"); | ||||
|             DynamicObject kdUser = FWUtils.getKdUserByFwUserID(tqq9_user_number); | ||||
|             if(kdUser != null){ | ||||
|                 tqq9_user.put("number", kdUser.getString("number")); | ||||
|                 reqDatum.put("tqq9_user", tqq9_user); | ||||
|             } | ||||
|             //申请部门 | ||||
|             Map<String, Object> tqq9_dept = (Map<String, Object>) reqDatum.get("tqq9_dept"); | ||||
|             String tqq9_dept_number = (String) tqq9_dept.get("number"); | ||||
|             DynamicObject kdDept = FWUtils.getKdOrgByFsOrgNumber(tqq9_dept_number); | ||||
|             if(kdDept != null){ | ||||
|                 tqq9_dept.put("number", kdDept.getString("number")); | ||||
|                 reqDatum.put("tqq9_dept", tqq9_dept); | ||||
|             } | ||||
| 
 | ||||
|             //明细 | ||||
|             List<Map<String, Object>> entries = (List<Map<String, Object>>) reqDatum.get("entryentity"); | ||||
|             for (Map<String, Object> entry : entries) { | ||||
|                 entry.put("tqq9_outownertype", "bos_org");//出库货主类型 | ||||
|                 Map<String, Object> tqq9_outinvtype = new HashMap<>(); | ||||
|                 tqq9_outinvtype.put("number", "110"); | ||||
|                 entry.put("tqq9_outinvtype", tqq9_outinvtype);//出库库存类型 | ||||
|                 Map<String, Object> tqq9_outinvstatus = new HashMap<>(); | ||||
|                 tqq9_outinvstatus.put("number", "110"); | ||||
|                 entry.put("tqq9_outinvstatus", tqq9_outinvstatus);//出库库存状态 | ||||
|                 entry.put("tqq9_outowner", org);//出库货主 | ||||
|                 entry.put("tqq9_outkeepertype", "bos_org");//出库保管者类型 | ||||
|                 entry.put("tqq9_outkeeper", org);//出库保管者 | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         return reqData; | ||||
|     } | ||||
| } | ||||
|  | @ -2,7 +2,7 @@ package tqq9.lc123.cloud.app.api.plugin; | |||
| 
 | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.openapi.api.plugin.ApiSavePlugin; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWOrgMappingUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWUtils; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | @ -19,7 +19,7 @@ public class FWUserImportSavePlugin implements ApiSavePlugin { | |||
|             for (Map<String, Object> entry : entries) { | ||||
|                 Map<String, Object> dpt = (Map<String, Object>) entry.get("dpt"); | ||||
|                 String dptNumber = (String) dpt.get("number"); | ||||
|                 DynamicObject kdOrg = FWOrgMappingUtils.getKdOrgByFsOrgNumber(dptNumber); | ||||
|                 DynamicObject kdOrg = FWUtils.getKdOrgByFsOrgNumber(dptNumber); | ||||
|                 if(kdOrg != null){ | ||||
|                     dpt.put("number", kdOrg.getString("number")); | ||||
|                 } | ||||
|  |  | |||
|  | @ -1,10 +1,14 @@ | |||
| package tqq9.lc123.cloud.app.plugin.operate.cas; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.entity.operate.result.OperationResult; | ||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.trd.FWImpl; | ||||
| 
 | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.util.List; | ||||
|  | @ -21,8 +25,20 @@ public class PayApplySubmitToFwOp extends AbstractOperationServicePlugIn { | |||
|         OperationResult operationResult = this.getOperationResult(); | ||||
|         List<Object> successPkIds = operationResult.getSuccessPkIds(); | ||||
|         for (Object successPkId : successPkIds) { | ||||
|             DynamicObject ap_payapply = BusinessDataServiceHelper.loadSingle(successPkId, "ap_payapply"); | ||||
|             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||||
|             DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "ap_payapply"); | ||||
|             String resultStr = FWImpl.pushFwPayApply(bill); | ||||
|             if(StringUtils.isNotBlank(resultStr)){ | ||||
|                 JSONObject resultObj = JSONObject.parseObject(resultStr); | ||||
|                 String code = resultObj.getString("code"); | ||||
|                 if("SUCCESS".equals(code)){ | ||||
|                     JSONObject data = resultObj.getJSONObject("data"); | ||||
|                     if(data != null){ | ||||
|                         String requestid = data.getString("requestid"); | ||||
|                         bill.set("tqq9_fwrequestid", requestid); | ||||
|                         SaveServiceHelper.save(new DynamicObject[]{bill}); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|         } | ||||
|  |  | |||
|  | @ -1,9 +1,7 @@ | |||
| package tqq9.lc123.cloud.app.plugin.operate.im; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.entity.operate.result.OperationResult; | ||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||
|  | @ -11,15 +9,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper; | |||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.trd.FWImpl; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWOrgMappingUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| 
 | ||||
| public class OtherInSubmitToFwOp extends AbstractOperationServicePlugIn { | ||||
|  |  | |||
|  | @ -1,9 +1,7 @@ | |||
| package tqq9.lc123.cloud.app.plugin.operate.im; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.entity.operate.result.OperationResult; | ||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||
|  | @ -11,15 +9,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper; | |||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.trd.FWImpl; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWOrgMappingUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| 
 | ||||
| public class OtherOutSubmitToFwOp extends AbstractOperationServicePlugIn { | ||||
|  |  | |||
|  | @ -1,21 +1,25 @@ | |||
| package tqq9.lc123.cloud.app.plugin.trd; | ||||
| 
 | ||||
| import cn.hutool.http.HttpUtil; | ||||
| import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.servicehelper.AttachmentServiceHelper; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWOrgMappingUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWUtils; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils; | ||||
| 
 | ||||
| import java.io.ByteArrayOutputStream; | ||||
| import java.io.FileInputStream; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.math.BigDecimal; | ||||
| import java.net.URL; | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| import java.util.*; | ||||
| 
 | ||||
| /** | ||||
|  * 泛微接口实现,用于后续单独推送的功能实现 | ||||
|  | @ -37,7 +41,7 @@ public class FWImpl { | |||
|         String bmbm = "18"; | ||||
|         if(tqq9_dept != null){ | ||||
|             String deptNumber = tqq9_dept.getString("number"); | ||||
|             String fwOrgNumber = FWOrgMappingUtils.getFwOrgNumberByKdOrgNumber(deptNumber); | ||||
|             String fwOrgNumber = FWUtils.getFwOrgNumberByKdOrgNumber(deptNumber); | ||||
|             if(StringUtils.isNotBlank(fwOrgNumber)){ | ||||
|                 bmbm = fwOrgNumber; | ||||
|             } | ||||
|  | @ -84,7 +88,7 @@ public class FWImpl { | |||
|         String cjbm = "18"; | ||||
|         if(tqq9_dept != null){ | ||||
|             String deptNumber = tqq9_dept.getString("number"); | ||||
|             String fwOrgNumber = FWOrgMappingUtils.getFwOrgNumberByKdOrgNumber(deptNumber); | ||||
|             String fwOrgNumber = FWUtils.getFwOrgNumberByKdOrgNumber(deptNumber); | ||||
|             if(StringUtils.isNotBlank(fwOrgNumber)){ | ||||
|                 cjbm = fwOrgNumber; | ||||
|             } | ||||
|  | @ -95,7 +99,7 @@ public class FWImpl { | |||
|         String ywgz = "4"; | ||||
|         if(org != null){ | ||||
|             String orgNumber = org.getString("number"); | ||||
|             String fwOrgNumber = FWOrgMappingUtils.getFwOrgNumberByKdOrgNumber(orgNumber); | ||||
|             String fwOrgNumber = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber); | ||||
|             if(StringUtils.isNotBlank(fwOrgNumber)){ | ||||
|                 ywgz = fwOrgNumber; | ||||
|             } | ||||
|  | @ -527,13 +531,13 @@ public class FWImpl { | |||
|         DynamicObject tqq9_dept = bill.getDynamicObject("tqq9_dept"); | ||||
|         if(tqq9_dept != null){ | ||||
|             String number = tqq9_dept.getString("number"); | ||||
|             bm = FWOrgMappingUtils.getFwOrgNumberByKdOrgNumber(number); | ||||
|             bm = FWUtils.getFwOrgNumberByKdOrgNumber(number); | ||||
|         } | ||||
|         Date biztime = bill.getDate("biztime"); | ||||
|         String sqrq = sdf.format(biztime); | ||||
|         DynamicObject org = bill.getDynamicObject("org"); | ||||
|         String orgNumber = org.getString("number"); | ||||
|         String ywgz = FWOrgMappingUtils.getFwOrgNumberByKdOrgNumber(orgNumber); | ||||
|         String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber); | ||||
|         int crk = 1; | ||||
|         DynamicObject biztype = bill.getDynamicObject("biztype"); | ||||
|         String biztypeNumber = biztype.getString("number"); | ||||
|  | @ -844,18 +848,18 @@ public class FWImpl { | |||
|         DynamicObject tqq9_dept = bill.getDynamicObject("tqq9_dept"); | ||||
|         if(tqq9_dept != null){ | ||||
|             String number = tqq9_dept.getString("number"); | ||||
|             bm = FWOrgMappingUtils.getFwOrgNumberByKdOrgNumber(number); | ||||
|             bm = FWUtils.getFwOrgNumberByKdOrgNumber(number); | ||||
|         } | ||||
|         Date biztime = bill.getDate("biztime"); | ||||
|         String sqrq = sdf.format(biztime); | ||||
|         DynamicObject org = bill.getDynamicObject("org"); | ||||
|         String orgNumber = org.getString("number"); | ||||
|         String ywgz = FWOrgMappingUtils.getFwOrgNumberByKdOrgNumber(orgNumber); | ||||
|         String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber); | ||||
|         int crk = 0; | ||||
|         DynamicObject biztype = bill.getDynamicObject("biztype"); | ||||
|         String biztypeNumber = biztype.getString("number"); | ||||
|         int ywlxck = 1; | ||||
|         String ywlxxsm = "其他入库"; | ||||
|         String ywlxxsm = "其他出库"; | ||||
|         if("351".equals(biztypeNumber)){ | ||||
|             ywlxck = 0; | ||||
|             ywlxxsm = "盘亏入库"; | ||||
|  | @ -886,7 +890,7 @@ public class FWImpl { | |||
|         DynamicObject tqq9_drck2 = bill.getDynamicObject("tqq9_drck2"); | ||||
|         if(tqq9_drck2 != null){ | ||||
|             String number = tqq9_drck2.getString("number"); | ||||
|             drzz = FWOrgMappingUtils.getFwOrgNumberByKdOrgNumber(number); | ||||
|             drzz = FWUtils.getFwOrgNumberByKdOrgNumber(number); | ||||
|         } | ||||
|         String jsr = null; | ||||
|         DynamicObject tqq9_jsr = bill.getDynamicObject("tqq9_jsr"); | ||||
|  | @ -1242,4 +1246,309 @@ public class FWImpl { | |||
|         return resultStr; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 付款申请推送泛微 | ||||
|      * @param bill | ||||
|      * @return | ||||
|      */ | ||||
|     public static String pushFwPayApply(DynamicObject bill){ | ||||
|         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||||
|         String tqq9_fwrequestid = bill.getString("tqq9_fwrequestid");//泛微流程ID | ||||
|         String billno = bill.getString("billno"); | ||||
|         DynamicObject creator = bill.getDynamicObject("creator"); | ||||
|         creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(), "bos_user", "tqq9_fwuserid,id,number"); | ||||
|         String cjr = creator.getString("tqq9_fwuserid"); | ||||
|         String cjbm = null; | ||||
|         DynamicObject tqq9_dept = bill.getDynamicObject("tqq9_dept"); | ||||
|         if(tqq9_dept != null){ | ||||
|             String number = tqq9_dept.getString("number"); | ||||
|             cjbm = FWUtils.getFwOrgNumberByKdOrgNumber(number); | ||||
|         } | ||||
|         Date applydate = bill.getDate("applydate"); | ||||
|         String cjrq = sdf.format(applydate); | ||||
|         DynamicObject settleorg = bill.getDynamicObject("settleorg"); | ||||
|         String orgNumber = settleorg.getString("number"); | ||||
|         String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber); | ||||
|         DynamicObject billtype = bill.getDynamicObject("billtype"); | ||||
|         String billtypenumber = billtype.getString("number"); | ||||
|         int djlx = 0; | ||||
|         if("ap_payapply_BT_S".equals(billtypenumber)){ | ||||
|             djlx = 0; | ||||
|         }else if("ap_payapply_oth_BT_S".equals(billtypenumber)){ | ||||
|             djlx = 1; | ||||
|         }else{ | ||||
|             return null; | ||||
|         } | ||||
|         DynamicObject payorg = bill.getDynamicObject("payorg"); | ||||
|         String payOrgNumber = payorg.getString("number"); | ||||
|         String fkzz = FWUtils.getFwOrgNumberByKdOrgNumber(payOrgNumber); | ||||
|         String qksy = bill.getString("applycause"); | ||||
|         int sfdpyf = 1; | ||||
|         boolean isprepayinvoice = bill.getBoolean("isprepayinvoice"); | ||||
|         if(isprepayinvoice){ | ||||
|             sfdpyf = 0; | ||||
|         } | ||||
|         BigDecimal sqje = bill.getBigDecimal("applyamount"); | ||||
|         int fklx = 0; | ||||
|         String tqq9_fklx = bill.getString("tqq9_fklx"); | ||||
|         if("A".equals(tqq9_fklx)){ | ||||
|             fklx = 0; | ||||
|         }else if("B".equals(tqq9_fklx)){ | ||||
|             fklx = 1; | ||||
|         }else if("C".equals(tqq9_fklx)){ | ||||
|             fklx = 2; | ||||
|         } | ||||
|         String wlzh = null; | ||||
|         String wlyh = null; | ||||
|         String qwfkr = null; | ||||
|         int fktj = 0; | ||||
|         DynamicObject tqq9_fktj = bill.getDynamicObject("tqq9_fktj"); | ||||
|         if(tqq9_fktj != null){ | ||||
|             String number = tqq9_fktj.getString("number"); | ||||
|             if("003".equals(number)){ | ||||
|                 fktj = 0; | ||||
|             }else if("002".equals(number)){ | ||||
|                 fktj = 1; | ||||
|             }else if("001".equals(number)){ | ||||
|                 fktj = 2; | ||||
|             }else if("004".equals(number)){ | ||||
|                 fktj = 3; | ||||
|             } | ||||
|         } | ||||
|         int jsfs = 0; | ||||
|         String dqr = null; | ||||
|         BigDecimal bcsjzfje = bill.getBigDecimal("applyamount"); | ||||
|         BigDecimal cgddyfze = bill.getBigDecimal("tqq9_cgyfje"); | ||||
|         BigDecimal ljyfzje = bill.getBigDecimal("tqq9_yfzje"); | ||||
|         BigDecimal hfsyzje = bill.getBigDecimal("tqq9_syhfzje"); | ||||
|         BigDecimal xfsyzje = bill.getBigDecimal("tqq9_syxfzje"); | ||||
|         BigDecimal zbzfje = bill.getBigDecimal("tqq9_zbzfje"); | ||||
|         BigDecimal qpje = bill.getBigDecimal("tqq9_qpje"); | ||||
|         Date tqq9_qpsj = bill.getDate("tqq9_qpsj"); | ||||
|         String yjdpsj = sdf.format(tqq9_qpsj); | ||||
|         BigDecimal qhje = bill.getBigDecimal("tqq9_qhje"); | ||||
|         Date tqq9_qhrq = bill.getDate("tqq9_qhrq"); | ||||
|         String yjdhsj = sdf.format(tqq9_qhrq); | ||||
|         String cc3gyxlbhyy = bill.getString("tqq9_rccsgyxlbh"); | ||||
|         String skgys = null; | ||||
| 
 | ||||
|         JSONObject detail1 = new JSONObject(); | ||||
|         JSONArray recordsArr1 = new JSONArray(); | ||||
|         DynamicObjectCollection entries = bill.getDynamicObjectCollection("entry"); | ||||
|         for (DynamicObject entry : entries) { | ||||
|             String cgddh = entry.getString("e_corebillno"); | ||||
|             String fyxm = null; | ||||
|             DynamicObject e_expenseitem = entry.getDynamicObject("e_expenseitem"); | ||||
|             if(e_expenseitem != null){ | ||||
|                 e_expenseitem = BusinessDataServiceHelper.loadSingle(e_expenseitem.getPkValue(), "er_expenseitemedit", "id,name,number"); | ||||
|                 fyxm = e_expenseitem.getString("name"); | ||||
|             } | ||||
|             BigDecimal bcsjzfje_e = entry.getBigDecimal("e_applyamount"); | ||||
|             BigDecimal cgddyfje = entry.getBigDecimal("e_payamount"); | ||||
|             BigDecimal xfsyje = entry.getBigDecimal("tqq9_xfsyje"); | ||||
|             BigDecimal hfsyje = entry.getBigDecimal("tqq9_hfsyje"); | ||||
|             BigDecimal zbzfje_e = entry.getBigDecimal("tqq9_zbzf"); | ||||
|             BigDecimal yfje = entry.getBigDecimal("e_paidamt"); | ||||
|             DynamicObject e_asstact = entry.getDynamicObject("e_asstact"); | ||||
|             if(e_asstact != null){ | ||||
|                 skgys = e_asstact.getString("number"); | ||||
|             } | ||||
|             wlzh = entry.getString("e_assacct"); | ||||
|             DynamicObject e_bebank = entry.getDynamicObject("e_bebank"); | ||||
|             if(e_bebank != null){ | ||||
|                 wlyh = e_bebank.getString("name"); | ||||
|             } | ||||
|             Date e_expaydate = entry.getDate("e_expaydate"); | ||||
|             qwfkr = sdf.format(e_expaydate); | ||||
|             DynamicObject e_settlementtype = entry.getDynamicObject("e_settlementtype"); | ||||
|             if(e_settlementtype != null){ | ||||
|                 String number = e_settlementtype.getString("number"); | ||||
|                 if("JSFS01".equals(number)){ | ||||
|                     jsfs = 0; | ||||
|                 }else if("JSFS04".equals(number)){ | ||||
|                     jsfs = 1; | ||||
|                 }else if("JSFS08".equals(number) || "JSFS16_S".equals(number)){ | ||||
|                     jsfs = 2; | ||||
|                 }else if("JSFS09".equals(number) || "JSFS12".equals(number)){ | ||||
|                     jsfs = 3; | ||||
|                 }else if("LC001".equals(number)){ | ||||
|                     jsfs = 4; | ||||
|                 } | ||||
|             } | ||||
|             Date e_duedate = entry.getDate("e_duedate"); | ||||
|             dqr = sdf.format(e_duedate); | ||||
| 
 | ||||
|             JSONObject e1 = new JSONObject(); | ||||
|             e1.put("fieldName", "cgddh"); | ||||
|             e1.put("fieldValue", cgddh); | ||||
|             JSONObject e2 = new JSONObject(); | ||||
|             e2.put("fieldName", "fyxm"); | ||||
|             e2.put("fieldValue", fyxm); | ||||
|             JSONObject e3 = new JSONObject(); | ||||
|             e3.put("fieldName", "bcsjzfje"); | ||||
|             e3.put("fieldValue", bcsjzfje_e==null||bcsjzfje_e.compareTo(BigDecimal.ZERO)==0?0:bcsjzfje_e); | ||||
|             JSONObject e4 = new JSONObject(); | ||||
|             e4.put("fieldName", "cgddyfje"); | ||||
|             e4.put("fieldValue", cgddyfje==null||cgddyfje.compareTo(BigDecimal.ZERO)==0?0:cgddyfje); | ||||
|             JSONObject e5 = new JSONObject(); | ||||
|             e5.put("fieldName", "xfsyje"); | ||||
|             e5.put("fieldValue", xfsyje==null||xfsyje.compareTo(BigDecimal.ZERO)==0?0:xfsyje); | ||||
|             JSONObject e6 = new JSONObject(); | ||||
|             e6.put("fieldName", "hfsyje"); | ||||
|             e6.put("fieldValue", hfsyje==null||hfsyje.compareTo(BigDecimal.ZERO)==0?0:hfsyje); | ||||
|             JSONObject e7 = new JSONObject(); | ||||
|             e7.put("fieldName", "zbzfje"); | ||||
|             e7.put("fieldValue", zbzfje_e==null||zbzfje_e.compareTo(BigDecimal.ZERO)==0?0:zbzfje_e); | ||||
|             JSONObject e8 = new JSONObject(); | ||||
|             e8.put("fieldName", "yfje"); | ||||
|             e8.put("fieldValue", yfje==null||yfje.compareTo(BigDecimal.ZERO)==0?0:yfje); | ||||
| 
 | ||||
|             List<JSONObject> elist = Arrays.asList(e1,e2,e3,e4,e5,e6,e7,e8); | ||||
|             JSONArray recordsArr = new JSONArray(); | ||||
|             for (JSONObject obj : elist) { | ||||
|                 recordsArr.add(obj); | ||||
|             } | ||||
| 
 | ||||
|             JSONObject recordObj = new JSONObject(); | ||||
|             recordObj.put("recordOrder", 0); | ||||
|             recordObj.put("workflowRequestTableFields", recordsArr); | ||||
|             recordsArr1.add(recordObj); | ||||
|         } | ||||
|         detail1.put("tableDBName", "formtable_main_100_dt1"); | ||||
|         detail1.put("workflowRequestTableRecords", recordsArr1); | ||||
|         if(StringUtils.isNotBlank(tqq9_fwrequestid)){ | ||||
|             detail1.put("deleteAll", "1"); | ||||
|         } | ||||
|         JSONArray detailRootArr = new JSONArray(); | ||||
|         detailRootArr.add(detail1); | ||||
| 
 | ||||
|         //构建主表数据 | ||||
|         JSONObject m1 = new JSONObject(); | ||||
|         m1.put("fieldName", "KDBillType"); | ||||
|         m1.put("fieldValue", "ap_payapply"); | ||||
|         JSONObject m2 = new JSONObject(); | ||||
|         m2.put("fieldName", "lcbh"); | ||||
|         m2.put("fieldValue", billno); | ||||
|         JSONObject m3 = new JSONObject(); | ||||
|         m3.put("fieldName", "cjr"); | ||||
|         m3.put("fieldValue", cjr); | ||||
|         JSONObject m4 = new JSONObject(); | ||||
|         m4.put("fieldName", "cjbm"); | ||||
|         m4.put("fieldValue", cjbm); | ||||
|         JSONObject m5 = new JSONObject(); | ||||
|         m5.put("fieldName", "cjrq"); | ||||
|         m5.put("fieldValue", cjrq); | ||||
|         JSONObject m6 = new JSONObject(); | ||||
|         m6.put("fieldName", "ywgz"); | ||||
|         m6.put("fieldValue", ywgz); | ||||
|         JSONObject m7 = new JSONObject(); | ||||
|         m7.put("fieldName", "djlx"); | ||||
|         m7.put("fieldValue", djlx); | ||||
|         JSONObject m8 = new JSONObject(); | ||||
|         m8.put("fieldName", "fkzz"); | ||||
|         m8.put("fieldValue", fkzz); | ||||
|         JSONObject m9 = new JSONObject(); | ||||
|         m9.put("fieldName", "qksy"); | ||||
|         m9.put("fieldValue", qksy); | ||||
|         JSONObject m10 = new JSONObject(); | ||||
|         m10.put("fieldName", "cc3gyxlbhyy"); | ||||
|         m10.put("fieldValue", cc3gyxlbhyy); | ||||
|         JSONObject m11 = new JSONObject(); | ||||
|         m11.put("fieldName", "skgys"); | ||||
|         m11.put("fieldValue", skgys); | ||||
|         JSONObject m12 = new JSONObject(); | ||||
|         m12.put("fieldName", "sfdpyf"); | ||||
|         m12.put("fieldValue", sfdpyf); | ||||
|         JSONObject m13 = new JSONObject(); | ||||
|         m13.put("fieldName", "sqje"); | ||||
|         m13.put("fieldValue", sqje==null||sqje.compareTo(BigDecimal.ZERO)==0?0:sqje); | ||||
|         JSONObject m14 = new JSONObject(); | ||||
|         m14.put("fieldName", "fklx"); | ||||
|         m14.put("fieldValue", fklx); | ||||
|         JSONObject m15 = new JSONObject(); | ||||
|         m15.put("fieldName", "wlzh"); | ||||
|         m15.put("fieldValue", wlzh); | ||||
|         JSONObject m16 = new JSONObject(); | ||||
|         m16.put("fieldName", "wlyh"); | ||||
|         m16.put("fieldValue", wlyh); | ||||
|         JSONObject m17 = new JSONObject(); | ||||
|         m17.put("fieldName", "qwfkr"); | ||||
|         m17.put("fieldValue", qwfkr); | ||||
|         JSONObject m18 = new JSONObject(); | ||||
|         m18.put("fieldName", "fktj"); | ||||
|         m18.put("fieldValue", fktj); | ||||
|         JSONObject m19 = new JSONObject(); | ||||
|         m19.put("fieldName", "jsfs"); | ||||
|         m19.put("fieldValue", jsfs); | ||||
|         JSONObject m20 = new JSONObject(); | ||||
|         m20.put("fieldName", "dqr"); | ||||
|         m20.put("fieldValue", dqr); | ||||
|         JSONObject m21 = new JSONObject(); | ||||
|         m21.put("fieldName", "bcsjzfje"); | ||||
|         m21.put("fieldValue", bcsjzfje==null||bcsjzfje.compareTo(BigDecimal.ZERO)==0?0:bcsjzfje); | ||||
|         JSONObject m22 = new JSONObject(); | ||||
|         m22.put("fieldName", "cgddyfze"); | ||||
|         m22.put("fieldValue", cgddyfze==null||cgddyfze.compareTo(BigDecimal.ZERO)==0?0:cgddyfze); | ||||
|         JSONObject m23 = new JSONObject(); | ||||
|         m23.put("fieldName", "ljyfzje"); | ||||
|         m23.put("fieldValue", ljyfzje==null||ljyfzje.compareTo(BigDecimal.ZERO)==0?0:ljyfzje); | ||||
|         JSONObject m24 = new JSONObject(); | ||||
|         m24.put("fieldName", "hfsyzje"); | ||||
|         m24.put("fieldValue", hfsyzje==null||hfsyzje.compareTo(BigDecimal.ZERO)==0?0:hfsyzje); | ||||
|         JSONObject m25 = new JSONObject(); | ||||
|         m25.put("fieldName", "xfsyzje"); | ||||
|         m25.put("fieldValue", xfsyzje==null||xfsyzje.compareTo(BigDecimal.ZERO)==0?0:xfsyzje); | ||||
|         JSONObject m26 = new JSONObject(); | ||||
|         m26.put("fieldName", "zbzfje"); | ||||
|         m26.put("fieldValue", zbzfje==null||zbzfje.compareTo(BigDecimal.ZERO)==0?0:zbzfje); | ||||
|         JSONObject m27 = new JSONObject(); | ||||
|         m27.put("fieldName", "qpje"); | ||||
|         m27.put("fieldValue", qpje==null||qpje.compareTo(BigDecimal.ZERO)==0?0:qpje); | ||||
|         JSONObject m28 = new JSONObject(); | ||||
|         m28.put("fieldName", "yjdpsj"); | ||||
|         m28.put("fieldValue", yjdpsj); | ||||
|         JSONObject m29 = new JSONObject(); | ||||
|         m29.put("fieldName", "qhje"); | ||||
|         m29.put("fieldValue", qhje==null||qhje.compareTo(BigDecimal.ZERO)==0?0:qhje); | ||||
|         JSONObject m30 = new JSONObject(); | ||||
|         m30.put("fieldName", "yjdhsj"); | ||||
|         m30.put("fieldValue", yjdhsj); | ||||
| 
 | ||||
|         List<JSONObject> mlist = new ArrayList<>(Arrays.asList(m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16, | ||||
|                 m17,m18,m19,m20,m21,m22,m23,m24,m25,m26,m27,m28,m29,m30)); | ||||
|         // 附件 | ||||
|         List<JSONObject> fjList = new ArrayList<>(); | ||||
|         List<Map<String, Object>> attachments = AttachmentServiceHelper.getAttachments("ap_payapply", bill.getPkValue(), "attachmentpanel"); | ||||
|         for (Map<String, Object> attachment : attachments) { | ||||
|             String filePath = (String) attachment.get("url"); | ||||
|             String fileName = (String) attachment.get("name"); | ||||
|             filePath = filePath.replace("127.0.0.1:8881", "10.200.30.186:8022"); | ||||
|             byte[] bytes = HttpUtil.downloadBytes(filePath); | ||||
|             String str = cn.hutool.core.codec.Base64.encode(bytes); | ||||
|             JSONObject fj = new JSONObject(); | ||||
|             fj.put("filePath", str); | ||||
|             fj.put("fileName", fileName); | ||||
|             fjList.add(fj); | ||||
|         } | ||||
| 
 | ||||
|         if(fjList.size() > 0){ | ||||
|             JSONObject fjObj = new JSONObject(); | ||||
|             fjObj.put("fieldName", "fj"); | ||||
|             fjObj.put("fieldValue", fjList); | ||||
|             mlist.add(fjObj); | ||||
|         } | ||||
|         JSONArray mainArr = new JSONArray(); | ||||
|         for (JSONObject obj : mlist) { | ||||
|             mainArr.add(obj); | ||||
|         } | ||||
| 
 | ||||
|         String fw_wfid_xzcgdd = ConfigUtils.getThirdConfigByNumber("FW_WFID_FKSQD"); | ||||
|         FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); | ||||
|         //如果单据上纯在泛微流程id,重新提交调用泛微提交接口,如果没有泛微流程id,就调用新增接口 | ||||
|         String resultStr = fwRestfulUtils.doBillAction(mainArr, detailRootArr, "付款申请单流程", fw_wfid_xzcgdd, billno, tqq9_fwrequestid); | ||||
|         return resultStr; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -208,7 +208,7 @@ public class FWRestfulUtils { | |||
|                     //封装请求头参数 | ||||
|                     RSA rsa = new RSA(null,spk); | ||||
|                     //对用户信息进行加密传输,暂仅支持传输OA用户ID | ||||
|                     String encryptUserid = rsa.encryptBase64("304", CharsetUtil.CHARSET_UTF_8, KeyType.PublicKey); | ||||
|                     String encryptUserid = rsa.encryptBase64("363", CharsetUtil.CHARSET_UTF_8, KeyType.PublicKey); | ||||
| 
 | ||||
|                     DynamicObject pushlog = BusinessDataServiceHelper.newDynamicObject("tqq9_fwpushlog"); | ||||
|                     pushlog.set("name", requestName); | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper; | |||
|  * 组织映射表工具类 | ||||
|  * | ||||
|  */ | ||||
| public class FWOrgMappingUtils { | ||||
| public class FWUtils { | ||||
| 
 | ||||
|     /** | ||||
|      * 根据金蝶组织编码获取泛微组织编码 | ||||
|  | @ -58,5 +58,20 @@ public class FWOrgMappingUtils { | |||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 根据泛微人员id获取用户信息 | ||||
|      * @param fwUserID | ||||
|      * @return | ||||
|      */ | ||||
|     public static DynamicObject getKdUserByFwUserID(String fwUserID){ | ||||
|         QFilter f = new QFilter("tqq9_fwuserid", "=", fwUserID); | ||||
|         DynamicObject[] bos_users = BusinessDataServiceHelper.load("bos_user", "id,name,number", new QFilter[]{f}); | ||||
|         if(bos_users != null && bos_users.length > 0){ | ||||
|             return bos_users[0]; | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue