家属端注册到添加长者流程
This commit is contained in:
parent
c63a676219
commit
5e7af35f1d
|
|
@ -51,5 +51,11 @@
|
|||
<version>2.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nursingunit.boot</groupId>
|
||||
<artifactId>nu-elder-local-api</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@ package com.nu.modules.wechat.pay.api;
|
|||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.nu.dto.NuBaseElderMQDto;
|
||||
import com.nu.entity.NuBillEntity;
|
||||
import com.nu.entity.PayParamEntity;
|
||||
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.systemorder.api.SystemOrderApi;
|
||||
import com.nu.modules.systemorder.entity.SystemOrderApiEntity;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
import com.nu.utils.WeChatPayUtils;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||
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.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
|
@ -61,6 +65,8 @@ public class WeChatPayApi {
|
|||
private INuBaseInfoApi nuBaseInfoApi;
|
||||
@Autowired
|
||||
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 {
|
||||
|
||||
//准备各种数据
|
||||
//系统订单号+商户订单号(使用同一个,便于管理)
|
||||
//年月日时分秒+毫秒值后六位+2位随机数
|
||||
//系统订单号+商户订单号(使用同一个,便于管理):年月日时分秒+毫秒值后六位+2位随机数
|
||||
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 nuId = params.getNursingUnit();//护理单元
|
||||
|
|
@ -130,17 +135,38 @@ public class WeChatPayApi {
|
|||
upDto.setId(systemOrderApiEntity.getId());
|
||||
upDto.setOrderStatus("ORG_PAYMENT_DISABLED");//商家未启用微信支付功能
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/callback")
|
||||
public String courseNative(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
Transaction decryptObject = weChatPayUtils.callback(request);
|
||||
log.info("搜我:结果:" + decryptObject.getTradeState().name());
|
||||
log.info("搜我:整体数据:");
|
||||
log.info("" + decryptObject);
|
||||
//查询订单
|
||||
SystemOrderApiEntity orderData = systemOrderApi.selectByOutTradeNo(decryptObject.getOutTradeNo());
|
||||
|
||||
|
|
@ -150,7 +176,7 @@ public class WeChatPayApi {
|
|||
//可以在这里针对“护理单元绑定”进行特殊处理
|
||||
if ("SUCCESS".equals(decryptObject.getTradeState().name())) {
|
||||
//绑定护理单元
|
||||
nuBaseInfoApi.bindNu(orderData.getNuId());
|
||||
nuBaseInfoApi.bindNu(orderData.getNuId(), orderData.getOpenId());
|
||||
//增加余额
|
||||
BigDecimal sum = nuBaseInfoApi.addBalance(orderData.getNuId(), orderData.getAmount());
|
||||
//修改护理单元费用明细
|
||||
|
|
@ -161,9 +187,16 @@ public class WeChatPayApi {
|
|||
nuBillEntity.setAmount(orderData.getAmount());//本次变动金额
|
||||
nuBillEntity.setBalanceAfter(sum);//操作后的余额
|
||||
nuBillEntity.setType("bind_nu");
|
||||
nuBillEntity.setRemark("绑定护理单元充值:"+orderData.getAmount().toString()+"元");
|
||||
nuBillEntity.setRemark("绑定护理单元充值:" + orderData.getAmount().toString() + "元");
|
||||
nuBillEntity.setCreateTime(new Date());
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -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("/iot/tq/api/electricityMeter/**", "anon"); //电表回调
|
||||
filterChainDefinitionMap.put("/api/pad/baseInfo/**", "anon"); //电表回调
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import java.io.Serializable;
|
|||
/**
|
||||
* @Description: 护理单元
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-04-11
|
||||
* @Date: 2025-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
|
|
@ -16,4 +16,16 @@ public class NuBaseInfoMQDto implements Serializable {
|
|||
|
||||
private String orgCode;
|
||||
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;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @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 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;
|
||||
/**
|
||||
* 监护人家庭住址
|
||||
|
|
@ -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;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -9,43 +11,84 @@ import java.util.List;
|
|||
/**
|
||||
* @Description: 护理单元
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-04-11
|
||||
* @Date: 2025-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class NuBaseInfoEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**ID*/
|
||||
/**
|
||||
* 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 nuId;
|
||||
/**区域标签ID*/
|
||||
/**
|
||||
* 区域标签ID
|
||||
*/
|
||||
private String areaFlag;
|
||||
/**使用状态 0未使用 1占用 2入住 3退住 4留床*/
|
||||
/**
|
||||
* 使用状态 0未使用 1占用 2入住 3退住 4留床
|
||||
*/
|
||||
private String status;
|
||||
/**客户*/
|
||||
/**
|
||||
* 客户
|
||||
*/
|
||||
private String customerId;
|
||||
/**是否删除 0未删除 1删除*/
|
||||
/**
|
||||
* 是否删除 0未删除 1删除
|
||||
*/
|
||||
private String delFlag;
|
||||
/**创建人*/
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String sysOrgCode;
|
||||
private String orgCode;
|
||||
private String asyncId;
|
||||
/**余额*/
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
//摄像头信息
|
||||
private List<CameraInfoEntity> cameraInfo;
|
||||
private CustomerInfoEntity customerInfo;
|
||||
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;
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
private String id;
|
||||
/**护理单元编号*/
|
||||
private String nuId;
|
||||
/**长者ID*/
|
||||
|
|
|
|||
|
|
@ -7,4 +7,11 @@ import java.util.List;
|
|||
public interface IElderInfoApi {
|
||||
|
||||
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)
|
||||
@ApiModelProperty(value = "民族")
|
||||
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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.entity.ElderInfoEntity;
|
||||
import com.nu.modules.elder.api.IElderInfoApi;
|
||||
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 org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Date;
|
||||
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"));
|
||||
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.modules.syncLog.entity.SyncBizLog;
|
||||
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.mapper.HumidDeviceMapper;
|
||||
import com.nu.modules.yiweilian.humid.service.IHumidDeviceService;
|
||||
|
|
@ -49,15 +48,16 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
@Lazy
|
||||
@Autowired
|
||||
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
|
||||
public Result<String> insertDevice(HumidDevice humidDevice){
|
||||
public Result<String> insertDevice(HumidDevice humidDevice) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("sn", humidDevice.getSn());
|
||||
params.put("timeCode", humidDevice.getTimeCode());
|
||||
|
|
@ -65,54 +65,56 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
String responseStr = yiweilianApi.addDevice(params);
|
||||
JSONObject jsonObject = new JSONObject(responseStr);
|
||||
Integer responseCode = jsonObject.getInt("code");
|
||||
if(responseCode.equals(10003)){
|
||||
if (responseCode.equals(10003)) {
|
||||
baseMapper.insertDevice(humidDevice);
|
||||
humidDevice.setOptType("insert");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if(sysUser!=null){
|
||||
if (sysUser != null) {
|
||||
humidDevice.setOptBy(sysUser.getUsername());
|
||||
}
|
||||
baseMapper.insertLog(humidDevice);
|
||||
String error = updateDeviceParameters(humidDevice,"insert");
|
||||
if(!error.equals("")){
|
||||
String result = "设备添加成功,但是获取配置参数错误:"+ error;
|
||||
String error = updateDeviceParameters(humidDevice, "insert");
|
||||
if (!error.equals("")) {
|
||||
String result = "设备添加成功,但是获取配置参数错误:" + error;
|
||||
return Result.error(result);
|
||||
}
|
||||
String error2 = updateDeviceRealTime(humidDevice);
|
||||
if(!error2.equals("")){
|
||||
String result = "设备添加成功,但是获取实时数据错误:"+ error2;
|
||||
if (!error2.equals("")) {
|
||||
String result = "设备添加成功,但是获取实时数据错误:" + error2;
|
||||
return Result.error(result);
|
||||
}
|
||||
return Result.OK("添加成功");
|
||||
}else{
|
||||
String result = "添加失败:"+jsonObject.getStr("msg");
|
||||
} else {
|
||||
String result = "添加失败:" + jsonObject.getStr("msg");
|
||||
return Result.error(result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备配置参数
|
||||
*
|
||||
* @param humidDevice
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String updateDeviceParameters(HumidDevice humidDevice,String type){
|
||||
Map<String, Object> params = getParmas(0,100,humidDevice);
|
||||
return updateDeviceConfigs(params,humidDevice,type);
|
||||
public String updateDeviceParameters(HumidDevice humidDevice, String type) {
|
||||
Map<String, Object> params = getParmas(0, 100, humidDevice);
|
||||
return updateDeviceConfigs(params, humidDevice, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取接口请求参数
|
||||
*
|
||||
* @param page
|
||||
* @param limit
|
||||
* @param humidDevice
|
||||
* @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<>();
|
||||
params.put("rows", limit);
|
||||
params.put("page", page);
|
||||
if(humidDevice.getSn()!=null&&!humidDevice.getSn().equals("")){
|
||||
if (humidDevice.getSn() != null && !humidDevice.getSn().equals("")) {
|
||||
params.put("sn", humidDevice.getSn());
|
||||
}
|
||||
return params;
|
||||
|
|
@ -120,24 +122,25 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
|
||||
/**
|
||||
* 调用接口更新设备配置参数
|
||||
*
|
||||
* @param map
|
||||
* @param humidDevice
|
||||
* @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 responseStr = yiweilianApi.getDeviceConfigs(map);
|
||||
JSONObject jsonObject = new JSONObject(responseStr);
|
||||
Integer responseCode = jsonObject.getInt("code");
|
||||
if(responseCode.equals(0)){
|
||||
if (responseCode.equals(0)) {
|
||||
JSONObject dataObj = jsonObject.getJSONObject("data");
|
||||
Integer count = dataObj.getInt("count");
|
||||
Integer limit = dataObj.getInt("rows");
|
||||
Integer page = dataObj.getInt("page");
|
||||
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();
|
||||
JSONObject json = (JSONObject)dataArr.get(i);
|
||||
JSONObject json = (JSONObject) dataArr.get(i);
|
||||
String sn = json.getStr("sn");
|
||||
String deviceName = json.getStr("deviceName");
|
||||
String deviceTypes = json.getStr("deviceTypes");
|
||||
|
|
@ -176,16 +179,16 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
baseMapper.updateDevice(dh);
|
||||
dh.setOptType(type);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if(sysUser!=null){
|
||||
if (sysUser != null) {
|
||||
dh.setOptBy(sysUser.getUsername());
|
||||
}
|
||||
baseMapper.insertLog(dh);
|
||||
}
|
||||
if((page+1)*limit<count){
|
||||
Map<String, Object> params = getParmas(page+1,limit,humidDevice);
|
||||
errorMsg += updateDeviceConfigs(params,humidDevice,type);
|
||||
if ((page + 1) * limit < count) {
|
||||
Map<String, Object> params = getParmas(page + 1, limit, humidDevice);
|
||||
errorMsg += updateDeviceConfigs(params, humidDevice, type);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
errorMsg = jsonObject.getStr("msg");
|
||||
}
|
||||
return errorMsg;
|
||||
|
|
@ -193,26 +196,29 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
|
||||
/**
|
||||
* 更新设备实时数据(抄表)
|
||||
*
|
||||
* @param humidDevice
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String updateDeviceRealTime(HumidDevice humidDevice){
|
||||
Map<String, Object> params = getRealTimeParmas(0,50,humidDevice);
|
||||
return updateDeviceRealTimeData(params,humidDevice);
|
||||
public String updateDeviceRealTime(HumidDevice humidDevice) {
|
||||
Map<String, Object> params = getRealTimeParmas(0, 50, humidDevice);
|
||||
return updateDeviceRealTimeData(params, humidDevice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实时数据接口请求参数
|
||||
*
|
||||
* @param page
|
||||
* @param limit
|
||||
* @param humidDevice
|
||||
* @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<>();
|
||||
params.put("rows", limit);
|
||||
params.put("page", page);
|
||||
if(humidDevice.getSn()!=null&&!humidDevice.getSn().equals("")){
|
||||
if (humidDevice.getSn() != null && !humidDevice.getSn().equals("")) {
|
||||
String[] str = new String[1];
|
||||
str[0] = humidDevice.getSn();
|
||||
params.put("snList", str);
|
||||
|
|
@ -222,25 +228,26 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
|
||||
/**
|
||||
* 调用接口更新设备实时数据(抄表)
|
||||
*
|
||||
* @param map
|
||||
* @param humidDevice
|
||||
* @return
|
||||
*/
|
||||
private String updateDeviceRealTimeData(Map<String,Object> map,HumidDevice humidDevice){
|
||||
private String updateDeviceRealTimeData(Map<String, Object> map, HumidDevice humidDevice) {
|
||||
String errorMsg = "";
|
||||
String responseStr = yiweilianApi.getRealTime(map);
|
||||
JSONObject jsonObject = new JSONObject(responseStr);
|
||||
Integer responseCode = jsonObject.getInt("code");
|
||||
if(responseCode.equals(0)){
|
||||
if (responseCode.equals(0)) {
|
||||
JSONObject dataObj = jsonObject.getJSONObject("data");
|
||||
Integer count = dataObj.getInt("count");
|
||||
Integer limit = dataObj.getInt("rows");
|
||||
Integer page = dataObj.getInt("page");
|
||||
JSONArray dataArr = dataObj.getJSONArray("dataList");
|
||||
if(dataArr.size()>0){
|
||||
for(int i=0;i<dataArr.size();i++){
|
||||
if (dataArr.size() > 0) {
|
||||
for (int i = 0; i < dataArr.size(); i++) {
|
||||
HumidDevice dh = new HumidDevice();
|
||||
JSONObject json = (JSONObject)dataArr.get(i);
|
||||
JSONObject json = (JSONObject) dataArr.get(i);
|
||||
String sn = json.getStr("sn");
|
||||
String status = json.getStr("status");
|
||||
String electricity = json.getStr("electricity");
|
||||
|
|
@ -248,11 +255,11 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
String humidity = json.getStr("humidity");
|
||||
String reportingTime = json.getStr("date");
|
||||
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();
|
||||
ca.add(Calendar.MINUTE,-5);
|
||||
ca.add(Calendar.MINUTE, -5);
|
||||
Date currentDate = ca.getTime();
|
||||
if(reportingDate.getTime()<=currentDate.getTime()){
|
||||
if (reportingDate.getTime() <= currentDate.getTime()) {
|
||||
dh.setStatus("1");
|
||||
}
|
||||
dh.setSn(sn);
|
||||
|
|
@ -263,14 +270,14 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
baseMapper.updateValue(dh);
|
||||
dh.setOptType("read");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if(sysUser!=null){
|
||||
if (sysUser != null) {
|
||||
dh.setOptBy(sysUser.getUsername());
|
||||
}
|
||||
baseMapper.insertLog(dh);
|
||||
syncStatusMq(dh);
|
||||
}
|
||||
}else{
|
||||
errorMsg += humidDevice.getSn()+"温湿度设备丢失,请联系管理员";
|
||||
} else {
|
||||
errorMsg += humidDevice.getSn() + "温湿度设备丢失,请联系管理员";
|
||||
HumidDevice dh = new HumidDevice();
|
||||
dh.setSn(humidDevice.getSn());
|
||||
dh.setStatus("1");
|
||||
|
|
@ -280,18 +287,18 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
dh.setReportingTime(DateUtil.now());
|
||||
dh.setOptType("read");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if(sysUser!=null){
|
||||
if (sysUser != null) {
|
||||
dh.setOptBy(sysUser.getUsername());
|
||||
}
|
||||
baseMapper.insertLog(dh);
|
||||
baseMapper.updateValue(dh);
|
||||
syncStatusMq(dh);
|
||||
}
|
||||
if((page+1)*limit<count){
|
||||
Map<String, Object> params = getParmas(page+1,limit,humidDevice);
|
||||
errorMsg += updateDeviceRealTimeData(params,humidDevice);
|
||||
if ((page + 1) * limit < count) {
|
||||
Map<String, Object> params = getParmas(page + 1, limit, humidDevice);
|
||||
errorMsg += updateDeviceRealTimeData(params, humidDevice);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
errorMsg = jsonObject.getStr("msg");
|
||||
}
|
||||
return errorMsg;
|
||||
|
|
@ -299,11 +306,12 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
|
||||
/**
|
||||
* 同步到运维系统
|
||||
*
|
||||
* @param humidDevice
|
||||
*/
|
||||
private void syncStatusMq(HumidDevice humidDevice){
|
||||
private void syncStatusMq(HumidDevice humidDevice) {
|
||||
HumidDevice entity = baseMapper.getHumidInfo(humidDevice);
|
||||
if(entity!=null){
|
||||
if (entity != null) {
|
||||
IotHumidDeviceMQDto ihd = new IotHumidDeviceMQDto();
|
||||
BeanUtils.copyProperties(entity, ihd);
|
||||
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<>();
|
||||
params.put("sn", humidDevice.getSn());
|
||||
params.put("timeCode", humidDevice.getTimeCode());
|
||||
|
|
@ -347,30 +355,31 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
* 修改
|
||||
*/
|
||||
@Override
|
||||
public Result<String> updateDevice(HumidDevice humidDevice){
|
||||
public Result<String> updateDevice(HumidDevice humidDevice) {
|
||||
Map<String, Object> params = getUpdateParmas(humidDevice);
|
||||
String responseStr = yiweilianApi.updateDeviceConfig(params);
|
||||
JSONObject jsonObject = new JSONObject(responseStr);
|
||||
Integer responseCode = jsonObject.getInt("code");
|
||||
if(responseCode.equals(0)){
|
||||
if (responseCode.equals(0)) {
|
||||
baseMapper.updateDevice(humidDevice);
|
||||
humidDevice.setOptType("update");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
humidDevice.setOptBy(sysUser.getUsername());
|
||||
baseMapper.insertLog(humidDevice);
|
||||
return Result.OK("修改成功");
|
||||
}else{
|
||||
String error = "修改失败:"+jsonObject.getStr("msg");
|
||||
} else {
|
||||
String error = "修改失败:" + jsonObject.getStr("msg");
|
||||
return Result.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新温湿度值
|
||||
*
|
||||
* @param humidDevice
|
||||
*/
|
||||
@Override
|
||||
public void updateValue(HumidDevice humidDevice){
|
||||
public void updateValue(HumidDevice humidDevice) {
|
||||
baseMapper.updateValue(humidDevice);
|
||||
}
|
||||
|
||||
|
|
@ -378,21 +387,21 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
* 删除
|
||||
*/
|
||||
@Override
|
||||
public Result<String> deleteDevice(HumidDevice humidDevice){
|
||||
public Result<String> deleteDevice(HumidDevice humidDevice) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("sn", humidDevice.getSn());
|
||||
String responseStr = yiweilianApi.deleteDevice(params);
|
||||
JSONObject jsonObject = new JSONObject(responseStr);
|
||||
Integer responseCode = jsonObject.getInt("code");
|
||||
if(responseCode.equals(0)){
|
||||
if (responseCode.equals(0)) {
|
||||
baseMapper.deleteDevice(humidDevice);
|
||||
humidDevice.setOptType("delete");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
humidDevice.setOptBy(sysUser.getUsername());
|
||||
baseMapper.insertLog(humidDevice);
|
||||
return Result.OK("删除成功");
|
||||
}else{
|
||||
String error = "删除失败:"+jsonObject.getStr("msg");
|
||||
} else {
|
||||
String error = "删除失败:" + jsonObject.getStr("msg");
|
||||
return Result.error(error);
|
||||
}
|
||||
}
|
||||
|
|
@ -401,15 +410,15 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
* 获取设备配置参数
|
||||
*/
|
||||
@Override
|
||||
public Result getDeviceParameters(HumidDevice humidDevice){
|
||||
if(humidDevice.getSn()==null||humidDevice.getSn().equals("")){
|
||||
public Result getDeviceParameters(HumidDevice humidDevice) {
|
||||
if (humidDevice.getSn() == null || humidDevice.getSn().equals("")) {
|
||||
return Result.error("请指定设备SN号");
|
||||
}
|
||||
Map<String, Object> params = getParmas(0,1,humidDevice);
|
||||
Map<String, Object> params = getParmas(0, 1, humidDevice);
|
||||
HumidDevice deviceParameters = getDeviceConfigs(params);
|
||||
if(deviceParameters!=null){
|
||||
if (deviceParameters != null) {
|
||||
return Result.OK(deviceParameters);
|
||||
}else{
|
||||
} else {
|
||||
return Result.error("温湿度设备丢失获取配置错误,请联系管理员");
|
||||
// return Result.error("获取设备配置参数错误");
|
||||
}
|
||||
|
|
@ -417,20 +426,21 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
|
||||
/**
|
||||
* 调用接口获取设备配置参数
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
private HumidDevice getDeviceConfigs(Map<String,Object> map){
|
||||
private HumidDevice getDeviceConfigs(Map<String, Object> map) {
|
||||
HumidDevice dh = new HumidDevice();
|
||||
String responseStr = yiweilianApi.getDeviceConfigs(map);
|
||||
JSONObject jsonObject = new JSONObject(responseStr);
|
||||
Integer responseCode = jsonObject.getInt("code");
|
||||
if(responseCode.equals(0)){
|
||||
if (responseCode.equals(0)) {
|
||||
JSONObject dataObj = jsonObject.getJSONObject("data");
|
||||
JSONArray dataArr = dataObj.getJSONArray("dataList");
|
||||
if(dataArr.size()>0){
|
||||
for(int i=0;i<dataArr.size();i++){
|
||||
JSONObject json = (JSONObject)dataArr.get(i);
|
||||
if (dataArr.size() > 0) {
|
||||
for (int i = 0; i < dataArr.size(); i++) {
|
||||
JSONObject json = (JSONObject) dataArr.get(i);
|
||||
String sn = json.getStr("sn");
|
||||
String deviceName = json.getStr("deviceName");
|
||||
String deviceTypes = json.getStr("deviceTypes");
|
||||
|
|
@ -468,17 +478,17 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
dh.setIzOnline(isOnline);
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return dh;
|
||||
}
|
||||
|
||||
public IPage<HumidDevice> findLogPage(Page<HumidDevice> page, HumidDevice humidDevice){
|
||||
return baseMapper.findLogPage(page,humidDevice);
|
||||
public IPage<HumidDevice> findLogPage(Page<HumidDevice> page, HumidDevice humidDevice) {
|
||||
return baseMapper.findLogPage(page, humidDevice);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -499,7 +509,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
}
|
||||
|
||||
@DS("devops")
|
||||
public void devopsBaoxiu(HumidDevice humidDevice){
|
||||
public void devopsBaoxiu(HumidDevice humidDevice) {
|
||||
baseMapper.updateById(humidDevice);
|
||||
}
|
||||
|
||||
|
|
@ -516,14 +526,14 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
|
||||
//业务系统保存或者修改命令
|
||||
@DS("#dataSourceCode")
|
||||
public boolean syncElectricitySaveOrUpdate(String dataSourceCode,HumidDevice humidDevice) {
|
||||
public boolean syncElectricitySaveOrUpdate(String dataSourceCode, HumidDevice humidDevice) {
|
||||
try {
|
||||
QueryWrapper<HumidDevice> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("sn",humidDevice.getSn());
|
||||
queryWrapper.eq("sn", humidDevice.getSn());
|
||||
HumidDevice oldParam = baseMapper.selectOne(queryWrapper);//查询数据库中该表号数据原始数据
|
||||
if(oldParam == null){
|
||||
if (oldParam == null) {
|
||||
baseMapper.insert(humidDevice);
|
||||
}else{
|
||||
} else {
|
||||
baseMapper.updateById(humidDevice);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import org.jeecg.common.system.vo.LoginUser;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public interface INuBaseInfoApi {
|
||||
|
||||
|
|
@ -20,7 +21,7 @@ public interface INuBaseInfoApi {
|
|||
|
||||
int updateBaseInfo(NuBaseInfoEntity nuBaseInfoApiDto);
|
||||
|
||||
void bindNu(String nuId);
|
||||
void bindNu(String nuId, String openId);
|
||||
|
||||
BigDecimal addBalance(String nuId, BigDecimal amount);
|
||||
|
||||
|
|
@ -29,4 +30,10 @@ public interface INuBaseInfoApi {
|
|||
void updateById(NuBaseInfoEntity nuBaseInfo);
|
||||
|
||||
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)
|
||||
@ApiModelProperty(value = "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) {
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
NuBaseInfo nuBaseInfo = new NuBaseInfo();
|
||||
BeanUtils.copyProperties(nuBaseInfoApiDto,nuBaseInfo);
|
||||
BeanUtils.copyProperties(nuBaseInfoApiDto, nuBaseInfo);
|
||||
QueryWrapper<NuBaseInfo> queryWrapper = QueryGenerator.initQueryWrapper(nuBaseInfo, req.getParameterMap(), customeRuleMap);
|
||||
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());
|
||||
entityPage.setRecords(BeanUtil.copyToList(list.getRecords(),NuBaseInfoEntity.class));
|
||||
entityPage.setRecords(BeanUtil.copyToList(list.getRecords(), NuBaseInfoEntity.class));
|
||||
return entityPage;
|
||||
}
|
||||
|
||||
|
|
@ -176,11 +176,11 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
|||
public NuBaseInfoEntity queryinfoByBuId(NuBaseInfoEntity nuBaseInfoApiDto, HttpServletRequest req) {
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
NuBaseInfo nuBaseInfo = new NuBaseInfo();
|
||||
BeanUtils.copyProperties(nuBaseInfoApiDto,nuBaseInfo);
|
||||
BeanUtils.copyProperties(nuBaseInfoApiDto, nuBaseInfo);
|
||||
QueryWrapper<NuBaseInfo> queryWrapper = QueryGenerator.initQueryWrapper(nuBaseInfo, req.getParameterMap(), customeRuleMap);
|
||||
NuBaseInfo dto = baseMapper.queryinfoByBuId(queryWrapper);
|
||||
NuBaseInfoEntity result = new NuBaseInfoEntity();
|
||||
BeanUtils.copyProperties(dto,result);
|
||||
BeanUtils.copyProperties(dto, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -192,11 +192,12 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
|||
}
|
||||
|
||||
@Override
|
||||
public void bindNu(String nuId) {
|
||||
public void bindNu(String nuId, String openId) {
|
||||
UpdateWrapper<NuBaseInfo> uw = new UpdateWrapper<>();
|
||||
uw.eq("nu_id", nuId);
|
||||
NuBaseInfo baseInfo = new NuBaseInfo();
|
||||
baseInfo.setStatus("1");
|
||||
baseInfo.setOpenId(openId);
|
||||
baseMapper.update(baseInfo, uw);
|
||||
}
|
||||
|
||||
|
|
@ -222,13 +223,13 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
|||
@Override
|
||||
public NuBaseInfoEntity getOneByNuId(String nuId) {
|
||||
QueryWrapper<NuBaseInfo> qw = new QueryWrapper<>();
|
||||
qw.eq("nu_id",nuId);
|
||||
qw.eq("nu_id", nuId);
|
||||
NuBaseInfo nuBaseInfo = baseMapper.selectOne(qw);
|
||||
if(nuBaseInfo == null){
|
||||
return null;
|
||||
}
|
||||
NuBaseInfoEntity result = new NuBaseInfoEntity();
|
||||
BeanUtils.copyProperties(nuBaseInfo,result);
|
||||
BeanUtils.copyProperties(nuBaseInfo, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -250,4 +251,30 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
|||
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;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.Integer id;
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private java.lang.String id;
|
||||
/**护理单元编号*/
|
||||
@Excel(name = "护理单元编号", width = 15)
|
||||
@ApiModelProperty(value = "护理单元编号")
|
||||
|
|
|
|||
|
|
@ -25,4 +25,18 @@ public class DynamicQueueNameProvider {
|
|||
public String getKeyName() {
|
||||
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 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.StatusMQDto;
|
||||
import com.nu.entity.NuBaseInfoEntity;
|
||||
import com.nu.enums.MQStatus;
|
||||
import com.nu.modules.nubaseinfo.entity.NuBaseInfo;
|
||||
import com.nu.modules.nubaseinfo.service.INuBaseInfoService;
|
||||
|
|
@ -32,8 +35,6 @@ public class NuBaseInfoMQListener {
|
|||
private INuBaseInfoService baseInfoService;
|
||||
|
||||
/**
|
||||
* direct直连 只发给我的
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
@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