家属端注册到添加长者流程
This commit is contained in:
parent
c63a676219
commit
5e7af35f1d
|
|
@ -51,5 +51,11 @@
|
||||||
<version>2.0.0</version>
|
<version>2.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nursingunit.boot</groupId>
|
||||||
|
<artifactId>nu-elder-local-api</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@ package com.nu.modules.wechat.pay.api;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
import com.nu.dto.NuBaseElderMQDto;
|
||||||
import com.nu.entity.NuBillEntity;
|
import com.nu.entity.NuBillEntity;
|
||||||
import com.nu.entity.PayParamEntity;
|
import com.nu.entity.PayParamEntity;
|
||||||
import com.nu.entity.WechatpayConfigEntity;
|
import com.nu.entity.WechatpayConfigEntity;
|
||||||
|
|
@ -13,6 +15,7 @@ import com.nu.modules.nubill.api.INuBillApi;
|
||||||
import com.nu.modules.sysconfig.ISysConfigApi;
|
import com.nu.modules.sysconfig.ISysConfigApi;
|
||||||
import com.nu.modules.systemorder.api.SystemOrderApi;
|
import com.nu.modules.systemorder.api.SystemOrderApi;
|
||||||
import com.nu.modules.systemorder.entity.SystemOrderApiEntity;
|
import com.nu.modules.systemorder.entity.SystemOrderApiEntity;
|
||||||
|
import com.nu.utils.RabbitMQUtil;
|
||||||
import com.nu.utils.WeChatPayUtils;
|
import com.nu.utils.WeChatPayUtils;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||||
|
|
@ -27,6 +30,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
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;
|
||||||
|
|
@ -61,6 +65,8 @@ public class WeChatPayApi {
|
||||||
private INuBaseInfoApi nuBaseInfoApi;
|
private INuBaseInfoApi nuBaseInfoApi;
|
||||||
@Autowired
|
@Autowired
|
||||||
private INuBillApi nuBillApi;
|
private INuBillApi nuBillApi;
|
||||||
|
@Autowired
|
||||||
|
private RabbitMQUtil rabbitMQUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定护理单元支付
|
* 绑定护理单元支付
|
||||||
|
|
@ -69,8 +75,7 @@ public class WeChatPayApi {
|
||||||
public Map<String, String> nativePay(@Valid @RequestBody PayParamEntity params) throws Exception {
|
public Map<String, String> nativePay(@Valid @RequestBody PayParamEntity params) throws Exception {
|
||||||
|
|
||||||
//准备各种数据
|
//准备各种数据
|
||||||
//系统订单号+商户订单号(使用同一个,便于管理)
|
//系统订单号+商户订单号(使用同一个,便于管理):年月日时分秒+毫秒值后六位+2位随机数
|
||||||
//年月日时分秒+毫秒值后六位+2位随机数
|
|
||||||
String outTradeNo = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + String.valueOf(System.currentTimeMillis() % 1000000) + String.format("%02d", new Random().nextInt(100));
|
String outTradeNo = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + String.valueOf(System.currentTimeMillis() % 1000000) + String.format("%02d", new Random().nextInt(100));
|
||||||
String openId = params.getOpenId();//用户openId
|
String openId = params.getOpenId();//用户openId
|
||||||
String nuId = params.getNursingUnit();//护理单元
|
String nuId = params.getNursingUnit();//护理单元
|
||||||
|
|
@ -130,17 +135,38 @@ public class WeChatPayApi {
|
||||||
upDto.setId(systemOrderApiEntity.getId());
|
upDto.setId(systemOrderApiEntity.getId());
|
||||||
upDto.setOrderStatus("ORG_PAYMENT_DISABLED");//商家未启用微信支付功能
|
upDto.setOrderStatus("ORG_PAYMENT_DISABLED");//商家未启用微信支付功能
|
||||||
upDto.setReceiptDescription("由于商家已关闭微信支付功能,无法完成微信支付。");//回执描述
|
upDto.setReceiptDescription("由于商家已关闭微信支付功能,无法完成微信支付。");//回执描述
|
||||||
throw new RuntimeException("微信支付已关闭");
|
Map<String, String> resultMap = Maps.newHashMap();
|
||||||
|
resultMap.put("failType", "ORG_PAYMENT_DISABLED");
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//如果是护理单元 验证是否已被绑定(停留在付款界面直至点击支付期间,可能已经有人更快已经付款绑定了此护理单元)
|
||||||
|
{
|
||||||
|
if (!nuBaseInfoApi.canBinding(nuId)) {
|
||||||
|
SystemOrderApiEntity upDto = new SystemOrderApiEntity();
|
||||||
|
upDto.setId(systemOrderApiEntity.getId());
|
||||||
|
upDto.setOrderStatus("NU_HAS_BEEN_BOUND");//护理单元已被其它用户绑定
|
||||||
|
upDto.setReceiptDescription("护理单元已被其它用户绑定。");//回执描述
|
||||||
|
Map<String, String> resultMap = Maps.newHashMap();
|
||||||
|
resultMap.put("nuFailType", "NU_HAS_BEEN_BOUND");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//正式支付
|
||||||
return weChatPayUtils.pay(title, openId, outTradeNo, amount);
|
return weChatPayUtils.pay(title, openId, outTradeNo, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/callback")
|
@PostMapping("/callback")
|
||||||
public String courseNative(HttpServletRequest request, HttpServletResponse response) {
|
public String courseNative(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
Transaction decryptObject = weChatPayUtils.callback(request);
|
Transaction decryptObject = weChatPayUtils.callback(request);
|
||||||
|
log.info("搜我:结果:" + decryptObject.getTradeState().name());
|
||||||
|
log.info("搜我:整体数据:");
|
||||||
|
log.info("" + decryptObject);
|
||||||
//查询订单
|
//查询订单
|
||||||
SystemOrderApiEntity orderData = systemOrderApi.selectByOutTradeNo(decryptObject.getOutTradeNo());
|
SystemOrderApiEntity orderData = systemOrderApi.selectByOutTradeNo(decryptObject.getOutTradeNo());
|
||||||
|
|
||||||
|
|
@ -150,7 +176,7 @@ public class WeChatPayApi {
|
||||||
//可以在这里针对“护理单元绑定”进行特殊处理
|
//可以在这里针对“护理单元绑定”进行特殊处理
|
||||||
if ("SUCCESS".equals(decryptObject.getTradeState().name())) {
|
if ("SUCCESS".equals(decryptObject.getTradeState().name())) {
|
||||||
//绑定护理单元
|
//绑定护理单元
|
||||||
nuBaseInfoApi.bindNu(orderData.getNuId());
|
nuBaseInfoApi.bindNu(orderData.getNuId(), orderData.getOpenId());
|
||||||
//增加余额
|
//增加余额
|
||||||
BigDecimal sum = nuBaseInfoApi.addBalance(orderData.getNuId(), orderData.getAmount());
|
BigDecimal sum = nuBaseInfoApi.addBalance(orderData.getNuId(), orderData.getAmount());
|
||||||
//修改护理单元费用明细
|
//修改护理单元费用明细
|
||||||
|
|
@ -161,9 +187,16 @@ public class WeChatPayApi {
|
||||||
nuBillEntity.setAmount(orderData.getAmount());//本次变动金额
|
nuBillEntity.setAmount(orderData.getAmount());//本次变动金额
|
||||||
nuBillEntity.setBalanceAfter(sum);//操作后的余额
|
nuBillEntity.setBalanceAfter(sum);//操作后的余额
|
||||||
nuBillEntity.setType("bind_nu");
|
nuBillEntity.setType("bind_nu");
|
||||||
nuBillEntity.setRemark("绑定护理单元充值:"+orderData.getAmount().toString()+"元");
|
nuBillEntity.setRemark("绑定护理单元充值:" + orderData.getAmount().toString() + "元");
|
||||||
nuBillEntity.setCreateTime(new Date());
|
nuBillEntity.setCreateTime(new Date());
|
||||||
nuBillApi.addData(nuBillEntity);
|
nuBillApi.addData(nuBillEntity);
|
||||||
|
//给管理平台发通知,新增/修改护理单元-家属关系
|
||||||
|
NuBaseElderMQDto mqDto = new NuBaseElderMQDto();
|
||||||
|
mqDto.setNuId(orderData.getNuId());
|
||||||
|
mqDto.setOpenId(orderData.getOpenId());
|
||||||
|
mqDto.setStatus("1");
|
||||||
|
mqDto.setOrgCode(orderData.getOrgCode());
|
||||||
|
rabbitMQUtil.sendToExchange("hldy.nubaseelder", "hldy.nubaseelder.bindnu", mqDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,12 @@ public class ShiroConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 配置不会被拦截的链接 顺序判断
|
// 配置不会被拦截的链接 顺序判断
|
||||||
|
//全部临时开放接口
|
||||||
|
{
|
||||||
|
filterChainDefinitionMap.put("/api/elderInfo/**", "anon");//新增长者
|
||||||
|
filterChainDefinitionMap.put("/api/nuInfo/**", "anon");//绑定护理单元
|
||||||
|
|
||||||
|
}
|
||||||
filterChainDefinitionMap.put("/api/tplink/videoStorage/**", "anon"); //视频缓存存储接口
|
filterChainDefinitionMap.put("/api/tplink/videoStorage/**", "anon"); //视频缓存存储接口
|
||||||
filterChainDefinitionMap.put("/iot/tq/api/electricityMeter/**", "anon"); //电表回调
|
filterChainDefinitionMap.put("/iot/tq/api/electricityMeter/**", "anon"); //电表回调
|
||||||
filterChainDefinitionMap.put("/api/pad/baseInfo/**", "anon"); //电表回调
|
filterChainDefinitionMap.put("/api/pad/baseInfo/**", "anon"); //电表回调
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import java.io.Serializable;
|
||||||
/**
|
/**
|
||||||
* @Description: 护理单元
|
* @Description: 护理单元
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
* @Date: 2025-04-11
|
* @Date: 2025-04-11
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|
@ -16,4 +16,16 @@ public class NuBaseInfoMQDto implements Serializable {
|
||||||
|
|
||||||
private String orgCode;
|
private String orgCode;
|
||||||
private String asyncId;
|
private String asyncId;
|
||||||
|
/**
|
||||||
|
* openId
|
||||||
|
*/
|
||||||
|
private java.lang.String openId;
|
||||||
|
/**
|
||||||
|
* 长者id nu_biz_elder_info.id
|
||||||
|
*/
|
||||||
|
private java.lang.String elderId;
|
||||||
|
/**
|
||||||
|
* 护理单元编码
|
||||||
|
*/
|
||||||
|
private String nuId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.nu.entity;
|
package com.nu.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 客户信息
|
* @Description: 客户信息
|
||||||
|
|
@ -41,11 +44,17 @@ public class ElderInfoEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 出生日期
|
* 出生日期
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy年MM月dd日")
|
||||||
|
@DateTimeFormat(pattern = "yyyy年MM月dd日")
|
||||||
private java.util.Date dateOfBirth;
|
private java.util.Date dateOfBirth;
|
||||||
/**
|
/**
|
||||||
* 民族
|
* 民族
|
||||||
*/
|
*/
|
||||||
private String national;
|
private String national;
|
||||||
|
/**
|
||||||
|
* 住址
|
||||||
|
*/
|
||||||
|
private java.lang.String houseAddress;
|
||||||
/**
|
/**
|
||||||
* 头像
|
* 头像
|
||||||
*/
|
*/
|
||||||
|
|
@ -125,6 +134,8 @@ public class ElderInfoEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 监护人出生日期
|
* 监护人出生日期
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy年MM月dd日")
|
||||||
|
@DateTimeFormat(pattern = "yyyy年MM月dd日")
|
||||||
private java.util.Date guardianDateOfBirth;
|
private java.util.Date guardianDateOfBirth;
|
||||||
/**
|
/**
|
||||||
* 监护人家庭住址
|
* 监护人家庭住址
|
||||||
|
|
@ -170,11 +181,15 @@ public class ElderInfoEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 有效开始日期
|
* 有效开始日期
|
||||||
*/
|
*/
|
||||||
private java.util.Date startTime;
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy.MM.dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy.MM.dd")
|
||||||
|
private Date startTime;
|
||||||
/**
|
/**
|
||||||
* 有效结束日期
|
* 有效结束日期
|
||||||
*/
|
*/
|
||||||
private java.util.Date endTime;
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy.MM.dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy.MM.dd")
|
||||||
|
private Date endTime;
|
||||||
/**
|
/**
|
||||||
* 发卡日期
|
* 发卡日期
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.nu.entity;
|
package com.nu.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -9,43 +11,84 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @Description: 护理单元
|
* @Description: 护理单元
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
* @Date: 2025-04-11
|
* @Date: 2025-04-11
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class NuBaseInfoEntity implements Serializable {
|
public class NuBaseInfoEntity implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**ID*/
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
/**护理单元名称*/
|
/**
|
||||||
|
* openId
|
||||||
|
*/
|
||||||
|
private java.lang.String openId;
|
||||||
|
/**
|
||||||
|
* 长者id nu_biz_elder_info.id
|
||||||
|
*/
|
||||||
|
private java.lang.String elderId;
|
||||||
|
/**
|
||||||
|
* 护理单元名称
|
||||||
|
*/
|
||||||
private String nuName;
|
private String nuName;
|
||||||
/**护理单元编码*/
|
/**
|
||||||
|
* 护理单元编码
|
||||||
|
*/
|
||||||
private String nuId;
|
private String nuId;
|
||||||
/**区域标签ID*/
|
/**
|
||||||
|
* 区域标签ID
|
||||||
|
*/
|
||||||
private String areaFlag;
|
private String areaFlag;
|
||||||
/**使用状态 0未使用 1占用 2入住 3退住 4留床*/
|
/**
|
||||||
|
* 使用状态 0未使用 1占用 2入住 3退住 4留床
|
||||||
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
/**客户*/
|
/**
|
||||||
|
* 客户
|
||||||
|
*/
|
||||||
private String customerId;
|
private String customerId;
|
||||||
/**是否删除 0未删除 1删除*/
|
/**
|
||||||
|
* 是否删除 0未删除 1删除
|
||||||
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
/**创建人*/
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
private String createBy;
|
private String createBy;
|
||||||
/**创建日期*/
|
/**
|
||||||
|
* 创建日期
|
||||||
|
*/
|
||||||
private java.util.Date createTime;
|
private java.util.Date createTime;
|
||||||
/**更新人*/
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
/**更新日期*/
|
/**
|
||||||
|
* 更新日期
|
||||||
|
*/
|
||||||
private java.util.Date updateTime;
|
private java.util.Date updateTime;
|
||||||
/**所属部门*/
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
private String sysOrgCode;
|
private String sysOrgCode;
|
||||||
private String orgCode;
|
private String orgCode;
|
||||||
private String asyncId;
|
private String asyncId;
|
||||||
/**余额*/
|
/**
|
||||||
|
* 余额
|
||||||
|
*/
|
||||||
private BigDecimal balance;
|
private BigDecimal balance;
|
||||||
//摄像头信息
|
//摄像头信息
|
||||||
private List<CameraInfoEntity> cameraInfo;
|
private List<CameraInfoEntity> cameraInfo;
|
||||||
private CustomerInfoEntity customerInfo;
|
private CustomerInfoEntity customerInfo;
|
||||||
private List<CustomerDirectiveEntity> customerDirectiveDtoList;
|
private List<CustomerDirectiveEntity> customerDirectiveDtoList;
|
||||||
|
//温湿度信息 正常一个nuid对应一条数据
|
||||||
|
private List<HumidDeviceEntity> humidDeviceList;
|
||||||
|
//长者信息
|
||||||
|
private ElderInfoEntity elderInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public class NuBillEntity implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**id*/
|
/**id*/
|
||||||
private Integer id;
|
private String id;
|
||||||
/**护理单元编号*/
|
/**护理单元编号*/
|
||||||
private String nuId;
|
private String nuId;
|
||||||
/**长者ID*/
|
/**长者ID*/
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,11 @@ import java.util.List;
|
||||||
public interface IElderInfoApi {
|
public interface IElderInfoApi {
|
||||||
|
|
||||||
List<ElderInfoEntity> selectCurrentState3();
|
List<ElderInfoEntity> selectCurrentState3();
|
||||||
|
|
||||||
|
String addElder(ElderInfoEntity elderInfoEntity);
|
||||||
|
|
||||||
|
void updateElderInfo(ElderInfoEntity elderInfoEntity);
|
||||||
|
|
||||||
|
List<ElderInfoEntity> queryByElderIds(String[] split);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,12 @@ public class ElderInfo implements Serializable {
|
||||||
@Excel(name = "民族", width = 15)
|
@Excel(name = "民族", width = 15)
|
||||||
@ApiModelProperty(value = "民族")
|
@ApiModelProperty(value = "民族")
|
||||||
private java.lang.String national;
|
private java.lang.String national;
|
||||||
|
/**
|
||||||
|
* 住址
|
||||||
|
*/
|
||||||
|
@Excel(name = "住址", width = 15)
|
||||||
|
@ApiModelProperty(value = "住址")
|
||||||
|
private java.lang.String houseAddress;
|
||||||
/**
|
/**
|
||||||
* 头像
|
* 头像
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.nu.modules.elderinfo.service.impl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nu.entity.ElderInfoEntity;
|
import com.nu.entity.ElderInfoEntity;
|
||||||
import com.nu.modules.elder.api.IElderInfoApi;
|
import com.nu.modules.elder.api.IElderInfoApi;
|
||||||
import com.nu.modules.elderinfo.entity.ElderInfo;
|
import com.nu.modules.elderinfo.entity.ElderInfo;
|
||||||
|
|
@ -11,12 +12,10 @@ import com.nu.modules.elderinfo.service.IElderInfoService;
|
||||||
import com.nu.modules.nubaseinfo.api.INuBaseInfoApi;
|
import com.nu.modules.nubaseinfo.api.INuBaseInfoApi;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.system.vo.LoginUser;
|
import org.jeecg.common.system.vo.LoginUser;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -64,4 +63,27 @@ public class ElderInfoServiceImpl extends ServiceImpl<ElderInfoMapper, ElderInfo
|
||||||
List<ElderInfo> elderInfos = baseMapper.selectList(new QueryWrapper<ElderInfo>().lambda().ne(ElderInfo::getCurrentState, "3"));
|
List<ElderInfo> elderInfos = baseMapper.selectList(new QueryWrapper<ElderInfo>().lambda().ne(ElderInfo::getCurrentState, "3"));
|
||||||
return BeanUtil.copyToList(elderInfos, ElderInfoEntity.class);
|
return BeanUtil.copyToList(elderInfos, ElderInfoEntity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String addElder(ElderInfoEntity elderInfoEntity) {
|
||||||
|
ElderInfo elderInfo = new ElderInfo();
|
||||||
|
BeanUtils.copyProperties(elderInfoEntity,elderInfo);
|
||||||
|
baseMapper.insert(elderInfo);
|
||||||
|
return elderInfo.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateElderInfo(ElderInfoEntity elderInfoEntity) {
|
||||||
|
ElderInfo elderInfo = new ElderInfo();
|
||||||
|
BeanUtils.copyProperties(elderInfoEntity,elderInfo);
|
||||||
|
baseMapper.updateById(elderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ElderInfoEntity> queryByElderIds(String[] ids) {
|
||||||
|
QueryWrapper<ElderInfo> qw = new QueryWrapper<>();
|
||||||
|
qw.in("id", ids);
|
||||||
|
return BeanUtil.copyToList(baseMapper.selectList(qw),ElderInfoEntity.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nu.dto.IotHumidDeviceMQDto;
|
import com.nu.dto.IotHumidDeviceMQDto;
|
||||||
import com.nu.modules.syncLog.entity.SyncBizLog;
|
import com.nu.modules.syncLog.entity.SyncBizLog;
|
||||||
import com.nu.modules.syncLog.service.ISyncBizLogService;
|
import com.nu.modules.syncLog.service.ISyncBizLogService;
|
||||||
import com.nu.modules.tq.electricity.entity.ElectricityMeter;
|
|
||||||
import com.nu.modules.yiweilian.humid.entity.HumidDevice;
|
import com.nu.modules.yiweilian.humid.entity.HumidDevice;
|
||||||
import com.nu.modules.yiweilian.humid.mapper.HumidDeviceMapper;
|
import com.nu.modules.yiweilian.humid.mapper.HumidDeviceMapper;
|
||||||
import com.nu.modules.yiweilian.humid.service.IHumidDeviceService;
|
import com.nu.modules.yiweilian.humid.service.IHumidDeviceService;
|
||||||
|
|
@ -49,15 +48,16 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private HumidDeviceServiceImpl syncImpl;
|
private HumidDeviceServiceImpl syncImpl;
|
||||||
public IPage<HumidDevice> findPage(Page<HumidDevice> page, HumidDevice humidDevice){
|
|
||||||
return baseMapper.findPage(page,humidDevice);
|
public IPage<HumidDevice> findPage(Page<HumidDevice> page, HumidDevice humidDevice) {
|
||||||
|
return baseMapper.findPage(page, humidDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加
|
* 添加
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> insertDevice(HumidDevice humidDevice){
|
public Result<String> insertDevice(HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("sn", humidDevice.getSn());
|
params.put("sn", humidDevice.getSn());
|
||||||
params.put("timeCode", humidDevice.getTimeCode());
|
params.put("timeCode", humidDevice.getTimeCode());
|
||||||
|
|
@ -65,54 +65,56 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
String responseStr = yiweilianApi.addDevice(params);
|
String responseStr = yiweilianApi.addDevice(params);
|
||||||
JSONObject jsonObject = new JSONObject(responseStr);
|
JSONObject jsonObject = new JSONObject(responseStr);
|
||||||
Integer responseCode = jsonObject.getInt("code");
|
Integer responseCode = jsonObject.getInt("code");
|
||||||
if(responseCode.equals(10003)){
|
if (responseCode.equals(10003)) {
|
||||||
baseMapper.insertDevice(humidDevice);
|
baseMapper.insertDevice(humidDevice);
|
||||||
humidDevice.setOptType("insert");
|
humidDevice.setOptType("insert");
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
if(sysUser!=null){
|
if (sysUser != null) {
|
||||||
humidDevice.setOptBy(sysUser.getUsername());
|
humidDevice.setOptBy(sysUser.getUsername());
|
||||||
}
|
}
|
||||||
baseMapper.insertLog(humidDevice);
|
baseMapper.insertLog(humidDevice);
|
||||||
String error = updateDeviceParameters(humidDevice,"insert");
|
String error = updateDeviceParameters(humidDevice, "insert");
|
||||||
if(!error.equals("")){
|
if (!error.equals("")) {
|
||||||
String result = "设备添加成功,但是获取配置参数错误:"+ error;
|
String result = "设备添加成功,但是获取配置参数错误:" + error;
|
||||||
return Result.error(result);
|
return Result.error(result);
|
||||||
}
|
}
|
||||||
String error2 = updateDeviceRealTime(humidDevice);
|
String error2 = updateDeviceRealTime(humidDevice);
|
||||||
if(!error2.equals("")){
|
if (!error2.equals("")) {
|
||||||
String result = "设备添加成功,但是获取实时数据错误:"+ error2;
|
String result = "设备添加成功,但是获取实时数据错误:" + error2;
|
||||||
return Result.error(result);
|
return Result.error(result);
|
||||||
}
|
}
|
||||||
return Result.OK("添加成功");
|
return Result.OK("添加成功");
|
||||||
}else{
|
} else {
|
||||||
String result = "添加失败:"+jsonObject.getStr("msg");
|
String result = "添加失败:" + jsonObject.getStr("msg");
|
||||||
return Result.error(result);
|
return Result.error(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新设备配置参数
|
* 更新设备配置参数
|
||||||
|
*
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String updateDeviceParameters(HumidDevice humidDevice,String type){
|
public String updateDeviceParameters(HumidDevice humidDevice, String type) {
|
||||||
Map<String, Object> params = getParmas(0,100,humidDevice);
|
Map<String, Object> params = getParmas(0, 100, humidDevice);
|
||||||
return updateDeviceConfigs(params,humidDevice,type);
|
return updateDeviceConfigs(params, humidDevice, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取接口请求参数
|
* 获取接口请求参数
|
||||||
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @param limit
|
* @param limit
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> getParmas(int page,int limit,HumidDevice humidDevice){
|
private Map<String, Object> getParmas(int page, int limit, HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("rows", limit);
|
params.put("rows", limit);
|
||||||
params.put("page", page);
|
params.put("page", page);
|
||||||
if(humidDevice.getSn()!=null&&!humidDevice.getSn().equals("")){
|
if (humidDevice.getSn() != null && !humidDevice.getSn().equals("")) {
|
||||||
params.put("sn", humidDevice.getSn());
|
params.put("sn", humidDevice.getSn());
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
|
|
@ -120,24 +122,25 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用接口更新设备配置参数
|
* 调用接口更新设备配置参数
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String updateDeviceConfigs(Map<String,Object> map,HumidDevice humidDevice,String type){
|
private String updateDeviceConfigs(Map<String, Object> map, HumidDevice humidDevice, String type) {
|
||||||
String errorMsg = "";
|
String errorMsg = "";
|
||||||
String responseStr = yiweilianApi.getDeviceConfigs(map);
|
String responseStr = yiweilianApi.getDeviceConfigs(map);
|
||||||
JSONObject jsonObject = new JSONObject(responseStr);
|
JSONObject jsonObject = new JSONObject(responseStr);
|
||||||
Integer responseCode = jsonObject.getInt("code");
|
Integer responseCode = jsonObject.getInt("code");
|
||||||
if(responseCode.equals(0)){
|
if (responseCode.equals(0)) {
|
||||||
JSONObject dataObj = jsonObject.getJSONObject("data");
|
JSONObject dataObj = jsonObject.getJSONObject("data");
|
||||||
Integer count = dataObj.getInt("count");
|
Integer count = dataObj.getInt("count");
|
||||||
Integer limit = dataObj.getInt("rows");
|
Integer limit = dataObj.getInt("rows");
|
||||||
Integer page = dataObj.getInt("page");
|
Integer page = dataObj.getInt("page");
|
||||||
JSONArray dataArr = dataObj.getJSONArray("dataList");
|
JSONArray dataArr = dataObj.getJSONArray("dataList");
|
||||||
for(int i=0;i<dataArr.size();i++){
|
for (int i = 0; i < dataArr.size(); i++) {
|
||||||
HumidDevice dh = new HumidDevice();
|
HumidDevice dh = new HumidDevice();
|
||||||
JSONObject json = (JSONObject)dataArr.get(i);
|
JSONObject json = (JSONObject) dataArr.get(i);
|
||||||
String sn = json.getStr("sn");
|
String sn = json.getStr("sn");
|
||||||
String deviceName = json.getStr("deviceName");
|
String deviceName = json.getStr("deviceName");
|
||||||
String deviceTypes = json.getStr("deviceTypes");
|
String deviceTypes = json.getStr("deviceTypes");
|
||||||
|
|
@ -176,16 +179,16 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
baseMapper.updateDevice(dh);
|
baseMapper.updateDevice(dh);
|
||||||
dh.setOptType(type);
|
dh.setOptType(type);
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
if(sysUser!=null){
|
if (sysUser != null) {
|
||||||
dh.setOptBy(sysUser.getUsername());
|
dh.setOptBy(sysUser.getUsername());
|
||||||
}
|
}
|
||||||
baseMapper.insertLog(dh);
|
baseMapper.insertLog(dh);
|
||||||
}
|
}
|
||||||
if((page+1)*limit<count){
|
if ((page + 1) * limit < count) {
|
||||||
Map<String, Object> params = getParmas(page+1,limit,humidDevice);
|
Map<String, Object> params = getParmas(page + 1, limit, humidDevice);
|
||||||
errorMsg += updateDeviceConfigs(params,humidDevice,type);
|
errorMsg += updateDeviceConfigs(params, humidDevice, type);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
errorMsg = jsonObject.getStr("msg");
|
errorMsg = jsonObject.getStr("msg");
|
||||||
}
|
}
|
||||||
return errorMsg;
|
return errorMsg;
|
||||||
|
|
@ -193,26 +196,29 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新设备实时数据(抄表)
|
* 更新设备实时数据(抄表)
|
||||||
|
*
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String updateDeviceRealTime(HumidDevice humidDevice){
|
public String updateDeviceRealTime(HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = getRealTimeParmas(0,50,humidDevice);
|
Map<String, Object> params = getRealTimeParmas(0, 50, humidDevice);
|
||||||
return updateDeviceRealTimeData(params,humidDevice);
|
return updateDeviceRealTimeData(params, humidDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取实时数据接口请求参数
|
* 获取实时数据接口请求参数
|
||||||
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @param limit
|
* @param limit
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> getRealTimeParmas(int page,int limit,HumidDevice humidDevice){
|
private Map<String, Object> getRealTimeParmas(int page, int limit, HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("rows", limit);
|
params.put("rows", limit);
|
||||||
params.put("page", page);
|
params.put("page", page);
|
||||||
if(humidDevice.getSn()!=null&&!humidDevice.getSn().equals("")){
|
if (humidDevice.getSn() != null && !humidDevice.getSn().equals("")) {
|
||||||
String[] str = new String[1];
|
String[] str = new String[1];
|
||||||
str[0] = humidDevice.getSn();
|
str[0] = humidDevice.getSn();
|
||||||
params.put("snList", str);
|
params.put("snList", str);
|
||||||
|
|
@ -222,25 +228,26 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用接口更新设备实时数据(抄表)
|
* 调用接口更新设备实时数据(抄表)
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String updateDeviceRealTimeData(Map<String,Object> map,HumidDevice humidDevice){
|
private String updateDeviceRealTimeData(Map<String, Object> map, HumidDevice humidDevice) {
|
||||||
String errorMsg = "";
|
String errorMsg = "";
|
||||||
String responseStr = yiweilianApi.getRealTime(map);
|
String responseStr = yiweilianApi.getRealTime(map);
|
||||||
JSONObject jsonObject = new JSONObject(responseStr);
|
JSONObject jsonObject = new JSONObject(responseStr);
|
||||||
Integer responseCode = jsonObject.getInt("code");
|
Integer responseCode = jsonObject.getInt("code");
|
||||||
if(responseCode.equals(0)){
|
if (responseCode.equals(0)) {
|
||||||
JSONObject dataObj = jsonObject.getJSONObject("data");
|
JSONObject dataObj = jsonObject.getJSONObject("data");
|
||||||
Integer count = dataObj.getInt("count");
|
Integer count = dataObj.getInt("count");
|
||||||
Integer limit = dataObj.getInt("rows");
|
Integer limit = dataObj.getInt("rows");
|
||||||
Integer page = dataObj.getInt("page");
|
Integer page = dataObj.getInt("page");
|
||||||
JSONArray dataArr = dataObj.getJSONArray("dataList");
|
JSONArray dataArr = dataObj.getJSONArray("dataList");
|
||||||
if(dataArr.size()>0){
|
if (dataArr.size() > 0) {
|
||||||
for(int i=0;i<dataArr.size();i++){
|
for (int i = 0; i < dataArr.size(); i++) {
|
||||||
HumidDevice dh = new HumidDevice();
|
HumidDevice dh = new HumidDevice();
|
||||||
JSONObject json = (JSONObject)dataArr.get(i);
|
JSONObject json = (JSONObject) dataArr.get(i);
|
||||||
String sn = json.getStr("sn");
|
String sn = json.getStr("sn");
|
||||||
String status = json.getStr("status");
|
String status = json.getStr("status");
|
||||||
String electricity = json.getStr("electricity");
|
String electricity = json.getStr("electricity");
|
||||||
|
|
@ -248,11 +255,11 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
String humidity = json.getStr("humidity");
|
String humidity = json.getStr("humidity");
|
||||||
String reportingTime = json.getStr("date");
|
String reportingTime = json.getStr("date");
|
||||||
dh.setStatus(status);
|
dh.setStatus(status);
|
||||||
Date reportingDate = DateUtil.parse(reportingTime,"yyyy-MM-dd HH:mm:ss");
|
Date reportingDate = DateUtil.parse(reportingTime, "yyyy-MM-dd HH:mm:ss");
|
||||||
Calendar ca = Calendar.getInstance();
|
Calendar ca = Calendar.getInstance();
|
||||||
ca.add(Calendar.MINUTE,-5);
|
ca.add(Calendar.MINUTE, -5);
|
||||||
Date currentDate = ca.getTime();
|
Date currentDate = ca.getTime();
|
||||||
if(reportingDate.getTime()<=currentDate.getTime()){
|
if (reportingDate.getTime() <= currentDate.getTime()) {
|
||||||
dh.setStatus("1");
|
dh.setStatus("1");
|
||||||
}
|
}
|
||||||
dh.setSn(sn);
|
dh.setSn(sn);
|
||||||
|
|
@ -263,14 +270,14 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
baseMapper.updateValue(dh);
|
baseMapper.updateValue(dh);
|
||||||
dh.setOptType("read");
|
dh.setOptType("read");
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
if(sysUser!=null){
|
if (sysUser != null) {
|
||||||
dh.setOptBy(sysUser.getUsername());
|
dh.setOptBy(sysUser.getUsername());
|
||||||
}
|
}
|
||||||
baseMapper.insertLog(dh);
|
baseMapper.insertLog(dh);
|
||||||
syncStatusMq(dh);
|
syncStatusMq(dh);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
errorMsg += humidDevice.getSn()+"温湿度设备丢失,请联系管理员";
|
errorMsg += humidDevice.getSn() + "温湿度设备丢失,请联系管理员";
|
||||||
HumidDevice dh = new HumidDevice();
|
HumidDevice dh = new HumidDevice();
|
||||||
dh.setSn(humidDevice.getSn());
|
dh.setSn(humidDevice.getSn());
|
||||||
dh.setStatus("1");
|
dh.setStatus("1");
|
||||||
|
|
@ -280,18 +287,18 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
dh.setReportingTime(DateUtil.now());
|
dh.setReportingTime(DateUtil.now());
|
||||||
dh.setOptType("read");
|
dh.setOptType("read");
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
if(sysUser!=null){
|
if (sysUser != null) {
|
||||||
dh.setOptBy(sysUser.getUsername());
|
dh.setOptBy(sysUser.getUsername());
|
||||||
}
|
}
|
||||||
baseMapper.insertLog(dh);
|
baseMapper.insertLog(dh);
|
||||||
baseMapper.updateValue(dh);
|
baseMapper.updateValue(dh);
|
||||||
syncStatusMq(dh);
|
syncStatusMq(dh);
|
||||||
}
|
}
|
||||||
if((page+1)*limit<count){
|
if ((page + 1) * limit < count) {
|
||||||
Map<String, Object> params = getParmas(page+1,limit,humidDevice);
|
Map<String, Object> params = getParmas(page + 1, limit, humidDevice);
|
||||||
errorMsg += updateDeviceRealTimeData(params,humidDevice);
|
errorMsg += updateDeviceRealTimeData(params, humidDevice);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
errorMsg = jsonObject.getStr("msg");
|
errorMsg = jsonObject.getStr("msg");
|
||||||
}
|
}
|
||||||
return errorMsg;
|
return errorMsg;
|
||||||
|
|
@ -299,11 +306,12 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步到运维系统
|
* 同步到运维系统
|
||||||
|
*
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
*/
|
*/
|
||||||
private void syncStatusMq(HumidDevice humidDevice){
|
private void syncStatusMq(HumidDevice humidDevice) {
|
||||||
HumidDevice entity = baseMapper.getHumidInfo(humidDevice);
|
HumidDevice entity = baseMapper.getHumidInfo(humidDevice);
|
||||||
if(entity!=null){
|
if (entity != null) {
|
||||||
IotHumidDeviceMQDto ihd = new IotHumidDeviceMQDto();
|
IotHumidDeviceMQDto ihd = new IotHumidDeviceMQDto();
|
||||||
BeanUtils.copyProperties(entity, ihd);
|
BeanUtils.copyProperties(entity, ihd);
|
||||||
String json = JSON.toJSONString(entity);
|
String json = JSON.toJSONString(entity);
|
||||||
|
|
@ -322,7 +330,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getUpdateParmas(HumidDevice humidDevice){
|
private Map<String, Object> getUpdateParmas(HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("sn", humidDevice.getSn());
|
params.put("sn", humidDevice.getSn());
|
||||||
params.put("timeCode", humidDevice.getTimeCode());
|
params.put("timeCode", humidDevice.getTimeCode());
|
||||||
|
|
@ -347,30 +355,31 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> updateDevice(HumidDevice humidDevice){
|
public Result<String> updateDevice(HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = getUpdateParmas(humidDevice);
|
Map<String, Object> params = getUpdateParmas(humidDevice);
|
||||||
String responseStr = yiweilianApi.updateDeviceConfig(params);
|
String responseStr = yiweilianApi.updateDeviceConfig(params);
|
||||||
JSONObject jsonObject = new JSONObject(responseStr);
|
JSONObject jsonObject = new JSONObject(responseStr);
|
||||||
Integer responseCode = jsonObject.getInt("code");
|
Integer responseCode = jsonObject.getInt("code");
|
||||||
if(responseCode.equals(0)){
|
if (responseCode.equals(0)) {
|
||||||
baseMapper.updateDevice(humidDevice);
|
baseMapper.updateDevice(humidDevice);
|
||||||
humidDevice.setOptType("update");
|
humidDevice.setOptType("update");
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
humidDevice.setOptBy(sysUser.getUsername());
|
humidDevice.setOptBy(sysUser.getUsername());
|
||||||
baseMapper.insertLog(humidDevice);
|
baseMapper.insertLog(humidDevice);
|
||||||
return Result.OK("修改成功");
|
return Result.OK("修改成功");
|
||||||
}else{
|
} else {
|
||||||
String error = "修改失败:"+jsonObject.getStr("msg");
|
String error = "修改失败:" + jsonObject.getStr("msg");
|
||||||
return Result.error(error);
|
return Result.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新温湿度值
|
* 更新温湿度值
|
||||||
|
*
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateValue(HumidDevice humidDevice){
|
public void updateValue(HumidDevice humidDevice) {
|
||||||
baseMapper.updateValue(humidDevice);
|
baseMapper.updateValue(humidDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -378,21 +387,21 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> deleteDevice(HumidDevice humidDevice){
|
public Result<String> deleteDevice(HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("sn", humidDevice.getSn());
|
params.put("sn", humidDevice.getSn());
|
||||||
String responseStr = yiweilianApi.deleteDevice(params);
|
String responseStr = yiweilianApi.deleteDevice(params);
|
||||||
JSONObject jsonObject = new JSONObject(responseStr);
|
JSONObject jsonObject = new JSONObject(responseStr);
|
||||||
Integer responseCode = jsonObject.getInt("code");
|
Integer responseCode = jsonObject.getInt("code");
|
||||||
if(responseCode.equals(0)){
|
if (responseCode.equals(0)) {
|
||||||
baseMapper.deleteDevice(humidDevice);
|
baseMapper.deleteDevice(humidDevice);
|
||||||
humidDevice.setOptType("delete");
|
humidDevice.setOptType("delete");
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
humidDevice.setOptBy(sysUser.getUsername());
|
humidDevice.setOptBy(sysUser.getUsername());
|
||||||
baseMapper.insertLog(humidDevice);
|
baseMapper.insertLog(humidDevice);
|
||||||
return Result.OK("删除成功");
|
return Result.OK("删除成功");
|
||||||
}else{
|
} else {
|
||||||
String error = "删除失败:"+jsonObject.getStr("msg");
|
String error = "删除失败:" + jsonObject.getStr("msg");
|
||||||
return Result.error(error);
|
return Result.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -401,15 +410,15 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
* 获取设备配置参数
|
* 获取设备配置参数
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result getDeviceParameters(HumidDevice humidDevice){
|
public Result getDeviceParameters(HumidDevice humidDevice) {
|
||||||
if(humidDevice.getSn()==null||humidDevice.getSn().equals("")){
|
if (humidDevice.getSn() == null || humidDevice.getSn().equals("")) {
|
||||||
return Result.error("请指定设备SN号");
|
return Result.error("请指定设备SN号");
|
||||||
}
|
}
|
||||||
Map<String, Object> params = getParmas(0,1,humidDevice);
|
Map<String, Object> params = getParmas(0, 1, humidDevice);
|
||||||
HumidDevice deviceParameters = getDeviceConfigs(params);
|
HumidDevice deviceParameters = getDeviceConfigs(params);
|
||||||
if(deviceParameters!=null){
|
if (deviceParameters != null) {
|
||||||
return Result.OK(deviceParameters);
|
return Result.OK(deviceParameters);
|
||||||
}else{
|
} else {
|
||||||
return Result.error("温湿度设备丢失获取配置错误,请联系管理员");
|
return Result.error("温湿度设备丢失获取配置错误,请联系管理员");
|
||||||
// return Result.error("获取设备配置参数错误");
|
// return Result.error("获取设备配置参数错误");
|
||||||
}
|
}
|
||||||
|
|
@ -417,20 +426,21 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用接口获取设备配置参数
|
* 调用接口获取设备配置参数
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private HumidDevice getDeviceConfigs(Map<String,Object> map){
|
private HumidDevice getDeviceConfigs(Map<String, Object> map) {
|
||||||
HumidDevice dh = new HumidDevice();
|
HumidDevice dh = new HumidDevice();
|
||||||
String responseStr = yiweilianApi.getDeviceConfigs(map);
|
String responseStr = yiweilianApi.getDeviceConfigs(map);
|
||||||
JSONObject jsonObject = new JSONObject(responseStr);
|
JSONObject jsonObject = new JSONObject(responseStr);
|
||||||
Integer responseCode = jsonObject.getInt("code");
|
Integer responseCode = jsonObject.getInt("code");
|
||||||
if(responseCode.equals(0)){
|
if (responseCode.equals(0)) {
|
||||||
JSONObject dataObj = jsonObject.getJSONObject("data");
|
JSONObject dataObj = jsonObject.getJSONObject("data");
|
||||||
JSONArray dataArr = dataObj.getJSONArray("dataList");
|
JSONArray dataArr = dataObj.getJSONArray("dataList");
|
||||||
if(dataArr.size()>0){
|
if (dataArr.size() > 0) {
|
||||||
for(int i=0;i<dataArr.size();i++){
|
for (int i = 0; i < dataArr.size(); i++) {
|
||||||
JSONObject json = (JSONObject)dataArr.get(i);
|
JSONObject json = (JSONObject) dataArr.get(i);
|
||||||
String sn = json.getStr("sn");
|
String sn = json.getStr("sn");
|
||||||
String deviceName = json.getStr("deviceName");
|
String deviceName = json.getStr("deviceName");
|
||||||
String deviceTypes = json.getStr("deviceTypes");
|
String deviceTypes = json.getStr("deviceTypes");
|
||||||
|
|
@ -468,17 +478,17 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
dh.setIzOnline(isOnline);
|
dh.setIzOnline(isOnline);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return dh;
|
return dh;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPage<HumidDevice> findLogPage(Page<HumidDevice> page, HumidDevice humidDevice){
|
public IPage<HumidDevice> findLogPage(Page<HumidDevice> page, HumidDevice humidDevice) {
|
||||||
return baseMapper.findLogPage(page,humidDevice);
|
return baseMapper.findLogPage(page, humidDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -499,7 +509,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
}
|
}
|
||||||
|
|
||||||
@DS("devops")
|
@DS("devops")
|
||||||
public void devopsBaoxiu(HumidDevice humidDevice){
|
public void devopsBaoxiu(HumidDevice humidDevice) {
|
||||||
baseMapper.updateById(humidDevice);
|
baseMapper.updateById(humidDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -516,14 +526,14 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
|
|
||||||
//业务系统保存或者修改命令
|
//业务系统保存或者修改命令
|
||||||
@DS("#dataSourceCode")
|
@DS("#dataSourceCode")
|
||||||
public boolean syncElectricitySaveOrUpdate(String dataSourceCode,HumidDevice humidDevice) {
|
public boolean syncElectricitySaveOrUpdate(String dataSourceCode, HumidDevice humidDevice) {
|
||||||
try {
|
try {
|
||||||
QueryWrapper<HumidDevice> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<HumidDevice> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("sn",humidDevice.getSn());
|
queryWrapper.eq("sn", humidDevice.getSn());
|
||||||
HumidDevice oldParam = baseMapper.selectOne(queryWrapper);//查询数据库中该表号数据原始数据
|
HumidDevice oldParam = baseMapper.selectOne(queryWrapper);//查询数据库中该表号数据原始数据
|
||||||
if(oldParam == null){
|
if (oldParam == null) {
|
||||||
baseMapper.insert(humidDevice);
|
baseMapper.insert(humidDevice);
|
||||||
}else{
|
} else {
|
||||||
baseMapper.updateById(humidDevice);
|
baseMapper.updateById(humidDevice);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import org.jeecg.common.system.vo.LoginUser;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface INuBaseInfoApi {
|
public interface INuBaseInfoApi {
|
||||||
|
|
||||||
|
|
@ -20,7 +21,7 @@ public interface INuBaseInfoApi {
|
||||||
|
|
||||||
int updateBaseInfo(NuBaseInfoEntity nuBaseInfoApiDto);
|
int updateBaseInfo(NuBaseInfoEntity nuBaseInfoApiDto);
|
||||||
|
|
||||||
void bindNu(String nuId);
|
void bindNu(String nuId, String openId);
|
||||||
|
|
||||||
BigDecimal addBalance(String nuId, BigDecimal amount);
|
BigDecimal addBalance(String nuId, BigDecimal amount);
|
||||||
|
|
||||||
|
|
@ -29,4 +30,10 @@ public interface INuBaseInfoApi {
|
||||||
void updateById(NuBaseInfoEntity nuBaseInfo);
|
void updateById(NuBaseInfoEntity nuBaseInfo);
|
||||||
|
|
||||||
void updateData(String customerId, String status, LoginUser sysUser, String nuId);
|
void updateData(String customerId, String status, LoginUser sysUser, String nuId);
|
||||||
|
|
||||||
|
void updateByNuId(NuBaseInfoEntity baseInfo);
|
||||||
|
|
||||||
|
List<NuBaseInfoEntity> queryByOpenId(String openId);
|
||||||
|
|
||||||
|
boolean canBinding(String nuId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,18 @@ public class NuBaseInfo implements Serializable {
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
@ApiModelProperty(value = "ID")
|
@ApiModelProperty(value = "ID")
|
||||||
private java.lang.String id;
|
private java.lang.String id;
|
||||||
|
/**
|
||||||
|
* openId
|
||||||
|
*/
|
||||||
|
@Excel(name = "openId", width = 15)
|
||||||
|
@ApiModelProperty(value = "openId")
|
||||||
|
private java.lang.String openId;
|
||||||
|
/**
|
||||||
|
* 长者id nu_biz_elder_info.id
|
||||||
|
*/
|
||||||
|
@Excel(name = "长者id", width = 15)
|
||||||
|
@ApiModelProperty(value = "长者id")
|
||||||
|
private java.lang.String elderId;
|
||||||
/**
|
/**
|
||||||
* 护理单元名称
|
* 护理单元名称
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
||||||
public IPage<NuBaseInfoEntity> queryPadPageList(Integer pageNo, Integer pageSize, NuBaseInfoEntity nuBaseInfoApiDto, HttpServletRequest req) {
|
public IPage<NuBaseInfoEntity> queryPadPageList(Integer pageNo, Integer pageSize, NuBaseInfoEntity nuBaseInfoApiDto, HttpServletRequest req) {
|
||||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||||
NuBaseInfo nuBaseInfo = new NuBaseInfo();
|
NuBaseInfo nuBaseInfo = new NuBaseInfo();
|
||||||
BeanUtils.copyProperties(nuBaseInfoApiDto,nuBaseInfo);
|
BeanUtils.copyProperties(nuBaseInfoApiDto, nuBaseInfo);
|
||||||
QueryWrapper<NuBaseInfo> queryWrapper = QueryGenerator.initQueryWrapper(nuBaseInfo, req.getParameterMap(), customeRuleMap);
|
QueryWrapper<NuBaseInfo> queryWrapper = QueryGenerator.initQueryWrapper(nuBaseInfo, req.getParameterMap(), customeRuleMap);
|
||||||
Page<NuBaseInfo> page = new Page<>(pageNo, pageSize);
|
Page<NuBaseInfo> page = new Page<>(pageNo, pageSize);
|
||||||
|
|
||||||
|
|
@ -168,7 +168,7 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
||||||
});
|
});
|
||||||
|
|
||||||
IPage<NuBaseInfoEntity> entityPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
IPage<NuBaseInfoEntity> entityPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
||||||
entityPage.setRecords(BeanUtil.copyToList(list.getRecords(),NuBaseInfoEntity.class));
|
entityPage.setRecords(BeanUtil.copyToList(list.getRecords(), NuBaseInfoEntity.class));
|
||||||
return entityPage;
|
return entityPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,11 +176,11 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
||||||
public NuBaseInfoEntity queryinfoByBuId(NuBaseInfoEntity nuBaseInfoApiDto, HttpServletRequest req) {
|
public NuBaseInfoEntity queryinfoByBuId(NuBaseInfoEntity nuBaseInfoApiDto, HttpServletRequest req) {
|
||||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||||
NuBaseInfo nuBaseInfo = new NuBaseInfo();
|
NuBaseInfo nuBaseInfo = new NuBaseInfo();
|
||||||
BeanUtils.copyProperties(nuBaseInfoApiDto,nuBaseInfo);
|
BeanUtils.copyProperties(nuBaseInfoApiDto, nuBaseInfo);
|
||||||
QueryWrapper<NuBaseInfo> queryWrapper = QueryGenerator.initQueryWrapper(nuBaseInfo, req.getParameterMap(), customeRuleMap);
|
QueryWrapper<NuBaseInfo> queryWrapper = QueryGenerator.initQueryWrapper(nuBaseInfo, req.getParameterMap(), customeRuleMap);
|
||||||
NuBaseInfo dto = baseMapper.queryinfoByBuId(queryWrapper);
|
NuBaseInfo dto = baseMapper.queryinfoByBuId(queryWrapper);
|
||||||
NuBaseInfoEntity result = new NuBaseInfoEntity();
|
NuBaseInfoEntity result = new NuBaseInfoEntity();
|
||||||
BeanUtils.copyProperties(dto,result);
|
BeanUtils.copyProperties(dto, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,11 +192,12 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindNu(String nuId) {
|
public void bindNu(String nuId, String openId) {
|
||||||
UpdateWrapper<NuBaseInfo> uw = new UpdateWrapper<>();
|
UpdateWrapper<NuBaseInfo> uw = new UpdateWrapper<>();
|
||||||
uw.eq("nu_id", nuId);
|
uw.eq("nu_id", nuId);
|
||||||
NuBaseInfo baseInfo = new NuBaseInfo();
|
NuBaseInfo baseInfo = new NuBaseInfo();
|
||||||
baseInfo.setStatus("1");
|
baseInfo.setStatus("1");
|
||||||
|
baseInfo.setOpenId(openId);
|
||||||
baseMapper.update(baseInfo, uw);
|
baseMapper.update(baseInfo, uw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,13 +223,13 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
||||||
@Override
|
@Override
|
||||||
public NuBaseInfoEntity getOneByNuId(String nuId) {
|
public NuBaseInfoEntity getOneByNuId(String nuId) {
|
||||||
QueryWrapper<NuBaseInfo> qw = new QueryWrapper<>();
|
QueryWrapper<NuBaseInfo> qw = new QueryWrapper<>();
|
||||||
qw.eq("nu_id",nuId);
|
qw.eq("nu_id", nuId);
|
||||||
NuBaseInfo nuBaseInfo = baseMapper.selectOne(qw);
|
NuBaseInfo nuBaseInfo = baseMapper.selectOne(qw);
|
||||||
if(nuBaseInfo == null){
|
if(nuBaseInfo == null){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
NuBaseInfoEntity result = new NuBaseInfoEntity();
|
NuBaseInfoEntity result = new NuBaseInfoEntity();
|
||||||
BeanUtils.copyProperties(nuBaseInfo,result);
|
BeanUtils.copyProperties(nuBaseInfo, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,4 +251,30 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
||||||
baseMapper.updateById(nuBaseInfo);
|
baseMapper.updateById(nuBaseInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateByNuId(NuBaseInfoEntity baseInfoEntity) {
|
||||||
|
NuBaseInfo nuBaseInfo = new NuBaseInfo();
|
||||||
|
BeanUtils.copyProperties(baseInfoEntity, nuBaseInfo);
|
||||||
|
|
||||||
|
UpdateWrapper<NuBaseInfo> uw = new UpdateWrapper<>();
|
||||||
|
uw.eq("nu_id", baseInfoEntity.getNuId());
|
||||||
|
baseMapper.update(nuBaseInfo, uw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NuBaseInfoEntity> queryByOpenId(String openId) {
|
||||||
|
QueryWrapper<NuBaseInfo> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("open_id", openId);
|
||||||
|
List<NuBaseInfo> list = baseMapper.selectList(qw);
|
||||||
|
return BeanUtil.copyToList(list, NuBaseInfoEntity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBinding(String nuId) {
|
||||||
|
QueryWrapper<NuBaseInfo> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("nu_id",nuId);
|
||||||
|
NuBaseInfo nuBaseInfo = baseMapper.selectOne(qw);
|
||||||
|
return "0".equals(nuBaseInfo.getStatus()) || "3".equals(nuBaseInfo.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ public class NuBill implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**id*/
|
/**id*/
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
@ApiModelProperty(value = "id")
|
@ApiModelProperty(value = "ID")
|
||||||
private java.lang.Integer id;
|
private java.lang.String id;
|
||||||
/**护理单元编号*/
|
/**护理单元编号*/
|
||||||
@Excel(name = "护理单元编号", width = 15)
|
@Excel(name = "护理单元编号", width = 15)
|
||||||
@ApiModelProperty(value = "护理单元编号")
|
@ApiModelProperty(value = "护理单元编号")
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,18 @@ public class DynamicQueueNameProvider {
|
||||||
public String getKeyName() {
|
public String getKeyName() {
|
||||||
return getQueueName();
|
return getQueueName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBindElderQueueName() {
|
||||||
|
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
||||||
|
String orgCode = deptInfo.getString("code");
|
||||||
|
if (StringUtils.isNotBlank(orgCode)) {
|
||||||
|
return orgCode + ".nubaseinfo.bindelder";
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBindElderKeyName() {
|
||||||
|
return getBindElderQueueName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,11 @@ package com.nu.mq.nubaseinfo.listener;
|
||||||
|
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.nu.dto.NuBaseElderMQDto;
|
||||||
import com.nu.dto.NuBaseInfoMQDto;
|
import com.nu.dto.NuBaseInfoMQDto;
|
||||||
import com.nu.dto.StatusMQDto;
|
import com.nu.dto.StatusMQDto;
|
||||||
|
import com.nu.entity.NuBaseInfoEntity;
|
||||||
import com.nu.enums.MQStatus;
|
import com.nu.enums.MQStatus;
|
||||||
import com.nu.modules.nubaseinfo.entity.NuBaseInfo;
|
import com.nu.modules.nubaseinfo.entity.NuBaseInfo;
|
||||||
import com.nu.modules.nubaseinfo.service.INuBaseInfoService;
|
import com.nu.modules.nubaseinfo.service.INuBaseInfoService;
|
||||||
|
|
@ -32,8 +35,6 @@ public class NuBaseInfoMQListener {
|
||||||
private INuBaseInfoService baseInfoService;
|
private INuBaseInfoService baseInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* direct直连 只发给我的
|
|
||||||
*
|
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@RabbitListener(
|
@RabbitListener(
|
||||||
|
|
@ -87,4 +88,26 @@ public class NuBaseInfoMQListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
*/
|
||||||
|
@RabbitListener(
|
||||||
|
bindings = @QueueBinding(
|
||||||
|
value = @Queue(name = "#{hldyAsyncDQNP.getBindElderQueueName()}"),
|
||||||
|
exchange = @Exchange(name = "hldy.nubaseinfo", type = ExchangeTypes.DIRECT),
|
||||||
|
key = "#{hldyAsyncDQNP.getBindElderKeyName()}"
|
||||||
|
),
|
||||||
|
errorHandler = "nuBaseInfoMQErrorHandler"
|
||||||
|
)
|
||||||
|
public void handleBindElder(NuBaseInfoMQDto dto) {
|
||||||
|
//更新护理单元使用人(openId/elderId)
|
||||||
|
NuBaseInfo baseInfo = new NuBaseInfo();
|
||||||
|
baseInfo.setNuId(dto.getNuId());
|
||||||
|
baseInfo.setOpenId(dto.getOpenId());
|
||||||
|
baseInfo.setElderId(dto.getElderId());
|
||||||
|
baseInfo.setStatus("2");
|
||||||
|
UpdateWrapper<NuBaseInfo> uw = new UpdateWrapper<>();
|
||||||
|
uw.eq("nu_id", dto.getNuId());
|
||||||
|
baseInfoService.update(baseInfo, uw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue