Browse Source

重构国际化,系统模块部分开发3

master
caojianbin 8 months ago
parent
commit
faa4232667
  1. 46
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/api/ApiController.java
  2. 137
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/api/ApiOutwardController.java
  3. 7
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/ApiLastLocationInfo.java
  4. 23
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/ApiLocaltionDTO.java
  5. 67
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/ApiOutward.java
  6. 24
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/ApiOutwardPage.java
  7. 47
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/vo/ApiDeviceInfo.java
  8. 34
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/vo/ApiDeviceStep.java
  9. 34
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/vo/ApiDeviceTemp.java
  10. 41
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/ApiFirmMapper.java
  11. 16
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/ApiOutwardMapper.java
  12. 32
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/ApiFirmService.java
  13. 16
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/ApiOutwardService.java
  14. 131
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/ApiFirmServiceImpl.java
  15. 28
      ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/api/ApiFirmMapper.xml
  16. 25
      ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/api/ApiOutwardMapper.xml

46
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/api/ApiController.java

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
package com.ecell.internationalize.system.controller.api;
import com.ecell.internationalize.common.core.web.domain.R;
import com.ecell.internationalize.system.entity.api.LocationPO;
import com.ecell.internationalize.system.service.api.ApiFirmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api")
public class ApiController {
@Autowired
ApiFirmService apiFirmService;
/**
* 根据imei查询设备信息
* @param imei
* @return
*/
@GetMapping("/device/info/{imei}")
public R queryDeviceInfoByImei(@PathVariable(value = "imei") String imei){
return R.ok(apiFirmService.queryDeviceInfoByImei(imei),"操作成功");
}
/**
* 根据条件查询设备轨迹信息
* @param
* @return
*/
@PostMapping ("/device/locationList")
public R queryDeviceLocaltionList(@RequestBody LocationPO po){
return R.ok(apiFirmService.queryDeviceLocaltionList(po),"操作成功");
}
/**
* 下发刷新定位
* @param imei
* @return
*/
@GetMapping ("/device/getLocation/{imei}")
public R getDeviceLocaltion(@PathVariable(value = "imei") String imei){
return R.ok(apiFirmService.getDeviceLocaltion(imei),"操作成功");
}
}

137
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/api/ApiOutwardController.java

