根据仪器ID获取绑定记录

master
382696293@qq.com 2 years ago
parent 3f2a9fe314
commit 739fa50013

@ -0,0 +1,223 @@
package com.flossom.common.core.domain.ret;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.web.domain.BaseEntity;
import java.time.LocalTime;
import java.util.Date;
/**
*
*/
public class WxBindingInstrumentInfo extends BaseEntity {
/**
* ID
*/
private Long instrumentId;
/**
*
*/
private String instrumentName;
/**
* 1 2iot
*/
private Integer instrumentType;
/**
* iot
*/
private String instrumentModel;
/**
*
*/
private String instrumentBanner;
/**
* logo
*/
private String instrumentLogo;
/**
*
*/
private String instrumentSerialImageLocation;
/**
*
*/
private String bindingSerial;
/**
*
*/
private String bindingSerialImage;
/**
*
*/
private Long instrumentGuarantee;
/**
*
*/
@JsonFormat(pattern = "HH:mm:ss")
private LocalTime instrumentNursingTime;
/**
* iot
*/
private String instrumentIotVersion;
/**
* iot
*/
private String instrumentIotUpgradeData;
/**
* 0 1
*/
private Integer instrumentIsScanCode;
/**
* 0 1
*/
private Integer instrumentIsPurchase;
/**
*
*/
private Date bindingDateTime;
public Long getInstrumentId() {
return instrumentId;
}
public void setInstrumentId(Long instrumentId) {
this.instrumentId = instrumentId;
}
public String getInstrumentName() {
return instrumentName;
}
public void setInstrumentName(String instrumentName) {
this.instrumentName = instrumentName;
}
public Integer getInstrumentType() {
return instrumentType;
}
public void setInstrumentType(Integer instrumentType) {
this.instrumentType = instrumentType;
}
public String getInstrumentModel() {
return instrumentModel;
}
public void setInstrumentModel(String instrumentModel) {
this.instrumentModel = instrumentModel;
}
public String getInstrumentBanner() {
return instrumentBanner;
}
public void setInstrumentBanner(String instrumentBanner) {
this.instrumentBanner = instrumentBanner;
}
public String getInstrumentLogo() {
return instrumentLogo;
}
public void setInstrumentLogo(String instrumentLogo) {
this.instrumentLogo = instrumentLogo;
}
public String getInstrumentSerialImageLocation() {
return instrumentSerialImageLocation;
}
public void setInstrumentSerialImageLocation(String instrumentSerialImageLocation) {
this.instrumentSerialImageLocation = instrumentSerialImageLocation;
}
public String getBindingSerial() {
return bindingSerial;
}
public void setBindingSerial(String bindingSerial) {
this.bindingSerial = bindingSerial;
}
public String getBindingSerialImage() {
return bindingSerialImage;
}
public void setBindingSerialImage(String bindingSerialImage) {
this.bindingSerialImage = bindingSerialImage;
}
public Long getInstrumentGuarantee() {
return instrumentGuarantee;
}
public void setInstrumentGuarantee(Long instrumentGuarantee) {
this.instrumentGuarantee = instrumentGuarantee;
}
public LocalTime getInstrumentNursingTime() {
return instrumentNursingTime;
}
public void setInstrumentNursingTime(LocalTime instrumentNursingTime) {
this.instrumentNursingTime = instrumentNursingTime;
}
public String getInstrumentIotVersion() {
return instrumentIotVersion;
}
public void setInstrumentIotVersion(String instrumentIotVersion) {
this.instrumentIotVersion = instrumentIotVersion;
}
public String getInstrumentIotUpgradeData() {
return instrumentIotUpgradeData;
}
public void setInstrumentIotUpgradeData(String instrumentIotUpgradeData) {
this.instrumentIotUpgradeData = instrumentIotUpgradeData;
}
public Integer getInstrumentIsScanCode() {
return instrumentIsScanCode;
}
public void setInstrumentIsScanCode(Integer instrumentIsScanCode) {
this.instrumentIsScanCode = instrumentIsScanCode;
}
public Integer getInstrumentIsPurchase() {
return instrumentIsPurchase;
}
public void setInstrumentIsPurchase(Integer instrumentIsPurchase) {
this.instrumentIsPurchase = instrumentIsPurchase;
}
public Date getBindingDateTime() {
return bindingDateTime;
}
public void setBindingDateTime(Date bindingDateTime) {
this.bindingDateTime = bindingDateTime;
}
}

