68 changed files with 3470 additions and 419 deletions
@ -0,0 +1,104 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
import java.util.List; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.PutMapping; |
|||
import org.springframework.web.bind.annotation.DeleteMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import com.ruoyi.common.annotation.Log; |
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.ruoyi.common.enums.BusinessType; |
|||
import com.zc.business.domain.DcPublishManage; |
|||
import com.zc.business.service.IDcPublishManageService; |
|||
import com.ruoyi.common.utils.poi.ExcelUtil; |
|||
import com.ruoyi.common.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 信息发布管理记录Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/business/manage") |
|||
public class DcPublishManageController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private IDcPublishManageService dcPublishManageService; |
|||
|
|||
/** |
|||
* 查询信息发布管理记录列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:manage:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcPublishManage dcPublishManage) |
|||
{ |
|||
startPage(); |
|||
List<DcPublishManage> list = dcPublishManageService.selectDcPublishManageList(dcPublishManage); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出信息发布管理记录列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:manage:export')") |
|||
@Log(title = "信息发布管理记录", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, DcPublishManage dcPublishManage) |
|||
{ |
|||
List<DcPublishManage> list = dcPublishManageService.selectDcPublishManageList(dcPublishManage); |
|||
ExcelUtil<DcPublishManage> util = new ExcelUtil<>(DcPublishManage.class); |
|||
util.exportExcel(response, list, "信息发布管理记录数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取信息发布管理记录详细信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:manage:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) |
|||
{ |
|||
return AjaxResult.success(dcPublishManageService.selectDcPublishManageById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增信息发布管理记录 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:manage:add')") |
|||
@Log(title = "信息发布管理记录", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody DcPublishManage dcPublishManage) |
|||
{ |
|||
return toAjax(dcPublishManageService.insertDcPublishManage(dcPublishManage)); |
|||
} |
|||
|
|||
/** |
|||
* 修改信息发布管理记录 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:manage:edit')") |
|||
@Log(title = "信息发布管理记录", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody DcPublishManage dcPublishManage) |
|||
{ |
|||
return toAjax(dcPublishManageService.updateDcPublishManage(dcPublishManage)); |
|||
} |
|||
|
|||
/** |
|||
* 删除信息发布管理记录 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:manage:remove')") |
|||
@Log(title = "信息发布管理记录", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) |
|||
{ |
|||
return toAjax(dcPublishManageService.deleteDcPublishManageByIds(ids)); |
|||
} |
|||
} |
@ -0,0 +1,117 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
import java.util.List; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.PutMapping; |
|||
import org.springframework.web.bind.annotation.DeleteMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import com.ruoyi.common.annotation.Log; |
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.ruoyi.common.enums.BusinessType; |
|||
import com.zc.business.domain.DcPublishingChannels; |
|||
import com.zc.business.service.IDcPublishingChannelsService; |
|||
import com.ruoyi.common.utils.poi.ExcelUtil; |
|||
import com.ruoyi.common.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 发布渠道Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/business/channels") |
|||
public class DcPublishingChannelsController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private IDcPublishingChannelsService dcPublishingChannelsService; |
|||
|
|||
/** |
|||
* 查询发布渠道列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:channels:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcPublishingChannels dcPublishingChannels) |
|||
{ |
|||
startPage(); |
|||
List<DcPublishingChannels> list = dcPublishingChannelsService.selectDcPublishingChannelsList(dcPublishingChannels); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出发布渠道列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:channels:export')") |
|||
@Log(title = "发布渠道", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, DcPublishingChannels dcPublishingChannels) |
|||
{ |
|||
List<DcPublishingChannels> list = dcPublishingChannelsService.selectDcPublishingChannelsList(dcPublishingChannels); |
|||
ExcelUtil<DcPublishingChannels> util = new ExcelUtil<>(DcPublishingChannels.class); |
|||
util.exportExcel(response, list, "发布渠道数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取发布渠道详细信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:channels:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) |
|||
{ |
|||
return AjaxResult.success(dcPublishingChannelsService.selectDcPublishingChannelsById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增发布渠道 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:channels:add')") |
|||
@Log(title = "发布渠道", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody DcPublishingChannels dcPublishingChannels) |
|||
{ |
|||
if (dcPublishingChannels.getDataCategory()==null){ |
|||
return AjaxResult.error("参数错误"); |
|||
} |
|||
List<DcPublishingChannels> channelsList = dcPublishingChannelsService. |
|||
selectChannelsDataCategory(dcPublishingChannels.getDataCategory()); |
|||
if (channelsList!=null&&channelsList.size()>0){ |
|||
return AjaxResult.error("事件类型已存在"); |
|||
} |
|||
return toAjax(dcPublishingChannelsService.insertDcPublishingChannels(dcPublishingChannels)); |
|||
} |
|||
|
|||
/** |
|||
* 修改发布渠道 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:channels:edit')") |
|||
@Log(title = "发布渠道", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody DcPublishingChannels dcPublishingChannels) |
|||
{ |
|||
List<DcPublishingChannels> channelsList = dcPublishingChannelsService. |
|||
selectChannelsDataCategory(dcPublishingChannels.getDataCategory()); |
|||
if (channelsList!=null&&channelsList.size()>0){ |
|||
return AjaxResult.error("事件类型已存在"); |
|||
} |
|||
return toAjax(dcPublishingChannelsService.updateDcPublishingChannels(dcPublishingChannels)); |
|||
} |
|||
|
|||
/** |
|||
* 删除发布渠道 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:channels:remove')") |
|||
@Log(title = "发布渠道", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) |
|||
{ |
|||
return toAjax(dcPublishingChannelsService.deleteDcPublishingChannelsByIds(ids)); |
|||
} |
|||
} |
@ -0,0 +1,105 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.zc.business.domain.DcSwitch; |
|||
import com.zc.business.service.DcSwitchService; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.scheduling.annotation.Scheduled; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.io.IOException; |
|||
import java.net.InetAddress; |
|||
import java.util.List; |
|||
import java.util.concurrent.CountDownLatch; |
|||
import java.util.concurrent.ExecutorService; |
|||
import java.util.concurrent.Executors; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 交换机Controller |
|||
* |
|||
* @author wangjiabao |
|||
*/ |
|||
@Api(tags = {"交换机"}) |
|||
@RestController |
|||
@RequestMapping("/business/switch") |
|||
public class DcSwitchController extends BaseController { |
|||
|
|||
@Resource |
|||
private DcSwitchService dcSwitchService; |
|||
|
|||
/** |
|||
* 查询交换机 |
|||
*/ |
|||
@ApiOperation("查询交换机") |
|||
@GetMapping("/query") |
|||
public AjaxResult getSwitchList(DcSwitch dcSwitch) { |
|||
return AjaxResult.success(dcSwitchService.getSwitchList(dcSwitch)); |
|||
} |
|||
|
|||
/** |
|||
* 根据设备列表查询设备 |
|||
*/ |
|||
@ApiOperation("根据设备列表查询设备") |
|||
@GetMapping("/deviceList/{deviceList}") |
|||
public AjaxResult getDeviceList(@PathVariable String deviceList) { |
|||
return AjaxResult.success(dcSwitchService.getDeviceList(deviceList)); |
|||
} |
|||
|
|||
/** |
|||
* 查询所有数据 |
|||
* |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
public AjaxResult getSwitchListAll() { |
|||
return AjaxResult.success(dcSwitchService.getSwitchListAll()); |
|||
} |
|||
|
|||
/** |
|||
* 定时更新交换机网络状态 |
|||
*/ |
|||
@Scheduled(cron = "0 0/30 * * * ?") |
|||
public void updateNetWorkStatus() { |
|||
List<DcSwitch> switchList = dcSwitchService.getSwitchList(new DcSwitch()); |
|||
ExecutorService executor = Executors.newFixedThreadPool(100); |
|||
List<DcSwitch> collect = switchList.stream() |
|||
.filter(dcSwitch -> { |
|||
return dcSwitch.getAncestors().split(",").length > 1; |
|||
}).collect(Collectors.toList()); |
|||
CountDownLatch latch = new CountDownLatch(collect.size()); |
|||
collect.forEach(dcSwitch -> { |
|||
executor.execute(() -> { |
|||
try { |
|||
InetAddress inet = InetAddress.getByName(dcSwitch.getSwitchIp()); |
|||
if (inet.isReachable(5000)) { |
|||
// 成功
|
|||
dcSwitch.setNetWorkStatus(1); |
|||
} else { |
|||
// 失败
|
|||
dcSwitch.setNetWorkStatus(0); |
|||
} |
|||
} catch (IOException e) { |
|||
e.getMessage(); |
|||
} finally { |
|||
latch.countDown(); |
|||
} |
|||
}); |
|||
}); |
|||
try { |
|||
latch.await(); // 等待所有线程执行完毕
|
|||
} catch (InterruptedException e) { |
|||
Thread.currentThread().interrupt(); |
|||
} finally { |
|||
executor.shutdown(); |
|||
} |
|||
// 批量修改
|
|||
dcSwitchService.updateBatchByNetWorkStatus(collect); |
|||
} |
|||
} |
@ -0,0 +1,138 @@ |
|||
package com.zc.business.controller; |
|||
import java.util.List; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import com.zc.business.domain.DcVoiceBroadcast; |
|||
import com.zc.business.service.IDcVoiceBroadcastService; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.PutMapping; |
|||
import org.springframework.web.bind.annotation.DeleteMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import com.ruoyi.common.annotation.Log; |
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.ruoyi.common.enums.BusinessType; |
|||
|
|||
import com.ruoyi.common.utils.poi.ExcelUtil; |
|||
import com.ruoyi.common.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 语音广播预发布Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/system/broadcast") |
|||
@Api(tags = "语音广播预发布") |
|||
public class DcVoiceBroadcastController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private IDcVoiceBroadcastService dcVoiceBroadcastService; |
|||
|
|||
/** |
|||
* 查询语音广播预发布列表 |
|||
*/ |
|||
@ApiOperation("查询语音广播预发布列表") |
|||
@PreAuthorize("@ss.hasPermi('system:broadcast:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcVoiceBroadcast dcVoiceBroadcast) |
|||
{ |
|||
startPage(); |
|||
List<DcVoiceBroadcast> list = dcVoiceBroadcastService.selectDcVoiceBroadcastList(dcVoiceBroadcast); |
|||
return getDataTable(list); |
|||
} |
|||
/** |
|||
* 查询语音广播预发布列表 |
|||
*/ |
|||
@ApiOperation("无分页查询语音广播预发布列表") |
|||
@PreAuthorize("@ss.hasPermi('system:broadcast:listAll')") |
|||
@GetMapping("/listAll") |
|||
public TableDataInfo listAll(DcVoiceBroadcast dcVoiceBroadcast) |
|||
{ |
|||
List<DcVoiceBroadcast> list = dcVoiceBroadcastService.selectDcVoiceBroadcastList(dcVoiceBroadcast); |
|||
return getDataTable(list); |
|||
} |
|||
/** |
|||
* 根据模版类型查询查询语音广播预发布列表 |
|||
*/ |
|||
@ApiOperation("根据模版类型查询查询语音广播预发布列表") |
|||
@PreAuthorize("@ss.hasPermi('system:broadcast:listId')") |
|||
@GetMapping("/listAll/{category}") |
|||
public TableDataInfo listByCategory(@PathVariable("category") String category) |
|||
{ |
|||
List<DcVoiceBroadcast> list = dcVoiceBroadcastService.selectDcVoiceBroadcastListByCategory(category); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出语音广播预发布列表 |
|||
*/ |
|||
@ApiOperation("导出语音广播预发布列表") |
|||
|
|||
@PreAuthorize("@ss.hasPermi('system:broadcast:export')") |
|||
@Log(title = "语音广播预发布", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, DcVoiceBroadcast dcVoiceBroadcast) |
|||
{ |
|||
List<DcVoiceBroadcast> list = dcVoiceBroadcastService.selectDcVoiceBroadcastList(dcVoiceBroadcast); |
|||
ExcelUtil<DcVoiceBroadcast> util = new ExcelUtil<>(DcVoiceBroadcast.class); |
|||
util.exportExcel(response, list, "语音广播预发布数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取语音广播预发布详细信息 |
|||
*/ |
|||
@ApiOperation("根据id获取语音广播预发布详细信息") |
|||
|
|||
@PreAuthorize("@ss.hasPermi('system:broadcast:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) |
|||
{ |
|||
return AjaxResult.success(dcVoiceBroadcastService.selectDcVoiceBroadcastById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增语音广播预发布 |
|||
*/ |
|||
@ApiOperation("新增语音广播预发布") |
|||
|
|||
@PreAuthorize("@ss.hasPermi('system:broadcast:add')") |
|||
@Log(title = "语音广播预发布", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody DcVoiceBroadcast dcVoiceBroadcast) |
|||
{ |
|||
return toAjax(dcVoiceBroadcastService.insertDcVoiceBroadcast(dcVoiceBroadcast)); |
|||
} |
|||
|
|||
/** |
|||
* 修改语音广播预发布 |
|||
*/ |
|||
@ApiOperation("修改语音广播预发布") |
|||
@PreAuthorize("@ss.hasPermi('system:broadcast:edit')") |
|||
@Log(title = "语音广播预发布", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody DcVoiceBroadcast dcVoiceBroadcast) |
|||
{ |
|||
return toAjax(dcVoiceBroadcastService.updateDcVoiceBroadcast(dcVoiceBroadcast)); |
|||
} |
|||
|
|||
/** |
|||
* 删除语音广播预发布 |
|||
*/ |
|||
@ApiOperation("删除语音广播预发布") |
|||
@PreAuthorize("@ss.hasPermi('system:broadcast:remove')") |
|||
@Log(title = "语音广播预发布", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) |
|||
{ |
|||
return toAjax(dcVoiceBroadcastService.deleteDcVoiceBroadcastByIds(ids)); |
|||
} |
|||
} |
@ -0,0 +1,77 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
import java.io.BufferedReader; |
|||
import java.io.IOException; |
|||
import java.io.InputStreamReader; |
|||
import java.io.OutputStream; |
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
import java.net.URLEncoder; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.Map; |
|||
import java.util.HashMap; |
|||
//微博获取token的工具类
|
|||
public class WeiboAuthExample { |
|||
private static final String APP_KEY = "1894516689"; |
|||
private static final String APP_SECRET = "4e89660243b70328fb74ae10f9ed98e5"; |
|||
private static final String REDIRECT_URI = "https://api.weibo.com/oauth2/default.html"; // 回调URL,需要URL编码
|
|||
private static final String AUTHORIZE_URL = "https://api.weibo.com/oauth2/authorize?client_id="+APP_KEY+"&redirect_uri="+REDIRECT_URI+"&response_type=code"; |
|||
|
|||
public static void main(String[] args) throws IOException { |
|||
// 1. 引导用户到微博授权页面
|
|||
System.out.println("Please visit the following URL to authorize your Weibo account:"); |
|||
System.out.println(AUTHORIZE_URL); |
|||
System.out.println("After authorization, you will be redirected to the callback URL with an Authorization Code."); |
|||
|
|||
// 在实际应用中,你应该设置一个HTTP服务器来处理回调,而不是从控制台读取输入。
|
|||
// 这里为了简化示例,我们直接从控制台读取Authorization Code。
|
|||
System.out.print("Enter the Authorization Code from the callback URL: "); |
|||
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); |
|||
String code = reader.readLine(); |
|||
// 2. 使用Authorization Code请求Access Token
|
|||
String accessTokenUrl = "https://api.weibo.com/oauth2/access_token"; |
|||
Map<String, String> params = new HashMap<>(); |
|||
params.put("client_id", APP_KEY); |
|||
params.put("client_secret", APP_SECRET); |
|||
params.put("grant_type", "authorization_code"); |
|||
params.put("code", code); |
|||
params.put("redirect_uri", REDIRECT_URI); |
|||
|
|||
String accessTokenResponse = sendPostRequest(accessTokenUrl, params); |
|||
// 解析Access Token响应,实际应用中应该使用JSON库来解析
|
|||
System.out.println("Access Token Response: " + accessTokenResponse); |
|||
|
|||
} |
|||
|
|||
private static String sendPostRequest(String url, Map<String, String> params) throws IOException { |
|||
URL obj = new URL(url); |
|||
HttpURLConnection con = (HttpURLConnection) obj.openConnection(); |
|||
con.setRequestMethod("POST"); |
|||
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); |
|||
con.setRequestProperty("Accept", "application/json"); |
|||
con.setDoOutput(true); |
|||
|
|||
StringBuilder postData = new StringBuilder(); |
|||
for (Map.Entry<String, String> param : params.entrySet()) { |
|||
if (postData.length() != 0) postData.append('&'); |
|||
postData.append(URLEncoder.encode(param.getKey(), StandardCharsets.UTF_8.toString())); |
|||
postData.append('='); |
|||
postData.append(URLEncoder.encode(param.getValue(), StandardCharsets.UTF_8.toString())); |
|||
} |
|||
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8); |
|||
|
|||
try (OutputStream os = con.getOutputStream()) { |
|||
os.write(postDataBytes); |
|||
} |
|||
int responseCode = con.getResponseCode(); |
|||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); |
|||
String inputLine; |
|||
StringBuffer response = new StringBuffer(); |
|||
|
|||
while ((inputLine = in.readLine()) != null) { |
|||
response.append(inputLine); |
|||
} |
|||
in.close(); |
|||
return response.toString(); |
|||
} |
|||
} |
@ -1,95 +1,61 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.HttpResponse; |
|||
import org.apache.http.client.HttpClient; |
|||
import org.apache.http.client.methods.CloseableHttpResponse; |
|||
import org.apache.http.client.methods.HttpGet; |
|||
import org.apache.http.client.entity.UrlEncodedFormEntity; |
|||
import org.apache.http.client.methods.HttpPost; |
|||
import org.apache.http.entity.StringEntity; |
|||
import org.apache.http.impl.client.CloseableHttpClient; |
|||
import org.apache.http.impl.client.HttpClients; |
|||
import org.apache.http.message.BasicNameValuePair; |
|||
import org.apache.http.util.EntityUtils; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
import java.net.URLEncoder; |
|||
|
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 王思祥 |
|||
* @ClassName DcWarningPush 微博推送 |
|||
*/ |
|||
|
|||
public class WeiboAuthUtil { |
|||
//1.登录传入重定向的url,用户授权后返回授权的code,2.使用code取得认证权限token 3.调用接口参数
|
|||
//1.登录获取用户的回调code
|
|||
private static final String APP_KEY = "你的App Key"; |
|||
private static final String AUTH_URL = "https://api.weibo.com/oauth2/authorize"; |
|||
private static final String APP_SECRET = "你的App Secret"; |
|||
private static final String REDIRECT_URI = "你的回调URL"; |
|||
//获取授权后的code
|
|||
public String tokenCode(){ |
|||
String url="https://api.weibo.com/oauth2/authorize?client_id="+APP_KEY+"&redirect_uri="+AUTH_URL; |
|||
String token=null; |
|||
private static final String ACCESS_TOKEN = "2.00oesadIn1MNEC0296dd00f87jmhaC"; |
|||
private static final String WEIBO_API_URL = "https://api.weibo.com/2/statuses/update.json"; |
|||
|
|||
public static void main(String[] args) { |
|||
try { |
|||
URL urlGet = new URL(url); //创建链接
|
|||
HttpURLConnection http = (HttpURLConnection) urlGet.openConnection(); |
|||
http.setRequestMethod("GET"); |
|||
http.setDoInput(true); //打开获取返回数据
|
|||
http.connect(); //发送链接
|
|||
InputStream is = http.getInputStream(); //
|
|||
int size = is.available(); |
|||
byte[] jsonBytes = new byte[size]; |
|||
is.read(jsonBytes); |
|||
token = new String(jsonBytes, "UTF-8"); |
|||
System.err.println(token); |
|||
JSONObject jsonObject = JSONObject.parseObject(token); |
|||
is.close(); |
|||
return jsonObject.get("code").toString(); |
|||
}catch (Exception e){ |
|||
String text = "这是一条通过Java和微博API推送的消息!"; // 你要推送的微博内容
|
|||
postWeibo(text); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return ""; |
|||
} |
|||
//获取toke
|
|||
public String token(String code)throws IOException { |
|||
HttpClient httpClient = HttpClients.createDefault(); |
|||
String tokenUrl = REDIRECT_URI + "?client_id=" + APP_KEY |
|||
+ "&client_secret=" + APP_SECRET |
|||
+ "&grant_type=authorization_code" |
|||
+ "&code=" + code |
|||
+ "&redirect_uri=" + URLEncoder.encode(REDIRECT_URI, "UTF-8"); |
|||
HttpGet httpGet = new HttpGet(tokenUrl); |
|||
HttpResponse response = httpClient.execute(httpGet); |
|||
private static void postWeibo(String status) throws Exception { |
|||
CloseableHttpClient httpClient = HttpClients.createDefault(); |
|||
HttpPost httpPost = new HttpPost(WEIBO_API_URL); |
|||
|
|||
// 设置请求头,包含Content-Type
|
|||
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); |
|||
httpPost.setHeader("Authorization", "Bearer " + ACCESS_TOKEN); |
|||
|
|||
// 构造POST请求参数列表
|
|||
List<BasicNameValuePair> params = new ArrayList<>(); |
|||
params.add(new BasicNameValuePair("access_token", ACCESS_TOKEN)); |
|||
params.add(new BasicNameValuePair("status", status)); |
|||
// 将参数列表转换为URL编码的字符串
|
|||
StringEntity paramsEntity = new StringEntity(EntityUtils.toString(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8)), StandardCharsets.UTF_8); |
|||
// 设置请求体内容
|
|||
httpPost.setEntity(paramsEntity); |
|||
// 发送请求并获取响应
|
|||
HttpResponse response = httpClient.execute(httpPost); |
|||
HttpEntity entity = response.getEntity(); |
|||
if (entity != null) { |
|||
String responseBody = EntityUtils.toString(entity, "UTF-8"); |
|||
org.json.JSONObject jsonObject = new org.json.JSONObject(responseBody); |
|||
return jsonObject.optString("access_token"); |
|||
String responseString = EntityUtils.toString(entity, StandardCharsets.UTF_8); |
|||
System.out.println("Response: " + responseString); |
|||
} |
|||
return null; |
|||
// 关闭HttpClient连接
|
|||
httpClient.close(); |
|||
} |
|||
|
|||
//执行调用推送api
|
|||
public static void main(String[] args) throws Exception { |
|||
WeiboAuthUtil weiboAuthUtil = new WeiboAuthUtil(); |
|||
String code = weiboAuthUtil.tokenCode(); |
|||
String accessToken = weiboAuthUtil.token(code);//认证后的code放入,获取token
|
|||
// 创建HttpClient实例
|
|||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) { |
|||
// 构建请求URL,这里以获取用户信息为例
|
|||
String url = "https://api.weibo.com/2/users/show.json?access_token=" + accessToken + "&uid=用户UID"; |
|||
// 创建HttpGet请求
|
|||
HttpGet httpGet = new HttpGet(url); |
|||
// 执行请求并获取响应
|
|||
try (CloseableHttpResponse response = httpClient.execute(httpGet)) { |
|||
HttpEntity entity = response.getEntity(); |
|||
if (entity != null) { |
|||
// 读取响应内容
|
|||
String responseString = EntityUtils.toString(entity, "UTF-8"); |
|||
System.out.println(responseString); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,405 @@ |
|||
package com.zc.business.domain; |
|||
|
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import com.ruoyi.common.annotation.Excel; |
|||
import com.ruoyi.common.core.domain.BaseEntity; |
|||
import org.omg.CORBA.INTERNAL; |
|||
|
|||
/** |
|||
* 信息发布管理记录对象 dc_publish_manage |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
public class DcPublishManage extends BaseEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 主键 */ |
|||
private Long id; |
|||
|
|||
/** 事件编号 */ |
|||
@Excel(name = "事件编号") |
|||
private String eventId; |
|||
|
|||
/** 所属机构 */ |
|||
@Excel(name = "所属机构") |
|||
private Long deptId; |
|||
|
|||
/** 发布渠道ID */ |
|||
@Excel(name = "发布渠道ID") |
|||
private Long publishChannelsId; |
|||
|
|||
/** 标题 */ |
|||
@Excel(name = "标题") |
|||
private String title; |
|||
|
|||
/** 发布渠道:多选用逗号隔开1-手机短信2-微信公众号3-微博4-情报板5-服务网站6-微信小程序 */ |
|||
@Excel(name = "发布渠道",readConverterExp="1=手机短信,2=微信公众号,3=微博,4=情报板,5=服务网站,6=微信小程序") |
|||
private Integer publishChannels; |
|||
|
|||
/** 审核状态:0-待审核1-已审核2-未通过 */ |
|||
@Excel(name = "审核状态: 0-待审核 1-已审核 2-未通过") |
|||
private Integer isverify; |
|||
|
|||
/** 发布者 */ |
|||
@Excel(name = "发布者") |
|||
private String publisher; |
|||
|
|||
/** 审核者1 */ |
|||
@Excel(name = "审核者1") |
|||
private String auditor1; |
|||
|
|||
/** 审核者1 */ |
|||
@Excel(name = "审核者1") |
|||
private String auditor2; |
|||
|
|||
/** 审核时间1 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
@Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd") |
|||
private Date auditTime1; |
|||
|
|||
/** 审核时间1 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
@Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd") |
|||
private Date auditTime2; |
|||
|
|||
/** 审核者1意见 */ |
|||
@Excel(name = "审核者1意见") |
|||
private String auditComment1; |
|||
|
|||
/** 审核者2意见 */ |
|||
@Excel(name = "审核者2意见") |
|||
private String auditComment2; |
|||
|
|||
/** 发布时间 */ |
|||
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
private Date publishTime; |
|||
|
|||
/** 发布状态:1-成功2-失败3-草稿 */ |
|||
@Excel(name = "发布状态: 1-成功 2-失败 3-草稿") |
|||
private Integer publishStatus; |
|||
|
|||
/** 事件详情 */ |
|||
@Excel(name = "事件详情") |
|||
private String contentDetails; |
|||
|
|||
@Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向") |
|||
private String direction; |
|||
@Excel(name = "桩号") |
|||
private String stakeMark; |
|||
@Excel(name = "事件主类",readConverterExp = "1=交通事故,2=车辆故障,3=交通管制,4=交通拥堵,5=非法上路,6=路障清除,7=施工建设,8=服务区异常,9=设施设备隐患,10=异常天气,11=其他事件") |
|||
private String eventType; |
|||
@Excel(name = "事件子类", readConverterExp = "1-1=追尾,1-2=侧翻,1-3=撞护栏,1-4=自然,1-5=其他事故,2-1=车辆故障,3-1=主线封闭和限行,3-2=收费站封闭和限行,3-3=立交封闭和限行,3-4=服务区封闭和限行,4-1=道路拥堵,4-2=立交拥堵,4-3=收费站拥堵,4-4=服务区拥堵,5-1=行人,5-2=非机动车,5-3=摩托车,5-4=其他,6-1=烟雾,6-2=倒伏树木,6-3=撒落物,6-4=动物,6-5=其他,7-1=道路养护施工,7-2=收费站养护施工,7-3=服务区养护施工,7-4=枢纽立交匝道养护施工,7-5=地方道路养护施工,7-6=道路工程建设施工,7-7=收费站工程建设施工,7-8=服务区工程建设施工,7-9=枢纽立交匝道工程建设施工,7-10=地方道路工程建设施工,8-1=封闭、暂停营业,8-2=重要设施停用,8-3=服务区其他异常,9-1=摄像机,9-2=护栏,9-3=隔离栅") |
|||
private String eventSubclass; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
private Date eventTime; |
|||
|
|||
/** 参数开始时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
private Date startTime; |
|||
/** 参数结束时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
private Date endTime; |
|||
//参数
|
|||
private String startStakeMarkValue; |
|||
//参数
|
|||
private String endStakeMarkValue; |
|||
//参数
|
|||
private Integer startStakeMark; |
|||
//参数
|
|||
private Integer endStakeMark; |
|||
//管制收费站
|
|||
private String facilityName; |
|||
//事件状态:0-待确认1-处理中2-已完成
|
|||
private Integer eventState; |
|||
|
|||
public Integer getEventState() { |
|||
return eventState; |
|||
} |
|||
|
|||
public void setEventState(Integer eventState) { |
|||
this.eventState = eventState; |
|||
} |
|||
|
|||
public String getFacilityName() { |
|||
return facilityName; |
|||
} |
|||
|
|||
public void setFacilityName(String facilityName) { |
|||
this.facilityName = facilityName; |
|||
} |
|||
|
|||
public String getStartStakeMarkValue() { |
|||
return startStakeMarkValue; |
|||
} |
|||
|
|||
public void setStartStakeMarkValue(String startStakeMarkValue) { |
|||
this.startStakeMarkValue = startStakeMarkValue; |
|||
} |
|||
|
|||
public String getEndStakeMarkValue() { |
|||
return endStakeMarkValue; |
|||
} |
|||
|
|||
public void setEndStakeMarkValue(String endStakeMarkValue) { |
|||
this.endStakeMarkValue = endStakeMarkValue; |
|||
} |
|||
|
|||
public Integer getStartStakeMark() { |
|||
return startStakeMark; |
|||
} |
|||
|
|||
public void setStartStakeMark(Integer startStakeMark) { |
|||
this.startStakeMark = startStakeMark; |
|||
} |
|||
|
|||
public Integer getEndStakeMark() { |
|||
return endStakeMark; |
|||
} |
|||
|
|||
public void setEndStakeMark(Integer endStakeMark) { |
|||
this.endStakeMark = endStakeMark; |
|||
} |
|||
|
|||
public String getDirection() { |
|||
return direction; |
|||
} |
|||
|
|||
public Date getEventTime() { |
|||
return eventTime; |
|||
} |
|||
|
|||
public void setEventTime(Date eventTime) { |
|||
this.eventTime = eventTime; |
|||
} |
|||
|
|||
public Date getStartTime() { |
|||
return startTime; |
|||
} |
|||
|
|||
public void setStartTime(Date startTime) { |
|||
this.startTime = startTime; |
|||
} |
|||
|
|||
public Date getEndTime() { |
|||
return endTime; |
|||
} |
|||
|
|||
public void setEndTime(Date endTime) { |
|||
this.endTime = endTime; |
|||
} |
|||
|
|||
public void setDirection(String direction) { |
|||
this.direction = direction; |
|||
} |
|||
|
|||
public String getStakeMark() { |
|||
return stakeMark; |
|||
} |
|||
|
|||
public void setStakeMark(String stakeMark) { |
|||
this.stakeMark = stakeMark; |
|||
} |
|||
|
|||
public String getEventType() { |
|||
return eventType; |
|||
} |
|||
|
|||
public void setEventType(String eventType) { |
|||
this.eventType = eventType; |
|||
} |
|||
|
|||
public String getEventSubclass() { |
|||
return eventSubclass; |
|||
} |
|||
|
|||
public void setEventSubclass(String eventSubclass) { |
|||
this.eventSubclass = eventSubclass; |
|||
} |
|||
|
|||
public void setId(Long id) |
|||
{ |
|||
this.id = id; |
|||
} |
|||
|
|||
public Long getId() |
|||
{ |
|||
return id; |
|||
} |
|||
public void setEventId(String eventId) |
|||
{ |
|||
this.eventId = eventId; |
|||
} |
|||
|
|||
public String getEventId() |
|||
{ |
|||
return eventId; |
|||
} |
|||
public void setDeptId(Long deptId) |
|||
{ |
|||
this.deptId = deptId; |
|||
} |
|||
|
|||
public Long getDeptId() |
|||
{ |
|||
return deptId; |
|||
} |
|||
public void setPublishChannelsId(Long publishChannelsId) |
|||
{ |
|||
this.publishChannelsId = publishChannelsId; |
|||
} |
|||
|
|||
public Long getPublishChannelsId() |
|||
{ |
|||
return publishChannelsId; |
|||
} |
|||
public void setTitle(String title) |
|||
{ |
|||
this.title = title; |
|||
} |
|||
|
|||
public String getTitle() |
|||
{ |
|||
return title; |
|||
} |
|||
public void setPublishChannels(Integer publishChannels) |
|||
{ |
|||
this.publishChannels = publishChannels; |
|||
} |
|||
|
|||
public Integer getPublishChannels() |
|||
{ |
|||
return publishChannels; |
|||
} |
|||
public void setIsverify(Integer isverify) |
|||
{ |
|||
this.isverify = isverify; |
|||
} |
|||
|
|||
public Integer getIsverify() |
|||
{ |
|||
return isverify; |
|||
} |
|||
public void setPublisher(String publisher) |
|||
{ |
|||
this.publisher = publisher; |
|||
} |
|||
|
|||
public String getPublisher() |
|||
{ |
|||
return publisher; |
|||
} |
|||
public void setAuditor1(String auditor1) |
|||
{ |
|||
this.auditor1 = auditor1; |
|||
} |
|||
|
|||
public String getAuditor1() |
|||
{ |
|||
return auditor1; |
|||
} |
|||
public void setAuditor2(String auditor2) |
|||
{ |
|||
this.auditor2 = auditor2; |
|||
} |
|||
|
|||
public String getAuditor2() |
|||
{ |
|||
return auditor2; |
|||
} |
|||
public void setAuditTime1(Date auditTime1) |
|||
{ |
|||
this.auditTime1 = auditTime1; |
|||
} |
|||
|
|||
public Date getAuditTime1() |
|||
{ |
|||
return auditTime1; |
|||
} |
|||
public void setAuditTime2(Date auditTime2) |
|||
{ |
|||
this.auditTime2 = auditTime2; |
|||
} |
|||
|
|||
public Date getAuditTime2() |
|||
{ |
|||
return auditTime2; |
|||
} |
|||
public void setAuditComment1(String auditComment1) |
|||
{ |
|||
this.auditComment1 = auditComment1; |
|||
} |
|||
|
|||
public String getAuditComment1() |
|||
{ |
|||
return auditComment1; |
|||
} |
|||
public void setAuditComment2(String auditComment2) |
|||
{ |
|||
this.auditComment2 = auditComment2; |
|||
} |
|||
|
|||
public String getAuditComment2() |
|||
{ |
|||
return auditComment2; |
|||
} |
|||
public void setPublishTime(Date publishTime) |
|||
{ |
|||
this.publishTime = publishTime; |
|||
} |
|||
|
|||
public Date getPublishTime() |
|||
{ |
|||
return publishTime; |
|||
} |
|||
public void setPublishStatus(Integer publishStatus) |
|||
{ |
|||
this.publishStatus = publishStatus; |
|||
} |
|||
|
|||
public Integer getPublishStatus() |
|||
{ |
|||
return publishStatus; |
|||
} |
|||
public void setContentDetails(String contentDetails) |
|||
{ |
|||
this.contentDetails = contentDetails; |
|||
} |
|||
|
|||
public String getContentDetails() |
|||
{ |
|||
return contentDetails; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("eventId", getEventId()) |
|||
.append("deptId", getDeptId()) |
|||
.append("publishChannelsId", getPublishChannelsId()) |
|||
.append("title", getTitle()) |
|||
.append("publishChannels", getPublishChannels()) |
|||
.append("isverify", getIsverify()) |
|||
.append("publisher", getPublisher()) |
|||
.append("auditor1", getAuditor1()) |
|||
.append("auditor2", getAuditor2()) |
|||
.append("auditTime1", getAuditTime1()) |
|||
.append("auditTime2", getAuditTime2()) |
|||
.append("auditComment1", getAuditComment1()) |
|||
.append("auditComment2", getAuditComment2()) |
|||
.append("publishTime", getPublishTime()) |
|||
.append("publishStatus", getPublishStatus()) |
|||
.append("contentDetails", getContentDetails()) |
|||
.append("remark", getRemark()) |
|||
.append("updateTime", getUpdateTime()) |
|||
.append("createTime", getCreateTime()) |
|||
.toString(); |
|||
} |
|||
} |
@ -0,0 +1,125 @@ |
|||
package com.zc.business.domain; |
|||
|
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import com.ruoyi.common.annotation.Excel; |
|||
import com.ruoyi.common.core.domain.BaseEntity; |
|||
|
|||
/** |
|||
* 发布渠道对象 dc_publishing_channels |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
public class DcPublishingChannels extends BaseEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 主键 */ |
|||
private Long id; |
|||
/** 数据种类:和交通事件类型保持一致就可以 */ |
|||
@Excel(name = "数据种类",readConverterExp = "1=交通事故,2=车辆故障,3=交通管制,4=交通拥堵,5=非法上路,6=路障清除,7=施工建设,8=服务区异常,9=设施设备隐患,10=异常天气,11=其他事件") |
|||
private Integer dataCategory; |
|||
|
|||
/** 1-影响通行2-不影响通行 */ |
|||
@Excel(name = "影响级别",readConverterExp="1=影响通行,2=不影响通行") |
|||
private Integer infoLevel; |
|||
|
|||
/** 0-停用2-启用 */ |
|||
@Excel(name = "启用状态",readConverterExp="0=停用,2=启用") |
|||
private Integer enabled; |
|||
|
|||
/** 1-单人审核2-双人审核 */ |
|||
@Excel(name = "审核方式",readConverterExp="1=单人审核,2=双人审核") |
|||
private Integer auditMethod; |
|||
|
|||
/** 发布渠道:多选用逗号隔开1-手机短信2-微信公众号3-微博4-情报板5-服务网站6-微信小程序 */ |
|||
@Excel(name = "发布渠道",readConverterExp="1=手机短信,2=微信公众号,3=微博,4=情报板,5=服务网站,6=微信小程序") |
|||
private String publishChannels; |
|||
|
|||
/** 启用日期 */ |
|||
@Excel(name = "启用日期", readConverterExp = "$column.readConverterExp()") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
private Date enableDate; |
|||
|
|||
public void setId(Long id) |
|||
{ |
|||
this.id = id; |
|||
} |
|||
|
|||
public Long getId() |
|||
{ |
|||
return id; |
|||
} |
|||
public void setDataCategory(Integer dataCategory) |
|||
{ |
|||
this.dataCategory = dataCategory; |
|||
} |
|||
|
|||
public Integer getDataCategory() |
|||
{ |
|||
return dataCategory; |
|||
} |
|||
public void setInfoLevel(Integer infoLevel) |
|||
{ |
|||
this.infoLevel = infoLevel; |
|||
} |
|||
|
|||
public Integer getInfoLevel() |
|||
{ |
|||
return infoLevel; |
|||
} |
|||
public void setEnabled(Integer enabled) |
|||
{ |
|||
this.enabled = enabled; |
|||
} |
|||
|
|||
public Integer getEnabled() |
|||
{ |
|||
return enabled; |
|||
} |
|||
public void setAuditMethod(Integer auditMethod) |
|||
{ |
|||
this.auditMethod = auditMethod; |
|||
} |
|||
|
|||
public Integer getAuditMethod() |
|||
{ |
|||
return auditMethod; |
|||
} |
|||
public void setPublishChannels(String publishChannels) |
|||
{ |
|||
this.publishChannels = publishChannels; |
|||
} |
|||
|
|||
public String getPublishChannels() |
|||
{ |
|||
return publishChannels; |
|||
} |
|||
public void setEnableDate(Date enableDate) |
|||
{ |
|||
this.enableDate = enableDate; |
|||
} |
|||
|
|||
public Date getEnableDate() |
|||
{ |
|||
return enableDate; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("dataCategory", getDataCategory()) |
|||
.append("infoLevel", getInfoLevel()) |
|||
.append("enabled", getEnabled()) |
|||
.append("auditMethod", getAuditMethod()) |
|||
.append("publishChannels", getPublishChannels()) |
|||
.append("enableDate", getEnableDate()) |
|||
.append("createTime", getCreateTime()) |
|||
.append("updateTime", getUpdateTime()) |
|||
.toString(); |
|||
} |
|||
} |
@ -0,0 +1,122 @@ |
|||
package com.zc.business.domain; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.ruoyi.common.annotation.Excel; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 交换机对象 dc_switch |
|||
* |
|||
* @author wangjiabao |
|||
* @date 2024-04-19 |
|||
*/ |
|||
|
|||
@ApiModel("交换机实体") |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class DcSwitch { |
|||
|
|||
/** |
|||
* 交换机编号 |
|||
*/ |
|||
@Excel(name = "交换机编号") |
|||
@ApiModelProperty("交换机编号") |
|||
private Integer switchId; |
|||
|
|||
/** |
|||
* 父交换机编号 |
|||
*/ |
|||
@Excel(name = "父交换机编号") |
|||
@ApiModelProperty("父交换机编号") |
|||
private Integer parentId; |
|||
|
|||
/** |
|||
* 祖级列表 |
|||
*/ |
|||
@Excel(name = "祖级列表") |
|||
@ApiModelProperty("祖级列表") |
|||
private String ancestors; |
|||
|
|||
/** |
|||
* 交换机名称 |
|||
*/ |
|||
@Excel(name = "交换机名称") |
|||
@ApiModelProperty("交换机名称") |
|||
private String switchName; |
|||
|
|||
/** |
|||
* 所在桩号 |
|||
*/ |
|||
@Excel(name = "所在桩号") |
|||
@ApiModelProperty("所在桩号") |
|||
private String stakeMark; |
|||
|
|||
/** |
|||
* 设备列表 |
|||
*/ |
|||
@Excel(name = "设备列表") |
|||
@ApiModelProperty("设备列表") |
|||
private String deviceList; |
|||
/** |
|||
* 交换机ip |
|||
*/ |
|||
@Excel(name = "交换机ip") |
|||
@ApiModelProperty("交换机ip") |
|||
private String switchIp; |
|||
|
|||
/** |
|||
* 网路状态 |
|||
*/ |
|||
@Excel(name = "网路状态") |
|||
@ApiModelProperty("网路状态") |
|||
private Integer netWorkStatus; |
|||
|
|||
/** |
|||
* 环网 |
|||
*/ |
|||
@Excel(name = "环网") |
|||
@ApiModelProperty("环网") |
|||
private Integer ringNetWork; |
|||
|
|||
/** |
|||
* 使用状态 |
|||
*/ |
|||
@Excel(name = "使用状态") |
|||
@ApiModelProperty("使用状态") |
|||
private Integer userState; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@Excel(name = "创建时间") |
|||
@ApiModelProperty("创建时间") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
private Date createTime; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@Excel(name = "更新时间") |
|||
@ApiModelProperty("更新时间") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
private Date updateTime; |
|||
|
|||
private List<DcSwitch> children; |
|||
|
|||
|
|||
/** |
|||
* 故障数量 |
|||
*/ |
|||
private int numberOfFaults; |
|||
private Map<String, List<DcDevice>> dcDeviceList; |
|||
|
|||
} |
@ -0,0 +1,72 @@ |
|||
package com.zc.business.domain; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import com.ruoyi.common.annotation.Excel; |
|||
import com.ruoyi.common.core.domain.BaseEntity; |
|||
|
|||
/** |
|||
* 语音广播预发布对象 dc_voice_broadcast |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
@ApiModel("语音广播预发布对象") |
|||
public class DcVoiceBroadcast extends BaseEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
private Long id; |
|||
@ApiModelProperty("模板分组") |
|||
|
|||
/** 模板分组 */ |
|||
@Excel(name = "模板分组") |
|||
private String category; |
|||
|
|||
/** 内容 */ |
|||
@Excel(name = "内容") |
|||
private String content; |
|||
|
|||
public void setId(Long id) |
|||
{ |
|||
this.id = id; |
|||
} |
|||
|
|||
public Long getId() |
|||
{ |
|||
return id; |
|||
} |
|||
public void setCategory(String category) |
|||
{ |
|||
this.category = category; |
|||
} |
|||
|
|||
public String getCategory() |
|||
{ |
|||
return category; |
|||
} |
|||
public void setContent(String content) |
|||
{ |
|||
this.content = content; |
|||
} |
|||
|
|||
public String getContent() |
|||
{ |
|||
return content; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("category", getCategory()) |
|||
.append("content", getContent()) |
|||
.append("remark", getRemark()) |
|||
.append("createTime", getCreateTime()) |
|||
.append("updateTime", getUpdateTime()) |
|||
.toString(); |
|||
} |
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.zc.business.mapper; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import com.zc.business.domain.DcPublishManage; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* 信息发布管理记录Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
public interface DcPublishManageMapper |
|||
{ |
|||
/** |
|||
* 查询信息发布管理记录 |
|||
* |
|||
* @param id 信息发布管理记录主键 |
|||
* @return 信息发布管理记录 |
|||
*/ |
|||
public DcPublishManage selectDcPublishManageById(Long id); |
|||
|
|||
/** |
|||
* 查询信息发布管理记录列表 |
|||
* |
|||
* @param dcPublishManage 信息发布管理记录 |
|||
* @return 信息发布管理记录集合 |
|||
*/ |
|||
List<DcPublishManage> selectDcPublishManageList(DcPublishManage dcPublishManage); |
|||
|
|||
/** |
|||
* 新增信息发布管理记录 |
|||
* |
|||
* @param dcPublishManage 信息发布管理记录 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcPublishManage(DcPublishManage dcPublishManage); |
|||
|
|||
/** |
|||
* 修改信息发布管理记录 |
|||
* |
|||
* @param dcPublishManage 信息发布管理记录 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcPublishManage(DcPublishManage dcPublishManage); |
|||
|
|||
/** |
|||
* 删除信息发布管理记录 |
|||
* |
|||
* @param id 信息发布管理记录主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcPublishManageById(Long id); |
|||
|
|||
/** |
|||
* 批量删除信息发布管理记录 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcPublishManageByIds(Long[] ids); |
|||
//查询交通事件类型
|
|||
public Integer selectEventType(@Param("eventId")String eventId); |
|||
//获取发布渠道信息
|
|||
public DcPublishManage selectPublishManage(@Param("dataCategory")Integer dataCategory); |
|||
//查询信息发布列表
|
|||
public List<HashMap<String,Object>> selectDcPublishManageListMap(DcPublishManage dcPublishManage); |
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.zc.business.mapper; |
|||
|
|||
import java.util.List; |
|||
import com.zc.business.domain.DcPublishingChannels; |
|||
|
|||
/** |
|||
* 发布渠道Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
public interface DcPublishingChannelsMapper |
|||
{ |
|||
/** |
|||
* 查询发布渠道 |
|||
* |
|||
* @param id 发布渠道主键 |
|||
* @return 发布渠道 |
|||
*/ |
|||
public DcPublishingChannels selectDcPublishingChannelsById(Long id); |
|||
|
|||
/** |
|||
* 查询发布渠道列表 |
|||
* |
|||
* @param dcPublishingChannels 发布渠道 |
|||
* @return 发布渠道集合 |
|||
*/ |
|||
List<DcPublishingChannels> selectDcPublishingChannelsList(DcPublishingChannels dcPublishingChannels); |
|||
|
|||
/** |
|||
* 新增发布渠道 |
|||
* |
|||
* @param dcPublishingChannels 发布渠道 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels); |
|||
|
|||
/** |
|||
* 修改发布渠道 |
|||
* |
|||
* @param dcPublishingChannels 发布渠道 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcPublishingChannels(DcPublishingChannels dcPublishingChannels); |
|||
|
|||
/** |
|||
* 删除发布渠道 |
|||
* |
|||
* @param id 发布渠道主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcPublishingChannelsById(Long id); |
|||
|
|||
/** |
|||
* 批量删除发布渠道 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcPublishingChannelsByIds(Long[] ids); |
|||
//查询数据类型是否已经存在
|
|||
public List<DcPublishingChannels> selectChannelsDataCategory(Integer dataCategory); |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.zc.business.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.zc.business.domain.DcSwitch; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 交换机Mapper接口 |
|||
* |
|||
* @author wangjiabao |
|||
*/ |
|||
@Mapper |
|||
public interface DcSwitchMapper extends BaseMapper<DcSwitch> { |
|||
List<DcSwitch> getSwitchList(DcSwitch dcSwitch); |
|||
|
|||
int updateBatchByNetWorkStatus(List<DcSwitch> list); |
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.zc.business.mapper; |
|||
|
|||
import com.zc.business.domain.DcVoiceBroadcast; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 语音广播预发布Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
public interface DcVoiceBroadcastMapper |
|||
{ |
|||
/** |
|||
* 查询语音广播预发布 |
|||
* |
|||
* @param id 语音广播预发布主键 |
|||
* @return 语音广播预发布 |
|||
*/ |
|||
public DcVoiceBroadcast selectDcVoiceBroadcastById(Long id); |
|||
|
|||
/** |
|||
* 查询语音广播预发布列表 |
|||
* |
|||
* @param dcVoiceBroadcast 语音广播预发布 |
|||
* @return 语音广播预发布集合 |
|||
*/ |
|||
List<DcVoiceBroadcast> selectDcVoiceBroadcastList(DcVoiceBroadcast dcVoiceBroadcast); |
|||
|
|||
/** |
|||
* 新增语音广播预发布 |
|||
* |
|||
* @param dcVoiceBroadcast 语音广播预发布 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast); |
|||
|
|||
/** |
|||
* 修改语音广播预发布 |
|||
* |
|||
* @param dcVoiceBroadcast 语音广播预发布 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast); |
|||
|
|||
/** |
|||
* 删除语音广播预发布 |
|||
* |
|||
* @param id 语音广播预发布主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcVoiceBroadcastById(Long id); |
|||
|
|||
/** |
|||
* 批量删除语音广播预发布 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcVoiceBroadcastByIds(Long[] ids); |
|||
|
|||
List<DcVoiceBroadcast> selectDcVoiceBroadcastListByCategory(String category); |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.zc.business.service; |
|||
|
|||
import com.zc.business.domain.DcDevice; |
|||
import com.zc.business.domain.DcSwitch; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 交换机Service接口 |
|||
* |
|||
* @author wangjiabao |
|||
* @date 2024-04-19 |
|||
*/ |
|||
public interface DcSwitchService { |
|||
|
|||
/** |
|||
* 查询交换机 |
|||
*/ |
|||
List<DcSwitch> getSwitchList(DcSwitch dcSwitch); |
|||
|
|||
/** |
|||
* 根据设备列表查询设备 |
|||
*/ |
|||
List<DcDevice> getDeviceList(String deviceList); |
|||
|
|||
/** |
|||
* 查询所有数据 |
|||
* @return |
|||
*/ |
|||
List<DcSwitch> getSwitchListAll(); |
|||
|
|||
/** |
|||
* 批量修改网络状态 |
|||
* @return |
|||
*/ |
|||
int updateBatchByNetWorkStatus(List<DcSwitch> list); |
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.zc.business.service; |
|||
|
|||
import java.util.List; |
|||
import com.zc.business.domain.DcPublishManage; |
|||
|
|||
/** |
|||
* 信息发布管理记录Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
public interface IDcPublishManageService |
|||
{ |
|||
/** |
|||
* 查询信息发布管理记录 |
|||
* |
|||
* @param id 信息发布管理记录主键 |
|||
* @return 信息发布管理记录 |
|||
*/ |
|||
public DcPublishManage selectDcPublishManageById(Long id); |
|||
|
|||
/** |
|||
* 查询信息发布管理记录列表 |
|||
* |
|||
* @param dcPublishManage 信息发布管理记录 |
|||
* @return 信息发布管理记录集合 |
|||
*/ |
|||
List<DcPublishManage> selectDcPublishManageList(DcPublishManage dcPublishManage); |
|||
|
|||
/** |
|||
* 新增信息发布管理记录 |
|||
* |
|||
* @param dcPublishManage 信息发布管理记录 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcPublishManage(DcPublishManage dcPublishManage); |
|||
|
|||
/** |
|||
* 修改信息发布管理记录 |
|||
* |
|||
* @param dcPublishManage 信息发布管理记录 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcPublishManage(DcPublishManage dcPublishManage); |
|||
|
|||
/** |
|||
* 批量删除信息发布管理记录 |
|||
* |
|||
* @param ids 需要删除的信息发布管理记录主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcPublishManageByIds(Long[] ids); |
|||
|
|||
/** |
|||
* 删除信息发布管理记录信息 |
|||
* |
|||
* @param id 信息发布管理记录主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcPublishManageById(Long id); |
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.zc.business.service; |
|||
|
|||
import java.util.List; |
|||
import com.zc.business.domain.DcPublishingChannels; |
|||
|
|||
/** |
|||
* 发布渠道Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
public interface IDcPublishingChannelsService |
|||
{ |
|||
/** |
|||
* 查询发布渠道 |
|||
* |
|||
* @param id 发布渠道主键 |
|||
* @return 发布渠道 |
|||
*/ |
|||
public DcPublishingChannels selectDcPublishingChannelsById(Long id); |
|||
|
|||
/** |
|||
* 查询发布渠道列表 |
|||
* |
|||
* @param dcPublishingChannels 发布渠道 |
|||
* @return 发布渠道集合 |
|||
*/ |
|||
List<DcPublishingChannels> selectDcPublishingChannelsList(DcPublishingChannels dcPublishingChannels); |
|||
|
|||
/** |
|||
* 新增发布渠道 |
|||
* |
|||
* @param dcPublishingChannels 发布渠道 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels); |
|||
|
|||
/** |
|||
* 修改发布渠道 |
|||
* |
|||
* @param dcPublishingChannels 发布渠道 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcPublishingChannels(DcPublishingChannels dcPublishingChannels); |
|||
|
|||
/** |
|||
* 批量删除发布渠道 |
|||
* |
|||
* @param ids 需要删除的发布渠道主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcPublishingChannelsByIds(Long[] ids); |
|||
|
|||
/** |
|||
* 删除发布渠道信息 |
|||
* |
|||
* @param id 发布渠道主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcPublishingChannelsById(Long id); |
|||
//查询数据类型是否已经存在
|
|||
public List<DcPublishingChannels> selectChannelsDataCategory(Integer dataCategory); |
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.zc.business.service; |
|||
|
|||
import com.zc.business.domain.DcVoiceBroadcast; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 语音广播预发布Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
public interface IDcVoiceBroadcastService |
|||
{ |
|||
/** |
|||
* 查询语音广播预发布 |
|||
* |
|||
* @param id 语音广播预发布主键 |
|||
* @return 语音广播预发布 |
|||
*/ |
|||
public DcVoiceBroadcast selectDcVoiceBroadcastById(Long id); |
|||
|
|||
/** |
|||
* 查询语音广播预发布列表 |
|||
* |
|||
* @param dcVoiceBroadcast 语音广播预发布 |
|||
* @return 语音广播预发布集合 |
|||
*/ |
|||
List<DcVoiceBroadcast> selectDcVoiceBroadcastList(DcVoiceBroadcast dcVoiceBroadcast); |
|||
|
|||
/** |
|||
* 新增语音广播预发布 |
|||
* |
|||
* @param dcVoiceBroadcast 语音广播预发布 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast); |
|||
|
|||
/** |
|||
* 修改语音广播预发布 |
|||
* |
|||
* @param dcVoiceBroadcast 语音广播预发布 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast); |
|||
|
|||
/** |
|||
* 批量删除语音广播预发布 |
|||
* |
|||
* @param ids 需要删除的语音广播预发布主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcVoiceBroadcastByIds(Long[] ids); |
|||
|
|||
/** |
|||
* 删除语音广播预发布信息 |
|||
* |
|||
* @param id 语音广播预发布主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcVoiceBroadcastById(Long id); |
|||
|
|||
List<DcVoiceBroadcast> selectDcVoiceBroadcastListByCategory(String category); |
|||
} |
@ -0,0 +1,107 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import com.ruoyi.common.utils.DateUtils; |
|||
import com.zc.business.domain.DcPublishManage; |
|||
import com.zc.business.mapper.DcPublishManageMapper; |
|||
import com.zc.business.service.IDcPublishManageService; |
|||
import com.zc.business.utils.StakeMarkUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 信息发布管理记录Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
@Service |
|||
public class DcPublishManageServiceImpl implements IDcPublishManageService |
|||
{ |
|||
@Autowired |
|||
private DcPublishManageMapper dcPublishManageMapper; |
|||
|
|||
/** |
|||
* 查询信息发布管理记录 |
|||
* |
|||
* @param id 信息发布管理记录主键 |
|||
* @return 信息发布管理记录 |
|||
*/ |
|||
@Override |
|||
public DcPublishManage selectDcPublishManageById(Long id) |
|||
{ |
|||
return dcPublishManageMapper.selectDcPublishManageById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询信息发布管理记录列表 |
|||
* |
|||
* @param dcPublishManage 信息发布管理记录 |
|||
* @return 信息发布管理记录 |
|||
*/ |
|||
@Override |
|||
public List<DcPublishManage> selectDcPublishManageList(DcPublishManage dcPublishManage) |
|||
{ |
|||
StakeMarkUtils stakeMarkUtils = new StakeMarkUtils(); |
|||
if (StringUtils.isNotBlank(dcPublishManage.getStartStakeMarkValue())) { |
|||
Integer stakeMark = stakeMarkUtils.stakeMarkToInt(dcPublishManage.getStartStakeMarkValue()); |
|||
dcPublishManage.setStartStakeMark(stakeMark); |
|||
} |
|||
if (StringUtils.isNotBlank(dcPublishManage.getEndStakeMarkValue())) { |
|||
Integer endMark = stakeMarkUtils.stakeMarkToInt(dcPublishManage.getEndStakeMarkValue()); |
|||
dcPublishManage.setEndStakeMark(endMark); |
|||
} |
|||
return dcPublishManageMapper.selectDcPublishManageList(dcPublishManage); |
|||
} |
|||
|
|||
/** |
|||
* 新增信息发布管理记录 |
|||
* |
|||
* @param dcPublishManage 信息发布管理记录 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertDcPublishManage(DcPublishManage dcPublishManage) |
|||
{ |
|||
dcPublishManage.setCreateTime(DateUtils.getNowDate()); |
|||
return dcPublishManageMapper.insertDcPublishManage(dcPublishManage); |
|||
} |
|||
|
|||
/** |
|||
* 修改信息发布管理记录 |
|||
* @param dcPublishManage 信息发布管理记录 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateDcPublishManage(DcPublishManage dcPublishManage) |
|||
{ |
|||
dcPublishManage.setUpdateTime(DateUtils.getNowDate()); |
|||
return dcPublishManageMapper.updateDcPublishManage(dcPublishManage); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除信息发布管理记录 |
|||
* |
|||
* @param ids 需要删除的信息发布管理记录主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcPublishManageByIds(Long[] ids) |
|||
{ |
|||
return dcPublishManageMapper.deleteDcPublishManageByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除信息发布管理记录信息 |
|||
* |
|||
* @param id 信息发布管理记录主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcPublishManageById(Long id) |
|||
{ |
|||
return dcPublishManageMapper.deleteDcPublishManageById(id); |
|||
} |
|||
} |
@ -0,0 +1,101 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import java.util.List; |
|||
import com.ruoyi.common.utils.DateUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import com.zc.business.mapper.DcPublishingChannelsMapper; |
|||
import com.zc.business.domain.DcPublishingChannels; |
|||
import com.zc.business.service.IDcPublishingChannelsService; |
|||
|
|||
/** |
|||
* 发布渠道Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
@Service |
|||
public class DcPublishingChannelsServiceImpl implements IDcPublishingChannelsService |
|||
{ |
|||
@Autowired |
|||
private DcPublishingChannelsMapper dcPublishingChannelsMapper; |
|||
|
|||
/** |
|||
* 查询发布渠道 |
|||
* |
|||
* @param id 发布渠道主键 |
|||
* @return 发布渠道 |
|||
*/ |
|||
@Override |
|||
public DcPublishingChannels selectDcPublishingChannelsById(Long id) |
|||
{ |
|||
return dcPublishingChannelsMapper.selectDcPublishingChannelsById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询发布渠道列表 |
|||
* |
|||
* @param dcPublishingChannels 发布渠道 |
|||
* @return 发布渠道 |
|||
*/ |
|||
@Override |
|||
public List<DcPublishingChannels> selectDcPublishingChannelsList(DcPublishingChannels dcPublishingChannels) |
|||
{ |
|||
return dcPublishingChannelsMapper.selectDcPublishingChannelsList(dcPublishingChannels); |
|||
} |
|||
|
|||
/** |
|||
* 新增发布渠道 |
|||
* |
|||
* @param dcPublishingChannels 发布渠道 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels) |
|||
{ |
|||
dcPublishingChannels.setCreateTime(DateUtils.getNowDate()); |
|||
return dcPublishingChannelsMapper.insertDcPublishingChannels(dcPublishingChannels); |
|||
} |
|||
|
|||
/** |
|||
* 修改发布渠道 |
|||
* |
|||
* @param dcPublishingChannels 发布渠道 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateDcPublishingChannels(DcPublishingChannels dcPublishingChannels) |
|||
{ |
|||
dcPublishingChannels.setUpdateTime(DateUtils.getNowDate()); |
|||
return dcPublishingChannelsMapper.updateDcPublishingChannels(dcPublishingChannels); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除发布渠道 |
|||
* |
|||
* @param ids 需要删除的发布渠道主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcPublishingChannelsByIds(Long[] ids) |
|||
{ |
|||
return dcPublishingChannelsMapper.deleteDcPublishingChannelsByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除发布渠道信息 |
|||
* |
|||
* @param id 发布渠道主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcPublishingChannelsById(Long id) |
|||
{ |
|||
return dcPublishingChannelsMapper.deleteDcPublishingChannelsById(id); |
|||
} |
|||
//查询数据类型是否已经存在
|
|||
@Override |
|||
public List<DcPublishingChannels> selectChannelsDataCategory(Integer dataCategory) { |
|||
return dcPublishingChannelsMapper.selectChannelsDataCategory(dataCategory); |
|||
} |
|||
} |
@ -0,0 +1,165 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.ruoyi.common.core.redis.RedisCache; |
|||
import com.ruoyi.common.utils.StringUtils; |
|||
import com.zc.business.constant.RedisKeyConstants; |
|||
import com.zc.business.domain.DcDevice; |
|||
import com.zc.business.domain.DcSwitch; |
|||
import com.zc.business.mapper.DcSwitchMapper; |
|||
import com.zc.business.service.DcSwitchService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.*; |
|||
import java.util.concurrent.CountDownLatch; |
|||
import java.util.concurrent.ExecutorService; |
|||
import java.util.concurrent.Executors; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 交换机Service实现类 |
|||
* |
|||
* @author wangjiabao |
|||
* @date 2024-04-19 |
|||
*/ |
|||
@Service |
|||
public class DcSwitchServiceImpl extends ServiceImpl<DcSwitchMapper, DcSwitch> implements DcSwitchService { |
|||
|
|||
@Resource |
|||
private DcSwitchMapper dcSwitchMapper; |
|||
|
|||
@Resource |
|||
private RedisCache redisCache; |
|||
|
|||
/** |
|||
* 查询交换机 |
|||
*/ |
|||
@Override |
|||
public List<DcSwitch> getSwitchList(DcSwitch dcSwitch) { |
|||
return getDeviceListBySwitch(dcSwitchMapper.getSwitchList(dcSwitch)); |
|||
} |
|||
|
|||
/** |
|||
* 根据设备列表查询设备 |
|||
*/ |
|||
@Override |
|||
public List<DcDevice> getDeviceList(String deviceList) { |
|||
if (StringUtils.isEmpty(deviceList)) { |
|||
return new ArrayList<>(); |
|||
} |
|||
List<String> devices = Arrays.stream(deviceList.split(",")).collect(Collectors.toList()); |
|||
List<DcDevice> dcDevices = new ArrayList<>(); |
|||
devices.forEach(device -> { |
|||
DcDevice cacheMapValue = redisCache.getCacheMapValue(RedisKeyConstants.DC_DEVICE_ID,device); |
|||
dcDevices.add(cacheMapValue); |
|||
}); |
|||
return dcDevices; |
|||
} |
|||
|
|||
/** |
|||
* 查询所有数据 |
|||
* |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<DcSwitch> getSwitchListAll() { |
|||
List<DcSwitch> deviceListBySwitch = dcSwitchMapper.getSwitchList(new DcSwitch()); |
|||
List<DcSwitch> dcSwitches = getDeviceListBySwitch(deviceListBySwitch); |
|||
List<DcSwitch> returnList = new ArrayList<>(); |
|||
List<Integer> tempList = new ArrayList<>(); |
|||
for (DcSwitch switche : dcSwitches) { |
|||
tempList.add(switche.getSwitchId()); |
|||
} |
|||
for (DcSwitch switches : dcSwitches) { |
|||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
|||
if (!tempList.contains(switches.getParentId())) { |
|||
recursionFn(dcSwitches, switches); |
|||
returnList.add(switches); |
|||
} |
|||
} |
|||
if (returnList.isEmpty()) { |
|||
returnList = dcSwitches; |
|||
} |
|||
return returnList; |
|||
} |
|||
|
|||
/** |
|||
* 处置交换机数据-获取设备数据 |
|||
* @param list |
|||
* @return |
|||
*/ |
|||
public List<DcSwitch> getDeviceListBySwitch(List<DcSwitch> list) { |
|||
ExecutorService executor = Executors.newFixedThreadPool(100); |
|||
CountDownLatch latch = new CountDownLatch(list.size()); |
|||
list.forEach(dcSwitch -> { |
|||
executor.execute(() ->{ |
|||
try { |
|||
if (StringUtils.isNotEmpty(dcSwitch.getDeviceList())) { |
|||
// 说明是设备交换机
|
|||
List<DcDevice> deviceList = getDeviceList(dcSwitch.getDeviceList()); |
|||
if (deviceList.size() > 0) { |
|||
Map<String, List<DcDevice>> collect = deviceList.stream().collect(Collectors.groupingBy(DcDevice::getDeviceType)); |
|||
dcSwitch.setDcDeviceList(collect); |
|||
} |
|||
} |
|||
}catch (Exception e) { |
|||
e.printStackTrace(); |
|||
}finally { |
|||
latch.countDown(); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
try { |
|||
latch.await(); // 等待所有线程执行完毕
|
|||
} catch (InterruptedException e) { |
|||
Thread.currentThread().interrupt(); |
|||
} finally { |
|||
executor.shutdown(); |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
/** |
|||
* 批量修改网络状态 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public int updateBatchByNetWorkStatus(List<DcSwitch> list) { |
|||
return dcSwitchMapper.updateBatchByNetWorkStatus(list); |
|||
} |
|||
|
|||
private void recursionFn(List<DcSwitch> list, DcSwitch t) { |
|||
// 得到子节点列表
|
|||
List<DcSwitch> childList = getChildList(list, t); |
|||
t.setChildren(childList); |
|||
for (DcSwitch tChild : childList) { |
|||
if (hasChild(list, tChild)) { |
|||
recursionFn(list, tChild); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 得到子节点列表 |
|||
*/ |
|||
private List<DcSwitch> getChildList(List<DcSwitch> list, DcSwitch t) { |
|||
List<DcSwitch> tlist = new ArrayList<>(); |
|||
Iterator<DcSwitch> it = list.iterator(); |
|||
while (it.hasNext()) { |
|||
DcSwitch n = (DcSwitch) it.next(); |
|||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getSwitchId().longValue()) { |
|||
tlist.add(n); |
|||
} |
|||
} |
|||
return tlist; |
|||
} |
|||
|
|||
/** |
|||
* 判断是否有子节点 |
|||
*/ |
|||
private boolean hasChild(List<DcSwitch> list, DcSwitch t) { |
|||
return getChildList(list, t).size() > 0; |
|||
} |
|||
} |
@ -0,0 +1,102 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import java.util.List; |
|||
import com.ruoyi.common.utils.DateUtils; |
|||
import com.zc.business.domain.DcVoiceBroadcast; |
|||
import com.zc.business.mapper.DcVoiceBroadcastMapper; |
|||
import com.zc.business.service.IDcVoiceBroadcastService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
|
|||
/** |
|||
* 语音广播预发布Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-04-19 |
|||
*/ |
|||
@Service |
|||
public class DcVoiceBroadcastServiceImpl implements IDcVoiceBroadcastService |
|||
{ |
|||
@Autowired |
|||
private DcVoiceBroadcastMapper dcVoiceBroadcastMapper; |
|||
|
|||
/** |
|||
* 查询语音广播预发布 |
|||
* |
|||
* @param id 语音广播预发布主键 |
|||
* @return 语音广播预发布 |
|||
*/ |
|||
@Override |
|||
public DcVoiceBroadcast selectDcVoiceBroadcastById(Long id) |
|||
{ |
|||
return dcVoiceBroadcastMapper.selectDcVoiceBroadcastById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询语音广播预发布列表 |
|||
* |
|||
* @param dcVoiceBroadcast 语音广播预发布 |
|||
* @return 语音广播预发布 |
|||
*/ |
|||
@Override |
|||
public List<DcVoiceBroadcast> selectDcVoiceBroadcastList(DcVoiceBroadcast dcVoiceBroadcast) |
|||
{ |
|||
return dcVoiceBroadcastMapper.selectDcVoiceBroadcastList(dcVoiceBroadcast); |
|||
} |
|||
|
|||
/** |
|||
* 新增语音广播预发布 |
|||
* |
|||
* @param dcVoiceBroadcast 语音广播预发布 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast) |
|||
{ |
|||
dcVoiceBroadcast.setCreateTime(DateUtils.getNowDate()); |
|||
return dcVoiceBroadcastMapper.insertDcVoiceBroadcast(dcVoiceBroadcast); |
|||
} |
|||
|
|||
/** |
|||
* 修改语音广播预发布 |
|||
* |
|||
* @param dcVoiceBroadcast 语音广播预发布 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast) |
|||
{ |
|||
dcVoiceBroadcast.setUpdateTime(DateUtils.getNowDate()); |
|||
return dcVoiceBroadcastMapper.updateDcVoiceBroadcast(dcVoiceBroadcast); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除语音广播预发布 |
|||
* |
|||
* @param ids 需要删除的语音广播预发布主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcVoiceBroadcastByIds(Long[] ids) |
|||
{ |
|||
return dcVoiceBroadcastMapper.deleteDcVoiceBroadcastByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除语音广播预发布信息 |
|||
* |
|||
* @param id 语音广播预发布主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcVoiceBroadcastById(Long id) |
|||
{ |
|||
return dcVoiceBroadcastMapper.deleteDcVoiceBroadcastById(id); |
|||
} |
|||
|
|||
@Override |
|||
public List<DcVoiceBroadcast> selectDcVoiceBroadcastListByCategory(String category) { |
|||
return dcVoiceBroadcastMapper.selectDcVoiceBroadcastListByCategory(category); |
|||
} |
|||
} |
@ -0,0 +1,174 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zc.business.mapper.DcPublishManageMapper"> |
|||
|
|||
<resultMap type="DcPublishManage" id="DcPublishManageResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="eventId" column="event_id" /> |
|||
<result property="deptId" column="dept_id" /> |
|||
<result property="publishChannelsId" column="publish_channels_id" /> |
|||
<result property="title" column="title" /> |
|||
<result property="publishChannels" column="publish_channels" /> |
|||
<result property="isverify" column="isverify" /> |
|||
<result property="publisher" column="publisher" /> |
|||
<result property="auditor1" column="auditor_1" /> |
|||
<result property="auditor2" column="auditor_2" /> |
|||
<result property="auditTime1" column="audit_time_1" /> |
|||
<result property="auditTime2" column="audit_time_2" /> |
|||
<result property="auditComment1" column="audit_comment_1" /> |
|||
<result property="auditComment2" column="audit_comment_2" /> |
|||
<result property="publishTime" column="publish_time" /> |
|||
<result property="publishStatus" column="publish_status" /> |
|||
<result property="contentDetails" column="content_details" /> |
|||
<result property="remark" column="remark" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="direction" column="direction" /> |
|||
<result property="stakeMark" column="stake_mark" /> |
|||
<result property="eventType" column="event_type" /> |
|||
<result property="eventSubclass" column="event_subclass" /> |
|||
<result property="eventTime" column="eventTime" /> |
|||
<result property="facilityName" column="facility_name" /> |
|||
<result property="eventState" column="event_state" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcPublishManageVo"> |
|||
select facility.facility_name, |
|||
manage.id, manage.event_id, manage.publish_channels_id, |
|||
manage.title, manage.publish_channels , manage.publisher, |
|||
manage.publish_time, manage.create_time, |
|||
manage.publish_status, manage.content_details, manage.remark, |
|||
event.create_time eventTime,event.direction,event.stake_mark, |
|||
event.event_type,event.event_subclass,event.event_state |
|||
from dc_publish_manage as manage |
|||
LEFT JOIN dc_event as event on event.id=manage.event_id |
|||
LEFT JOIN dc_event_traffic_control as traffic on event.id=traffic.id |
|||
LEFT JOIN dc_facility as facility ON traffic.facility_id=facility.id |
|||
</sql> |
|||
|
|||
<select id="selectDcPublishManageList" parameterType="DcPublishManage" resultMap="DcPublishManageResult"> |
|||
<include refid="selectDcPublishManageVo"/> |
|||
<where> |
|||
<if test="eventState != null"> and event.event_state = #{eventState}</if> |
|||
<if test="eventType != null and eventType != ''"> and event.event_type = #{eventType}</if> |
|||
<if test="publishStatus != null and publishStatus != '' "> and manage.publish_status = #{publishStatus}</if> |
|||
<if test="startTime != null and endTime != null "> |
|||
and manage.create_time between #{startTime} and #{endTime} |
|||
</if> |
|||
<if test="startStakeMark != null and startStakeMark != ''"> |
|||
and CAST(SUBSTRING(SUBSTRING_INDEX(event.stake_mark,'+',1),2)AS UNSIGNED)*1000 |
|||
+CAST(SUBSTRING_INDEX(event.stake_mark, '+', -1) AS UNSIGNED)>=#{startStakeMark} |
|||
</if> |
|||
<if test=" endStakeMark != null and endStakeMark != '' "> |
|||
and CAST(SUBSTRING(SUBSTRING_INDEX(event.stake_mark,'+',1),2)AS UNSIGNED)*1000 |
|||
+CAST(SUBSTRING_INDEX(event.stake_mark, '+', -1) AS UNSIGNED)<=#{endStakeMark} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcPublishManageById" parameterType="Long" resultMap="DcPublishManageResult"> |
|||
<include refid="selectDcPublishManageVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
<select id="selectEventType" resultType="java.lang.Integer"> |
|||
select event_type from dc_event where id=#{eventId} |
|||
</select> |
|||
<select id="selectPublishManage" resultType="com.zc.business.domain.DcPublishManage"> |
|||
select id,publish_channels from dc_publishing_channels where enabled=2 and data_category=#{dataCategory} |
|||
</select> |
|||
<select id="selectDcPublishManageListMap" resultType="java.util.HashMap"> |
|||
select |
|||
event.occurrence_time,event.direction,event.event_type,event.stake_mark, |
|||
manage.id, manage.event_id, manage.publish_channels_id, |
|||
manage.title, manage.publish_channels, manage.publisher, |
|||
manage.publish_time, manage.publish_status, manage.content_details, manage.remark, |
|||
manage.update_time, manage.create_time from dc_publish_manage as manage |
|||
LEFT JOIN dc_event as event on manage.event_id=event.id |
|||
|
|||
</select> |
|||
|
|||
<insert id="insertDcPublishManage" parameterType="DcPublishManage" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into dc_publish_manage |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="eventId != null and eventId != ''">event_id,</if> |
|||
<if test="deptId != null">dept_id,</if> |
|||
<if test="publishChannelsId != null">publish_channels_id,</if> |
|||
<if test="title != null">title,</if> |
|||
<if test="publishChannels != null">publish_channels,</if> |
|||
<if test="isverify != null">isverify,</if> |
|||
<if test="publisher != null and publisher != ''">publisher,</if> |
|||
<if test="auditor1 != null">auditor_1,</if> |
|||
<if test="auditor2 != null">auditor_2,</if> |
|||
<if test="auditTime1 != null">audit_time_1,</if> |
|||
<if test="auditTime2 != null">audit_time_2,</if> |
|||
<if test="auditComment1 != null">audit_comment_1,</if> |
|||
<if test="auditComment2 != null">audit_comment_2,</if> |
|||
<if test="publishTime != null">publish_time,</if> |
|||
<if test="publishStatus != null">publish_status,</if> |
|||
<if test="contentDetails != null">content_details,</if> |
|||
<if test="remark != null">remark,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="eventId != null and eventId != ''">#{eventId},</if> |
|||
<if test="deptId != null">#{deptId},</if> |
|||
<if test="publishChannelsId != null">#{publishChannelsId},</if> |
|||
<if test="title != null">#{title},</if> |
|||
<if test="publishChannels != null">#{publishChannels},</if> |
|||
<if test="isverify != null">#{isverify},</if> |
|||
<if test="publisher != null and publisher != ''">#{publisher},</if> |
|||
<if test="auditor1 != null">#{auditor1},</if> |
|||
<if test="auditor2 != null">#{auditor2},</if> |
|||
<if test="auditTime1 != null">#{auditTime1},</if> |
|||
<if test="auditTime2 != null">#{auditTime2},</if> |
|||
<if test="auditComment1 != null">#{auditComment1},</if> |
|||
<if test="auditComment2 != null">#{auditComment2},</if> |
|||
<if test="publishTime != null">#{publishTime},</if> |
|||
<if test="publishStatus != null">#{publishStatus},</if> |
|||
<if test="contentDetails != null">#{contentDetails},</if> |
|||
<if test="remark != null">#{remark},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcPublishManage" parameterType="DcPublishManage"> |
|||
update dc_publish_manage |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="eventId != null and eventId != ''">event_id = #{eventId},</if> |
|||
<if test="deptId != null">dept_id = #{deptId},</if> |
|||
<if test="publishChannelsId != null">publish_channels_id = #{publishChannelsId},</if> |
|||
<if test="title != null">title = #{title},</if> |
|||
<if test="publishChannels != null">publish_channels = #{publishChannels},</if> |
|||
<if test="isverify != null">isverify = #{isverify},</if> |
|||
<if test="publisher != null and publisher != ''">publisher = #{publisher},</if> |
|||
<if test="auditor1 != null">auditor_1 = #{auditor1},</if> |
|||
<if test="auditor2 != null">auditor_2 = #{auditor2},</if> |
|||
<if test="auditTime1 != null">audit_time_1 = #{auditTime1},</if> |
|||
<if test="auditTime2 != null">audit_time_2 = #{auditTime2},</if> |
|||
<if test="auditComment1 != null">audit_comment_1 = #{auditComment1},</if> |
|||
<if test="auditComment2 != null">audit_comment_2 = #{auditComment2},</if> |
|||
<if test="publishTime != null">publish_time = #{publishTime},</if> |
|||
<if test="publishStatus != null">publish_status = #{publishStatus},</if> |
|||
<if test="contentDetails != null">content_details = #{contentDetails},</if> |
|||
<if test="remark != null">remark = #{remark},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcPublishManageById" parameterType="Long"> |
|||
delete from dc_publish_manage where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcPublishManageByIds" parameterType="String"> |
|||
delete from dc_publish_manage where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
@ -0,0 +1,92 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zc.business.mapper.DcPublishingChannelsMapper"> |
|||
|
|||
<resultMap type="DcPublishingChannels" id="DcPublishingChannelsResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="dataCategory" column="data_category" /> |
|||
<result property="infoLevel" column="info_level" /> |
|||
<result property="enabled" column="enabled" /> |
|||
<result property="auditMethod" column="audit_method" /> |
|||
<result property="publishChannels" column="publish_channels" /> |
|||
<result property="enableDate" column="enable_date" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcPublishingChannelsVo"> |
|||
select id, data_category, info_level, enabled, audit_method, publish_channels, enable_date, create_time, update_time from dc_publishing_channels |
|||
</sql> |
|||
|
|||
<select id="selectDcPublishingChannelsList" parameterType="DcPublishingChannels" resultMap="DcPublishingChannelsResult"> |
|||
<include refid="selectDcPublishingChannelsVo"/> |
|||
<where> |
|||
<if test="dataCategory != null "> and data_category = #{dataCategory}</if> |
|||
<if test="infoLevel != null "> and info_level = #{infoLevel}</if> |
|||
<if test="enabled != null "> and enabled = #{enabled}</if> |
|||
<if test="auditMethod != null "> and audit_method = #{auditMethod}</if> |
|||
<if test="publishChannels != null and publishChannels != ''"> and publish_channels = #{publishChannels}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcPublishingChannelsById" parameterType="Long" resultMap="DcPublishingChannelsResult"> |
|||
<include refid="selectDcPublishingChannelsVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
|
|||
<insert id="insertDcPublishingChannels" parameterType="DcPublishingChannels" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into dc_publishing_channels |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="dataCategory != null">data_category,</if> |
|||
<if test="infoLevel != null">info_level,</if> |
|||
<if test="enabled != null">enabled,</if> |
|||
<if test="auditMethod != null">audit_method,</if> |
|||
<if test="publishChannels != null and publishChannels != ''">publish_channels,</if> |
|||
<if test="enableDate != null">enable_date,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="dataCategory != null">#{dataCategory},</if> |
|||
<if test="infoLevel != null">#{infoLevel},</if> |
|||
<if test="enabled != null">#{enabled},</if> |
|||
<if test="auditMethod != null">#{auditMethod},</if> |
|||
<if test="publishChannels != null and publishChannels != ''">#{publishChannels},</if> |
|||
<if test="enableDate != null">#{enableDate},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcPublishingChannels" parameterType="DcPublishingChannels"> |
|||
update dc_publishing_channels |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="dataCategory != null">data_category = #{dataCategory},</if> |
|||
<if test="infoLevel != null">info_level = #{infoLevel},</if> |
|||
<if test="enabled != null">enabled = #{enabled},</if> |
|||
<if test="auditMethod != null">audit_method = #{auditMethod},</if> |
|||
<if test="publishChannels != null and publishChannels != ''">publish_channels = #{publishChannels},</if> |
|||
<if test="enableDate != null">enable_date = #{enableDate},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcPublishingChannelsById" parameterType="Long"> |
|||
delete from dc_publishing_channels where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcPublishingChannelsByIds" parameterType="String"> |
|||
delete from dc_publishing_channels where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
<select id="selectChannelsDataCategory" resultType="com.zc.business.domain.DcPublishingChannels"> |
|||
select id from dc_publishing_channels where data_category=#{dataCategory} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,60 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zc.business.mapper.DcSwitchMapper"> |
|||
|
|||
<resultMap type="DcSwitch" id="DcSwitch"> |
|||
<result property="switchId" column="switch_id"/> |
|||
<result property="parentId" column="parent_id"/> |
|||
<result property="ancestors" column="ancestors"/> |
|||
<result property="switchName" column="switch_name"/> |
|||
<result property="stakeMark" column="stake_mark"/> |
|||
<result property="deviceList" column="device_list"/> |
|||
<result property="switchIp" column="switch_ip"/> |
|||
<result property="ringNetWork" column="ring_netWork"/> |
|||
<result property="netWorkStatus" column="netWork_status"/> |
|||
<result property="userState" column="user_state"/> |
|||
<result property="stakeMark" column="stake_mark"/> |
|||
<result property="createTime" column="create_time"/> |
|||
<result property="updateTime" column="update_time"/> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcSwitchVo"> |
|||
select switch_id, |
|||
parent_id, |
|||
ancestors, |
|||
switch_name, |
|||
stake_mark, |
|||
device_list, |
|||
switch_ip, |
|||
ring_netWork, |
|||
netWork_status, |
|||
user_state, |
|||
create_time, |
|||
update_time |
|||
from dc_switch |
|||
</sql> |
|||
|
|||
<select id="getSwitchList" parameterType="DcSwitch" resultType="DcSwitch"> |
|||
<include refid="selectDcSwitchVo"/> |
|||
<where> |
|||
user_state = 1 |
|||
<if test="parentId != null ">and parent_id = #{parentId}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<update id="updateBatchByNetWorkStatus" parameterType="List"> |
|||
update dc_switch set netWork_status = |
|||
<foreach collection="list" item="item" index="index" |
|||
separator=" " open="case switch_id" close="end"> |
|||
when #{item.switchId} then #{item.netWorkStatus} |
|||
</foreach> |
|||
where switch_id in |
|||
<foreach collection="list" item="item" index="index" |
|||
separator="," open="(" close=")"> |
|||
#{item.switchId} |
|||
</foreach> |
|||
</update> |
|||
|
|||
</mapper> |
@ -0,0 +1,78 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zc.business.mapper.DcVoiceBroadcastMapper"> |
|||
|
|||
<resultMap type="com.zc.business.domain.DcVoiceBroadcast" id="DcVoiceBroadcastResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="category" column="category" /> |
|||
<result property="content" column="content" /> |
|||
<result property="remark" column="remark" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcVoiceBroadcastVo"> |
|||
select id, category, content, remark, create_time, update_time from dc_voice_broadcast |
|||
</sql> |
|||
|
|||
<select id="selectDcVoiceBroadcastList" parameterType="com.zc.business.domain.DcVoiceBroadcast" resultMap="DcVoiceBroadcastResult"> |
|||
<include refid="selectDcVoiceBroadcastVo"/> |
|||
<where> |
|||
<if test="category != null and category != ''"> and category = #{category}</if> |
|||
<if test="content != null and content != ''"> and content = #{content}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcVoiceBroadcastById" parameterType="Long" resultMap="DcVoiceBroadcastResult"> |
|||
<include refid="selectDcVoiceBroadcastVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<select id="selectDcVoiceBroadcastListByCategory" parameterType="string" resultMap="DcVoiceBroadcastResult"> |
|||
<include refid="selectDcVoiceBroadcastVo"/> |
|||
where category = #{category} |
|||
</select> |
|||
|
|||
<insert id="insertDcVoiceBroadcast" parameterType="com.zc.business.domain.DcVoiceBroadcast" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into dc_voice_broadcast |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="category != null">category,</if> |
|||
<if test="content != null">content,</if> |
|||
<if test="remark != null">remark,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="category != null">#{category},</if> |
|||
<if test="content != null">#{content},</if> |
|||
<if test="remark != null">#{remark},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcVoiceBroadcast" parameterType="com.zc.business.domain.DcVoiceBroadcast"> |
|||
update dc_voice_broadcast |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="category != null">category = #{category},</if> |
|||
<if test="content != null">content = #{content},</if> |
|||
<if test="remark != null">remark = #{remark},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcVoiceBroadcastById" parameterType="Long"> |
|||
delete from dc_voice_broadcast where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcVoiceBroadcastByIds" parameterType="String"> |
|||
delete from dc_voice_broadcast where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
Loading…
Reference in new issue