ycl-pojo/src/main/java/com/ycl/platform/domain/entity/PlatformOnline.java
@@ -20,13 +20,9 @@ private static final long serialVersionUID = 1L; @TableField("platform_name") /** 平台名称 */ private String platformName; @TableField("platform_ip") /** 平台ip/域名 */ private String platformIp; @TableField("platform_id") /** 平台id */ private Integer platformId; @TableField("create_date") /** 统计的日期 */ ycl-pojo/src/main/java/com/ycl/platform/domain/form/PlatformForm.java
@@ -36,7 +36,7 @@ private String platformIP; @ApiModelProperty("行政区域") private String area; private List<String> areaList; // @NotBlank(message = "平台联系人不能为空", groups = {Add.class, Update.class}) // @ApiModelProperty("平台联系人") @@ -49,8 +49,8 @@ @ApiModelProperty("备注") private String remark; @ApiModelProperty("部署平台列表,一个平台可部署到多个区县") private List<Platform> deployList; // @ApiModelProperty("部署平台列表,一个平台可部署到多个区县") // private List<Platform> deployList; public static Platform getEntityByForm(@NonNull PlatformForm form, Platform entity) { if(entity == null) { ycl-pojo/src/main/java/com/ycl/platform/domain/vo/PlatformOnlineVO.java
@@ -22,6 +22,9 @@ /** 平台ip/域名 */ private String platformIp; /** 区域 */ private String area; /** 统计的日期 */ private Date createDate; ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java
@@ -49,19 +49,20 @@ Date now = new Date(); entity.setCreateTime(now); entity.setUpdateTime(now); entity.setArea(form.getAreaList().stream().collect(Collectors.joining(","))); baseMapper.insert(entity); if (! CollectionUtils.isEmpty(form.getDeployList())) { List<Platform> childList = form.getDeployList().stream().map(deploy -> { Platform child = new Platform(); BeanUtils.copyProperties(deploy, child); child.setPlatformName(entity.getPlatformName()); child.setParentId(entity.getId()); child.setCreateTime(now); child.setUpdateTime(now); return child; }).collect(Collectors.toList()); this.saveBatch(childList); } // if (! CollectionUtils.isEmpty(form.getDeployList())) { // List<Platform> childList = form.getDeployList().stream().map(deploy -> { // Platform child = new Platform(); // BeanUtils.copyProperties(deploy, child); // child.setPlatformName(entity.getPlatformName()); // child.setParentId(entity.getId()); // child.setCreateTime(now); // child.setUpdateTime(now); // return child; // }).collect(Collectors.toList()); // this.saveBatch(childList); // } return Result.ok("添加成功"); } ycl-server/src/main/java/com/ycl/task/PlatformTask.java
@@ -100,20 +100,18 @@ Object outLineTime = redisTemplate.opsForValue().get(REDIS_KEY_PREFIX + platform.getPlatformIP()); Integer outlineTimeSed = Objects.isNull(outLineTime) ? 0 : (Integer) outLineTime; PlatformOnline one = new LambdaQueryChainWrapper<>(platformOnlineService.getBaseMapper()) .eq(PlatformOnline::getPlatformIp, platform.getPlatformIP()) .eq(PlatformOnline::getPlatformId, platform.getId()) .eq(PlatformOnline::getCreateDate, sqlDate) .one(); if (Objects.isNull(one)) { one = new PlatformOnline(); one.setPlatformIp(platform.getPlatformIP()); one.setPlatformName(platform.getPlatformName()); one.setPlatformId(platform.getId()); one.setCreateDate(sqlDate); one.setTodayOutlineSed(outlineTimeSed); } else { one.setTodayOutlineSed(one.getTodayOutlineSed() + outlineTimeSed); } one.setPlatformIp(platform.getPlatformIP()); one.setPlatformName(platform.getPlatformName()); one.setPlatformId(platform.getId()); one.setCreateDate(sqlDate); platformOnlineService.saveOrUpdate(one); ycl-server/src/main/resources/mapper/zgyw/PlatformOnlineMapper.xml
@@ -14,8 +14,9 @@ <select id="getById" resultMap="BaseResultMap"> SELECT TPO.platform_name, TPO.platform_ip, TP.platform_name, TP.platform_ip, TP.area, TPO.create_date, TPO.today_outline_sed, TPO.update_time, @@ -23,6 +24,7 @@ TPO.id FROM t_platform_online TPO INNER JOIN t_platform TP ON TP.id = TPO.platform_id WHERE TPO.id = #{id} AND TPO.deleted = 0 </select> @@ -30,8 +32,9 @@ <select id="getPage" resultMap="BaseResultMap"> SELECT TPO.platform_name, TPO.platform_ip, TP.platform_name, TP.platform_ip, TP.area, TPO.create_date, TPO.today_outline_sed, TPO.update_time, @@ -39,6 +42,7 @@ TPO.id FROM t_platform_online TPO INNER JOIN t_platform TP ON TP.id = TPO.platform_id WHERE TPO.deleted = 0 <if test="query.startTime != null and query.endTime != null">