From 427f31a5ae905fbeb2edc5e454dfa6572307b2f9 Mon Sep 17 00:00:00 2001 From: "382696293@qq.com" <382696293@qq.com> Date: Wed, 27 Mar 2024 14:09:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=AA=E5=99=A8=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=86=9C=E5=B8=83=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/entity/WxInstrumentLining.java | 83 +++++++++ .../core/domain/entity/WxInstrumentMode.java | 10 ++ .../common/core/domain/entity/WxLining.java | 29 ++++ .../core/domain/req/WxInstrumentSaveReq.java | 14 ++ .../core/mapper/WxInstrumentLiningMapper.java | 63 +++++++ .../mapper/WxInstrumentLiningMapper.xml | 78 +++++++++ .../mapper/WxInstrumentModeMapper.xml | 7 +- .../service/impl/WxInstrumentServiceImpl.java | 164 ++++++++++++++++-- 8 files changed, 431 insertions(+), 17 deletions(-) create mode 100644 flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentLining.java create mode 100644 flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentLiningMapper.java create mode 100644 flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentLiningMapper.xml diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentLining.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentLining.java new file mode 100644 index 0000000..49278e3 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentLining.java @@ -0,0 +1,83 @@ +package com.flossom.common.core.domain.entity; + +import com.flossom.common.core.annotation.Excel; +import com.flossom.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 仪器与膜布的关联对象 wx_instrument_lining + * + * @author flossom + * @date 2024-03-27 + */ +public class WxInstrumentLining extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 仪器id + */ + @Excel(name = "仪器id") + private Long instrumentId; + + /** + * 膜布id + */ + @Excel(name = "膜布id") + private Long liningId; + + /** + * 状态(0正常 1停用) + */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private Long status; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setInstrumentId(Long instrumentId) { + this.instrumentId = instrumentId; + } + + public Long getInstrumentId() { + return instrumentId; + } + + public void setLiningId(Long liningId) { + this.liningId = liningId; + } + + public Long getLiningId() { + return liningId; + } + + public void setStatus(Long status) { + this.status = status; + } + + public Long getStatus() { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("instrumentId", getInstrumentId()) + .append("liningId", getLiningId()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentMode.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentMode.java index cf2c0dd..9cbd681 100644 --- a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentMode.java +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentMode.java @@ -48,6 +48,8 @@ public class WxInstrumentMode extends BaseEntity { @Excel(name = "状态", readConverterExp = "0=正常,1=停用") private Integer status; + private Long liningId; + public void setId(Long id) { this.id = id; } @@ -96,6 +98,14 @@ public class WxInstrumentMode extends BaseEntity { this.isNew = isNew; } + public Long getLiningId() { + return liningId; + } + + public void setLiningId(Long liningId) { + this.liningId = liningId; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxLining.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxLining.java index 7270595..e714c66 100644 --- a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxLining.java +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxLining.java @@ -5,6 +5,8 @@ import com.flossom.common.core.web.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import java.util.List; + /** * 膜布对象 wx_lining * @@ -64,6 +66,16 @@ public class WxLining extends BaseEntity { @Excel(name = "状态", readConverterExp = "0=正常,1=禁用") private Long status; + /** + * 当前膜布下的模式集合 + */ + private List modeList; + + /** + * 带new标识的模式 + */ + private List newModeIdList; + public void setId(Long id) { this.id = id; } @@ -136,6 +148,23 @@ public class WxLining extends BaseEntity { return status; } + + public List getModeList() { + return modeList; + } + + public void setModeList(List modeList) { + this.modeList = modeList; + } + + public List getNewModeIdList() { + return newModeIdList; + } + + public void setNewModeIdList(List newModeIdList) { + this.newModeIdList = newModeIdList; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxInstrumentSaveReq.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxInstrumentSaveReq.java index 32da9f2..4c59a6a 100644 --- a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxInstrumentSaveReq.java +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxInstrumentSaveReq.java @@ -2,6 +2,7 @@ package com.flossom.common.core.domain.req; import com.fasterxml.jackson.annotation.JsonFormat; import com.flossom.common.core.domain.entity.WxInstrumentFileRelate; +import com.flossom.common.core.domain.entity.WxLining; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; @@ -260,6 +261,11 @@ public class WxInstrumentSaveReq { */ private String we200BluetoothConnectingContent; + /** + * 膜布集合 + */ + private List wxLiningList; + public Long getId() { return id; } @@ -619,4 +625,12 @@ public class WxInstrumentSaveReq { public void setWe200BluetoothConnectingContent(String we200BluetoothConnectingContent) { this.we200BluetoothConnectingContent = we200BluetoothConnectingContent; } + + public List getWxLiningList() { + return wxLiningList; + } + + public void setWxLiningList(List wxLiningList) { + this.wxLiningList = wxLiningList; + } } diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentLiningMapper.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentLiningMapper.java new file mode 100644 index 0000000..93dd9c6 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentLiningMapper.java @@ -0,0 +1,63 @@ +package com.flossom.common.core.mapper; + +import com.flossom.common.core.domain.entity.WxInstrumentLining; + +import java.util.List; + +/** + * 仪器与膜布的关联Mapper接口 + * + * @author flossom + * @date 2024-03-27 + */ +public interface WxInstrumentLiningMapper { + /** + * 查询仪器与膜布的关联 + * + * @param id 仪器与膜布的关联主键 + * @return 仪器与膜布的关联 + */ + public WxInstrumentLining selectWxInstrumentLiningById(Long id); + + /** + * 查询仪器与膜布的关联列表 + * + * @param wxInstrumentLining 仪器与膜布的关联 + * @return 仪器与膜布的关联集合 + */ + public List selectWxInstrumentLiningList(WxInstrumentLining wxInstrumentLining); + + /** + * 新增仪器与膜布的关联 + * + * @param wxInstrumentLining 仪器与膜布的关联 + * @return 结果 + */ + public int insertWxInstrumentLining(WxInstrumentLining wxInstrumentLining); + + /** + * 修改仪器与膜布的关联 + * + * @param wxInstrumentLining 仪器与膜布的关联 + * @return 结果 + */ + public int updateWxInstrumentLining(WxInstrumentLining wxInstrumentLining); + + /** + * 删除仪器与膜布的关联 + * + * @param id 仪器与膜布的关联主键 + * @return 结果 + */ + public int deleteWxInstrumentLiningById(Long id); + + /** + * 批量删除仪器与膜布的关联 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWxInstrumentLiningByIds(Long[] ids); + + public int deleteByInstrumentId(Long instrumentId); +} diff --git a/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentLiningMapper.xml b/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentLiningMapper.xml new file mode 100644 index 0000000..5f6eccc --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentLiningMapper.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + select id, instrument_id, lining_id, status, create_by, create_time from wx_instrument_lining + + + + + + + + insert into wx_instrument_lining + + instrument_id, + lining_id, + status, + create_by, + create_time, + + + #{instrumentId}, + #{liningId}, + #{status}, + #{createBy}, + #{createTime}, + + + + + update wx_instrument_lining + + instrument_id = #{instrumentId}, + lining_id = #{liningId}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from wx_instrument_lining where id = #{id} + + + + delete from wx_instrument_lining where id in + + #{id} + + + + + delete from wx_instrument_lining where instrument_id = #{instrumentId} + + \ No newline at end of file diff --git a/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentModeMapper.xml b/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentModeMapper.xml index 8fe99b8..31c725c 100644 --- a/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentModeMapper.xml +++ b/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentModeMapper.xml @@ -13,10 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select id, instrument_id, mode_id, mode_sort, is_new, status, create_by, create_time from wx_instrument_mode + select id, instrument_id, mode_id, mode_sort, is_new, status, create_by, create_time, lining_id from wx_instrument_mode @@ -45,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" status, create_by, create_time, + lining_id, #{instrumentId}, @@ -54,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{status}, #{createBy}, #{createTime}, + #{liningId}, @@ -67,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" status = #{status}, create_by = #{createBy}, create_time = #{createTime}, + lining_id = #{liningId}, where id = #{id} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentServiceImpl.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentServiceImpl.java index 527b107..f939ebd 100644 --- a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentServiceImpl.java +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentServiceImpl.java @@ -45,6 +45,12 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService { @Autowired private WxInstrumentTagMapper wxInstrumentTagMapper; + @Autowired + private WxInstrumentLiningMapper wxInstrumentLiningMapper; + + @Autowired + private WxLiningMapper wxLiningMapper; + /** * 查询仪器列 * @@ -80,21 +86,50 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService { selectByInstrumentIdAndClassify(wxInstrument.getId(), InstrumentFileClassifyEnum.INSTRUMENT_INSTRUCTION.getCode()); wxInstrumentSaveReq.setIntroduceList(instructionRelate); // 获取模式关联 - WxInstrumentMode wxInstrumentMode = new WxInstrumentMode(); - wxInstrumentMode.setInstrumentId(id); - List wxInstrumentModes = wxInstrumentModeMapper.selectWxInstrumentModeList(wxInstrumentMode); - if (wxInstrumentModes != null && wxInstrumentModes.size() > 0) { - wxInstrumentSaveReq.setModeIdsValue(wxInstrumentModes.stream() - .map(WxInstrumentMode::getModeId) - .map(Long::intValue) - .collect(Collectors.toList())); - - wxInstrumentSaveReq.setNewModeIdList(wxInstrumentModes.stream() - .filter(im -> im.getIsNew() == 1) - .map(WxInstrumentMode::getModeId) - .map(Long::intValue) - .collect(Collectors.toList()) - ); + if (!StringUtils.equals(wxInstrument.getModel(), "WE200")) { + // 其他仪器直接获取关联的模式 + WxInstrumentMode wxInstrumentMode = new WxInstrumentMode(); + wxInstrumentMode.setInstrumentId(id); + List wxInstrumentModes = wxInstrumentModeMapper.selectWxInstrumentModeList(wxInstrumentMode); + if (wxInstrumentModes != null && wxInstrumentModes.size() > 0) { + wxInstrumentSaveReq.setModeIdsValue(wxInstrumentModes.stream() + .map(WxInstrumentMode::getModeId) + .map(Long::intValue) + .collect(Collectors.toList())); + wxInstrumentSaveReq.setNewModeIdList(wxInstrumentModes.stream() + .filter(im -> im.getIsNew() == 1) + .map(WxInstrumentMode::getModeId) + .map(Long::intValue) + .collect(Collectors.toList()) + ); + } + } else { + // we200 获取膜布关联的模式 + WxInstrumentLining instrumentLiningQuery = new WxInstrumentLining(); + instrumentLiningQuery.setInstrumentId(id); + List instrumentLiningList = wxInstrumentLiningMapper.selectWxInstrumentLiningList(instrumentLiningQuery); + if (instrumentLiningList != null) { + for (WxInstrumentLining wxInstrumentLining : instrumentLiningList) { + Long liningId = wxInstrumentLining.getLiningId(); + WxLining wxLining = wxLiningMapper.selectWxLiningById(liningId); + WxInstrumentMode instrumentModeQuery = new WxInstrumentMode(); + instrumentModeQuery.setInstrumentId(id); + instrumentModeQuery.setLiningId(liningId); + List wxInstrumentModeList = wxInstrumentModeMapper.selectWxInstrumentModeList(instrumentModeQuery); + if (wxInstrumentModeList != null && wxInstrumentModeList.size() > 0) { + wxLining.setModeList(wxInstrumentModeList.stream() + .map(WxInstrumentMode::getModeId) + .map(Long::intValue) + .collect(Collectors.toList())); + wxLining.setNewModeIdList(wxInstrumentModeList.stream() + .filter(im -> im.getIsNew() == 1) + .map(WxInstrumentMode::getModeId) + .map(Long::intValue) + .collect(Collectors.toList()) + ); + } + } + } } return wxInstrumentSaveReq; } @@ -222,6 +257,55 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService { wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode); } } + + // 膜布关联的模式 + List wxLiningList = wxInstrumentSaveReq.getWxLiningList(); + if (wxLiningList != null && wxLiningList.size() > 0) { + wxInstrumentModeMapper.deleteByInstrumentId(wxInstrument.getId()); + wxInstrumentLiningMapper.deleteByInstrumentId(wxInstrument.getId()); + for (WxLining wxLining : wxLiningList) { + Long liningId = wxLining.getId(); + WxInstrumentLining wxInstrumentLining = new WxInstrumentLining(); + wxInstrumentLining.setLiningId(liningId); + wxInstrumentLining.setInstrumentId(wxInstrument.getId()); + wxInstrumentLining.setStatus(Status.OK.getCode().longValue()); + wxInstrumentLining.setCreateBy(SecurityUtils.getUsername()); + wxInstrumentLining.setCreateTime(DateUtils.getNowDate()); + wxInstrumentLiningMapper.insertWxInstrumentLining(wxInstrumentLining); + + List modeList = wxLining.getModeList(); + if (modeList != null && modeList.size() > 0) { + for (int i = 0; i < modeList.size(); i++) { + WxInstrumentMode wxInstrumentMode = new WxInstrumentMode(); + wxInstrumentMode.setInstrumentId(wxInstrument.getId()); + wxInstrumentMode.setModeId(modeList.get(i).longValue()); + wxInstrumentMode.setModeSort(i); + wxInstrumentMode.setIsNew(0); + wxInstrumentMode.setLiningId(liningId); + wxInstrumentMode.setStatus(Status.OK.getCode()); + wxInstrumentMode.setCreateBy(SecurityUtils.getUsername()); + wxInstrumentMode.setCreateTime(DateUtils.getNowDate()); + wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode); + } + } + List newModeIdList = wxLining.getNewModeIdList(); + if (newModeIdList != null && newModeIdList.size() > 0) { + for (int i = 0; i < newModeIdList.size(); i++) { + WxInstrumentMode wxInstrumentMode = new WxInstrumentMode(); + wxInstrumentMode.setInstrumentId(wxInstrument.getId()); + wxInstrumentMode.setModeId(modeIdList.get(i).longValue()); + wxInstrumentMode.setModeSort(i); + wxInstrumentMode.setIsNew(1); + wxInstrumentMode.setLiningId(liningId); + wxInstrumentMode.setStatus(Status.OK.getCode()); + wxInstrumentMode.setCreateBy(SecurityUtils.getUsername()); + wxInstrumentMode.setCreateTime(DateUtils.getNowDate()); + wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode); + } + } + } + } + return insertNum; } @@ -268,7 +352,6 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService { } wxInstrument.setUpdateTime(DateUtils.getNowDate()); - // 打卡时间处理 // 打卡时间处理 if (wxInstrumentSaveReq.getIsExtraClock() != null && wxInstrumentSaveReq.getIsExtraClock() == 1) { wxInstrument.setStartTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(0)); @@ -329,6 +412,55 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService { wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode); } } + + // 膜布关联的模式 + List wxLiningList = wxInstrumentSaveReq.getWxLiningList(); + if (wxLiningList != null && wxLiningList.size() > 0) { + wxInstrumentModeMapper.deleteByInstrumentId(wxInstrument.getId()); + wxInstrumentLiningMapper.deleteByInstrumentId(wxInstrument.getId()); + for (WxLining wxLining : wxLiningList) { + Long liningId = wxLining.getId(); + WxInstrumentLining wxInstrumentLining = new WxInstrumentLining(); + wxInstrumentLining.setLiningId(liningId); + wxInstrumentLining.setInstrumentId(wxInstrument.getId()); + wxInstrumentLining.setStatus(Status.OK.getCode().longValue()); + wxInstrumentLining.setCreateBy(SecurityUtils.getUsername()); + wxInstrumentLining.setCreateTime(DateUtils.getNowDate()); + wxInstrumentLiningMapper.insertWxInstrumentLining(wxInstrumentLining); + + List modeList = wxLining.getModeList(); + if (modeList != null && modeList.size() > 0) { + for (int i = 0; i < modeList.size(); i++) { + WxInstrumentMode wxInstrumentMode = new WxInstrumentMode(); + wxInstrumentMode.setInstrumentId(wxInstrument.getId()); + wxInstrumentMode.setModeId(modeList.get(i).longValue()); + wxInstrumentMode.setModeSort(i); + wxInstrumentMode.setIsNew(0); + wxInstrumentMode.setLiningId(liningId); + wxInstrumentMode.setStatus(Status.OK.getCode()); + wxInstrumentMode.setCreateBy(SecurityUtils.getUsername()); + wxInstrumentMode.setCreateTime(DateUtils.getNowDate()); + wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode); + } + } + List newModeIdList = wxLining.getNewModeIdList(); + if (newModeIdList != null && newModeIdList.size() > 0) { + for (int i = 0; i < newModeIdList.size(); i++) { + WxInstrumentMode wxInstrumentMode = new WxInstrumentMode(); + wxInstrumentMode.setInstrumentId(wxInstrument.getId()); + wxInstrumentMode.setModeId(modeIdList.get(i).longValue()); + wxInstrumentMode.setModeSort(i); + wxInstrumentMode.setIsNew(1); + wxInstrumentMode.setLiningId(liningId); + wxInstrumentMode.setStatus(Status.OK.getCode()); + wxInstrumentMode.setCreateBy(SecurityUtils.getUsername()); + wxInstrumentMode.setCreateTime(DateUtils.getNowDate()); + wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode); + } + } + } + } + return wxInstrumentMapper.updateWxInstrument(wxInstrument); } From 4addf14637b8b1bb16bfb2af9d5374cf7b6c8e52 Mon Sep 17 00:00:00 2001 From: "382696293@qq.com" <382696293@qq.com> Date: Wed, 27 Mar 2024 15:20:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?IOT=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=BB=8B=E7=BB=8D=20bug=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flossom-ui/src/views/system/instrument/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flossom-ui/src/views/system/instrument/index.vue b/flossom-ui/src/views/system/instrument/index.vue index 687a51d..13fa1eb 100644 --- a/flossom-ui/src/views/system/instrument/index.vue +++ b/flossom-ui/src/views/system/instrument/index.vue @@ -1977,7 +1977,7 @@ export default { this.form.iotVersionUpgrade ) // WE200IOT版本升级介绍 - this.form.iotVersionUpgrade = decodeURIComponent( + this.form.we200IotVersionUpgrade = decodeURIComponent( this.form.we200IotVersionUpgrade ) })