|
@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.client.RestClientException;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.*;
|
|
@ -41,37 +42,37 @@ import java.util.stream.Collectors;
|
|
|
@Api( tags = {"网关-统计"})
|
|
|
public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
private JobController jobController;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
private SystemDictEntryService dictEntryService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjQuotaService tjQuotaService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
private RsResourceQuotaService resourceQuotaService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjQuotaDataSaveService tjQuotaDataSaveService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjQuotaDataSourceService tjQuotaDataSourceService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjDataSaveService tjDataSaveService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjDataSourceService tjDataSourceService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjQuotaChartService tjQuotaChartService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjDimensionMainService tjDimensionMainService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjDimensionSlaveService tjDimensionSlaveService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
private TjQuotaCategoryService quotaCategoryService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjQuotaDimensionSlaveService tjQuotaDimensionSlaveService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjQuotaDimensionMainService tjQuotaDimensionMainService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
private QuotaService quotaService;
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
TjQuotaLogService tjQuotaLogService;
|
|
|
|
|
|
@GetMapping("/getTjQuota")
|
|
@ -255,7 +256,7 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
List<TjQuota> list = tjQuotaService.search(filter);
|
|
|
return ObjEnvelop.getSuccess("查询成功",list.size() >0);
|
|
|
} catch (Exception e) {
|
|
|
e.getMessage();
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return failed("查询失败");
|
|
|
}
|
|
@ -281,15 +282,6 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
*/
|
|
|
@PostMapping("execuQuota")
|
|
|
public Envelop execuQuota(Long tjQuotaId, String startDate, String endDate) {
|
|
|
Envelop envelop = new Envelop();
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("id", tjQuotaId);
|
|
|
if (!StringUtils.isEmpty(startDate)) {
|
|
|
params.put("startDate", startDate);
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(endDate)) {
|
|
|
params.put("endDate", endDate);
|
|
|
}
|
|
|
try {
|
|
|
String url = "/job/execuJob";
|
|
|
return jobController.executeQuota(tjQuotaId,startDate,endDate);
|
|
@ -331,7 +323,7 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
@GetMapping("selectQuotaResult")
|
|
|
public Envelop selectQuotaResult(Long tjQuotaId, int page, int rows,
|
|
|
String startTime, String endTime, String orgName,
|
|
|
String province, String city, String district,String res, HttpServletRequest request) {
|
|
|
String province, String city, String district,String res) {
|
|
|
String url = "/tj/tjGetQuotaResult";
|
|
|
try {
|
|
|
Map<String, Object> filters = new HashMap<>();
|
|
@ -387,17 +379,6 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
@GetMapping("queryQuotaLog")
|
|
|
public Envelop queryQuotaLog(String quotaCode, String startTime, String endTime, int page, int rows) throws Exception {
|
|
|
String url = "/tj/getTjQuotaLogList";
|
|
|
String resultStr = "";
|
|
|
Envelop envelop = new Envelop();
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
|
|
|
params.put("startTime", startTime);
|
|
|
params.put("endTime", endTime);
|
|
|
params.put("quotaCode", quotaCode);
|
|
|
params.put("fields", "");
|
|
|
params.put("sorts", "");
|
|
|
params.put("page", page);
|
|
|
params.put("size", rows);
|
|
|
try {
|
|
|
Map<String, Object> conditionMap = new HashMap<>();
|
|
|
conditionMap.put("quotaCode", quotaCode);
|
|
@ -444,7 +425,7 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
List<TjQuotaDimensionMain> list = tjQuotaDimensionMainService.search(filters);
|
|
|
return ObjEnvelop.getSuccess("",list.size()>0);
|
|
|
} catch (Exception e) {
|
|
|
e.getMessage();
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return failed("查询失败");
|
|
|
}
|
|
@ -521,12 +502,8 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
}
|
|
|
}
|
|
|
List<String> list = getAllCheckedTjQuotaChart(filters);
|
|
|
for (int i = 0; i < mainModelList.size(); i++) {
|
|
|
if (list.contains(mainModelList.get(i).getCode())) {
|
|
|
mainModelList.get(i).setChecked(true);
|
|
|
} else {
|
|
|
mainModelList.get(i).setChecked(false);
|
|
|
}
|
|
|
for (SystemDictEntry systemDictEntry : mainModelList) {
|
|
|
systemDictEntry.setChecked(list.contains(systemDictEntry.getCode()));
|
|
|
}
|
|
|
return MixEnvelop.getSuccess("",checkedConventionalDicts,mainModelList,page,rows,dictEntryService.getCount(filter));
|
|
|
} else {
|
|
@ -562,8 +539,8 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
if (list != null && list.size() > 0) {
|
|
|
tjQuotaChartService.deleteByQuotaCode(list.get(0).getQuotaCode());
|
|
|
}
|
|
|
for (int i=0; i<list.size(); i++) {
|
|
|
tjQuotaChartService.save(list.get(i));
|
|
|
for (TjQuotaChart tjQuotaChart : list) {
|
|
|
tjQuotaChartService.save(tjQuotaChart);
|
|
|
}
|
|
|
return ObjEnvelop.getSuccess("指标图表信息更新成功!", list);
|
|
|
} catch (RestClientException e) {
|
|
@ -801,8 +778,6 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
*
|
|
|
* @param name 检索字段名称
|
|
|
* @param codes 检索列表
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private List<String> findExistCodeOrName(String name, Set<String> codes) throws Exception {
|
|
|
|
|
@ -834,9 +809,9 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
private Map<String, String> findExistQuotaType(Set<String> names) throws Exception {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
List<Object> list = (List<Object>)quotaCategoryService.getQuotaCategoryByName(toEntity(toJson(names), String[].class));
|
|
|
for(int i = 0 ;i < list.size() ; i++){
|
|
|
Object[] objectList=(Object[])list.get(i);
|
|
|
if(null!=objectList[0]&&null!=objectList[1]){
|
|
|
for (Object o : list) {
|
|
|
Object[] objectList = (Object[]) o;
|
|
|
if (null != objectList[0] && null != objectList[1]) {
|
|
|
map.put(objectList[0].toString(), objectList[1].toString());
|
|
|
}
|
|
|
}
|
|
@ -913,7 +888,6 @@ public class TjQuotaController extends EnvelopRestEndpoint {
|
|
|
*/
|
|
|
@PostMapping("removeQuota")
|
|
|
public Object removeQuota(Long tjQuotaId) {
|
|
|
Envelop envelop = new Envelop();
|
|
|
try {
|
|
|
return jobController.removeQuota(tjQuotaId);
|
|
|
} catch (Exception e) {
|