Commit 6ac5532b authored by kinky2014's avatar kinky2014

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

parents 03571466 43b2561e
package com.yeejoin.amos.api.openapi.constant;
public enum CylinderInfoFieldEnum {
creditCode,
unitName,
sequenceCode,
cylinderVariety,
cylinderVarietyName,
factoryNum,
fillingMedia,
fillingMediaName,
manufacturingUnit,
manufacturingDate,
valveManufacturUnit,
nominalWorkPressure,
volume,
productQualified,
proofQuality,
supervisionInspec,
typeExperiments,
cylinderStatus,
syncDate,
syncState;
}
package com.yeejoin.amos.api.openapi.constant;
public enum CylinderUnitFieldEnum {
unitId,
regionCode,
regionName,
unitName,
creditCode,
address,
unitPerson,
personMobilePhone,
personTelephone,
securityAdm,
securityAdmPhone,
postalCode,
syncDate,
syncState;
}
package com.yeejoin.amos.api.openapi.constant;
public enum FillingAfterFieldEnum {
sequenceCode,
fillingCheckId,
withinScope,
sealedState,
defective,
abnormaLTemperature,
warningSign,
compliance,
checkResults,
nonconformances,
inspector,
inspectionDate,
syncDate,
syncState;
}
package com.yeejoin.amos.api.openapi.constant;
public enum FillingBeforeFieldEnum {
sequenceCode,
fillingBeforeId,
creditCode,
fillingUnitName,
inspectorUser,
inspectionDate,
isValid,
same,
isRegulations,
isComplianceWithGBT,
haveStillPressure,
isComplete,
haveSecurityDocuments,
fillBeforeItem,
checkResults,
nonconformances,
syncDate,
syncState;
}
package com.yeejoin.amos.api.openapi.constant;
public enum FillingRecordFieldEnum {
sequenceCode,
fillingRecordId,
fillingBeforeId,
fillingCheckId,
fillingExamineId,
fillingStartTime,
fillingEndTime,
fillingUser,
inspectorName,
fillingQuantity,
dischargeVolume,
temperature,
abnormal,
syncDate,
syncState;
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum CylinderFillingAuditFieldEnum {
sequenceCode(true, true),
fillingExamineId(true, true),
fillingAuditDate(true, false),
fillingAuditUrl(true, false),
fillingAuditname(true, false),
syncDate(true, false),
syncState(true, false);
private boolean isRequire;
private boolean isUnique;
public static List<String> getAllRequireKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isRequire).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
public static List<String> getAllUniqueKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isUnique).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum CylinderInfoFieldEnum {
creditCode(true, false),
unitName(true, false),
sequenceCode(true, true),
cylinderVariety(true, false),
cylinderVarietyName(true, false),
factoryNum(true, false),
fillingMedia(true, false),
fillingMediaName(true, false),
manufacturingUnit(true, false),
manufacturingDate(true, false),
valveManufacturUnit(true, false),
nominalWorkPressure(true, false),
volume(true, false),
productQualified(true, false),
proofQuality(true, false),
supervisionInspec(true, false),
typeExperiments(true, false),
cylinderStatus(true, false),
syncDate(true, false),
syncState(true, false);
private boolean isRequire;
private boolean isUnique;
public static List<String> getAllRequireKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isRequire).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
public static List<String> getAllUniqueKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isUnique).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum CylinderInspectionFieldEnum {
sequenceCode(true, true),
inspectionUnit(true, true),
inspectionDate(true, true),
inspectionResult(true, true),
scrapQuantity(true, true),
nextInspectionDate(true, true),
syncDate(true, true),
syncState(true, true);
private boolean isRequire;
private boolean isUnique;
public static List<String> getAllRequireKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isRequire).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
public static List<String> getAllUniqueKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isUnique).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum CylinderTagFieldEnum {
sequenceCode(true, true),
qrCode(true, true),
electronicLabelCode(true, true),
gasCylinderStamp(true, true),
syncDate(true, false),
syncState(true, false);
private boolean isRequire;
private boolean isUnique;
public static List<String> getAllRequireKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isRequire).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
public static List<String> getAllUniqueKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isUnique).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum CylinderUnitFieldEnum {
unitId(true, true),
regionCode(true, false),
regionName(true, false),
unitName(true, true),
creditCode(true, true),
address(true, false),
unitPerson(true, false),
personMobilePhone(true, false),
personTelephone(true, false),
securityAdm(true, false),
securityAdmPhone(true, false),
postalCode(true, false),
syncDate(true, false),
syncState(true, false);
private boolean isRequire;
private boolean isUnique;
public static List<String> getAllRequireKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isRequire).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
public static List<String> getAllUniqueKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isUnique).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum FillingAfterFieldEnum {
sequenceCode(true, true),
fillingCheckId(true, true),
withinScope(true, false),
sealedState(true, false),
defective(true, false),
abnormaLTemperature(true, false),
warningSign(true, false),
compliance(true, false),
checkResults(true, false),
nonconformances(true, false),
inspector(true, false),
inspectionDate(true, false),
syncDate(true, false),
syncState(true, false);
private boolean isRequire;
private boolean isUnique;
public static List<String> getAllRequireKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isRequire).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
public static List<String> getAllUniqueKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isUnique).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum FillingBeforeFieldEnum {
sequenceCode(true, true),
fillingBeforeId(true, true),
creditCode(true, false),
fillingUnitName(true, false),
inspectorUser(true, false),
inspectionDate(true, false),
isValid(true, false),
same(true, false),
isRegulations(true, false),
isComplianceWithGBT(true, false),
haveStillPressure(true, false),
isComplete(true, false),
haveSecurityDocuments(true, false),
fillBeforeItem(true, false),
checkResults(true, false),
nonconformances(true, false),
syncDate(true, false),
syncState(true, false);
private boolean isRequire;
private boolean isUnique;
public static List<String> getAllRequireKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isRequire).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
public static List<String> getAllUniqueKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isUnique).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum FillingRecordFieldEnum {
sequenceCode(true, true),
fillingRecordId(true, true),
fillingBeforeId(true, true),
fillingCheckId(true, true),
fillingExamineId(true, true),
fillingStartTime(true, false),
fillingEndTime(true, false),
fillingUser(true, false),
inspectorName(true, false),
fillingQuantity(true, false),
dischargeVolume(true, false),
temperature(true, false),
abnormal(true, false),
syncDate(true, false),
syncState(true, false);
private boolean isRequire;
private boolean isUnique;
public static List<String> getAllRequireKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isRequire).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
public static List<String> getAllUniqueKeys() {
List<String> keys = Arrays.stream(values()).filter(e -> e.isUnique).map(e -> e.name()).collect(Collectors.toList());
return keys;
}
}
......@@ -2,11 +2,6 @@ package com.yeejoin.amos.api.openapi.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.UseInfo;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Set;
/**
* 特种设备基本信息-使用信息 Mapper 接口
......
package com.yeejoin.amos.boot.module.cylinder.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 问题信息列表
*
* @author system_generator
* @date 2024-06-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "CylinderQuestionInfoDto", description = "问题信息列表")
public class CylinderQuestionInfoDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "行政区划")
private String regionCode;
@ApiModelProperty(value = "问题类型枚举")
private String questionType;
@ApiModelProperty(value = "问题内容")
private String questionContent;
@ApiModelProperty(value = "发生日期")
private Date happenDate;
@ApiModelProperty(value = "等级")
private String level;
@ApiModelProperty(value = "预警对象唯一标识")
private String questionObjectId;
@ApiModelProperty(value = "预警对象名称")
private String questionObjectName;
@ApiModelProperty(value = "问题归属唯一标识")
private String questionAttributionId;
@ApiModelProperty(value = "问题归属名称")
private String questionAttributionName;
@ApiModelProperty(value = "问题类型名称")
private String questionTypeName;
}
package com.yeejoin.amos.boot.module.cylinder.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 问题信息列表
*
* @author system_generator
* @date 2024-06-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tz_cylinder_question_info")
public class CylinderQuestionInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 行政区划
*/
@TableField("region_code")
private String regionCode;
/**
* 问题类型枚举
*/
@TableField("question_type")
private String questionType;
/**
* 问题内容
*/
@TableField("question_content")
private String questionContent;
/**
* 发生日期
*/
@TableField("happen_date")
private Date happenDate;
/**
* 等级
*/
@TableField("level")
private String level;
/**
* 预警对象唯一标识
*/
@TableField("question_object_id")
private String questionObjectId;
/**
* 预警对象名称
*/
@TableField("question_object_name")
private String questionObjectName;
/**
* 问题归属唯一标识
*/
@TableField("question_attribution_id")
private String questionAttributionId;
/**
* 问题归属名称
*/
@TableField("question_attribution_name")
private String questionAttributionName;
/**
* 问题类型名称
*/
@TableField("question_type_name")
private String questionTypeName;
}
package com.yeejoin.amos.boot.module.cylinder.api.mapper;
import com.yeejoin.amos.boot.module.cylinder.api.entity.CylinderQuestionInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 问题信息列表 Mapper 接口
*
* @author system_generator
* @date 2024-06-01
*/
public interface CylinderQuestionInfoMapper extends BaseMapper<CylinderQuestionInfo> {
}
package com.yeejoin.amos.boot.module.cylinder.api.service;
/**
* 问题信息列表接口类
*
* @author system_generator
* @date 2024-06-01
*/
public interface ICylinderQuestionInfoService {
}
......@@ -13,4 +13,6 @@ public interface TzsAuthService {
List<String> getUserRegionCode();
List<RegionModel> getUserReginTree();
List<RegionModel> getThreeUserReginTree();
}
package com.yeejoin.amos.boot.module.cylinder.flc.api.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 地市气瓶信息汇总
*
* @author LiuLin
* @date 2024-05-31
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="CityCylinderInfoDto", description="地市气瓶信息汇总")
public class CityCylinderInfoDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "地市名称")
private String regionName;
@ApiModelProperty(value = "地市Code")
private String regionCode;
@ApiModelProperty(value = "是否报警")
@JsonProperty("isAlarm")
private boolean isAlarm;
@ApiModelProperty(value = "气站数量")
private Integer stationCount;
@ApiModelProperty(value = "气瓶数量")
private Integer cylindersCount;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
}
package com.yeejoin.amos.boot.module.cylinder.flc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CityCylinderInfoDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnit;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
......@@ -48,4 +48,11 @@ public interface CylinderUnitMapper extends BaseMapper<CylinderUnit> {
Integer getThisMonthUnitTotalByRegionCode(String regionCode);
List<CylinderUnitDto> getMessage(@Param("regionCode") String regionCode);
/**
* 根据层级查气瓶信息
* @param level 层级
* @return list
*/
List<CityCylinderInfoDto> getCylinderDataByLevel(@Param("level") String level);
}
......@@ -3,8 +3,8 @@ package com.yeejoin.amos.boot.module.cylinder.flc.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderInfoDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CityCylinderInfoDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInfoDto;
import java.util.List;
import java.util.Map;
......@@ -56,4 +56,6 @@ public interface ICylinderInfoService {
void saveCylinderInfo2ES(List<CylinderInfoDto> records);
Integer getInfoTotal();
List<CityCylinderInfoDto> getCityCylinderData(String level);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.cylinder.api.mapper.CylinderQuestionInfoMapper">
</mapper>
......@@ -14,6 +14,21 @@
select count(sequence_nbr) from tz_cylinder_unit where region_code like CONCAT('%',#{regionCode},'%')
</select>
<select id="getCylinderDataByLevel" resultType="com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CityCylinderInfoDto">
SELECT
SUBSTRING_INDEX(SUBSTRING_INDEX(cu.region_code, '#', #{level}), '#', -1) AS regionCode,
COUNT(DISTINCT cu.sequence_nbr) AS stationCount,
COUNT(ci.app_id) AS cylindersCount,
CASE
WHEN (SELECT COUNT(1) FROM tz_cylinder_inspection ins WHERE ins.app_id = cu.app_id
AND LENGTH(ins.next_inspection_date) >= 10
AND TO_DAYS(ins.next_inspection_date) - TO_DAYS(NOW()) &lt;= 30) > 0 THEN 1
WHEN (SELECT COUNT(1) FROM view_unit_outofdate v WHERE v.credit_code = cu.credit_code) > 0 THEN 1
ELSE 0
END AS "isAlarm"
FROM tz_cylinder_unit cu LEFT JOIN tz_cylinder_info ci ON cu.app_id = ci.app_id GROUP BY regionCode
</select>
<select id="getWarnNum" resultType="java.lang.Integer">
select count(1) from view_unit_outofdate v where v.app_id in (
select u.app_id from tz_cylinder_unit u where u.region_code like CONCAT('%',#{regionCode},'%')
......
package com.yeejoin.amos.boot.module.cylinder.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.cylinder.api.dto.CylinderQuestionInfoDto;
import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.CylinderQuestionInfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
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;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 问题信息列表
*
* @author system_generator
* @date 2024-06-01
*/
@RestController
@Api(tags = "问题信息列表Api")
@RequestMapping(value = "/cylinder-question-info")
public class CylinderQuestionInfoController extends BaseController {
@Autowired
CylinderQuestionInfoServiceImpl cylinderQuestionInfoServiceImpl;
/**
* 新增问题信息列表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增问题信息列表", notes = "新增问题信息列表")
public ResponseModel<CylinderQuestionInfoDto> save(@RequestBody CylinderQuestionInfoDto model) {
model = cylinderQuestionInfoServiceImpl.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<CylinderQuestionInfoDto> updateBySequenceNbrCylinderQuestionInfo(@RequestBody CylinderQuestionInfoDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(cylinderQuestionInfoServiceImpl.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(cylinderQuestionInfoServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个问题信息列表", notes = "根据sequenceNbr查询单个问题信息列表")
public ResponseModel<CylinderQuestionInfoDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(cylinderQuestionInfoServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "问题信息列表分页查询", notes = "问题信息列表分页查询")
public ResponseModel<Page<CylinderQuestionInfoDto>> queryForPage(@ApiParam(value = "页数") @RequestParam(value = "current") int current,
@ApiParam(value = "每页大小") @RequestParam(value = "size") int size,
@ApiParam(value = "问题类型枚举") @RequestParam(value = "questionType",required = false) String questionType,
@ApiParam(value = "行政区域code") @RequestParam(value = "regionCode",required = false) String regionCode) {
Page<CylinderQuestionInfoDto> page = new Page<CylinderQuestionInfoDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(cylinderQuestionInfoServiceImpl.queryForCylinderQuestionInfoPage(page,questionType, regionCode));
}
}
......@@ -36,92 +36,105 @@ import java.util.Map;
@RequestMapping(value = "/tzs-auth-api")
public class TzsAuthController extends BaseController {
@Value("${tzs.auth.user.photo}")
String userPhoto;
@Autowired
TzsAuthService tzsAuthService;
@Autowired
TzsAuthService tzsAuthService;
@Autowired
TzsCitInfoServiceImpl citInfoService;
@Autowired
TzsCitInfoServiceImpl citInfoService;
/**
* 判断用户是否是管理员
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/isUserAdmin")
@ApiOperation(httpMethod = "GET", value = "判断用户是否是管理员", notes = "判断用户是否是管理员")
public ResponseModel<Boolean> isUserAdmin() {
Boolean flag = false;
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
LambdaQueryWrapper<TzsCitInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzsCitInfo::getCtiUserId, me.getUserId());
TzsCitInfo ctiInfo = citInfoService.getOne(wrapper);
if (!ValidationUtil.isEmpty(ctiInfo)) {
if ("班长".equals(ctiInfo.getUserRole())) {
flag = true;
}
}
return ResponseHelper.buildResponse(flag);
}
/**
* 判断用户是否是管理员
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/isUserAdmin")
@ApiOperation(httpMethod = "GET", value = "判断用户是否是管理员", notes = "判断用户是否是管理员")
public ResponseModel<Boolean> isUserAdmin() {
Boolean flag = false;
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
LambdaQueryWrapper<TzsCitInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzsCitInfo::getCtiUserId,me.getUserId());
TzsCitInfo ctiInfo = citInfoService.getOne(wrapper);
if(!ValidationUtil.isEmpty(ctiInfo)){
if("班长".equals(ctiInfo.getUserRole())){
flag = true;
}
}
return ResponseHelper.buildResponse(flag);
}
/**
* 获取用户regionCode
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserRegincode")
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<String>> getUserRegincode() {
List<String> regionList = tzsAuthService.getUserRegionCode();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
return ResponseHelper.buildResponse(regionList);
}
/**
* 获取用户regionCode
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserRegincode")
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<String>> getUserRegincode() {
List<String> regionList = tzsAuthService.getUserRegionCode();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
return ResponseHelper.buildResponse(regionList);
}
/**
* 获取用户组织机构树
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserReginTree")
@ApiOperation(httpMethod = "GET", value = "获取用户组织机构树", notes = "获取用户组织机构树")
public ResponseModel<Collection<RegionModel>> getUserReginTree() {
List<RegionModel> result = tzsAuthService.getUserReginTree();
return ResponseHelper.buildResponse(result);
}
/**
* 获取用户组织机构树
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserReginTree")
@ApiOperation(httpMethod = "GET", value = "获取用户组织机构树", notes = "获取用户组织机构树")
public ResponseModel<Collection<RegionModel>> getUserReginTree() {
List<RegionModel> result = tzsAuthService.getUserReginTree();
return ResponseHelper.buildResponse(result);
}
/**
* 获取用户组织机构树-到省市区级别三级
*
* @author LiuLin
* @date 2025-05-31
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getThreeUserReginTree")
@ApiOperation(httpMethod = "GET", value = "获取三级用户组织机构树", notes = "获取三级用户组织机构树")
public ResponseModel<Collection<RegionModel>> getThreeUserReginTree() {
List<RegionModel> result = tzsAuthService.getThreeUserReginTree();
return ResponseHelper.buildResponse(result);
}
@Value("${tzs.auth.user.photo}")
String userPhoto;
/**
* 获取用户监管机构
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserRegulator")
@ApiOperation(httpMethod = "GET", value = "获取用户组织机构树", notes = "获取用户组织机构树")
public ResponseModel<Map<String, Object>> getUserRegulator() {
Map<String, Object> map = new HashMap<>();
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.getme();
if (result.getResult() != null) {
List<CompanyModel> list = result.getResult().getCompanys();
if (list != null && !list.isEmpty()) {
CompanyModel company = list.get(0);
if ("company".equals(company.getLevel())) {
FeignClientResult<CompanyModel> cResult = Privilege.companyClient.seleteOne(company.getParentId());
if (cResult.getResult() != null) {
map.put("regulator", cResult.getResult().getCompanyName());
}
map.put("orgCode", cResult.getResult().getOrgCode() + "_" + cResult.getResult().getCompanyName());
} else {
map.put("regulator", company.getCompanyName());
map.put("orgCode", list.get(0).getOrgCode() + "_" + list.get(0).getCompanyName());
}
map.put("company", company.getCompanyName());
map.put("companyId", company.getParentId() != 0L ? company.getParentId() : company.getSequenceNbr());
map.put("USE_UNIT_NAME", list.get(0).getCompanyName());
map.put("USE_UNIT_CREDIT_CODE", list.get(0).getCompanyCode());
}
map.put("userName", result.getResult().getRealName());
map.put("userPhoto", userPhoto);
}
return ResponseHelper.buildResponse(map);
}
/**
* 获取用户监管机构
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserRegulator")
@ApiOperation(httpMethod = "GET", value = "获取用户组织机构树", notes = "获取用户组织机构树")
public ResponseModel<Map<String, Object>> getUserRegulator() {
Map<String, Object> map = new HashMap<>();
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.getme();
if (result.getResult() != null) {
List<CompanyModel> list = result.getResult().getCompanys();
if (list != null && !list.isEmpty()) {
CompanyModel company = list.get(0);
if ("company".equals(company.getLevel())) {
FeignClientResult<CompanyModel> cResult = Privilege.companyClient.seleteOne(company.getParentId());
if (cResult.getResult() != null) {
map.put("regulator", cResult.getResult().getCompanyName());
}
map.put("orgCode", cResult.getResult().getOrgCode() + "_" + cResult.getResult().getCompanyName());
} else {
map.put("regulator", company.getCompanyName());
map.put("orgCode", list.get(0).getOrgCode() + "_" + list.get(0).getCompanyName());
}
map.put("company", company.getCompanyName());
map.put("companyId", company.getParentId() != 0L ? company.getParentId() : company.getSequenceNbr());
map.put("USE_UNIT_NAME", list.get(0).getCompanyName());
map.put("USE_UNIT_CREDIT_CODE", list.get(0).getCompanyCode());
}
map.put("userName", result.getResult().getRealName());
map.put("userPhoto", userPhoto);
}
return ResponseHelper.buildResponse(map);
}
}
package com.yeejoin.amos.boot.module.cylinder.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.cylinder.api.dto.CylinderQuestionInfoDto;
import com.yeejoin.amos.boot.module.cylinder.api.entity.CylinderQuestionInfo;
import com.yeejoin.amos.boot.module.cylinder.api.mapper.CylinderQuestionInfoMapper;
import com.yeejoin.amos.boot.module.cylinder.api.service.ICylinderQuestionInfoService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
/**
* 问题信息列表服务实现类
*
* @author system_generator
* @date 2024-06-01
*/
@Service
public class CylinderQuestionInfoServiceImpl extends BaseService<CylinderQuestionInfoDto, CylinderQuestionInfo, CylinderQuestionInfoMapper> implements ICylinderQuestionInfoService {
/**
* 分页查询
*/
public Page<CylinderQuestionInfoDto> queryForCylinderQuestionInfoPage(Page<CylinderQuestionInfoDto> page, String questionType, @Condition(value = Operator.like) String regionCode) {
return this.queryForPage(page, "happen_date", true, questionType, regionCode);
}
}
\ No newline at end of file
......@@ -137,6 +137,68 @@ public class TzsAuthServiceImpl implements TzsAuthService {
return newTree;
}
@Override
public List<RegionModel> getThreeUserReginTree() {
List<String> regionList = this.getUserRegionCode();
//AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
startPlatformTokenService.getToken();
List<RegionModel> tree = (List<RegionModel>) Systemctl.regionClient.queryForTree(null).getResult();
// 循环list 将List 封装为 省市区 SET
Set<String> city = new HashSet<>();
Set<String> district = new HashSet<>();
for(String regionCode : regionList) {
// 判断是否是某个县
String districtCode = regionCode.substring(4,6);
if("00".equals(districtCode)) { // 为市
city.add(regionCode);
} else { // 为区
district.add(regionCode);
}
}
// 判断市区是否存在区域码的市,如果存在则移除区
Iterator<String> disIt = district.iterator();
while(disIt.hasNext()) {
String regionCode = disIt.next();
String tempCity = regionCode.substring(0,4) + "00";
if(city.contains(tempCity)) {
disIt.remove();
}
}
// 将tree 转换为K-V形式便于处理
Map<Integer, RegionModel> tempMap = new HashMap<Integer, RegionModel>();
RegionModel start = tree.get(0); // 省
filterAndMapRegions(tempMap,start);
List<RegionModel> newTree = new ArrayList<RegionModel>();
List<RegionModel> newCity = new ArrayList<RegionModel>();
// 如果管理市 取得整个市的数据 如果管理某个县 取得某市某县数据
Map<String, RegionModel> tempCityMap = new HashMap<String, RegionModel>();
for(String regionCode : district) {
// 先拿市 再封装新的城市
String cityCode = regionCode.substring(0,4) + "00";
RegionModel tempCity = tempCityMap.get(cityCode);
if(tempCity == null) {
List<RegionModel> tempDisList = new ArrayList<RegionModel>();
tempDisList.add(tempMap.get(Integer.parseInt(regionCode)));
tempCity = tempMap.get(Integer.parseInt(cityCode));
tempCity.setChildren(tempDisList);
tempCityMap.put(cityCode,tempCity);
} else {
List<RegionModel> tempDisList = (List<RegionModel>) tempCity.getChildren();
tempDisList.add(tempMap.get(Integer.parseInt(regionCode)));
}
}
for(String regionCode : city) {// 获取城市
newCity.add(tempMap.get(Integer.parseInt(regionCode)));
}
// 拼接城市
for(Map.Entry<String, RegionModel> entries : tempCityMap.entrySet()) {
newCity.add(entries.getValue());
}
//start.setChildren(newCity);
newTree.addAll(newCity);
return newTree;
}
private void setMap(Map<Integer, RegionModel> tempMap, RegionModel start) {
tempMap.put(start.getRegionCode(),start);
......@@ -146,9 +208,25 @@ public class TzsAuthServiceImpl implements TzsAuthService {
setMap(tempMap,temp);
}
}
}
private static void filterAndMapRegions(Map<Integer, RegionModel> tempMap, RegionModel start) {
// 先检查并过滤子节点
if (start.getChildren() != null) {
Iterator<RegionModel> iterator = start.getChildren().iterator();
while (iterator.hasNext()) {
RegionModel child = iterator.next();
if ("4".equals(child.getLevel().trim())) {
iterator.remove();
} else {
filterAndMapRegions(tempMap, child);
}
}
}
if (!"4".equals(start.getLevel().trim())) {
tempMap.put(start.getRegionCode(), start);
}
}
private void loginCtiUser() {
String passwd = DesUtil.encode(ctiUserPwd, "qaz");
......
......@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CityCylinderInfoDto;
import com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.*;
import com.yeejoin.amos.boot.module.cylinder.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.cylinder.api.entity.BaseUnitLicence;
......@@ -1330,6 +1331,21 @@ public class CylinderInfoController extends BaseController {
return ResponseHelper.buildResponse(map);
}
/**
* 地市气瓶,气站信息统计
*
* @author LiuLin
* @date 2025-05-31
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCityCylinderData")
@ApiOperation(httpMethod = "GET", value = "获取地市气瓶,气站信息统计", notes = "获取地市气瓶,气站信息统计")
public ResponseModel<Collection<CityCylinderInfoDto>> getCityCylinderData(@RequestParam( value="level") String level) {
List<CityCylinderInfoDto> result = cylinderInfoServiceImpl.getCityCylinderData(level);
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "某个企业充装次数及累计充装量统计")
@GetMapping(value = "/countFillingTimesAndQuantityByCompany")
......
package com.yeejoin.amos.boot.module.cylinder.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CommonVideoDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnit;
import com.yeejoin.amos.boot.module.cylinder.flc.api.service.ICylinderInfoService;
import com.yeejoin.amos.boot.module.cylinder.flc.api.service.ICylinderUnitVideoService;
import com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.CylinderUnitServiceImpl;
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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -22,8 +19,6 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -44,7 +39,7 @@ public class CylinderUnitController extends BaseController {
@Autowired
ICylinderInfoService iCylinderInfoService;
@Autowired
ICylinderUnitVideoService icylinderUnitVideoService;
ICylinderUnitVideoService icylinderUnitVideoService;
/**
......@@ -126,6 +121,8 @@ public class CylinderUnitController extends BaseController {
page.setSize(size);
return ResponseHelper.buildResponse(cylinderUnitServiceImpl.queryForCylinderUnitPage(page));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUnitVideoUrl")
@ApiOperation(httpMethod = "GET", value = "根据气瓶企业seq查询视频链接", notes = "根据气瓶企业seq查询视频链接")
......
......@@ -56,6 +56,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.IntConsumer;
import java.util.stream.Collectors;
/**
* 气瓶基本信息服务实现类
......@@ -813,6 +814,32 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
}
@Override
public List<CityCylinderInfoDto> getCityCylinderData(String level) {
List<RegionModel> result = Systemctl.regionClient.queryByLevel(level).getResult();
List<CityCylinderInfoDto> cylinderInfoDtoList = cylinderUnitServiceImpl.getCylinderDataByLevel(level);
Map<String, CityCylinderInfoDto> dtoMap = cylinderInfoDtoList.stream()
.collect(Collectors.toMap(CityCylinderInfoDto::getRegionCode, dto -> dto));
result.forEach(regionModel -> {
String regionCode = regionModel.getRegionCode()+"";
CityCylinderInfoDto dto = dtoMap.computeIfAbsent(regionCode, key -> {
CityCylinderInfoDto newDto = new CityCylinderInfoDto();
newDto.setRegionCode(regionCode);
newDto.setRegionName(regionModel.getRegionName());
newDto.setLatitude(regionModel.getLatitude());
newDto.setLongitude(regionModel.getLongitude());
cylinderInfoDtoList.add(newDto);
return newDto;
});
dto.setLatitude(regionModel.getLatitude());
dto.setLongitude(regionModel.getLongitude());
dto.setRegionName(regionModel.getRegionName());
});
return cylinderInfoDtoList;
}
@Override
public ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci) {
ESCylinderInfoDto esCylinderInfoDto = new ESCylinderInfoDto();
BeanUtils.copyProperties(ci, esCylinderInfoDto);
......
......@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.cylinder.api.entity.BaseUnitLicence;
import com.yeejoin.amos.boot.module.cylinder.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.BaseUnitLicenceServiceImpl;
import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.TzBaseEnterpriseInfoServiceImpl;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CityCylinderInfoDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.RegUnitIcDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnit;
......@@ -76,6 +77,10 @@ public class CylinderUnitServiceImpl extends BaseService<CylinderUnitDto, Cylind
return baseMapper.getThisMonthUnitTotalByRegionCode(regionCode);
}
public List<CityCylinderInfoDto> getCylinderDataByLevel(String level) {
return baseMapper.getCylinderDataByLevel(level);
}
public Integer getUnitTotalByRegionCode(String regionCode) {
return baseMapper.getUnitTotalByRegionCode(regionCode);
}
......
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