Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4c0fdd2fba
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.system.api;
|
||||
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.constant.ServiceNameConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
import com.bonus.system.api.domain.SysTcpMessage;
|
||||
import com.bonus.system.api.factory.RemoteFileFallbackFactory;
|
||||
import com.bonus.system.api.factory.RemoteTcpFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* TCP服务
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@FeignClient(contextId = "RemoteTcpService", value = ServiceNameConstants.TCP_SERVICE, fallbackFactory = RemoteTcpFallbackFactory.class)
|
||||
public interface RemoteTcpService {
|
||||
|
||||
@GetMapping(value = "/netty/setMessage")
|
||||
public R setMessage(@RequestBody SysTcpMessage sysTcpMessage, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 消息通知
|
||||
*/
|
||||
@Data
|
||||
public class SysTcpMessage {
|
||||
|
||||
private String devCode;
|
||||
|
||||
private float distance;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.system.api.factory;
|
||||
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.RemoteTcpService;
|
||||
import com.bonus.system.api.domain.SysTcpMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* tcp服务降级处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@Component
|
||||
public class RemoteTcpFallbackFactory implements FallbackFactory<RemoteTcpService> {
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteTcpFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteTcpService create(Throwable throwable) {
|
||||
log.error("tcp服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteTcpService() {
|
||||
@Override
|
||||
public R setMessage(SysTcpMessage sysTcpMessage, String source) {
|
||||
return R.fail("近电感应设备设置失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -2,3 +2,4 @@ com.bonus.system.api.factory.RemoteUserFallbackFactory
|
|||
com.bonus.system.api.factory.RemoteLogFallbackFactory
|
||||
com.bonus.system.api.factory.RemoteFileFallbackFactory
|
||||
com.bonus.system.api.factory.RemoteSourceFallbackFactory
|
||||
com.bonus.system.api.factory.RemoteTcpFallbackFactory
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@ public class BusinessConstants {
|
|||
*/
|
||||
public final static String JD = "elec_induction";
|
||||
public final static String DL = "电量";
|
||||
/**
|
||||
* 近电感应设备电量编码
|
||||
*/
|
||||
public final static String JD_DL = "dl_code";
|
||||
|
||||
/**
|
||||
* 管理员角色
|
||||
|
|
@ -142,7 +146,7 @@ public class BusinessConstants {
|
|||
public static final String PNG = "image/png";
|
||||
public static final String JPG = "image/jpg";
|
||||
|
||||
|
||||
public final static String SET_MSG = "配置成功";
|
||||
|
||||
public final static Integer CELL_1 = 1;
|
||||
public final static Integer CELL_2 = 2;
|
||||
|
|
|
|||
|
|
@ -22,4 +22,9 @@ public class ServiceNameConstants
|
|||
*/
|
||||
public static final String FILE_SERVICE = "bonus-file";
|
||||
|
||||
/**
|
||||
* tcp服务的serviceid
|
||||
*/
|
||||
public static final String TCP_SERVICE = "bonus-tcp";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,18 +23,19 @@ public class JdConfigVo {
|
|||
@NotNull(message = "设备ID不能为空")
|
||||
private Long devId;
|
||||
|
||||
@NotBlank(message = "设备编码不能为空")
|
||||
private String devCode;
|
||||
|
||||
@NotEmpty(message = "配置属性不能为空")
|
||||
private List<ConfigItems> configItems;
|
||||
|
||||
@Data
|
||||
public static class ConfigItems {
|
||||
/**线路属性*/
|
||||
@NotBlank(message = "线路属性不能为空", groups = {Query.class})
|
||||
private String configType;
|
||||
/**线路属性名称*/
|
||||
private String configTypeName;
|
||||
/**电压等级*/
|
||||
@NotBlank(message = "电压等级不能为空", groups = {Query.class})
|
||||
private String voltageLevel;
|
||||
/**电压等级名称*/
|
||||
private String voltageLevelName;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class DeviceExportVo {
|
|||
@Excel(name = "设备状态", width = 20.0,height = 15.0,orderNum = "4")
|
||||
private String deviceStatus;
|
||||
|
||||
@Excel(name = "领用人", width = 20.0,height = 15.0,orderNum = "5")
|
||||
@Excel(name = "设备使用人", width = 20.0,height = 15.0,orderNum = "5")
|
||||
private String lyName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package com.bonus.app.service.impl;
|
|||
import com.bonus.app.mapper.CraneMonitorMapper;
|
||||
import com.bonus.app.service.ICraneMonitorService;
|
||||
import com.bonus.common.core.constant.BusinessConstants;
|
||||
import com.bonus.common.core.constant.HttpStatus;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.entity.app.AppParamsDto;
|
||||
|
|
@ -10,6 +13,8 @@ import com.bonus.common.entity.app.vo.DevInfoVo;
|
|||
import com.bonus.common.entity.app.vo.DevWarnVo;
|
||||
import com.bonus.common.entity.app.vo.JdConfigVo;
|
||||
import com.bonus.common.security.utils.ValidatorsUtils;
|
||||
import com.bonus.system.api.RemoteTcpService;
|
||||
import com.bonus.system.api.domain.SysTcpMessage;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -18,10 +23,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @className:CraneMonitorServiceImpl
|
||||
|
|
@ -40,6 +42,9 @@ public class CraneMonitorServiceImpl implements ICraneMonitorService {
|
|||
@Resource(name = "ValidatorsUtils")
|
||||
private ValidatorsUtils validatorsUtils;
|
||||
|
||||
@Resource
|
||||
private RemoteTcpService remoteTcpService;
|
||||
|
||||
@Override
|
||||
public AjaxResult getDzWarnList(AppParamsDto dto) {
|
||||
List<DevInfoVo> list = new ArrayList<>();
|
||||
|
|
@ -105,8 +110,18 @@ public class CraneMonitorServiceImpl implements ICraneMonitorService {
|
|||
return AjaxResult.error(validResult);
|
||||
}
|
||||
}
|
||||
mapper.delJdConfig(vo);
|
||||
mapper.addJdConfigData(vo);
|
||||
SysTcpMessage sysTcpMessage = new SysTcpMessage();
|
||||
sysTcpMessage.setDevCode(vo.getDevCode());
|
||||
sysTcpMessage.setDistance(Float.parseFloat(configItems.get(0).getDistance()));
|
||||
R result = remoteTcpService.setMessage(sysTcpMessage, SecurityConstants.INNER);
|
||||
log.info("调用结果:code:{},msg:{}", result.getCode(),result.getMsg());
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS && Objects.equals(result.getMsg(), BusinessConstants.SET_MSG)) {
|
||||
mapper.delJdConfig(vo);
|
||||
mapper.addJdConfigData(vo);
|
||||
return AjaxResult.success(result.getMsg());
|
||||
} else {
|
||||
return AjaxResult.error(result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,10 @@ import com.bonus.common.core.text.Convert;
|
|||
import com.bonus.common.core.utils.ServletUtils;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.entity.app.vo.DevWarnVo;
|
||||
import com.bonus.common.entity.app.vo.JdConfigVo;
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.bracelet.vo.CheckConfigVo;
|
||||
import com.bonus.common.entity.bracelet.vo.EquipmentReqVo;
|
||||
import com.bonus.common.entity.bracelet.vo.WarnInfoVo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
|
|
@ -21,7 +20,6 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:ConsControlController
|
||||
|
|
@ -184,7 +182,11 @@ public class ConsControlController extends BaseController {
|
|||
*/
|
||||
@GetMapping("getJdWarnList")
|
||||
public AjaxResult getJdWarnList(BraceletParamsDto dto){
|
||||
return service.getJdWarnList(dto);
|
||||
Integer pageNum = Convert.toInt(ServletUtils.getParameter(BusinessConstants.PAGE_NUM), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter(BusinessConstants.PAGE_SIZE), 10);
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
PageInfo<DevWarnVo> pageInfo = service.getJdWarnList(dto);
|
||||
return AjaxResult.success(pageInfo.getList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -52,6 +52,16 @@ public interface DeviceMapper {
|
|||
*/
|
||||
DeviceVo isExist(DeviceVo vo);
|
||||
|
||||
/**
|
||||
* 判断设备编码是否存在
|
||||
*
|
||||
* @param vo
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2024/7/17 14:41
|
||||
*/
|
||||
DeviceVo isExistCode(DeviceVo vo);
|
||||
|
||||
/**
|
||||
* 新增时设备名称是否重复
|
||||
* @param vo
|
||||
|
|
@ -59,6 +69,13 @@ public interface DeviceMapper {
|
|||
*/
|
||||
DeviceVo isNameExist(DeviceVo vo);
|
||||
|
||||
/**
|
||||
* 新增时设备编码是否重复
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
DeviceVo isCodeExist(DeviceVo vo);
|
||||
|
||||
/**
|
||||
* 新增时级联编码是否重复
|
||||
* @param vo
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.bracelet.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.entity.app.vo.DevWarnVo;
|
||||
import com.bonus.common.entity.app.vo.JdConfigVo;
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.bracelet.vo.CheckConfigVo;
|
||||
|
|
@ -141,7 +142,7 @@ public interface IConsControlService {
|
|||
* @author cwchen
|
||||
* @date 2024/8/16 17:57
|
||||
*/
|
||||
AjaxResult getJdWarnList(BraceletParamsDto dto);
|
||||
PageInfo<DevWarnVo> getJdWarnList(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 查询近电感应设备
|
||||
|
|
|
|||
|
|
@ -48,25 +48,12 @@ public class BraceletServiceImpl implements IBraceletService {
|
|||
@Override
|
||||
public List<BraceletVo> getBraceletLists(BraceletVo data) {
|
||||
List<BraceletVo> list = new ArrayList<>();
|
||||
List<BraceletVo> listFilter = new ArrayList<>();
|
||||
try {
|
||||
list = braceletMapper.getBraceletLists(data);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getShPersonName()==null || list.get(i).getShPersonName().equals("")){
|
||||
list.get(i).setShStatus(1);
|
||||
}else{
|
||||
list.get(i).setShStatus(0);
|
||||
}
|
||||
}
|
||||
if(data.getShStatus()!=null){
|
||||
listFilter = list.stream().filter(bracelet -> data.getShStatus()==(bracelet.getShStatus())).collect(Collectors.toList());
|
||||
}else{
|
||||
listFilter = list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return listFilter;
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -120,27 +107,12 @@ public class BraceletServiceImpl implements IBraceletService {
|
|||
@Override
|
||||
public List<ShboxVo> getShboxallLists(ShboxVo data) {
|
||||
List<ShboxVo> list = new ArrayList<>();
|
||||
List<ShboxVo> listFilter = new ArrayList<>();
|
||||
try {
|
||||
list = braceletMapper.getShboxallLists(data);
|
||||
if(data.getShboxStatus()==null){
|
||||
listFilter = list;
|
||||
}else if(data.getShboxStatus()==0){
|
||||
listFilter = list.stream().filter(bracelet -> (bracelet.getLyName()!=null && (!bracelet.getLyName().equals("")))).collect(Collectors.toList());
|
||||
}else {
|
||||
listFilter = list.stream().filter(bracelet -> (bracelet.getLyName()==null || bracelet.getLyName().equals(""))).collect(Collectors.toList());
|
||||
}
|
||||
for (int i = 0; i < listFilter.size(); i++) {
|
||||
if(listFilter.get(i).getLyName()==null || listFilter.get(i).getLyName().equals("")){
|
||||
listFilter.get(i).setShboxStatus(1);
|
||||
}else{
|
||||
listFilter.get(i).setShboxStatus(0);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return listFilter;
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ import com.bonus.common.core.utils.BuildTreeUtil;
|
|||
import com.bonus.common.entity.bracelet.vo.*;
|
||||
import com.bonus.common.security.utils.ValidatorsUtils;
|
||||
import com.bonus.system.api.RemoteFileService;
|
||||
import com.bonus.system.api.RemoteTcpService;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
import com.bonus.system.api.domain.SysTcpMessage;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -56,6 +58,9 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
@Resource(name = "ValidatorsUtils")
|
||||
private ValidatorsUtils validatorsUtils;
|
||||
|
||||
@Resource
|
||||
private RemoteTcpService remoteTcpService;
|
||||
|
||||
@Override
|
||||
public AjaxResult getBallDeviceLists(BraceletParamsDto dto) {
|
||||
JSONArray resultTree = new JSONArray();
|
||||
|
|
@ -206,22 +211,6 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
return AjaxResult.success(resultTree);
|
||||
}
|
||||
|
||||
public PersonTreeVo pruneTree(PersonTreeVo root) {
|
||||
if (root == null) {
|
||||
return null;
|
||||
}
|
||||
List<PersonTreeVo> nonEmptyChildren = new ArrayList<>();
|
||||
for (PersonTreeVo child : root.getChildren()) {
|
||||
PersonTreeVo prunedChild = pruneTree(child);
|
||||
if (prunedChild != null) {
|
||||
nonEmptyChildren.add(prunedChild);
|
||||
}
|
||||
}
|
||||
root.setChildren(nonEmptyChildren);
|
||||
|
||||
return root.getChildren().isEmpty() ? null : root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getWorkInfo(BraceletParamsDto dto) {
|
||||
Map<String, Object> mapData = new HashMap<>();
|
||||
|
|
@ -537,7 +526,7 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getJdWarnList(BraceletParamsDto dto) {
|
||||
public PageInfo<DevWarnVo> getJdWarnList(BraceletParamsDto dto) {
|
||||
List<DevWarnVo> list = new ArrayList<>();
|
||||
try {
|
||||
dto.setDevType(BusinessConstants.JD);
|
||||
|
|
@ -548,7 +537,8 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
PageInfo<DevWarnVo> pageInfo = new PageInfo<>(list);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -558,7 +548,7 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
dto.setDevType(BusinessConstants.JD);
|
||||
list = mapper.getJdList(dto);
|
||||
for (DevInfoVo vo : list) {
|
||||
String electricQuantity = mapper.getElectricQuantity(vo.getDevId(), BusinessConstants.DL);
|
||||
String electricQuantity = mapper.getElectricQuantity(vo.getDevId(), BusinessConstants.JD_DL);
|
||||
if (StringUtils.isNotBlank(electricQuantity) && isNumeric(electricQuantity)) {
|
||||
vo.setElectricQuantity(electricQuantity);
|
||||
} else {
|
||||
|
|
@ -591,8 +581,18 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
return AjaxResult.error(validResult);
|
||||
}
|
||||
}
|
||||
mapper.delJdConfig(vo);
|
||||
mapper.addJdConfigData(vo);
|
||||
SysTcpMessage sysTcpMessage = new SysTcpMessage();
|
||||
sysTcpMessage.setDevCode(vo.getDevCode());
|
||||
sysTcpMessage.setDistance(Float.parseFloat(configItems.get(0).getDistance()));
|
||||
R result = remoteTcpService.setMessage(sysTcpMessage, SecurityConstants.INNER);
|
||||
log.info("调用结果:code:{},msg:{}", result.getCode(),result.getMsg());
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS && Objects.equals(result.getMsg(), BusinessConstants.SET_MSG)) {
|
||||
mapper.delJdConfig(vo);
|
||||
mapper.addJdConfigData(vo);
|
||||
return AjaxResult.success(result.getMsg());
|
||||
} else {
|
||||
return AjaxResult.error(result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,25 +51,13 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
@Override
|
||||
public List<DeviceVo> getDeviceLists(DeviceVo data) {
|
||||
List<DeviceVo> list = new ArrayList<>();
|
||||
List<DeviceVo> listFilter = new ArrayList<>();
|
||||
try {
|
||||
list = deviceMapper.getDeviceLists(data);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getLyName()==null || list.get(i).getLyName().equals("")){
|
||||
list.get(i).setDeviceStatus(1);
|
||||
}else{
|
||||
list.get(i).setDeviceStatus(0);
|
||||
}
|
||||
}
|
||||
if(data.getDeviceStatus()!=null){
|
||||
listFilter = list.stream().filter(device -> data.getDeviceStatus()==(device.getDeviceStatus())).collect(Collectors.toList());
|
||||
}else{
|
||||
listFilter = list;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return listFilter;
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -102,6 +90,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
if (result != null) {
|
||||
return AjaxResult.error("设备名称已存在");
|
||||
}
|
||||
DeviceVo resultTwo = deviceMapper.isCodeExist(vo);
|
||||
if (resultTwo != null) {
|
||||
return AjaxResult.error("设备编码已存在");
|
||||
}
|
||||
int num = deviceMapper.addDevice(vo);
|
||||
int numly = deviceMapper.getDeviceLy(vo.getDeviceId());
|
||||
if(numly==0){
|
||||
|
|
@ -224,6 +216,11 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
return AjaxResult.error("设备名称已存在");
|
||||
}
|
||||
|
||||
DeviceVo resultTwo = deviceMapper.isExistCode(vo);
|
||||
if (resultTwo != null) {
|
||||
return AjaxResult.error("设备编码已存在");
|
||||
}
|
||||
|
||||
int num = deviceMapper.updateDevice(vo);
|
||||
if(num==1){
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.bonus.bracelet.mapper.BraceletMapper">
|
||||
<!--手环列表-->
|
||||
<select id="getBraceletLists" resultType="com.bonus.common.entity.bracelet.vo.BraceletVo">
|
||||
select * from (
|
||||
select tb.id as shId,tb.sh_code as shCode,
|
||||
case
|
||||
WHEN tb.peopel_type=0 then tpe.name
|
||||
|
|
@ -12,6 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ELSE ''
|
||||
END AS shPersonName,
|
||||
case
|
||||
WHEN (tb.peopel_type=0 and (tpe.name is not null and tpe.name!='')) then tb.sh_status=0 and tb.sh_status
|
||||
WHEN (tb.peopel_type=1 and (tlu.name is not null and tlu.name!='')) then tb.sh_status=0 and tb.sh_status
|
||||
ELSE 1
|
||||
END AS shStatus,
|
||||
case
|
||||
WHEN (tsb.box_name is null or tsb.box_name='') then '未绑定'
|
||||
WHEN (tsb.box_name is not null and tsb.box_name!='') then tsb.box_name
|
||||
ELSE '未绑定'
|
||||
|
|
@ -22,19 +28,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join tb_people tpe on tb.bid_id=tpe.id and tb.peopel_type=0
|
||||
left join tb_ls_user tlu on tb.bid_id=tlu.id and tb.peopel_type=1
|
||||
where tb.del_flag = 0
|
||||
<if test="shCode != null and shCode!=''">
|
||||
AND INSTR(tb.sh_code,#{shCode}) > 0
|
||||
</if>
|
||||
<if test="shboxName != null and shboxName!='' and shboxName != '未绑定'">
|
||||
AND INSTR(tsb.box_name,#{shboxName}) > 0
|
||||
</if>
|
||||
<if test="shboxName == '未绑定'">
|
||||
AND (tsb.box_name is null or tsb.box_name='')
|
||||
</if>
|
||||
<if test="shPersonName != null and shPersonName!=''">
|
||||
AND (tpe.name=#{shPersonName} or tlu.name=#{shPersonName})
|
||||
</if>
|
||||
order by tb.id ASC
|
||||
) a
|
||||
<where>
|
||||
<if test="shCode != null and shCode!=''">
|
||||
AND INSTR(a.shCode,#{shCode}) > 0
|
||||
</if>
|
||||
<if test="shboxName != null and shboxName!='' and shboxName != '未绑定'">
|
||||
AND INSTR(a.shboxName,#{shboxName}) > 0
|
||||
</if>
|
||||
<if test="shboxName == '未绑定'">
|
||||
AND (a.shboxName is null or a.shboxName='')
|
||||
</if>
|
||||
<if test="shStatus != null">
|
||||
AND a.shStatus = #{shStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by a.shId ASC
|
||||
</select>
|
||||
|
||||
<!--手环箱绑定手环列表-->
|
||||
|
|
@ -95,20 +107,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!--手环箱管理页面手环箱列表-->
|
||||
<select id="getShboxallLists" resultType="com.bonus.common.entity.bracelet.vo.ShboxVo">
|
||||
select * from (
|
||||
select tsb.id as shboxId,tsb.box_code as shboxCode,tsb.box_name as shboxName,count(tb.id) as shboxBindNum,
|
||||
tsb.box_capacity as shboxCapacity,twt.team_leader as lyName
|
||||
tsb.box_capacity as shboxCapacity,twt.team_leader as lyName,
|
||||
case
|
||||
when twt.team_leader is not null and twt.team_leader != '' then tsb.team_id = 0 and tsb.team_id
|
||||
else 1
|
||||
end as shboxStatus
|
||||
from tb_sh_box tsb
|
||||
left join t_work_team twt on tsb.team_id = twt.team_id and twt.del_flag = 0
|
||||
left join tb_bracelet tb on tsb.id = tb.box_id and tb.del_flag = 0
|
||||
where tsb.del_flag = 0
|
||||
<if test="shboxName != null and shboxName!=''">
|
||||
AND INSTR(tsb.box_name,#{shboxName}) > 0
|
||||
</if>
|
||||
<if test="shboxCode != null and shboxCode!=''">
|
||||
AND INSTR(tsb.box_code,#{shboxCode}) > 0
|
||||
</if>
|
||||
group by tsb.id
|
||||
order by tsb.id ASC
|
||||
) a
|
||||
<where>
|
||||
<if test="shboxName != null and shboxName!=''">
|
||||
AND INSTR(a.shboxName,#{shboxName}) > 0
|
||||
</if>
|
||||
<if test="shboxCode != null and shboxCode!=''">
|
||||
AND INSTR(a.shboxCode,#{shboxCode}) > 0
|
||||
</if>
|
||||
<if test="shboxStatus != null">
|
||||
AND a.shboxStatus = #{shboxStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by a.shboxId ASC
|
||||
</select>
|
||||
|
||||
<!--手环绑定选择列表-->
|
||||
|
|
|
|||
|
|
@ -5,29 +5,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.bonus.bracelet.mapper.DeviceMapper">
|
||||
<!--设备列表-->
|
||||
<select id="getDeviceLists" resultType="com.bonus.common.entity.bracelet.vo.DeviceVo">
|
||||
select * from (
|
||||
select td.id as deviceId,td.dev_type as deviceType,td.dev_name as deviceName,td.dev_code as deviceCode,
|
||||
tdl.ly_user as lyId,tdl.user_type as lyType,tdd.dict_label AS deviceTypeName,td.dev_index as deviceIndex,
|
||||
case
|
||||
WHEN tdl.user_type=0 then tpe.name
|
||||
WHEN tdl.user_type=1 then tlu.name
|
||||
ELSE ''
|
||||
END AS lyName
|
||||
END AS lyName,
|
||||
case
|
||||
WHEN (tdl.user_type=0 and (tpe.name is not null and tpe.name!='')) then td.dev_status=0 and td.dev_status
|
||||
WHEN (tdl.user_type=1 and (tlu.name is not null and tlu.name!='')) then td.dev_status=0 and td.dev_status
|
||||
ELSE 1
|
||||
END AS deviceStatus
|
||||
from tb_device td
|
||||
left join sys_dict_data tdd on tdd.dict_value=td.dev_type AND tdd.dict_type='sys_device_type'
|
||||
left join tb_dev_ly tdl on td.id = tdl.dev_id
|
||||
left join tb_people tpe on tdl.ly_user=tpe.id and tdl.user_type=0
|
||||
left join tb_ls_user tlu on tdl.ly_user=tlu.id and tdl.user_type=1
|
||||
where td.del_flag = 0
|
||||
) a
|
||||
<where>
|
||||
<if test="deviceType != null and deviceType!=''">
|
||||
AND INSTR(td.dev_type,#{deviceType}) > 0
|
||||
AND INSTR(a.deviceType,#{deviceType}) > 0
|
||||
</if>
|
||||
<if test="deviceName != null and deviceName!=''">
|
||||
AND INSTR(td.dev_name,#{deviceName}) > 0
|
||||
AND INSTR(a.deviceName,#{deviceName}) > 0
|
||||
</if>
|
||||
<if test="deviceCode != null and deviceCode!=''">
|
||||
AND INSTR(td.dev_code,#{deviceCode}) > 0
|
||||
AND INSTR(a.deviceCode,#{deviceCode}) > 0
|
||||
</if>
|
||||
order by td.id ASC
|
||||
<if test="deviceStatus != null ">
|
||||
AND a.deviceStatus = #{deviceStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by a.deviceId ASC
|
||||
</select>
|
||||
|
||||
<!--获取人员管理表中领用人名称-->
|
||||
|
|
@ -60,6 +72,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where td.dev_name = #{deviceName} and td.id != #{deviceId} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--判断设备编码是否存在-->
|
||||
<select id="isExistCode" resultType="com.bonus.common.entity.bracelet.vo.DeviceVo">
|
||||
select td.id as deviceId,td.dev_type as deviceType,td.dev_name as deviceName,td.dev_code as deviceCode,td.dev_status as deviceStatus
|
||||
from tb_device td
|
||||
where td.dev_code = #{deviceCode} and td.id != #{deviceId} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<update id="updateDevice">
|
||||
UPDATE tb_device td
|
||||
SET dev_type = #{deviceType},dev_name = #{deviceName},dev_code = #{deviceCode},dev_index = #{deviceIndex},update_time = #{updateTime},update_user = #{updateUser}
|
||||
|
|
@ -73,6 +92,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where td.dev_name = #{deviceName} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--判断新增时设备编码是否存在-->
|
||||
<select id="isCodeExist" resultType="com.bonus.common.entity.bracelet.vo.DeviceVo">
|
||||
select td.id as deviceId,td.dev_type as deviceType,td.dev_name as deviceName,td.dev_code as deviceCode,td.dev_status as deviceStatus
|
||||
from tb_device td
|
||||
where td.dev_code = #{deviceCode} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--判断新增时设备领用表是否存在-->
|
||||
<select id="getDeviceLy" resultType="java.lang.Integer">
|
||||
select count(dev_id) as count
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ public class BootNettyController {
|
|||
|
||||
@Autowired
|
||||
BootNettyServer nettyServer;
|
||||
@GetMapping("/setMessage")
|
||||
public AjaxResult setMessage(TcpMessage message) {
|
||||
@PostMapping("/setMessage")
|
||||
public AjaxResult setMessage(@RequestBody TcpMessage message) {
|
||||
try{
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
if(StringUtils.isEmpty(message.getDevCode())){
|
||||
|
|
|
|||
Loading…
Reference in New Issue