Merge remote-tracking branch 'origin/master'

This commit is contained in:
2023-08-30 09:30:13 +08:00
24 changed files with 542 additions and 28 deletions

View File

@@ -0,0 +1,84 @@
package com.njcn.device.pq.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 半月报返回体
*/
@Data
public class HalfReportVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("省份")
private String areaName;
@ApiModelProperty("供电公司")
private String gdName;
@ApiModelProperty("所属变电站")
private String subName;
@ApiModelProperty("监测点名称")
private String lineName;
@ApiModelProperty("重要等级")
private String lineGrade;
@ApiModelProperty("行业类型")
private String businessType;
@ApiModelProperty("运行状态")
private String runFlag;
@ApiModelProperty("监测点通讯状态")
private String comFlag;
@ApiModelProperty("投运时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime loginTime;
@ApiModelProperty("数据更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ApiModelProperty("在线率(%)")
private BigDecimal onlineRate;
@ApiModelProperty("完整性(%)")
private BigDecimal integrityData;
@ApiModelProperty("装置名称")
private String devName;
@ApiModelProperty("装置系列")
private String devSeries;
@ApiModelProperty("mac地址")
private String ip;
@ApiModelProperty("总流量(M)")
private BigDecimal flowMeal;
@ApiModelProperty("使用流量(M)")
private BigDecimal statisValue;
// @ApiModelProperty("剩余流量(M)")
// private BigDecimal ;
// @ApiModelProperty("使用率(%)")
// private BigDecimal ;
@ApiModelProperty("ICICD")
private String sim;
@ApiModelProperty("备注")
private String remark;
}

View File

@@ -1,5 +1,6 @@
package com.njcn.device.pq.controller; package com.njcn.device.pq.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -11,9 +12,7 @@ import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.mapper.*; import com.njcn.device.pq.mapper.*;
import com.njcn.device.pq.pojo.dto.*; import com.njcn.device.pq.pojo.dto.*;
import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.*; import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.pojo.vo.*;
import com.njcn.device.pq.service.LineService; import com.njcn.device.pq.service.LineService;
@@ -426,5 +425,12 @@ public class LineController extends BaseController {
List<RStatIntegrityVO> onIntegrityByIds = integrityDMapper.getOnIntegrityByIdsAndTime (param.getLineIds(),param.getStartTime(),param.getEndTime()); List<RStatIntegrityVO> onIntegrityByIds = integrityDMapper.getOnIntegrityByIdsAndTime (param.getLineIds(),param.getStartTime(),param.getEndTime());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,onIntegrityByIds,methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,onIntegrityByIds,methodDescribe);
} }
@PostMapping("/getHalfReport")
@ApiOperation("监测点半月报")
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
public HttpResult<Page<HalfReportVO>> getHalfReport(@RequestBody TerminalMainQueryParam param) {
String methodDescribe = getMethodDescribe("getHalfReport");
Page<HalfReportVO> halfReportVOS = lineService.halfReport(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,halfReportVOS,methodDescribe);
}
} }

View File

@@ -15,6 +15,7 @@ import com.njcn.device.pq.pojo.dto.OverLimitLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO; import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.WarningSubstationDTO; import com.njcn.device.pq.pojo.dto.WarningSubstationDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.*; import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.pojo.vo.*;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
@@ -495,4 +496,13 @@ public interface LineMapper extends BaseMapper<Line> {
* @return * @return
*/ */
List<DeviceIpRVO> getDevicesIp(@Param("devIds") List<String> devIds); List<DeviceIpRVO> getDevicesIp(@Param("devIds") List<String> devIds);
/**
* @Description: 监测点半月报功能
* @param
* @return: java.util.List<com.njcn.device.pq.pojo.vo.DeviceIpRVO>
* @Author: wr
* @Date: 2023/8/29 12:50
*/
Page<HalfReportVO> selectHalfReport(Page page,@Param("param") TerminalMainQueryParam param);
} }

View File

