|
@ -1,10 +1,8 @@
|
|
package com.yihu.jw.basic.agadmin.controller.quota;
|
|
package com.yihu.jw.basic.agadmin.controller.quota;
|
|
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
|
|
import com.yihu.jw.basic.dict.service.SystemDictEntryService;
|
|
import com.yihu.jw.basic.dict.service.SystemDictEntryService;
|
|
import com.yihu.jw.basic.quota.controller.JobController;
|
|
import com.yihu.jw.basic.quota.controller.JobController;
|
|
import com.yihu.jw.basic.quota.model.SaveModel;
|
|
|
|
import com.yihu.jw.basic.quota.service.*;
|
|
import com.yihu.jw.basic.quota.service.*;
|
|
import com.yihu.jw.basic.resource.service.RsResourceQuotaService;
|
|
import com.yihu.jw.basic.resource.service.RsResourceQuotaService;
|
|
import com.yihu.jw.basic.util.TemPath;
|
|
import com.yihu.jw.basic.util.TemPath;
|
|
@ -17,9 +15,12 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.util.date.DateTimeUtil;
|
|
import com.yihu.jw.util.date.DateTimeUtil;
|
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.http.NameValuePair;
|
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@ -74,6 +75,10 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
private QuotaService quotaService;
|
|
private QuotaService quotaService;
|
|
@Resource
|
|
@Resource
|
|
TjQuotaLogService tjQuotaLogService;
|
|
TjQuotaLogService tjQuotaLogService;
|
|
|
|
@Resource
|
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
@Value("${url.svr_quota}")
|
|
|
|
private String quotaUrl;
|
|
|
|
|
|
@GetMapping("/getTjQuota")
|
|
@GetMapping("/getTjQuota")
|
|
public Envelop searchTjQuota(String name, Integer quotaType, int page, int rows) {
|
|
public Envelop searchTjQuota(String name, Integer quotaType, int page, int rows) {
|
|
@ -266,11 +271,16 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
*/
|
|
*/
|
|
@PostMapping("firstExecuteQuota")
|
|
@PostMapping("firstExecuteQuota")
|
|
public Envelop firstExecuteQuota(Long tjQuotaId) {
|
|
public Envelop firstExecuteQuota(Long tjQuotaId) {
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
|
params.put("id", tjQuotaId);
|
|
|
|
try {
|
|
try {
|
|
String url = "/job/firstExecuteQuota";
|
|
|
|
return jobController.firstExecuteQuota(tjQuotaId);
|
|
|
|
|
|
String url = quotaUrl + "/api/v1.0/job/firstExecuteQuota";
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("id", tjQuotaId+""));
|
|
|
|
String infoResponse = httpClientUtil.post(url,params,"UTF-8");
|
|
|
|
// return jobController.firstExecuteQuota(tjQuotaId);
|
|
|
|
if("true".equals(infoResponse)){
|
|
|
|
return success("执行成功");
|
|
|
|
}
|
|
|
|
return Envelop.getError("执行失败");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
return failed(ERR_SYSTEM_DES);
|
|
return failed(ERR_SYSTEM_DES);
|
|
@ -283,8 +293,18 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
@PostMapping("execuQuota")
|
|
@PostMapping("execuQuota")
|
|
public Envelop execuQuota(Long tjQuotaId, String startDate, String endDate) {
|
|
public Envelop execuQuota(Long tjQuotaId, String startDate, String endDate) {
|
|
try {
|
|
try {
|
|
String url = "/job/execuJob";
|
|
|
|
return jobController.executeQuota(tjQuotaId,startDate,endDate);
|
|
|
|
|
|
String url = quotaUrl + "/api/v1.0/job/execuJob";
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("id", tjQuotaId+""));
|
|
|
|
params.add(new BasicNameValuePair("startDate", startDate));
|
|
|
|
params.add(new BasicNameValuePair("endDate", endDate));
|
|
|
|
// return jobController.executeQuota(tjQuotaId,startDate,endDate);
|
|
|
|
String infoResponse = httpClientUtil.post(url,params,"UTF-8");
|
|
|
|
// return jobController.firstExecuteQuota(tjQuotaId);
|
|
|
|
if("true".equals(infoResponse)){
|
|
|
|
return success("执行成功");
|
|
|
|
}
|
|
|
|
return Envelop.getError("执行失败");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
return failed(ERR_SYSTEM_DES);
|
|
return failed(ERR_SYSTEM_DES);
|
|
@ -324,48 +344,67 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
public Envelop selectQuotaResult(Long tjQuotaId, int page, int rows,
|
|
public Envelop selectQuotaResult(Long tjQuotaId, int page, int rows,
|
|
String startTime, String endTime, String orgName,
|
|
String startTime, String endTime, String orgName,
|
|
String province, String city, String district,String res) {
|
|
String province, String city, String district,String res) {
|
|
String url = "/tj/tjGetQuotaResult";
|
|
|
|
try {
|
|
try {
|
|
Map<String, Object> filters = new HashMap<>();
|
|
Map<String, Object> filters = new HashMap<>();
|
|
if(StringUtils.isNotBlank(startTime)){
|
|
|
|
filters.put("startTime", startTime);
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(endTime)){
|
|
|
|
filters.put("endTime", endTime);
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(orgName)){
|
|
|
|
filters.put("orgName", orgName);
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(province)){
|
|
|
|
filters.put("province", province);
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(city)){
|
|
|
|
filters.put("city", city);
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(district)){
|
|
|
|
filters.put("district", district);
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(res)){
|
|
|
|
// 结果大于0
|
|
|
|
filters.put("result", res);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
List<SaveModel> saveModelList = new ArrayList<>();
|
|
|
|
List<Map<String, Object>> resultList = quotaService.queryResultPage(tjQuotaId, filters.toString(), page, rows);
|
|
|
|
if(resultList != null && resultList.size() > 0){
|
|
|
|
for(Map<String, Object> map : resultList){
|
|
|
|
SaveModel saveModel = objectMapper.convertValue(map, SaveModel.class);
|
|
|
|
if(saveModel != null){
|
|
|
|
saveModelList.add(saveModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
long totalCount = quotaService.getQuotaTotalCount(tjQuotaId,filters.toString());
|
|
|
|
return PageEnvelop.getSuccessListWithPage("查询成功",saveModelList,page,rows,totalCount);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
return failed("查询失败");
|
|
|
|
|
|
filters.put("startTime", startTime);
|
|
|
|
filters.put("endTime", endTime);
|
|
|
|
filters.put("org", orgName);
|
|
|
|
filters.put("province", province);
|
|
|
|
filters.put("town", city);
|
|
|
|
filters.put("district", district);
|
|
|
|
// 结果大于0
|
|
|
|
filters.put("result", res);
|
|
|
|
|
|
|
|
String url = quotaUrl + "/api/v1.0/tj/tjGetQuotaResult";
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("id", tjQuotaId+""));
|
|
|
|
params.add(new BasicNameValuePair("pageNo", page+""));
|
|
|
|
params.add(new BasicNameValuePair("pageSize", rows+""));
|
|
|
|
params.add(new BasicNameValuePair("filters", objectMapper.writeValueAsString(filters)));
|
|
|
|
|
|
|
|
String infoResponse = httpClientUtil.get(url,params,"UTF-8");
|
|
|
|
return toModel(infoResponse,MixEnvelop.class);
|
|
|
|
|
|
|
|
// Map<String, Object> filters = new HashMap<>();
|
|
|
|
// if(StringUtils.isNotBlank(startTime)){
|
|
|
|
// filters.put("startTime", startTime);
|
|
|
|
// }
|
|
|
|
// if(StringUtils.isNotBlank(endTime)){
|
|
|
|
// filters.put("endTime", endTime);
|
|
|
|
// }
|
|
|
|
// if(StringUtils.isNotBlank(orgName)){
|
|
|
|
// filters.put("orgName", orgName);
|
|
|
|
// }
|
|
|
|
// if(StringUtils.isNotBlank(province)){
|
|
|
|
// filters.put("province", province);
|
|
|
|
// }
|
|
|
|
// if(StringUtils.isNotBlank(city)){
|
|
|
|
// filters.put("city", city);
|
|
|
|
// }
|
|
|
|
// if(StringUtils.isNotBlank(district)){
|
|
|
|
// filters.put("district", district);
|
|
|
|
// }
|
|
|
|
// if(StringUtils.isNotBlank(res)){
|
|
|
|
// // 结果大于0
|
|
|
|
// filters.put("result", res);
|
|
|
|
// }
|
|
|
|
// try {
|
|
|
|
// List<SaveModel> saveModelList = new ArrayList<>();
|
|
|
|
// List<Map<String, Object>> resultList = quotaService.queryResultPage(tjQuotaId, filters.toString(), page, rows);
|
|
|
|
// if(resultList != null && resultList.size() > 0){
|
|
|
|
// for(Map<String, Object> map : resultList){
|
|
|
|
// SaveModel saveModel = objectMapper.convertValue(map, SaveModel.class);
|
|
|
|
// if(saveModel != null){
|
|
|
|
// saveModelList.add(saveModel);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// long totalCount = quotaService.getQuotaTotalCount(tjQuotaId,filters.toString());
|
|
|
|
// return PageEnvelop.getSuccessListWithPage("查询成功",saveModelList,page,rows,totalCount);
|
|
|
|
// } catch (Exception e) {
|
|
|
|
// e.printStackTrace();
|
|
|
|
// }
|
|
|
|
// return failed("查询失败");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
return failed(ERR_SYSTEM_DES);
|
|
return failed(ERR_SYSTEM_DES);
|