食堂-双屏机接口
This commit is contained in:
parent
60517d329e
commit
90decda985
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.canteen.core.android.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.android.service.DeviceService;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Api(tags = "android-双屏消费机-设备信息")
|
||||
@RestController
|
||||
@RequestMapping("/api/android/device")
|
||||
public class DeviceController extends BaseController {
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
|
||||
|
||||
|
||||
@ApiOperation("获取设备信息")
|
||||
@RequestMapping("/getDeviceInfo")
|
||||
public AjaxResult getDeviceInfo(@RequestBody AppDTO dto) {
|
||||
if (ObjectUtil.isEmpty(dto.getDeviceSn())) {
|
||||
throw new ServiceException("设备sn不能为空");
|
||||
}
|
||||
return deviceService.getDeviceInfo(dto);
|
||||
}
|
||||
@ApiOperation("获取设备版本信息")
|
||||
@RequestMapping("/getAppVersion")
|
||||
public AjaxResult getAppVersion(@RequestBody AppDTO dto) {
|
||||
if (ObjectUtil.isEmpty(dto.getId())) {
|
||||
throw new ServiceException("Version不能为空");
|
||||
}
|
||||
return deviceService.getAppVersion(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取参数")
|
||||
@PostMapping(value = "/getParamInfo")
|
||||
public AjaxResult getInfo() {
|
||||
return success(deviceService.getParamInfo());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.bonus.canteen.core.android.controller;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.android.service.FaceService;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Api(tags = "android-双屏消费机-人脸特征值")
|
||||
@RestController
|
||||
@RequestMapping("/api/android/face")
|
||||
public class FaceController {
|
||||
@Autowired
|
||||
private FaceService faceService;
|
||||
|
||||
@ApiOperation("获取人脸特征值")
|
||||
@RequestMapping("/getFaceFeatureList")
|
||||
public AjaxResult getFaceFeatureList(@RequestBody AppDTO dto) {
|
||||
try {
|
||||
return faceService.getFaceFeatureList(dto);
|
||||
}catch (ServiceException e){
|
||||
return AjaxResult.error("获取人脸特征值失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.bonus.canteen.core.android.controller;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.android.service.UserService;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Api(tags = "android-双屏消费机-用户信息")
|
||||
@RestController
|
||||
@RequestMapping("/api/android/user")
|
||||
public class UserController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@ApiOperation("获取人员信息")
|
||||
@RequestMapping("/getUserInfo")
|
||||
public AjaxResult getUserInfo(@RequestBody AppDTO dto) {
|
||||
try {
|
||||
return userService.getUserInfo(dto);
|
||||
}catch (ServiceException e){
|
||||
return AjaxResult.error("获取人员信息失败!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.canteen.core.android.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Data
|
||||
public class AppDTO {
|
||||
|
||||
/**
|
||||
* 设备sn码
|
||||
*/
|
||||
private String deviceSn;
|
||||
|
||||
private String time;
|
||||
|
||||
private String type;
|
||||
|
||||
private String userId;
|
||||
private String id;
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.bonus.canteen.core.android.mapper;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.android.vo.AppVersionVo;
|
||||
import com.bonus.canteen.core.android.vo.DeviceInfoVo;
|
||||
import com.bonus.canteen.core.android.vo.ParamSettingVO;
|
||||
import com.bonus.canteen.core.android.vo.ParamVO;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 设备绑定多档口子Mapper接口
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
public interface DeviceMapper {
|
||||
/**
|
||||
* 查询设备信息
|
||||
*
|
||||
* @param dto
|
||||
* @return 设备绑定多档口子
|
||||
*/
|
||||
DeviceInfoVo getDeviceInfo(AppDTO dto);
|
||||
|
||||
/**
|
||||
* 查询设备版本信息
|
||||
*
|
||||
* @param dto 入参
|
||||
* @return 设备绑定多档口子
|
||||
*/
|
||||
AppVersionVo getAppVersion(AppDTO dto);
|
||||
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*
|
||||
* @return 参数
|
||||
*/
|
||||
List<ParamVO> getParamInfo();
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.canteen.core.android.mapper;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.user.domain.UserFace;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
public interface FaceMapper {
|
||||
/**
|
||||
* 获取人脸特征值
|
||||
*
|
||||
* @param dto 请求参数
|
||||
* @return 人脸特征值集合
|
||||
*/
|
||||
List<UserFace> getFaceFeatureList(AppDTO dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.canteen.core.android.mapper;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.android.vo.UserInfoVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
public interface UserMapper {
|
||||
/**
|
||||
* 获取人员信息
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<UserInfoVo> getUserInfo(AppDTO dto);
|
||||
/**
|
||||
* 获取人员钱包余额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<UserInfoVo> getMoneyList();
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.bonus.canteen.core.android.service;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.android.vo.ParamSettingVO;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
public interface DeviceService {
|
||||
/**
|
||||
* 获取设备信息
|
||||
*
|
||||
* @param dto 请求参数
|
||||
* @return 设备信息
|
||||
*/
|
||||
AjaxResult getDeviceInfo(AppDTO dto);
|
||||
|
||||
/**
|
||||
* 获取设备版本信息
|
||||
*
|
||||
* @param dto 请求参数
|
||||
* @return 设备版本信息
|
||||
*/
|
||||
AjaxResult getAppVersion(AppDTO dto);
|
||||
|
||||
/**
|
||||
* 获取参数信息
|
||||
*
|
||||
* @return 参数信息
|
||||
*/
|
||||
ParamSettingVO getParamInfo();
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.canteen.core.android.service;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
public interface FaceService {
|
||||
/**
|
||||
* 获取人脸特征值
|
||||
*
|
||||
* @param dto 请求参数
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult getFaceFeatureList(AppDTO dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.canteen.core.android.service;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
public interface UserService {
|
||||
/**
|
||||
* 获取人员信息
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getUserInfo(AppDTO dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package com.bonus.canteen.core.android.service.impl;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.android.mapper.DeviceMapper;
|
||||
import com.bonus.canteen.core.android.service.DeviceService;
|
||||
import com.bonus.canteen.core.android.vo.AppVersionVo;
|
||||
import com.bonus.canteen.core.android.vo.DeviceInfoVo;
|
||||
import com.bonus.canteen.core.android.vo.ParamSettingVO;
|
||||
import com.bonus.canteen.core.android.vo.ParamVO;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.houqin.constant.GlobalConstants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Service
|
||||
public class DeviceServiceImpl implements DeviceService {
|
||||
@Autowired
|
||||
private DeviceMapper mapper;
|
||||
|
||||
|
||||
@Value("${face.android.appId}")
|
||||
private String appId;
|
||||
@Value("${face.android.sdkKey}")
|
||||
private String appKey;
|
||||
|
||||
@Override
|
||||
public AjaxResult getDeviceInfo(AppDTO dto) {
|
||||
//判断设备是否存在
|
||||
DeviceInfoVo deviceInfoVo = mapper.getDeviceInfo(dto);
|
||||
if (deviceInfoVo == null) {
|
||||
return AjaxResult.error("设备不存在");
|
||||
}
|
||||
deviceInfoVo.setAppId(appId);
|
||||
deviceInfoVo.setAppKey(appKey);
|
||||
deviceInfoVo.setTenantId(String.valueOf(GlobalConstants.TENANT_ID));
|
||||
return AjaxResult.success(deviceInfoVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getAppVersion(AppDTO dto) {
|
||||
AppVersionVo appVersionVo = mapper.getAppVersion(dto);
|
||||
if (appVersionVo == null){
|
||||
return AjaxResult.success("无需更新");
|
||||
}
|
||||
return AjaxResult.success(appVersionVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParamSettingVO getParamInfo() {
|
||||
List<ParamVO> list = mapper.getParamInfo();
|
||||
ParamSettingVO paramSettingVO = new ParamSettingVO();
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (ParamVO vo : list) {
|
||||
String key = vo.getParamKey();
|
||||
String value = vo.getParamValue();
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
switch (vo.getParamKey()) {
|
||||
case "site_url":
|
||||
paramSettingVO.setIpAddress(value);
|
||||
break;
|
||||
case "face_pass_rate":
|
||||
paramSettingVO.setFacePassRate(value);
|
||||
break;
|
||||
case "mqtt_address":
|
||||
paramSettingVO.setMqttAddress(value);
|
||||
break;
|
||||
case "mqtt_user_name":
|
||||
paramSettingVO.setMqttUserName(value);
|
||||
break;
|
||||
case "mqtt_pass_word":
|
||||
paramSettingVO.setMqttPassword(value);
|
||||
break;
|
||||
case "app_id":
|
||||
paramSettingVO.setAppId(value);
|
||||
break;
|
||||
case "app_key":
|
||||
paramSettingVO.setAppKey(value);
|
||||
break;
|
||||
case "face_prefix":
|
||||
paramSettingVO.setPhotoPrefixes(value);
|
||||
break;
|
||||
case "version":
|
||||
paramSettingVO.setVersion(value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramSettingVO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.canteen.core.android.service.impl;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.android.mapper.FaceMapper;
|
||||
import com.bonus.canteen.core.android.service.FaceService;
|
||||
import com.bonus.canteen.core.user.domain.UserFace;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Service
|
||||
public class FaceServiceImpl implements FaceService {
|
||||
@Autowired
|
||||
private FaceMapper mapper;
|
||||
@Override
|
||||
public AjaxResult getFaceFeatureList(AppDTO dto) {
|
||||
List<UserFace> list = mapper.getFaceFeatureList(dto);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.bonus.canteen.core.android.service.impl;
|
||||
|
||||
import com.bonus.canteen.core.android.dto.AppDTO;
|
||||
import com.bonus.canteen.core.android.mapper.UserMapper;
|
||||
import com.bonus.canteen.core.android.service.UserService;
|
||||
import com.bonus.canteen.core.android.vo.UserInfoVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.houqin.utils.SM4EncryptUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
@Autowired
|
||||
private UserMapper mapper;
|
||||
|
||||
private static final int PHONE_LENGTH = 11;
|
||||
|
||||
@Override
|
||||
public AjaxResult getUserInfo(AppDTO dto) {
|
||||
List<UserInfoVo> list = mapper.getUserInfo(dto);
|
||||
if (list.isEmpty()) {
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
List<UserInfoVo> moneyList = mapper.getMoneyList();
|
||||
// 构建 userId 到 moneyVo 的映射,提升查找效率
|
||||
Map<String, UserInfoVo> moneyMap = moneyList.stream().collect(Collectors.toMap(UserInfoVo::getUserId, vo -> vo, (a, b) -> a));
|
||||
list.forEach(userInfoVo -> {
|
||||
if (userInfoVo.getPhone().length() > PHONE_LENGTH) {
|
||||
userInfoVo.setPhone(SM4EncryptUtils.sm4Decrypt(userInfoVo.getPhone()));
|
||||
}
|
||||
UserInfoVo money = moneyMap.get(userInfoVo.getUserId());
|
||||
if (money != null) {
|
||||
userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance());
|
||||
userInfoVo.setSubsidiesBalance(money.getSubsidiesBalance());
|
||||
}
|
||||
});
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.canteen.core.android.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Data
|
||||
public class AppVersionVo {
|
||||
|
||||
private String id;
|
||||
|
||||
private String version;
|
||||
|
||||
private String versionName;
|
||||
|
||||
private String apkName;
|
||||
|
||||
private String apkPath;
|
||||
|
||||
private String updateContent;
|
||||
|
||||
private String deployTime;
|
||||
|
||||
private String deployUser;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.canteen.core.android.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Data
|
||||
public class DeviceInfoVo {
|
||||
|
||||
private String tenantId;
|
||||
|
||||
private String appId;
|
||||
|
||||
private String appKey;
|
||||
|
||||
private String areaId;
|
||||
private String areaName;
|
||||
private String canteenId;
|
||||
private String stallId;
|
||||
private String canteenName;
|
||||
private String stallName;
|
||||
private String recipeId;
|
||||
private String deviceNum;
|
||||
private String deviceName;
|
||||
private String devicePwd;
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.canteen.core.android.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Data
|
||||
public class ParamSettingVO {
|
||||
@ApiModelProperty("参数id")
|
||||
private Integer id;
|
||||
@ApiModelProperty("IP地址")
|
||||
@NotBlank(message = "IP地址不能为空")
|
||||
private String ipAddress;
|
||||
@ApiModelProperty("人脸识别通过率")
|
||||
@NotBlank(message = "人脸识别通过率不能为空")
|
||||
private String facePassRate;
|
||||
@ApiModelProperty("MQTT地址")
|
||||
@NotBlank(message = "MQTT地址不能为空")
|
||||
private String mqttAddress;
|
||||
@ApiModelProperty("MQTT用户名")
|
||||
@NotBlank(message = "MQTT用户名不能为空")
|
||||
private String mqttUserName;
|
||||
@ApiModelProperty("MQTT密码")
|
||||
@NotBlank(message = "MQTT密码不能为空")
|
||||
private String mqttPassword;
|
||||
@ApiModelProperty("APP_ID")
|
||||
@NotBlank(message = "人脸引擎APP_ID不能为空")
|
||||
private String appId;
|
||||
@ApiModelProperty("APP_KEY")
|
||||
@NotBlank(message = "人脸引擎APP_KEY不能为空")
|
||||
private String appKey;
|
||||
@ApiModelProperty("PHOTO_PREFIXES")
|
||||
@NotBlank(message = "照片前缀不能为空")
|
||||
private String photoPrefixes;
|
||||
@ApiModelProperty("version")
|
||||
private String version;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.bonus.canteen.core.android.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Data
|
||||
public class ParamVO {
|
||||
private String paramKey;
|
||||
private String paramValue;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.canteen.core.android.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
public class UserInfoVo {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String userName;
|
||||
private String nickName;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String loginType;
|
||||
|
||||
private String accId;
|
||||
/**
|
||||
* 卡号
|
||||
*/
|
||||
private String cardNum;
|
||||
|
||||
/**
|
||||
* 序列号 物理卡号
|
||||
*/
|
||||
private String serialNum;
|
||||
|
||||
/**
|
||||
* 个人钱包余额
|
||||
*/
|
||||
private BigDecimal personalWalletBalance;
|
||||
|
||||
/**
|
||||
* 补贴余额
|
||||
*/
|
||||
private BigDecimal subsidiesBalance;
|
||||
|
||||
/**
|
||||
* 账户状态 1正常 2冻结 3销户
|
||||
*/
|
||||
private String accStatus;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.canteen.core.android.mapper.DeviceMapper">
|
||||
<select id="getDeviceInfo" resultType="com.bonus.canteen.core.android.vo.DeviceInfoVo">
|
||||
SELECT di.device_number AS deviceNum,
|
||||
di.device_name AS deviceName,
|
||||
dr.recipe_id AS recipeId,
|
||||
dr.recipe_name AS recipeName,
|
||||
CONCAT(aaa.area_name, '/', aa.area_name) AS areaName,
|
||||
aa.area_id AS areaId,
|
||||
ac.canteen_name AS canteenName,
|
||||
ac.canteen_id AS canteenId,
|
||||
ast.stall_name AS stallName,
|
||||
ast.stall_id AS stallId,
|
||||
di.device_pwd as devicePwd
|
||||
FROM device_info di
|
||||
LEFT JOIN device_bind db ON di.device_id = db.device_id
|
||||
left join basic_area aa on db.area_id = aa.area_id
|
||||
left join basic_area aaa on aaa.area_id = aa.parent_id
|
||||
LEFT JOIN basic_canteen ac ON db.canteen_id = ac.canteen_id
|
||||
LEFT JOIN basic_stall ast ON db.stall_id = ast.stall_id
|
||||
LEFT JOIN (SELECT dr.device_id, mr.recipe_name,mr.recipe_id
|
||||
FROM cook_recipe_bind_device dr
|
||||
LEFT JOIN cook_recipe mr ON dr.recipe_id = mr.recipe_id) dr
|
||||
ON di.device_id = dr.device_id
|
||||
where di.device_sn = #{deviceSn}
|
||||
GROUP BY di.device_id
|
||||
</select>
|
||||
<select id="getAppVersion" resultType="com.bonus.canteen.core.android.vo.AppVersionVo">
|
||||
select
|
||||
version as id,
|
||||
version as version,
|
||||
version_name as versionName,
|
||||
apk_name as apkName,
|
||||
apk_path as apkPath,
|
||||
update_content as updateContent,
|
||||
deploy_time as deployTime,
|
||||
deploy_user as deployUser
|
||||
from device_app_version
|
||||
where canteen_type = #{type} and version > #{id}
|
||||
</select>
|
||||
<select id="getParamInfo" resultType="com.bonus.canteen.core.android.vo.ParamVO">
|
||||
public int insertCookNutrition(CookNutrition cookNutrition) {
|
||||
cookNutrition.setCreateTime(DateUtils.getNowDate());
|
||||
try {
|
||||
if (StringUtils.isBlank(cookNutrition.getNutritionName())){
|
||||
throw new ServiceException("食材名称不能为空!");
|
||||
}
|
||||
if (StringUtils.isNull(cookNutrition.getNutritionTypeId()) || cookNutrition.getNutritionTypeId() == 0){
|
||||
throw new ServiceException("食材类别不能为空!");
|
||||
}
|
||||
if (cookNutritionMapper.checkIsExistByName(cookNutrition.getNutritionName(),null) > 0) {
|
||||
throw new ServiceException("该食材营养基础信息已存在!");
|
||||
}
|
||||
return cookNutritionMapper.insertCookNutrition(cookNutrition);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.canteen.core.android.mapper.FaceMapper">
|
||||
<select id="getFaceFeatureList" resultType="com.bonus.canteen.core.user.domain.UserFace">
|
||||
select
|
||||
user_id,
|
||||
photo_url,
|
||||
features,
|
||||
face_state
|
||||
from user_face
|
||||
<where>
|
||||
<if test="time != null and time != ''">
|
||||
and update_time >= #{time} - INTERVAL 5 SECOND;
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.canteen.core.android.mapper.UserMapper">
|
||||
<select id="getUserInfo" resultType="com.bonus.canteen.core.android.vo.UserInfoVo">
|
||||
select
|
||||
su.user_id as userId,
|
||||
su.user_name as userName,
|
||||
su.nick_name as nickName,
|
||||
ac.acc_id as accId,
|
||||
ac.card_num as cardNum,
|
||||
ac.serial_num as serialNum,
|
||||
ai.acc_status as accStatus,
|
||||
su.phonenumber as phone,
|
||||
su.login_type as loginType
|
||||
from sys_user su
|
||||
left join account_card ac on ac.user_id = su.user_id
|
||||
left join account_info ai on ai.user_id = su.user_id
|
||||
where ai.del_flag = '0'
|
||||
<if test="type == 'user'">
|
||||
<if test="time != null and time != ''">
|
||||
AND su.update_time >= #{time} - INTERVAL 5 SECOND;
|
||||
</if>
|
||||
</if>
|
||||
<if test="type == 'card'">
|
||||
<if test="time != null and time != ''">
|
||||
AND ac.update_time >= #{time} - INTERVAL 5 SECOND;
|
||||
</if>
|
||||
</if>
|
||||
<if test="userId != null and userId != '' and userId != 0 and userId != '0'">
|
||||
AND su.user_id = #{userId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getMoneyList" resultType="com.bonus.canteen.core.android.vo.UserInfoVo">
|
||||
SELECT
|
||||
sum(r.personalWalletBalance) as personalWalletBalance,
|
||||
sum(r.subsidiesBalance) as subsidiesBalance,
|
||||
r.user_id as userId
|
||||
from( select
|
||||
user_id,
|
||||
IF(wallet_id = 1,wallet_bal,0) as personalWalletBalance,
|
||||
IF(wallet_id = 2,wallet_bal,0) as subsidiesBalance,
|
||||
wallet_bal
|
||||
from account_wallet_info)r
|
||||
GROUP BY r.user_id
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue