Merge branch 'feature-20240104' of https://gitee.com/yunqiang_technology/floatomcloud into feature-20240104

master
qsj 2 years ago
commit a3efaa7c97

@ -1,6 +1,7 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxMode;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -60,5 +61,5 @@ public interface WxModeMapper
*/
public int deleteWxModeByIds(Long[] ids);
List<WxMode> selectListByInstrumentId(Long instrumentId);
List<WxMode> selectListByInstrumentId(@Param("instrumentId") Long instrumentId, @Param("liningId") Long liningId);
}

@ -74,8 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
wx_mode mo
LEFT JOIN `wx_instrument_mode` imo ON imo.mode_id = mo.id
WHERE
imo.instrument_id = #{instrumentId}
<where>
<if test="instrumentId != null "> and imo.instrument_id = #{instrumentId}</if>
<if test="liningId != null "> and imo.lining_id = #{liningId}</if>
</where>
ORDER BY imo.mode_sort ASC
</select>

@ -134,8 +134,9 @@ public class WxInstrumentController extends BaseController {
* ID
*/
@GetMapping(value = "/modeInfoList")
public R modeInfo(@NotNull(message = "仪器ID不能为空") @RequestParam("instrumentId") Long instrumentId) {
return R.ok(wxInstrumentService.getInstrumentModeByInstrumentId(instrumentId));
public R modeInfo(@NotNull(message = "仪器ID不能为空") @RequestParam("instrumentId") Long instrumentId,
@RequestParam(value = "liningId", required = false) Long liningId) {
return R.ok(wxInstrumentService.getInstrumentModeByInstrumentId(instrumentId, liningId));
}
/**

@ -0,0 +1,31 @@
package com.flossom.miniProgram.controller;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.miniProgram.service.IWxLiningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
/**
* Controller
*/
@RestController
@RequestMapping("/lining")
public class WxLiningController extends BaseController {
@Autowired
private IWxLiningService wxLiningService;
/**
*
*/
@GetMapping("/list")
public R list(@RequestParam @NotNull(message = "仪器ID不能为空") Long instrumentId) {
return R.ok(wxLiningService.selectWxLiningList(instrumentId));
}
}

@ -25,7 +25,7 @@ public interface IWxInstrumentService {
List<WxInstrumentFileRelate> getInstrumentFileRelateByInstrumentId(Long instrumentId, Integer classify);
List<WxModeRet> getInstrumentModeByInstrumentId(Long instrumentId);
List<WxModeRet> getInstrumentModeByInstrumentId(Long instrumentId, Long liningId);
WxInstrumentSerial determineSerialIsSameInstrument(String serial, Long instrumentId);

@ -0,0 +1,20 @@
package com.flossom.miniProgram.service;
import com.flossom.common.core.domain.entity.WxLining;
import java.util.List;
/**
* Service
*/
public interface IWxLiningService {
/**
*
*
* @param wxLining
* @return
*/
public List<WxLining> selectWxLiningList(Long instrumentId);
}

@ -434,7 +434,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
}
@Override
public List<WxModeRet> getInstrumentModeByInstrumentId(Long instrumentId) {
public List<WxModeRet> getInstrumentModeByInstrumentId(Long instrumentId, Long liningId) {
// 用户拥有的标签
WxUserTag wxUserTag = new WxUserTag();
wxUserTag.setUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
@ -447,7 +447,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
}
// 查询仪器关联的所有模式
List<WxModeRet> wxModeRetList = new ArrayList<>();
List<WxMode> wxModeList = wxModeMapper.selectListByInstrumentId(instrumentId);
List<WxMode> wxModeList = wxModeMapper.selectListByInstrumentId(instrumentId, liningId);
for (WxMode wxMode : wxModeList) {
// 判断每个模式是否加锁
WxModeRet wxModeRet = new WxModeRet();

@ -0,0 +1,50 @@
package com.flossom.miniProgram.service.impl;
import com.flossom.common.core.domain.entity.WxInstrumentLining;
import com.flossom.common.core.domain.entity.WxLining;
import com.flossom.common.core.mapper.WxInstrumentLiningMapper;
import com.flossom.common.core.mapper.WxLiningMapper;
import com.flossom.miniProgram.service.IWxLiningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-03-26
*/
@Service
public class WxLiningServiceImpl implements IWxLiningService {
@Autowired
private WxLiningMapper wxLiningMapper;
@Autowired
private WxInstrumentLiningMapper wxInstrumentLiningMapper;
/**
*
*
* @param wxLining
* @return
*/
@Override
public List<WxLining> selectWxLiningList(Long instrumentId) {
WxInstrumentLining instrumentLiningQuery = new WxInstrumentLining();
instrumentLiningQuery.setInstrumentId(instrumentId);
List<WxInstrumentLining> wxInstrumentLiningList = wxInstrumentLiningMapper.selectWxInstrumentLiningList(instrumentLiningQuery);
if (wxInstrumentLiningList != null && wxInstrumentLiningList.size() > 0) {
List<WxLining> liningList = new ArrayList<>();
for (WxInstrumentLining wxInstrumentLining : wxInstrumentLiningList) {
liningList.add(wxLiningMapper.selectWxLiningById(wxInstrumentLining.getLiningId()));
}
return liningList;
}
return null;
}
}

@ -1,5 +1,6 @@
package com.flossom.system.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@ -109,6 +110,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
instrumentLiningQuery.setInstrumentId(id);
List<WxInstrumentLining> instrumentLiningList = wxInstrumentLiningMapper.selectWxInstrumentLiningList(instrumentLiningQuery);
if (instrumentLiningList != null) {
List<WxLining> liningList = new ArrayList<>();
for (WxInstrumentLining wxInstrumentLining : instrumentLiningList) {
Long liningId = wxInstrumentLining.getLiningId();
WxLining wxLining = wxLiningMapper.selectWxLiningById(liningId);
@ -127,8 +129,10 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
.map(Long::intValue)
.collect(Collectors.toList())
);
liningList.add(wxLining);
}
}
wxInstrumentSaveReq.setWxLiningList(liningList);
}
}
return wxInstrumentSaveReq;
@ -280,22 +284,13 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
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<Integer> 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);
if (wxLining.getNewModeIdList() != null && wxLining.getNewModeIdList().size() > 0) {
if (wxLining.getNewModeIdList().contains(modeList.get(i))) {
wxInstrumentMode.setIsNew(1);
}
}else {
wxInstrumentMode.setIsNew(0);
}
wxInstrumentMode.setLiningId(liningId);
wxInstrumentMode.setStatus(Status.OK.getCode());
wxInstrumentMode.setCreateBy(SecurityUtils.getUsername());
@ -435,22 +430,13 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
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<Integer> 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(newModeIdList.get(i).longValue());
wxInstrumentMode.setModeSort(i);
wxInstrumentMode.setIsNew(1);
if (wxLining.getNewModeIdList() != null && wxLining.getNewModeIdList().size() > 0) {
if (wxLining.getNewModeIdList().contains(modeList.get(i))) {
wxInstrumentMode.setIsNew(1);
}
}else {
wxInstrumentMode.setIsNew(0);
}
wxInstrumentMode.setLiningId(liningId);
wxInstrumentMode.setStatus(Status.OK.getCode());
wxInstrumentMode.setCreateBy(SecurityUtils.getUsername());

Loading…
Cancel
Save