This commit is contained in:
zhangqinlin
2022-04-06 12:02:37 +08:00
parent 04a98b547d
commit 18f54719d6
5 changed files with 50 additions and 39 deletions
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.util.RedisUtil;
import com.jero.contract.entity.ThereContract;
import com.jero.project.entity.PayResearchProject;
import com.jero.project.mapper.PayResearchProjectMapper;
@@ -69,6 +70,8 @@ public class PayResearchProjectServiceImpl extends ServiceImpl<PayResearchProjec
@Resource
private PayResearchProjectMapper payResearchProjectMapper;
@Resource
private RedisUtil redisUtil;
/**
* 加密,并将结果转成16进制字符串
*
@@ -173,7 +176,11 @@ public class PayResearchProjectServiceImpl extends ServiceImpl<PayResearchProjec
@Override
public JSONObject pageForThreeContract(ThereContract thereContract) {
String access_token = getToken().getJSONObject("data").getString("access_token");
String access_token;
access_token = String.valueOf(redisUtil.get("theThreeContract_token"));
if(StringUtils.isBlank(access_token)||access_token.equals("null")) {
access_token = getToken().getJSONObject("data").getString("access_token");
}
HttpRequest post = HttpUtil.createPost(URL_CONTRACT_PAGE);
HashMap<String, String> map2 = new HashMap<>();
@@ -224,7 +231,11 @@ public class PayResearchProjectServiceImpl extends ServiceImpl<PayResearchProjec
@Override
public JSONObject listForThreeContract(ThereContract thereContract) {
String access_token = getToken().getJSONObject("data").getString("access_token");
String access_token;
access_token = String.valueOf(redisUtil.get("theThreeContract_token"));
if(StringUtils.isBlank(access_token)||access_token.equals("null")) {
access_token = getToken().getJSONObject("data").getString("access_token");
}
HttpRequest post = HttpUtil.createPost(URL_CONTRACT_LIST);
HashMap<String, String> map2 = new HashMap<>();
map2.put("Authorization",access_token);
@@ -268,7 +279,11 @@ public class PayResearchProjectServiceImpl extends ServiceImpl<PayResearchProjec
@Override
public JSONObject oneForThreeContract(String id) {
String access_token = getToken().getJSONObject("data").getString("access_token");
String access_token;
access_token = String.valueOf(redisUtil.get("theThreeContract_token"));
if(StringUtils.isBlank(access_token)||access_token.equals("null")) {
access_token = getToken().getJSONObject("data").getString("access_token");
}
HttpRequest get = HttpUtil.createGet(URL_CONTRACT_ID+id);
HashMap<String, String> map2 = new HashMap<>();
map2.put("Authorization",access_token);
@@ -288,20 +303,16 @@ public class PayResearchProjectServiceImpl extends ServiceImpl<PayResearchProjec
String s = JSONObject.toJSONString(map);
String s1 = HttpUtil.post(URL_TOKEN, s);
JSONObject jsonObject = JSONObject.parseObject(s1);
String access_token = jsonObject.getJSONObject("data").getString("access_token");
redisUtil.set("theThreeContract_token",access_token,7200);
return jsonObject;
}
@Override
public JSONObject refreshToken( String refresh_token) {
// HashMap<String,String> map = new HashMap<>();
// map.put("refresh_token",refresh_token);
// String s = JSONObject.toJSONString(map);
// String s1 = HttpUtil.post(URL_REFRESH_TOKEN, s);
// JSONObject jsonObject = JSONObject.parseObject(s1);
HashMap<String, Object> map2 = new HashMap<>();
map2.put("refresh_token",refresh_token);
//这种方式是表单提交键值对
String post = HttpUtil.post(URL_REFRESH_TOKEN, map2);
JSONObject jsonObject = JSONObject.parseObject(post);
return jsonObject;
@@ -123,8 +123,8 @@ public class AllProjectStatisticsController {
}
AllMoney allMoney = payWorkingGroupService.queryPageList33(allProjectStatisticsSearch);
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getAllMoney())?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getComeAllMoney())?0:allMoney.getComeAllMoney());
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getComeAllMoney());
hashMap.put("pageList",pageList);
return Result.OK(hashMap);
@@ -199,8 +199,8 @@ public class AllProjectStatisticsController {
}
AllMoney allMoney = payWorkingGroupService.queryPageList33(allProjectStatisticsSearch);
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getAllMoney())?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getComeAllMoney())?0:allMoney.getComeAllMoney());
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getComeAllMoney());
hashMap.put("pageList",pageList);
return Result.OK(hashMap);
@@ -108,8 +108,8 @@ public class CompanyComeMoneyStatisticsController {
DecimalFormat df = new DecimalFormat("#,##0.00");
AllMoney allMoney = payWorkingGroupService.queryPageListForCompany33(companyComeMoneySearch,null);
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getAllMoney())?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getComeAllMoney())?0:allMoney.getComeAllMoney());
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getComeAllMoney());
hashMap.put("pageList",pageList);
return Result.OK(hashMap);
@@ -187,8 +187,8 @@ public class CompanyComeMoneyStatisticsController {
}
}
AllMoney allMoney = payWorkingGroupService.queryPageListForCompanyDetail33(companyComeMoneyDetailSearch,null);
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getAllMoney())?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getComeAllMoney())?0:allMoney.getComeAllMoney());
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getComeAllMoney());
hashMap.put("pageList", pageList);
return Result.OK(hashMap);
}
@@ -119,8 +119,8 @@ public class PayWorkingGroupStatisticsController {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("pageList",pageList.setRecords(records));
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getAllMoney())?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getComeAllMoney())?0:allMoney.getComeAllMoney());
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getComeAllMoney());
return Result.OK(hashMap);
}
@@ -264,8 +264,8 @@ public class PayWorkingGroupStatisticsController {
}
}
hashMap.put("pageList",pageList);
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getAllMoney())?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getComeAllMoney())?0:allMoney.getComeAllMoney());
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getComeAllMoney());
return Result.OK(hashMap);
}
@@ -98,12 +98,12 @@ public class PrincipalPeopleStatisticsController {
AllMoney allMoney = payWorkingGroupService.queryPageListForPrincipal33(principalPeopleSearch,idList);
HashMap<String, Object> hashMap = new HashMap<>();
double sum=0;
double sumTwo =0;
if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum() : 0;
sumTwo = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
}
// double sum=0;
// double sumTwo =0;
// if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
// sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum() : 0;
// sumTwo = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
// }
//处理为空数据为0
for(PrincipalPeopleList s: pageList.getRecords()) {
if (s.getAllMoney() == null || s.getAllMoney().equals("")) {
@@ -117,8 +117,8 @@ public class PrincipalPeopleStatisticsController {
}
}
DecimalFormat df = new DecimalFormat("#,##0.00");
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getAllMoney())?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getComeAllMoney())?0:allMoney.getComeAllMoney());
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getComeAllMoney());
hashMap.put("pageList",pageList);
return Result.OK(hashMap);
@@ -141,13 +141,13 @@ public class PrincipalPeopleStatisticsController {
IPage<PrincipalPeopleDetail> pageList = payWorkingGroupService.queryPageListForPrincipalDetail(page, principalPeopleDetailSearch);
AllMoney allMoney = payWorkingGroupService.queryPageListForPrincipalDetail33(principalPeopleDetailSearch);
HashMap<String, Object> hashMap = new HashMap<>();
double sum=0;
double sumTwo =0;
if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum() : 0;
sumTwo = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
}
DecimalFormat df = new DecimalFormat("#,##0.00");
// double sum=0;
// double sumTwo =0;
// if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
// sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum() : 0;
// sumTwo = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
// }
// DecimalFormat df = new DecimalFormat("#,##0.00");
for(PrincipalPeopleDetail s: pageList.getRecords()){
String key = String.valueOf(s.getChargeUse());
String payment_charge_use = sysBaseAPI.translateDict("payment_charge_use", key);
@@ -163,8 +163,8 @@ public class PrincipalPeopleStatisticsController {
}
}
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getAllMoney())?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)&&ObjectUtils.isEmpty(allMoney.getComeAllMoney())?0:allMoney.getComeAllMoney());
hashMap.put("sumOfMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getAllMoney());
hashMap.put("sumOfReallyMoney",ObjectUtils.isEmpty(allMoney)?0:allMoney.getComeAllMoney());
hashMap.put("pageList", pageList);
return Result.OK(hashMap);
}