Commit ca41a7e7 authored by 刘凡's avatar 刘凡

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 594559b9 44985717
......@@ -14,5 +14,5 @@ public interface AlertStatisticsMapper extends BaseMapper<AlertStatistics> {
AlertStatistics getStatisticsMessage(@Param("orgCode")String orgCode, @Param("startDate")String startDate , @Param("endDate")String endDate);
AlertStatistics statisticsInfoByRegionAndDate(@Param("regionCode")String regionCode, @Param("startDate")String startDate , @Param("endDate")String endDate);
AlertStatistics statisticsInfoByRegionAndDate(@Param("regionCode")Integer regionCode, @Param("startDate")String startDate , @Param("endDate")String endDate);
}
......@@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertStatistics;
import java.text.ParseException;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
public interface IAlertStatisticsService {
......@@ -14,5 +14,5 @@ public interface IAlertStatisticsService {
List<AlertStatistics> getList(String date) throws ParseException;
JSONArray statisticInfoByRegionAndDate(String regionCode, LocalDate startDate, LocalDate endDate);
JSONArray statisticInfoByRegionAndDate(Map<String, Object> queryParams);
}
......@@ -12,10 +12,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -24,11 +21,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.*;
@RestController
......@@ -350,9 +343,9 @@ public class StatisticsController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/region/info")
@ApiOperation(httpMethod = "GET", value = "查询区域统计信息", notes = "查询区域统计信息")
public ResponseModel<JSONArray> statisticsRegionInfo(@RequestParam(value = "cityCode") String regionCode, @RequestParam(value = "startDate", required = false) LocalDate startDate, @RequestParam(value = "endDate", required = false) LocalDate endDate) {
return ResponseHelper.buildResponse(alertStatisticsService.statisticInfoByRegionAndDate(regionCode, startDate, endDate));
@PostMapping (value = "/region/info")
@ApiOperation(httpMethod = "POST", value = "查询区域统计信息", notes = "查询区域统计信息")
public ResponseModel<JSONArray> statisticsRegionInfo(@RequestBody Map<String, Object> queryParams) {
return ResponseHelper.buildResponse(alertStatisticsService.statisticInfoByRegionAndDate(queryParams));
}
}
......@@ -165,9 +165,12 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
}
@Override
public JSONArray statisticInfoByRegionAndDate(String regionCode, LocalDate startDate, LocalDate endDate) {
public JSONArray statisticInfoByRegionAndDate(Map<String, Object> params) {
LocalDate today = LocalDate.now();
if (ObjectUtils.isEmpty(startDate) || ObjectUtils.isEmpty(endDate)) {
LocalDate startDate = (LocalDate) params.get("startDate");
LocalDate endDate = (LocalDate) params.get("endDate");
Integer regionCode = (Integer) params.get("cityCode");
if (ObjectUtils.isEmpty(params.get("startDate")) || ObjectUtils.isEmpty(params.get("endDate"))) {
startDate = today.minusDays(6);
endDate = today;
}
......
......@@ -51,7 +51,7 @@ public class DPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏总览中间-地图左右两侧8大类、单位、人员数量全局统计", notes = "大屏总览中间-地图左右两侧8大类、单位、人员数量全局统计")
@PostMapping(value = "/zl/center-map/global/count")
@PostMapping(value = "/zl/center-map/legend")
public ResponseModel<Map<String, Object>> centerMapCountForGlobal(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
......@@ -61,6 +61,17 @@ public class DPStatisticsController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏总览中间-地图地市统计", notes = "大屏总览中间-地图地市统计")
@PostMapping(value = "/zl/center-map/overview")
public ResponseModel<List<Map<String, Object>>> centerMapCountForOverview(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.getCenterMapCountDataForOverview(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏八大类左侧-使用登记统计", notes = "大屏八大类左侧-使用登记统计")
@PostMapping(value = "/useRegisterCount")
public ResponseModel<Map<String, Object>> useRegisterCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
......
......@@ -13,7 +13,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.web.bind.annotation.*;
......@@ -124,7 +123,6 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.equCategoryListByCompanyType(getSelectedOrgInfo(), null, null));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equ-category/listByPersonAndEquList")
@ApiOperation(httpMethod = "GET", value = "按照人员身份、设备种类查询设备类别", notes = "按照人员身份、设备种类查询设备类别")
......@@ -167,7 +165,7 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/importData")
@ApiOperation(httpMethod = "POST", value = "气瓶批量导入", notes = "气瓶批量导入")
public List<EquipInfoCylinderExcelDto> ImportData (@RequestPart MultipartFile multipartFile) throws Exception {
public List<EquipInfoCylinderExcelDto> ImportData (@RequestPart("file") MultipartFile multipartFile) throws Exception {
List<EquipInfoCylinderExcelDto> aircraftList = new ArrayList<>();
try {
EasyExcel.read(multipartFile.getInputStream(), EquipInfoCylinderExcelDto.class, new AnalysisEventListener<EquipInfoCylinderExcelDto>() {
......
......@@ -5,9 +5,11 @@ import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.service.IEquipUsedCheck;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.List;
......@@ -48,6 +50,10 @@ public class ApplicationRunnerImpl implements ApplicationRunner {
private List<IEquipUsedCheck> equipUsedCheckList;
private DPStatisticsServiceImpl statisticsService;
private AmosRequestContext amosRequestContext;
public ApplicationRunnerImpl(JgUseRegistrationServiceImpl useRegistrationService,
CommonServiceImpl commonService,
JgInstallationNoticeServiceImpl installationNoticeService,
......@@ -63,7 +69,7 @@ public class ApplicationRunnerImpl implements ApplicationRunner {
JgScrapCancelServiceImpl scrapCancelService,
JgChangeRegistrationNameServiceImpl changeRegistrationNameService,
ReportAnalysisServiceImpl reportAnalysisService,
List<IEquipUsedCheck> equipUsedCheckList) {
List<IEquipUsedCheck> equipUsedCheckList, DPStatisticsServiceImpl statisticsService, AmosRequestContext amosRequestContext) {
this.commonService = commonService;
this.useRegistrationService = useRegistrationService;
......@@ -95,6 +101,8 @@ public class ApplicationRunnerImpl implements ApplicationRunner {
this.reportAnalysisService = reportAnalysisService;
this.equipUsedCheckList = equipUsedCheckList;
this.statisticsService = statisticsService;
this.amosRequestContext = amosRequestContext;
}
......@@ -184,5 +192,11 @@ public class ApplicationRunnerImpl implements ApplicationRunner {
// 流程中的设备统计数据预热
equipUsedCheckList.forEach(IEquipUsedCheck::init);
// 初始化数据到内存
RequestContext.setAppKey(amosRequestContext.getAppKey());
RequestContext.setProduct(amosRequestContext.getProduct());
RequestContext.setToken(amosRequestContext.getToken());
statisticsService.init();
}
}
......@@ -5,12 +5,17 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto;
import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgScrapCancelMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.action.search.SearchRequest;
......@@ -26,19 +31,15 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
......@@ -60,6 +61,27 @@ public class DPStatisticsServiceImpl {
*/
private final static String EQU_CATEGORY_CYLINDER = "2300";
/**
* 单位类型-使用单位
*/
private final static String COMPANY_TYPE_USE = "使用单位";
/**
* 单位类型-安装改造维修单位
*/
private final static String COMPANY_TYPE_MAINTENANCE = "安装改造维修单位";
/**
* 单位类型-制造单位
*/
private final static String COMPANY_TYPE_MANUFACTURE = "制造单位";
/**
* 单位类型-充装单位
*/
private final static String COMPANY_TYPE_FILLING = "充装单位";
private EquipmentCategoryMapper equipmentCategoryMapper;
private JgUseRegistrationMapper useRegistrationMapper;
......@@ -72,25 +94,46 @@ public class DPStatisticsServiceImpl {
private RestHighLevelClient restHighLevelClient;
private TzBaseEnterpriseInfoMapper enterpriseInfoMapper;
private CommonMapper commonMapper;
private static List<EquipmentCategoryDto> equipmentCategoryDtos;
private TzsUserInfoMapper userInfoMapper;
private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>();
private static List<RegionModel> regionModels = new ArrayList<>();
public DPStatisticsServiceImpl(EquipmentCategoryMapper equipmentCategoryMapper, JgUseRegistrationMapper useRegistrationMapper, EquipTechParamPipelineMapper techParamsPipelineMapper, JgEnableDisableMapper enableDisableMapper, JgScrapCancelMapper scrapCancelMapper, RestHighLevelClient restHighLevelClient) {
public DPStatisticsServiceImpl(EquipmentCategoryMapper equipmentCategoryMapper, JgUseRegistrationMapper useRegistrationMapper, EquipTechParamPipelineMapper techParamsPipelineMapper, JgEnableDisableMapper enableDisableMapper, JgScrapCancelMapper scrapCancelMapper, RestHighLevelClient restHighLevelClient, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, CommonMapper commonMapper, TzsUserInfoMapper userInfoMapper) {
this.equipmentCategoryMapper = equipmentCategoryMapper;
this.useRegistrationMapper = useRegistrationMapper;
this.techParamsPipelineMapper = techParamsPipelineMapper;
this.enableDisableMapper = enableDisableMapper;
this.scrapCancelMapper = scrapCancelMapper;
this.restHighLevelClient = restHighLevelClient;
this.enterpriseInfoMapper = enterpriseInfoMapper;
this.commonMapper = commonMapper;
this.userInfoMapper = userInfoMapper;
}
@PostConstruct
public void init() {
// 数据不变所以放到内存,提高响应时间
equipmentCategoryDtos = equipmentCategoryMapper.selectClassify();
initReginCode();
}
private List<LegendDataDto> buildLegendDataList() {
List<LegendDataDto> legendDataDtos = new ArrayList<>();
legendDataDtos.add(LegendDataDto.builder().dataKey("newDevice").value("新增登记设备").build());
legendDataDtos.add(LegendDataDto.builder().dataKey("stoppedDevice").value("报停设备").build());
legendDataDtos.add(LegendDataDto.builder().dataKey("scrappedDevice").value("报废设备").build());
return legendDataDtos;
}
public Map<String, Object> useRegisterCountByEquList(DPFilterParamDto dpFilterParamDto) {
// 1.查询条件构造未上送时间时,默认查询数据为近一个月数据
this.setDefaultFilter(dpFilterParamDto);
......@@ -106,14 +149,6 @@ public class DPStatisticsServiceImpl {
return result;
}
private List<LegendDataDto> buildLegendDataList() {
List<LegendDataDto> legendDataDtos = new ArrayList<>();
legendDataDtos.add(LegendDataDto.builder().dataKey("newDevice").value("新增登记设备").build());
legendDataDtos.add(LegendDataDto.builder().dataKey("stoppedDevice").value("报停设备").build());
legendDataDtos.add(LegendDataDto.builder().dataKey("scrappedDevice").value("报废设备").build());
return legendDataDtos;
}
private void buildYData(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) {
// 待统计的数据本来sql可以单独统计,但是要求气瓶单独从压力容器里拎出来,与八大类同级,故java处理
// 1.新增登记统计
......@@ -187,14 +222,38 @@ public class DPStatisticsServiceImpl {
//3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, dpFilterParamDto);
//4.人员数量统计
StopWatch stopWatch5 = new StopWatch();
stopWatch5.start();
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto);
return null;
stopWatch5.stop();
log.info("------人员查询>:{}", stopWatch5.getTotalTimeSeconds());
return result;
}
private void staticsCenterMapCountDataForPerson(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) {
// String orgCode = regionCodeOrgCodeMap.get(dpFilterParamDto.getCityCode());
// if (orgCode == null) {
// orgCode = commonMapper.getOrgCodeByCompanyCode(dpFilterParamDto.getCityCode());
// regionCodeOrgCodeMap.put(dpFilterParamDto.getCityCode(), orgCode);
// }
// Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, "6552");
// result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num);
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), 0);
}
private void staticsCenterMapCountDataForCompany(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) {
String orgCode = regionCodeOrgCodeMap.get(dpFilterParamDto.getCityCode());
if (orgCode == null) {
orgCode = commonMapper.getOrgCodeByCompanyCode(dpFilterParamDto.getCityCode());
if (orgCode == null) {
return;
}
regionCodeOrgCodeMap.put(dpFilterParamDto.getCityCode(), orgCode);
}
result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, COMPANY_TYPE_USE));
result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, COMPANY_TYPE_MAINTENANCE));
result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, COMPANY_TYPE_MANUFACTURE));
result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, COMPANY_TYPE_FILLING));
}
private long staticsCenterMapCountDataForCylinder(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) {
......@@ -208,6 +267,7 @@ public class DPStatisticsServiceImpl {
boolMust.must(QueryBuilders.termsQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER));
// 纳管状态为已纳管
boolMust.must(QueryBuilders.termsQuery("IS_INTO_MANAGEMENT", true));
request.query(boolMust);
try {
CountResponse response = restHighLevelClient.count(request, RequestOptions.DEFAULT);
num = response.getCount();
......@@ -253,6 +313,7 @@ public class DPStatisticsServiceImpl {
equipmentCategoryDtos.forEach(c -> {
result.put(this.castCategoryCode2WebCode(c.getCode()), countMap.getOrDefault(c.getCode(), 0L));
});
result.put(DPMapStatisticsItemEnum.TOTAL.getCode(), countMap.values().stream().mapToLong(e -> e).sum());
} catch (IOException e) {
throw new RuntimeException(e);
}
......@@ -269,15 +330,15 @@ public class DPStatisticsServiceImpl {
Map<String, Object> result = new HashMap<>();
List legendDataList = new ArrayList();
Map<String,Object> newDeviceMap = new HashMap<>();
newDeviceMap.put("dataKey","newDevice");
newDeviceMap.put("value","新增登记设备");
Map<String, Object> newDeviceMap = new HashMap<>();
newDeviceMap.put("dataKey", "newDevice");
newDeviceMap.put("value", "新增登记设备");
legendDataList.add(newDeviceMap);
Map<String,Object> scrappedDeviceMap = new HashMap<>();
scrappedDeviceMap.put("dataKey","scrappedDevice");
scrappedDeviceMap.put("value","报废设备");
Map<String, Object> scrappedDeviceMap = new HashMap<>();
scrappedDeviceMap.put("dataKey", "scrappedDevice");
scrappedDeviceMap.put("value", "报废设备");
legendDataList.add(scrappedDeviceMap);
result.put("legendData",legendDataList);
result.put("legendData", legendDataList);
LocalDate today = LocalDate.now();
List xDataList = new ArrayList();
List<Integer> newDeviceList = new ArrayList();
......@@ -290,14 +351,44 @@ public class DPStatisticsServiceImpl {
dpFilterParamDto.setEndDate(LocalDateTime.of(lastDayOfPrevMonth, java.time.LocalTime.MAX).format(sdf));
Integer useRegisterCount = useRegistrationMapper.getUseRegisterCount(dpFilterParamDto);
Integer scrappedDeviceCount = scrapCancelMapper.getScrappedDeviceCount(dpFilterParamDto);
xDataList.add(firstDayOfPrevMonth.getMonthValue()+"月");
xDataList.add(firstDayOfPrevMonth.getMonthValue() + "月");
newDeviceList.add(null == useRegisterCount ? 0 : useRegisterCount);
scrappedDeviceList.add(null == scrappedDeviceCount ? 0 : scrappedDeviceCount);
}
result.put("xdata",xDataList);
result.put("newDevice",newDeviceList);
result.put("scrappedDevice",scrappedDeviceList);
result.put("xdata", xDataList);
result.put("newDevice", newDeviceList);
result.put("scrappedDevice", scrappedDeviceList);
return result;
}
public List<Map<String, Object>> getCenterMapCountDataForOverview(DPFilterParamDto dpFilterParamDto) {
return regionModels.parallelStream().filter(e -> e.getParentRegionCode() != null && (e.getParentRegionCode().toString()).equals(dpFilterParamDto.getCityCode())).map(r -> {
DPFilterParamDto filterParamDto = new DPFilterParamDto();
filterParamDto.setCityCode(r.getRegionCode().toString());
Map<String, Object> itemResult = getCenterMapCountDataForGlobal(filterParamDto);
if (itemResult == null) {
itemResult = new HashMap<>();
}
itemResult.put("cityCode", r.getRegionCode());
return itemResult;
}).collect(Collectors.toList());
}
private void initReginCode() {
Collection<RegionModel> result = Systemctl.regionClient.queryForTree(null).getResult();
result.forEach(r -> {
regionModels.add(r);
this.loopSetChildRegin(regionModels, r.getChildren());
});
}
private void loopSetChildRegin(List<RegionModel> regionModels, Collection<RegionModel> children) {
if (children != null && children.size() > 0) {
children.forEach(c -> {
regionModels.add(c);
this.loopSetChildRegin(regionModels, c.getChildren());
});
}
}
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectTimeCountDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationEquip;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -23,4 +24,6 @@ public interface JyjcInspectionApplicationEquipMapper extends BaseMapper<JyjcIns
* @return 统计列表
*/
List<InspectTimeCountDto> countInspectTimeCountByTypeAndEquList(DPFilterParamDto dpFilterParamDto);
Integer inspectTimeCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
}
......@@ -47,4 +47,27 @@
c.equ_category,
c.equ_define
</select>
<select id="inspectTimeCount" resultType="java.lang.Integer">
SELECT COUNT(1) AS num
FROM
(
SELECT
ae.equ_category,
concat ( u.PROVINCE, '#', u.CITY, '#', u.COUNTY ) AS areaCode
FROM
"tz_jyjc_inspection_application_equip" ae,
tz_jyjc_inspection_application A,
"idx_biz_jg_use_info" u
WHERE
ae.equip_unicode = u."RECORD"
AND A.sequence_nbr = ae.application_seq
AND ( A.application_date BETWEEN #{ dpFilterParamDto.beginDate } AND #{ dpFilterParamDto.endDate } )
AND A.status = '6616'
AND ae.equ_category = '2300'
) C
WHERE
C.areaCode LIKE concat ( '%', #{dpFilterParamDto.cityCode}, '%' )
GROUP BY
C.equ_category
</select>
</mapper>
......@@ -47,4 +47,16 @@ public class DPStatisticsController {
}
return ResponseHelper.buildResponse(statisticsService.inspectTimeCountByTypeAndEquList(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "气瓶检验检测次数统计", notes = "气瓶检验检测次数统计")
@PostMapping(value = "/inspectTimeCount")
public ResponseModel<Map<String, Object>> inspectTimeCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if(!fieldErrors.isEmpty()){
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.inspectTimeCount(dpFilterParamDto));
}
}
......@@ -10,6 +10,10 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.stream.Collectors;
......@@ -113,4 +117,24 @@ public class DPStatisticsServiceImpl {
dpFilterParamDto.setEndDate(DateUtil.today());
}
}
public Map<String, Object> inspectTimeCount(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> returnMap = new HashMap<>();
LocalDate today = LocalDate.now();
List xDataList = new ArrayList();
List<Integer> yDataList = new ArrayList();
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
for (int i = 2; i >= 0; i--) {
LocalDate firstDayOfPrevMonth = today.minusMonths(i).with(TemporalAdjusters.firstDayOfMonth());
LocalDate lastDayOfPrevMonth = today.minusMonths(i).with(TemporalAdjusters.lastDayOfMonth());
dpFilterParamDto.setBeginDate(LocalDateTime.of(firstDayOfPrevMonth, java.time.LocalTime.MIN).format(sdf));
dpFilterParamDto.setEndDate(LocalDateTime.of(lastDayOfPrevMonth, java.time.LocalTime.MAX).format(sdf));
Integer inspectTimeCount = inspectionApplicationEquipMapper.inspectTimeCount(dpFilterParamDto);
xDataList.add(firstDayOfPrevMonth.getMonthValue()+"月");
yDataList.add(null == inspectTimeCount ? 0 : inspectTimeCount);
}
returnMap.put("xData",xDataList);
returnMap.put("yData",yDataList);
return returnMap;
}
}
......@@ -64,4 +64,6 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
* @author yangyang
*/
TzBaseEnterpriseInfo selectBySeq(Long sequenceNbr);
Long countByUnitTypeAndOrgCode(@Param("orgCode") String orgCode,@Param("unitType") String unitType);
}
......@@ -11,4 +11,6 @@ import java.util.Set;
public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
Page<TzsUserInfoDto> selectPageMessage(@Param("page") Page<TzsUserInfoDto> page, @Param("dto") TzsUserInfoDto dto);
Long countUserByPostAndAreaCode(@Param("orgCode") String orgCode, @Param("post") String post);
}
......@@ -27,7 +27,7 @@
</select>
<select id="sumPipeLengthByArea" resultType="java.lang.String">
select
round(sum(p."PIPE_LENGTH"), 2) as PIPE_LENGTH
COALESCE(round(sum(p."PIPE_LENGTH"), 2),0) as PIPE_LENGTH
from
idx_biz_jg_tech_params_pipeline p,
(
......@@ -45,6 +45,6 @@
and ui.IS_INTO_MANAGEMENT =true
) a
where
p."RECORD" = a."RECORD" and c.areaCode like concat('%',#{cityCode}, '%')
p."RECORD" = a."RECORD" and a.areaCode like concat('%',#{cityCode}, '%')
</select>
</mapper>
......@@ -196,4 +196,13 @@
<select id="selectBySeq" resultType="com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo">
select * from tz_base_enterprise_info where sequence_nbr = #{sequenceNbr}
</select>
<select id="countByUnitTypeAndOrgCode" resultType="java.lang.Long">
SELECT
count(1)
FROM
"tz_base_enterprise_info" a
where
a.supervise_org_code like concat(#{orgCode},'%')
and a.unit_type like concat('%', #{unitType},'%')
</select>
</mapper>
......@@ -48,4 +48,16 @@
</where>
order by rec_date
</select>
<select id="countUserByPostAndAreaCode" resultType="java.lang.Long">
SELECT
count(1)
FROM
tzs_user_info tui,
tz_base_enterprise_info bi
WHERE
tui.unit_code = bi.use_code
and tui.post LIKE concat ( '%', #{post}, '%' )
and bi.supervise_org_code LIKE CONCAT ( #{orgCode}, '%' )
and tui.is_delete=false
</select>
</mapper>
\ No newline at end of file
package com.yeejoin.amos.boot.module.ymt.biz.dao;
import com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
......
......@@ -10,7 +10,7 @@ import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipExportDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentMessageDto;
......
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