Commit ad673887 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents c3dced3f 123d45ca
......@@ -11,8 +11,8 @@ import lombok.Getter;
@AllArgsConstructor
public enum PowerStationProcessStateEnum {
进行中("进行中", "0", "progress"),
通过("通过", "1", "yes"),
不通过("不通过", "2", "no"),
通过("通过", "1", "0"),
不通过("不通过", "2", "1"),
完成("完成", "3", "complete"),
作废("作废", "4", "reject");
......
......@@ -76,4 +76,6 @@ public class PowerStationDto extends BaseDto {
@ApiModelProperty(value = "计划实例id")
private String planInstanceId;
@ApiModelProperty(value = "设计图纸审核")
private String drawingReview;
}
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
......@@ -27,157 +28,157 @@ public class DesignInformation extends BaseEntity {
/**
* 典型设计图信息
*/
@TableField(value = "typical_diagram",typeHandler = FastjsonTypeHandler.class)
@TableField(value = "typical_diagram",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
private List<Object> typicalDiagram;
/**
* 组件排布图
*/
@TableField(value = "component_layout",typeHandler = FastjsonTypeHandler.class)
@TableField(value = "component_layout",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
private List<Object> componentLayout;
/**
* 组件支架图
*/
@TableField(value = "component_bracket",typeHandler = FastjsonTypeHandler.class)
@TableField(value = "component_bracket",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
private List<Object> componentBracket;
/**
* 组串接线图
*/
@TableField(value = "connection_line",typeHandler = FastjsonTypeHandler.class)
@TableField(value = "connection_line",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
private List<Object> connectionLine;
/**
* 一次接线图
*/
@TableField(value = "once_line",typeHandler = FastjsonTypeHandler.class)
@TableField(value = "once_line",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
private List<Object> onceLine;
/**
* 组件
*/
@TableField(value = "assembly",typeHandler = FastjsonTypeHandler.class)
@TableField(value = "assembly",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
private List<Object> assembly;
/**
* 逆变器
*/
@TableField(value = "inverter",typeHandler = FastjsonTypeHandler.class)
@TableField(value = "inverter",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
private List<Object> inverter;
/**
* 电表箱
*/
@TableField(value = "electricity_meter",typeHandler = FastjsonTypeHandler.class)
@TableField(value = "electricity_meter",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
private List<Object> electricityMeter;
/**
* 支架
*/
@TableField(value = "support",typeHandler = FastjsonTypeHandler.class)
@TableField(value = "support",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
private List<Object> support;
/**
* 防滑雪措施
*/
@TableField("anti_skiing")
@TableField(value = "anti_skiing",updateStrategy = FieldStrategy.IGNORED)
private String antiSkiing;
/**
* 防滑雪措施备注
*/
@TableField("anti_skiing_notes")
@TableField(value = "anti_skiing_notes",updateStrategy = FieldStrategy.IGNORED)
private String antiSkiingNotes;
/**
* 抽检
*/
@TableField("spot_check")
@TableField(value = "spot_check",updateStrategy = FieldStrategy.IGNORED)
private String spotCheck;
/**
* 抽检意见
*/
@TableField("spot_check_opinion")
@TableField(value = "spot_check_opinion",updateStrategy = FieldStrategy.IGNORED)
private String spotCheckOpinion;
/**
* 是否定制
*/
@TableField("isok_customized")
@TableField(value = "isok_customized",updateStrategy = FieldStrategy.IGNORED)
private String isokCustomized;
/**
* 是否加固
*/
@TableField("wind_resistant")
@TableField(value = "wind_resistant",updateStrategy = FieldStrategy.IGNORED)
private String windResistant;
/**
* 试点方案
*/
@TableField("pilot_program")
@TableField(value = "pilot_program",updateStrategy = FieldStrategy.IGNORED)
private String pilotProgram;
/**
* s试点物料
*/
@TableField("pilot_materials")
@TableField(value = "pilot_materials",updateStrategy = FieldStrategy.IGNORED)
private String pilotMaterials;
/**
* 方位角
*/
@TableField("azimuth")
@TableField(value = "azimuth",updateStrategy = FieldStrategy.IGNORED)
private String azimuth;
/**
* 倾角
*/
@TableField("dip_angle")
@TableField(value = "dip_angle",updateStrategy = FieldStrategy.IGNORED)
private String dipAngle;
/**
* 应用场景
*/
@TableField("application_scenario")
@TableField(value = "application_scenario",updateStrategy = FieldStrategy.IGNORED)
private String applicationScenario;
/**
* 应用场景数量
*/
@TableField("application_scenario_num")
@TableField(value = "application_scenario_num",updateStrategy = FieldStrategy.IGNORED)
private Integer applicationScenarioNum;
/**
* 支架方案
*/
@TableField("support_scheme")
@TableField(value = "support_scheme",updateStrategy = FieldStrategy.IGNORED)
private String supportScheme;
/**
* 支架方案数量
*/
@TableField("support_scheme_num")
@TableField(value = "support_scheme_num",updateStrategy = FieldStrategy.IGNORED)
private Integer supportSchemeNum;
/**
* 特殊方案
*/
@TableField("special_plan")
@TableField(value = "special_plan",updateStrategy = FieldStrategy.IGNORED)
private String specialPlan;
/**
* 特殊方案数量
*/
@TableField("special_plan_num")
@TableField(value = "special_plan_num",updateStrategy = FieldStrategy.IGNORED)
private Integer specialPlanNum;
/**
* 农户id
*/
@TableField("peasant_household_id")
@TableField(value = "peasant_household_id",updateStrategy = FieldStrategy.IGNORED)
private String peasantHouseholdId;
}
......@@ -127,4 +127,8 @@ public class PowerStation extends BaseEntity {
*/
@TableField("plan_instance_id")
private String planInstanceId;
@TableField("drawing_review")
private String drawingReview;
}
......@@ -16,9 +16,10 @@ public interface IPowerStationService {
/**
* 保存审核实例
* @param powerStation 审核对象
* @param flag 是否是最后一个节点
* @return 状态
*/
boolean savePowerStation(PowerStation powerStation);
boolean savePowerStation(PowerStation powerStation, boolean flag);
/**
......
......@@ -3,13 +3,19 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PowerStationServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
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 com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -96,12 +102,15 @@ public class PowerStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询")
public ResponseModel<Page<PowerStationDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) {
public ResponseModel<Page<PowerStationDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "powerStationCode",required = false)String powerStationCode,
@RequestParam(value = "ownersName",required = false)String ownersName) {
Page<PowerStationDto> page = new Page<PowerStationDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(powerStationServiceImpl.queryForPowerStationPage(page));
AgencyUserModel userInfo = getUserInfo();
return ResponseHelper.buildResponse(powerStationServiceImpl.queryForPowerStationUserRoles(page,powerStationCode,ownersName,userInfo));
}
/**
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationNodeEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.DesignInformation;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStation;
import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService;
import com.yeejoin.amos.boot.module.hygf.api.mapper.DesignInformationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IPowerStationService;
import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import lombok.extern.slf4j.Slf4j;
import net.sf.cglib.beans.BeanMap;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import springfox.documentation.service.ApiListing;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -51,20 +53,38 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
IPowerStationService powerStationService;
@Autowired
DesignInformationMapper designInformationMapper;
@Autowired
DesignInformationServiceImpl designInformationService;
private static final String IDX_REQUEST_STATE="200";
private static final String VERIFY_RESULT_YES="yes";
private static final String VERIFY_RESULT_NO="no";
private static final String VERIFY_RESULT_YES="0";
private static final String VERIFY_RESULT_NO="1";
@Autowired
WorkflowFeignClient workflowFeignClient;
public Page<PowerStationDto> queryForPowerStationUserRoles(Page<PowerStationDto> page, String powerStationCode, String ownersName, AgencyUserModel userInfo){
String serviceAgent = "";
Map<Long, List<RoleModel>> orgRoles = userInfo.getOrgRoles();
Collection<List<RoleModel>> roleModels = orgRoles.values();
if(roleModels !=null){
List<String> roleTypes = new ArrayList<>();
Iterator<List<RoleModel>> iterator = roleModels.iterator();
while (iterator.hasNext()){
List<RoleModel> next = iterator.next();
roleTypes.addAll(next.stream().map(RoleModel::getRoleType).collect(Collectors.toList()));
}
if(roleTypes.size()>0){
serviceAgent = !roleTypes.contains("HYGFGLY") ? roleTypes.contains("HYGFJXS") ? userInfo.getCompanys().get(0).getCompanyName() : null : null ;
}
}
return this.queryForPowerStationPage(page,powerStationCode,ownersName,serviceAgent);
}
/**
* 分页查询
*/
public Page<PowerStationDto> queryForPowerStationPage(Page<PowerStationDto> page) {
return this.queryForPage(page, null, false);
public Page<PowerStationDto> queryForPowerStationPage(Page<PowerStationDto> page,@Condition(Operator.like) String powerStationCode,@Condition(Operator.like) String ownersName,String serviceAgent) {
return this.queryForPage(page, null, false,powerStationCode,ownersName,serviceAgent);
}
/**
......@@ -77,23 +97,20 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
@Override
@Transactional
public boolean savePowerStation(PowerStation powerStation) {
try{ //流程节点code
String flowTaskIdnext=this.getTaskNoAuth(powerStation.getProcessInstanceId());
public boolean savePowerStation(PowerStation powerStation, boolean flag) {
try{
//流程节点code
if (flag) {
String flowTaskIdnext = this.getTaskNoAuth(powerStation.getProcessInstanceId());
WorkDto workDto=this.getNodeInfoCode(flowTaskIdnext);
powerStation.setNextProcessNode(workDto.getNextProcessNode());
powerStation.setNodeRole(workDto.getNodeRole());
powerStation.setNodeRouting(workDto.getNodeRouting());
}
return this.saveOrUpdate(powerStation);
}catch (Exception e){
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!");
}
}
@Override
......@@ -110,12 +127,11 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
// 1. 业务相关数据落表
PowerStation powerStation = this.baseMapper.selectById(stationId);
PowerStationNodeEnum nodeByCode = PowerStationNodeEnum.getNodeByCode(nodeCode);
boolean flag = true;
if (PowerStationNodeEnum.设计上传图纸.getCode().equals(nodeCode)||PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) {
this.updateSeve(powerStation.getPeasantHouseholdId(),kv);
} else {
String result = String.valueOf(kv.get("VERIFY_RESULT"));
String result = String.valueOf(kv.get("approvalStatue"));
if (VERIFY_RESULT_NO.equals(result)) {
powerStation.setProcessStatus(PowerStationProcessStateEnum.不通过.getName());
}
......@@ -132,8 +148,10 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
break;
case 文件审核:
if (VERIFY_RESULT_YES.equals(result)) {
flag = false;
powerStation.setProcessStatus(PowerStationProcessStateEnum.完成.getName());
}
powerStation.setDrawingReview(resultObj.getName());
break;
default:
break;
......@@ -154,15 +172,8 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
JSONObject resultObj = record.getResult();
String flowTaskId = String.valueOf(resultObj.get("flowTaskId"));
powerStation.setFlowTaskId(flowTaskId);
//流程节点code
String flowTaskIdnext=this.getTaskNoAuth(planInstanceId);
WorkDto workDto=this.getNodeInfoCode(flowTaskIdnext);
powerStation.setNextProcessNode(workDto.getNextProcessNode());
powerStation.setNodeRole(workDto.getNodeRole());
powerStation.setNodeRouting(workDto.getNodeRouting());
}
powerStationService.savePowerStation(powerStation);
powerStationService.savePowerStation(powerStation, flag);
}
}catch (Exception e){
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!");
......@@ -235,10 +246,15 @@ public void updateSeve(String peasantHouseholdId, Map<String, Object> kv ){
designInformationnew.setTypicalDiagram(designInformation.getTypicalDiagram());
designInformationnew.setPeasantHouseholdId(peasantHouseholdId);
designInformationnew.setSequenceNbr(designInformation.getSequenceNbr());
designInformationnew.setRecDate(designInformation.getRecDate());
designInformationnew.setRecUserId(designInformation.getRecUserId());
designInformationnew.setRecUserName(designInformation.getRecUserName());
designInformationnew.setIsDelete(designInformation.getIsDelete());
designInformationMapper.updateById(designInformationnew);
}else{
DesignInformation designInformationnew=this.mapToBean(kv,DesignInformation.class);
DesignInformation designInformationnew=new DesignInformation();
designInformationnew.setTypicalDiagram((List<Object>)kv.get("typicalDiagram")) ;
designInformationnew.setPeasantHouseholdId(peasantHouseholdId);
designInformationMapper.insert(designInformationnew);
......@@ -248,11 +264,12 @@ public void updateSeve(String peasantHouseholdId, Map<String, Object> kv ){
public <T> T mapToBean(Map<String, Object> map, Class<T> clazz) {
ObjectMapper objectMapper= new ObjectMapper();
T bean =null;
try {
bean = clazz.newInstance();
BeanMap beanMap = BeanMap.create(bean);
beanMap.putAll(map);
bean = objectMapper.convertValue(map,clazz);
}catch (Exception e){
throw new BaseException(" 数据转化异常!","400","数据转化异常!");
......@@ -261,5 +278,8 @@ public void updateSeve(String peasantHouseholdId, Map<String, Object> kv ){
}
// private CollectionToList(Collection<? extends E> c){
// Object[] objects = c.toArray();
// }
}
\ No newline at end of file
......@@ -233,7 +233,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
powerStation.setFlowTaskId(flowTaskId);
powerStation.setNextProcessNode(PowerStationNodeEnum.设计审核.getCode());
}
powerStationService.savePowerStation(powerStation);
powerStationService.savePowerStation(powerStation, true);
}
} catch (Exception e){
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!");
......
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.util.List;
@Data
public class StationRecordInfo {
......@@ -40,4 +41,6 @@ public class StationRecordInfo {
@ApiModelProperty(value = "风险等级")
private String riskLevel;
@ApiModelProperty(value = "场站坐标偏移量")
private String titlePos;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationCoordinateDto;
import io.swagger.annotations.ApiModelProperty;
......@@ -20,7 +21,7 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("station_basic")
@TableName(value = "station_basic",autoResultMap = true)
public class StationBasic extends BaseEntity {
private static final long serialVersionUID = 1L;
......@@ -139,8 +140,6 @@ public class StationBasic extends BaseEntity {
@TableField(exist =false)
private List<StationCoordinate> stationCoordinate;
//新增 场站第三方编号
@TableField("station_number")
private String stationNumber;
......@@ -150,6 +149,7 @@ public class StationBasic extends BaseEntity {
//升压站网管
@TableField("booster_gateway_id")
private String boosterGatewayId;
//地图偏移量
@TableField(value = "title_pos",typeHandler = FastjsonTypeHandler.class)
private List<Double> titlePos;
}
......@@ -44,4 +44,6 @@ public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicato
Map<String, String> getMajorBoosterStationInfoBySort(@Param("gatewayId") String gatewayId,
@Param("sort") String sort);
List<Map<String, String>> getBoosterStationInfo2(@Param("gatewayId") String boosterGatewayId);
}
......@@ -112,6 +112,47 @@
ORDER BY sort ASC
</select>
<select id="getBoosterStationInfo2" resultType="java.util.Map">
select * from
((select
`sequence_nbr` as id,
`gateway_id` as gatewayId,
`booster_name` as text,
booster_name as boosterName,
`booster_code` as boosterCode,
`sort` as value
from booster_station_info
<where>
sort != 2
<if test="gatewayId != null and gatewayId != ''">
AND gateway_id = #{gatewayId}
</if>
<!-- <if test="sort != null and sort != ''">-->
<!-- AND sort = #{sort}-->
<!-- </if>-->
<!-- <if test="boosterName != null and boosterName != '' and (sort = null or sort = '')">-->
<!-- AND booster_name = #{boosterName}-->
<!-- </if>-->
</where>)
union all
(select
'99999' as id,
`gateway_id` as gatewayId,
'1主变' as text,
'1主变' as boosterName,
'2' as boosterCode,
2 as value
from booster_station_info
<where>
<if test="gatewayId != null and gatewayId != ''">
AND gateway_id = #{gatewayId}
</if>
</where>
limit 1)) a
ORDER BY a.value ASC
</select>
<select id="getMajorBoosterStationInfo" resultType="java.util.Map">
select
`sequence_nbr` as id,
......
......@@ -114,6 +114,7 @@
station_basic.station_flag stationFlag,
station_basic.area_code areaCode,
station_basic.jump_path,
station_basic.title_pos titlePos,
station_basic.risk_level riskLevel,
station_basic.belong_area belongArea,
station_coordinate.longitude,
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationCoordinateDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationInfoDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationRecordInfo;
......@@ -320,8 +322,13 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio
if (stationRecordInfo.getBelongArea() != null) {
stationInfoDto.setRegion(this.getProviceName(stationRecordInfo.getBelongArea()));
}
ArrayList<Double> arrayList = MapUtils.geoTo3d(Double.valueOf(stationRecordInfo.getLongitude()), Double.valueOf(stationRecordInfo.getLaitude()));
stationInfoDto.setTitlePos(arrayList);
// ArrayList<Double> arrayList = MapUtils.geoTo3d(Double.valueOf(stationRecordInfo.getLongitude()), Double.valueOf(stationRecordInfo.getLaitude()));
String []original = stationRecordInfo.getTitlePos().replace("[","").replace("]","").split(",");
ArrayList<Double> doubleList = new ArrayList<>();
for (String s : original) {
doubleList.add(Double.parseDouble(s));
}
stationInfoDto.setTitlePos(doubleList);
stationInfoDto.setIndicatorData(indicatorList);
stationInfoDto.setRiskLevel(stationRecordInfo.getRiskLevel());
stationInfoDtoList.add(stationInfoDto);
......
......@@ -398,11 +398,12 @@ public class MonitorFanIdxController extends BaseController {
@GetMapping("/getByStationId")
public ResponseModel<IPage<StationBasic>> getByStationId(@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic oneByStationNumber = monitorFanIndicator.getOneByStationNumber(stationId);
oneByStationNumber.setTitlePos(null);
List<StationBasic> stationBasics = Collections.singletonList(oneByStationNumber);
IPage<StationBasic> result = new Page<>();
result.setRecords(stationBasics);
result.setCurrent(1);
result.setTotal(stationBasics.size());
result.setTotal(1);
return ResponseHelper.buildResponse(result);
}
......@@ -416,7 +417,7 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(resultsData);
}
// @Scheduled(cron = "0/10 * * * * ? ")
// @Scheduled(cron = "0/15 * * * * ? ")
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "模拟量列表消息")
@GetMapping("/getAnalogQuantityInfo")
......@@ -430,7 +431,7 @@ public class MonitorFanIdxController extends BaseController {
return CommonResponseUtil.success();
}
// @Scheduled(cron = "0/10 * * * * ? ")
// @Scheduled(cron = "0/15 * * * * ? ")
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "升压站主屏消息接口")
@GetMapping("/getMajorAnalogQuantityByPage")
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
......@@ -30,7 +31,10 @@ 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.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Handler;
@RestController
@Api(tags = "监盘地图接口")
......@@ -40,14 +44,14 @@ public class MonitoringMapController extends BaseController {
@Autowired
MonitoringServiceImpl monitoringServiceImpl;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取监盘全国地图数据")
@GetMapping("/nationwide")
public ResponseModel<List<RegionNationWideDto>> getNationWideInfo(@RequestParam (value = "provinceName", required = false)String provinceName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取区域电量指标完成情况")
@GetMapping("/getCompletionOfPowerIndicatorsByProvinceName")
public ResponseModel<ResultsData> getCompletionOfPowerIndicatorsByProvinceName(@RequestParam(required = true) int current, @RequestParam(required = true) int size, @RequestParam(required = true) String provinceName) {
......@@ -61,15 +65,55 @@ public class MonitoringMapController extends BaseController {
return ResponseHelper.buildResponse(monitoringServiceImpl.getTabsByStationBasicId(stationBasicId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "首页地图-获取片区信息")
@ApiOperation(value = "监盘首页地图-全国")
@GetMapping("/getAreaInfo")
public ResponseModel<List<MapAreaInfoDto>> getAreaInfo() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getAreaInfo());
}
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "地图首页接口")
// @GetMapping("/getMapInfoByAreaName")
// public ResponseModel<List<RegionNationWideDto>> getMapInfo(@RequestParam (value = "areaName", required = false)String areaName) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName));
// }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页地图-片区")
@GetMapping("/getStaitonListInfoByAreaName")
public ResponseModel<List<HomeMapStationInfoDto>> getStaitonListInfoByAreaName(@RequestParam(required = true)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getStaitonListInfoByAreaName(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-场站分类信息")
@GetMapping("/getStaionCategoryInfo")
public ResponseModel<List<Map<String,String>>> getStaionCategoryInfo(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getStaionCategoryInfo(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-装机容量")
@GetMapping("/getInstallCapityByAreaName")
public ResponseModel<HashMap<String,String>> getInstallCapityByAreaName(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getInstallCapityByAreaName(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-有功功率")
@GetMapping("/getActivePowerByAreaName")
public ResponseModel<HashMap<String,String>> getActivePowerByAreaName(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getActivePowerByAreaName(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-社会贡献")
@GetMapping("/getSocialContributionDtoList")
public ResponseModel<Page<SocialContributionDto>> getSocialContributionDtoList(@RequestParam(required = false)String areaName, @RequestParam(required = false)String station) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getSocialContributionDtoList(areaName,station));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-发电量趋势")
@GetMapping("/getPowerGenerationTrends")
public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrends(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrends(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-发电量详情")
@GetMapping("/getDetailsOnPowergeneration")
public ResponseModel<Page<HashMap<String,String>>> getDetailsOnPowergeneration(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getDetailsOnPowergeneration(areaName));
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class HomeMapStationInfoDto {
//场站id
String stationId;
//当前功率
String currentPower = "0";
//风速辐照度
String speendOrirradiate;
//场站类型
String stationType;
//场站装机容量
String stationInstalledCapacity;
//场站经纬度
List<String> stationPosition;
}
......@@ -3,19 +3,28 @@ package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class MapAreaInfoDto {
//片区省份
List<String> province;
//经纬度
List<String> position;
//片区名称
String areaName;
//片区code
String areaCode;
//风电站数量
String windPowerStationCount = "0";
//集中式光伏电站数量
String centralizedPhotovoltaicStationCount = "0";
//分布式光伏电站数量
String distributedPhotovoltaicStationCount = "0";
//储能电站数量
String energyStorageStationCount = "0";
//装机容量
String installedCapacity = "0";
//当日发电量
String electricityGenerationOfDay = "0";
}
......@@ -7,7 +7,7 @@ public class SocialContributionDto {
/**
* 社会贡献值
*/
private Double title;
private String title;
/**
* 贡献单位
*/
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service
......@@ -30,7 +36,7 @@ public class CommonServiceImpl {
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql,IndicatorsDto.class);
List<Double> doubleList = indicatorsDtoList.stream().map(indicatorsDto -> Double.parseDouble(indicatorsDto.getValue())).collect(Collectors.toList());
totalvalue = doubleList.stream().mapToDouble(Double::doubleValue).sum();
return totalvalue;
return Double.valueOf(String.format("%.2f",totalvalue));
}
/**
* @deprecated 获取指标值平均值
......@@ -44,10 +50,47 @@ public class CommonServiceImpl {
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql,IndicatorsDto.class);
List<Double> doubleList = indicatorsDtoList.stream().map(indicatorsDto -> Double.parseDouble(indicatorsDto.getValue())).collect(Collectors.toList());
avageValue = doubleList.stream().mapToDouble(Double::doubleValue).average().getAsDouble();
return avageValue;
return Double.valueOf(String.format("%.2f",avageValue));
}
public Double getStationCapactityByStationWerks(String WERKS){
return sjglZsjZsbtzMapper.getStationCapactityByStationWerks(WERKS);
}
public Page<SocialContributionDto> getSocialContributionDtoList(Double totalSocialContribution){
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
//获取所有网关id不为空的数据
//二氧化碳贡献数
SocialContributionDto co2 = new SocialContributionDto();
//标准煤贡献度
SocialContributionDto coal = new SocialContributionDto();
//碳粉尘计算公式
SocialContributionDto toner = new SocialContributionDto();
//二氧化硫贡献度
SocialContributionDto so2 = new SocialContributionDto();
/** 社会贡献原始计算公式,后边的数据已经经过处理
//二氧化碳计算公式 *10000*832/10000/1000/1000
//标准煤计算公式 *10000*304.9/10000/1000/1000
//碳粉尘计算公式 *10000*0.032/1000/1000
//二氧化硫计算公式 =A2*10000*0.16/1000/1000
*/
co2.setUnit("二氧化碳减排量(万t)");
co2.setTitle(String.format("%.2f",totalSocialContribution * 0.000832));
socialContributionDtoList.add(co2);
coal.setUnit("节约标准煤(万t)");
coal.setTitle(String.format("%.2f",totalSocialContribution * 0.0003049));
socialContributionDtoList.add(coal);
toner.setUnit("碳粉尘减排量(万t)");
toner.setTitle(String.format("%.2f",totalSocialContribution * 0.00032));
socialContributionDtoList.add(toner);
so2.setUnit("二氧化硫减排量(万t)");
so2.setTitle(String.format("%.2f",totalSocialContribution * 0.0016));
socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
socialContributionDtoPage.setCurrent(1);
return socialContributionDtoPage;
}
}
......@@ -782,7 +782,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public List<Map<String, String>> getBoosterStationInfo(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfo(stationBasic.getBoosterGatewayId());
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfo2(stationBasic.getBoosterGatewayId());
// List<Map<String, String>> value = boosterStationInfo.stream().filter(item -> !"2".equals(item.get("value"))).collect(Collectors.toList());
// HashMap<String, String> stringStringHashMap = new HashMap<>();
// stringStringHashMap.put();
return boosterStationInfo;
}
......@@ -1009,6 +1014,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
resultMap.put("1svg", "1SVG");
resultMap.put("2svg", "2SVG");
resultMap.put("xzsvg", "夏造 SVG");
resultMap.put("xzaggavc", "夏造 AGGAVC");
resultMap.put("xzgyxh", "夏造 公用信号");
resultMap.put("xzjzlp", "夏造 交直流屏");
//下方重复列表数据
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getMajorBoosterStationInfo(gatewayId, "ASC", 10);
ArrayList<Map<String, String>> resultList = new ArrayList<>();
......@@ -1039,7 +1049,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
// 开关信息
Map<String, Object> switchUrl = getSwitchUrl(gatewayId, null);
BeanUtils.copyProperties(switchUrl, resultMap);
resultMap.putAll(switchUrl);
List<Map<String, Object>> finallyResultList = Collections.singletonList(resultMap);
// 主屏下方重复列表数据
......
......@@ -104,16 +104,16 @@ public class MonitoringServiceIMQTTmpl {
//二氧化硫计算公式 =A2*10000*0.16/1000/1000
*/
co2.setUnit("二氧化碳减排量(万t)");
co2.setTitle(totalSocialContribution.get() * 0.000832);
co2.setTitle(String.format("%.2f",totalSocialContribution.get() * 0.000832));
socialContributionDtoList.add(co2);
coal.setUnit("节约标准煤(万t)");
coal.setTitle(totalSocialContribution.get() * 0.0003049);
coal.setTitle(String.format("%.2f",totalSocialContribution.get() * 0.0003049));
socialContributionDtoList.add(coal);
toner.setUnit("碳粉尘减排量(万t)");
toner.setTitle(totalSocialContribution.get() * 0.00032);
toner.setTitle(String.format("%.2f",totalSocialContribution.get() * 0.00032));
socialContributionDtoList.add(toner);
so2.setUnit("二氧化硫减排量(万t)");
so2.setTitle(totalSocialContribution.get() * 0.0016);
so2.setTitle(String.format("%.2f",totalSocialContribution.get() * 0.0016));
socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
......@@ -143,7 +143,7 @@ public class MonitoringServiceIMQTTmpl {
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
//年发电量完成比例
Double completionRatio = 23.11;
String completionRatio = "23.11";
//年利用小时数
AtomicReference<Double> useHours = new AtomicReference<>(0.01);
stationBasicList.forEach(stationBasic -> {
......@@ -153,19 +153,19 @@ public class MonitoringServiceIMQTTmpl {
useHours.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日工作时间"));
});
SocialContributionDto dailyPowerdto = new SocialContributionDto();
dailyPowerdto.setTitle(dailyPower.get());
dailyPowerdto.setTitle(String.format("%.2f",dailyPower.get()));
dailyPowerdto.setUnit("万kWh");
SocialContributionDto monthlyPowerdto = new SocialContributionDto();
monthlyPowerdto.setTitle(monthlyPower.get());
monthlyPowerdto.setTitle(String.format("%.2f",monthlyPower.get()));
monthlyPowerdto.setUnit("万kWh");
SocialContributionDto annualPowerdto = new SocialContributionDto();
annualPowerdto.setTitle(annualPower.get());
annualPowerdto.setTitle(String.format("%.2f",annualPower.get()));
annualPowerdto.setUnit("万kWh");
SocialContributionDto completionRatioDto = new SocialContributionDto();
completionRatioDto.setTitle(completionRatio);
completionRatioDto.setUnit("%");
SocialContributionDto useHoursDto = new SocialContributionDto();
useHoursDto.setTitle(useHours.get());
useHoursDto.setTitle(String.format("%.2f",useHours.get()));
useHoursDto.setUnit("h");
socialContributionDtoList.add(dailyPowerdto);
socialContributionDtoList.add(monthlyPowerdto);
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
......@@ -10,17 +12,19 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service
......@@ -55,6 +59,9 @@ public class MonitoringServiceImpl {
@Autowired
MapRegionMapper mapRegionMapper;
@Autowired
EmqKeeper emqKeeper;
/**
* 根据场站编号获取该场站的装机容量
......@@ -63,7 +70,9 @@ public class MonitoringServiceImpl {
* @return
*/
public Double getStationCaPACITYL(String werks) {
return this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity;
}
/**
......@@ -102,10 +111,10 @@ public class MonitoringServiceImpl {
regionNationWideDto.setGuangfuMW("0");
regionNationWideDto.setFengdianMV("0");
if (!ObjectUtils.isEmpty(guangfuMW.get())) {
regionNationWideDto.setGuangfuMW(guangfuMW.toString());
regionNationWideDto.setGuangfuMW(String.format("%.2f", guangfuMW.get()));
}
if (!ObjectUtils.isEmpty(fengdianMW.get())) {
regionNationWideDto.setFengdianMV(fengdianMW.toString());
regionNationWideDto.setFengdianMV(String.format("%.2f", fengdianMW.get()));
}
regionNationWideDto.setName(region.getRegionName());
regionNationWideDtoList.add(regionNationWideDto);
......@@ -142,20 +151,33 @@ public class MonitoringServiceImpl {
regionNationWideDto.setPosition(hashMap);
regionNationWideDtoList.add(regionNationWideDto);
}
String provinceNameTopic = "";
if (provinceName.contains("黑龙江") || provinceName.contains("内蒙古")) {
provinceNameTopic = provinceName.substring(0, 3);
} else {
provinceNameTopic = provinceName.substring(0, 2);
}
HashMap<String,String> stringHashMap =new HashMap<>();
stringHashMap.put("title",provinceNameTopic+"区域");
try {
emqKeeper.getMqttClient().publish("proviceName_topic",JSON.toJSON(stringHashMap).toString().getBytes("UTF-8"), 1, true);
logger.info("----------------------------------推送省份名称消息成功败--------------------------------");
} catch (Exception e) {
logger.info("----------------------------------推送省份名称消息失败--------------------------------");
}
getCompletionOfPowerIndicatorsByCurrentData(provinceName);
}
return regionNationWideDtoList;
}
public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) {
Region region = this.regionMapper.selectOne(new QueryWrapper<Region>().eq("level", 1).eq("region_name", provinceName));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
List<ColModel> colModels = new ArrayList<>();
List<CompletionOfPowerIndicatorsDto> completionOfPowerIndicatorsDtoList = new ArrayList<>();
ColModel colModelStatitonName = new ColModel("stationName", "stationName", "场站", "场站", "dataGrid", "stationName");
ColModel colModelInstallCapactity = new ColModel("installCapactity", "installCapactity", "装机容量", "装机容量", "dataGrid", "installCapactity");
ColModel colModelWindSpeedOrIrradiance = new ColModel("windSpeedOrIrradiance", "windSpeedOrIrradiance", "风度/辐照度", "风度/辐照度", "dataGrid", "windSpeedOrIrradiance");
ColModel colModelWindSpeedOrIrradiance = new ColModel("windSpeedOrIrradiance", "windSpeedOrIrradiance", "风速/辐照度", "风速/辐照度", "dataGrid", "windSpeedOrIrradiance");
ColModel colModelActivePower = new ColModel("activePower", "activePower", "有功", "有功", "dataGrid", "activePower");
ColModel colModelDailyPower = new ColModel("dailyPower", "dailyPower", "日发电量", "日发电量", "dataGrid", "dailyPower");
ColModel colModelMonthlyPower = new ColModel("monthlyPower", "monthlyPower", "月发电量", "月发电量", "dataGrid", "monthlyPower");
......@@ -167,13 +189,15 @@ public class MonitoringServiceImpl {
colModels.add(colModelDailyPower);
colModels.add(colModelMonthlyPower);
colModels.add(colModelAnnualPower);
Region region = this.regionMapper.selectOne(new QueryWrapper<Region>().eq("level", 1).eq("region_name", provinceName));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
//遍历列表
stationBasicList.forEach(stationBasic -> {
CompletionOfPowerIndicatorsDto completionOfPowerIndicatorsDto = new CompletionOfPowerIndicatorsDto();
completionOfPowerIndicatorsDto.setStationName(stationBasic.getStationName());
completionOfPowerIndicatorsDto.setInstallCapactity("0");
if (getStationCaPACITYL(stationBasic.getStationNumber()) != null) {
completionOfPowerIndicatorsDto.setInstallCapactity(String.valueOf(getStationCaPACITYL(stationBasic.getStationNumber())));
completionOfPowerIndicatorsDto.setInstallCapactity(String.format("%.2f", getStationCaPACITYL(stationBasic.getStationNumber())));
}
try {
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速")));
......@@ -196,7 +220,58 @@ public class MonitoringServiceImpl {
return resultsData;
}
public void getCompletionOfPowerIndicatorsByCurrentData(String provinceName) {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------");
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
Region region = this.regionMapper.selectOne(new QueryWrapper<Region>().eq("level", 1).eq("region_name", "江西省"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()).isNotNull("fan_gateway_id"));
//日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
//年发电量完成比例
String completionRatio = "23.11";
//年利用小时数
AtomicReference<Double> useHours = new AtomicReference<>(0.01);
stationBasicList.forEach(stationBasic -> {
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "年发电量"));
useHours.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日工作时间"));
});
SocialContributionDto dailyPowerdto = new SocialContributionDto();
dailyPowerdto.setTitle(String.format("%.2f",dailyPower.get()));
dailyPowerdto.setUnit("万kWh");
SocialContributionDto monthlyPowerdto = new SocialContributionDto();
monthlyPowerdto.setTitle(String.format("%.2f",monthlyPower.get()));
monthlyPowerdto.setUnit("万kWh");
SocialContributionDto annualPowerdto = new SocialContributionDto();
annualPowerdto.setTitle(String.format("%.2f",annualPower.get()));
annualPowerdto.setUnit("万kWh");
SocialContributionDto completionRatioDto = new SocialContributionDto();
completionRatioDto.setTitle(completionRatio);
completionRatioDto.setUnit("%");
SocialContributionDto useHoursDto = new SocialContributionDto();
useHoursDto.setTitle(String.format("%.2f",useHours.get()));
useHoursDto.setUnit("h");
socialContributionDtoList.add(dailyPowerdto);
socialContributionDtoList.add(monthlyPowerdto);
socialContributionDtoList.add(annualPowerdto);
socialContributionDtoList.add(completionRatioDto);
socialContributionDtoList.add(useHoursDto);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
socialContributionDtoPage.setCurrent(1);
try {
emqKeeper.getMqttClient().publish("completionofpowerindicator_topic", JSON.toJSON(socialContributionDtoPage).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送区域实时生产数据消息=================== 成功!" + JSON.toJSONString(socialContributionDtoPage));
} catch (Exception exception) {
logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
}
}
public List<TabDto> getTabsByStationBasicId(String stationBasicId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
List<TabDto> tabDtoList = new ArrayList<>();
......@@ -236,9 +311,9 @@ public class MonitoringServiceImpl {
public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>();
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
mapRegionList.forEach(mapRegion -> {
List<StationBasic> stationBasicListAll = new ArrayList<>();
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
//开始处理省份名称-三维与二维的名称有差异
ArrayList<String> stringArrayList = mapRegion.getProvince();
......@@ -249,7 +324,6 @@ public class MonitoringServiceImpl {
stationBasicListAll.addAll(stationBasicList);
}
mapAreaInfoDto.setProvince(stringArrayList);
System.out.println(stationBasicListAll);
// --------------------省份名称处理结束----------------------------
//设置片区名称
mapAreaInfoDto.setAreaName(mapRegion.getName());
......@@ -270,9 +344,56 @@ public class MonitoringServiceImpl {
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
return mapAreaInfoDtoList;
}
public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) {
List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>();
//根据areaName获取area信息
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stringArrayList.set(i, region.getRegionName());
stationBasicListAll.addAll(stationBasicList);
}
if (!stationBasicListAll.isEmpty()) {
Map<String, String> map = new HashMap<>();
stationBasicListAll.forEach(stationBasic -> {
HomeMapStationInfoDto homeMapStationInfoDto = new HomeMapStationInfoDto();
//设置场站id
homeMapStationInfoDto.setStationId(String.valueOf(stationBasic.getSequenceNbr()));
//设置场站类型
homeMapStationInfoDto.setStationType(stationBasic.getStationType());
//设置装机容量
homeMapStationInfoDto.setStationInstalledCapacity(String.format("%.2f", getStationCaPACITYL(stationBasic.getStationNumber())));
//设置风速辐照度
String speendOrirradiate = "";
if (stationBasic.getStationType().equals("FDZ")) {
speendOrirradiate = String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速"));
homeMapStationInfoDto.setSpeendOrirradiate(speendOrirradiate);
} else {
homeMapStationInfoDto.setSpeendOrirradiate(String.valueOf(Math.random() * 100));
}
StationCoordinate stationCoordinate = stationCoordinateMapper.selectOne(new QueryWrapper<StationCoordinate>().eq("station_id", stationBasic.getSequenceNbr()).eq("is_main_coordinate", 0));
//获取场站经纬度
List<String> list = new ArrayList<>();
list.add(stationCoordinate.getLongitude());
list.add(stationCoordinate.getLaitude());
homeMapStationInfoDto.setStationPosition(list);
//设置当前功率
homeMapStationInfoDto.setCurrentPower("0");
homeMapStationInfoDtoList.add(homeMapStationInfoDto);
});
}
return homeMapStationInfoDtoList;
}
public String getInstallCapity(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
......@@ -284,7 +405,7 @@ public class MonitoringServiceImpl {
}
}
});
return String.format("%.2f",total.get());
return String.format("%.2f", total.get());
}
public String getPowerOfDaily(List<StationBasic> stationBasicList) {
......@@ -299,7 +420,172 @@ public class MonitoringServiceImpl {
}
});
return String.format("%.2f",total.get());
return String.format("%.2f", total.get());
}
public List<Map<String, String>> getStaionCategoryInfo(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
List<Map<String, String>> result = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
//根据areaName获取area信息
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
}
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key -> {
Map<String, String> stringStringMap = new HashMap<>();
stringStringMap.put("name", key);
stringStringMap.put("value", String.valueOf(listMap.get(key).size()));
result.add(stringStringMap);
});
return result;
}
//获取装机容量
public HashMap<String, String> getInstallCapityByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
//根据areaName获取area信息
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
});
hashMap.put("title", String.format("%.2f", total.get()));
return hashMap;
}
//获取有功功率
public HashMap<String, String> getActivePowerByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
//根据areaName获取area信息
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率"));
});
hashMap.put("title", String.format("%.2f", total.get()));
return hashMap;
}
//获取社会贡献
/**
* @param areaName 片区名称
* @param stationId 场站id
* @return 社会贡献列表
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果 areaName 与stationId都传 则取场站id
*/
public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(stationId)) {
stationBasicListAll.add(stationBasicMapper.selectById(stationId));
} else if (!ObjectUtils.isEmpty(areaName)) {
//根据areaName获取area信息
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "年发电量"));
});
return commonServiceImpl.getSocialContributionDtoList(total.get());
}
public HashMap<String, List<String>> getPowerGenerationTrends(String areaName) {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().eq("station_type", "FDZ").isNotNull("fan_gateway_id"));
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "月发电量"));
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = new ArrayList<>();
List<String> yList = new ArrayList<>();
for (int i = 1; i < 13; i++) {
xList.add(i + "月");
if (i == new Date().getMonth()) {
yList.add(String.format("%.2f", monthlyPower.get()));
} else {
yList.add("0");
}
}
hashMap.put("axisData", xList);
hashMap.put("seriesData", yList);
return hashMap;
}
public Page<HashMap<String, String>> getDetailsOnPowergeneration(String areaName) {
Page<HashMap<String, String>> hashMapPage = new Page<>(1, 99);
List<HashMap<String, String>> hashMapList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().eq("station_type", "FDZ").isNotNull("fan_gateway_id"));
//日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "年发电量"));
});
HashMap<String, String> dayHashMap = new HashMap<>();
dayHashMap.put("title", String.format("%.2f", dailyPower.get()) + "KWh");
HashMap<String, String> monthHashMap = new HashMap<>();
monthHashMap.put("title", String.format("%.2f", monthlyPower.get()) + "KWh");
HashMap<String, String> annualHashMap = new HashMap<>();
annualHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
HashMap<String, String> totalHashMap = new HashMap<>();
totalHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
hashMapList.add(dayHashMap);
hashMapList.add(monthHashMap);
hashMapList.add(annualHashMap);
hashMapList.add(totalHashMap);
hashMapPage.setRecords(hashMapList);
return hashMapPage;
}
}
......@@ -15,8 +15,25 @@ 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.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.tzs.api.dto.*;
import com.yeejoin.amos.boot.module.tzs.api.entity.*;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledRecordDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.FormValue;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzsCitInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsCitInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentClassifityEnum;
......@@ -25,8 +42,6 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang.text.StrBuilder;
import org.apache.logging.log4j.LogManager;
......@@ -36,14 +51,21 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
......@@ -153,12 +175,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
wrapper.eq(DataDictionary::getCode, alertCalledDto.getUseSiteCategory());
DataDictionary dataDictionary = iDataDictionaryService.getOne(wrapper);
if (!ValidationUtil.isEmpty(dataDictionary)) {
alertCalledDto.setUseUnit(dataDictionary.getName());
// alertCalledDto.setUseUnit(dataDictionary.getName());
alertCalledDto.setUseSiteCategory(dataDictionary.getName());
} else {
alertCalledDto.setUseUnit("");
alertCalledDto.setUseSiteCategory("");
}
} else {
alertCalledDto.setUseUnit("");
alertCalledDto.setUseSiteCategory("");
}
String voiceRecord = "";
VoiceRecordFile temp = voiceRecordFileServiceImpl.getOne(new LambdaQueryWrapper<VoiceRecordFile>().eq(VoiceRecordFile::getAlertId,id).eq(VoiceRecordFile::getAlertStageCode,"860").orderByAsc(VoiceRecordFile::getRecDate));
......
......@@ -191,7 +191,7 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc
useSiteCategory = ValidationUtil.isEmpty(categoryDict) ? "" : categoryDict.getName();
}
String useUnit = elevator.getUseUnit();
content = content.replace("$call_time",createTime).replace("$address",address).replace("$rescue_code",rescueCode).replace("$use_site_category",useSiteCategory);
content = content.replace("$call_time", createTime).replace("$address", address).replace("$rescue_code", rescueCode).replace("$use_site_category", useSiteCategory);
String typeCode = "";
if(AlertStageEnums.KRJY.toString().equals(alertTypeCode)) {
typeCode = AlertStageEnums.KRJY.getId();
......@@ -228,14 +228,14 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc
break;
case "GZWX" : // 故障维修
dispatchTaskDto.setIsSaveTask(false);
desc = dynamicParms.get("desc") == null ? "" : dynamicParms.get("desc");
content = content.replace("$use_unit",useUnit).replace("$desc",desc);
desc = dynamicParms.get("fault_report") == null ? "" : dynamicParms.get("fault_report");
content = content.replace("$use_unit", useUnit).replace("$desc", desc);
break;
case "TSZX" : // 投诉咨询
dispatchTaskDto.setIsSaveTask(false);
desc = dynamicParms.get("desc") == null ? "" : dynamicParms.get("desc");
content = content.replace("$emergency_call",emergencyCall).replace("$contact_phone",contactPhone);
content = content.replace("$use_unit",useUnit).replace("$desc",desc);
desc = dynamicParms.get("complaint_consulttation") == null ? "" : dynamicParms.get("complaint_consulttation");
content = content.replace("$emergency_call",emergencyCall).replace("$contact_phone", contactPhone);
content = content.replace("$use_unit", useUnit).replace("$desc", desc);
break;
}
dispatchTaskDto.setDispatchContext(content);
......
......@@ -41,6 +41,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
......@@ -48,6 +49,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
......@@ -262,10 +264,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
}
//生成码
Map<String, String> codeMap;
synchronized (EquipmentCategoryServiceImpl.class) {
codeMap = creatCode(city, county, equipCategory, null,null);
}
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
Map<String, String> codeMap = categoryService.creatCode(city, county, equipCategory, null, null);
if (ObjectUtils.isEmpty(codeMap)) {
return new HashMap<>();
}
......@@ -283,7 +283,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
elevatorCode = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? null : codeMap.get("code96333");
List<CategoryOtherInfo> categoryOtherInfo = categoryOtherInfoMapper.selectList(new QueryWrapper<CategoryOtherInfo>().eq("SUPERVISORY_CODE", supervisorCode));
if (categoryOtherInfo.size() > 0) {
// categoryOtherInfoMapper.updateCode(supervisorCode, equState);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisoryCodeInfo.getSupervisoryCode()));
} else {
supervisoryCodeInfo.setStatus(equState);
......@@ -482,7 +481,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
/**
* 具体生成监管码和电梯96333识别码逻辑
*/
private synchronized Map<String, String> creatCode(String city, String county, String equipCategory, String code96333,String supervisionCode) {
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
public synchronized Map<String, String> creatCode(String city, String county, String equipCategory, String code96333,String supervisionCode) {
Map<String, String> resultMap = new HashMap<>();
StringBuilder supervisorCode = new StringBuilder();
StringBuilder elevatorCode = new StringBuilder();
......@@ -551,7 +551,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* @param county 行政区划区
* @return 监管码
*/
private String createSupervisorCode(String city, String county, String equipCategory) {
public String createSupervisorCode(String city, String county, String equipCategory) {
StringBuilder supervisorCode = new StringBuilder();
//生成监管码前缀
Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), county);
......@@ -585,7 +585,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* @param county 行政区划区
* @return 96333电梯识别码
*/
private String createElevatorCode(String city, String county) {
public String createElevatorCode(String city, String county) {
StringBuilder elevatorCode = new StringBuilder();
//生成生成96333电梯码前缀
Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county);
......@@ -1034,8 +1034,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String county = String.valueOf(superviseMap.get("county"));
String equCategory = String.valueOf(superviseMap.get("equCategory"));
String supervisionCode = String.valueOf(superviseMap.get("supervisionCode"));
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
// EquipmentCategoryServiceImpl categoryService = SpringUtils.getBean(EquipmentCategoryServiceImpl.class);
//生成码
codeMap = creatCode(city, county, equCategory, code96333, supervisionCode);
codeMap = categoryService.creatCode(city, county, equCategory, code96333, supervisionCode);
log.info("已生成对应监管码或96333电梯识别码");
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map.remove("data");
......@@ -1075,8 +1077,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
response.setStatus(HttpStatus.BAD_REQUEST.value());
return response;
} finally {
log.info("已生成对应监管码" + supervisionMap.get("SUPERVISORY_CODE"));
log.info("已生成对应96333电梯识别码" + supervisionMap.get("CODE96333"));
updateEquipmentCategoryData(unitCode,orgBranchCode);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisoryCodeInfo.getSupervisoryCode()));
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisionMap.get("SUPERVISORY_CODE")));
}
return responseModel;
}
......
......@@ -13,11 +13,6 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordLog;
import com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordLogMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService;
import com.yeejoin.amos.boot.module.tzs.api.service.IVoiceRecordLogService;
import com.yeejoin.amos.component.feign.config.TokenOperation;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
......@@ -26,11 +21,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -121,7 +114,7 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
model.setTelStartTime(telStartTime);
model.setTelEndTime(telEndTime);
if(1 == recordInfo.getInteger("callType")) {
model.setFileType("客户呼入");
model.setFileType("呼入");
} else if(2 == recordInfo.getInteger("callType")) {
model.setFileType("坐席呼出");
}
......
package com.yeejoin.amos.boot.module.tzs.biz.utils;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@Configuration
@ComponentScan("com.yeejoin.amos.boot.module.tzs.biz.service.impl")
@EnableAspectJAutoProxy(exposeProxy = true)//开启spring注解aop配置的支持
public class SpringConfiguration {
}
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