LAPTOP-KB9HII50\70708 2 anni fa
parent
commit
7dd8e4ff00

+ 4 - 6
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/app/AppController.java

@ -9,10 +9,10 @@ import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@ -24,9 +24,9 @@ import java.util.*;
@Api( tags = {"网关-应用"})
public class AppController extends EnvelopRestEndpoint {
    @Autowired
    @Resource
    private GetInfoService getInfoService;
    @Autowired
    @Resource
    private AppService appService;
//    @RequestMapping("template/appInfo")
@ -62,7 +62,7 @@ public class AppController extends EnvelopRestEndpoint {
     * 应用列表及特定查询
     */
    @GetMapping("/searchApps")
    public Envelop getAppList(String sourceType, String searchNm, String org, String catalog, String status, int page, int rows, HttpServletRequest request) {
    public Envelop getAppList(String sourceType, String searchNm, String org, String catalog, String status, int page, int rows) {
        StringBuilder filters = new StringBuilder();
        if (!StringUtils.isEmpty(sourceType)) {
            filters.append("sourceType=" + sourceType+";");
@ -83,7 +83,6 @@ public class AppController extends EnvelopRestEndpoint {
        }
        String url = "/apps";
        String resultStr = "";
        try {
            List<App> appList = appService.search(null, filters.toString(), "-createTime", page, rows);
            return PageEnvelop.getSuccessListWithPage("查询成功",appList,page,rows,appService.getCount(filters.toString()));
@ -95,7 +94,6 @@ public class AppController extends EnvelopRestEndpoint {
    }
//    @RequestMapping("/deleteApp")
//    @ResponseBody
//    public Object deleteApp(String appId) {
//        Envelop result = new Envelop();
//        String resultStr = "";

+ 3 - 20
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/common/SystemDictController.java

@ -8,15 +8,13 @@ import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.net.URLEncoder;
import java.util.ArrayList;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -29,9 +27,9 @@ import java.util.Map;
@Api( tags = {"网关-字典"})
public class SystemDictController extends EnvelopRestEndpoint {
    @Autowired
    @Resource
    private SystemDictService dictService;
    @Autowired
    @Resource
    private SystemDictEntryService systemDictEntryService;
//
//    @RequestMapping("/createDict")
@ -108,8 +106,6 @@ public class SystemDictController extends EnvelopRestEndpoint {
    @GetMapping("searchSysDicts")
    public Envelop searchSysDicts(String searchNm, Integer page, Integer rows) {
        String resultStr = "";
        Envelop result = new Envelop();
        Map<String, Object> params = new HashMap<>();
        StringBuffer stringBuffer = new StringBuffer();
@ -328,29 +324,17 @@ public class SystemDictController extends EnvelopRestEndpoint {
    @GetMapping("searchDictEntryList")
    public Envelop searchDictEntryListForDDL(Long dictId, Integer page, Integer rows) {
        String resultStr = "";
        Envelop result = new Envelop();
        Map<String, Object> params = new HashMap<>();
        StringBuffer stringBuffer = new StringBuffer();
        if (!StringUtils.isEmpty(dictId)) {
            stringBuffer.append("dictId=" + dictId);
        }
        String filters = stringBuffer.toString();
        params.put("filters", "");
        if (!StringUtils.isEmpty(filters)) {
            params.put("filters", filters);
        }
        if(StringUtils.isEmpty(page) || page == 0){
            page = 1;
        }
        if(StringUtils.isEmpty(rows) || rows == 0){
            rows = 50;
        }
        params.put("page", page);
        params.put("size", rows);
        try {
            String url ="/dictionaries/entries";
            List<SystemDictEntry> systemDictEntryList = systemDictEntryService.search(null,filters,null,page,rows);
@ -363,7 +347,6 @@ public class SystemDictController extends EnvelopRestEndpoint {
//    @RequestMapping("searchDictForSelect")
//    @ResponseBody
//    public Object searchDictForSelect(Long dictId, String searchParm, Integer page, Integer rows) {
//
//        String resultStr = "";

+ 5 - 27
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/quota/TjDataSaveController.java

@ -7,17 +7,14 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.annotation.Resource;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by llh on 2017/5/9.
@ -27,16 +24,13 @@ import java.util.Map;
@Api( tags = {"网关-统计数据存储"})
public class TjDataSaveController extends EnvelopRestEndpoint {
    @Autowired
    @Resource
    TjDataSaveService tjDataSaveService;
    //查询统计主维度
    @GetMapping("/getTjDataSave")
    public Envelop searchTjDataSave(String name, String searchParm,int page, int rows){
        String url = "/tj/getTjDataSaveList";
        String resultStr = "";
        Envelop envelop = new Envelop();
        Map<String, Object> params = new HashMap<>();
        StringBuffer stringBuffer = new StringBuffer();
        if (!StringUtils.isEmpty(name)) {
            stringBuffer.append("name?" + name );
@ -70,18 +64,10 @@ public class TjDataSaveController extends EnvelopRestEndpoint {
    /**
     * 新增修改
     * @param tjDataSaveModelJsonData
     * @param request
     * @return
     * @throws IOException
     */
    @RequestMapping(value = "updateTjDataSave")
    public Envelop updateTjDataSave(String tjDataSaveModelJsonData, HttpServletRequest request) throws IOException {
    public Envelop updateTjDataSave(String tjDataSaveModelJsonData) throws IOException {
        String url = "/tj/addTjDataSave";
        String resultStr = "";
        System.out.println();
        Envelop result = new Envelop();
        String[] strings = URLDecoder.decode(tjDataSaveModelJsonData, "UTF-8").split(";");
        try {
            TjDataSave detailModel = objectMapper.readValue(strings[0], TjDataSave.class);
@ -115,8 +101,6 @@ public class TjDataSaveController extends EnvelopRestEndpoint {
    /**
     * 删除消息
     * @param tjDataSaveId
     * @return
     */
    @RequestMapping("deleteTjDataSave")
    public Envelop deleteTjDataSave(Long tjDataSaveId) {
@ -134,8 +118,6 @@ public class TjDataSaveController extends EnvelopRestEndpoint {
    /**
     * 根据id获取消息
     * @param id
     * @return
     */
    @GetMapping("getTjDataSaveById")
    public Envelop getTjQuotaById(Long id ) {
@ -152,8 +134,6 @@ public class TjDataSaveController extends EnvelopRestEndpoint {
    /**
     * 校验name是否唯一,true已存在
     * @param name
     * @return
     */
    @GetMapping("hasExistsName")
    public Envelop hasExistsName(String name) {
@ -163,15 +143,13 @@ public class TjDataSaveController extends EnvelopRestEndpoint {
            List<TjDataSave> list = tjDataSaveService.search(filter);
            return ObjEnvelop.getSuccess("查询成功",list.size() > 0);
        } catch (Exception e) {
            e.getMessage();
            e.printStackTrace();
        }
        return failed("查询失败");
    }
    /**
     * 校验code是否唯一
     * @param code
     * @return
     */
    @GetMapping("hasExistsCode")
    public Envelop hasExistsCode(String code) {
@ -181,7 +159,7 @@ public class TjDataSaveController extends EnvelopRestEndpoint {
            List<TjDataSave> list = tjDataSaveService.search(filter);
            return ObjEnvelop.getSuccess("查询成功",list.size() > 0);
        } catch (Exception e) {
            e.getMessage();
            e.printStackTrace();
        }
        return  failed("查询失败");
    }

+ 5 - 20
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/quota/TjDataSourceController.java

@ -7,20 +7,17 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.annotation.Resource;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by llh on 2017/5/9.
@ -30,7 +27,7 @@ import java.util.Map;
@Api( tags = {"网关-统计数据源"})
public class TjDataSourceController extends EnvelopRestEndpoint {
    @Autowired
    @Resource
    TjDataSourceService tjDataSourceService;
    //查询
@ -70,13 +67,9 @@ public class TjDataSourceController extends EnvelopRestEndpoint {
    /**
     * 新增修改
     * @param tjDataSourceModelJsonData
     * @param request
     * @return
     * @throws IOException
     */
    @PostMapping(value = "updateTjDataSource")
    public Envelop updateTjDataSource(String tjDataSourceModelJsonData, HttpServletRequest request) throws IOException {
    public Envelop updateTjDataSource(String tjDataSourceModelJsonData) throws IOException {
        String url = "/tj/addTjDataSource";
        String[] strings = URLDecoder.decode(tjDataSourceModelJsonData, "UTF-8").split(";");
        TjDataSource detailModel = objectMapper.readValue(strings[0],TjDataSource.class);
@ -109,8 +102,6 @@ public class TjDataSourceController extends EnvelopRestEndpoint {
    /**
     * 删除消息
     * @param tjDataSourceId
     * @return
     */
    @PostMapping("deleteTjDataSource")
    public Envelop deleteTjDataSource(Long tjDataSourceId) {
@ -128,8 +119,6 @@ public class TjDataSourceController extends EnvelopRestEndpoint {
    /**
     * 根据id获取消息
     * @param id
     * @return
     */
    @GetMapping("getTjDataSourceById")
    public Envelop getTjQuotaById(Long id ) {
@ -145,8 +134,6 @@ public class TjDataSourceController extends EnvelopRestEndpoint {
    /**
     * 校验name是否唯一,true已存在
     * @param name
     * @return
     */
    @GetMapping("hasExistsName")
    public Envelop hasExistsName(String name) {
@ -156,15 +143,13 @@ public class TjDataSourceController extends EnvelopRestEndpoint {
            List<TjDataSource> list = tjDataSourceService.search(filter);
            return ObjEnvelop.getSuccess("查询成功",list.size() > 0);
        } catch (Exception e) {
            e.getMessage();
            e.printStackTrace();
        }
        return  failed("查询失败");
    }
    /**
     * 校验code是否唯一
     * @param code
     * @return
     */
    @GetMapping("hasExistsCode")
    public Envelop hasExistsCode(String code) {
@ -174,7 +159,7 @@ public class TjDataSourceController extends EnvelopRestEndpoint {
            List<TjDataSource> list = tjDataSourceService.search(filter);
            return ObjEnvelop.getSuccess("查询成功",list.size() > 0);
        } catch (Exception e) {
            e.getMessage();
            e.printStackTrace();
        }
        return  failed("查询失败");
    }

+ 7 - 27
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/quota/TjDimensionMainController.java

@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.*;
@ -40,7 +39,6 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
    @GetMapping("/getTjDimensionMain")
    public Object searchTjDimensionMain(String name, int page, int rows){
        String url = "/tj/getTjDimensionMainList";
        String resultStr = "";
        StringBuffer stringBuffer = new StringBuffer();
        if (!StringUtils.isEmpty(name)) {
            stringBuffer.append("name?" + name );
@ -71,16 +69,11 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
    /**
     * 新增修改
     * @param tjDimensionMainModelJsonData
     * @param request
     * @return
     * @throws IOException
     */
    @PostMapping(value = "updateTjDimensionMain")
    public Object updateTjDimensionMain(String tjDimensionMainModelJsonData, HttpServletRequest request) throws IOException {
    public Object updateTjDimensionMain(String tjDimensionMainModelJsonData) throws IOException {
        String url = "/tj/tjDimensionMain";
        String resultStr = "";
        System.out.println();
        String[] strings = URLDecoder.decode(tjDimensionMainModelJsonData, "UTF-8").split(";");
        TjDimensionMain detailModel = objectMapper.readValue(strings[0], TjDimensionMain.class);
@ -113,8 +106,6 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
    /**
     * 删除消息
     * @param tjDimensionMainId
     * @return
     */
    @PostMapping("deleteTjDimensionMain")
    public Object deleteTjDimensionMain(Long tjDimensionMainId) {
@ -134,8 +125,6 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
    /**
     * 根据id获取消息
     * @param id
     * @return
     */
    @GetMapping("getTjDimensionMainByID")
    public Envelop getTjDimensionMainByID(Long id ) {
@ -153,8 +142,6 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
    /**
     * 校验名称是否唯一
     * @param name
     * @return
     */
    @GetMapping("isNameExists")
    public Envelop isNameExists(String name) {
@ -164,15 +151,13 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
            List<TjDimensionMain> tjDimensionMains = tjDimensionMainService.search(filter);
            return ObjEnvelop.getSuccess("",tjDimensionMains.size() >0);
        } catch (Exception e) {
            e.getMessage();
            e.printStackTrace();
        }
        return  failed("查询失败");
    }
    /**
     * 校验code是否唯一
     * @param code
     * @return
     */
    @GetMapping("isCodeExists")
    public Envelop isCodeExists(String code) {
@ -182,7 +167,7 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
            List<TjDimensionMain> tjDimensionMains = tjDimensionMainService.search(filter);
            return ObjEnvelop.getSuccess("",tjDimensionMains.size() >0);
        } catch (Exception e) {
            e.getMessage();
            e.printStackTrace();
        }
        return  failed("查询失败");
    }
@ -190,7 +175,6 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
    @GetMapping("/getTjDimensionMainInfo")
    public Envelop getTjDimensionMainInfo(String quotaCode, String name, int page, int rows){
        String url = "/tj/getTjDimensionMainInfoList";
        String resultStr = "";
        StringBuffer mainFilter = new StringBuffer("status=1");
        if (!StringUtils.isEmpty(name)) {
            mainFilter.append("name?" + name + " g1;code?" + name + " g1;");
@ -210,12 +194,8 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
                    }
                }
                List<String> list = getTjQuotaDimensionMainOfMainCode(filter, null);
                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 (TjDimensionMain tjDimensionMain : mainModelList) {
                    tjDimensionMain.setChecked(list.contains(tjDimensionMain.getCode()));
                }
                return MixEnvelop.getSuccess("查询成功",mainModelList2,mainModelList,page,rows,tjDimensionMainService.getCount(filters));
            }else{
@ -231,8 +211,8 @@ public class TjDimensionMainController extends EnvelopRestEndpoint {
        List<TjQuotaDimensionMain> mainModelList = tjQuotaDimensionMainService.search(filters, sorts);
        List<String> list = new ArrayList<>();
        if(mainModelList.size() > 0){
            for (int i=0; i<mainModelList.size(); i++) {
                list.add(mainModelList.get(i).getMainCode());
            for (TjQuotaDimensionMain tjQuotaDimensionMain : mainModelList) {
                list.add(tjQuotaDimensionMain.getMainCode());
            }
        }
        return list;

+ 10 - 34
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/quota/TjDimensionSlaveController.java

@ -10,14 +10,13 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.annotation.Resource;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.*;
@ -30,18 +29,15 @@ import java.util.*;
@Api( tags = {"网关-统计从维度"})
public class TjDimensionSlaveController extends EnvelopRestEndpoint {
    @Autowired
    @Resource
    TjDimensionSlaveService tjDimensionSlaveService;
    @Autowired
    @Resource
    TjQuotaDimensionSlaveService tjQuotaDimensionSlaveService;
    //查询
    @GetMapping("/getTjDimensionSlave")
    public Envelop searchTjDimensionSlave(String name, int page, int rows){
        String url = "/tj/getTjDimensionSlaveList";
        String resultStr = "";
        Envelop envelop = new Envelop();
        Map<String, Object> params = new HashMap<>();
        StringBuffer stringBuffer = new StringBuffer();
        if (!StringUtils.isEmpty(name)) {
            stringBuffer.append("name?" + name );
@ -72,13 +68,9 @@ public class TjDimensionSlaveController extends EnvelopRestEndpoint {
    /**
     * 新增修改
     * @param tjDimensionSlaveModelJsonData
     * @param request
     * @return
     * @throws IOException
     */
    @PostMapping(value = "updateTjDimensionSlave")
    public Envelop updateTjDimensionSlave(String tjDimensionSlaveModelJsonData, HttpServletRequest request) throws IOException {
    public Envelop updateTjDimensionSlave(String tjDimensionSlaveModelJsonData) throws IOException {
        String url = "/tj/tjDimensionSlave";
        String[] strings = URLDecoder.decode(tjDimensionSlaveModelJsonData, "UTF-8").split(";");
@ -112,8 +104,6 @@ public class TjDimensionSlaveController extends EnvelopRestEndpoint {
    /**
     * 删除消息
     * @param tjDimensionSlaveId
     * @return
     */
    @PostMapping("deleteTjDimensionSlave")
    public Envelop deleteTjDimensionSlave(Long tjDimensionSlaveId) {
@ -132,8 +122,6 @@ public class TjDimensionSlaveController extends EnvelopRestEndpoint {
    /**
     * 根据id获取消息
     * @param id
     * @return
     */
    @GetMapping("getTjDimensionSlaveById")
    public Envelop getTjDimensionSlaveById( Long id ) {
@ -149,8 +137,6 @@ public class TjDimensionSlaveController extends EnvelopRestEndpoint {
    /**
     * 校验名称是否唯一
     * @param name
     * @return
     */
    @GetMapping("isNameExists")
    public Envelop isNameExists(String name) {
@ -160,15 +146,13 @@ public class TjDimensionSlaveController extends EnvelopRestEndpoint {
            List<TjDimensionSlave> list = tjDimensionSlaveService.search(filter);
            return ObjEnvelop.getSuccess("查询成功",list.size() > 0);
        } catch (Exception e) {
            e.getMessage();
            e.printStackTrace();
        }
        return failed("查询失败");
    }
    /**
     * 校验code是否唯一
     * @param code
     * @return
     */
    @GetMapping("isCodeExists")
    public Envelop isCodeExists(String code) {
@ -178,7 +162,7 @@ public class TjDimensionSlaveController extends EnvelopRestEndpoint {
            List<TjDimensionSlave> list = tjDimensionSlaveService.search(filter);
            return ObjEnvelop.getSuccess("查询成功",list.size() > 0);
        } catch (Exception e) {
            e.getMessage();
            e.printStackTrace();
        }
        return failed("查询失败");
    }
@ -208,12 +192,8 @@ public class TjDimensionSlaveController extends EnvelopRestEndpoint {
                    }
                }
                List<String> list = getTjQuotaDimensionMainOfSlaveCode(filter, null);
                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 (TjDimensionSlave tjDimensionSlave : mainModelList) {
                    tjDimensionSlave.setChecked(list.contains(tjDimensionSlave.getCode()));
                }
                return MixEnvelop.getSuccess("",qtjQuotaDimensionSlaveList,mainModelList,page,rows,tjDimensionSlaveService.getCount(filters));
            } else {
@ -228,13 +208,9 @@ public class TjDimensionSlaveController extends EnvelopRestEndpoint {
    public List<String> getTjQuotaDimensionMainOfSlaveCode(String filters, String sorts) throws Exception {
        List<String> list = new ArrayList<>();
        List<TjQuotaDimensionSlave> qtjQuotaDimensionSlaveList = tjQuotaDimensionSlaveService.search(filters, sorts);
        List<TjQuotaDimensionSlave>  tjQuotaDimensionSlaveModelList = new ArrayList<>();
        if (qtjQuotaDimensionSlaveList.size()>0) {
            for (TjQuotaDimensionSlave tjQuotaQuotaDimensionSlaveModel : qtjQuotaDimensionSlaveList) {
                tjQuotaDimensionSlaveModelList.add(tjQuotaQuotaDimensionSlaveModel);
            }
            for (int i=0; i<tjQuotaDimensionSlaveModelList.size(); i++) {
                list.add(tjQuotaDimensionSlaveModelList.get(i).getSlaveCode());
            for (TjQuotaDimensionSlave tjQuotaDimensionSlave : qtjQuotaDimensionSlaveList) {
                list.add(tjQuotaDimensionSlave.getSlaveCode());
            }
        }
        return list;

+ 27 - 53
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/quota/TjQuotaController.java

@ -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) {

+ 10 - 12
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/report/ReportController.java

@ -15,7 +15,6 @@ import jxl.Workbook;
import jxl.format.CellFormat;
import jxl.write.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -51,7 +50,7 @@ public class ReportController extends EnvelopRestEndpoint {
        calendar.setTime(endDate);
        calendar.add(calendar.DATE, 1);//把日期往后增加一天.整数往后推,负数往前移动
        endDate = calendar.getTime();   //日期往后推一天
        QcQuotaResult qc = null;
        QcQuotaResult qc;
        //按区域查询统计结果集
        quotaList = qcQuotaResultService.getQuotaListByLocation(location, startDate, endDate);
        if(null!=quotaList&&quotaList.size() > 0){
@ -355,7 +354,6 @@ public class ReportController extends EnvelopRestEndpoint {
        Map<String, MQcDailyReportResultDetail> detailMap = new TreeMap();
        Map<String, MQcDailyReportResultDetail> detailAnMap = new TreeMap();
        Map<String, MQcDailyReportResultDetail> detailMonMap = new TreeMap();
        MQcDailyReportResultDetail qrd = null;
        if(null!=detailQuotaList&&detailQuotaList.size() > 0){
            for (int i = 0; i < detailQuotaList.size(); i++) {
                Object[] obj = (Object[]) detailQuotaList.get(i);
@ -434,16 +432,16 @@ public class ReportController extends EnvelopRestEndpoint {
                    String value="";
                    if(obj[4] != null && obj[5] != null && obj[6] != null && obj[7] != null){
                        //实收数 (数据元的实收为 应收 - 错误数(标识为空的错误code))
                        totalNum = Integer.valueOf(obj[4].toString());
                        totalNum = Integer.parseInt(obj[4].toString());
                        qc.setTotalNum(totalNum);
                        //应收数
                        realNum = Integer.valueOf(obj[5].toString());
                        realNum = Integer.parseInt(obj[5].toString());
                        qc.setRealNum(realNum);
                        //错误数量(该字段只针对数据元的准确性统计)
                        errorNum = Integer.valueOf(obj[6].toString());
                        errorNum = Integer.parseInt(obj[6].toString());
                        qc.setErrorNum(errorNum);
                        //及时采集的档案数量
                        timelyNum = Integer.valueOf(obj[7].toString());
                        timelyNum = Integer.parseInt(obj[7].toString());
                        qc.setTimelyNum(timelyNum);
                        value=calculatePointUtil.calculatePoint(quotaIdstr, realNum, totalNum , errorNum , timelyNum);
                    }
@ -485,8 +483,8 @@ public class ReportController extends EnvelopRestEndpoint {
            params.put("startTime",startTime);
            params.put("endTime",endTime);
            List<Object> quotaList = new ArrayList<Object>();
            List<Object> detailQuotaList = new ArrayList<Object>();
            List<Object> quotaList;
            List<Object> detailQuotaList;
//        int firstDate=(page-1)*size;
            Date startDate = DateUtil.formatYMDToYMDHMS(startTime);
@ -499,13 +497,13 @@ public class ReportController extends EnvelopRestEndpoint {
            //获取区域名称和事件时间
            quotaList = qcQuotaResultService.getfindQcListByLocationAndTime(location, startDate, endDate);
            if (null!=quotaList&&quotaList.size() > 0) {
                for (int i = 0; i < quotaList.size(); i++) {
                    Object[] obj = (Object[]) quotaList.get(i);
                for (Object o : quotaList) {
                    Object[] obj = (Object[]) o;
                    String eventTime = obj[2].toString();
                    String newEventTime = "";
                    if (null != eventTime && !"".equals(eventTime)) {
                        //事件时间
                        newEventTime = eventTime.substring(0,4)+"年"+eventTime.substring(5,7)+"月"+eventTime.substring(8,10)+"日";
                        newEventTime = eventTime.substring(0, 4) + "年" + eventTime.substring(5, 7) + "月" + eventTime.substring(8, 10) + "日";
                    }
                    String qcKey = obj[2].toString().substring(0, 10) + obj[3].toString();
                    QcQuotaResultAnalyseMap.put(qcKey, newEventTime);

+ 15 - 28
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/resource/ResourceBrowseController.java

@ -4,33 +4,22 @@ package com.yihu.jw.basic.agadmin.controller.resource;
import com.yihu.jw.basic.agadmin.service.ResourceBrowseControllerService;
import com.yihu.jw.basic.resource.service.ResourceBrowseService;
import com.yihu.jw.basic.resource.service.RsResourceService;
import com.yihu.jw.entity.ehr.resource.RsResource;
import com.yihu.jw.restmodel.ehr.resource.MRsColumnsModel;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.network.HttpResponse;
import com.yihu.jw.util.network.HttpUtils;
import io.swagger.annotations.Api;
import jxl.Cell;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.OutputStream;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -89,7 +78,6 @@ public class ResourceBrowseController extends EnvelopRestEndpoint {
    /**
     * 动态获取GRID的列名
     * @param dictId 资源编码
     * @return
     */
    @GetMapping("/getGridCloumnNames")
    public Envelop getGridColumnNames(String dictId) throws Exception {
@ -121,12 +109,6 @@ public class ResourceBrowseController extends EnvelopRestEndpoint {
    /**
     * 档案资源浏览
     * @param resourcesCode
     * @param searchParams
     * @param page
     * @param rows
     * @param request
     * @return
     */
    @GetMapping("/searchResourceData")
    public Envelop searchResourceData(String resourcesCode, String searchParams, int page, int rows, HttpServletRequest request) throws Exception {
@ -154,19 +136,24 @@ public class ResourceBrowseController extends EnvelopRestEndpoint {
            List<Map<String, Object>> envelopList = listEnvelop.getDetailModelList();
            List<Map<String, Object>> middleList = new ArrayList<>();
            for (Map<String, Object> envelopMap : envelopList) {
                Map<String, Object> resultMap = new HashMap<String, Object>();
                Map<String, Object> resultMap = new HashMap<>();
                for (String key : envelopMap.keySet()) {
                    String value = envelopMap.get(key) == null? "" : String.valueOf(envelopMap.get(key));
                    if (key.equals("event_type")) {
                        String eventType = envelopMap.get(key).toString();
                        if (eventType.equals("0")) {
                            resultMap.put(key, "门诊");
                        } else if (eventType.equals("1")) {
                            resultMap.put(key, "住院");
                        } else if (eventType.equals("2")) {
                            resultMap.put(key, "体检");
                        } else {
                            resultMap.put(key, "未知");
                        switch (eventType) {
                            case "0":
                                resultMap.put(key, "门诊");
                                break;
                            case "1":
                                resultMap.put(key, "住院");
                                break;
                            case "2":
                                resultMap.put(key, "体检");
                                break;
                            default:
                                resultMap.put(key, "未知");
                                break;
                        }
                    } else if (value.contains("T") && value.contains("Z")) {
                        String newDateStr = value.replace("T", " ").replace("Z", "");