Browse Source

推送整和,事件绑定调度

develop
wangsixiang 7 months ago
parent
commit
4c094f2132
  1. 13
      zc-business/src/main/java/com/zc/business/controller/DcWarningController.java
  2. 71
      zc-business/src/main/java/com/zc/business/controller/MsmController.java
  3. 95
      zc-business/src/main/java/com/zc/business/controller/WeiboAuthUtil.java
  4. 36
      zc-business/src/main/java/com/zc/business/domain/DcDispatch.java
  5. 79
      zc-business/src/main/java/com/zc/business/domain/DcDispatchResource.java
  6. 2
      zc-business/src/main/java/com/zc/business/domain/DcVehicles.java
  7. 6
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  8. 6
      zc-business/src/main/java/com/zc/business/service/IDcWarningService.java
  9. 72
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  10. 1
      zc-business/src/main/java/com/zc/business/service/impl/MsmServiceImpl.java
  11. 39
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

13
zc-business/src/main/java/com/zc/business/controller/DcWarningController.java

@ -2,6 +2,8 @@ package com.zc.business.controller;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.uuid.IdUtils;
import com.zc.business.domain.DcDispatch;
import com.zc.business.domain.DcDispatchResource;
import com.zc.business.domain.DcWarningBatchConvert; import com.zc.business.domain.DcWarningBatchConvert;
import com.zc.business.service.IDcWarningService; import com.zc.business.service.IDcWarningService;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
@ -156,5 +158,14 @@ public class DcWarningController extends BaseController
} }
return (dcWarningService.commandAndDispatch(dcWarning)); return (dcWarningService.commandAndDispatch(dcWarning));
} }
//指挥调度记录新增
@PostMapping("/insertDispatch")
public AjaxResult insertDispatch(@RequestBody DcDispatch dcDispatch){
return AjaxResult.success(dcWarningService.insertDispatch(dcDispatch));
}
//指挥调度资源新增
@PostMapping("/insertSource")
public AjaxResult insertDispatchSource(@RequestBody DcDispatchResource dcDispatchResource){
return toAjax(dcWarningService.insertDispatchSource(dcDispatchResource));
}
} }

71
zc-business/src/main/java/com/zc/business/controller/MsmController.java

@ -1,15 +1,22 @@
package com.zc.business.controller; package com.zc.business.controller;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcWarning; import com.zc.business.domain.DcWarning;
import com.zc.business.service.IMsmService; import com.zc.business.service.IMsmService;
import com.zc.business.utils.HttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.omg.CORBA.INTERNAL;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.lang.reflect.Array;
import java.rmi.MarshalledObject;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
/** /**
@ -26,13 +33,71 @@ public class MsmController extends BaseController {
* 短信推送业务,阿里云短信业务 * 短信推送业务,阿里云短信业务
*/ */
@PostMapping("/push") @PostMapping("/push")
public Boolean alibabaCloudSms() public Boolean alibabaCloudSms(@RequestBody HashMap map)
{ {
return msmService.send("19806114248"); String type = map.get("type").toString();
if (map==null|| StringUtils.isBlank(map.get("phone").toString())){
return false;
}
String string = map.get("phone").toString();
return msmService.send(string);
} }
//调用微信推送 //调用微信推送
@PostMapping("/wenXinPush") @PostMapping("/wenXinPush")
public AjaxResult commandAndDispatch(){ public AjaxResult commandAndDispatch(@RequestBody HashMap map){
return AjaxResult.success(msmService.wenXinSend("wx9ee0e3babfd8d2af","de2ecb80b30d63135918ba3ae6ffb711")); return AjaxResult.success(msmService.wenXinSend("wx9ee0e3babfd8d2af","de2ecb80b30d63135918ba3ae6ffb711"));
} }
//整合推送
@PostMapping("/pushAll")
public AjaxResult pushAll(@RequestBody HashMap map)
{
if (map == null || StringUtils.isBlank(map.get("type").toString())) {
return AjaxResult.error("参数错误");
}
ArrayList<String> array = (ArrayList<String>) map.get("type");
Boolean send = null;
Integer data = null;
String weiXin = "微信推送失败"; // 初始化为成功状态
String message = "短信推送失败"; // 初始化为失败状态
for (String type : array) {
if ("1".equals(type)) { //短信
if (map == null || StringUtils.isBlank(map.get("phone").toString())) {
return AjaxResult.error("手机号为空");
}
String string = map.get("phone").toString();
send = msmService.send(string);
continue;
}
if ("2".equals(type)) { //微信
JSONArray objects = msmService.wenXinSend("wx9ee0e3babfd8d2af", "de2ecb80b30d63135918ba3ae6ffb711");
data = (Integer) objects.get(0);
continue;
}
}
if (send==null){
message=null;
}else if (send){
message = "短信推送成功"; // 如果 send 为 true,则短信推送成功
}
if (data==null){
weiXin=null;
}else if (data==0){
weiXin = "微信推送成功"; // 如果所有 dateValue 都为0,则微信推送成功
}
if (message!=null&&"短信推送成功".equals(message) &&weiXin!=null&&"微信推送成功".equals(weiXin)) {
return AjaxResult.success(message +","+ weiXin);
} else if (message==null&&weiXin!=null&&"微信推送成功".equals(weiXin)){
return AjaxResult.success(weiXin);
}else if (message!=null&&"短信推送成功".equals(message)&&weiXin==null){
return AjaxResult.success(message);
}else if (message!=null&&"短信推送失败".equals(message)&&weiXin==null){
return AjaxResult.error(message);
}else if (message==null&&"微信推送失败".equals(weiXin)){
return AjaxResult.error(weiXin);
}else {
return AjaxResult.error(message +","+ weiXin);
}
}
} }