@ -0,0 +1,137 @@ @@ -0,0 +1,137 @@
package com.ecell.internationalize.system.controller.api;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ecell.internationalize.common.core.context.SecurityContextHolder;
import com.ecell.internationalize.common.core.utils.locale.LocaleUtil;
import com.ecell.internationalize.common.core.utils.uuid.UUID;
import com.ecell.internationalize.common.core.web.domain.AjaxResult;
import com.ecell.internationalize.common.core.web.domain.R;
import com.ecell.internationalize.common.redis.service.RedisService;
import com.ecell.internationalize.common.system.annotation.SystemLog;
import com.ecell.internationalize.common.system.constant.FieldConstant;
import com.ecell.internationalize.system.entity.FirmManage;
import com.ecell.internationalize.system.entity.api.ApiOutward;
import com.ecell.internationalize.system.entity.api.dto.ApiOutwardPage;
import com.ecell.internationalize.system.service.FirmManageService;
import com.ecell.internationalize.system.service.api.ApiOutwardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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;
import java.util.Date;
/**
* <p>
* API对外开放接口
* </p>
*
* @author ${author}
* @since 2023-03-07
*/
@RestController
@Api(value="API对外开放接口",tags={"API对外开放接口"})
@RequestMapping("/api_outward")
public class ApiOutwardController {
@Autowired
private ApiOutwardService apiOutwardService;
@Autowired
private RedisService redisService;
@Autowired
private FirmManageService firmManageService;
/**
* 条件分页查询
* @Author liy
* @Date 2022/7/14 16:38
* @param apiOutwardPage 分页条件查询体
* @Return AjaxResult
*/
@ApiOperation("APPID和APPKEY条件分页查询")
@PostMapping("api/list")
public R<IPage<ApiOutward>> queryAllByPage(@RequestBody ApiOutwardPage apiOutwardPage){
Page<ApiOutward> page=new Page<>(apiOutwardPage.getCurrent(),apiOutwardPage.getPageSize());
LambdaQueryWrapper<ApiOutward> lambdaQueryWrapper=new LambdaQueryWrapper<>();
lambdaQueryWrapper.orderByDesc(ApiOutward::getCreateTime);
IPage<ApiOutward> selectPage = apiOutwardService.getBaseMapper().selectPage(page, lambdaQueryWrapper);
if (null!=selectPage) {
for (ApiOutward apiOutward : selectPage.getRecords()) {
LambdaQueryWrapper<FirmManage> firm=new LambdaQueryWrapper<>();
//厂商
if (FieldConstant.MATH_ONE.equals(apiOutward.getFirmFlag())) {
firm.eq(FirmManage::getFirmId,apiOutward.getFirmId());
}
//代理商
if (FieldConstant.SECOND_FLAG.equals(apiOutward.getFirmFlag())) {
firm.eq(FirmManage::getParentId,apiOutward.getSecondFirmId());
}
FirmManage firmManage = firmManageService.getBaseMapper().selectOne(firm);
apiOutward.setFirmName(firmManage.getFirmName());
}
}
return R.ok(selectPage);
}
/**
* 新增
* @Author liy
* @Date 2023/3/7 16:38
* @param apiOutward API
* @Return AjaxResult
*/
@ApiOperation("生成APPid和APPkey")
@PostMapping("api/save")
public AjaxResult save(@RequestBody @ApiParam("API类") ApiOutward apiOutward) {
int appId = Integer.parseInt(String.valueOf(System.currentTimeMillis()).substring(0,10));
String appKey= UUID.fastUUID().toString(true);
apiOutward.setAppId(appId);
apiOutward.setAppKey(appKey);
apiOutward.setCreateTime(new Date());
apiOutward.setCreateUser(SecurityContextHolder.getUserName());
apiOutward.setId(UUID.fastUUID().toString(true));
apiOutward.setStatus(FieldConstant.OPERATOR_SUCCESS);
apiOutwardService.getBaseMapper().insert(apiOutward);
redisService.setCacheObject(appId+"_"+appKey, apiOutward);
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS));
}
/**
* 删除
* @Author liy
* @Date 2023/3/7 16:38
* @param apiOutward 实体类
* @Return AjaxResult
*/
@ApiOperation("删除APPid和APPkey")
@PostMapping("api/del")
public AjaxResult del(@RequestBody @ApiParam("API类") ApiOutward apiOutward){
System.out.println("删除之前redis中的数据:"+redisService.getCacheObject(apiOutward.getAppId()+"_"+apiOutward.getAppKey()));
apiOutwardService.getBaseMapper().deleteById(apiOutward);
redisService.deleteObject(apiOutward.getAppId()+"_"+apiOutward.getAppKey());
System.out.println("删除之后redis中的数据:"+redisService.getCacheObject(apiOutward.getAppId()+"_"+apiOutward.getAppKey()));
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS));
}
/**
* 修改状态
* @Author liy
* @Date 2023/3/8 16:38
* @param apiOutward 实体类
* @Return AjaxResult
*/
@ApiOperation("修改启用/禁用状态")
@SystemLog(msg =FieldConstant.ACTIVITY_BANNER_BANNER,operation = FieldConstant.ACTIVITY_BANNER_PUBLISH)
@PostMapping("api/changeStatus")
public AjaxResult changeStatusOrDelUser(@RequestBody @ApiParam(name="状态",value="传整个对象,修改其中status字段,(0:禁用,1:=启用)",required=true) ApiOutward apiOutward){
apiOutwardService.getBaseMapper().updateById(apiOutward);
redisService.setCacheObject(apiOutward.getAppId()+"_"+apiOutward.getAppKey(), apiOutward);
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS));
}
}

7
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/ApiLastLocationInfo.java

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
package com.ecell.internationalize.system.entity.api;
/**
* @author borui
*/
public class ApiLastLocationInfo {
}

23
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/ApiLocaltionDTO.java

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
package com.ecell.internationalize.system.entity.api;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author borui
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ApiLocaltionDTO<T> implements Serializable {
private static final long serialVersionUID=1L;
private Integer total;
private Integer pageTotal;
private Integer size;
private List<T> list;
}

