大屏
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.member.controller.admin.screen;
|
package cn.iocoder.yudao.module.member.controller.admin.screen;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
@ -36,6 +37,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@ -170,9 +172,24 @@ public class ScreenController {
|
|||||||
@Operation(summary = "设备数据")
|
@Operation(summary = "设备数据")
|
||||||
@PermitAll
|
@PermitAll
|
||||||
public CommonResult<List<DeviceInfo>> getDeviceInfo(Long storeId) {
|
public CommonResult<List<DeviceInfo>> getDeviceInfo(Long storeId) {
|
||||||
return success(deviceWarnService.getDeviceInfo(storeId));
|
List<DeviceInfo> deviceInfo = deviceWarnService.getDeviceInfo(storeId);
|
||||||
|
for (DeviceInfo info : deviceInfo) {
|
||||||
|
info.setDiff(info.getTotalWeight().subtract(info.getRemWeight()));
|
||||||
|
}
|
||||||
|
return success(deviceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/warnDish")
|
||||||
|
@Operation(summary = "告警菜品")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<List<DeviceInfo>> getWarnDish(Long storeId) {
|
||||||
|
List<DeviceInfo> deviceInfo = deviceWarnService.getDeviceInfo(storeId);
|
||||||
|
if(CollectionUtil.isNotEmpty(deviceInfo)){
|
||||||
|
deviceInfo = deviceInfo.stream().filter(deviceInfo1 ->
|
||||||
|
deviceInfo1.getRemWeight().compareTo(deviceInfo1.getFirstWeight().multiply(new BigDecimal("0.2")))<0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return success(deviceInfo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,7 @@ public class DeviceInfo {
|
|||||||
|
|
||||||
@Schema(description = "余量")
|
@Schema(description = "余量")
|
||||||
private BigDecimal remWeight;
|
private BigDecimal remWeight;
|
||||||
|
|
||||||
|
@Schema(description = "第一次绑定量")
|
||||||
|
private BigDecimal firstWeight;
|
||||||
}
|
}
|
||||||
|
@ -52,4 +52,14 @@ public class StoreGoodsDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String equipmentCode;
|
private String equipmentCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存
|
||||||
|
*/
|
||||||
|
private Integer inventory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String img;
|
||||||
|
|
||||||
}
|
}
|
@ -31,9 +31,9 @@ public interface DeviceWarnMapper extends BaseMapperX<DeviceWarnDO> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Select("select di.device_name, ds.dishes_name, ds.dishes_sum_price, dn.total_weight, dn.diff, dn.rem_weight\n" +
|
@Select("select di.device_name, ds.dishes_name, ds.dishes_sum_price, dn.total_weight, dn.diff, dn.rem_weight, dn.first_weight\n" +
|
||||||
"from t_device_info di\n" +
|
"from t_device_info di\n" +
|
||||||
" left join (select d.device_sn, d.rem_weight, d.diff, d.total_weight, d.dishes_id\n" +
|
" left join (select d.device_sn, d.rem_weight, d.diff, d.total_weight, d.dishes_id, d.first_weight\n" +
|
||||||
" from t_devuce d\n" +
|
" from t_devuce d\n" +
|
||||||
" where d.bind = true\n" +
|
" where d.bind = true\n" +
|
||||||
" and d.deleted = false) dn\n" +
|
" and d.deleted = false) dn\n" +
|
||||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.member.controller.admin.group.vo.MemberGroupPageV
|
|||||||
import cn.iocoder.yudao.module.member.controller.admin.group.vo.MemberGroupUserVo;
|
import cn.iocoder.yudao.module.member.controller.admin.group.vo.MemberGroupUserVo;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.group.MemberGroupDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.group.MemberGroupDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
import org.apache.ibatis.annotations.MapKey;
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -54,4 +55,7 @@ public interface MemberGroupMapper extends BaseMapperX<MemberGroupDO> {
|
|||||||
Map<Long,String> selectAllUserGroupName();
|
Map<Long,String> selectAllUserGroupName();
|
||||||
|
|
||||||
List<MemberGroupUserVo> getGroupList(List<Long> list);
|
List<MemberGroupUserVo> getGroupList(List<Long> list);
|
||||||
|
|
||||||
|
@Delete("delete from member_group_member where group_id = #{groupId}")
|
||||||
|
void deleteAssociation(Long groupId);
|
||||||
}
|
}
|
||||||
|
@ -383,6 +383,6 @@ public class BusinessServiceImpl implements BusinessService {
|
|||||||
List<BusinessDO> businessDOS = businessMapper.selectList(Wrappers.<BusinessDO>lambdaQuery()
|
List<BusinessDO> businessDOS = businessMapper.selectList(Wrappers.<BusinessDO>lambdaQuery()
|
||||||
.between(BusinessDO::getCreateTime, startOfDay, endOfDay)
|
.between(BusinessDO::getCreateTime, startOfDay, endOfDay)
|
||||||
.eq(BusinessDO::getCarteenId, carteenId));
|
.eq(BusinessDO::getCarteenId, carteenId));
|
||||||
return businessDOS.get(0);
|
return CollectionUtil.isNotEmpty(businessDOS)?businessDOS.get(0):new BusinessDO();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -73,7 +73,9 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
validateGroupExists(id);
|
validateGroupExists(id);
|
||||||
// 校验分组下是否有用户
|
// 校验分组下是否有用户
|
||||||
validateGroupHasUser(id);
|
// validateGroupHasUser(id);
|
||||||
|
//把分组下的用户群解放
|
||||||
|
memberGroupMapper.deleteAssociation(id);
|
||||||
// 删除
|
// 删除
|
||||||
memberGroupMapper.deleteById(id);
|
memberGroupMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.annotation.security.PermitAll;
|
import javax.annotation.security.PermitAll;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -132,6 +133,14 @@ public class AppDevuceController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/addWeight")
|
||||||
|
@Operation(summary = "增加菜品总量")
|
||||||
|
public CommonResult<Boolean> addWeight(BigDecimal addWeight) {
|
||||||
|
devuceService.addWeight(addWeight);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/alive")
|
@GetMapping("/alive")
|
||||||
@Operation(summary = "在线检测")
|
@Operation(summary = "在线检测")
|
||||||
public void alive() {
|
public void alive() {
|
||||||
|
@ -55,4 +55,6 @@ public class DevuceDO extends BaseDO {
|
|||||||
* 菜品剩余重量
|
* 菜品剩余重量
|
||||||
*/
|
*/
|
||||||
private BigDecimal remWeight;
|
private BigDecimal remWeight;
|
||||||
|
|
||||||
|
private BigDecimal firstWeight;
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.dishes.DishesDO;
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dishestype.DishesTypeDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dishestype.DishesTypeDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -90,6 +91,10 @@ public interface DevuceService {
|
|||||||
List<Map> getDishesNutrition(Long dishesId,String cId);
|
List<Map> getDishesNutrition(Long dishesId,String cId);
|
||||||
|
|
||||||
void updateWeight(DevuceReqVO updateReqVO);
|
void updateWeight(DevuceReqVO updateReqVO);
|
||||||
|
|
||||||
|
void addWeight(BigDecimal addWeight);
|
||||||
|
|
||||||
|
|
||||||
List<DevuceListVO> getList(Long storeId);
|
List<DevuceListVO> getList(Long storeId);
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -278,10 +279,25 @@ public class DevuceServiceImpl implements DevuceService {
|
|||||||
devuceMapper.update(new DevuceDO(),new LambdaUpdateWrapper<DevuceDO>()
|
devuceMapper.update(new DevuceDO(),new LambdaUpdateWrapper<DevuceDO>()
|
||||||
.set(updateReqVO.getRemWeight()!=null,DevuceDO::getRemWeight,updateReqVO.getRemWeight())
|
.set(updateReqVO.getRemWeight()!=null,DevuceDO::getRemWeight,updateReqVO.getRemWeight())
|
||||||
.set(updateReqVO.getTotalWeight()!=null,DevuceDO::getTotalWeight,updateReqVO.getTotalWeight())
|
.set(updateReqVO.getTotalWeight()!=null,DevuceDO::getTotalWeight,updateReqVO.getTotalWeight())
|
||||||
|
.set(updateReqVO.getTotalWeight()!=null,DevuceDO::getFirstWeight,updateReqVO.getTotalWeight())
|
||||||
.eq(DevuceDO::getDeviceSn,hearder)
|
.eq(DevuceDO::getDeviceSn,hearder)
|
||||||
.eq(DevuceDO::getBind,true));
|
.eq(DevuceDO::getBind,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWeight(BigDecimal addWeight) {
|
||||||
|
String hearder = this.getHearder();
|
||||||
|
List<DevuceDO> devuceDOS = devuceMapper.selectList(Wrappers.<DevuceDO>lambdaQuery()
|
||||||
|
.eq(DevuceDO::getDeviceSn, hearder)
|
||||||
|
.eq(DevuceDO::getBind, true));
|
||||||
|
if(CollectionUtil.isEmpty(devuceDOS)){
|
||||||
|
DevuceDO devuceDO = devuceDOS.get(0);
|
||||||
|
devuceDO.setTotalWeight(devuceDO.getTotalWeight().add(addWeight));
|
||||||
|
devuceDO.setRemWeight(devuceDO.getRemWeight().add(addWeight));
|
||||||
|
devuceMapper.updateById(devuceDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DevuceListVO> getList(Long storeId) {
|
public List<DevuceListVO> getList(Long storeId) {
|
||||||
ArrayList<DevuceListVO> devuceListVOS = new ArrayList<>();
|
ArrayList<DevuceListVO> devuceListVOS = new ArrayList<>();
|
||||||
|
Reference in New Issue
Block a user