95
zc-business/src/main/java/com/zc/business/controller/WeiboAuthUtil.java

@ -0,0 +1,95 @@
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.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
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;
/**
* @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;
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){
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);
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");
}
return null;
}
//执行调用推送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);
}
}
}
}
}

36
zc-business/src/main/java/com/zc/business/domain/DcDispatch.java

@ -52,6 +52,42 @@ private String organizationName;
private Date endTime; private Date endTime;
/** 1-人员2-车辆 */
@Excel(name = "1-人员 2-车辆")
private Integer dispatchType;
/** $column.columnComment */
@Excel(name = "资源id", readConverterExp = "$column.readConverterExp()")
private Long resourceId;
/** $column.columnComment */
@Excel(name = "调度记录id", readConverterExp = "$column.readConverterExp()")
private Long dispatchId;
public Integer getDispatchType() {
return dispatchType;
}
public void setDispatchType(Integer dispatchType) {
this.dispatchType = dispatchType;
}
public Long getResourceId() {
return resourceId;
}
public void setResourceId(Long resourceId) {
this.resourceId = resourceId;
}
public Long getDispatchId() {
return dispatchId;
}
public void setDispatchId(Long dispatchId) {
this.dispatchId = dispatchId;
}
public String getOrganizationName() { public String getOrganizationName() {
return organizationName; return organizationName;
} }

79
zc-business/src/main/java/com/zc/business/domain/DcDispatchResource.java

@ -0,0 +1,79 @@
package com.zc.business.domain;
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_dispatch_resource
*
* @author ruoyi
* @date 2024-04-15
*/
public class DcDispatchResource extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 1-人员2-车辆 */
@Excel(name = "1-人员 2-车辆")
private Integer dispatchType;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long resourceId;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long dispatchId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDispatchType(Integer dispatchType)
{
this.dispatchType = dispatchType;
}
public Integer getDispatchType()
{
return dispatchType;
}
public void setResourceId(Long resourceId)
{
this.resourceId = resourceId;
}
public Long getResourceId()
{
return resourceId;
}
public void setDispatchId(Long dispatchId)
{
this.dispatchId = dispatchId;
}
public Long getDispatchId()
{
return dispatchId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("dispatchType", getDispatchType())
.append("resourceId", getResourceId())
.append("dispatchId", getDispatchId())
.toString();
}
}

2
zc-business/src/main/java/com/zc/business/domain/DcVehicles.java

@ -27,7 +27,7 @@ public class DcVehicles extends BaseEntity
private String vehiclePlate; private String vehiclePlate;
/** 车辆类型 */ /** 车辆类型 */
@Excel(name = "车辆类型") @Excel(name = "车辆类型",readConverterExp = "1=吊车,2=清障车,3=高空作业车,4=水车,5=除雪车")
private Integer vehicleType; private Integer vehicleType;
/** 1-可用2-使用中 */ /** 1-可用2-使用中 */

6
zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java

@ -5,6 +5,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import cn.hutool.core.lang.hash.Hash; import cn.hutool.core.lang.hash.Hash;
import com.zc.business.domain.DcDispatch;
import com.zc.business.domain.DcDispatchResource;
import com.zc.business.domain.DcRoadSection; import com.zc.business.domain.DcRoadSection;
import com.zc.business.domain.DcWaringStrategy; import com.zc.business.domain.DcWaringStrategy;
import com.zc.business.domain.DcWarning; import com.zc.business.domain.DcWarning;
@ -102,4 +104,8 @@ public interface DcWarningMapper
public List<HashMap<String,Object>> selectShifts(@Param("station") Long station); public List<HashMap<String,Object>> selectShifts(@Param("station") Long station);
//查询某个机构的车辆信息 //查询某个机构的车辆信息
public List<HashMap<String,Object>> selectVehicles(@Param("organizationId")Long organizationId); public List<HashMap<String,Object>> selectVehicles(@Param("organizationId")Long organizationId);
//新增调度资源信息
public Integer insertDispatchResource(DcDispatchResource dcDispatchResource);
//新增调度记录信息
public Integer insertDcDispatch(DcDispatch dcDispatch);
} }

6
zc-business/src/main/java/com/zc/business/service/IDcWarningService.java

@ -4,6 +4,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcDispatch;
import com.zc.business.domain.DcDispatchResource;
import com.zc.business.domain.DcWarning; import com.zc.business.domain.DcWarning;
import com.zc.business.domain.DcWarningBatchConvert; import com.zc.business.domain.DcWarningBatchConvert;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -86,4 +88,8 @@ public interface IDcWarningService
Integer updateEndSection(); Integer updateEndSection();
//指挥调度 //指挥调度
AjaxResult commandAndDispatch(DcWarning dcWarning); AjaxResult commandAndDispatch(DcWarning dcWarning);
//新增指挥调度资源记录
public DcDispatch insertDispatch(DcDispatch dcDispatch);
//新增指挥调度资源记录
public Integer insertDispatchSource(DcDispatchResource dcDispatchResource);
} }

72
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -7,6 +7,8 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.uuid.IdUtils;
import com.zc.business.domain.DcDispatch;
import com.zc.business.domain.DcDispatchResource;
import com.zc.business.domain.DcEvent; import com.zc.business.domain.DcEvent;
import com.zc.business.domain.DcWaringStrategy; import com.zc.business.domain.DcWaringStrategy;
import com.zc.business.domain.DcWarning; import com.zc.business.domain.DcWarning;
@ -22,6 +24,7 @@ import com.zc.common.core.websocket.WebSocketService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -444,14 +447,16 @@ public class DcWarningServiceImpl implements IDcWarningService
StringUtils.isBlank(dcWarning.getDirection())){ StringUtils.isBlank(dcWarning.getDirection())){
return AjaxResult.error("参数错误"); return AjaxResult.error("参数错误");
} }
ArrayList<HashMap<String,Object>> hashMaps = new ArrayList<>();
dcWarning.setUserId(SecurityUtils.getUserId()); dcWarning.setUserId(SecurityUtils.getUserId());
int updateState = dcWarningMapper.updateState(dcWarning);//感知事件状态改变为已完成 int updateState = dcWarningMapper.updateState(dcWarning);//感知事件状态改变为已完成
if (updateState==0){ if (updateState==0){
return AjaxResult.error("操作失败"); return AjaxResult.error("操作失败");
} }
String stakeMark = dcWarning.getStakeMark();
DcEvent dcEvent = new DcEvent(); DcEvent dcEvent = new DcEvent();
dcEvent.setId(dcWarning.getId());//id dcEvent.setId(dcWarning.getId());//id
dcEvent.setStakeMark(dcWarning.getStakeMark());//桩号 dcEvent.setStakeMark(stakeMark);//桩号
dcEvent.setDirection(dcWarning.getDirection());//方向 dcEvent.setDirection(dcWarning.getDirection());//方向
dcEvent.setDeptId(dcWarning.getDeptId());//部门 dcEvent.setDeptId(dcWarning.getDeptId());//部门
dcEvent.setOccurrenceTime(dcWarning.getWarningTime());//预警时间 dcEvent.setOccurrenceTime(dcWarning.getWarningTime());//预警时间
@ -480,6 +485,32 @@ public class DcWarningServiceImpl implements IDcWarningService
dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间 dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间
dcEvent.setUserId(SecurityUtils.getUserId());//处置人员 dcEvent.setUserId(SecurityUtils.getUserId());//处置人员
int insertDcEvent = dcEventService.insertDcEventWarning(dcEvent); int insertDcEvent = dcEventService.insertDcEventWarning(dcEvent);
List<HashMap<String, Object>> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称
for (HashMap<String,Object> map:mapList){
if (StringUtils.isBlank(map.get("stakeMark").toString())){
continue;
}
Long id = (Long) map.get("id");//机构的id
String stakeMarkNew = map.get("stakeMark").toString();//机构桩号
StakeMarkUtils stakeMarkUtils = new StakeMarkUtils();
Integer itselfStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMarkNew);//机构本身的米数
Integer afferentStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMark);//传入的桩号米数
Integer difference =Math.abs(afferentStakeMark-itselfStakeMark); //计算距离绝对值
map.put("difference",difference/1000.0);//米转公里加入到map
map.put("id",id);
hashMaps.add(map);
}
List<HashMap<String, Object>> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> {
return (Double) map.get("difference"); })).collect(Collectors.toList());
HashMap<String, Object> map = sortedHashMaps.get(0);
Long id = (Long) map.get("id");//取出最近的机构id
if (id!=null){
DcDispatch dcDispatch = new DcDispatch();
dcDispatch.setEventId(dcWarning.getId());
dcDispatch.setOrganizationId(id);
dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定记录
}
if (insertDcEvent==0){ if (insertDcEvent==0){
return AjaxResult.error("操作失败"); return AjaxResult.error("操作失败");
} }
@ -604,10 +635,49 @@ public class DcWarningServiceImpl implements IDcWarningService
map.put("vehiclesMap",vehiclesMap); map.put("vehiclesMap",vehiclesMap);
hashMaps.add(map); hashMaps.add(map);
} }
List<HashMap<String, Object>> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> { List<HashMap<String, Object>> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> {
return (Double) map.get("difference"); })).collect(Collectors.toList()); return (Double) map.get("difference"); })).collect(Collectors.toList());
return AjaxResult.success(sortedHashMaps); return AjaxResult.success(sortedHashMaps);
} }
@Override
public DcDispatch insertDispatch(DcDispatch dcDispatch) {
dcWarningMapper.insertDcDispatch(dcDispatch);
return dcDispatch;
}
@Override
public Integer insertDispatchSource(DcDispatchResource dcDispatchResource) {
return dcWarningMapper.insertDispatchResource(dcDispatchResource);
}
//依据桩号计算出记录最近的机构id
public AjaxResult stake(DcWarning dcWarning){
String stakeMark = dcWarning.getStakeMark();
ArrayList<HashMap<String,Object>> hashMaps = new ArrayList<>();
List<HashMap<String, Object>> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称
for (HashMap<String,Object> map:mapList){
if (StringUtils.isBlank(map.get("stakeMark").toString())){
continue;
}
Long id = (Long) map.get("id");//机构的id
String stakeMarkNew = map.get("stakeMark").toString();//机构桩号
StakeMarkUtils stakeMarkUtils = new StakeMarkUtils();
Integer itselfStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMarkNew);//机构本身的米数
Integer afferentStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMark);//传入的桩号米数
Integer difference =Math.abs(afferentStakeMark-itselfStakeMark); //计算距离绝对值
map.put("difference",difference/1000.0);//米转公里加入到map
map.put("id",id);
hashMaps.add(map);
}
List<HashMap<String, Object>> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> {
return (Double) map.get("difference"); })).collect(Collectors.toList());
if (!sortedHashMaps.isEmpty()){
HashMap<String, Object> map = sortedHashMaps.get(0);
Long id = (Long) map.get("id");
return AjaxResult.success(id);
}
return null;
}
} }

1
zc-business/src/main/java/com/zc/business/service/impl/MsmServiceImpl.java

@ -148,7 +148,6 @@ public class MsmServiceImpl implements IMsmService {
System.out.println("-->" + r); System.out.println("-->" + r);
try { try {
JSONObject jsonObject = new JSONObject(r); JSONObject jsonObject = new JSONObject(r);
String errmsg = jsonObject.getString("errmsg");
Object errcode = jsonObject.get("errcode"); Object errcode = jsonObject.get("errcode");
objects.add(errcode); objects.add(errcode);
} catch (Exception e) { } catch (Exception e) {

39
zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

@ -146,7 +146,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endTime != null">#{endTime},</if> <if test="endTime != null">#{endTime},</if>
</trim> </trim>
</insert> </insert>
<insert id="insertDispatchResource" parameterType="DcDispatchResource">
insert into dc_dispatch_resource
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="dispatchType != null">dispatch_type,</if>
<if test="resourceId != null">resource_id,</if>
<if test="dispatchId != null">dispatch_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="dispatchType != null">#{dispatchType},</if>
<if test="resourceId != null">#{resourceId},</if>
<if test="dispatchId != null">#{dispatchId},</if>
</trim>
</insert>
<insert id="insertDcDispatch" parameterType="DcDispatch" useGeneratedKeys="true" keyProperty="id">
insert into dc_dispatch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="organizationId != null">organization_id,</if>
<if test="eventId != null and eventId != ''">event_id,</if>
<if test="dispatchName != null">dispatch_name,</if>
<if test="dispatchStatus != null">dispatch_status,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="organizationId != null">#{organizationId},</if>
<if test="eventId != null and eventId != ''">#{eventId},</if>
<if test="dispatchName != null">#{dispatchName},</if>
<if test="dispatchStatus != null">#{dispatchStatus},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateDcWarning" parameterType="DcWarning"> <update id="updateDcWarning" parameterType="DcWarning">
update dc_warning update dc_warning
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">

Loading…
Cancel
Save