|
@@ -907,10 +907,11 @@ public class ReportController {
|
|
|
LocalDateTime time = LocalDateTime.now();
|
|
|
String format = time.format(df);
|
|
|
String tokenOfYiWei = getTokenOfYiWei();
|
|
|
- String url = "http://183.194.0.98:3202/controlCenter/billApply";
|
|
|
+ String url = "http://183.194.0.98:3202/api/web-server/controlCenter/billApply";
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
headers.add("token",tokenOfYiWei);
|
|
|
+ headers.add("Accept-Language","zh-CN");
|
|
|
JSONObject body=new JSONObject();
|
|
|
body.put("dataSource","工时管家");
|
|
|
body.put("type","EXPENSE");
|
|
@@ -922,8 +923,8 @@ public class ReportController {
|
|
|
Optional<Project> first = targetProjectList.stream().filter(tl -> tl.getId().equals(report.getProjectId())).findFirst();
|
|
|
if(first.isPresent()){
|
|
|
JSONObject expenseDetail =new JSONObject();
|
|
|
- expenseDetail.put("company","");
|
|
|
- expenseDetail.put("department","");
|
|
|
+ expenseDetail.put("company","FONE");
|
|
|
+ expenseDetail.put("department","DEFAULT");
|
|
|
expenseDetail.put("project",first.get().getProjectCode());
|
|
|
expenseDetail.put("expenseItem","default");
|
|
|
expenseDetail.put("amount",report.getWorkingTime());
|
|
@@ -939,7 +940,19 @@ public class ReportController {
|
|
|
String resp = responseEntity.getBody();
|
|
|
JSONObject json = JSONObject.parseObject(resp);
|
|
|
if(json.getIntValue("status")==0){
|
|
|
- JSONArray jsonArray = json.getJSONArray("data");
|
|
|
+ JSONArray data = json.getJSONArray("data");
|
|
|
+ JSONObject jsonObject = data.getJSONObject(0);
|
|
|
+ Integer availableBudgetAmount = jsonObject.getInteger("availableBudgetAmount");
|
|
|
+ Integer occurredBudgetAmount = jsonObject.getInteger("occurredBudgetAmount");
|
|
|
+ BigDecimal divide = new BigDecimal(occurredBudgetAmount).add(new BigDecimal(jsonObject.getInteger("amount"))).divide(new BigDecimal(availableBudgetAmount), 3, RoundingMode.HALF_UP);
|
|
|
+ if(divide.doubleValue()>0.85){
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
+ httpRespMsg.setError("当前预算占用已到85%");
|
|
|
+ }
|
|
|
+ } else if(json.getIntValue("status")==14001){
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
+ httpRespMsg.setError("当前项目预算不足,无法填报");
|
|
|
+ return httpRespMsg;
|
|
|
}
|
|
|
}
|
|
|
}*/
|
|
@@ -1247,13 +1260,13 @@ public class ReportController {
|
|
|
|
|
|
|
|
|
private String getTokenOfYiWei(){
|
|
|
- String url = "http://183.194.0.98:3202/controlCenter/token";
|
|
|
+ String url = "http://183.194.0.98:3202/api/web-server/controlCenter/token";
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
String token="";
|
|
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
JSONObject jsonObject=new JSONObject();
|
|
|
jsonObject.put("appId","GongShi");
|
|
|
- jsonObject.put("appSecret","6195e252f611785a5e1446e1");
|
|
|
+ jsonObject.put("appSecret","858a6e0b60d228a556d8e353ebbd2c5c");
|
|
|
HttpEntity<String> requestEntity;
|
|
|
requestEntity = new HttpEntity<String>(jsonObject.toJSONString(), headers);
|
|
|
ResponseEntity<String> responseEntity = this.restTemplate.exchange(url,
|