From 5b6bd2b10c8c87b658b888f4d0384aec3ed491ce Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期二, 26 八月 2025 12:21:29 +0800 Subject: [PATCH] 代码提交 --- ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java | 177 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 131 insertions(+), 46 deletions(-) diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java index 2e80ce8..4f24c58 100644 --- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java +++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java @@ -6,6 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.core.domain.AjaxResult; @@ -16,7 +20,6 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.DtoConversionUtils; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.project.domain.*; import com.ruoyi.project.domain.vo.*; import com.ruoyi.project.mapper.*; @@ -24,7 +27,6 @@ import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserRoleMapper; import com.ruoyi.system.service.ISysUserService; -import com.taobao.api.ApiException; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.poi.ss.usermodel.*; @@ -34,14 +36,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.RequestBody; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.math.BigDecimal; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -198,7 +198,7 @@ Long flowlevel = null; if (serviceProcessVO.getApplytype().equals("0")) { ServiceReimbursement serviceReimbursement = new ServiceReimbursement(); - serviceReimbursement.setId(serviceProcessVO.getBackCode()); + serviceReimbursement.setId(StringUtils.isNotEmpty(serviceProcessVO.getBackCode()) ? Long.valueOf(serviceProcessVO.getBackCode()) : null); List<ServiceReimbursement> serviceReimbursementList = iServiceReimbursementService.queryList(serviceReimbursement); if (CollectionUtils.isEmpty(serviceReimbursementList)) { log.error("serviceReimbursementList娌℃湁鏌ュ埌鏁版嵁锛歿}", serviceProcessVO.getBackCode()); @@ -212,7 +212,7 @@ applytype = "0"; } else { ServiceFund serviceFund = new ServiceFund(); - serviceFund.setId(serviceProcessVO.getBackCode()); + serviceFund.setId(StringUtils.isNotEmpty(serviceProcessVO.getBackCode()) ? Long.valueOf(serviceProcessVO.getBackCode()) : null); List<ServiceFund> serviceFunds = queryInfoById(serviceFund); if (CollectionUtils.isEmpty(serviceFunds)) { log.error("serviceFunds娌℃湁鏌ュ埌鏁版嵁锛歿}", serviceProcessVO.getBackCode()); @@ -225,22 +225,23 @@ applytype = serviceFunds.get(0).getApplytype(); } - //灏嗘搷浣滀繚瀛樺埌fundflow琛ㄤ腑 - ServiceFundflow serviceFundflow = new ServiceFundflow(); - serviceFundflow.setCreateBy("admin"); - serviceFundflow.setCreateTime(new Date()); - serviceFundflow.setUpdateBy("admin"); - serviceFundflow.setUpdateTime(new Date()); - serviceFundflow.setCheckusername(serviceProcessVO.getCheckusername()); - serviceFundflow.setFlowcontent(serviceProcessVO.getFlowcontent()); - serviceFundflow.setFlowconclusion(1); - serviceFundflow.setFundtype(2); - serviceFundflow.setFlowlevel(flowlevel.intValue()); - if (serviceProcessVO.getFlowconclusion() == 3) serviceFundflow.setFlowlevel(999); - serviceFundflow.setApplytype(applytype); - serviceFundflow.setFundid(serviceProcessVO.getBackCode()); - serviceFundflow.setCheckTime(serviceProcessVO.getCheckTime()); - fundflowService.save(serviceFundflow); +// //灏嗘搷浣滀繚瀛樺埌fundflow琛ㄤ腑 +// ServiceFundflow serviceFundflow = new ServiceFundflow(); +// serviceFundflow.setCreateBy("admin"); +// serviceFundflow.setCreateTime(new Date()); +// serviceFundflow.setUpdateBy("admin"); +// serviceFundflow.setUpdateTime(new Date()); +// serviceFundflow.setCheckusername(serviceProcessVO.getCheckusername()); +// serviceFundflow.setFlowcontent(serviceProcessVO.getFlowcontent()); +// serviceFundflow.setFlowconclusion(1); +// serviceFundflow.setFundtype(2); +// serviceFundflow.setFlowlevel(flowlevel.intValue()); +// if (StringUtils.isNotEmpty(serviceProcessVO.getFlowconclusion()) && serviceProcessVO.getFlowconclusion().equals("3")) +// serviceFundflow.setFlowlevel(999); +// serviceFundflow.setApplytype(applytype); +// serviceFundflow.setFundid(StringUtils.isNotEmpty(serviceProcessVO.getBackCode()) ? Long.valueOf(serviceProcessVO.getBackCode()) : null); +// serviceFundflow.setCheckTime(serviceProcessVO.getCheckTime()); +// fundflowService.save(serviceFundflow); SysUser sysUser = sysUserService.selectUserByUserName(userNo); @@ -260,6 +261,42 @@ serviceSystemmessage.setMessagecontent(serviceProcessVO.getFlowcontent()); iServiceSystemmessageService.save(serviceSystemmessage); + return true; + } + + @Override + public Boolean updatecodepay(ServiceCodeAndPyaWay serviceCodeAndPyaWay) { + Integer i = null; + if (StringUtils.isNotEmpty(serviceCodeAndPyaWay.getApplytype()) && !serviceCodeAndPyaWay.getApplytype().equals("0")) { + ServiceFund serviceFund = new ServiceFund(); + serviceFund.setId(serviceCodeAndPyaWay.getBackCode()); + serviceFund.setBh(serviceCodeAndPyaWay.getBh()); + serviceFund.setZffs(serviceCodeAndPyaWay.getZffs()); + serviceFund.setRiqi(serviceCodeAndPyaWay.getRiqi()); + i = serviceFundMapper.updateById(serviceFund); + + ServiceFundShared serviceFundShared = new ServiceFundShared(); + serviceFundShared.setSerfunid(serviceFund.getId()); + serviceFundShared.setZffs(serviceFund.getZffs()); + serviceFundShared.setRiqi(serviceFund.getRiqi()); + serviceFundShared.setBh(serviceFund.getBh()); + serviceFundSharedMapper.updateShareByfundid(serviceFundShared); + } else { + ServiceReimbursement serviceReimbursement = new ServiceReimbursement(); + serviceReimbursement.setId(serviceCodeAndPyaWay.getBackCode()); + serviceReimbursement.setBh(serviceCodeAndPyaWay.getBh()); + serviceReimbursement.setZffs(serviceCodeAndPyaWay.getZffs()); + serviceReimbursement.setRiqi(serviceCodeAndPyaWay.getRiqi()); + i = serviceReimbursementMapper.updateById(serviceReimbursement); + + ServiceReimbursementShared serviceReimbursementShared = new ServiceReimbursementShared(); + serviceReimbursementShared.setReimid(serviceReimbursement.getId()); + serviceReimbursementShared.setBh(serviceReimbursement.getBh()); + serviceReimbursementShared.setZffs(serviceReimbursement.getZffs()); + serviceReimbursementShared.setRiqi(serviceReimbursement.getRiqi()); + serviceReimbursementSharedMapper.updateReimShareByfundid(serviceReimbursementShared); + } + if (i == 0) return false; return true; } @@ -579,31 +616,62 @@ data.put("data", data2); //妯℃澘缂栧彿锛岀敱鑷磋繙鏂规彁渚涳紝璇ュ弬鏁板喅瀹氬彂璧峰崗鍚岀郴缁熶腑鍝釜娴佺▼ - data.put("templateCode", "001"); + data.put("templateCode", "fybxd_rzhc_ceshi"); //鏄惁涓哄緟鍙戯細0:鏂板缓-鍙戦�侊紱1:鏂板缓-淇濆瓨寰呭彂 data.put("draft", "0"); //鍗忓悓鏍囬鍖洪檮浠讹紝Long鍨婰ist锛屽�间负闄勪欢鐨処d銆侷d鏄檮浠舵帴鍙e搷搴旂粨鏋滀腑fileUrl瀛楁鐨勫�� - data.put("attachments", null); +// data.put("attachments", null); //鍗忓悓鍏枃鐨刬d - data.put("relateDoc", "col|123,456;doc|321,654"); +// data.put("relateDoc", "col|123,456;doc|321,654"); //鏈缃彇妯℃澘璁剧疆鐨勬爣棰� data.put("subject", "null"); + ServiceFund serviceFund1 = serviceFundMapper.selectById(serviceFund.getId()); + data.put("summaryId", serviceFund1.getSummaryId()); map.put("data", data); String strRes = null; if (!active.equals("druid")) { //濡傛灉鏄湰鍦扮幆澧冿紝灏变笉璋冭繖涓簡 + String token = getToken(); + JSONObject json1 = JSONObject.parseObject(token); + token = json1.get("id").toString(); + ObjectMapper objectMapper = new ObjectMapper(); + String json = null; if (serviceFund.getBackflowlevel() == 100L) { //鍐嶆鍙戣捣 - strRes = HttpClientKit.postOpr(rexyurl, map.toString()); + try { + json = objectMapper.writeValueAsString(map); + log.error("-----------------鍐嶆鍙戣捣鐨剈rl涓猴細{}, 鍏ュ弬涓猴細{}", rexyurl + "?token=" + token, json); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + strRes = HttpClientKit.postOpr(rexyurl + "?token=" + token, json); } else { //棣栨鍙戣捣 - strRes = HttpClientKit.postOpr(xyurl, map.toString()); + try { + json = objectMapper.writeValueAsString(map); + log.error("-----------------棣栨鍙戣捣鐨剈rl涓猴細{}, 鍏ュ弬涓猴細{}", xyurl + "?token=" + token, json); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + strRes = HttpClientKit.postOpr(xyurl + "?token=" + token, json); + + // 灏唖ummaryId淇濆瓨璧锋潵,骞跺皢璇ュ�间繚瀛樺埌fund涓紝鐢ㄤ簬鍐嶆鍙戣捣鏃讹紝浣跨敤锛堝崗鍙嬭姹傦紝鍐嶆鍙戣捣鏃讹紝甯︿笂杩欎釜鍊硷級 + JsonObject root = JsonParser.parseString(strRes).getAsJsonObject(); + String code = root.get("code").getAsString(); + if ("0".equals(code)) { + String appBusinessData = root.getAsJsonObject("data").get("app_bussiness_data").getAsString(); + JsonObject appDataObj = JsonParser.parseString(appBusinessData).getAsJsonObject(); + String summaryId = appDataObj.get("summaryId").getAsString(); + serviceFund.setSummaryId(summaryId); + serviceFundMapper.updateById(serviceFund); + } } } - com.alibaba.fastjson2.JSONObject jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(strRes); - String code = jsonObject.getJSONObject("code").toString(); + log.error("------------------strRes鐨勫�间负锛歿}", strRes); + JSONObject jsonObject = JSONObject.parseObject(strRes); + String code = jsonObject.getString("code"); if (!code.equals("0")) { return false; } @@ -626,12 +694,12 @@ map.put("鏀剁泭浜哄灞炴垨涓撳", serviceFunddetailShared.getBeneficiaryname()); map.put("绋庡悗閲戦", serviceFunddetailShared.getTaxamount()); map.put("浣滃簾鏈�缁堥噾棰�", null); - String fpuuid = IdUtils.simpleUUID(); + Long fpuuid = System.currentTimeMillis() + 5; map.put("鍙戠エ闄勪欢", fpuuid); map.put("鍙戠エ璇嗗埆", null); map.put("璇嗗埆浜�", null); map.put("绋庨", null); - String qtuuid = IdUtils.simpleUUID(); + long qtuuid = System.currentTimeMillis() + 20; map.put("鍏朵粬闄勪欢", qtuuid); map.put("椤圭洰缂栫爜", serviceFunddetailShared.getItemcode()); map.put("棰勭畻椤圭洰", null); @@ -682,7 +750,7 @@ formmain_0831.put("鎶ラ攢浜哄憳", serviceFundShared.getUsername()); formmain_0831.put("涓氬姟鍖哄煙", serviceFundShared.getDeptmentname()); formmain_0831.put("缁忔墜浜�", serviceFundShared.getUsername()); - formmain_0831.put("濉〃鏃堕棿", serviceFundShared.getApplyTime()); + formmain_0831.put("濉〃鏃堕棿", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(serviceFundShared.getApplyTime())); formmain_0831.put("鎶ラ攢閲戦鍚堣", serviceFundShared.getPretaxcost()); formmain_0831.put("涓婁紶闄勪欢", null); formmain_0831.put("澶囨敞", null); @@ -715,7 +783,7 @@ formmain_0831.put("鍑瘉绫诲埆", null); formmain_0831.put("绋庡悗閲戦鍚堣", serviceFundShared.getTaxedcost()); formmain_0831.put("鍘嗗彶瀹℃壒璁板綍", null); - formmain_0831.put("琛ㄥ崟缂栧彿", serviceFundShared.getBh()); + formmain_0831.put("琛ㄥ崟缂栧彿", serviceFundShared.getSerfunid()); formmain_0831.put("鍘嗗彶瀹℃壒鍗曟煡璇�", null); return formmain_0831; } @@ -1530,18 +1598,19 @@ int uploadOAFileAndUpdateDb(ServiceFunddetailShared remShare) throws Exception { //涓婁紶OA鏂囦欢 - String strUrl = "http://129.88.242.39:8899/seeyon/rest/token"; - //涓婁紶鏂囦欢鎴愬姛鍚庯紝鍘绘洿鏂扮浉鍏崇殑鏁版嵁搴� - Map<String, Object> map = new HashMap<String, Object>(); - map.put("userName", "opo"); - map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5"); - map.put("loginName", "demo3"); +// String strUrl = "http://129.88.242.39:8899/seeyon/rest/token"; +// //涓婁紶鏂囦欢鎴愬姛鍚庯紝鍘绘洿鏂扮浉鍏崇殑鏁版嵁搴� +// Map<String, Object> map = new HashMap<String, Object>(); +// map.put("userName", "opo"); +// map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5"); +// map.put("loginName", "demo3"); +// +// JSONObject jsonObj = new JSONObject(map); +// +// System.out.println("uploadOAFileAndUpdateDb + jsonObject" + jsonObj.toString() + "\r\n" + jsonObj.toJSONString()); +// String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString());// + String strRes = getToken(); - JSONObject jsonObj = new JSONObject(map); - - System.out.println("uploadOAFileAndUpdateDb + jsonObject" + jsonObj.toString() + "\r\n" + jsonObj.toJSONString()); - String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString());// - //String strRes = HttpClientKit.postMsg(strUrl,jsonObj);//寰楀埌杩斿洖鐨則oken? JSONObject json1 = JSONObject.parseObject(strRes); strRes = json1.get("id").toString(); @@ -1563,6 +1632,22 @@ //鍙戠エ闄勪欢 uploadFile(filePath, strFUrl, invoicefilesList, invoicefilesArray, remShare, "2"); return 0; + } + + private String getToken() { + //涓婁紶OA鏂囦欢 + String strUrl = "http://129.88.242.39:8899/seeyon/rest/token"; + //涓婁紶鏂囦欢鎴愬姛鍚庯紝鍘绘洿鏂扮浉鍏崇殑鏁版嵁搴� + Map<String, Object> map = new HashMap<String, Object>(); + map.put("userName", "opo"); + map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5"); + map.put("loginName", "demo"); + + JSONObject jsonObj = new JSONObject(map); + + System.out.println("uploadOAFileAndUpdateDb + jsonObject" + jsonObj.toString() + "\r\n" + jsonObj.toJSONString()); + String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString()); + return strRes; } @@ -1685,12 +1770,12 @@ serviceFundflow.setCreateTime(new Date()); serviceFundflow.setUpdateTime(new Date()); serviceFundflow.setFlowcontent(serviceProcessVO.getFlowcontent()); - serviceFundflow.setFlowconclusion(serviceProcessVO.getFlowconclusion()); + serviceFundflow.setFlowconclusion(StringUtils.isNotEmpty(serviceProcessVO.getFlowconclusion()) ? Integer.valueOf(serviceProcessVO.getFlowconclusion()) : null); if (serviceProcessVO.getApplytype() == "0") serviceFundflow.setFundtype(1); if (serviceProcessVO.getApplytype() == "1") serviceFundflow.setFundtype(2); serviceFundflow.setFlowlevel(100); serviceFundflow.setApplytype(serviceProcessVO.getApplytype()); - serviceFundflow.setFundid(serviceProcessVO.getBackCode()); + serviceFundflow.setFundid(StringUtils.isNotEmpty(serviceProcessVO.getBackCode()) ? Long.valueOf(serviceProcessVO.getBackCode()) : null); fundflowService.save(serviceFundflow); ArrayList<ConcurrentHashMap<String, Object>> contentList = new ArrayList<>(); -- Gitblit v1.9.3