Commit 5c5fd847 by huluobin

update

parent 0322bb0d
package com.blt.other.common.config; package com.blt.other.common.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -12,11 +10,9 @@ import org.springframework.web.client.RestTemplate; ...@@ -12,11 +10,9 @@ import org.springframework.web.client.RestTemplate;
@Configuration @Configuration
public class RestConfiguration { public class RestConfiguration {
@Autowired
private RestTemplateBuilder restTemplateBuilder;
@Bean @Bean
public RestTemplate restTemplate(){ public RestTemplate restTemplate() {
return restTemplateBuilder.build(); return new RestTemplate();
} }
} }
...@@ -14,6 +14,7 @@ public class UserCostFinansysSyncJob extends QuartzJobBean { ...@@ -14,6 +14,7 @@ public class UserCostFinansysSyncJob extends QuartzJobBean {
@Autowired @Autowired
private UserCostFinansysService userCostFinansysService; private UserCostFinansysService userCostFinansysService;
@Override @Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
String result = userCostFinansysService.syncUserFinance(); String result = userCostFinansysService.syncUserFinance();
......
...@@ -3,6 +3,7 @@ package com.blt.other.common.util; ...@@ -3,6 +3,7 @@ package com.blt.other.common.util;
import com.bailuntec.common.SpringContextUtil; import com.bailuntec.common.SpringContextUtil;
import com.blt.other.common.config.property.CostUrlProperties; import com.blt.other.common.config.property.CostUrlProperties;
import com.blt.other.module.cost.vo.CurVo; import com.blt.other.module.cost.vo.CurVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -10,6 +11,7 @@ import java.math.BigDecimal; ...@@ -10,6 +11,7 @@ import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Slf4j
public class CurUtils { public class CurUtils {
/** /**
...@@ -21,6 +23,8 @@ public class CurUtils { ...@@ -21,6 +23,8 @@ public class CurUtils {
*/ */
public static BigDecimal getCur(String fromCur, String toCur) { public static BigDecimal getCur(String fromCur, String toCur) {
log.info(fromCur);
log.info(toCur);
CostUrlProperties costUrlProperties = SpringContextUtil.getBean(CostUrlProperties.class); CostUrlProperties costUrlProperties = SpringContextUtil.getBean(CostUrlProperties.class);
String getExchangeRateApi = costUrlProperties.getExchangeRateApi; String getExchangeRateApi = costUrlProperties.getExchangeRateApi;
......
...@@ -18,13 +18,13 @@ public class GetDeparmentListServiceImpl implements GetDeparmentListService { ...@@ -18,13 +18,13 @@ public class GetDeparmentListServiceImpl implements GetDeparmentListService {
Logger logger = LoggerFactory.getLogger(GetDeparmentListServiceImpl.class); Logger logger = LoggerFactory.getLogger(GetDeparmentListServiceImpl.class);
@Autowired
private RestTemplate restTemplate;
@Resource @Resource
CostUrlProperties costUrlProperties; CostUrlProperties costUrlProperties;
@Override @Override
public List<DepartmentMsg> getList() { public List<DepartmentMsg> getList() {
RestTemplate restTemplate = new RestTemplate();
String response = restTemplate.getForEntity(costUrlProperties.getDepartmentListApi, String.class).getBody(); String response = restTemplate.getForEntity(costUrlProperties.getDepartmentListApi, String.class).getBody();
return JsonUtilByFsJson.jsonToList(response, DepartmentMsg.class); return JsonUtilByFsJson.jsonToList(response, DepartmentMsg.class);
} }
......
package com.blt.other.module.commons.controller; package com.blt.other.module.commons.controller;
import com.bailuntec.cost.api.response.CostResult; import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.common.annotation.LoginIgnore;
import com.blt.other.common.exception.BizRuntimeException; import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.PathUtil; import com.blt.other.common.util.PathUtil;
import com.blt.other.module.cost.utils.CostFileUtil; import com.blt.other.module.cost.utils.CostFileUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.java.Log;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -22,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -22,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
@RestController @RestController
public class FileController { public class FileController {
@LoginIgnore
@ApiOperation("文件上传接口") @ApiOperation("文件上传接口")
@PostMapping("/file/upload") @PostMapping("/file/upload")
public CostResult<String> upload(MultipartFile file) { public CostResult<String> upload(MultipartFile file) {
......
package com.blt.other.module.cost.controller; package com.blt.other.module.cost.controller;
import com.blt.other.common.lock.CostPlanNoLock;
import com.blt.other.common.util.CurUtils; import com.blt.other.common.util.CurUtils;
import com.blt.other.database.model.CostPlanDomain; import com.blt.other.database.model.CostPlanDomain;
import com.blt.other.module.cost.dto.response.RestResp; import com.blt.other.module.cost.dto.response.RestResp;
...@@ -42,19 +41,19 @@ public class CostPlanNewController { ...@@ -42,19 +41,19 @@ public class CostPlanNewController {
@PostMapping("/affirm") @PostMapping("/affirm")
public Map<String, Object> affirm(@RequestParam String costPlanNo) { public Map<String, Object> affirm(@RequestParam String costPlanNo) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
CostPlanNoLock lock = CostPlanNoLock.getInstance(); // CostPlanNoLock lock = CostPlanNoLock.getInstance();
try { // try {
lock.lock(Math.abs(costPlanNo.hashCode())); // lock.lock(Math.abs(costPlanNo.hashCode()));
CostPlanService costPlanService = CostPlanServiceFactory.getCostPlanService(costPlanNo); CostPlanService costPlanService = CostPlanServiceFactory.getCostPlanService(costPlanNo);
Integer affirm = costPlanService.affirm(costPlanNo); Integer affirm = costPlanService.affirm(costPlanNo);
result.put("success", true); result.put("success", true);
result.put("msg", "已生成 " + affirm + " 张费用单"); result.put("msg", "已生成 " + affirm + " 张费用单");
return result; return result;
} finally { // } finally {
lock.unlock(Math.abs(costPlanNo.hashCode())); // lock.unlock(Math.abs(costPlanNo.hashCode()));
} // }
} }
......
...@@ -115,8 +115,8 @@ ...@@ -115,8 +115,8 @@
<!-- 正式环境日志级别为INFO --> <!-- 正式环境日志级别为INFO -->
<springProfile name="prod"> <springProfile name="prod">
<logger name="com.gogirl" level="DEBUG"/> <logger name="com.blt.other" level="DEBUG"/>
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="DEBUG"/>
<!--日志打印的包的范围,及分类日志文件存储 --> <!--日志打印的包的范围,及分类日志文件存储 -->
<logger name="com.blt.other" additivity="false"> <logger name="com.blt.other" additivity="false">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment