Search in sources :

Example 1 with ApplicationInfoExample

use of com.itrus.portal.db.ApplicationInfoExample in project portal by ixinportal.

the class SocialSecurity method social.

/**
 * 社保
 * @param authHmac
 * @param appId
 * @param userName
 * @param idNo
 * @param sbbzNo
 * @param sbCardNo
 * @param serviceCode
 * @param request
 * @return
 */
@PostMapping(value = "/auth/social")
@ResponseBody
public Map<String, Object> social(@RequestHeader("Content-Signature") String authHmac, @RequestParam(value = "appId", required = true) String appId, @RequestParam(value = "userName", required = true) String userName, @RequestParam(value = "idNo", required = true) String idNo, @RequestParam(value = "sbbzNo", required = true) String sbbzNo, @RequestParam(value = "sbCardNo", required = true) String sbCardNo, @RequestParam(value = "serviceCode", required = true) String serviceCode, HttpServletRequest request) {
    // 存储接口返回信息
    JSONObject ret_data = null;
    // 返回错误信息
    Map<String, Object> result = new HashMap<String, Object>();
    // 验证参数是否完整
    if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(serviceCode) || StringUtils.isEmpty(idNo) || StringUtils.isEmpty(sbbzNo) || (StringUtils.isEmpty(sbCardNo))) {
        result.put("status", 0);
        result.put("message", "提交的参数信息不完整");
        return result;
    }
    // 得到应用信息 改成service
    Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
    ApplicationInfo applicationInfo = appInfoMap.get(appId);
    if (applicationInfo == null) {
        ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
        ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
        appInfoExampleCriteria.andAppIdEqualTo(appId);
        applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
    }
    return null;
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) JSONObject(com.alibaba.fastjson.JSONObject) HashMap(java.util.HashMap) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) JSONObject(com.alibaba.fastjson.JSONObject) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with ApplicationInfoExample

use of com.itrus.portal.db.ApplicationInfoExample in project portal by ixinportal.

the class APIService method upload.

/**
 * 证件图片上传
 *
 * @param authHmac
 *            hmac签名值,采用HmacSHA1算法
 * @param appId
 *            应用标识
 * @param orderNumber
 *            申请流水号
 * @param image1
 *            证件图片, base64形式
 * @param image2
 *            证件图片反面, base64形式(法定代表人和代理人证件类型为身份证时,必填)
 * @param type
 *            图片类型 1.营业执照或事业单位法人证书 2.组织机构代码证 3.税务登记证 4.法定代表人证件 5.代理人证件 6.授权书
 * @return
 */
@PostMapping(value = "/auth/upload")
@ResponseBody
public Map<String, Object> upload(@RequestHeader("Content-Signature") String authHmac, @RequestParam(value = "appId", required = false) String appId, @RequestParam(value = "orderNumber", required = false) String orderNumber, @RequestParam(value = "image1", required = false) String image1, @RequestParam(value = "image2", required = false) String image2, @RequestParam(value = "type", required = false) String type, HttpServletRequest request) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("status", 0);
    // 验证参数是否完整
    if (StringUtils.isEmpty(authHmac) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(type) || StringUtils.isEmpty(orderNumber) || StringUtils.isEmpty(image1)) {
        result.put("message", "提交的参数信息不完整");
        return result;
    }
    try {
        Bill bill = billService.getBillByOrderNumber(orderNumber);
        if (bill == null) {
            result.put("message", "申请流水号不存在");
            return result;
        }
        UserInfo userInfo = userInfoService.getUserInfoByBillId(bill.getId());
        // 得到应用信息 改成service
        Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
        ApplicationInfo applicationInfo = appInfoMap.get(appId);
        if (applicationInfo == null) {
            ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
            ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
            appInfoExampleCriteria.andAppIdEqualTo(appId);
            applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
        }
        if (applicationInfo == null) {
            result.put("message", "应用标识不存在");
            return result;
        }
        if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
            result.put("status", -1);
            result.put("message", "没有此服务权限");
            log.error("APIService_AccsessIp : " + request.getRemoteAddr());
            return result;
        }
        // 验证hmac有效性
        try {
            String macVal = CertService.hmacSha1(applicationInfo.getSecretKey().getBytes(), (appId + orderNumber + image1 + image2 + type).getBytes("utf-8"));
            // sc.getAddressKey()), false);
            if (!authHmac.equals("HMAC-SHA1 " + macVal)) {
                result.put("status", -2);
                result.put("message", "服务密钥错误");
                return result;
            }
        } catch (Exception e) {
            result.put("status", -3);
            result.put("message", "Hmac验证错误");
            e.printStackTrace();
            return result;
        }
        Enterprise enterprise = enterpriseService.getEnterpriseById(bill.getEnterprise());
        // 1、订单状态为:未支付、支付待确认、已支付待审核、送审中的状态,其余状态不能继续往下执行
        List<Integer> modifiedStatus = new ArrayList<Integer>();
        modifiedStatus.add(ComNames.BILL_STATUS_3);
        modifiedStatus.add(ComNames.BILL_STATUS_4);
        modifiedStatus.add(ComNames.BILL_STATUS_10);
        // 不在以上状态中
        if (modifiedStatus.indexOf(bill.getBillStatus()) == -1) {
            result.put("message", "该订单不能上传图片");
            return result;
        }
        // 1.营业执照或事业单位法人证书 2.组织机构代码证 3.税务登记证 4.法定代表人证件 5.代理人证件 6.授权书
        if (type.equals("1")) {
            BusinessLicense lc = businessService.getBusinessByBillId(bill.getId(), null);
            if (lc == null) {
                result.put("message", "不需要上传营业执照或(事业单位)法人证书图片");
                return result;
            }
            BusinessLicense business = businessService.portUpdateBusiness(bill.getId(), enterprise.getEnterpriseSn(), image1);
            if (business == null) {
                result.put("message", "营业执照或(事业单位)法人证书图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "营业执照或(事业单位)法人证书图片图片上传成功");
            return result;
        } else if (type.equals("2")) {
            OrgCode oc = orgCodeService.getOrgCodeByBillId(bill.getId(), null);
            if (oc == null) {
                result.put("message", "不需要上传组织机构代码证书图片");
                return result;
            }
            OrgCode orgCode = orgCodeService.portUpdateOrgCode(bill.getId(), enterprise.getEnterpriseSn(), image1);
            if (orgCode == null) {
                result.put("message", "组织机构代码证书图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "组织机构代码证书图片上传成功");
            return result;
        } else if (type.equals("3")) {
            TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId(bill.getId(), null);
            if (tc == null) {
                result.put("message", "不需要上传税务登记证图片");
                return result;
            }
            TaxRegisterCert taxRegisterCert = taxCertService.portUpdateTaxCert(bill.getId(), enterprise.getEnterpriseSn(), image1);
            if (taxRegisterCert == null) {
                result.put("message", "税务登记证图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "税务登记证图片上传成功");
            return result;
        } else if (type.equals("4")) {
            IdentityCard ic = identityCardService.getIdentityCardByBillId(bill.getId(), null);
            if (ic == null) {
                result.put("message", "不需要上传法定代表人证件图片");
                return result;
            }
            if (ic.getCardType().equals(1) && StringUtils.isEmpty(image2)) {
                result.put("message", "提交的参数信息不完整");
                return result;
            }
            IdentityCard identityCard = identityCardService.portUpdateIdentityCard(bill.getId(), enterprise.getEnterpriseSn(), image1, image2);
            if (identityCard == null) {
                result.put("message", "法定代表人证件图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "法定代表人证件图片上传成功");
            return result;
        } else if (type.equals("5")) {
            Agent at = agentService.getAgentByBillId(bill.getId(), null);
            if (at == null) {
                result.put("message", "不需要上传代理人证件图片");
                return result;
            }
            if (at.getCardType().equals(1) && StringUtils.isEmpty(image2)) {
                result.put("message", "提交的参数信息不完整");
                return result;
            }
            Agent agent = agentService.portUpdateAgent(bill.getId(), enterprise.getEnterpriseSn(), image1, image2);
            if (agent == null) {
                result.put("message", "代理人证件图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "代理人证件图片上传成功");
            return result;
        } else if (type.equals("6")) {
            Proxy py = proxyService.getProxyByBillId(bill.getId());
            if (py == null) {
                result.put("message", "不需要上传授权书图片");
                return result;
            }
            Proxy proxy = proxyService.portUpdateProxy(bill.getId(), userInfo.getUniqueId(), image1);
            if (proxy == null) {
                result.put("message", "授权书图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "授权书图片上传成功");
            return result;
        } else {
            result.put("message", "图片类型参数输入有误");
            return result;
        }
    } catch (Exception e) {
        e.printStackTrace();
        if (e.getMessage().contains("图片大小不能")) {
            result.put("status", 0);
            result.put("message", e.getMessage());
            return result;
        }
        // TODO Auto-generated catch block
        result.put("status", 0);
        result.put("message", "服务端出现未知错误,请联系管理员");
        return result;
    }
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) Agent(com.itrus.portal.db.Agent) HashMap(java.util.HashMap) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) ArrayList(java.util.ArrayList) UserInfo(com.itrus.portal.db.UserInfo) JSONException(org.json.JSONException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) Proxy(com.itrus.portal.db.Proxy) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) JSONObject(com.alibaba.fastjson.JSONObject) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with ApplicationInfoExample

use of com.itrus.portal.db.ApplicationInfoExample in project portal by ixinportal.

the class StatisticsIssuingController method list.

@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "serviceRequestPlatform", required = false) String serviceRequestPlatform, @RequestParam(value = "Statistics", required = false) Integer Statistics, @RequestParam(value = "year1", required = false) Integer year1, @RequestParam(value = "year2", required = false) Integer year2, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "hisApplicant", required = false) String hisApplicant, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "outReportTemplate", required = false) String outReportTemplate, @RequestParam(value = "hisway", required = false) String hisway, Model uiModel) throws Exception {
    Map param = new HashMap();
    Integer year3 = null;
    if (year1 != null) {
        year3 = year1;
    }
    List<Map<Integer, Integer>> list = new ArrayList<Map<Integer, Integer>>();
    java.util.Date nowdate = new java.util.Date();
    String[] monthList = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };
    String[] seasonList = { "S1", "S2", "S3", "S4" };
    String month = null;
    String season = null;
    String year = null;
    Calendar calendar = Calendar.getInstance();
    Calendar calendar2 = Calendar.getInstance();
    if (null != Statistics && Statistics == 12) {
        while (year1 <= year2) {
            for (int j = 0; j <= 11; j++) {
                calendar.set(Calendar.YEAR, year1);
                calendar.set(Calendar.MONTH, j);
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                calendar.set(Calendar.HOUR_OF_DAY, 0);
                calendar.set(Calendar.MINUTE, 0);
                calendar.set(Calendar.SECOND, 0);
                calendar.set(Calendar.MILLISECOND, 0);
                Date dt1 = calendar.getTime();
                calendar2.set(Calendar.YEAR, year1);
                calendar2.set(Calendar.MONTH, j + 1);
                calendar2.set(Calendar.DAY_OF_MONTH, 1);
                calendar2.set(Calendar.HOUR_OF_DAY, 0);
                calendar2.set(Calendar.MINUTE, 0);
                calendar2.set(Calendar.SECOND, 0);
                calendar2.set(Calendar.MILLISECOND, 0);
                Date dt2 = calendar2.getTime();
                if (StringUtils.isNotEmpty(serviceRequestPlatform) && !"0".equals(serviceRequestPlatform)) {
                    param.put("serviceRequestPlatform", serviceRequestPlatform);
                }
                if (StringUtils.isNotEmpty(hisApplicant)) {
                    param.put("hisApplicant", "%" + hisApplicant + "%");
                }
                if (type != null && !"0".equals(type)) {
                    param.put("type", type);
                }
                if (outReportTemplate != null && !"0".equals(outReportTemplate)) {
                    param.put("outReportTemplate", outReportTemplate);
                }
                if (hisway != null && !"0".equals(hisway)) {
                    param.put("hisway", hisway);
                }
                month = year1 + "-" + monthList[j];
                param.put("queryDate1", dt1);
                param.put("queryDate2", dt2);
                int count = hiscertificate.selectcount(param);
                Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                map.put(1, year1);
                map.put(2, count);
                list.add(map);
            }
            year1++;
        }
    }
    if (null != Statistics && Statistics == 4) {
        while (year1 <= year2) {
            for (int j = 0; j <= 9; j = j + 3) {
                calendar.set(Calendar.YEAR, year1);
                calendar.set(Calendar.MONTH, j);
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                calendar.set(Calendar.HOUR_OF_DAY, 0);
                calendar.set(Calendar.MINUTE, 0);
                calendar.set(Calendar.SECOND, 0);
                calendar.set(Calendar.MILLISECOND, 0);
                Date dt1 = calendar.getTime();
                calendar2.set(Calendar.YEAR, year1);
                calendar2.set(Calendar.MONTH, j + 3);
                calendar2.set(Calendar.DAY_OF_MONTH, 1);
                calendar2.set(Calendar.HOUR_OF_DAY, 0);
                calendar2.set(Calendar.MINUTE, 0);
                calendar2.set(Calendar.SECOND, 0);
                calendar2.set(Calendar.MILLISECOND, 0);
                Date dt2 = calendar2.getTime();
                if (StringUtils.isNotEmpty(serviceRequestPlatform) && !"0".equals(serviceRequestPlatform)) {
                    param.put("serviceRequestPlatform", serviceRequestPlatform);
                }
                if (StringUtils.isNotEmpty(hisApplicant)) {
                    param.put("hisApplicant", "%" + hisApplicant + "%");
                }
                if (type != null && !"0".equals(type)) {
                    param.put("type", type);
                }
                if (outReportTemplate != null && !"0".equals(outReportTemplate)) {
                    param.put("outReportTemplate", outReportTemplate);
                }
                if (hisway != null && !"0".equals(hisway)) {
                    param.put("hisway", hisway);
                }
                month = year1 + "-" + monthList[j];
                param.put("queryDate1", dt1);
                param.put("queryDate2", dt2);
                int count = hiscertificate.selectcount(param);
                Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                map.put(1, year1);
                map.put(2, count);
                list.add(map);
            }
            year1++;
        }
    }
    if (null != Statistics && Statistics == 1) {
        while (year1 <= year2) {
            calendar.set(Calendar.YEAR, year1);
            calendar.set(Calendar.MONTH, 0);
            calendar.set(Calendar.DAY_OF_MONTH, 1);
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            calendar.set(Calendar.MILLISECOND, 0);
            Date dt1 = calendar.getTime();
            calendar2.set(Calendar.YEAR, year1 + 1);
            calendar2.set(Calendar.MONTH, 0);
            calendar2.set(Calendar.DAY_OF_MONTH, 1);
            calendar2.set(Calendar.HOUR_OF_DAY, 0);
            calendar2.set(Calendar.MINUTE, 0);
            calendar2.set(Calendar.SECOND, 0);
            calendar2.set(Calendar.MILLISECOND, 0);
            Date dt2 = calendar2.getTime();
            if (StringUtils.isNotEmpty(serviceRequestPlatform) && !"0".equals(serviceRequestPlatform)) {
                param.put("serviceRequestPlatform", serviceRequestPlatform);
            }
            if (StringUtils.isNotEmpty(hisApplicant)) {
                param.put("hisApplicant", "%" + hisApplicant + "%");
            }
            if (type != null && !"0".equals(type)) {
                param.put("type", type);
            }
            if (outReportTemplate != null && !"0".equals(outReportTemplate)) {
                param.put("outReportTemplate", outReportTemplate);
            }
            if (hisway != null && !"0".equals(hisway)) {
                param.put("hisway", hisway);
            }
            year = year + "Y";
            param.put("queryDate1", dt1);
            param.put("queryDate2", dt2);
            int count = hiscertificate.selectcount(param);
            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
            map.put(1, year1);
            map.put(2, count);
            list.add(map);
            year1++;
        }
    }
    List appservice = applicationInfoService.selectByExample(new ApplicationInfoExample());
    uiModel.addAttribute("appservice", appservice);
    if (null == serviceRequestPlatform || "0".equals(serviceRequestPlatform)) {
        serviceRequestPlatform = "所有应用";
    }
    List<EvidenceBasicInformation> basicinfo = basicInformationimpl.selectList();
    uiModel.addAttribute("basicinfo", basicinfo);
    List<EvidenceOutTemplate> outRemplate = outServiceConfigService.selectOutTemplateByList();
    uiModel.addAttribute("outRemplate", outRemplate);
    if (null == serviceRequestPlatform || "0".equals(serviceRequestPlatform)) {
        serviceRequestPlatform = "所有应用";
    }
    uiModel.addAttribute("list", list);
    // System.out.println(list);
    uiModel.addAttribute("year1", year3);
    uiModel.addAttribute("serviceRequestPlatform", serviceRequestPlatform);
    uiModel.addAttribute("year2", year2);
    uiModel.addAttribute("Statistics", Statistics);
    uiModel.addAttribute("hisApplicant", hisApplicant);
    uiModel.addAttribute("type", type);
    uiModel.addAttribute("outReportTemplate", outReportTemplate);
    uiModel.addAttribute("hisway", hisway);
    return "sratisticsissuing/list";
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) Date(java.util.Date) Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) Date(java.util.Date) ArrayList(java.util.ArrayList) List(java.util.List) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with ApplicationInfoExample

use of com.itrus.portal.db.ApplicationInfoExample in project portal by ixinportal.

the class ApplicationInfoController method List.

// 列表所有信息
@RequestMapping(produces = "text/html")
public String List(@RequestParam(required = false, value = "aId") Long aId, @RequestParam(required = false, value = "queryDate1") Date queryDate1, @RequestParam(required = false, value = "queryDate2") Date queryDate2, @RequestParam(required = false, value = "serviceItem") Long serviceItem, @RequestParam(required = false, value = "page") Integer page, @RequestParam(required = false, value = "size") Integer size, Model uiModel) {
    // 补全日期
    if (queryDate1 == null && queryDate2 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate2 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate1 = calendar.getTime();
    }
    // page,size
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    // query data
    Integer offset = size * (page - 1);
    ApplicationInfoExample appExample = new ApplicationInfoExample();
    ApplicationInfoExample.Criteria ae = appExample.createCriteria();
    if (aId != null && aId != 0) {
        ae.andIdEqualTo(aId);
    }
    if (null != queryDate1) {
        ae.andCreateTimeGreaterThanOrEqualTo(queryDate1);
    }
    if (null != queryDate2) {
        ae.andCreateTimeLessThanOrEqualTo(queryDate2);
    }
    if (serviceItem != null && serviceItem != 0) {
        ae.andAppServiceItemsLike("%" + serviceItem.toString() + "%");
    }
    appExample.setOrderByClause("create_time desc");
    appExample.setOffset(offset);
    appExample.setLimit(size);
    List applicationInfoList = applicationInfoService.selectByExample(appExample);
    uiModel.addAttribute("applicationInfoList", applicationInfoList);
    Integer count = applicationInfoService.countByExample(appExample);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    // page, size
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("aId", aId);
    uiModel.addAttribute("queryDate1", queryDate1);
    uiModel.addAttribute("queryDate2", queryDate2);
    uiModel.addAttribute("serviceItem", serviceItem);
    List applicationInfos = applicationInfoService.selectByExample(new ApplicationInfoExample());
    uiModel.addAttribute("applicationInfos", applicationInfos);
    Map<Long, AppService> appServices = appService.selectMapByExample();
    uiModel.addAttribute("appServices", appServices);
    return "applicationinfo/list";
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) AppService(com.itrus.portal.db.AppService) Calendar(java.util.Calendar) List(java.util.List) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with ApplicationInfoExample

use of com.itrus.portal.db.ApplicationInfoExample in project portal by ixinportal.

the class AuthenticationstatisticsController method list.

@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "applyname", required = false) String applyname, @RequestParam(value = "Statistics", required = false) Integer Statistics, @RequestParam(value = "year1", required = false) Integer year1, @RequestParam(value = "year2", required = false) Integer year2, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "serviceclass", required = false) Long serviceclass, @RequestParam(value = "appServiceName", required = false) String appServiceName, @RequestParam(value = "serviceAuthenticationItem", required = false) String serviceAuthenticationItem, @RequestParam(value = "serviceAuthentication", required = false) String serviceAuthentication, @RequestParam(value = "authenticationResultMessage", required = false) Integer authenticationResultMessage, @RequestParam(value = "checkNumber", required = false) Double checkNumber, Model uiModel) throws Exception {
    Map param = new HashMap();
    Map param2 = new HashMap();
    Integer year3 = null;
    if (year1 != null) {
        year3 = year1;
    }
    List<Map<Integer, Integer>> list = new ArrayList<Map<Integer, Integer>>();
    java.util.Date nowdate = new java.util.Date();
    String[] monthList = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };
    String[] seasonList = { "S1", "S2", "S3", "S4" };
    String month = null;
    String season = null;
    String year = null;
    Calendar calendar = Calendar.getInstance();
    Calendar calendar2 = Calendar.getInstance();
    String applyname1 = null;
    String serviceAuthentication11 = null;
    List<Map> realNameList = new ArrayList<>();
    if (null != Statistics && Statistics == 12) {
        while (year1 <= year2) {
            for (int j = 0; j <= 11; j++) {
                calendar.set(Calendar.YEAR, year1);
                calendar.set(Calendar.MONTH, j);
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                calendar.set(Calendar.HOUR_OF_DAY, 0);
                calendar.set(Calendar.MINUTE, 0);
                calendar.set(Calendar.SECOND, 0);
                calendar.set(Calendar.MILLISECOND, 0);
                Date dt1 = calendar.getTime();
                calendar2.set(Calendar.YEAR, year1);
                calendar2.set(Calendar.MONTH, j + 1);
                calendar2.set(Calendar.DAY_OF_MONTH, 1);
                calendar2.set(Calendar.HOUR_OF_DAY, 0);
                calendar2.set(Calendar.MINUTE, 0);
                calendar2.set(Calendar.SECOND, 0);
                calendar2.set(Calendar.MILLISECOND, 0);
                Date dt2 = calendar2.getTime();
                if (applyname != null && !"0".equals(applyname)) {
                    param.put("applyname", applyname);
                }
                if (StringUtils.isNotEmpty(appServiceName)) {
                    param.put("appServiceName", appServiceName);
                }
                if (serviceclass == 0) {
                    if (serviceAuthenticationItem != null && !"0".equals(serviceAuthenticationItem)) {
                        param.put("serviceAuthenticationItem", "%" + serviceAuthenticationItem + "%");
                    }
                } else if (serviceclass == 1) {
                    if (serviceAuthentication != null && !"0".equals(serviceAuthentication)) {
                        param.put("serviceAuthenticationItem", "%" + serviceAuthentication + "%");
                    }
                }
                if (authenticationResultMessage != null && authenticationResultMessage >= 0) {
                    param.put("authenticationResultMessage", authenticationResultMessage);
                } else {
                    param.put("authenticationResultMessage", null);
                }
                if (checkNumber != null && checkNumber > 0) {
                    param.put("checkNumber", checkNumber);
                } else {
                    param.put("checkNumber", null);
                }
                if (serviceclass >= 0) {
                    param.put("serviceclass", serviceclass);
                }
                param.put("serviceclass", null);
                month = year1 + "-" + monthList[j];
                param2.put("month", month);
                param.put("queryDate1", dt1);
                param.put("queryDate2", dt2);
                Integer count1 = null;
                Integer count = null;
                if (serviceclass == 0) {
                    count = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod", param);
                    count1 = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod1", param);
                    realNameList = realNameService.selectListByRealNameRecordEnt1(param);
                // uiModel.addAttribute("RealNameList", RealNameList);
                } else if (serviceclass == 1) {
                    count = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod", param);
                    count1 = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod1", param);
                    realNameList = personalNameService.selectListByRealNameRecordEnt1(param);
                // uiModel.addAttribute("RealNameList", RealNameList);
                } else if (serviceclass == 2) {
                    Integer rcount1 = null;
                    Integer rcount = null;
                    Integer pcount1 = null;
                    Integer pcount = null;
                    rcount = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod", param);
                    rcount1 = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod1", param);
                    pcount = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod", param);
                    pcount1 = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod1", param);
                    count = rcount + pcount;
                    count1 = rcount1 + pcount1;
                }
                Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                map.put(1, year1);
                map.put(2, count);
                map.put(3, count1);
                list.add(map);
            // }
            }
            year1++;
        }
    }
    if (null != Statistics && Statistics == 4) {
        while (year1 <= year2) {
            for (int j = 0; j <= 9; j = j + 3) {
                calendar.set(Calendar.YEAR, year1);
                calendar.set(Calendar.MONTH, j);
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                calendar.set(Calendar.HOUR_OF_DAY, 0);
                calendar.set(Calendar.MINUTE, 0);
                calendar.set(Calendar.SECOND, 0);
                calendar.set(Calendar.MILLISECOND, 0);
                Date dt1 = calendar.getTime();
                calendar2.set(Calendar.YEAR, year1);
                calendar2.set(Calendar.MONTH, j + 3);
                calendar2.set(Calendar.DAY_OF_MONTH, 1);
                calendar2.set(Calendar.HOUR_OF_DAY, 0);
                calendar2.set(Calendar.MINUTE, 0);
                calendar2.set(Calendar.SECOND, 0);
                calendar2.set(Calendar.MILLISECOND, 0);
                Date dt2 = calendar2.getTime();
                if (applyname != null && !"0".equals(applyname)) {
                    param.put("applyname", applyname);
                }
                if (StringUtils.isNotEmpty(appServiceName)) {
                    param.put("appServiceName", appServiceName);
                }
                if (serviceAuthenticationItem != null && !"0".equals(serviceAuthenticationItem)) {
                    param.put("serviceAuthenticationItem", "%" + serviceAuthenticationItem + "%");
                } else {
                    param.put("serviceAuthenticationItem", null);
                }
                if (authenticationResultMessage != null && authenticationResultMessage >= 0) {
                    param.put("authenticationResultMessage", authenticationResultMessage);
                } else {
                    param.put("authenticationResultMessage", null);
                }
                if (checkNumber != null && checkNumber > 0) {
                    param.put("checkNumber", checkNumber);
                } else {
                    param.put("checkNumber", null);
                }
                if (serviceclass >= 0) {
                    param.put("serviceclass", serviceclass);
                }
                param.put("serviceclass", null);
                season = year1 + "-" + monthList[j / 3];
                param2.put("season", season);
                param.put("queryDate1", dt1);
                param.put("queryDate2", dt2);
                Integer count1 = null;
                Integer count = null;
                if (serviceclass == 0) {
                    count = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod", param);
                    count1 = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod1", param);
                    realNameList = realNameService.selectListByRealNameRecordEnt1(param);
                // uiModel.addAttribute("RealNameList", RealNameList);
                } else if (serviceclass == 1) {
                    count = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod", param);
                    count1 = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod1", param);
                    realNameList = personalNameService.selectListByRealNameRecordEnt1(param);
                // uiModel.addAttribute("RealNameList", RealNameList);
                } else if (serviceclass == 2) {
                    Integer rcount1 = null;
                    Integer rcount = null;
                    Integer pcount1 = null;
                    Integer pcount = null;
                    rcount = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod", param);
                    rcount1 = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod1", param);
                    pcount = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod", param);
                    pcount1 = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod1", param);
                    count = rcount + pcount;
                    count1 = rcount1 + pcount1;
                }
                Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                map.put(1, year1);
                map.put(2, count);
                map.put(3, count1);
                list.add(map);
            }
            year1++;
        }
    }
    if (null != Statistics && Statistics == 1) {
        while (year1 <= year2) {
            calendar.set(Calendar.YEAR, year1);
            calendar.set(Calendar.MONTH, 0);
            calendar.set(Calendar.DAY_OF_MONTH, 1);
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            calendar.set(Calendar.MILLISECOND, 0);
            Date dt1 = calendar.getTime();
            calendar2.set(Calendar.YEAR, year1 + 1);
            calendar2.set(Calendar.MONTH, 0);
            calendar2.set(Calendar.DAY_OF_MONTH, 1);
            calendar2.set(Calendar.HOUR_OF_DAY, 0);
            calendar2.set(Calendar.MINUTE, 0);
            calendar2.set(Calendar.SECOND, 0);
            calendar2.set(Calendar.MILLISECOND, 0);
            Date dt2 = calendar2.getTime();
            if (applyname != null && !"0".equals(applyname)) {
                param.put("applyname", applyname);
            }
            if (StringUtils.isNotEmpty(appServiceName)) {
                param.put("appServiceName", appServiceName);
            }
            if (serviceAuthenticationItem != null && !"0".equals(serviceAuthenticationItem)) {
                param.put("serviceAuthenticationItem", "%" + serviceAuthenticationItem + "%");
            } else {
                param.put("serviceAuthenticationItem", null);
            }
            if (authenticationResultMessage != null && authenticationResultMessage >= 0) {
                param.put("authenticationResultMessage", authenticationResultMessage);
            } else {
                param.put("authenticationResultMessage", null);
            }
            if (checkNumber != null && checkNumber > 0) {
                param.put("checkNumber", checkNumber);
            } else {
                param.put("checkNumber", null);
            }
            if (serviceclass >= 0) {
                param.put("serviceclass", serviceclass);
            }
            param.put("serviceclass", null);
            year = year + "Y";
            param2.put("year", year);
            param.put("queryDate1", dt1);
            param.put("queryDate2", dt2);
            Integer count1 = null;
            Integer count = null;
            if (serviceclass == 0) {
                count = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod", param);
                count1 = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod1", param);
                realNameList = realNameService.selectListByRealNameRecordEnt1(param);
                if (!"0".equals(serviceAuthenticationItem)) {
                    for (int j = 0; j < realNameList.size(); j++) {
                        serviceAuthenticationItem = realNameList.get(j).get("service_authentication_item").toString();
                    }
                }
            // uiModel.addAttribute("RealNameList", RealNameList);
            } else if (serviceclass == 1) {
                count = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod", param);
                count1 = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod1", param);
                realNameList = personalNameService.selectListByRealNameRecordEnt1(param);
            // uiModel.addAttribute("RealNameList", RealNameList);
            } else if (serviceclass == 2) {
                Integer rcount1 = null;
                Integer rcount = null;
                Integer pcount1 = null;
                Integer pcount = null;
                rcount = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod", param);
                rcount1 = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectCountByPeriod1", param);
                pcount = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod", param);
                pcount1 = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectCountByPeriod1", param);
                count = rcount + pcount;
                count1 = rcount1 + pcount1;
            }
            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
            map.put(1, year1);
            map.put(2, count);
            map.put(3, count1);
            list.add(map);
            year1++;
        }
    }
    List appservice = applicationInfoService.selectByExample(new ApplicationInfoExample());
    uiModel.addAttribute("appservice", appservice);
    if (null == applyname || "0".equals(applyname)) {
        applyname = "所有应用";
    }
    Map param3 = new HashMap();
    if (null == appServiceName || "" == appServiceName) {
        appServiceName = "所有服务";
    } else {
        if ("0".equals(serviceAuthenticationItem) && "0".equals(serviceAuthentication) && checkNumber == 0.0 && authenticationResultMessage == -1) {
            if (serviceclass == 0) {
                param3.put("appServiceName", appServiceName);
                AppServiceAuthentication appService = sqlSession.selectOne("com.itrus.portal.db.AppServiceAuthenticationMapper.selectByAppServiceAutToPersonal", param3);
                if (appService != null) {
                    uiModel.addAttribute("appService", appService);
                    if (null != serviceAuthenticationItem || !"0".equals(serviceAuthenticationItem)) {
                        uiModel.addAttribute("serviceAuthenticationItem", serviceAuthenticationItem);
                    } else {
                        uiModel.addAttribute("serviceAuthenticationItem", 0);
                    }
                } else {
                    uiModel.addAttribute("appService", 1);
                }
            } else if (serviceclass == 1) {
                param3.put("appServiceName", appServiceName);
                PersonalServiceAuthentication personalService = sqlSession.selectOne("com.itrus.portal.db.PersonalServiceAuthenticationMapper.selectByToPersonal", param3);
                if (personalService != null) {
                    uiModel.addAttribute("personalService", personalService);
                    if (null != serviceAuthenticationItem || !"0".equals(serviceAuthenticationItem)) {
                        uiModel.addAttribute("serviceAuthenticationItem", serviceAuthenticationItem);
                    } else {
                        uiModel.addAttribute("serviceAuthenticationItem", 0);
                    }
                } else {
                    uiModel.addAttribute("personalService", 1);
                }
            }
        } else {
            uiModel.addAttribute("appService", 1);
            uiModel.addAttribute("personalService", 1);
        }
    }
    uiModel.addAttribute("list", list);
    // System.out.println(list);
    uiModel.addAttribute("year1", year3);
    uiModel.addAttribute("applyname1", applyname1);
    uiModel.addAttribute("year2", year2);
    uiModel.addAttribute("Statistics", Statistics);
    uiModel.addAttribute("authenticationResultMessage", authenticationResultMessage);
    uiModel.addAttribute("checkNumber", checkNumber);
    uiModel.addAttribute("applyname", applyname);
    uiModel.addAttribute("serviceclass", serviceclass);
    uiModel.addAttribute("appServiceName", appServiceName);
    if (null != serviceAuthenticationItem || !"0".equals(serviceAuthenticationItem)) {
        uiModel.addAttribute("serviceAuthenticationItem", serviceAuthenticationItem);
    } else {
        uiModel.addAttribute("serviceAuthenticationItem", 0);
    }
    if (null != serviceAuthentication || !"0".equals(serviceAuthentication)) {
        uiModel.addAttribute("serviceAuthentication", serviceAuthentication);
    } else {
        uiModel.addAttribute("serviceAuthentication", 0);
    }
    return "authenticationstatistics/list";
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) HashMap(java.util.HashMap) Date(java.util.Date) Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) Date(java.util.Date) AppServiceAuthentication(com.itrus.portal.db.AppServiceAuthentication) PersonalServiceAuthentication(com.itrus.portal.db.PersonalServiceAuthentication) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ApplicationInfoExample (com.itrus.portal.db.ApplicationInfoExample)31 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)25 HashMap (java.util.HashMap)21 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)12 JSONObject (com.alibaba.fastjson.JSONObject)10 Map (java.util.Map)8 PostMapping (org.springframework.web.bind.annotation.PostMapping)8 Calendar (java.util.Calendar)7 Bill (com.itrus.portal.db.Bill)6 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)6 Date (java.util.Date)6 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)5 ArrayList (java.util.ArrayList)5 JSONException (org.json.JSONException)5 Enterprise (com.itrus.portal.db.Enterprise)4 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)4 IOException (java.io.IOException)4 List (java.util.List)4 Agent (com.itrus.portal.db.Agent)3