话机接口开发

This commit is contained in:
张博 2024-11-20 15:24:09 +08:00
parent edc9e08711
commit faa5b8553a
23 changed files with 183 additions and 44 deletions

View File

@ -26,13 +26,12 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.vo.TenCelldeptWeVo;
import net.shapelight.modules.vo.TenDeviceVo;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

View File

@ -21,12 +21,11 @@ import net.shapelight.modules.sys.service.SysDeviceAppService;
import net.shapelight.modules.sys.service.SysUserService;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.vo.SchoolNameVo;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

View File

@ -9,7 +9,7 @@ import net.shapelight.common.utils.IpUtils;
import net.shapelight.common.utils.SnowflakeIdWorker;
import net.shapelight.modules.app.annotation.Login;
import net.shapelight.modules.app.annotation.LoginUser;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.mobile.entity.MobilePackage;
import net.shapelight.modules.mobile.entity.MobilePackageOrder;
import net.shapelight.modules.mobile.service.MobilePackageOrderService;
@ -40,7 +40,7 @@ public class AppParentWxController {
MobilePackageService packageService;
@Autowired
GlobalValue globalValue;
@Qualifier("net.shapelight.modules.fegin.OpFeignClient")
@Qualifier("net.shapelight.modules.fegin.client.OpFeignClient")
@Autowired
private OpFeignClient opFeignClient;

View File

@ -2,6 +2,7 @@ package net.shapelight.modules.fegin;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.job.entity.KeysEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

View File

@ -1,6 +1,7 @@
package net.shapelight.modules.fegin;
package net.shapelight.modules.fegin.client;
import com.alibaba.fastjson.JSONObject;
import net.shapelight.modules.fegin.hystrix.OpHystrix;
import net.shapelight.modules.fegin.config.OpFeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
@ -15,7 +16,7 @@ import java.util.Map;
* path 指定调用接口所在Controller的@RequestMapping对应路径没有则不填
* 青桔话务平台
*/
@FeignClient(name = "operator-service", url = "${global.qingju.url}",configuration = OpFeignConfig.class)
@FeignClient(name = "operator-service", url = "${global.qingju.url}",configuration = OpFeignConfig.class,fallbackFactory = OpHystrix.class)
@Component
public interface OpFeignClient {

View File

@ -1,4 +1,4 @@
package net.shapelight.modules.fegin;
package net.shapelight.modules.fegin.client;
import com.alibaba.fastjson.JSONObject;
import net.shapelight.modules.fegin.config.OpFeignConfig;
@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.PostConstruct;
import java.util.Map;
/*

View File

@ -2,7 +2,7 @@ package net.shapelight.modules.fegin.config;
import feign.Logger;
import feign.Request;
import net.shapelight.modules.fegin.OpFeignInterceptor;
import net.shapelight.modules.fegin.interceptor.OpFeignInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,9 +1,10 @@
package net.shapelight.modules.fegin;
package net.shapelight.modules.fegin.hystrix;
import com.alibaba.fastjson.JSONObject;
import feign.hystrix.FallbackFactory;
import net.shapelight.modules.fegin.client.OpFeignClient;
import org.springframework.stereotype.Component;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package net.shapelight.modules.fegin;
package net.shapelight.modules.fegin.interceptor;
import feign.RequestInterceptor;
import feign.RequestTemplate;

View File

@ -3,7 +3,7 @@ package net.shapelight.modules.job.task;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.modules.job.entity.KeysEntity;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

View File

@ -1,25 +1,41 @@
package net.shapelight.modules.job.task;
import com.alibaba.fastjson.JSONObject;
import net.shapelight.modules.fegin.OpFeignClient;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import net.shapelight.common.handler.CustomizeTableNameHandler;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.job.entity.KeysEntity;
import net.shapelight.modules.mobile.entity.MobileDevice;
import net.shapelight.modules.mobile.entity.MobileDeviceGroup;
import net.shapelight.modules.mobile.service.MobileDeviceGroupService;
import net.shapelight.modules.mobile.service.MobileDeviceService;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.impl.TenUserScopeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class TerminalListSyncTask implements ITask {
public class TerminalListSyncTask extends AbstractController implements ITask {
@Autowired
private OpFeignClient feignClient;
@Autowired
private MobileDeviceGroupService mobileDeviceGroupService;
@Autowired
private MobileDeviceService mobileDeviceService;
@Value("${global.qingju.accountNumber}")
String accountNumber;
@Value("${global.qingju.empowerKey}")
String empowerKey;
@Autowired
private TenUserScopeServiceImpl tenUserScopeService;
@Override
public void run(String params) throws Exception {
@ -37,10 +53,16 @@ public class TerminalListSyncTask implements ITask {
queryParams.put("otherSchoolCode", "xtzg");
params.put("queryParams",queryParams);
JSONObject jsonObject = feignClient.getData(params);
TenUserScopeEntity tenUserScopeEntity = tenUserScopeService.getOne(new LambdaQueryWrapper<TenUserScopeEntity>()
.eq(TenUserScopeEntity::getUserId,getUserId()));
if(jsonObject.getString("shrgStatus").equals("S")) {
jsonObject.getJSONArray("list").forEach(item -> {
List<JSONObject> list = jsonObject.getJSONArray("list").toJavaList(JSONObject.class);
list.forEach(item -> {
MobileDeviceGroup mdg = new MobileDeviceGroup();
//mdg.setOpenId()
mdg.setOpenId(item.getString("terminalGroupUuid"));
mdg.setGroupName(item.getString("terminalGroupName"));
mdg.setDeviceCount(item.getInteger("terminalCount"));
mobileDeviceGroupService.save(mdg);
});
}
}
@ -53,7 +75,25 @@ public class TerminalListSyncTask implements ITask {
params.put("passKey", KeysEntity.passKey);
Map<String, Object> queryParams = feignClient.getData(params);
queryParams.put("otherSchoolCode", "xtzg");
params.put("queryParams",queryParams);
feignClient.getData(params);
//params.put("queryParams",queryParams);
JSONObject jsonObject = feignClient.getData(params);
TenUserScopeEntity tenUserScopeEntity = tenUserScopeService.getOne(new LambdaQueryWrapper<TenUserScopeEntity>()
.eq(TenUserScopeEntity::getUserId,getUserId()));
if(jsonObject.getString("shrgStatus").equals("S")) {
List<JSONObject> list = jsonObject.getJSONArray("list").toJavaList(JSONObject.class);
CustomizeTableNameHandler.setData(tenUserScopeEntity.getTenantId().toString());
list.forEach(item -> {
MobileDevice mobileDevice = new MobileDevice();
mobileDevice.setOpenId(item.getString("terminalGroupUuid"));
mobileDevice.setName(item.getString("terminalName"));
mobileDevice.setSn(item.getString("terminalSn"));
mobileDevice.setKey(item.getString("key"));
mobileDevice.setGroupName(item.getString("terminalGroupName"));
//mobileDevice.setGroupId(item.getString(""))
mobileDeviceService.save(mobileDevice);
});
CustomizeTableNameHandler.removeData();
}
}
}

View File

@ -0,0 +1,23 @@
package net.shapelight.modules.mobile.controler;
import io.swagger.annotations.Api;
import net.shapelight.common.utils.R;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("ghAppController")
@Api(value = "设备接口",tags = "设备接口")
public class DeviceClientController {
public R getData(@RequestBody Map<String,Object> params) {
return R.ok().put("data", params.get("data"));
}
}

View File

@ -3,31 +3,24 @@ package net.shapelight.modules.mobile.controler;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.handler.CustomizeTableNameHandler;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.R;
import net.shapelight.common.utils.SnowflakeIdWorker;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.job.entity.KeysEntity;
import net.shapelight.modules.mobile.dto.mobileDevice.MobileDeviceAddDto;
import net.shapelight.modules.mobile.dto.mobileDevice.MobileDeviceQueryDto;
import net.shapelight.modules.mobile.entity.MobileDevice;
import net.shapelight.modules.mobile.entity.MobileDeviceGroup;
import net.shapelight.modules.mobile.service.MobileDeviceService;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.impl.TenUserScopeServiceImpl;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@ -8,11 +8,10 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.shapelight.common.utils.BeanUtils;
//import net.shapelight.common.utils.ExcelUtils;
import net.shapelight.common.utils.ExcelUtils;
import net.shapelight.common.utils.R;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.job.entity.KeysEntity;
import net.shapelight.modules.mobile.dto.mobileDeviceGroup.MobileDeviceGruopQueryDto;
import net.shapelight.modules.mobile.dto.mobileDeviceGroup.MobileDeviceGroupAddDto;
@ -75,7 +74,7 @@ public class DeviceGroupController extends AbstractController {
TenUserScopeEntity tenUserScopeEntity = tenUserScopeService.getOne(new LambdaQueryWrapper<TenUserScopeEntity>().eq(TenUserScopeEntity::getUserId,getUserId()));
queryParams.put("otherSchoolCode", tenUserScopeEntity.getCellId().toString());
params.put("queryParams",queryParams);
queryParams.put("otherSchoolCode", tenUserScopeEntity.getCellId());
queryParams.put("otherSchoolCode", tenUserScopeEntity.getCellId().toString());
params.put("queryParams",queryParams);
JSONObject jsonObject = feignClient.getData(params);
if(jsonObject.getString("shrgStatus").equals("S")) {

View File

@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
@ -121,5 +122,92 @@ public class MobileDevice implements Serializable {
@TableLogic
private Integer deleteFlag;
/**
* 三方ID
*/
@Size(max= 50,message="编码长度不能超过50")
@ApiModelProperty("三方ID")
@Length(max= 50,message="编码长度不能超过50")
private String openId;
/**
* 心跳频率毫秒
*/
@ApiModelProperty("心跳频率(毫秒)")
private Integer heartbeatFrequency;
/**
* 单次通话时长
*/
@NotNull(message="[单次通话时长]不能为空")
@ApiModelProperty("单次通话时长")
private Integer callTime;
/**
* 开机时间
*/
@ApiModelProperty("开机时间")
private Date timeOn;
/**
* 关机时间
*/
@ApiModelProperty("关机时间")
private Date timeOff;
/**
* 禁拨电话
*/
@Size(max= 255,message="编码长度不能超过255")
@ApiModelProperty("禁拨电话")
@Length(max= 255,message="编码长度不能超过255")
private String forbidPhone;
/**
* 拨号方式all:视频+语音video视频sim语音
*/
@NotBlank(message="[拨号方式all:视频+语音video视频sim语音]不能为空")
@Size(max= 10,message="编码长度不能超过10")
@ApiModelProperty("拨号方式all:视频+语音video视频sim语音")
@Length(max= 10,message="编码长度不能超过10")
private String phoneType;
/**
* 是否显示留言按钮(Y显示N不显示)
*/
@NotBlank(message="[是否显示留言按钮(Y显示N不显示)]不能为空")
@Size(max= 2,message="编码长度不能超过2")
@ApiModelProperty("是否显示留言按钮(Y显示N不显示)")
@Length(max= 2,message="编码长度不能超过2")
private String messageFlag;
/**
* 拔打SOS电话是否要人
脸认证(Y要人脸认证N不要人脸认证)
*/
@NotBlank(message="[拔打SOS电话是否要人 脸认证(Y要人脸认证N不要人脸认证。)]不能为空")
@Size(max= 2,message="编码长度不能超过2")
@ApiModelProperty("拔打SOS电话是否要人 脸认证(Y要人脸认证N不要人脸认证。)")
@Length(max= 2,message="编码长度不能超过2")
private String checkSosPhone;
/**
* 是否显示成绩查询按钮(Y显示N不显示)
*/
@NotBlank(message="[是否显示成绩查询按钮(Y显示N不显示)]不能为空")
@Size(max= 2,message="编码长度不能超过2")
@ApiModelProperty("是否显示成绩查询按钮(Y显示N不显示)")
@Length(max= 2,message="编码长度不能超过2")
private String achievementFlag;
/**
* 预警通话时长
*/
@NotNull(message="[预警通话时长]不能为空")
@ApiModelProperty("预警通话时长")
private Integer warningCallTime;
/**
* 是否显示请假按钮(Y显示N不显示)
*/
@NotBlank(message="[是否显示请假按钮(Y显示N不显示)]不能为空")
@Size(max= 2,message="编码长度不能超过2")
@ApiModelProperty("是否显示请假按钮(Y显示N不显示)")
@Length(max= 2,message="编码长度不能超过2")
private String userLeaveFlag;
private String key;
private String groupName;
}

View File

@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import java.io.Serializable;
import java.util.Date;
@ -24,7 +25,7 @@ public class MobileDeviceGroup implements Serializable {
/**
* 设备组id
*/
@TableId
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(name = "设备组ID")
private Long groupId;

View File

@ -16,10 +16,9 @@ import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenPersonService;
import net.shapelight.modules.ten.service.TenUserScopeService;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

View File

@ -17,11 +17,10 @@ import net.shapelight.modules.ten.entity.TenParent;
import net.shapelight.modules.ten.entity.TenRelation;
import net.shapelight.modules.ten.service.TenParentService;
import net.shapelight.modules.ten.service.TenRelationService;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.vo.ParentVo;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

View File

@ -38,13 +38,12 @@ import net.shapelight.modules.sys.service.SysUserService;
import net.shapelight.modules.sys.service.impl.SysDictServiceImpl;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.vo.TenDeviceVo;
import net.shapelight.modules.vo.TenPersonOperationVo;
import org.apache.commons.io.FilenameUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

View File

@ -13,9 +13,8 @@ import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.TenParentService;
import net.shapelight.modules.ten.service.TenRelationService;
import net.shapelight.modules.ten.service.TenUserScopeService;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;
import java.util.*;

View File

@ -16,11 +16,10 @@ import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.vo.TenPersonOperationVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

View File

@ -33,7 +33,7 @@ import net.shapelight.modules.sys.service.impl.SysDictServiceImpl;
import net.shapelight.modules.ten.dao.TenRelationMapper;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import net.shapelight.modules.vo.*;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -5,7 +5,7 @@ import net.shapelight.modules.ten.entity.TenAddressEntity;
import net.shapelight.modules.ten.entity.TenBuildEntity;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.fegin.client.OpFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;