@ -148,4 +148,12 @@ public class WxInstrumentController extends BaseController {
return R.ok(wxInstrumentService.upgrade(instrumentId));
}
/**
* ID
*/
@GetMapping(value = "/bindingInstrumentInfo")
public R bindingInstrumentInfo(@NotBlank(message = "仪器ID不能为空") @RequestParam("instrumentId") Long instrumentId) {
return R.ok(wxInstrumentService.bindingInstrumentInfo(instrumentId));
}
}

@ -1,6 +1,7 @@
package com.flossom.miniProgram.service;
import com.flossom.common.core.domain.entity.*;
import com.flossom.common.core.domain.ret.WxBindingInstrumentInfo;
import com.flossom.common.core.domain.ret.WxModeRet;
import java.util.List;
@ -29,4 +30,6 @@ public interface IWxInstrumentService {
WxInstrumentSerial determineSerialIsSameInstrument(String serial, Long instrumentId);
String upgrade(Long instrumentId);
WxBindingInstrumentInfo bindingInstrumentInfo(Long instrumentId);
}

@ -1,7 +1,9 @@
package com.flossom.miniProgram.service.impl;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.domain.entity.*;
import com.flossom.common.core.domain.ret.WxBindingInstrumentInfo;
import com.flossom.common.core.domain.ret.WxModeRet;
import com.flossom.common.core.enums.*;
import com.flossom.common.core.exception.ServiceException;
@ -24,6 +26,7 @@ import java.io.*;
import java.net.URL;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
@ -233,6 +236,8 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
wxUserInstrumentLog.setStatus(Status.OK.getCode().longValue());
wxUserInstrumentLog.setCreateBy(wxUserMember.getNickname());
wxUserInstrumentLog.setCreateTime(DateUtils.getNowDate());
wxUserInstrumentLog.setUpdateBy(wxUserMember.getNickname());
wxUserInstrumentLog.setUpdateTime(DateUtils.getNowDate());
wxUserInstrumentLogMapper.insertWxUserInstrumentLog(wxUserInstrumentLog);
// 会员信息中的仪器数量加1
@ -437,4 +442,38 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
}
return null;
}
@Override
public WxBindingInstrumentInfo bindingInstrumentInfo(Long instrumentId) {
WxUserMember wxUserMember = SecurityUtils.getLoginUser().getWxUserMember();
WxUserInstrument query = new WxUserInstrument();
query.setUserId(wxUserMember.getId());
query.setInstrumentId(instrumentId);
query.setBindingStatus(BindingStatusEnums.BINDED.getCode());
List<WxUserInstrument> wxUserInstrumentList = wxUserInstrumentMapper.selectListByUserIdAndInstrumentId(query);
if (wxUserInstrumentList == null || wxUserInstrumentList.size() != 0) {
throw new ServiceException("没有绑定该仪器");
}
WxUserInstrument wxUserInstrument = wxUserInstrumentList.get(0);
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(instrumentId);
// 封装返回信息
WxBindingInstrumentInfo wxBindingInstrumentInfo = new WxBindingInstrumentInfo();
wxBindingInstrumentInfo.setInstrumentId(wxInstrument.getId());
wxBindingInstrumentInfo.setInstrumentName(wxInstrument.getName());
wxBindingInstrumentInfo.setInstrumentType(wxInstrument.getType());
wxBindingInstrumentInfo.setInstrumentModel(wxInstrument.getModel());
wxBindingInstrumentInfo.setInstrumentBanner(wxInstrument.getBanner());
wxBindingInstrumentInfo.setInstrumentLogo(wxInstrument.getLogo());
wxBindingInstrumentInfo.setInstrumentSerialImageLocation(wxInstrument.getSerial());
wxBindingInstrumentInfo.setBindingSerial(wxUserInstrument.getSerial());
wxBindingInstrumentInfo.setBindingSerialImage(wxUserInstrument.getSerialImage());
wxBindingInstrumentInfo.setInstrumentGuarantee(wxUserInstrument.getGuarantee());
wxBindingInstrumentInfo.setInstrumentNursingTime(wxInstrument.getNursingTime());
wxBindingInstrumentInfo.setInstrumentIotVersion(wxInstrument.getIotVersion());
wxBindingInstrumentInfo.setInstrumentIotUpgradeData(wxInstrument.getIotUpgradeData());
wxBindingInstrumentInfo.setInstrumentIsScanCode(wxInstrument.getIsScanCode());
wxBindingInstrumentInfo.setInstrumentIsPurchase(wxInstrument.getIsPurchase());
wxBindingInstrumentInfo.setBindingDateTime(wxUserInstrument.getUpdateTime());
return wxBindingInstrumentInfo;
}
}

Loading…
Cancel
Save