Commit 5c5fd847 by huluobin

update

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