67
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/ApiOutward.java

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
package com.ecell.internationalize.system.entity.api;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* API对外开放接口表
* </p>
*
* @author ${author}
* @since 2023-03-07
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ApiOutward对象", description="API对外开放接口表")
public class ApiOutward implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(example = "主键Id(新增不需要传)")
private String id;
@ApiModelProperty(example = "APPID")
private Integer appId;
@ApiModelProperty(example = "APPKEY")
private String appKey;
@ApiModelProperty(example = "状态(0:禁用 , 1:启用)")
private String status;
@ApiModelProperty(example = "厂商Id")
private String firmId;
@ApiModelProperty(example = "标识(1:厂商:2:代理商)")
private String firmFlag;
@ApiModelProperty(example = "代理商Id")
private String secondFirmId;
@ApiModelProperty(example = "创建人(新增不需要传)")
private String createUser;
@ApiModelProperty(example = "创建时间(新增不需要传)")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(example = "发起请求秒数(如一分钟多少次,单位为秒)")
private Integer second;
@ApiModelProperty(example = "发起请求次数(如多少分钟100次)")
private Integer frequency;
@ApiModelProperty(example = "厂商/代理商名称",hidden = true)
@TableField(exist = false)
private String firmName;
}

24
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/ApiOutwardPage.java

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
package com.ecell.internationalize.system.entity.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Title: ApiOutwardPage
* @Author: liy
* @Date: 2023/3/8 14:56
* @Description:
* @Version:1.0
*/
@Data
public class ApiOutwardPage {
// @ApiModelProperty(example = "厂商/代理商名称")
// private String firmName;
@ApiModelProperty(example = "每页展示的条数")
private Integer pageSize;
@ApiModelProperty(example = "当前的页码")
private Integer current;
}

