Commit afaa7479 authored by tianyiming's avatar tianyiming

监管业务发起相关提交

parent e7fb3ea8
......@@ -167,4 +167,19 @@ public class CommonController extends BaseController {
record.put("label", e.getName());
return record;
}
/**
* 查询监管业务名称列表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询监管业务名称列表", notes = "查询监管业务名称列表")
@GetMapping(value = "/superviseBusinessCategory")
public ResponseModel<Object> equipTree(String type) {
return ResponseHelper.buildResponse(commonService.superviseBusinessCategory(type));
}
}
......@@ -40,4 +40,6 @@ public interface ICommonService {
void generateCertificateReport(Map<String, Object> map, HttpServletResponse response);
List<LinkedHashMap> creatApproveTree();
List<Map<String, Object>> superviseBusinessCategory(String type);
}
......@@ -12,15 +12,18 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.utils.FileExporter;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.PrivilegeFeginService;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
......@@ -54,6 +57,10 @@ public class CommonServiceImpl implements ICommonService {
@Autowired
CommonMapper commonMapper;
@Value("classpath:/json/superviseBusinessCategory.json")
private Resource superviseBusinessCategory;
//行政区划redis缓存key
private static final String PROVINCE = "PROVINCE";
private static final String CITY = "CITY";
......@@ -205,6 +212,33 @@ public class CommonServiceImpl implements ICommonService {
return resultTree;
}
@Override
public List<Map<String, Object>> superviseBusinessCategory(String type) {
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(superviseBusinessCategory);
List<Map<String, Object>> mapList = new ArrayList<>();
switch (type) {
case "SGGZ":
mapList = resourceJson.get("SGGZ");
break;
case "DJGL":
mapList = resourceJson.get("DJGL");
break;
case "WBBA":
mapList = resourceJson.get("WBBA");
break;
case "SBYJ":
mapList = resourceJson.get("SBYJ");
break;
case "TYQY":
mapList = resourceJson.get("TYQY");
break;
case "ZXBF":
mapList = resourceJson.get("ZXBF");
break;
}
return mapList;
}
private List<LinkedHashMap> deleteTreeData(List<LinkedHashMap> result) {
Iterator it = result.iterator();
while (it.hasNext()) {
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
......@@ -23,6 +24,7 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.apache.commons.collections.CollectionUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.poi.ss.formula.functions.T;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
......@@ -524,7 +526,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* @return
*/
public Page<JSONObject> queryForEquipmentRegisterPage(JSONObject map) {
Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size"));
Integer pageNumber = ObjectUtils.isEmpty(map.getInteger("number")) ? 1 : map.getInteger("number");
Integer size = ObjectUtils.isEmpty(map.getInteger("size")) ? 20 : map.getInteger("size");
Page<JSONObject> result = new Page<>(pageNumber, size);
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder();
......@@ -541,11 +545,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String companyCode = company.getString("companyCode").contains("_") ?
company.getString("companyCode").split("_")[1] : company.getString("companyCode");
String type = company.getString("companyType");
if (ValidationUtil.isEmpty(type) || ValidationUtil.isEmpty(companyCode)) {
result.setRecords(new ArrayList<>());
result.setTotal(0);
return result;
}
//根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
......@@ -555,12 +555,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 根据当前登录用户类型及管辖机构筛选条件添加对应参数
if (ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR")) && ObjectUtils.isEmpty(map.getString("useUnitCreditCode"))) {
if (!ValidationUtil.isEmpty(type) && type.contains("使用单位")) {
if(ValidationUtil.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))){
if (ValidationUtil.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) {
map.put("USE_UNIT_CREDIT_CODE", companyCode);
}
} else if (!ValidationUtil.isEmpty(type) && type.contains("安装改造维修单位")) {
map.put("USC_UNIT_CREDIT_CODE", companyCode);
}else {
} else {
result.setRecords(new ArrayList<>());
result.setTotal(0);
return result;
......@@ -575,40 +575,37 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
boolMust.must(meBuilder);
String queryType = map.getString("QUERY_TYPE");
// //查询 安装告知【可告知设备列表】【EQU_STATE=== null】
if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "AZ")) {
BoolQueryBuilder azBuilder = QueryBuilders.boolQuery();
azBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
boolMust.must(azBuilder);
}
//查询 维保备案【可绑定设备列表】【(EQU_STATE=== null) && (INSPECT_REPORT!=="" && !null)】
// if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "WB")) {
// BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery();
// wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
// wbBuilder.must(QueryBuilders.existsQuery("INSPECT_REPORT"));
// wbBuilder.mustNot(QueryBuilders.matchPhraseQuery("INSPECT_REPORT", ""));
// boolMust.must(wbBuilder);
// }
//查询 使用登记【可选设备列表】【EQU_STATUS=== null && (INSPECT_REPORT!=="" && !null) && (USE_ORG_CODE!=="" && !null)】
if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "SY")) {
BoolQueryBuilder syBuilder = QueryBuilders.boolQuery();
syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
syBuilder.must(QueryBuilders.existsQuery("INSPECT_REPORT"));
syBuilder.mustNot(QueryBuilders.matchPhraseQuery("INSPECT_REPORT", ""));
syBuilder.must(QueryBuilders.existsQuery("USE_ORG_CODE"));
syBuilder.mustNot(QueryBuilders.matchPhraseQuery("USE_ORG_CODE", ""));
boolMust.must(syBuilder);
if(!ObjectUtils.isEmpty(queryType)){
//查询 安装告知【可告知设备列表】【EQU_STATE=== null】
if (ValidationUtil.equals(queryType, "AZ")) {
BoolQueryBuilder azBuilder = QueryBuilders.boolQuery();
azBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
boolMust.must(azBuilder);
} else if (ValidationUtil.equals(queryType, "WB")) {
// 查询 维保备案【可绑定设备列表】【(EQU_STATE=== null) && (INSPECT_REPORT!=="" && !null)】
BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery();
wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
wbBuilder.must(QueryBuilders.existsQuery("INSPECT_REPORT"));
wbBuilder.mustNot(QueryBuilders.matchPhraseQuery("INSPECT_REPORT", ""));
boolMust.must(wbBuilder);
} else if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "SY")) {
//查询 使用登记【可选设备列表】【EQU_STATUS=== null && (INSPECT_REPORT!=="" && !null) && (USE_ORG_CODE!=="" && !null)】
BoolQueryBuilder syBuilder = QueryBuilders.boolQuery();
syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
syBuilder.must(QueryBuilders.existsQuery("INSPECT_REPORT"));
syBuilder.mustNot(QueryBuilders.matchPhraseQuery("INSPECT_REPORT", ""));
syBuilder.must(QueryBuilders.existsQuery("USE_ORG_CODE"));
syBuilder.mustNot(QueryBuilders.matchPhraseQuery("USE_ORG_CODE", ""));
boolMust.must(syBuilder);
}
}
//通用匹配规则,其他条件构建
if (!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))) {
BoolQueryBuilder seqBuilder = QueryBuilders.boolQuery();
String param = map.getString("SEQUENCE_NBR");
String[] split = param.split(",");
for (String seq : split) {
seqBuilder.should(QueryBuilders.termQuery("SEQUENCE_NBR.keyword", seq));
}
seqBuilder.minimumShouldMatch(1);
List<String> strings = Arrays.asList(param.split(","));
seqBuilder.must(QueryBuilders.termsQuery("SEQUENCE_NBR.keyword", strings));
boolMust.must(seqBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_CATEGORY"))) {
......@@ -633,7 +630,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
//使用单位 //安装改造维修单位
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE")) && !ObjectUtils.isEmpty(map.getString("USC_UNIT_CREDIT_CODE"))){
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE")) && !ObjectUtils.isEmpty(map.getString("USC_UNIT_CREDIT_CODE"))) {
BoolQueryBuilder ubuilder = QueryBuilders.boolQuery();
String useCode = QueryParser.escape(map.getString("USE_UNIT_CREDIT_CODE"));
useCode = useCode.contains("_") ? useCode.split("_")[0] : useCode;
......@@ -643,7 +640,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
ubuilder.should(QueryBuilders.matchPhraseQuery("USC_UNIT_CREDIT_CODE", "*" + uscCode + "*"));
ubuilder.minimumShouldMatch(1);
boolMust.must(ubuilder);
}else {
} else {
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE")) || !ObjectUtils.isEmpty(map.getString("useUnitCreditCode"))) {
BoolQueryBuilder uuccBuilder = QueryBuilders.boolQuery();
String uucc = !ValidationUtil.isEmpty(map.getString("USE_UNIT_CREDIT_CODE")) ? map.getString("USE_UNIT_CREDIT_CODE") : map.getString("useUnitCreditCode");
......@@ -664,11 +661,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ObjectUtils.isEmpty(map.getString("SUPERVISORY_CODE"))) {
BoolQueryBuilder scBuilder = QueryBuilders.boolQuery();
String param = map.getString("SUPERVISORY_CODE");
String[] split = param.split(",");
for (String code : split) {
scBuilder.should(QueryBuilders.termQuery("SUPERVISORY_CODE", code));
}
scBuilder.minimumShouldMatch(1);
List<String> strings = Arrays.asList(param.split(","));
scBuilder.must(QueryBuilders.termsQuery("SUPERVISORY_CODE", strings));
boolMust.must(scBuilder);
}
//设备种类编码
......@@ -689,8 +683,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC);
builder.from((map.getInteger("number") - 1) * map.getInteger("size"));
builder.size(map.getInteger("size"));
builder.from((pageNumber - 1) * size);
builder.size(size);
request.source(builder);
List<JSONObject> list = new LinkedList<>();
long totle = 0;
......
{
"SGGZ": [
{
"name": "安装告知",
"code": "GZ01"
},
{
"name": "改造告知",
"code": "GZ02"
},
{
"name": "维修告知",
"code": "GZ03"
},
{
"name": "移装告知",
"code": "GZ04"
}
],
"DJGL":[
{
"name": "使用登记",
"code": "DJ01"
},
{
"name": "改造变更登记",
"code": "DJ02"
},
{
"name": "移装变更登记",
"code": "DJ03"
},
{
"name": "单位变更登记",
"code": "DJ04"
},
{
"name": "更名变更登记",
"code": "DJ05"
}
],
"WBBA":[
{
"name": "维保备案",
"code": "WB01"
}
],
"SBYJ":[
{
"name": "设备移交",
"code": "YJ01"
}
],
"TYQY":[
{
"name": "停用启用",
"code": "QT01"
}
],
"ZXBF":[
{
"name": "注销报废",
"code": "BF01"
}
]
}
\ No newline at end of file
......@@ -393,6 +393,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (ValidationUtil.isEmpty(type)) {
mapList = resourceJson.get(EquipmentClassifityEnum.BDLS.getCode());
} else {
if ("ZXBF".equals(type) || "TYQY".equals(type)) {
type = "superviseBusiness";
} else {
type = EquipmentClassifityEnum.BDLS.getCode();
}
mapList = resourceJson.get(type);
}
for (Map map : mapList) {
......
......@@ -114,5 +114,11 @@
"name": "客运索道",
"code": "9000"
}
],
"superviseBusiness": [
{
"name": "电梯",
"code": "3000"
}
]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment