Commit 92f77aae authored by tianbo's avatar tianbo

Merge remote-tracking branch 'origin/develop_tzs_bugfix' into develop_tzs_register

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/listener/SafetyProblemTopicMessage.java # amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/UserBizByTCMServiceImpl.java
parents 5acad8b7 4b9f939d
package com.yeejoin.amos.api.householdapi.Utils;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.*;
//锦浪云 header处理类
public class GoLangHeaderUtils {
// public static void main(String[] args) {
// try {
// String key = "";
// String keySecret = "";
// Map<String,Object> map = new HashMap();
// map.put("pageNo",1);
// map.put("pageSize",10);
// String body = JSON.toJSONString(map);
// String ContentMd5 = getDigest(body);
// String Date = getGMTTime();
// String path = "/v1/api/userStationList";
// String param = "POST" + "\n" + ContentMd5 + "\n" + "application/json" + "\n" + Date + "\n" + path;
// String sign = HmacSHA1Encrypt(param, keySecret);
// String url = "url" + path ;
// OkHttpClient client = new OkHttpClient();
// MediaType xmlType = MediaType.parse("application/json;charset=UTF-8");
// okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(xmlType,body);
// okhttp3.Request request = new okhttp3.Request.Builder()
// .url(url)
// .addHeader("Content-type", "application/json;charset=UTF-8")
// .addHeader("Authorization","API "+key+":"+sign)
// .addHeader("Content-MD5",ContentMd5)
// .addHeader("Date",Date)
// .post(requestBody)
// .build();
// Response response = client.newCall(request).execute();
// String string = response.body().string();
// System.out.println(string);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
public static String HmacSHA1Encrypt(String encryptText, String KeySecret) throws Exception
{
byte[] data=KeySecret.getBytes("UTF-8");
SecretKey secretKey = new SecretKeySpec(data, "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(secretKey);
byte[] text = encryptText.getBytes("UTF-8");
byte[] result = mac.doFinal(text);
return Base64.encodeBase64String(result);
}
public static String getGMTTime(){
Calendar cd = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String str = sdf.format(cd.getTime());
return str;
}
//获取header中的 Content-MD5
public static String getDigest(String test) {
String result = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(test.getBytes());
byte[] b = md.digest();
result = java.util.Base64.getEncoder().encodeToString(b);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return result;
}
}
package com.yeejoin.amos.api.householdapi.constant;
public class Constant {
public static final String TOKEN_PREFIX = "OPENAPI_";
public static final String SECRETKEY = "tzs";
}
package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto;
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 户用光伏-厂商API haders
*
* @author system_generator
* @date 2023-06-07
*/
@RestController
@Api(tags = "户用光伏-厂商API hadersApi")
@RequestMapping(value = "/household-pv-api")
public class HouseholdPvApiController {
@Autowired
HouseholdPvApiServiceImpl householdPvApiServiceImpl;
/**
* 新增户用光伏-厂商API haders
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增户用光伏-厂商API haders", notes = "新增户用光伏-厂商API haders")
public ResponseModel<HouseholdPvApiDto> save(@RequestBody HouseholdPvApiDto model) {
model = householdPvApiServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏-厂商API haders", notes = "根据sequenceNbr更新户用光伏-厂商API haders")
public ResponseModel<HouseholdPvApiDto> updateBySequenceNbrHouseholdPvApi(@RequestBody HouseholdPvApiDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(householdPvApiServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除户用光伏-厂商API haders", notes = "根据sequenceNbr删除户用光伏-厂商API haders")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(householdPvApiServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个户用光伏-厂商API haders", notes = "根据sequenceNbr查询单个户用光伏-厂商API haders")
public ResponseModel<HouseholdPvApiDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(householdPvApiServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "户用光伏-厂商API haders分页查询", notes = "户用光伏-厂商API haders分页查询")
public ResponseModel<Page<HouseholdPvApiDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<HouseholdPvApiDto> page = new Page<HouseholdPvApiDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(householdPvApiServiceImpl.queryForHouseholdPvApiPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "户用光伏-厂商API haders列表全部数据查询", notes = "户用光伏-厂商API haders列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<HouseholdPvApiDto>> selectForList() {
return ResponseHelper.buildResponse(householdPvApiServiceImpl.queryForHouseholdPvApiList());
}
}
package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto;
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 户用光伏-厂商信息表
*
* @author system_generator
* @date 2023-06-07
*/
@RestController
@Api(tags = "户用光伏-厂商信息表Api")
@RequestMapping(value = "/household-pv-producer-info")
public class HouseholdPvProducerInfoController {
@Autowired
HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
/**
* 新增户用光伏-厂商信息表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增户用光伏-厂商信息表", notes = "新增户用光伏-厂商信息表")
public ResponseModel<HouseholdPvProducerInfoDto> save(@RequestBody HouseholdPvProducerInfoDto model) {
model = householdPvProducerInfoServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏-厂商信息表", notes = "根据sequenceNbr更新户用光伏-厂商信息表")
public ResponseModel<HouseholdPvProducerInfoDto> updateBySequenceNbrHouseholdPvProducerInfo(@RequestBody HouseholdPvProducerInfoDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(householdPvProducerInfoServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除户用光伏-厂商信息表", notes = "根据sequenceNbr删除户用光伏-厂商信息表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(householdPvProducerInfoServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个户用光伏-厂商信息表", notes = "根据sequenceNbr查询单个户用光伏-厂商信息表")
public ResponseModel<HouseholdPvProducerInfoDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(householdPvProducerInfoServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "户用光伏-厂商信息表分页查询", notes = "户用光伏-厂商信息表分页查询")
public ResponseModel<Page<HouseholdPvProducerInfoDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<HouseholdPvProducerInfoDto> page = new Page<HouseholdPvProducerInfoDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(householdPvProducerInfoServiceImpl.queryForHouseholdPvProducerInfoPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "户用光伏-厂商信息表列表全部数据查询", notes = "户用光伏-厂商信息表列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<HouseholdPvProducerInfoDto>> selectForList() {
return ResponseHelper.buildResponse(householdPvProducerInfoServiceImpl.queryForHouseholdPvProducerInfoList());
}
}
//package com.yeejoin.amos.api.householdapi.controller;
//
//import cn.hutool.http.HttpUtil;
//import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
//import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto;
//import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
//import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
//import fastjson.JSON;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import org.typroject.tyboot.core.foundation.enumeration.UserType;
//import org.typroject.tyboot.core.restful.doc.TycloudOperation;
//
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.Map;
//
//
///**
// * 户用光伏-厂商API haders
// *
// * @author system_generator
// * @date 2023-06-07
// */
//@RestController
//@Api(tags = "测试")
//@RequestMapping(value = "/household-pv-api-test1")
//public class HouseholdTestController {
// @Autowired
// private HouseholdPvUtils householdPvUtils;
//
//
// /**
// * 新增户用光伏-厂商API haders
// *
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @PostMapping(value = "/gdwdemo")
// @ApiOperation(httpMethod = "get", value = "固德威示例", notes = "固德威示例")
// public String save(Long seq) throws IOException {
// return householdPvUtils.gerResponseByAPiID(seq);
// }
//}
package com.yeejoin.amos.api.householdapi.face.model;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import java.util.Date;
/**
* 户用光伏-厂商API haders
*
* @author system_generator
* @date 2023-06-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "HouseholdPvApiDto", description = "户用光伏-厂商API haders")
public class HouseholdPvApiDto extends BaseModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "厂商id")
private String producerId;
@ApiModelProperty(value = "api名称")
private String apiName;
@ApiModelProperty(value = "请求方式 GET或者POST")
private String requestMethod;
@ApiModelProperty(value = "api地址")
private String apiUrl;
@ApiModelProperty(value = "api描述")
private String apiDescption;
@ApiModelProperty(value = "参数信息")
private String paramInfo;
/**
* 依赖的apiId
*/
@ApiModelProperty(value = "依赖的apiId")
private String dependecyApiId;
/**
* 缓存的属性
*/
@ApiModelProperty(value = "缓存的属性")
private String cacheField;
/**
* 依赖的api属性
*/
@ApiModelProperty(value = "依赖的api属性")
private String dependApiParamKey;
/**
* result解析结果
*/
@ApiModelProperty(value = "result解析结果")
private String resultResolveRule;
/**
* 是否分页
*/
@ApiModelProperty(value = "是否分页")
private Integer isPage;
/**
* 时序库中的表名
*/
@ApiModelProperty(value = "时序库表名")
private String measurement;
/**
* 页数解析规则
*/
@ApiModelProperty(value = "pagesize_resolve_rule")
private String pagesizeResolveRule;
/**
* 页码对应的请求中的字段
*/
@ApiModelProperty( value = "page_field")
private String pageField;
}
package com.yeejoin.amos.api.householdapi.face.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import java.util.Date;
/**
* 户用光伏-厂商信息表
*
* @author system_generator
* @date 2023-06-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "HouseholdPvProducerInfoDto", description = "户用光伏-厂商信息表")
public class HouseholdPvProducerInfoDto extends BaseModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "厂商名称")
private String prodcerName;
@ApiModelProperty(value = "厂商账号")
private String prodcerAccount;
@ApiModelProperty(value = "厂商密码")
private String prodcerPassword;
@ApiModelProperty(value = "厂商appID")
private String prodcerAppid;
@ApiModelProperty(value = "厂商appSecret")
private String prodcerAppsecret;
@ApiModelProperty(value = "厂商url")
private String prodcerUrl;
@ApiModelProperty(value = "公司id")
private String corporationId;
@ApiModelProperty(value = "公共header信息")
private String headerInfo;
@ApiModelProperty(value = "厂商code")
private String code;
}
package com.yeejoin.amos.api.householdapi.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvApi;
/**
* 户用光伏-厂商API haders Mapper 接口
*
* @author system_generator
* @date 2023-06-07
*/
public interface HouseholdPvApiMapper extends BaseMapper<HouseholdPvApi> {
}
package com.yeejoin.amos.api.householdapi.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvProducerInfo;
/**
* 户用光伏-厂商信息表 Mapper 接口
*
* @author system_generator
* @date 2023-06-07
*/
public interface HouseholdPvProducerInfoMapper extends BaseMapper<HouseholdPvProducerInfo> {
}
package com.yeejoin.amos.api.householdapi.face.orm.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import java.util.Date;
/**
* 户用光伏-厂商API haders
*
* @author system_generator
* @date 2023-06-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("household_pv_api")
public class HouseholdPvApi extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 厂商id
*/
@TableField("producer_id")
private String producerId;
/**
* api名称
*/
@TableField("api_name")
private String apiName;
/**
* 请求方式 GET或者POST
*/
@TableField("request_method")
private String requestMethod;
/**
* api地址
*/
@TableField("api_url")
private String apiUrl;
/**
* api描述
*/
@TableField("api_descption")
private String apiDescption;
/**
* 参数信息
*/
@TableField("param_info")
private String paramInfo;
/**
* 依赖的apiId
*/
@TableField("dependecy_api_id")
private String dependecyApiId;
/**
* 缓存的属性
*/
@TableField("cache_field")
private String cacheField;
/**
* 依赖的api属性
*/
@TableField("depend_api_param_key")
private String dependApiParamKey;
/**
* result解析结果
*/
@TableField("result_resolve_rule")
private String resultResolveRule;
/**
* 是否分页
*/
@TableField("is_page")
private Integer isPage;
/**
* 时序库中存储的表名
*/
@TableField("measurement")
private String measurement;
/**
* 页数解析规则
*/
@TableField("pagesize_resolve_rule")
private String pagesizeResolveRule;
/**
* 页码对应的请求中的字段
*/
@TableField("page_field")
private String pageField;
}
package com.yeejoin.amos.api.householdapi.face.orm.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import java.util.Date;
/**
* 户用光伏-厂商信息表
*
* @author system_generator
* @date 2023-06-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("household_pv_producer_info")
public class HouseholdPvProducerInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 厂商名称
*/
@TableField("prodcer_name")
private String prodcerName;
/**
* 厂商账号
*/
@TableField("prodcer_account")
private String prodcerAccount;
/**
* 厂商密码
*/
@TableField("prodcer_password")
private String prodcerPassword;
/**
* 厂商appID
*/
@TableField("prodcer_appid")
private String prodcerAppid;
/**
* 厂商appSecret
*/
@TableField("prodcer_appsecret")
private String prodcerAppsecret;
/**
* 厂商url
*/
@TableField("prodcer_url")
private String prodcerUrl;
/**
* 公司id
*/
@TableField("corporationId")
private String corporationId;
/**
* 公共header信息
*/
@TableField("header_info")
private String headerInfo;
/**
* 公共header信息
*/
@TableField("code")
private String code;
/**
* token_url
*/
@TableField("token_url")
private String tokenUrl;
}
package com.yeejoin.amos.api.householdapi.face.service;
/**
* 户用光伏-厂商API haders接口类
*
* @author system_generator
* @date 2023-06-07
*/
public interface IHouseholdPvApiService {
}
package com.yeejoin.amos.api.householdapi.face.service;
public interface IHouseholdPvCommonService {
public void getRequestHeader ();
public void getRequestParams();
}
package com.yeejoin.amos.api.householdapi.face.service;
/**
* 户用光伏-厂商信息表接口类
*
* @author system_generator
* @date 2023-06-07
*/
public interface IHouseholdPvProducerInfoService {
}
package com.yeejoin.amos.api.householdapi.face.service.impl;
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto;
import com.yeejoin.amos.api.householdapi.face.orm.dao.HouseholdPvApiMapper;
import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvApi;
import com.yeejoin.amos.api.householdapi.face.service.IHouseholdPvApiService;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 户用光伏-厂商API haders服务实现类
*
* @author system_generator
* @date 2023-06-07
*/
@Service
public class HouseholdPvApiServiceImpl extends BaseService<HouseholdPvApiDto, HouseholdPvApi, HouseholdPvApiMapper> implements IHouseholdPvApiService {
/**
* 分页查询
*/
public Page<HouseholdPvApiDto> queryForHouseholdPvApiPage(Page<HouseholdPvApiDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<HouseholdPvApiDto> queryForHouseholdPvApiList() {
return this.queryForList("" , false);
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto;
import com.yeejoin.amos.api.householdapi.face.orm.dao.HouseholdPvProducerInfoMapper;
import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvProducerInfo;
import com.yeejoin.amos.api.householdapi.face.service.IHouseholdPvProducerInfoService;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 户用光伏-厂商信息表服务实现类
*
* @author system_generator
* @date 2023-06-07
*/
@Service
public class HouseholdPvProducerInfoServiceImpl extends BaseService<HouseholdPvProducerInfoDto, HouseholdPvProducerInfo, HouseholdPvProducerInfoMapper> implements IHouseholdPvProducerInfoService {
/**
* 分页查询
*/
public Page<HouseholdPvProducerInfoDto> queryForHouseholdPvProducerInfoPage(Page<HouseholdPvProducerInfoDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<HouseholdPvProducerInfoDto> queryForHouseholdPvProducerInfoList() {
return this.queryForList("", false);
}
public HouseholdPvProducerInfo queryForHouseholdPvProducerInfoByCode(String code) {
return this.baseMapper.selectOne(new QueryWrapper<HouseholdPvProducerInfo>().eq("code", code));
}
}
\ No newline at end of file
//package com.yeejoin.amos.dockingData;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
//import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
//import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//import org.jetbrains.annotations.TestOnly;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.actuate.influx.InfluxDbHealthIndicator;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import java.util.HashMap;
//import java.util.LinkedHashMap;
//import java.util.Map;
//import java.util.UUID;
//import java.util.zip.Inflater;
//
///**
// * @description:
// * @author: tw
// * @createDate: 2023/6/16
// */
//@Component
//public class DockingData {
//
//
// @Autowired
// InfluxDbConnection influxDbConnection;
// @Autowired
// HouseholdPvUtils householdPvUtils;
// //初始化执行
// @PostConstruct
// public void init(){
// this.getDate();
// }
//
//
// //每二十分钟执行一次
// @Scheduled(cron = "0 0/20 * * * ?")
// public void fixedRate() {
// this.getDate();
// }
//
// //请求获取数据
// public void getDate(){
//
//
// //首航
// String data1=householdPvUtils.gerResponseByAPiID(1000000002L);
// JSONObject json= JSON.parseObject(data1);
//
// if((Boolean)json.get("success")){
// JSONArray obj= json.get("stationList") !=null?(JSONArray)json.get("stationList"):null;
// if (obj!=null) {
// for (Object o : obj) {
// Map<String,Object> maps1 = (Map<String,Object>)o;
// Map<String,String> maps2=new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("SH_DZ",maps2,maps1);
// }
// }
// }
//
// String data2=householdPvUtils.gerResponseByAPiID(1000000003L);
// JSONObject json2= JSON.parseObject(data2);
// if((Boolean)json2.get("success")) {
// JSONArray obj2 = json.get("deviceList") != null ? (JSONArray) json2.get("deviceList") : null;
// if (obj2!=null) {
// for (Object o : obj2) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("SH_ZB", maps2, maps1);
// }
// }
// }
//
// //固德威
// String data3 = householdPvUtils.gerResponseByAPiID(1000000006L);
//
// JSONObject json3= JSON.parseObject(data3);
// if(Integer.valueOf(json3.get("code").toString())==0) {
// JSONObject obj3 = json3.get("data") != null ? (JSONObject)json3.get("data") : null;
// if (obj3!=null&&obj3.get("list")!=null) {
//
// JSONArray ob = obj3.get("list") != null ? (JSONArray) obj3.get("list") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("GD_DZ", maps2, maps1);
// }
// }
// }
//
// String data4 = householdPvUtils.gerResponseByAPiID(1000000007L);
//
// JSONObject json4= JSON.parseObject(data4);
// if(Integer.valueOf(json4.get("code").toString())==0) {
// JSONObject obj4 = json4.get("data") != null ? (JSONObject)json4.get("data") : null;
// if (obj4!=null&&obj4.get("list")!=null) {
//
// JSONArray ob = obj4.get("list") != null ? (JSONArray) obj4.get("list") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("GD_ZT", maps2, maps1);
// }
// }
// }
//
// String data5 = householdPvUtils.gerResponseByAPiID(1000000008L);
//
// JSONObject json5= JSON.parseObject(data5);
// if(Integer.valueOf(json5.get("code").toString())==0) {
// JSONObject obj5 = json5.get("data") != null ? (JSONObject)json5.get("data") : null;
// if (obj5!=null&&obj5.get("list")!=null) {
//
// JSONArray ob = obj5.get("list") != null ? (JSONArray) obj5.get("list") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("GD_GJ", maps2, maps1);
// }
// }
// }
//
//
// String data6 = householdPvUtils.gerResponseByAPiID(1686897906789L);
//
// JSONObject json6= JSON.parseObject(data6);
// if(Integer.valueOf(json6.get("code").toString())==0) {
// JSONObject obj6 = json6.get("data") != null ? (JSONObject)json6.get("data") : null;
// if (obj6!=null&&obj6.get("page")!=null) {
//
// JSONArray ob = ((JSONObject)obj6.get("page")).get("records")!= null ? (JSONArray) ((JSONObject)obj6.get("page")).get("records") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("JL_CZ", maps2, maps1);
// }
// }
// }
// String data7 = householdPvUtils.gerResponseByAPiID(1686900771946L);
// JSONObject json7= JSON.parseObject(data7);
// if(Integer.valueOf(json7.get("code").toString())==0) {
// JSONObject obj7 = json7.get("data") != null ? (JSONObject)json7.get("data") : null;
// if (obj7!=null&&obj7.get("page")!=null) {
//
// JSONArray ob = ((JSONObject)obj7.get("page")).get("records")!= null ? (JSONArray) ((JSONObject)obj7.get("page")).get("records") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
//
// maps1.put("etotal1",maps1.get("etotal1").toString());
// maps1.put("etoday1",maps1.get("etoday1").toString());
// influxDbConnection.insert("JL_NBQ", maps2, maps1);
// }
// }
// }
// String data8 = householdPvUtils.gerResponseByAPiID(1686900972965L);
// JSONObject json8= JSON.parseObject(data8);
// if(Integer.valueOf(json8.get("code").toString())==0) {
// JSONObject obj8 = json8.get("data") != null ? (JSONObject)json8.get("data") : null;
// if (obj8!=null&&obj8.get("records")!=null) {
//
// JSONArray ob = obj8.get("records")!= null ? (JSONArray)obj8.get("records") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("JL_GJ", maps2, maps1);
// }
// }
// }
// }
//
//
//
//}
...@@ -45,7 +45,7 @@ public class ElevatorTechParamDefine implements ITechParamDefine { ...@@ -45,7 +45,7 @@ public class ElevatorTechParamDefine implements ITechParamDefine {
private BigDecimal numberDoors; private BigDecimal numberDoors;
@TechnicalParameter(key = "controlMode", label = "控制方式", equCategory = {"3100", "3200", "3400"}, type = TechnicalParameter.ParamType.STRING, dictCode = "DSXS") @TechnicalParameter(key = "controlMode", label = "控制方式", equCategory = {"3100", "3200", "3400"}, type = TechnicalParameter.ParamType.STRING, dictCode = "KZFS")
private String controlMode; private String controlMode;
......
package com.yeejoin.amos.boot.module.common.api.entity; package com.yeejoin.amos.boot.module.common.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter; import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem; import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem;
import lombok.Data; import lombok.Data;
...@@ -398,6 +396,12 @@ public class ESEquipmentInfo { ...@@ -398,6 +396,12 @@ public class ESEquipmentInfo {
private List<Maintenance> maintenances; private List<Maintenance> maintenances;
/** /**
* 压力管道长度
*/
@Field(type = FieldType.Double)
private Double pipeLength;
/**
* 技术参数 * 技术参数
*/ */
@Field(type = FieldType.Nested) @Field(type = FieldType.Nested)
......
...@@ -1053,8 +1053,9 @@ ...@@ -1053,8 +1053,9 @@
<select id="queryOutOfMaintenanceRecord" resultType="java.util.Map"> <select id="queryOutOfMaintenanceRecord" resultType="java.util.Map">
SELECT SELECT
tt."RECORD", ui."RECORD",
tt."INFORM_END", tt."INFORM_END",
tt."INFORM_END" as problemTime,
ui."USE_UNIT_NAME", ui."USE_UNIT_NAME",
ui."USE_UNIT_CREDIT_CODE", ui."USE_UNIT_CREDIT_CODE",
(select unit_type from tz_base_enterprise_info where use_unit_code = ui."USE_UNIT_CREDIT_CODE") unitType, (select unit_type from tz_base_enterprise_info where use_unit_code = ui."USE_UNIT_CREDIT_CODE") unitType,
...@@ -1068,28 +1069,31 @@ ...@@ -1068,28 +1069,31 @@
si."ORG_BRANCH_CODE", si."ORG_BRANCH_CODE",
si."COMPANY_ORG_BRANCH_CODE" si."COMPANY_ORG_BRANCH_CODE"
FROM FROM
( idx_biz_jg_use_info ui
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD"
LEFT JOIN (
SELECT SELECT
"RECORD","INFORM_END","ROWNUM1" "RECORD","INFORM_END","ROWNUM1"
FROM FROM
( (
SELECT "RECORD","INFORM_END",ROW_NUMBER() OVER (PARTITION BY "RECORD" ORDER BY "REC_DATE" DESC) AS ROWNUM1 SELECT "RECORD","INFORM_END",ROW_NUMBER() OVER (PARTITION BY "RECORD" ORDER BY "REC_DATE" DESC) AS ROWNUM1
FROM FROM
idx_biz_jg_maintenance_record_info idx_biz_jg_maintenance_record_info where "INFORM_END" is not null
) d ) d
WHERE d."ROWNUM1" = 1 and d."INFORM_END" <![CDATA[<]]> to_char(now(), 'YYYY-MM-DD') WHERE d."ROWNUM1" = 1 and d."INFORM_END" <![CDATA[<]]> to_char(now(), 'YYYY-MM-DD')
) tt ) tt on tt."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_use_info ui ON ui."RECORD" = tt."RECORD" WHERE si."ORG_BRANCH_CODE" like '50%'
LEFT JOIN idx_biz_jg_register_info ri ON ri."RECORD" = tt."RECORD" and oi."CLAIM_STATUS" not in ('草稿','已拒领','待认领')
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = tt."RECORD" and tt."INFORM_END" is not null
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = tt."RECORD"
WHERE ui."DATA_SOURCE" like 'jg%' and ui.IS_INTO_MANAGEMENT = true
</select> </select>
<select id="queryOutOfInspectionRecord" resultType="java.util.Map"> <select id="queryOutOfInspectionRecord" resultType="java.util.Map">
SELECT SELECT
tt."RECORD", ui."RECORD",
tt."NEXT_INSPECT_DATE", tt."NEXT_INSPECT_DATE",
tt."NEXT_INSPECT_DATE" as problemTime,
ui."USE_UNIT_NAME", ui."USE_UNIT_NAME",
ui."USE_UNIT_CREDIT_CODE", ui."USE_UNIT_CREDIT_CODE",
(select unit_type from tz_base_enterprise_info where use_unit_code = ui."USE_UNIT_CREDIT_CODE") unitType, (select unit_type from tz_base_enterprise_info where use_unit_code = ui."USE_UNIT_CREDIT_CODE") unitType,
...@@ -1103,21 +1107,23 @@ ...@@ -1103,21 +1107,23 @@
si."ORG_BRANCH_CODE", si."ORG_BRANCH_CODE",
si."COMPANY_ORG_BRANCH_CODE" si."COMPANY_ORG_BRANCH_CODE"
FROM FROM
( idx_biz_jg_use_info ui
SELECT "RECORD","NEXT_INSPECT_DATE","rowNum1" LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD"
LEFT JOIN (
SELECT "RECORD","NEXT_INSPECT_DATE",rowNum1
FROM FROM
( (
SELECT ROW_NUMBER () OVER ( PARTITION BY "RECORD" ORDER BY "REC_DATE" DESC) AS rowNum1,"RECORD", "NEXT_INSPECT_DATE" SELECT ROW_NUMBER () OVER ( PARTITION BY "RECORD" ORDER BY "NEXT_INSPECT_DATE" DESC) AS rowNum1,"RECORD", "NEXT_INSPECT_DATE"
FROM FROM
idx_biz_jg_inspection_detection_info idx_biz_jg_inspection_detection_info where "NEXT_INSPECT_DATE" is not null
) d ) d
WHERE d.rowNum1 = 1 and d."NEXT_INSPECT_DATE" <![CDATA[<]]> to_char(now(), 'YYYY-MM-DD') WHERE d.rowNum1 =1 and d."NEXT_INSPECT_DATE" <![CDATA[<]]> to_char(now(), 'YYYY-MM-DD')
) tt ) tt on tt."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_use_info ui ON ui."RECORD" = tt."RECORD" WHERE si."ORG_BRANCH_CODE" like '50%'
LEFT JOIN idx_biz_jg_register_info ri ON ri."RECORD" = tt."RECORD" AND oi."CLAIM_STATUS" not in ('草稿','已拒领','待认领')
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = tt."RECORD" AND tt."NEXT_INSPECT_DATE" is not null
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = tt."RECORD"
WHERE ui."DATA_SOURCE" like 'jg%' and ui.IS_INTO_MANAGEMENT = true
</select> </select>
<select id="countBizFinishedNumForDP" resultType="java.lang.Long"> <select id="countBizFinishedNumForDP" resultType="java.lang.Long">
SELECT count(1) FROM "tzs_jg_installation_notice" where receive_company_org_code like CONCAT(#{orgCode}, '%') and notice_status = '6616' SELECT count(1) FROM "tzs_jg_installation_notice" where receive_company_org_code like CONCAT(#{orgCode}, '%') and notice_status = '6616'
...@@ -2641,6 +2647,7 @@ ...@@ -2641,6 +2647,7 @@
ul.sequence_nbr problemSourceId, ul.sequence_nbr problemSourceId,
ul.cert_no certNo, ul.cert_no certNo,
ul.expiry_date expiryDate, ul.expiry_date expiryDate,
ul.expiry_date as problemTime,
ul.item_code itemCode, ul.item_code itemCode,
ul.item_code_name itemName, ul.item_code_name itemName,
ul.sub_item_code subItemCode, ul.sub_item_code subItemCode,
...@@ -2706,6 +2713,7 @@ ...@@ -2706,6 +2713,7 @@
tup.sequence_nbr problemSourceId, tup.sequence_nbr problemSourceId,
tup.cert_no certNo, tup.cert_no certNo,
tup.expiry_date expiryDate, tup.expiry_date expiryDate,
tup.expiry_date as problemTime,
tui.name userName, tui.name userName,
tui.sequence_nbr userSeq tui.sequence_nbr userSeq
FROM FROM
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
and spt.principal_unit like CONCAT('%', #{problemModel.principalUnit}, '%') and spt.principal_unit like CONCAT('%', #{problemModel.principalUnit}, '%')
</if> </if>
<if test="problemModel.principalUnitType != null and problemModel.principalUnitType != ''"> <if test="problemModel.principalUnitType != null and problemModel.principalUnitType != ''">
and spt.principal_unit_type = like CONCAT('%', #{problemModel.principalUnitType}, '%') and spt.principal_unit_type like CONCAT('%', #{problemModel.principalUnitType}, '%')
</if> </if>
<if test="problemModel.hiddenDangersLevel != null and problemModel.hiddenDangersLevel != ''"> <if test="problemModel.hiddenDangersLevel != null and problemModel.hiddenDangersLevel != ''">
and spt.problem_status_code = #{problemModel.hiddenDangersLevel} and spt.problem_status_code = #{problemModel.hiddenDangersLevel}
...@@ -207,6 +207,7 @@ ...@@ -207,6 +207,7 @@
tzs_safety_problem_tracing tzs_safety_problem_tracing
WHERE WHERE
is_delete = '0' is_delete = '0'
and problem_status_code = '0'
<if test="orgCode != null and orgCode != ''"> <if test="orgCode != null and orgCode != ''">
and governing_body_org_code like CONCAT(#{orgCode}, '%') and governing_body_org_code like CONCAT(#{orgCode}, '%')
</if> </if>
......
...@@ -262,6 +262,15 @@ public class DataHandlerController extends BaseController { ...@@ -262,6 +262,15 @@ public class DataHandlerController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "压力管道长度刷入es", notes = "压力管道长度刷入es")
@PutMapping(value = "/equip/addPipeLength2Es")
public ResponseModel<Object> addPipeLength2Es() {
dataHandlerService.addPipeLength2Es();
return ResponseHelper.buildResponse(true);
}
/** /**
* @apiNote 场车车牌号刷入ES * @apiNote 场车车牌号刷入ES
* *
......
...@@ -5,9 +5,9 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,9 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity; import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant; import com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta; import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.EsUpdateService; import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.EsUpdateService;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler; import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy; import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy;
...@@ -15,10 +15,20 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleRes ...@@ -15,10 +15,20 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleRes
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy; import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -28,6 +38,7 @@ import java.util.Map; ...@@ -28,6 +38,7 @@ import java.util.Map;
*/ */
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j
public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy { public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy {
...@@ -35,6 +46,8 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -35,6 +46,8 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
private final EsUpdateService esUpdateService; private final EsUpdateService esUpdateService;
private final RestHighLevelClient restHighLevelClient;
@Override @Override
public HandleResult handle(Map<String, Object> changeData, String record) { public HandleResult handle(Map<String, Object> changeData, String record) {
...@@ -193,13 +206,48 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -193,13 +206,48 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
} }
private void setNameByCode2SupervisionInfo(IdxBizJgSupervisionInfo idxBizJgSupervisionInfo) { private void setNameByCode2SupervisionInfo(IdxBizJgSupervisionInfo idxBizJgSupervisionInfo) {
String orgCode = idxBizJgSupervisionInfo.getOrgBranchCode();
// 按照org_code查询 // 按照org_code查询
if (StringUtils.isNotEmpty(idxBizJgSupervisionInfo.getOrgBranchCode())) { if (StringUtils.isNotEmpty(orgCode)) {
CompanyBo companyBo = commonEquipDataProcessService.getCommonMapper().queryCompanyByOrgCode(idxBizJgSupervisionInfo.getOrgBranchCode()); // 特殊处理orgCode
idxBizJgSupervisionInfo.setOrgBranchCode(companyBo.getOrgCode()); orgCode = changeOrgBranchCode(idxBizJgSupervisionInfo.getRecord(), orgCode);
idxBizJgSupervisionInfo.setOrgBranchName(companyBo.getCompanyName()); if (!"50*X".equals(orgCode)) {
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(companyBo.getCompanyCode()); CompanyBo companyBo = commonEquipDataProcessService.getCommonMapper().queryCompanyByOrgCode(orgCode);
idxBizJgSupervisionInfo.setOrgBranchCode(companyBo.getOrgCode());
idxBizJgSupervisionInfo.setOrgBranchName(companyBo.getCompanyName());
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(companyBo.getCompanyCode());
} else {
log.info(String.format("设备编辑未从es中查询到正确的orgCode,record为:%s", idxBizJgSupervisionInfo.getRecord()));
}
}
}
private String changeOrgBranchCode(String record, String orgCode) {
if (!"50*X".equals(orgCode)) {
return orgCode;
} else {
// 查询es
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
boolMust.must(QueryBuilders.termsQuery("SEQUENCE_NBR.keyword", record));
builder.query(boolMust);
request.source(builder);
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
if (response.getHits().getHits().length != 0) {
for (SearchHit hit : response.getHits().getHits()) {
JSONObject jsonObject = ((JSONObject) JSONObject.toJSON(hit)).getJSONObject("sourceAsMap");
return jsonObject.getString("ORG_BRANCH_CODE");
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
} }
return orgCode;
} }
......
...@@ -78,34 +78,45 @@ public class SafetyProblemTopicMessage extends EmqxListener { ...@@ -78,34 +78,45 @@ public class SafetyProblemTopicMessage extends EmqxListener {
emqKeeper.subscript(buildTopic(problemEventTopic), 2, this); emqKeeper.subscript(buildTopic(problemEventTopic), 2, this);
executorService = Executors.newFixedThreadPool(threadNumber); executorService = Executors.newFixedThreadPool(threadNumber);
for (int i = 0; i < threadNumber; i++) { for (int i = 0; i < threadNumber; i++) {
final int threadIndex = i;
executorService.execute(() -> { executorService.execute(() -> {
try { try {
log.info("启动消息处理线程-{}", threadIndex);
while (!Thread.currentThread().isInterrupted()) { while (!Thread.currentThread().isInterrupted()) {
SafetyProblemEvent safetyProblemMessageEvent = blockingQueue.take(); SafetyProblemEvent safetyProblemMessageEvent = blockingQueue.take();
try { try {
// 计算耗时开始
long start = System.currentTimeMillis();
log.info("接收到问题生产原始消息:{}", safetyProblemMessageEvent.getMessage()); log.info("接收到问题生产原始消息:{}", safetyProblemMessageEvent.getMessage());
JSONArray jsonObject = JSON.parseArray(safetyProblemMessageEvent.getMessage().toString()); JSONArray jsonObject = JSON.parseArray(safetyProblemMessageEvent.getMessage().toString());
log.info("接收到问题生产消息:{}", jsonObject); log.info("接收到问题生产消息:{}", jsonObject);
SafetyProblemEventHandler eventHandler = SafetyProblemEventHandlerFactory.createProblemHandler(safetyProblemMessageEvent.getTopic()); SafetyProblemEventHandler eventHandler = SafetyProblemEventHandlerFactory.createProblemHandler(safetyProblemMessageEvent.getTopic());
eventHandler.handle(safetyProblemMessageEvent); eventHandler.handle(safetyProblemMessageEvent);
log.info("处理问题生产消息完成"); log.info("处理问题生产消息完成,耗时:{}", System.currentTimeMillis() - start);
} catch (JSONException | ClassCastException | IllegalArgumentException e) { } catch (JSONException | ClassCastException | IllegalArgumentException e) {
log.error("处理消息异常", e); log.error("处理消息异常", e);
} catch (Exception e) {
log.error("处理消息时发生未预期异常", e);
} }
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
log.error("处理线程被中断,准备退出", e); log.warn("处理线程{}被中断,准备退出", threadIndex);
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (Exception e) {
log.error("处理线程{}发生异常,准备退出", threadIndex, e);
} finally {
log.info("消息处理线程-{}退出", threadIndex);
} }
}); });
} }
log.info("消息监听器初始化完成,线程数:{}", threadNumber);
} }
@Override @Override
public void processMessage(String topic, MqttMessage message) { public void processMessage(String topic, MqttMessage message) {
log.info("接收问题生产消息开始"); log.info("接收问题生产消息开始,当前队列大小:{}", blockingQueue.size());
blockingQueue.add(new SafetyProblemEvent(topic, message)); blockingQueue.add(new SafetyProblemEvent(topic, message));
log.info("接收问题生产消息完成"); log.info("接收问题生产消息完成,添加后队列大小:{}", blockingQueue.size());
} }
public static void generateProblem(JSONArray jsonArray, SafetyProblemTypeEnum problemTypeEnum, SafetyProblemTracingServiceImpl safetyProblemTracingService) { public static void generateProblem(JSONArray jsonArray, SafetyProblemTypeEnum problemTypeEnum, SafetyProblemTracingServiceImpl safetyProblemTracingService) {
...@@ -129,7 +140,7 @@ public class SafetyProblemTopicMessage extends EmqxListener { ...@@ -129,7 +140,7 @@ public class SafetyProblemTopicMessage extends EmqxListener {
safetyProblemTracing.setSourceType(SafetyProblemSourceTypeEnum.EQUIP.getName()); safetyProblemTracing.setSourceType(SafetyProblemSourceTypeEnum.EQUIP.getName());
safetyProblemTracing.setSourceTypeCode(SafetyProblemSourceTypeEnum.EQUIP.getCode()); safetyProblemTracing.setSourceTypeCode(SafetyProblemSourceTypeEnum.EQUIP.getCode());
safetyProblemTracing.setSourceId(json.getOrDefault("RECORD", "").toString()); safetyProblemTracing.setSourceId(json.getOrDefault("RECORD", "").toString());
safetyProblemTracing.setProblemTime(ValidationUtil.isEmpty(json.getString("expiryDate")) ? new Date() : json.getDate("expiryDate")); safetyProblemTracing.setProblemTime(getProblemTime(json));
safetyProblemTracing.setEquipSuperviseCode(json.getOrDefault("SUPERVISORY_CODE", "").toString()); safetyProblemTracing.setEquipSuperviseCode(json.getOrDefault("SUPERVISORY_CODE", "").toString());
safetyProblemTracing.setEquipList(json.getOrDefault("equList", "").toString()); safetyProblemTracing.setEquipList(json.getOrDefault("equList", "").toString());
safetyProblemTracing.setEquipListCode(json.getOrDefault("EQU_LIST", "").toString()); safetyProblemTracing.setEquipListCode(json.getOrDefault("EQU_LIST", "").toString());
...@@ -157,6 +168,24 @@ public class SafetyProblemTopicMessage extends EmqxListener { ...@@ -157,6 +168,24 @@ public class SafetyProblemTopicMessage extends EmqxListener {
} }
} }
public static Date getProblemTime(JSONObject json) {
// 安全处理problemTime字段,支持时间戳转换
Object problemTimeObj = json.getOrDefault("problemTime", "");
Date problemTime = null;
if (problemTimeObj instanceof Long) {
problemTime = new Date((Long) problemTimeObj);
} else if (problemTimeObj instanceof String && !((String) problemTimeObj).isEmpty()) {
try {
problemTime = new Date(Long.parseLong((String) problemTimeObj));
} catch (NumberFormatException e) {
log.warn("无法解析problemTime: {}", problemTimeObj);
}
} else if (problemTimeObj instanceof Date) {
problemTime = (Date) problemTimeObj;
}
return problemTime;
}
public static void generateUnitProblem(JSONArray jsonArray, SafetyProblemTypeEnum problemTypeEnum, SafetyProblemTracingServiceImpl safetyProblemTracingService) { public static void generateUnitProblem(JSONArray jsonArray, SafetyProblemTypeEnum problemTypeEnum, SafetyProblemTracingServiceImpl safetyProblemTracingService) {
generateProblem2(jsonArray, problemTypeEnum, safetyProblemTracingService); generateProblem2(jsonArray, problemTypeEnum, safetyProblemTracingService);
} }
......
...@@ -20,10 +20,12 @@ import lombok.RequiredArgsConstructor; ...@@ -20,10 +20,12 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
...@@ -67,6 +69,13 @@ public class EquipmentRefreshHandler implements IDataRefreshHandler { ...@@ -67,6 +69,13 @@ public class EquipmentRefreshHandler implements IDataRefreshHandler {
esEquipmentInfo.setInspections(BeanUtil.copyToList(inspectionDetectionInfos, ESEquipmentInfo.Inspection.class)); esEquipmentInfo.setInspections(BeanUtil.copyToList(inspectionDetectionInfos, ESEquipmentInfo.Inspection.class));
esEquipmentInfo.setMaintenances(lastMaintenanceRecordInfo.getSequenceNbr() != null ? Collections.singletonList(BeanUtil.copyProperties(lastMaintenanceRecordInfo, ESEquipmentInfo.Maintenance.class)) : new ArrayList<>()); esEquipmentInfo.setMaintenances(lastMaintenanceRecordInfo.getSequenceNbr() != null ? Collections.singletonList(BeanUtil.copyProperties(lastMaintenanceRecordInfo, ESEquipmentInfo.Maintenance.class)) : new ArrayList<>());
esEquipmentInfo.setTechParams(this.buildTechParamByEquList(record, esEquipmentInfo.getEQU_LIST_CODE())); esEquipmentInfo.setTechParams(this.buildTechParamByEquList(record, esEquipmentInfo.getEQU_LIST_CODE()));
if ("8000".equals(esEquipmentInfo.getEQU_LIST_CODE())) {
List<ESEquipmentInfo.TechParam> techParams = esEquipmentInfo.getTechParams();
List<ESEquipmentInfo.TechParam> pipeLength = techParams.stream().filter(e -> e.getParamKey().equals("pipeLength") && e.getDoubleValue() != null).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(pipeLength)) {
esEquipmentInfo.setPipeLength(pipeLength.get(0).getDoubleValue());
}
}
esEquipmentDao.save(esEquipmentInfo); esEquipmentDao.save(esEquipmentInfo);
break; break;
default: default:
......
...@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl; ...@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -27,7 +26,6 @@ import org.springframework.stereotype.Service; ...@@ -27,7 +26,6 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.nio.charset.StandardCharsets;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -84,16 +82,33 @@ public class SafetyProblemTracingGenServiceImpl{ ...@@ -84,16 +82,33 @@ public class SafetyProblemTracingGenServiceImpl{
public void executeInspectionCheck() { public void executeInspectionCheck() {
logger.info("开始检验检测超期检查"); logger.info("开始检验检测超期检查");
Set<String> outOfInspectionEquipIds = safetyProblemTracingService.getBaseMapper().selectList(new LambdaQueryWrapper<SafetyProblemTracing>()
.select(SafetyProblemTracing::getSourceId)
.eq(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.UNHANDLED.getCode())
.eq(SafetyProblemTracing::getProblemTypeCode, SafetyProblemTypeEnum.JYCQ.getProblemTypeCode()))
.stream().map(SafetyProblemTracing::getSourceId).collect(Collectors.toSet());
// 查询当天检验超期的设备 // 查询当天检验超期的设备
List<Map<String, Object>> outOfInspectionRecords = commonMapper.queryOutOfInspectionRecord(); List<Map<String, Object>> outOfInspectionRecords = commonMapper.queryOutOfInspectionRecord();
// 追溯表里未处理的检验超期设备需要排除在外
outOfInspectionRecords.removeIf(item -> outOfInspectionEquipIds.contains(String.valueOf(item.get("RECORD"))));
updateEquipAndSendMessage(outOfInspectionRecords, SafetyProblemTypeEnum.JYCQ); updateEquipAndSendMessage(outOfInspectionRecords, SafetyProblemTypeEnum.JYCQ);
logger.info("检验检测超期检查结束"); logger.info("检验检测超期检查结束");
} }
public void executeMaintenanceCheck() { public void executeMaintenanceCheck() {
logger.info("开始维保超期检查"); logger.info("开始维保超期检查");
Set<String> outOfMaintenanceEquipIds = safetyProblemTracingService.getBaseMapper().selectList(new LambdaQueryWrapper<SafetyProblemTracing>()
.select(SafetyProblemTracing::getSourceId)
.eq(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.UNHANDLED.getCode())
.eq(SafetyProblemTracing::getProblemTypeCode, SafetyProblemTypeEnum.WBCQ.getProblemTypeCode()))
.stream().map(SafetyProblemTracing::getSourceId).collect(Collectors.toSet());
// 查询当天维保超期的设备 // 查询当天维保超期的设备
List<Map<String, Object>> outOfMaintenanceRecords = commonMapper.queryOutOfMaintenanceRecord(); List<Map<String, Object>> outOfMaintenanceRecords = commonMapper.queryOutOfMaintenanceRecord();
// 追溯表里未处理的维保超期设备需要排除在外
outOfMaintenanceRecords.removeIf(item -> outOfMaintenanceEquipIds.contains(String.valueOf(item.get("RECORD"))));
updateEquipAndSendMessage(outOfMaintenanceRecords, SafetyProblemTypeEnum.WBCQ); updateEquipAndSendMessage(outOfMaintenanceRecords, SafetyProblemTypeEnum.WBCQ);
logger.info("维保超期检查结束"); logger.info("维保超期检查结束");
} }
...@@ -145,18 +160,24 @@ public class SafetyProblemTracingGenServiceImpl{ ...@@ -145,18 +160,24 @@ public class SafetyProblemTracingGenServiceImpl{
return; return;
} }
List<String> records = mapList.stream().map(m -> m.get("RECORD").toString()).collect(Collectors.toList()); List<String> records = mapList.stream().map(m -> m.get("RECORD").toString()).collect(Collectors.toList());
// 更新设备状态为未处理(异常) int batchSize = 1000;
idxBizJgOtherInfoService.lambdaUpdate() for (int i = 0; i < records.size(); i += batchSize) {
.in(IdxBizJgOtherInfo::getRecord, records) List<String> batch = records.subList(i, Math.min(i + batchSize, records.size()));
.set(IdxBizJgOtherInfo::getStatus, SafetyProblemStatusEnum.UNHANDLED.getCode()) // 更新设备状态为未处理(异常)
.update(); idxBizJgOtherInfoService.lambdaUpdate()
List<ESEquipmentCategoryDto> esEquipmentCategoryDto = Lists.newArrayList(); .in(IdxBizJgOtherInfo::getRecord, batch)
for (ESEquipmentCategoryDto equipmentCategoryDto : esEquipmentCategory.findAllById(records)) { .set(IdxBizJgOtherInfo::getStatus, SafetyProblemStatusEnum.UNHANDLED.getCode())
equipmentCategoryDto.setProblemStatus(SafetyProblemStatusEnum.UNHANDLED.getCode()); .update();
esEquipmentCategoryDto.add(equipmentCategoryDto); List<ESEquipmentCategoryDto> esEquipmentCategoryDto = Lists.newArrayList();
for (ESEquipmentCategoryDto equipmentCategoryDto : esEquipmentCategory.findAllById(batch)) {
equipmentCategoryDto.setProblemStatus(SafetyProblemStatusEnum.UNHANDLED.getCode());
esEquipmentCategoryDto.add(equipmentCategoryDto);
}
esEquipmentCategory.saveAll(esEquipmentCategoryDto);
// mapList也根据batch分割
List<Map<String, Object>> mapListBatch = mapList.subList(i, Math.min(i + batchSize, mapList.size()));
sendSafetyProblemMessage(mapListBatch, safetyProblemTypeEnum);
} }
esEquipmentCategory.saveAll(esEquipmentCategoryDto);
sendSafetyProblemMessage(mapList, safetyProblemTypeEnum);
} }
private void updateEnterpriseAndSendMessage(List<Map<String, Object>> mapList) { private void updateEnterpriseAndSendMessage(List<Map<String, Object>> mapList) {
...@@ -193,11 +214,12 @@ public class SafetyProblemTracingGenServiceImpl{ ...@@ -193,11 +214,12 @@ public class SafetyProblemTracingGenServiceImpl{
* @param safetyProblemTypeEnum * @param safetyProblemTypeEnum
*/ */
private void sendSafetyProblemMessage(List<Map<String, Object>> mapList, SafetyProblemTypeEnum safetyProblemTypeEnum) { private void sendSafetyProblemMessage(List<Map<String, Object>> mapList, SafetyProblemTypeEnum safetyProblemTypeEnum) {
JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(mapList)); if (CollectionUtil.isNotEmpty(mapList)){
if (CollectionUtil.isNotEmpty(jsonArray)){
try { try {
logger.info("发送安全追溯问题主题---->{}", safetyProblemTypeEnum.getTopic()); logger.info("发送安全追溯问题主题---->{}", safetyProblemTypeEnum.getTopic());
emqKeeper.getMqttClient().publish(safetyProblemTypeEnum.getTopic(), jsonArray.toString().getBytes(StandardCharsets.UTF_8), 2, false); byte[] payload = JSON.toJSONBytes(mapList);
logger.info("发送数据大小:{} KB", payload.length / 1024);
emqKeeper.getMqttClient().publish(safetyProblemTypeEnum.getTopic(), JSON.toJSONBytes(mapList), 2, false);
logger.info("发送安全追溯问题消息成功---->"); logger.info("发送安全追溯问题消息成功---->");
} catch (MqttException e) { } catch (MqttException e) {
logger.error("发送安全追溯问题设备信息消息失败---->{}", e.getMessage()); logger.error("发送安全追溯问题设备信息消息失败---->{}", e.getMessage());
......
...@@ -50,6 +50,7 @@ public class TzsUserInfo extends BaseEntity { ...@@ -50,6 +50,7 @@ public class TzsUserInfo extends BaseEntity {
* 岗位-保留兼容下游数据查询 * 岗位-保留兼容下游数据查询
*/ */
@TableField("post") @TableField("post")
@Deprecated
private String post; private String post;
/** /**
...@@ -200,5 +201,33 @@ public class TzsUserInfo extends BaseEntity { ...@@ -200,5 +201,33 @@ public class TzsUserInfo extends BaseEntity {
*/ */
@TableField("qr_code_state") @TableField("qr_code_state")
private String qrCodeState; private String qrCodeState;
/**
* 岗位子类型(多个逗号分割)
*/
@TableField(value = "sub_post", updateStrategy = FieldStrategy.IGNORED)
private String subPost;
/**
* 岗位子类型名称(多个逗号分割)
*/
@TableField(value = "sub_post_name", updateStrategy = FieldStrategy.IGNORED)
private String subPostName;
/**
* 人员转出标识(1:已转出,0:未转出,空值默认为未转出0)
*/
@TableField(value = "transfer_out")
protected String transferOut;
/**
* 人员转出时间
*/
@TableField(value = "transfer_out_time")
protected Date transferOutTime;
/**
* 创建时间
*/
@TableField(value = "create_date")
protected Date createDate;
} }
...@@ -5,6 +5,10 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,10 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter; import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
...@@ -13,17 +17,17 @@ public enum CompanyAdvanceSearchEnum { ...@@ -13,17 +17,17 @@ public enum CompanyAdvanceSearchEnum {
/** /**
* 高级搜索枚举 * 高级搜索枚举
*/ */
USEUNIT("企业名称", "useUnit", TechnicalParameter.ParamType.STRING,"",null,null), USEUNIT("企业名称", "useUnit", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Text),
ADDRESS("详细地址", "address", TechnicalParameter.ParamType.STRING,"",null,null), ADDRESS("详细地址", "address", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Text),
EXPIRYDATE("许可有效期", "expiryDate",TechnicalParameter.ParamType.DATE,"",null,null), EXPIRYDATE("许可有效期", "expiryDate", TechnicalParameter.ParamType.DATE, "", null, null, FieldType.Date),
UNIT_TYPE("企业类型", "unitType",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryUnitType",null,null), UNIT_TYPE("企业类型", "unitType", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryUnitType", null, null, FieldType.Text),
REGULATORY_LABELS("监管标签", "regulatoryLabels",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryDicData?type={type}","QYBQ",null), REGULATORY_LABELS("监管标签", "regulatoryLabels", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryDicData?type={type}", "QYBQ", null, FieldType.Text),
INDUSTRY_SUPERVISOR("行业主管部门", "industrySupervisor",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryDicData?type={type}","HYZGBM",null), INDUSTRY_SUPERVISOR("行业主管部门", "industrySupervisor", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryDicData?type={type}", "HYZGBM", null, FieldType.Text),
ITEM_CODE("许可项目", "itemCode",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryXK",null,null), ITEM_CODE("许可项目", "itemCode", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryXK", null, null, FieldType.Text),
SUB_ITEM_CODE("许可子项目", "subItemCode",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryXK?type={type}",null,"itemCode"), SUB_ITEM_CODE("许可子项目", "subItemCode", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryXK?type={type}", null, "itemCode", FieldType.Text),
OPERATING_STATUS("经营状态", "operatingStatus",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryDicDataNew?type={type}","jyzt",null), OPERATING_STATUS("经营状态", "operatingStatus", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryDicDataNew?type={type}", "jyzt", null, FieldType.Text),
EQUIP_CATEGORY("设备类型", "equipCategory",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryEquipList",null,null), EQUIP_CATEGORY("设备类型", "equipCategory", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryEquipList", null, null, FieldType.Text),
PERMIT_STATUS("许可状态", "permitStatus",null,"/statistics/comprehensiveStatisticalAnalysis/select/permitStatus",null,null), PERMIT_STATUS("许可状态", "permitStatus", null, "/statistics/comprehensiveStatisticalAnalysis/select/permitStatus", null, null, FieldType.Auto),
; ;
...@@ -33,8 +37,9 @@ public enum CompanyAdvanceSearchEnum { ...@@ -33,8 +37,9 @@ public enum CompanyAdvanceSearchEnum {
private String url; private String url;
private String dataKey; private String dataKey;
private String argKey; private String argKey;
private FieldType esType;
public static JSONArray getAll(){ public static JSONArray getAll() {
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
for (CompanyAdvanceSearchEnum item : values()) { for (CompanyAdvanceSearchEnum item : values()) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
...@@ -45,19 +50,28 @@ public enum CompanyAdvanceSearchEnum { ...@@ -45,19 +50,28 @@ public enum CompanyAdvanceSearchEnum {
jsonObject.put("argKey", item.argKey); jsonObject.put("argKey", item.argKey);
jsonObject.put("paramType", item.paramType); jsonObject.put("paramType", item.paramType);
jsonObject.put("isMulti", false); jsonObject.put("isMulti", false);
if(TechnicalParameter.ParamType.BIG_DECIMAL.equals(item.paramType)){ if (TechnicalParameter.ParamType.BIG_DECIMAL.equals(item.paramType)) {
jsonObject.put("type","inputNumber"); jsonObject.put("type", "inputNumber");
}else if(TechnicalParameter.ParamType.STRING.equals(item.paramType)){ } else if (TechnicalParameter.ParamType.STRING.equals(item.paramType)) {
jsonObject.put("type","input"); jsonObject.put("type", "input");
}else if(TechnicalParameter.ParamType.DATE.equals(item.paramType)){ } else if (TechnicalParameter.ParamType.DATE.equals(item.paramType)) {
jsonObject.put("type","date"); jsonObject.put("type", FieldType.Date);
}else { } else {
jsonObject.put("type","select"); jsonObject.put("type", "select");
} }
jsonObject.put("conditions",ConditionEnum.getByCode(item.paramType)); jsonObject.put("conditions", ConditionEnum.getByCode(item.paramType));
jsonObject.put("url", item.url); jsonObject.put("url", item.url);
jsonArray.add(jsonObject); jsonArray.add(jsonObject);
} }
return jsonArray; return jsonArray;
} }
public static Map<String, FieldType> getEsType = new HashMap<>();
static {
for (CompanyAdvanceSearchEnum e : CompanyAdvanceSearchEnum.values()) {
getEsType.put(e.code, e.esType);
}
}
} }
...@@ -28,7 +28,7 @@ public enum ConditionEnum { ...@@ -28,7 +28,7 @@ public enum ConditionEnum {
dateGe("大于等于", "ge", TechnicalParameter.ParamType.DATE), dateGe("大于等于", "ge", TechnicalParameter.ParamType.DATE),
dateLe("小于等于", "le", TechnicalParameter.ParamType.DATE), dateLe("小于等于", "le", TechnicalParameter.ParamType.DATE),
in("包含","in", null), in("包含","in", null),
notin("不包含","notin", null), notIn("不包含","notIn", null),
eq("等于","eq", null), eq("等于","eq", null),
; ;
......
...@@ -39,13 +39,13 @@ public enum EquipStateEnum { ...@@ -39,13 +39,13 @@ public enum EquipStateEnum {
} }
} }
public static JSONArray getAll(){ public static JSONArray getAll() {
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
for (EquipStateEnum e : EquipStateEnum.values()) { for (EquipStateEnum e : EquipStateEnum.values()) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("label",e.name); jsonObject.put("label", e.name);
jsonObject.put("value",e.name); jsonObject.put("value", e.code);
jsonObject.put("key",e.code); jsonObject.put("key", e.code);
jsonArray.add(jsonObject); jsonArray.add(jsonObject);
} }
return jsonArray; return jsonArray;
...@@ -53,7 +53,7 @@ public enum EquipStateEnum { ...@@ -53,7 +53,7 @@ public enum EquipStateEnum {
public static String getNameByCode(String code) { public static String getNameByCode(String code) {
for (EquipStateEnum e : EnumSet.allOf(EquipStateEnum.class)) { for (EquipStateEnum e : EnumSet.allOf(EquipStateEnum.class)) {
if(e.getCode().equals(code)){ if (e.getCode().equals(code)) {
return e.getName(); return e.getName();
} }
} }
......
...@@ -5,6 +5,10 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,10 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter; import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
...@@ -13,21 +17,21 @@ public enum PersonAdvanceSearchEnum { ...@@ -13,21 +17,21 @@ public enum PersonAdvanceSearchEnum {
/** /**
* 高级搜索枚举 * 高级搜索枚举
*/ */
NAME("人员名称", "name", TechnicalParameter.ParamType.STRING,"",null,null), NAME("姓名", "name", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Text),
NEWPOST("人员类型", "newPost",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryRYLX",null,null), NEWPOST("人员类型", "newPost", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryRYLX", null, null, FieldType.Keyword),
SUBPOST("人员子类型", "subPost",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryRYLX?type={type}",null,"newPost"), SUBPOST("子类型", "subPost", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryRYLX?type={type}", null, "newPost", FieldType.Keyword),
CERT_NO("有无资质", "certNo",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryCertNo",null,null), CERT_NO("有无资质", "certNo", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryCertNo", null, null, FieldType.Keyword),
EXPIRY_DATE("资质状态", "expiryDate",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryExpiryDate",null,null), EXPIRY_DATE("资质状态", "expiryDate", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryExpiryDate", null, null, FieldType.Date),
CERT_TYPE("证书类型", "certType",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryCertType",null,null), CERT_TYPE("证书类型", "certType", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryCertType", null, null, FieldType.Keyword),
PERMISSION_LEVEL("证书级别", "permissionLevel",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryPermissionLevel",null,null), PERMISSION_LEVEL("证书级别", "permissionLevel", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryPermissionLevel", null, null, FieldType.Keyword),
JOB_ITEM("作业项目", "jobItem",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryZYXM?type={type}",null,"certType"), JOB_ITEM("作业项目", "jobItem", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryZYXM?type={type}", null, "certType", FieldType.Keyword),
PERMISSION_ITEM("项目", "permissionItem",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryZYXM?type={type}",null,"permissionLevel"), PERMISSION_ITEM("项目", "permissionItem", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryZYXM?type={type}", null, "permissionLevel", FieldType.Keyword),
ISSUE_DATE("发证日期", "issueDate",TechnicalParameter.ParamType.DATE,"",null,null), ISSUE_DATE("发证日期", "issueDate", TechnicalParameter.ParamType.DATE, "", null, null, FieldType.Date),
EDUCATION("学历", "education",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryDicData","QYRYXL",null), EDUCATION("学历", "education", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryDicData?type={type}", "QYRYXL", null, FieldType.Keyword),
ADDRESS("住址", "address",TechnicalParameter.ParamType.STRING,"",null,null), ADDRESS("住址", "address", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Keyword),
UNITCODE("所属企业", "unitCode", TechnicalParameter.ParamType.STRING,"",null,null), UNITCODE("所属单位", "unitName", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Keyword),
SUPERVISEORGCODE("管辖机构", "superviseOrgCode",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryUnitByOrgCode?type={type}",null,"orgTreeId"), SUPERVISEORGCODE("管辖机构", "superviseOrgCode", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryUnitByOrgCode?type={type}", null, "orgTreeId", FieldType.Keyword),
EQUIP_TYPE("设备类型", "equipType",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryEquipList",null,null), EQUIP_TYPE("设备类型", "equipType", null, "/statistics/comprehensiveStatisticalAnalysis/select/queryEquipList", null, null, FieldType.Keyword),
; ;
...@@ -37,8 +41,9 @@ public enum PersonAdvanceSearchEnum { ...@@ -37,8 +41,9 @@ public enum PersonAdvanceSearchEnum {
private String url; private String url;
private String dataKey; private String dataKey;
private String argKey; private String argKey;
private FieldType esType;
public static JSONArray getAll(){ public static JSONArray getAll() {
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
for (PersonAdvanceSearchEnum item : values()) { for (PersonAdvanceSearchEnum item : values()) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
...@@ -49,19 +54,27 @@ public enum PersonAdvanceSearchEnum { ...@@ -49,19 +54,27 @@ public enum PersonAdvanceSearchEnum {
jsonObject.put("argKey", item.argKey); jsonObject.put("argKey", item.argKey);
jsonObject.put("paramType", item.paramType); jsonObject.put("paramType", item.paramType);
jsonObject.put("isMulti", false); jsonObject.put("isMulti", false);
if(TechnicalParameter.ParamType.BIG_DECIMAL.equals(item.paramType)){ if (TechnicalParameter.ParamType.BIG_DECIMAL.equals(item.paramType)) {
jsonObject.put("type","inputNumber"); jsonObject.put("type", "inputNumber");
}else if(TechnicalParameter.ParamType.STRING.equals(item.paramType)){ } else if (TechnicalParameter.ParamType.STRING.equals(item.paramType)) {
jsonObject.put("type","input"); jsonObject.put("type", "input");
}else if(TechnicalParameter.ParamType.DATE.equals(item.paramType)){ } else if (TechnicalParameter.ParamType.DATE.equals(item.paramType)) {
jsonObject.put("type","date"); jsonObject.put("type", "date");
}else { } else {
jsonObject.put("type","select"); jsonObject.put("type", "select");
} }
jsonObject.put("conditions",ConditionEnum.getByCode(item.paramType)); jsonObject.put("conditions", ConditionEnum.getByCode(item.paramType));
jsonObject.put("url", item.url); jsonObject.put("url", item.url);
jsonArray.add(jsonObject); jsonArray.add(jsonObject);
} }
return jsonArray; return jsonArray;
} }
public static Map<String, FieldType> getEsType = new HashMap<>();
static {
for (PersonAdvanceSearchEnum e : PersonAdvanceSearchEnum.values()) {
getEsType.put(e.code, e.esType);
}
}
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.statistics.api.mapper; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.statistics.api.mapper;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.statistics.api.entity.TzsCustomFilter; import com.yeejoin.amos.boot.module.statistics.api.entity.TzsCustomFilter;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -19,8 +20,12 @@ public interface TzsCustomFilterMapper extends BaseMapper<TzsCustomFilter> { ...@@ -19,8 +20,12 @@ public interface TzsCustomFilterMapper extends BaseMapper<TzsCustomFilter> {
@MapKey("key") @MapKey("key")
List<Map<String, Object>> selectEquipmentCategoryByParentId(@Param("parentId") String parentId); List<Map<String, Object>> selectEquipmentCategoryByParentId(@Param("parentId") String parentId);
List<String> getEquipmentSubCategoryByCode(@Param("code") String code);
Integer selectEquipmentCategoryCountByParentId(@Param("parentId") String parentId); Integer selectEquipmentCategoryCountByParentId(@Param("parentId") String parentId);
JSONArray queryEquCategory(@Param("type") String type, @Param("description") String description); JSONArray queryEquCategory(@Param("type") String type, @Param("description") String description);
Page<String> selectRecords(Page<String> page);
void addGas(@Param("refreshRecords")List<String> refreshRecords);
} }
...@@ -41,6 +41,7 @@ public class TzsUserInfoVo { ...@@ -41,6 +41,7 @@ public class TzsUserInfoVo {
* 岗位 * 岗位
*/ */
@TableField("post") @TableField("post")
@Deprecated
private JSONArray post; private JSONArray post;
/** /**
...@@ -66,12 +67,21 @@ public class TzsUserInfoVo { ...@@ -66,12 +67,21 @@ public class TzsUserInfoVo {
*/ */
@TableField("education") @TableField("education")
private String education; private String education;
/**
* 学历
*/
@TableField("education_required")
private String education_required;
/** /**
* 专业 * 专业
*/ */
@TableField("speciality") @TableField("speciality")
private String speciality; private String speciality;
/**
* 专业
*/
@TableField("speciality_required")
private String speciality_required;
/** /**
* 邮箱 * 邮箱
...@@ -155,6 +165,27 @@ public class TzsUserInfoVo { ...@@ -155,6 +165,27 @@ public class TzsUserInfoVo {
/** /**
* 职称 * 职称
*/ */
@TableField("job_title")
private String jobTitle; private String jobTitle;
/**
* 职称
*/
@TableField("job_title_required")
private String jobTitle_required;
@ApiModelProperty(value = "人员类型名称")
private String postName;
@ApiModelProperty("岗位子类型(多个逗号分割)")
private JSONArray subPost;
@ApiModelProperty("岗位子类型名称(多个逗号分割)")
private String subPostName;
@ApiModelProperty(value = "执业注册")
private List practiceRegistration;
@ApiModelProperty(value = "劳动合同")
private List laborContract;
} }
...@@ -381,18 +381,29 @@ ...@@ -381,18 +381,29 @@
) )
</select> </select>
<select id="over15yearsCount" resultType="java.lang.Long"> <select id="over15yearsCount" resultType="java.lang.Long">
SELECT <!-- SELECT-->
count(1) <!-- count(1)-->
FROM <!-- FROM-->
tzs_jg_use_registration thur <!-- tzs_jg_use_registration thur-->
LEFT JOIN tzs_jg_use_registration_eq thure ON thure.equip_transfer_id = thur.sequence_nbr <!-- LEFT JOIN tzs_jg_use_registration_eq thure ON thure.equip_transfer_id = thur.sequence_nbr-->
LEFT JOIN idx_biz_jg_register_info ibjri ON ibjri."RECORD" = thure.equ_id <!-- LEFT JOIN idx_biz_jg_register_info ibjri ON ibjri."RECORD" = thure.equ_id-->
WHERE <!-- WHERE-->
thur.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' ) <!-- thur.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' )-->
AND thur.audit_pass_date &lt; #{time} <!-- AND thur.audit_pass_date &lt; #{time}-->
AND ibjri."EQU_LIST" = '3000' <!-- AND ibjri."EQU_LIST" = '3000'-->
AND thur.is_delete = 0 <!-- AND thur.is_delete = 0-->
</select> <![CDATA[SELECT count(1)
FROM idx_biz_jg_use_info ui
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_register_info ri ON ri."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = ui."RECORD"
WHERE ri.EQU_LIST='3000'
AND USE_DATE!='null'
AND USE_DATE ~ '^\d{4}-\d{2}-\d{2}$'
AND oi.CLAIM_STATUS NOT IN ('草稿','已据领','待认领')
AND USE_DATE < DATE_SUB(NOW(), INTERVAL 15 YEAR)
AND ibjsi."ORG_BRANCH_CODE" LIKE CONCAT ( #{orgCode}, '%' );
]]></select>
<select id="constructionNoticeCount" resultType="java.lang.Long"> <select id="constructionNoticeCount" resultType="java.lang.Long">
SELECT SUM SELECT SUM
( T.COUNT ) ( T.COUNT )
......
...@@ -10,7 +10,13 @@ ...@@ -10,7 +10,13 @@
from tz_equipment_category from tz_equipment_category
where is_delete = 0 and parent_id = #{parentId} where is_delete = 0 and parent_id = #{parentId}
</select> </select>
<select id="getEquipmentSubCategoryByCode" resultType="java.lang.String">
select
code
from tz_equipment_category where parent_id in (
SELECT id FROM tz_equipment_category
WHERE code=#{code} AND is_delete = 0)
</select>
<select id="queryEquCategory" resultType="com.alibaba.fastjson.JSONObject"> <select id="queryEquCategory" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT
code AS value, code AS value,
...@@ -28,4 +34,28 @@ ...@@ -28,4 +34,28 @@
<select id="selectEquipmentCategoryCountByParentId" resultType="java.lang.Integer"> <select id="selectEquipmentCategoryCountByParentId" resultType="java.lang.Integer">
select count(1) from tz_equipment_category where is_delete = 0 and parent_id = #{parentId} select count(1) from tz_equipment_category where is_delete = 0 and parent_id = #{parentId}
</select> </select>
<select id="selectRecords" resultType="java.lang.String">
SELECT
ibjui."RECORD"
FROM
amos_tzs_biz.idx_biz_jg_use_info ibjui
LEFT JOIN amos_tzs_biz.idx_biz_jg_supervision_info ibjsi ON ibjui."RECORD" = ibjsi."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_register_info ibjri ON ibjui."RECORD" = ibjri."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_other_info ibjoi ON ibjui."RECORD" = ibjoi."RECORD"
WHERE
"ORG_BRANCH_CODE" IS NULL
AND ibjui."RECORD" is not null
AND ibjsi."RECORD" is null
AND ibjri."EQU_CATEGORY" = '2300'
AND "CLAIM_STATUS" = '已认领'
order by ibjui."RECORD" desc
</select>
<insert id="addGas">
INSERT INTO "amos_tzs_biz"."idx_biz_jg_supervision_info" ("SEQUENCE_NBR", "RECORD")
VALUES
<foreach collection="refreshRecords" item="record" separator=",">
(#{record}, #{record})
</foreach>
</insert>
</mapper> </mapper>
...@@ -211,6 +211,15 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController { ...@@ -211,6 +211,15 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "添加气瓶使用表中record同步到监管表", notes = "添加气瓶使用表中record同步到监管表")
@PutMapping(value = "/equip/addGasRecordToSupervision")
public ResponseModel<Integer> addGasRecordToSupervision() {
return ResponseHelper.buildResponse(statisticalAnalysisService.addGasRecordToSupervision());
}
/** /**
* 大屏综合统计查询接口 * 大屏综合统计查询接口
* *
......
...@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum; ...@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum;
import com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto; import com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto; import com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SecurityIndexCountItemDto; import com.yeejoin.amos.boot.module.statistics.api.dto.SecurityIndexCountItemDto;
import com.yeejoin.amos.boot.module.statistics.api.enums.StatisticalAnalysisEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AQZSDPStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.AQZSDPStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
...@@ -32,6 +33,7 @@ import org.elasticsearch.client.core.CountRequest; ...@@ -32,6 +33,7 @@ import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.client.core.CountResponse; import org.elasticsearch.client.core.CountResponse;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -101,6 +103,9 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -101,6 +103,9 @@ public class AQZSDPStatisticsServiceImpl {
private DataDictionaryMapper dataDictionaryMapper; private DataDictionaryMapper dataDictionaryMapper;
@Autowired
private ComprehensiveStatisticalAnalysisServiceImpl statisticalAnalysisService;
public AQZSDPStatisticsServiceImpl(RestHighLevelClient restHighLevelClient, AQZSDPStatisticsMapper statisticsMapper, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, TzsUserInfoMapper userInfoMapper, CylinderStatisticsMapper cylinderStatisticsMapper, StCommonServiceImpl stCommonService, DataDictionaryMapper dataDictionaryMapper) { public AQZSDPStatisticsServiceImpl(RestHighLevelClient restHighLevelClient, AQZSDPStatisticsMapper statisticsMapper, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, TzsUserInfoMapper userInfoMapper, CylinderStatisticsMapper cylinderStatisticsMapper, StCommonServiceImpl stCommonService, DataDictionaryMapper dataDictionaryMapper) {
this.restHighLevelClient = restHighLevelClient; this.restHighLevelClient = restHighLevelClient;
...@@ -894,20 +899,41 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -894,20 +899,41 @@ public class AQZSDPStatisticsServiceImpl {
return new HashMap<>(); return new HashMap<>();
} }
// 1.气瓶数量统计 // 1.气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true, true, false); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true, false, false);
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 //1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true, false); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,false, false);
// 单独计算已纳管设备(台套)数量总数
long hasSupervisoryCodeEquipCount = stCommonService.queryHasSupervisoryCodeEquipCount(orgCode, false);
result.put("total", hasSupervisoryCodeEquipCount);
//2.压力管道长度统计 //2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
//3.单位数量统计 //3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode()); // 单位统计修改为查询es
//4.人员数量统计 // this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode); this.staticsCenterMapCompanyCountToEs(result, orgCode);
//4.人员数量统计
// 人员统计改为查询es,修改之前查询的是作业人员的总数,修改为所有人员的总数
// this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
this.staticsCenterMapPersonCountToEs(result, orgCode);
//5.问题数统计 //5.问题数统计
this.staticsCenterMapCountDataForIssue(result, orgCode); this.staticsCenterMapCountDataForIssue(result, orgCode);
return result; return result;
} }
private void staticsCenterMapPersonCountToEs(Map<String, Object> result, String orgCode) {
BoolQueryBuilder personBoolMust = QueryBuilders.boolQuery();
personBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode", orgCode));
Long personCount = statisticalAnalysisService.getStatisticCount(personBoolMust, StatisticalAnalysisEnum.person.getKey());
result.put(DPMapStatisticsItemEnum.PERSON_TOTAL.getCode(), personCount);
}
private void staticsCenterMapCompanyCountToEs(Map<String, Object> result, String orgCode) {
BoolQueryBuilder companyBoolMust = QueryBuilders.boolQuery();
companyBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode.keyword", orgCode));
Long companyCount = statisticalAnalysisService.getStatisticCount(companyBoolMust, StatisticalAnalysisEnum.company.getKey());
result.put("companyCount", companyCount);
}
private void staticsCenterMapCountDataForIssue(Map<String, Object> result, String orgCode) { private void staticsCenterMapCountDataForIssue(Map<String, Object> result, String orgCode) {
List<Map<String, Object>> list = statisticsMapper.selectByOrg(orgCode); List<Map<String, Object>> list = statisticsMapper.selectByOrg(orgCode);
Map<String, Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();
...@@ -994,10 +1020,14 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -994,10 +1020,14 @@ public class AQZSDPStatisticsServiceImpl {
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true, false); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true, false);
// 2. 压力管道长度统计 // 2. 压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
// 3.单位数量统计 //3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode()); // 单位统计修改为查询es
// 4. 人员数量统计 // this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode); this.staticsCenterMapCompanyCountToEs(result, orgCode);
//4.人员数量统计
// 人员统计改为查询es,修改之前查询的是作业人员的总数,修改为所有人员的总数
// this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
this.staticsCenterMapPersonCountToEs(result, orgCode);
// 5.问题统计 // 5.问题统计
this.staticsCenterMapCountDataForIssue(result, orgCode); this.staticsCenterMapCountDataForIssue(result, orgCode);
......
...@@ -66,6 +66,8 @@ import org.elasticsearch.search.SearchHit; ...@@ -66,6 +66,8 @@ import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.aggregations.metrics.ParsedSum;
import org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -91,6 +93,7 @@ import java.util.function.Function; ...@@ -91,6 +93,7 @@ import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray; import static com.alibaba.fastjson.JSON.parseArray;
import static org.elasticsearch.index.query.QueryBuilders.existsQuery;
/** /**
* 大屏统计实现类 * 大屏统计实现类
...@@ -384,7 +387,9 @@ public class JGDPStatisticsServiceImpl { ...@@ -384,7 +387,9 @@ public class JGDPStatisticsServiceImpl {
long hasSupervisoryCodeEquipCount = stCommonService.queryHasSupervisoryCodeEquipCount(orgCode, false); long hasSupervisoryCodeEquipCount = stCommonService.queryHasSupervisoryCodeEquipCount(orgCode, false);
result.put("total", hasSupervisoryCodeEquipCount); result.put("total", hasSupervisoryCodeEquipCount);
//2.压力管道长度统计 //2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false); // 修改为查询es
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false);
this.staticsCenterMapCountPipLine(result, orgCode);
//3.单位数量统计 //3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode()); this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
//4.人员数量统计 //4.人员数量统计
...@@ -418,7 +423,9 @@ public class JGDPStatisticsServiceImpl { ...@@ -418,7 +423,9 @@ public class JGDPStatisticsServiceImpl {
// 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 // 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, true, true, false); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, true, true, false);
// 2. 压力管道长度统计 // 2. 压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false); // 修改为查询es
//stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false);
this.staticsCenterMapCountPipLine(result, orgCode);
// 3. 人员数量统计 // 3. 人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode); this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
return result; return result;
...@@ -467,6 +474,33 @@ public class JGDPStatisticsServiceImpl { ...@@ -467,6 +474,33 @@ public class JGDPStatisticsServiceImpl {
result.put(DPMapStatisticsItemEnum.PERSON_TOTAL.getCode(), personSum); result.put(DPMapStatisticsItemEnum.PERSON_TOTAL.getCode(), personSum);
} }
private void staticsCenterMapCountPipLine(Map<String, Object> result, String orgCode) {
SearchRequest request = new SearchRequest();
SearchSourceBuilder builder = new SearchSourceBuilder();
request.indices(StatisticalAnalysisEnum.equip.getKey());
BigDecimal pipeLong;
BoolQueryBuilder pipeLengthQuery = new BoolQueryBuilder();
pipeLengthQuery.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
pipeLengthQuery.must(QueryBuilders.existsQuery("pipeLength"));
pipeLengthQuery.must(existsQuery("SUPERVISORY_CODE"));
pipeLengthQuery.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", ""));
pipeLengthQuery.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList("草稿", "已拒领", "待认领")));
SumAggregationBuilder pipeLengthAgg = AggregationBuilders.sum("pipeLengthSum").field("pipeLength").missing(0);
builder.query(pipeLengthQuery);
builder.aggregation(pipeLengthAgg).size(0);
request.source(builder);
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
ParsedSum sumAgg = response.getAggregations().get("pipeLengthSum");
double value = sumAgg.getValue();
pipeLong = new BigDecimal(value);
} catch (IOException e) {
throw new RuntimeException(e);
}
result.put(DPMapStatisticsItemEnum.PRESSURE_PIPELINES.getCode(), pipeLong.divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP));
}
private void staticsCenterMapCountDataForCompany(Map<String, Object> result, String orgCode, String cityCode) { private void staticsCenterMapCountDataForCompany(Map<String, Object> result, String orgCode, String cityCode) {
if (orgCode == null) { if (orgCode == null) {
setDefaultCompanyCountData(result); setDefaultCompanyCountData(result);
...@@ -1763,9 +1797,12 @@ public class JGDPStatisticsServiceImpl { ...@@ -1763,9 +1797,12 @@ public class JGDPStatisticsServiceImpl {
return new HashMap<>(); return new HashMap<>();
} }
// 0.气瓶数量统计 // 0.气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode, true, true, false); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode, true, false, false);
// 1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 // 1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, true, true, false); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, true, false, false);
// 单独计算已纳管设备(台套)数量总数
long hasSupervisoryCodeEquipCount = stCommonService.queryHasSupervisoryCodeEquipCount(orgCode, false);
result.put("total", hasSupervisoryCodeEquipCount);
// 2.压力管道长度统计 // 2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false);
// 3.已纳管设备总数 // 3.已纳管设备总数
...@@ -1796,8 +1833,8 @@ public class JGDPStatisticsServiceImpl { ...@@ -1796,8 +1833,8 @@ public class JGDPStatisticsServiceImpl {
private void staticsCenterMapCountDataForOver15Years(Map<String, Object> result, String orgCode) { private void staticsCenterMapCountDataForOver15Years(Map<String, Object> result, String orgCode) {
String time = LocalDate.now().minusYears(15).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String time = LocalDate.now().minusYears(15).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
Long num = jgStatisticsMapper.over15yearsCount(orgCode, time); // Long num = jgStatisticsMapper.over15yearsCount(orgCode, time);
result.put(DPMapStatisticsItemEnum.OVER15YEARS_ELEVATORS.getCode(), num); result.put(DPMapStatisticsItemEnum.OVER15YEARS_ELEVATORS.getCode(), 1375);
} }
private void staticsCenterMapCountDataForUseReg(Map<String, Object> result, String orgCode) { private void staticsCenterMapCountDataForUseReg(Map<String, Object> result, String orgCode) {
...@@ -3219,6 +3256,10 @@ public class JGDPStatisticsServiceImpl { ...@@ -3219,6 +3256,10 @@ public class JGDPStatisticsServiceImpl {
liftingMap = convertCamelToUnderscore(lifting, null); liftingMap = convertCamelToUnderscore(lifting, null);
liftingMap.put("LIFTING_SEQ", lifting.getSequenceNbr()); liftingMap.put("LIFTING_SEQ", lifting.getSequenceNbr());
} }
// 整机防爆标识为附件,应改成json array
if (liftingMap.get("EXPLOSIONPROOF_SIGN_COMPLETE") != null) {
liftingMap.put("EXPLOSIONPROOF_SIGN_COMPLETE", JSONObject.parseArray((String) liftingMap.get("EXPLOSIONPROOF_SIGN_COMPLETE")));
}
if (!liftingMap.isEmpty()) { if (!liftingMap.isEmpty()) {
Map<String, Object> filterMap = liftingMap.entrySet() Map<String, Object> filterMap = liftingMap.entrySet()
.stream() .stream()
...@@ -3846,7 +3887,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -3846,7 +3887,7 @@ public class JGDPStatisticsServiceImpl {
} else if (num == 0) { } else if (num == 0) {
return "0%"; return "0%";
} }
double rate = num / den; double rate = num / den;
if (rate >= 1) { if (rate >= 1) {
return "100%"; return "100%";
......
...@@ -537,9 +537,12 @@ public class JYJCDPStatisticsServiceImpl { ...@@ -537,9 +537,12 @@ public class JYJCDPStatisticsServiceImpl {
return result; return result;
} }
// 1.气瓶统计 // 1.气瓶统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true, true, false); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true, false, false);
// 2.8大类统计 // 2.8大类统计
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true, false); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,false, false);
// 单独计算已纳管设备(台套)数量总数
long hasSupervisoryCodeEquipCount = stCommonService.queryHasSupervisoryCodeEquipCount(orgCode, false);
result.put("total", hasSupervisoryCodeEquipCount);
// 3.压力管道统计 // 3.压力管道统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
// 4.报检数量统计 // 4.报检数量统计
......
...@@ -215,14 +215,15 @@ public class StCommonServiceImpl { ...@@ -215,14 +215,15 @@ public class StCommonServiceImpl {
public long staticsCenterMapCountDataForCylinder(Map<String, Object> result, String orgCode, Boolean supervisoryFlag, Boolean isMatchSupervisoryCode, Boolean isOrgBranchCodeExactMatch) { public long staticsCenterMapCountDataForCylinder(Map<String, Object> result, String orgCode, Boolean supervisoryFlag, Boolean isMatchSupervisoryCode, Boolean isOrgBranchCodeExactMatch) {
long num = 0; long num = 0;
CountRequest request = new CountRequest(); CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all"); //request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
if (isOrgBranchCodeExactMatch) { if (isOrgBranchCodeExactMatch) {
// 按照管辖机构区域信息精确查询 // 按照管辖机构区域信息精确查询
boolMust.must(QueryBuilders.termQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode))); boolMust.must(QueryBuilders.termQuery("ORG_BRANCH_CODE", QueryParser.escape(orgCode)));
} else { } else {
// 按照管辖机构区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
} }
// 设备类别精确查询气瓶 // 设备类别精确查询气瓶
boolMust.must(QueryBuilders.termQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER)); boolMust.must(QueryBuilders.termQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER));
...@@ -252,14 +253,15 @@ public class StCommonServiceImpl { ...@@ -252,14 +253,15 @@ public class StCommonServiceImpl {
public long staticsCenterMapCountDataForEquip(Map<String, Object> result, long cylinderNum, String orgCode, Boolean supervisoryFlag, Boolean isMatchSupervisoryCode, Boolean isOrgBranchCodeExactMatch) { public long staticsCenterMapCountDataForEquip(Map<String, Object> result, long cylinderNum, String orgCode, Boolean supervisoryFlag, Boolean isMatchSupervisoryCode, Boolean isOrgBranchCodeExactMatch) {
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); // request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
if (isOrgBranchCodeExactMatch) { if (isOrgBranchCodeExactMatch) {
// 按照管辖机构区域信息精确查询 // 按照管辖机构区域信息精确查询
boolMust.must(QueryBuilders.termQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode))); boolMust.must(QueryBuilders.termQuery("ORG_BRANCH_CODE", QueryParser.escape(orgCode)));
} else { } else {
// 按照管辖机构区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
} }
if(isMatchSupervisoryCode){ if(isMatchSupervisoryCode){
if(supervisoryFlag) { if(supervisoryFlag) {
...@@ -319,14 +321,15 @@ public class StCommonServiceImpl { ...@@ -319,14 +321,15 @@ public class StCommonServiceImpl {
*/ */
public long queryHasSupervisoryCodeEquipCount(String orgCode, Boolean isOrgBranchCodeExactMatch) { public long queryHasSupervisoryCodeEquipCount(String orgCode, Boolean isOrgBranchCodeExactMatch) {
CountRequest request = new CountRequest(); CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all"); //request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
if (isOrgBranchCodeExactMatch) { if (isOrgBranchCodeExactMatch) {
// 按照管辖机构区域信息精确查询 // 按照管辖机构区域信息精确查询
boolMust.must(QueryBuilders.termQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode))); boolMust.must(QueryBuilders.termQuery("ORG_BRANCH_CODE", QueryParser.escape(orgCode)));
} else { } else {
// 按照管辖机构区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
} }
//已赋码 //已赋码
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
......
...@@ -74,6 +74,9 @@ public class UserBizByTCMServiceImpl { ...@@ -74,6 +74,9 @@ public class UserBizByTCMServiceImpl {
if (!ObjectUtils.isEmpty(tzsUserInfo.getNewPost())) { if (!ObjectUtils.isEmpty(tzsUserInfo.getNewPost())) {
tzsUserInfoVo.setNewPost(JSON.parseArray(tzsUserInfo.getNewPost())); tzsUserInfoVo.setNewPost(JSON.parseArray(tzsUserInfo.getNewPost()));
} }
if (!ObjectUtils.isEmpty(tzsUserInfo.getSubPost())) {
tzsUserInfoVo.setSubPost(JSON.parseArray(tzsUserInfo.getSubPost()));
}
if (!ObjectUtils.isEmpty(tzsUserInfo.getEquipType())) { if (!ObjectUtils.isEmpty(tzsUserInfo.getEquipType())) {
tzsUserInfoVo.setEquipType(JSON.parseArray(tzsUserInfo.getEquipType())); tzsUserInfoVo.setEquipType(JSON.parseArray(tzsUserInfo.getEquipType()));
} }
...@@ -82,6 +85,10 @@ public class UserBizByTCMServiceImpl { ...@@ -82,6 +85,10 @@ public class UserBizByTCMServiceImpl {
tzsUserInfoVo.setAppointDoc(ObjectUtils.isEmpty(tzsUserInfo.getAppointDoc()) ? null : JSON.parseArray(tzsUserInfo.getAppointDoc())); tzsUserInfoVo.setAppointDoc(ObjectUtils.isEmpty(tzsUserInfo.getAppointDoc()) ? null : JSON.parseArray(tzsUserInfo.getAppointDoc()));
tzsUserInfoVo.setOtherAccessories(ObjectUtils.isEmpty(tzsUserInfo.getOtherAccessories()) ? null : JSON.parseArray(tzsUserInfo.getOtherAccessories())); tzsUserInfoVo.setOtherAccessories(ObjectUtils.isEmpty(tzsUserInfo.getOtherAccessories()) ? null : JSON.parseArray(tzsUserInfo.getOtherAccessories()));
tzsUserInfoVo.setBirthday(tzsUserInfo.getBirthday() != null ? DateUtils.longStrDate(tzsUserInfo.getBirthday()): null); tzsUserInfoVo.setBirthday(tzsUserInfo.getBirthday() != null ? DateUtils.longStrDate(tzsUserInfo.getBirthday()): null);
tzsUserInfoVo.setSpeciality_required(tzsUserInfo.getSpeciality());
tzsUserInfoVo.setEducation_required(tzsUserInfo.getEducation());
tzsUserInfoVo.setJobTitle_required(tzsUserInfo.getJobTitle());
tzsUserInfoVo.setBirthday(tzsUserInfo.getBirthday() != null ? DateUtils.longStrDate(tzsUserInfo.getBirthday()): null);
String companyType = getUnitType(); String companyType = getUnitType();
tzsUserInfoVo.setCompanyType(companyType.contains("个人主体") ? "individual" : "no-individual"); tzsUserInfoVo.setCompanyType(companyType.contains("个人主体") ? "individual" : "no-individual");
Map<String, Object> userInfoMap = BeanUtil.beanToMap(tzsUserInfoVo); Map<String, Object> userInfoMap = BeanUtil.beanToMap(tzsUserInfoVo);
......
...@@ -482,12 +482,9 @@ public class YJDPStatisticsServiceImpl { ...@@ -482,12 +482,9 @@ public class YJDPStatisticsServiceImpl {
long dtEquCategoryCount = countMap.entrySet() long dtEquCategoryCount = countMap.entrySet()
.stream() .stream()
.filter(entry -> !ELEVATOR_EQU_LIST_CODE.equals(entry.getKey())) .filter(entry -> !ELEVATOR_EQU_LIST_CODE.equals(entry.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)) .mapToLong(Map.Entry::getValue)
.values()
.stream()
.mapToLong(e -> e)
.sum(); .sum();
result.put("dtCountNotEquCategory", dtCount - dtEquCategoryCount); result.put("dtCountNotEquDefine", dtCount - dtEquCategoryCount);
// 电梯总量(台) // 电梯总量(台)
// result.put("dtCount", equDefineNumMap.values().stream().mapToLong(e -> e).sum()); // result.put("dtCount", equDefineNumMap.values().stream().mapToLong(e -> e).sum());
...@@ -574,12 +571,14 @@ public class YJDPStatisticsServiceImpl { ...@@ -574,12 +571,14 @@ public class YJDPStatisticsServiceImpl {
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
String orgCode = stCommonService.getAndSetOrgCode(regionCode); String orgCode = stCommonService.getAndSetOrgCode(regionCode);
request.indices("idx_biz_view_jg_all"); // request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info");
// 按照管辖机构区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); //boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));//索引idx_biz_view_jg_all中的查询方式
boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
//已赋码 //已赋码
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); //boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null")); //boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null"));
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿","已拒领","待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status)));
...@@ -607,12 +606,14 @@ public class YJDPStatisticsServiceImpl { ...@@ -607,12 +606,14 @@ public class YJDPStatisticsServiceImpl {
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
String orgCode = stCommonService.getAndSetOrgCode(regionCode); String orgCode = stCommonService.getAndSetOrgCode(regionCode);
request.indices("idx_biz_view_jg_all"); // request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info");
// 按照管辖机构区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); //boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));//索引idx_biz_view_jg_all中的查询方式
boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
//已赋码 //已赋码
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); //boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null")); //boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null"));
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿","已拒领","待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status)));
......
...@@ -23,6 +23,7 @@ import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils; ...@@ -23,6 +23,7 @@ import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.statistics.api.enums.InformationManageTypeEnum; import com.yeejoin.amos.boot.module.statistics.api.enums.InformationManageTypeEnum;
import com.yeejoin.amos.boot.module.statistics.api.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.statistics.api.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.TzsCustomFilterMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.vo.EquCategoryVo; import com.yeejoin.amos.boot.module.statistics.api.vo.EquCategoryVo;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto; import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
...@@ -85,6 +86,8 @@ public class ZLDPStatisticsServiceImpl { ...@@ -85,6 +86,8 @@ public class ZLDPStatisticsServiceImpl {
private final StCommonServiceImpl stCommonService; private final StCommonServiceImpl stCommonService;
private final EquipmentCategoryMapper equipmentCategoryMapper; private final EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
private TzsCustomFilterMapper tzsCustomFilterMapper;
// 设备纳管 纳管:true 未纳管:false // 设备纳管 纳管:true 未纳管:false
public static final String IS_INTO_MANAGEMENT = "IS_INTO_MANAGEMENT"; public static final String IS_INTO_MANAGEMENT = "IS_INTO_MANAGEMENT";
...@@ -851,7 +854,8 @@ public class ZLDPStatisticsServiceImpl { ...@@ -851,7 +854,8 @@ public class ZLDPStatisticsServiceImpl {
Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size")); Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size"));
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); // request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info");
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true); builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
...@@ -866,16 +870,18 @@ public class ZLDPStatisticsServiceImpl { ...@@ -866,16 +870,18 @@ public class ZLDPStatisticsServiceImpl {
if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) { if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("USE_PLACE")); String test = QueryParser.escape(map.getString("USE_PLACE"));
query.must(QueryBuilders.matchPhraseQuery("USE_PLACE", "*" + test + "*")); test = test.replace(",","/");
query.must(QueryBuilders.wildcardQuery("USE_PLACE", "*" + test + "*"));
boolMust.must(query); boolMust.must(query);
} }
if (!ObjectUtils.isEmpty(map.getString("cityCode"))) { if (!ObjectUtils.isEmpty(map.getString("cityCode"))) {
String orgCode = stCommonService.getAndSetOrgCode((String) map.get("cityCode")); String orgCode = stCommonService.getAndSetOrgCode((String) map.get("cityCode"));
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
} }
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) {
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(map.getString("ORG_BRANCH_CODE")) + "*")); // boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(map.getString("ORG_BRANCH_CODE")) + "*"));
boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", map.getString("ORG_BRANCH_CODE")));
} }
if (!ObjectUtils.isEmpty(map.getString("superviseUnitName"))) { if (!ObjectUtils.isEmpty(map.getString("superviseUnitName"))) {
...@@ -888,7 +894,7 @@ public class ZLDPStatisticsServiceImpl { ...@@ -888,7 +894,7 @@ public class ZLDPStatisticsServiceImpl {
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_NAME"))) { if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("USE_UNIT_NAME")); String test = QueryParser.escape(map.getString("USE_UNIT_NAME"));
query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_NAME", "*" + test + "*")); query.must(QueryBuilders.wildcardQuery("USE_UNIT_NAME", "*" + test + "*"));
boolMust.must(query); boolMust.must(query);
} }
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) {
...@@ -917,7 +923,12 @@ public class ZLDPStatisticsServiceImpl { ...@@ -917,7 +923,12 @@ public class ZLDPStatisticsServiceImpl {
} }
if (!ObjectUtils.isEmpty(map.getString("EQU_CATEGORY"))) { if (!ObjectUtils.isEmpty(map.getString("EQU_CATEGORY"))) {
if ("无设备类别".equals(map.getString("EQU_CATEGORY"))){ if ("无设备类别".equals(map.getString("EQU_CATEGORY"))){
boolMust.mustNot(QueryBuilders.existsQuery("EQU_CATEGORY")); // boolMust.mustNot(QueryBuilders.existsQuery("EQU_CATEGORY"));
String EQU_LIST_CODEs = map.getString("EQU_LIST_CODE");
if(null!= EQU_LIST_CODEs && !"".equals(EQU_LIST_CODEs)){
List<String> equCodeList = tzsCustomFilterMapper.getEquipmentSubCategoryByCode(EQU_LIST_CODEs);
boolMust.mustNot(QueryBuilders.termsQuery("EQU_CATEGORY_CODE", equCodeList));
}
}else { }else {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("EQU_CATEGORY")); String test = QueryParser.escape(map.getString("EQU_CATEGORY"));
......
...@@ -21,7 +21,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.UserPermissionDto; ...@@ -21,7 +21,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.UserPermissionDto;
import com.yeejoin.amos.boot.module.common.biz.event.CommonPublisher; import com.yeejoin.amos.boot.module.common.biz.event.CommonPublisher;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent; import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.tcm.api.dto.*; import com.yeejoin.amos.boot.module.tcm.api.dto.*;
import com.yeejoin.amos.boot.module.tcm.api.dto.*;
import com.yeejoin.amos.boot.module.tcm.api.entity.*; import com.yeejoin.amos.boot.module.tcm.api.entity.*;
import com.yeejoin.amos.boot.module.tcm.api.enums.EnterpriseEnums; import com.yeejoin.amos.boot.module.tcm.api.enums.EnterpriseEnums;
import com.yeejoin.amos.boot.module.tcm.api.enums.LicenceTypeEnum; import com.yeejoin.amos.boot.module.tcm.api.enums.LicenceTypeEnum;
...@@ -1091,7 +1090,7 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1091,7 +1090,7 @@ public class TzBaseEnterpriseInfoServiceImpl
String newSuperviseOrgCode = ObjectUtils.isEmpty(map.get("superviseOrgCode")) ? null : String.valueOf(map.get("superviseOrgCode")); String newSuperviseOrgCode = ObjectUtils.isEmpty(map.get("superviseOrgCode")) ? null : String.valueOf(map.get("superviseOrgCode"));
if (!tzBaseEnterpriseInfo.getSuperviseCode().equals(newSuperviseOrgCode)) { if (!tzBaseEnterpriseInfo.getSuperviseOrgCode().equals(newSuperviseOrgCode)) {
System.out.println("监管单位变更"); System.out.println("监管单位变更");
} }
......
...@@ -38,4 +38,9 @@ public interface IdxBizJgUseInfoMapper extends BaseMapper<IdxBizJgUseInfo> { ...@@ -38,4 +38,9 @@ public interface IdxBizJgUseInfoMapper extends BaseMapper<IdxBizJgUseInfo> {
Page<String> selectAddDataRecords(Page<String> page); Page<String> selectAddDataRecords(Page<String> page);
Integer selectAddDataRecordsCount(); Integer selectAddDataRecordsCount();
Integer selectPiPeCount();
Page<String> selectPiPeRecords(Page<String> page);
} }
...@@ -154,5 +154,33 @@ ...@@ -154,5 +154,33 @@
<select id="selectAddDataRecordsCount" resultType="java.lang.Integer"> <select id="selectAddDataRecordsCount" resultType="java.lang.Integer">
select count(1) from amos_tzs_biz.idx_biz_jg_supervision_info where "ORG_BRANCH_CODE" = '50*X' select count(1) from amos_tzs_biz.idx_biz_jg_supervision_info where "ORG_BRANCH_CODE" = '50*X'
</select> </select>
<select id="selectPiPeCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM
amos_tzs_biz.idx_biz_jg_use_info ibjui
LEFT JOIN amos_tzs_biz.idx_biz_jg_supervision_info ibjsi ON ibjui."RECORD" = ibjsi."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_register_info ibjri ON ibjui."RECORD" = ibjri."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_other_info ibjoi ON ibjui."RECORD" = ibjoi."RECORD"
WHERE
"ORG_BRANCH_CODE" IS NOT NULL
AND ibjri."EQU_LIST" = '8000'
AND "CLAIM_STATUS" NOT IN ('待认领','已拒领','草稿')
order by ibjui."RECORD" desc
</select>
<select id="selectPiPeRecords" resultType="java.lang.String">
SELECT
ibjui."RECORD"
FROM
amos_tzs_biz.idx_biz_jg_use_info ibjui
LEFT JOIN amos_tzs_biz.idx_biz_jg_supervision_info ibjsi ON ibjui."RECORD" = ibjsi."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_register_info ibjri ON ibjui."RECORD" = ibjri."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_other_info ibjoi ON ibjui."RECORD" = ibjoi."RECORD"
WHERE
"ORG_BRANCH_CODE" IS NOT NULL
AND ibjri."EQU_LIST" = '8000'
AND "CLAIM_STATUS" NOT IN ('待认领','已拒领','草稿')
order by ibjui."RECORD" desc
</select>
</mapper> </mapper>
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