From 4b6e55140537e4932f4ea46f6c62c72af1ddb40e Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期一, 07 八月 2023 16:38:01 +0800 Subject: [PATCH] 加上日志 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java | 11 +++++++---- ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java | 12 +----------- ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java | 9 +++++++-- ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java | 18 ++++++++++++++---- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 5894b48..36480c8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -1,6 +1,5 @@ package com.ruoyi.web.controller.common; -import org.apache.coyote.AbstractProtocol; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; @@ -10,27 +9,18 @@ import com.ruoyi.framework.config.ServerConfig; import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; +import org.apache.coyote.AbstractProtocol; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import javax.management.MBeanServer; -import javax.management.MalformedObjectNameException; -import javax.management.ObjectName; -import javax.management.Query; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.lang.management.ManagementFactory; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.util.Set; /** * 閫氱敤璇锋眰澶勭悊 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java index 58204bf..c239a71 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java @@ -27,6 +27,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.annotations.Options; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import java.io.*; @@ -582,15 +583,19 @@ /** - * 淇敼璐圭敤鐢宠涓� + * 淇敼璐圭敤鐢宠 */ - @ApiOperation("淇敼璐圭敤鐢宠涓�") + @ApiOperation("淇敼璐圭敤鐢宠") //@PreAuthorize("@ss.hasPermi('project:fund:edit')") @Log(title = "璐圭敤鐢宠涓�", businessType = BusinessType.UPDATE) @PutMapping @RepeatSubmit public AjaxResult edit(@RequestBody ServiceFund serviceFund) { List<ServiceFund> infoByInfoIdList = serviceFundService.queryInfoById(serviceFund); + if (CollectionUtils.isEmpty(infoByInfoIdList)) { + log.info("淇敼璐圭敤鐢宠锛岄�氳繃鍏ュ弬鏌ヨ serviceFundService.queryInfoById鏁版嵁涓虹┖,鍏ュ弬:{}", serviceFund); + return toAjax(false); + } for (ServiceFund sf : infoByInfoIdList) { //濡傛灉绛変簬100锛岃鏄庡凡缁忚蛋鍒板尰闄㈣储鍔¢偅杈逛簡锛涜储鍔¢偅杈瑰彇鏁版嵁鏄粠鍒嗕韩琛ㄥ彇锛屾墍浠ワ紝杩欓噷鐩存帴寰�鍒嗕韩琛ㄩ噷娣诲姞鏁版嵁灏辫浜� if (sf.getBackflowlevel() == 100 || sf.getBackflowlevel() == 199) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java index 6fb031b..f2220b6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java @@ -27,6 +27,7 @@ import freemarker.template.TemplateException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.annotations.Options; import org.springframework.beans.factory.annotation.Autowired; @@ -46,6 +47,7 @@ * @author ruoyi * @date 2022-01-24 */ +@Slf4j @Api("鎶ラ攢鐢宠") @RestController @RequestMapping("/project/reimbursement") @@ -448,7 +450,7 @@ ServiceReimbursement serviceReimbursement = serviceReimbursementService.getById(checkFundVO.getFundid()); //濡傛灉绛変簬100锛岃鏄庡凡缁忚蛋鍒板尰闄㈣储鍔¢偅杈逛簡锛涜储鍔¢偅杈瑰彇鏁版嵁鏄粠鍒嗕韩琛ㄥ彇锛屾墍浠ワ紝杩欓噷鐩存帴寰�鍒嗕韩琛ㄩ噷娣诲姞鏁版嵁灏辫浜�; if (!Objects.isNull(serviceReimbursement) && serviceReimbursement.getBackflowlevel() != null) { - if (serviceReimbursement.getBackflowlevel() == 100 || serviceReimbursement.getBackflowlevel() == 199){ + if (serviceReimbursement.getBackflowlevel() == 100 || serviceReimbursement.getBackflowlevel() == 199) { //灏嗕慨鏀圭殑涓婃姤鏁版嵁 鏂板涓�鏉� ServiceReimbursementShared serviceReimbursementShared = DtoConversionUtils.sourceToTarget(serviceReimbursement, ServiceReimbursementShared.class); @@ -510,8 +512,9 @@ @Log(title = "瀹℃牳璐圭敤", businessType = BusinessType.OTHER) @PostMapping("/checkfund") public AjaxResult checkFund(@RequestBody CheckFundVO checkFundVO) { + log.info("瀹℃牳璐圭敤鐨勫叆鍙� : {}", checkFundVO); ServiceReimbursement serviceReimbursement = serviceReimbursementService.getById(checkFundVO.getFundid()); - + log.info("瀹℃牳璐圭敤鐨剆erviceReimbursementService.getById杩斿弬 : {}", serviceReimbursement); if (serviceReimbursement != null) { Integer totalLevel = 0; LoginUser loginUser = getLoginUser(); @@ -520,7 +523,7 @@ serviceFundflowrule.setApplytype("0"); serviceFundflowrule.setCheckuserno(loginUser.getUsername()); List<ServiceFundflowrule> serviceFundflowrules = serviceFundflowruleService.queryList(serviceFundflowrule); - + log.info("瀹℃牳璐圭敤鐨剆erviceFundflowruleService.queryList杩斿弬 : {}", serviceFundflowrules.size()); if (serviceFundflowrules == null || serviceFundflowrules.stream().count() == 0) { return AjaxResult.error(HttpStatus.ERROR, "褰撳墠浜哄憳鏃犳璁板綍瀹℃牳鏉冮檺"); } @@ -585,7 +588,7 @@ serviceFundflowService.save(serviceFundflow); List<Integer> postids = postService.selectPostListByUserId(loginUser.getUserId()); - + log.info("postService.selectPostListByUserId : {}", postids.size()); if (!postids.contains(2)) { if (CheckFlag == 2 && OriginalFlowLevel == 1) { ServiceFundflow serviceFundflowAuto = new ServiceFundflow(); diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java index 2ffa53f..eb06291 100644 --- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java +++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java @@ -141,13 +141,16 @@ @Override @Transactional public Boolean addSharedData(Long id) { + log.info("addSharedData鏂规硶鐨勫叆鍙俰d :{}", id); ServiceReimbursement serviceReimbursement = serviceReimbursementMapper.selectById(id); Map<String, Object> columnMap = new HashMap<>(); columnMap.put("rbid", id); //鑾峰彇璇︽儏鏁版嵁 List<ServiceReimbursementdetail> details = serviceReimbursementdetailMapper.selectByMap(columnMap); + log.info("serviceReimbursementdetailMapper.selectByMap鏂规硶鐨勮繑鍙傚弬 :{}", details.size()); //鑾峰彇鏀粯鏁版嵁 List<ServiceReimbursementpayee> serviceReimbursementpayees = reimbursementpayeeMapper.selectByMap(columnMap); + log.info("reimbursementpayeeMapper.selectByMap鏂规硶鐨勮繑鍙傚弬 :{}", serviceReimbursementpayees.size()); //鏁版嵁缁勮 ServiceReimbursementShared serviceReimbursementShared = DtoConversionUtils.sourceToTarget(serviceReimbursement, ServiceReimbursementShared.class); serviceReimbursementShared.setReimid(id); @@ -164,6 +167,7 @@ serviceReimbursementdetailShareds.get(i).setRbid(serviceReimbursementShared.getId()); serviceReimbursementdetailShareds.get(i).setId(null); //涓婁紶OA鏂囦欢 + log.info("涓婁紶OA鏂囦欢鏂规硶鐨勫叆鍙�:{}", serviceReimbursementdetailShareds.get(i)); uploadOAFileAndUpdateDb(serviceReimbursementdetailShareds.get(i)); } @@ -205,7 +209,10 @@ return serviceReimbursementMapper.getRDInfoByItem(serviceReimbursementEo); } + public int uploadOAFileAndUpdateDb(ServiceReimbursementdetailShared remShare) { + log.info("uploadOAFileAndUpdate鏂规硶鐨勫叆鍙�:{}", remShare); + System.out.println("uploadOAFileAndUpdate鏂规硶鐨勫叆鍙�:" + remShare); //涓婁紶OA鏂囦欢 //String strUrl = "http://129.88.242.39:8899/seeyon/rest/token?userName=opo&password=127814f8-84e8-4304-84a5-a71573567efd&loginName=demo3"; String strUrl = "http://129.88.242.39:8899/seeyon/rest/token"; @@ -220,8 +227,7 @@ 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? + String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString()); JSONObject json1 = JSONObject.parseObject(strRes); strRes = json1.get("id").toString(); @@ -233,18 +239,22 @@ List<RbDetailFile> parseArray = JSON.parseArray(remShare.getAnnexfiles(), RbDetailFile.class); for (int i = 0; i < parseArray.size(); i++) { RbDetailFile rbDetailFile = parseArray.get(i); + log.info("filePath鐨勪慨鏀�:{}", filePath); String strFile = rbDetailFile.getUrl().replaceAll("/profile/upload", filePath); File filetest = new File(strFile); try { + log.info("璇锋眰绗笁鏂圭殑鍏ュ弬strFile : {}, strFUrl : {}", strFile, filePath); String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl); + log.info("绗笁鏂逛紶鍥炵殑鏁版嵁: {}", struploadResult); if (StringUtils.isEmpty(struploadResult)) { - log.info("HttpClientKit.sendPostWithFile 璇锋眰涓虹┖浜� filetest:{}, strFUrl:{} ",filetest,strFUrl); + log.info("HttpClientKit.sendPostWithFile 璇锋眰涓虹┖浜� filetest:{}, strFUrl:{} ", filetest, strFUrl); return 0; } //鑾峰彇fileid JSONObject jsonR = JSONObject.parseObject(struploadResult); JSONArray jsonArr = jsonR.getJSONArray("atts"); + log.info("绗笁鏂逛紶鍥炵殑鏁版嵁鑾峰彇鐨刟tts : {}", jsonArr); for (int j = 0; j < jsonArr.size(); j++) { JSONObject jsonRet = jsonArr.getJSONObject(j); rbDetailFile.setFileid(jsonRet.get("fileUrl").toString()); @@ -256,7 +266,7 @@ parseArray2.add(rbDetailFile); } remShare.setAnnexfiles(JSON.toJSONString(parseArray2)); - log.info("ServiceReimbursementdetailShared 鏄惁鍔犱笂浜唂ileid : {}",remShare); + log.info("ServiceReimbursementdetailShared 鏄惁鍔犱笂浜唂ileid : {}", remShare); return 0; } -- Gitblit v1.9.3