@@ -1243,5 +1243,86 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="selectHalfReport" resultType="com.njcn.device.pq.pojo.vo.HalfReportVO">
select * from
( SELECT
sys.NAME AS areaName,
gd.NAME AS gbName,
sub.NAME AS subName,
line.NAME AS lineName,
pd.Run_Flag AS runFlag,
pd.Com_Flag AS comFlag,
pld.Line_Grade AS lineGrade,
pld.Business_Type AS businessType,
pd.Login_Time AS loginTime,
pd.Update_Time AS updateTime,
ifnull( round(onlineRate,2), 0 ) AS onlineRate,
ifnull( round(integrityData,2), 0 ) AS integrityData,
dev.NAME AS devName,
pd.Dev_Series AS devSeries,
pd.ip AS ip,
round(ifnull(d.flow,( SELECT flow FROM cld_flow_meal WHERE type = 0 AND flag = 1 )) + ifnull( d1.flow, 0 ),2) AS flowMeal,
round(ifnull( m.Actual_Value / 1024 / 1024, 0 ),2) AS statisValue,
pd.Sim AS sim ,
pld.Remark AS remark
FROM
pq_line line
INNER JOIN pq_line_detail pld ON line.Id = pld.Id
INNER JOIN pq_line vol ON vol.Id = line.Pid
INNER JOIN pq_line dev ON dev.Id = vol.Pid
INNER JOIN pq_device pd ON pd.Id = dev.Id
INNER JOIN pq_line sub ON sub.Id = dev.Pid
INNER JOIN pq_line gd ON gd.Id = sub.Pid
INNER JOIN pq_line area ON area.Id = gd.Pid
INNER JOIN sys_area sys ON area.NAME = sys.id
LEFT JOIN cld_dev_meal c ON dev.id = c.line_id
LEFT JOIN cld_flow_meal d ON c.Base_Meal_Id = d.id
LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id
LEFT JOIN cld_month_flow m ON dev.id = m.Dev_Id AND m.time_id between #{param.searchBeginTime} and #{param.searchEndTime}
LEFT JOIN (SELECT dev_index,avg( online_min /( online_min + offline_min ))* 100 onlineRate FROM r_stat_onlinerate_d
WHERE time_id BETWEEN #{param.searchBeginTime} AND #{param.searchEndTime}
GROUP BY dev_index) a on a.dev_index=dev.Id
LEFT JOIN (select line_index lineId,avg(real_time/due_time)*100 integrityData from r_stat_integrity_d
WHERE time_id BETWEEN #{param.searchBeginTime} AND #{param.searchEndTime}
group by line_index) b on b.lineId =line.id
<where>
<if test="param.comFlag != null ">
and pd.Com_Flag = #{param.comFlag}
</if>
<if test="param.runFlag != null ">
and pd.Run_Flag = #{param.runFlag}
</if>
<if test="param.lineGrade != null and param.lineGrade !=''">
and pld.Line_Grade = #{param.lineGrade}
</if>
</where>
) x
<where>
<if test="param.searchValue!=null and param.searchValue!=''">
and (
areaName like CONCAT('%', #{param.searchValue}, '%')
or gbName like CONCAT('%', #{param.searchValue}, '%')
or subName like CONCAT('%', #{param.searchValue}, '%')
or lineName like CONCAT('%', #{param.searchValue}, '%')
or loginTime like CONCAT('%', #{param.searchValue}, '%')
or updateTime like CONCAT('%', #{param.searchValue}, '%')
or onlineRate like CONCAT('%', #{param.searchValue}, '%')
or integrityData like CONCAT('%', #{param.searchValue}, '%')
or devName like CONCAT('%', #{param.searchValue}, '%')
or ip like CONCAT('%', #{param.searchValue}, '%')
or flowMeal like CONCAT('%', #{param.searchValue}, '%')
or statisValue like CONCAT('%', #{param.searchValue}, '%')
or sim like CONCAT('%', #{param.searchValue}, '%')
or remark like CONCAT('%', #{param.searchValue}, '%')
)
</if>
</where>
ORDER BY
areaName,
gbName,
subName,
devName,
lineName
</select>
</mapper> </mapper>

View File

@@ -6,6 +6,7 @@ import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.PqsParam; import com.njcn.device.pq.pojo.param.PqsParam;
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.Line; import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.pojo.po.TopMsgPO; import com.njcn.device.pq.pojo.po.TopMsgPO;
@@ -178,4 +179,6 @@ public interface LineService {
Page<TopMsgPO> dailyDeviceAbnormalStatistics(PqsParam param); Page<TopMsgPO> dailyDeviceAbnormalStatistics(PqsParam param);
List<TopMsgPO> dailyDeviceAbnormal(DeviceInfoParam.BusinessParam conditionBusinessParam); List<TopMsgPO> dailyDeviceAbnormal(DeviceInfoParam.BusinessParam conditionBusinessParam);
Page<HalfReportVO> halfReport(TerminalMainQueryParam param);
} }

View File

@@ -24,6 +24,7 @@ import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.PqsParam; import com.njcn.device.pq.pojo.param.PqsParam;
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.*; import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.pojo.vo.*;
import com.njcn.device.pq.mapper.*; import com.njcn.device.pq.mapper.*;
@@ -460,6 +461,14 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
return topMsgDetails; return topMsgDetails;
} }
@Override
public Page<HalfReportVO> halfReport(TerminalMainQueryParam param) {
Page<LineMarkVO> page = new Page<>(param.getPageNum(), param.getPageSize());
param.setSearchBeginTime(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString());
param.setSearchEndTime(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
return this.baseMapper.selectHalfReport(page,param);
}
@Override @Override
public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) { public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) {
return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList()); return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList());

View File

@@ -33,6 +33,7 @@ import com.njcn.web.utils.RestTemplateUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.IOUtils; import org.apache.commons.compress.utils.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -76,6 +77,10 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
private final UserFeignClient userFeignClient; private final UserFeignClient userFeignClient;
@Value("${gw.url}")
private String gwUrl;
@Override @Override
public String pushPlan(List<String> planIds) { public String pushPlan(List<String> planIds) {
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -445,7 +450,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
} }
} }
public static Map<String, String> send(SendParam param, String url, String serviceName) { public Map<String, String> send(SendParam param, String url, String serviceName) {
Map<String, String> map = new LinkedHashMap<>(); Map<String, String> map = new LinkedHashMap<>();
ContentBody cb; ContentBody cb;
if (ObjectUtil.isNull(param)) { if (ObjectUtil.isNull(param)) {
@@ -484,12 +489,12 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
return map; return map;
} }
public static String LoginToken() { public String LoginToken() {
String token = null; String token = null;
String clientId = "942a9278671711eda2e10ae0b5517f6c"; String clientId = "942a9278671711eda2e10ae0b5517f6c";
String clientSecret = "3Psd2VEhsA3dVsSPHW0ll5r/03kAqlA2P4w2IiWPA8UWSadcX0we2wffjyTUYGsK"; String clientSecret = "3Psd2VEhsA3dVsSPHW0ll5r/03kAqlA2P4w2IiWPA8UWSadcX0we2wffjyTUYGsK";
String userUrl = "http://25.36.214.86:32234/psr-auth/oauth/accessToken?grant_type={grant_type}&client_id={client_id}&client_secret={client_secret}"; String userUrl = "http://"+gwUrl+"/psr-auth/oauth/accessToken?grant_type={grant_type}&client_id={client_id}&client_secret={client_secret}";
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("grant_type", "credentials"); map.put("grant_type", "credentials");
map.put("client_id", clientId); map.put("client_id", clientId);
@@ -533,7 +538,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
//如果需要传递请求参数 可以拼接到请求URL中或者设置paramsMap参数由SDK内部进行拼接 //如果需要传递请求参数 可以拼接到请求URL中或者设置paramsMap参数由SDK内部进行拼接
HttpParameters.Builder builder = HttpParameters.newBuilder(); HttpParameters.Builder builder = HttpParameters.newBuilder();
builder.requestURL("http://25.36.214.86:32234/CSB/WMCenter/powerQuality/file/create") // 设置请求的URL,可以拼接URL请求参数 builder.requestURL(url) // 设置请求的URL,可以拼接URL请求参数
.api("zongbuSync") // 设置服务名 .api("zongbuSync") // 设置服务名
.version("1.0.0") // 设置版本号 .version("1.0.0") // 设置版本号
.method("post") // 设置调用方式, 必须为 post .method("post") // 设置调用方式, 必须为 post
@@ -638,8 +643,8 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
* @param type * @param type
* @return * @return
*/ */
public static String getUrl(Integer type) { public String getUrl(Integer type) {
String url = "http://25.36.214.86:32234/CSB"; String url = "http://"+gwUrl+"/CSB";
switch (type) { switch (type) {
case 1: case 1:

View File

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/** /**
* @author xuyang * @author xuyang
@@ -19,7 +20,9 @@ import org.springframework.web.bind.annotation.RequestBody;
public interface EleEvtFeignClient { public interface EleEvtFeignClient {
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增事件拓展数据")
HttpResult<EleEpdPqd> add(@RequestBody EleEvtParam evtParam); HttpResult<EleEpdPqd> add(@RequestBody EleEvtParam evtParam);
@PostMapping("/delete")
HttpResult<EleEpdPqd> delete(@RequestParam("id") String id);
} }

View File

@@ -0,0 +1,28 @@
package com.njcn.system.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.fallback.EleWaveFeignClientFallbackFactory;
import com.njcn.system.pojo.param.CsWaveParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author xuyang
* @version 1.0.0
* @date 2021年05月08日 15:11
*/
@FeignClient(value = ServerInfo.SYSTEM,path = "/eleWaveParm",fallbackFactory = EleWaveFeignClientFallbackFactory.class,contextId = "eleWaveParm")
public interface EleWaveFeignClient {
@PostMapping("/add")
HttpResult<String> add(@RequestBody CsWaveParam waveParam);
@PostMapping("/delete")
@ApiOperation("删除波形拓展数据")
HttpResult<String> delete(@RequestParam("id") String id);
}

View File

@@ -41,6 +41,12 @@ public class EleEvtFeignClientFallbackFactory implements FallbackFactory<EleEvtF
log.error("{}异常,降级处理,异常为:{}","新增事件拓展数据",cause.toString()); log.error("{}异常,降级处理,异常为:{}","新增事件拓展数据",cause.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<EleEpdPqd> delete(String id) {
log.error("{}异常,降级处理,异常为:{}","删除事件拓展数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -0,0 +1,46 @@
package com.njcn.system.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.EleWaveFeignClient;
import com.njcn.system.pojo.param.CsWaveParam;
import com.njcn.system.utils.SystemEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2023/5/24 18:46
*/
@Slf4j
@Component
public class EleWaveFeignClientFallbackFactory implements FallbackFactory<EleWaveFeignClient> {
@Override
public EleWaveFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if(cause.getCause() instanceof BusinessException){
BusinessException businessException = (BusinessException) cause.getCause();
exceptionEnum = SystemEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new EleWaveFeignClient() {
@Override
public HttpResult<String> add(CsWaveParam waveParam) {
log.error("{}异常,降级处理,异常为:{}","新增波形拓展数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<String> delete(String id) {
log.error("{}异常,降级处理,异常为:{}","删除波形拓展数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,25 @@
package com.njcn.system.pojo.param;
import lombok.Data;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2023/8/29 16:10
*/
@Data
public class CsWaveParam {
private String pid;
private String name;
private String type;
private String data;
private String showName;
}

View File

@@ -0,0 +1,31 @@
package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2023/8/29 16:10
*/
@Data
@TableName("cs_wave_parm")
public class CsWaveParm {
private static final long serialVersionUID = 1L;
private String id;
private String pid;
private String name;
private String type;
private String data;
private String showName;
}

View File

@@ -17,11 +17,8 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
/** /**
@@ -54,5 +51,18 @@ public class EleEvtParmController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
@PostMapping("/delete")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("删除事件拓展数据")
@ApiImplicitParam(name = "id", value = "id", required = true)
public HttpResult<EleEpdPqd> delete(@RequestParam String id){
String methodDescribe = getMethodDescribe("delete");
LogUtil.njcnDebug(log, "{}传递的id为:{}", methodDescribe,id);
eleEvtParmService.delete(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
} }

View File

@@ -0,0 +1,64 @@
package com.njcn.system.controller;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;
import com.njcn.system.pojo.param.CsWaveParam;
import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.service.IEleWaveParmService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 事件拓展表 前端控制器
* </p>
*
* @author xuyang
* @since 2023-07-31
*/
@Slf4j
@RestController
@RequestMapping("/eleWaveParm")
@RequiredArgsConstructor
@Api(tags = "波形字典录入")
@Validated
public class EleWaveParmController extends BaseController {
private final IEleWaveParmService waveParamService;
@PostMapping("/add")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("新增波形拓展数据")
@ApiImplicitParam(name = "waveParam", value = "字典数据", required = true)
public HttpResult<String> add(@RequestBody @Validated CsWaveParam waveParam){
log.info("录入字典数据");
String methodDescribe = getMethodDescribe("add");
LogUtil.njcnDebug(log, "{},模板当前解析字典数据为:", methodDescribe);
waveParamService.add(waveParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("/delete")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("删除波形拓展数据")
@ApiImplicitParam(name = "id", value = "id", required = true)
public HttpResult<EleEpdPqd> delete(@RequestParam String id){
String methodDescribe = getMethodDescribe("delete");
LogUtil.njcnDebug(log, "{}传递的id为:{}", methodDescribe,id);
waveParamService.delete(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -0,0 +1,16 @@
package com.njcn.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.system.pojo.po.CsWaveParm;
/**
* <p>
* 事件拓展表 Mapper 接口
* </p>
*
* @author xuyang
* @since 2023-07-31
*/
public interface EleWaveParmMapper extends BaseMapper<CsWaveParm> {
}

View File

@@ -16,4 +16,6 @@ public interface IEleEvtParmService extends IService<EleEvtParm> {
void add(EleEvtParam eleEvtParam); void add(EleEvtParam eleEvtParam);
void delete(String id);
} }

View File

@@ -0,0 +1,21 @@
package com.njcn.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.system.pojo.param.CsWaveParam;
import com.njcn.system.pojo.po.CsWaveParm;
/**
* <p>
* 事件拓展表 服务类
* </p>
*
* @author xuyang
* @since 2023-07-31
*/
public interface IEleWaveParmService extends IService<CsWaveParm> {
void add(CsWaveParam waveParam);
void delete(String id);
}

View File

@@ -362,7 +362,7 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
vo = BeanUtil.copyProperties(datum, OnlineUsersVO.class); vo = BeanUtil.copyProperties(datum, OnlineUsersVO.class);
Long integer = time.get(datum.getId()); Long integer = time.get(datum.getId());
DateTime date = DateUtil.date(integer * 1000); DateTime date = DateUtil.date(integer * 1000);
vo.setTime(date.toDateStr()); vo.setTime(date.toString());
info.add(vo); info.add(vo);
} }
} }

View File

@@ -1,5 +1,6 @@
package com.njcn.system.service.impl; package com.njcn.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.system.mapper.EleEvtParmMapper; import com.njcn.system.mapper.EleEvtParmMapper;
import com.njcn.system.pojo.param.EleEvtParam; import com.njcn.system.pojo.param.EleEvtParam;
@@ -25,4 +26,11 @@ public class EleEvtParmServiceImpl extends ServiceImpl<EleEvtParmMapper, EleEvtP
BeanUtils.copyProperties(eleEvtParam,eleEvtParm); BeanUtils.copyProperties(eleEvtParam,eleEvtParm);
this.save(eleEvtParm); this.save(eleEvtParm);
} }
@Override
public void delete(String id) {
LambdaQueryWrapper<EleEvtParm> deleteWrapper = new LambdaQueryWrapper<>();
deleteWrapper.eq(EleEvtParm::getPid,id);
this.baseMapper.delete(deleteWrapper);
}
} }

View File

@@ -0,0 +1,37 @@
package com.njcn.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.system.mapper.EleWaveParmMapper;
import com.njcn.system.pojo.param.CsWaveParam;
import com.njcn.system.pojo.po.CsWaveParm;
import com.njcn.system.pojo.po.EleEvtParm;
import com.njcn.system.service.IEleWaveParmService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
/**
* <p>
* 事件拓展表 服务实现类
* </p>
*
* @author xuyang
* @since 2023-07-31
*/
@Service
public class EleWaveParmServiceImpl extends ServiceImpl<EleWaveParmMapper, CsWaveParm> implements IEleWaveParmService {
@Override
public void add(CsWaveParam waveParam) {
CsWaveParm csWaveParm = new CsWaveParm();
BeanUtils.copyProperties(waveParam,csWaveParm);
this.save(csWaveParm);
}
@Override
public void delete(String id) {
LambdaQueryWrapper<CsWaveParm> deleteWrapper = new LambdaQueryWrapper<>();
deleteWrapper.eq(CsWaveParm::getPid,id);
this.baseMapper.delete(deleteWrapper);
}
}

View File

@@ -1,5 +1,6 @@
package com.njcn.system.service.impl; package com.njcn.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
@@ -132,15 +133,21 @@ public class EventTemplateServiceImpl extends ServiceImpl<EventTemplateMapper, E
boolean flag = this.updateById(eventTemplate); boolean flag = this.updateById(eventTemplate);
// 先删除字典表 // 先删除字典表
templateRelMapper.deleteByRtId(id); templateRelMapper.deleteByRtId(id);
List<TemplateRel> list = new ArrayList<>(); if(CollUtil.isNotEmpty(eventTemplateUpdateParam.getIds())){
eventTemplateUpdateParam.getIds().forEach(rdId -> { List<TemplateRel> list = new ArrayList<>();
TemplateRel relevancy = new TemplateRel(); eventTemplateUpdateParam.getIds().forEach(rdId -> {
// 模版id TemplateRel relevancy = new TemplateRel();
relevancy.setRtId(id); // 模版id
relevancy.setRdId(rdId); relevancy.setRtId(id);
list.add(relevancy); relevancy.setRdId(rdId);
}); list.add(relevancy);
flag = templateRelMapper.batchInsert(list); });
if(CollUtil.isNotEmpty(list)){
flag = templateRelMapper.batchInsert(list);
}
}
return flag; return flag;
} }

View File

@@ -1,6 +1,7 @@
package com.njcn.user.service.impl; package com.njcn.user.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
@@ -127,8 +128,14 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
list = componentMapper.getAllComponent(); list = componentMapper.getAllComponent();
} else { } else {
List<String> componentList = roleComponentService.selectRoleComponent(roleList.stream().map(Role::getId).collect(Collectors.toList())); List<String> componentList = roleComponentService.selectRoleComponent(roleList.stream().map(Role::getId).collect(Collectors.toList()));
if (CollectionUtil.isEmpty(componentList)) {
return result;
}
list = componentMapper.getComponentByList(componentList); list = componentMapper.getComponentByList(componentList);
} }
if (CollectionUtil.isEmpty(list)){
return result;
}
list.forEach(item -> { list.forEach(item -> {
ComponentVO componentVO = new ComponentVO(); ComponentVO componentVO = new ComponentVO();
BeanUtil.copyProperties(item, componentVO); BeanUtil.copyProperties(item, componentVO);

View File

@@ -278,12 +278,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
public Page<UserVO> userList(UserParam.UserQueryParam queryParam) { public Page<UserVO> userList(UserParam.UserQueryParam queryParam) {
QueryWrapper<UserVO> queryWrapper = new QueryWrapper<>(); QueryWrapper<UserVO> queryWrapper = new QueryWrapper<>();
Page<UserVO> page = new Page<>(); Page<UserVO> page = new Page<>();
Integer type = this.lambdaQuery().eq(User::getId, RequestUtil.getUserIndex()).one().getType(); User user = this.lambdaQuery().eq(User::getId, RequestUtil.getUserIndex()).one();
Integer type = user.getType();
if (Objects.equals(UserType.SUPER_ADMINISTRATOR, type)) { if (Objects.equals(UserType.SUPER_ADMINISTRATOR, type)) {
type = UserType.ADMINISTRATOR; type = UserType.ADMINISTRATOR;
} else if (Objects.equals(UserType.ADMINISTRATOR, type)) { //fixme 存在web用户和App用户目前先通过管理员的登录名来区分开
} else if (Objects.equals(UserType.ADMINISTRATOR, type) && !Objects.equals(user.getLoginName(),"njcnyw")) {
type = UserType.USER; type = UserType.USER;
} else if (Objects.equals(UserType.USER, type) || Objects.equals(UserType.APP, type)) { } else if (Objects.equals(UserType.ADMINISTRATOR, type) && Objects.equals(user.getLoginName(),"njcnyw")) {
type = UserType.APP;
}
else if (Objects.equals(UserType.USER, type) || Objects.equals(UserType.APP, type)) {
return page; return page;
} }
if (ObjectUtil.isNotNull(queryParam)) { if (ObjectUtil.isNotNull(queryParam)) {