47
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/vo/ApiDeviceInfo.java

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
package com.ecell.internationalize.system.entity.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 设备步数
* </p>
*
* @author liy
* @since 2022-07-11
*/
@Data
public class ApiDeviceInfo {
private static final long serialVersionUID=1L;
/**
* 日期
*/
@ApiModelProperty(example = "日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date date;
/**
* 手机号
*/
@ApiModelProperty(example = "手机号")
private String phone;
/**
* 姓名
*/
@ApiModelProperty(example = "姓名")
private String name;
/**
* 手机号
*/
@ApiModelProperty(example = "身份")
private String identity;
}

34
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/vo/ApiDeviceStep.java

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
package com.ecell.internationalize.system.entity.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 设备步数
* </p>
*
* @author liy
* @since 2022-07-11
*/
@Data
public class ApiDeviceStep {
private static final long serialVersionUID=1L;
/**
* 设备iMei
*/
@ApiModelProperty(example = "日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date date;
/**
* 姓名
*/
@ApiModelProperty(example = "步数")
private Integer num;
}

34
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/vo/ApiDeviceTemp.java

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
package com.ecell.internationalize.system.entity.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 设备步数
* </p>
*
* @author liy
* @since 2022-07-11
*/
@Data
public class ApiDeviceTemp {
private static final long serialVersionUID=1L;
/**
* 设备iMei
*/
@ApiModelProperty(example = "日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date date;
/**
* 姓名
*/
@ApiModelProperty(example = "步数")
private String data;
}

41
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/ApiFirmMapper.java

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
package com.ecell.internationalize.system.mapper.api;
import com.ecell.internationalize.system.entity.api.ApiLastLocationInfo;
import com.ecell.internationalize.system.entity.api.ApiTrackInfo;
import com.ecell.internationalize.system.entity.api.FirmDeviceInfo;
import com.ecell.internationalize.system.entity.api.LocationPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author borui
*/
public interface ApiFirmMapper {
/**
* 根据imei查询设备拥有者信息
* @param imei
* @return
*/
FirmDeviceInfo queryDeviceOwnerByImei(@Param("imei") String imei);
/**
* 根据imei查询最新位置信息
* @param imei
* @return
*/
ApiLastLocationInfo queryLastLocationInfoByImei(@Param("imei")String imei);
/**
* 查询轨迹总数
* @param po
* @return
*/
Integer queryDeviceLocaltionCount( @Param("po") LocationPO po);
/**
* 查询轨迹信息
* @param po
* @return
*/
List<ApiTrackInfo> queryDeviceLocaltionInfo(@Param("po") LocationPO po);
}

16
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/ApiOutwardMapper.java

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
package com.ecell.internationalize.system.mapper.api;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ecell.internationalize.system.entity.api.ApiOutward;
/**
* <p>
* API对外开放接口表 Mapper 接口
* </p>
*
* @author ${author}
* @since 2023-03-07
*/
public interface ApiOutwardMapper extends BaseMapper<ApiOutward> {
}

32
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/ApiFirmService.java

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
package com.ecell.internationalize.system.service.api;
import com.ecell.internationalize.system.entity.api.FirmDeviceInfo;
import com.ecell.internationalize.system.entity.api.LocationPO;
import java.util.Map;
/**
* @author borui
*/
public interface ApiFirmService {
/**
* 根据imei 查询设备信息
* @param imei
* @return
*/
FirmDeviceInfo queryDeviceInfoByImei(String imei);
/**
* 查询轨迹数据
* @param po
* @return
*/
Object queryDeviceLocaltionList(LocationPO po);
/**
*
* 获取位置
* @param imei
* @return
*/
Map<String, String> getDeviceLocaltion(String imei);
}

16
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/ApiOutwardService.java

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
package com.ecell.internationalize.system.service.api;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ecell.internationalize.system.entity.api.ApiOutward;
/**
* <p>
* API对外开放接口表 服务类
* </p>
*
* @author ${author}
* @since 2023-03-07
*/
public interface ApiOutwardService extends IService<ApiOutward> {
}

131
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/ApiFirmServiceImpl.java

@ -0,0 +1,131 @@ @@ -0,0 +1,131 @@
package com.ecell.internationalize.system.service.api.impl;
import com.ecell.internationalize.common.core.exception.ServiceException;
import com.ecell.internationalize.common.core.utils.StringUtils;
import com.ecell.internationalize.system.constant.DeviceModelConstants;
import com.ecell.internationalize.system.entity.api.*;
import com.ecell.internationalize.system.entity.dto.sendInstructionDTO;
import com.ecell.internationalize.system.mapper.api.ApiFirmMapper;
import com.ecell.internationalize.system.service.api.ApiFirmService;
import com.ecell.internationalize.system.service.impl.DeviceInfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @author borui
*/
@Service
public class ApiFirmServiceImpl implements ApiFirmService {
@Resource
private ApiFirmMapper apiFirmMapper;
@Autowired
private DeviceInfoServiceImpl deviceInfoService;
@Override
public FirmDeviceInfo queryDeviceInfoByImei(String imei) {
FirmDeviceInfo firmDeviceInfo = queryDeviceOwnerByImei(imei);
if (StringUtils.isNotNull(firmDeviceInfo)){
ApiLastLocationInfo apiLastLocationInfo = queryLastLocationInfoByImei(imei);
if (StringUtils.isNotNull(apiLastLocationInfo)){
firmDeviceInfo.setApiLastLocationInfo(apiLastLocationInfo);
}
}
return firmDeviceInfo;
}
/**
* 查询轨迹数据
* @param po
* @return
*/
@Override
public Object queryDeviceLocaltionList(LocationPO po) {
if (!StringUtils.isNotEmpty(po.getImei())||!StringUtils.isNotEmpty(po.getStartTime())||!StringUtils.isNotEmpty(po.getEndTime())){
throw new ServiceException("messages.parameter.error");
}
ApiLocaltionDTO<ApiTrackInfo> apiLocaltionDTO =new ApiLocaltionDTO<>();
if (po.getPage()<=0){
po.setPage(1);
}
if (po.getNum()<=0){
po.setNum(20);
}
int count = queryDeviceLocaltionCount(po);
if (count>0){
int pageCount = getPageCount(count, po.getNum());
int startTotal = (po.getPage()-1)*(po.getNum());
po.setStartTotal(startTotal);
//查询轨迹信息
apiLocaltionDTO.setSize(po.getNum());
apiLocaltionDTO.setPageTotal(pageCount);
apiLocaltionDTO.setTotal(count);
List<ApiTrackInfo> apiTrackInfos = queryDeviceLocaltionInfo(po);
apiLocaltionDTO.setList(apiTrackInfos);
}
return apiLocaltionDTO;
}
/**
* 下发指令获取位置信息
* @param imei
* @return
*/
@Override
public Map<String, String> getDeviceLocaltion(String imei) {
if (!StringUtils.isNotEmpty(imei)){
throw new ServiceException("messages.parameter.error");
}
sendInstructionDTO dto =new sendInstructionDTO();
dto.setImei(imei);
dto.setType(DeviceModelConstants.ONE);
Map<String, String> map = deviceInfoService.sendInstructions(dto);
return map;
}
/**
* 根据imei查询设备拥有者信息
*/
private FirmDeviceInfo queryDeviceOwnerByImei(String imei){
return apiFirmMapper.queryDeviceOwnerByImei(imei);
}
/**
* 根据imei查询位置体温心率最新信息
*/
private ApiLastLocationInfo queryLastLocationInfoByImei(String imei){
return apiFirmMapper.queryLastLocationInfoByImei(imei);
}
/**
* 查询轨迹总数
* @param po
* @return
*/
private int queryDeviceLocaltionCount(LocationPO po){
return apiFirmMapper.queryDeviceLocaltionCount(po);
}
/**
* 查询轨迹信息
* @param po
* @return
*/
private List<ApiTrackInfo> queryDeviceLocaltionInfo(LocationPO po){
return apiFirmMapper.queryDeviceLocaltionInfo(po);
}
private int getPageCount(int total,int pageSize){
return total % pageSize== 0 ? (total/pageSize):(total/pageSize)+1;
}
}

28
ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/api/ApiFirmMapper.xml

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
<?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.ecell.internationalize.system.mapper.api.ApiFirmMapper">
<select id="queryDeviceOwnerByImei" resultType="com.ecell.internationalize.system.entity.api.FirmDeviceInfo">
select imei,`name`,sex,birthday,height,weight,phone,dial_switch,image,positioning_interval,rejectStrange from device_owner_info_app where imei=#{imei}
</select>
<select id="queryLastLocationInfoByImei" resultType="com.ecell.internationalize.system.entity.api.ApiLastLocationInfo">
select longitude,latitude,location_type,radius,battery,step_number,rate,temperature,temperature_time,rate_time,update_time from latest_location_app where imei=#{imei}
</select>
<select id="queryDeviceLocaltionCount" parameterType="com.ecell.internationalize.system.entity.api.LocationPO" resultType="java.lang.Integer">
select count(1) from track_info_app where imei=#{po.imei} and create_time &gt;=#{po.startTime} and create_time &lt;=#{po.endTime} and alarm_type='0'
</select>
<select id="queryDeviceLocaltionInfo" parameterType="com.ecell.internationalize.system.entity.api.LocationPO" resultType="com.ecell.internationalize.system.entity.api.ApiTrackInfo">
select longitude,latitude,location_type,addr,update_time from track_info_app where imei=#{po.imei} and date_format(create_time,'%Y-%m-%d') &gt;=#{po.startTime} and date_format(create_time,'%Y-%m-%d') &lt;=#{po.endTime} and alarm_type='0'
<choose>
<when test="po.sort == 1">
ORDER BY update_time ASC
</when>
<otherwise>
ORDER BY update_time DESC
</otherwise>
</choose>
LIMIT #{po.startTotal},#{po.num}
</select>
</mapper>

25
ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/api/ApiOutwardMapper.xml

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
<?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.ecell.internationalize.system.mapper.api.ApiOutwardMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.ecell.internationalize.system.entity.api.ApiOutward">
<id column="id" property="id" />
<result column="app_id" property="appId" />
<result column="app_key" property="appKey" />
<result column="status" property="status" />
<result column="firm_id" property="firmId" />
<result column="firm_flag" property="firmFlag" />
<result column="second_firm_id" property="secondFirmId" />
<result column="create_user" property="createUser" />
<result column="create_time" property="createTime" />
<result column="second" property="second" />
<result column="frequency" property="frequency" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, app_id, app_key, status, firm_id, firm_flag, second_firm_id, create_user, create_time,frequency,second
</sql>
</mapper>
Loading…
Cancel
Save