caojianbin
8 months ago
22 changed files with 1096 additions and 29 deletions
@ -1,9 +1,78 @@
@@ -1,9 +1,78 @@
|
||||
package com.ecell.internationalize.common.system.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
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 javax.validation.constraints.Min; |
||||
import javax.validation.constraints.NotEmpty; |
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@Accessors(chain = true) |
||||
@ApiModel(value="PositioningModelInfo对象", description="定位模式信息表") |
||||
public class PositioningModelInfo implements Serializable { |
||||
private static final long serialVersionUID=1L; |
||||
|
||||
@ApiModelProperty(value = "定位模式id") |
||||
@TableId(value ="positioning_mode_id",type = IdType.INPUT) |
||||
private String positioningModeId; |
||||
|
||||
@NotEmpty(message = "定位模式1名称不能为空") |
||||
@ApiModelProperty(value = "定位模式1名称(正常模式)") |
||||
private String modelOneName; |
||||
|
||||
@Min(1) |
||||
@ApiModelProperty(value = "定位模式1间隔(单位分钟)") |
||||
private Integer positioningOneInterva; |
||||
|
||||
@NotEmpty(message = "定位模式2名称不能为空") |
||||
@ApiModelProperty(value = "定位模式2名称(省电模式)") |
||||
private String modelTwoName; |
||||
|
||||
@Min(1) |
||||
@ApiModelProperty(value = "定位模式2间隔(单位分钟)") |
||||
private Integer positioningTwoInterva; |
||||
|
||||
@NotEmpty(message = "定位模式3名称不能为空") |
||||
@ApiModelProperty(value = "定位模式3名称(高频模式)") |
||||
private String modelThreeName; |
||||
|
||||
@Min(1) |
||||
@ApiModelProperty(value = "定位模式3间隔(单位分钟)") |
||||
private Integer positioningThreeInterva; |
||||
|
||||
@ApiModelProperty(value = "创建人") |
||||
@TableField(value = "create_user",fill = FieldFill.INSERT) |
||||
private String createUser; |
||||
|
||||
@ApiModelProperty(value = "修改人") |
||||
@TableField(value = "update_user",fill = FieldFill.UPDATE) |
||||
private String updateUser; |
||||
|
||||
@TableField(value = "create_time",fill = FieldFill.INSERT) |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "创建时间") |
||||
private Date createTime; |
||||
|
||||
@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE) |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "修改时间") |
||||
private Date updateTime; |
||||
|
||||
@ApiModelProperty(value = "默认值(0.代表默认,默认数据不可以修改)") |
||||
private String defaultValue; |
||||
|
||||
} |
||||
|
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
package com.ecell.internationalize.common.issue.callback; |
||||
|
||||
import com.ecell.internationalize.common.issue.mqtt.AppSingleMqttClient; |
||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; |
||||
import org.eclipse.paho.client.mqttv3.MqttCallback; |
||||
import org.eclipse.paho.client.mqttv3.MqttMessage; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
public class CustomMessageCallback implements MqttCallback { |
||||
private static final Logger logger = LoggerFactory.getLogger(CustomMessageCallback.class); |
||||
@Override |
||||
public void connectionLost(Throwable throwable) { |
||||
logger.info("进行重新连接"); |
||||
AppSingleMqttClient.reconnection(); |
||||
} |
||||
|
||||
@Override |
||||
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,147 @@
@@ -0,0 +1,147 @@
|
||||
package com.ecell.internationalize.common.issue.constant; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
public class CommonConstant { |
||||
public static final String AUDIT_STATUS_ZERO="0"; |
||||
public static final String AUDIT_STATUS_ONE="1"; |
||||
public static final String AUDIT_STATUS_TWO="2"; |
||||
public static final String AUDIT_STATUS_THREE="3"; |
||||
public static final String AUDIT_STATUS_FOUR="4"; |
||||
public static final String AUDIT_STATUS_FIVE="5"; |
||||
public static final Integer AUDIT_STATUS_AND=240; |
||||
public static final int NUMBER_ZERO=0; |
||||
public static final int NUMBER_ONE=1; |
||||
public static final int NUMBER_TWO=2; |
||||
public static final int NUMBER_THREE=3; |
||||
public static final int NUMBER_FOUR=4; |
||||
public static final int NUMBER_FIVE=5; |
||||
public static final int PRE_NUMBER_FOUR=-4; |
||||
public static final int PRE_NUMBER_FIVE=-5; |
||||
public static final String BINDING_STATUS="binding_status"; |
||||
public static final String ADMIN_EMAIL="admin_email"; |
||||
public static final String ADMIN_PHONE="admin_phone"; |
||||
public static final String DEVICE_TYPE="device_type"; |
||||
|
||||
public static final String PHONE="phone"; |
||||
|
||||
public static final String MESSAGE_CODE="code"; |
||||
public static final String MESSAGE_INFO_SIX="666"; |
||||
public static final String MESSAGE_INFO_TWO="200"; |
||||
|
||||
public static final String SOUND="default"; |
||||
public static final String ANDROID="Android"; |
||||
public static final String IOS="iOS"; |
||||
public static final String CN="CN"; |
||||
public static final String US="US"; |
||||
|
||||
/**type常量**/ |
||||
public static final String LOCATION_TYPE="location"; |
||||
public static final String TYPE="type"; |
||||
public static final String IOS_PUSH_KAFKA="jianyou_tongxin_PUSH"; |
||||
|
||||
/**TCP-TOPIC*/ |
||||
public static final String WATCHPUSH_KAFKA="jianyou_tongxin_WatchPUSH_Kafka"; |
||||
/** 视频类型为声网*/ |
||||
public static final String VIDEO_TYPE_TWO="SW"; |
||||
/** 视频类型为菊风*/ |
||||
public static final String VIDEO_TYPE_ONE="JF"; |
||||
/** 视频类型为佰锐*/ |
||||
public static final String VIDEO_TYPE_THREE="BR"; |
||||
/** 视频类型为鹈鹕*/ |
||||
public static final String VIDEO_TYPE_FOUR="TH"; |
||||
/** 视频类型不支持*/ |
||||
public static final String VIDEO_TYPE_ZERO="0"; |
||||
|
||||
public static final int VIDEO_RESULT_PRE_ONE=-1; |
||||
public static final int VIDEO_RESULT_PRE_TWO=-2; |
||||
public static final int VIDEO_RESULT_PRE_THREE=-3; |
||||
public static final Map<String,String> VIDEO_TYPE_MAP = new HashMap<>(); |
||||
static { |
||||
VIDEO_TYPE_MAP.put("0", "0"); |
||||
VIDEO_TYPE_MAP.put("1", "JF"); |
||||
VIDEO_TYPE_MAP.put("2", "SW"); |
||||
VIDEO_TYPE_MAP.put("3", "BR"); |
||||
VIDEO_TYPE_MAP.put("4", "TH"); |
||||
} |
||||
public static final String DOWN_VIDEO_CALL_WITH_WATCH="downVideoCallWithWatch"; |
||||
public static final String UP_VIDEO_CALL_WITH_APP="upVideoCallWithAPP"; |
||||
/** 分辨率 宽 * 高 */ |
||||
public static final String DISPLAY_RESOLUTION="120*160"; |
||||
|
||||
/** 单次通话时长/秒 手表小热的等待时间(秒)*/ |
||||
public static final Integer ONE_CALL_TIME=15*60; |
||||
|
||||
/** 等待时长*/ |
||||
public static final Integer WAIT_TIME=60; |
||||
|
||||
/** 通话间隔/秒 菊风视频的不启用限制的 间隔总分钟数 (超过该分钟数就不启用限制,并清除之前的限制)(秒)*/ |
||||
public static final Integer CALL_INTERVAL=3*60; |
||||
|
||||
/**总视频时长/秒 菊风视频的启用限制的 视频通话总分钟数 最近视频通话累计时间 /秒 默认*/ |
||||
public static final Integer ALL_CALL_TIME=10*60; |
||||
/** 菊风视频Key */ |
||||
public static final String JF_VIDEO_KEY = "28012fd8eee097ab30ca5096"; |
||||
/** 鹈鹕视频Key */ |
||||
public static final String TH_VIDEO_KEY = "UkM4Q8mk3BeKEtbt"; |
||||
/** 佰锐视频Key */ |
||||
public static final String BR_VIDEO_KEY = "A3BEE84E-9C7A-D848-85D3-90F233D9A022"; |
||||
/** 声网视频Key*/ |
||||
public static final String SW_VIDEO_KEY = "f692ba8aa8b941afa9421d10a5f7b929"; |
||||
public static final String SW_CUSTOMER_ID = "去声网申请"; |
||||
public static final String SW_CUSTOMER_CERTIFICATE = "去声网申请"; |
||||
/** Ios的token */ |
||||
public static final String DEVICE_TOKEN="deviceToken"; |
||||
/** Ios的package */ |
||||
public static final String IOS_PACKAGE="iosPackage"; |
||||
/** Ios的version */ |
||||
public static final String IOS_VERSION="iosVersion"; |
||||
/** Ios 语言 */ |
||||
public static final String IOS_LANGUAGE="iosLanguage"; |
||||
/** 消息推送区分Android / iOS*/ |
||||
public static final String USER_AGENT="userAgent"; |
||||
/** 系统推送区分Android具体型号*/ |
||||
public static final String ANDROID_AGENT="AndroidAgent:"; |
||||
public static final String VIDEO_CALL ="message.video.call" ; |
||||
public static final String INVITE_CALL ="message.invite.call" ; |
||||
public static final String TRIGGER_SOS = "message.trigger.sos"; |
||||
public static final String ALARM_SOS = "message.alarm.sos"; |
||||
|
||||
public static final String HEART_RATE_ABNORMAL = "heart.rate.abnormal"; |
||||
public static final String PRE_MIN = "pre.min"; |
||||
public static final String HEART_RATE_CURRENT = "heart.rate.current"; |
||||
|
||||
public static final String TEMP_ABNORMAL = "temp.abnormal"; |
||||
public static final String TEMP_CURRENT = "temp.current"; |
||||
|
||||
public static final String HEART_SIMPLE_ABNORMAL = "heart.simple.abnormal"; |
||||
public static final String TEMP_SIMPLE= "temp.simple"; |
||||
public static final String CHANT_VIDEO="message.chant.video"; |
||||
public static final String ACCEPT_CHANT_VIDEO="accept.chant.video"; |
||||
|
||||
public static final String USER_UNBIND_DEVICE="user.unbind.device"; |
||||
public static final String DOWN_VIDEO_CALL="down.video.call"; |
||||
public static final String ENTER_RAIL="enter.rail"; |
||||
public static final String LEAVE_RAIL="leave.rail"; |
||||
public static final String CALL_FOLLOW="call.follow"; |
||||
|
||||
public static final String PRE_IDENTITY_TRANSFER="pre.identity.transer"; |
||||
public static final String AFTER_IDENTITY_TRANSFER="after.identity.transer"; |
||||
|
||||
public static final String ACCEPT_IDENTITY_TRANSFER="accept.identity.transer"; |
||||
|
||||
public static final String ADDRESS_BOOK_MAX="message.addressBook.max"; |
||||
|
||||
public static final String EXIT_LIST_VIDEO_CALL = "exit.list.video.call"; |
||||
public static final String CAN_NOT_VIDEO_CALL = "cannot.video.call"; |
||||
public static final String DISABLED_VIDEO_CALL = "disabled.video.call"; |
||||
public static final String NOT_INTERNET_VIDEO_CALL = "not.internet.video.call"; |
||||
public static final String LONG_TIME_VIDEO_CALL = "long.time.video.call"; |
||||
public static final String PROCESS_VIDEO_CALL = "process.video.call"; |
||||
|
||||
public static final String PHONE_HAS_EXIT="phone.has.exit"; |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package com.ecell.internationalize.common.issue.entity; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@Data |
||||
public class AlarmClockDto extends DistributeParent{ |
||||
private List<AlarmClockSecond> alarm; |
||||
} |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
package com.ecell.internationalize.common.issue.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@Data |
||||
public class AlarmClockSecond { |
||||
private String text; |
||||
private String week; |
||||
private String start; |
||||
private Integer status; |
||||
} |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
package com.ecell.internationalize.common.issue.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@Data |
||||
public class BootOff extends DistributeParent { |
||||
private String startTime; //"06:00",[str] //开始时间 (24 小时制 )
|
||||
private String endTime; //"23:00",[str] //结束时间 (24 小时制 )
|
||||
private String week; //"1111111",[str] // 重复星期数 默认是 1111111 每天开启
|
||||
private Integer status; // 开关状态
|
||||
} |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
package com.ecell.internationalize.common.issue.entity; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@Data |
||||
public class ChatGroupDisbandMessageInfo { |
||||
private String type; |
||||
private String groupId; |
||||
private String operator; |
||||
private String name; |
||||
private String imei; |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
private Date disbandTime; |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package com.ecell.internationalize.common.issue.entity; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@Data |
||||
public class DeviceDisabledAppDto extends DistributeParent{ |
||||
private List<DeviceDisabledInnerAppDto> disturb; |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package com.ecell.internationalize.common.issue.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@Data |
||||
public class DeviceDisabledInnerAppDto { |
||||
private String end; |
||||
private String week; |
||||
private String start; |
||||
private Integer status; |
||||
|
||||
} |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
package com.ecell.internationalize.common.issue.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@Data |
||||
public class DistributeParent { |
||||
//6位随机数
|
||||
protected String ident; |
||||
//设备imei
|
||||
protected String imei; |
||||
//登录用户id
|
||||
protected String openid; |
||||
//厂商标识
|
||||
protected String vender; |
||||
//下发指令类型
|
||||
protected String type; |
||||
//下发时间
|
||||
protected Long time; |
||||
} |
@ -0,0 +1,234 @@
@@ -0,0 +1,234 @@
|
||||
package com.ecell.internationalize.common.issue.issue; |
||||
|
||||
import com.alibaba.fastjson2.JSON; |
||||
import com.ecell.internationalize.common.issue.constant.CommonConstant; |
||||
import com.ecell.internationalize.common.issue.entity.AlarmClockDto; |
||||
import com.ecell.internationalize.common.issue.entity.BootOff; |
||||
import com.ecell.internationalize.common.issue.entity.DeviceDisabledAppDto; |
||||
import com.ecell.internationalize.common.redis.service.RedisService; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.kafka.core.KafkaTemplate; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.*; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@Component |
||||
public class IssueInstructions { |
||||
private static final Logger log = LoggerFactory.getLogger(IssueInstructions.class); |
||||
@Autowired |
||||
private RedisService redisService; |
||||
@Autowired |
||||
private KafkaTemplate<String,Object> kafkaTemplate; |
||||
public void emitDeviceDemand(String type, String imei, Object object){ |
||||
//查询缓存设备状态
|
||||
String onlineStatus = redisService.getCacheMapValue(imei, "onlineStatus"); |
||||
if ("disturb".equals(type)){ //上课禁用(下发)18
|
||||
DeviceDisabledAppDto disturb =(DeviceDisabledAppDto)object; |
||||
addRedis(imei,type,"disBan","disBanSync",disturb,onlineStatus); |
||||
} |
||||
else if ("alarm".equals(type)){ //闹钟(下发) 17
|
||||
AlarmClockDto alarm = (AlarmClockDto)object; |
||||
addRedis(imei,type,"alarms","alarmsSync",alarm,onlineStatus); |
||||
} |
||||
else if ("setBootOff".equals(type)){ //定时开关机数据设置下发指令 62
|
||||
BootOff bootOff =(BootOff)object; |
||||
addRedis(imei,type,"setBootOff","setBootOffSync",bootOff,onlineStatus); |
||||
|
||||
} |
||||
//设备在线才下发指令
|
||||
if(CommonConstant.AUDIT_STATUS_ONE.equals(onlineStatus)){ |
||||
log.info("下发到kafka指令:{},状态{}",object,onlineStatus); |
||||
sendKafka(object); |
||||
} |
||||
// //获取用户id
|
||||
// String stringUserId = SecurityContextHolder.getStringUserId();
|
||||
// log.info("指令下发内容:{}",object);
|
||||
// //查询缓存设备状态
|
||||
// String onlineStatus = redisService.getCacheMapValue(imei, "onlineStatus");
|
||||
// if ("centerPhone".equals(type)){// 中心号码设置(下发)只有管理员绑定设备,和管理员转让才下发该指令 29
|
||||
// CenterPhoneSetting centerPhoneSetting =(CenterPhoneSetting) object;
|
||||
// addRedis(imei,type,"centerPhone","centerPhoneSync",centerPhoneSetting,onlineStatus);
|
||||
// }else if ("sos".equals(type)){ //sos下发 20
|
||||
// SOS sos = (SOS)object;
|
||||
// addRedis(imei,type,"sos","sosSync",sos,onlineStatus);
|
||||
// }else if ("alarm".equals(type)){ //闹钟(下发) 17
|
||||
// AlarmClockDto alarm = (AlarmClockDto)object;
|
||||
// addRedis(imei,type,"alarms","alarmsSync",alarm,onlineStatus);
|
||||
// }else if ("disturb".equals(type)){ //上课禁用(下发)18
|
||||
// DeviceDisabledAppDto disturb =(DeviceDisabledAppDto)object;
|
||||
// addRedis(imei,type,"disBan","disBanSync",disturb,onlineStatus);
|
||||
// }else if ("PowerOff".equals(type)){ //远程关机(下发) 只有管理员才能操作
|
||||
// DistributeParent distributeParent =(DistributeParent)object;
|
||||
// addRedis(imei,type,"PowerOff","PowerOffSync",distributeParent,onlineStatus);
|
||||
// }else if ("dialSwitch".equals(type)){//拨号盘开关(下发)
|
||||
// DialSwitch dialSwitch =(DialSwitch)object;
|
||||
// addRedis(imei,type,"dialSwitch","dialSwitchSync",dialSwitch,onlineStatus);
|
||||
//
|
||||
// }else if ("locationUploadInterval".equals(type)){ //位置上报间隔设置(下发)22
|
||||
// LocationUploadInterval locationUploadInterval =(LocationUploadInterval)object;
|
||||
// if (StringUtils.isNotNull(locationUploadInterval)){
|
||||
// if (StringUtils.isNotEmpty(locationUploadInterval.getSecond().toString())){
|
||||
// locationUploadInterval.setSecond(locationUploadInterval.getSecond()*60);
|
||||
// } else {
|
||||
// locationUploadInterval.setSecond(600);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// addRedis(imei,type,"locMode_rate","locMode_rateSync",locationUploadInterval,onlineStatus);
|
||||
// }else if ("contact".equals(type)) { //通讯录下发 TODO 这里还要理一下逻辑
|
||||
// Contact contact = (Contact) object;
|
||||
// addRedis(imei, type, "contacts", "contactsSync", contact, onlineStatus);
|
||||
// }else if ("reset".equals(type)){ //恢复出厂设置(下发)25
|
||||
// restDevice(imei);
|
||||
// }else if ("requestLocation".equals(type)){ //请求定位(下发)15
|
||||
// log.info("请求定位下发 imei:%s object: %s", imei, object);
|
||||
// setRedisKey(type,imei,stringUserId);
|
||||
// }else if ("requestWifi".equals(type)){ //TCP-API接口文档没有 先不做
|
||||
//
|
||||
// }else if ("setBootOff".equals(type)){ //定时开关机数据设置下发指令 62
|
||||
// BootOff bootOff =(BootOff)object;
|
||||
// addRedis(imei,type,"setBootOff","setBootOffSync",bootOff,onlineStatus);
|
||||
//
|
||||
// }else if ("setSetpSwitch".equals(type)){ //APP 下发计步开关和目标步数指令60
|
||||
// SetpSwitch setpSwitch =(SetpSwitch)object;
|
||||
// addRedis(imei,type,"setSetpSwitch","setSetpSwitchSync",setpSwitch,onlineStatus);
|
||||
//
|
||||
// }else if ("downSchoolTimeTable".equals(type)){ //APP 下发课程表信息 (下发)
|
||||
// DownSchoolTimeTable downSchoolTimeTable =(DownSchoolTimeTable) object;
|
||||
// addRedis(imei,type,"downSchoolTimeTable","downSchoolTimeTableSync",downSchoolTimeTable,onlineStatus);
|
||||
// }else if ("STUDENTINFO".equals(type)){//平台下发学生信息
|
||||
// StudentInfo studentInfo =(StudentInfo) object;
|
||||
// addRedis(imei,type,"STUDENTINFO","STUDENTINFOSync",studentInfo,onlineStatus);
|
||||
//
|
||||
// }else if ("familyPhoneList".equals(type)){//亲情号下发
|
||||
// FamilyPhoneInfo familyPhoneInfo =(FamilyPhoneInfo) object;
|
||||
// addRedis(imei,type,"familyPhoneList","familyPhoneListSync",familyPhoneInfo,onlineStatus);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @param imei 设备IMEI |
||||
* @param type 指令下发类型 |
||||
* @param key1 缓存的key1 |
||||
* @param key2 缓存的key2 |
||||
* @param o 下发指令的内容 |
||||
* @param onlineStatus 缓存中设备的状态 |
||||
*/ |
||||
// 设置缓存
|
||||
private void addRedis(String imei, String type, String key1, String key2, Object o, String onlineStatus){ |
||||
log.info("存到redis数据库结果 type:%s:{}, data:%s:{}", key1, o); |
||||
redisService.setCacheMapValue(imei,key1, JSON.toJSONString(o)); |
||||
if (CommonConstant.AUDIT_STATUS_ONE.equals(onlineStatus)){ |
||||
log.info("设备imei: %s 在线",imei); |
||||
}else { |
||||
redisService.setCacheMapValue(imei,key2,"1"); |
||||
} |
||||
|
||||
} |
||||
|
||||
// 下发KAFKA
|
||||
public void sendKafka(Object object){ |
||||
log.info("下发到kafka的数据信息:{}",object); |
||||
kafkaTemplate.send(CommonConstant.WATCHPUSH_KAFKA, JSON.toJSONString(object)).addCallback(success->{ |
||||
log.info("发送到kafka具体信息{},partition 分区 {},offset {}", success.getRecordMetadata().topic(),success.getRecordMetadata().partition(),success.getRecordMetadata().offset()); |
||||
|
||||
},failure -> { |
||||
//失败
|
||||
log.info("下发到kafka的数据信息失败:{}",failure.getMessage()); |
||||
log.info("发送到kafka具体信息{}",JSON.toJSONString(object)); |
||||
|
||||
}); |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
/** |
||||
* 恢复出厂设置 |
||||
* @param imei |
||||
*/ |
||||
private void restDevice(String imei){ |
||||
List<String> list = Arrays.asList("messageVoice", "messageVoiceSync", "centerPhone", "weather", "weather_time", "weather_adcode", "locMode_rate", "locMode_rateSync", "reject", "rejectSync", "dialSwitch", |
||||
"dialSwitchSync", "volume", "volumeSync", "downSchoolTimeTable", "downSchoolTimeTableSync", "setHeartRate", "setHeartRateSync", "setBodyTemperature", "setBodyTemperatureSync", |
||||
"setBootOff", "setBootOffSync", "setSetpSwitch", "setSetpSwitchSync", "ppmessage", "ppmessageSync", "sos", "sosSync", "familyPhoneList", "familyPhoneListSync", "whitePhoneList", |
||||
"whitePhoneListSync", "studentInfo", "studentInfoSync","familyPhoneList","zytz"); |
||||
log.info("设备恢复出厂设置:{}",imei); |
||||
// delRedisKey(imei,list);
|
||||
boolean flag= redisService.deleteObject(imei); |
||||
log.info("删除缓存是否成功:{}",flag); |
||||
if (flag){ |
||||
redisService.setCacheMapValue(imei,"contacts","{\"last\":0,\"ident\":1616,\"contact\":[],\"index\":0,\"type\":'contact'}"); |
||||
redisService.setCacheMapValue(imei,"contactsSync", "1"); |
||||
redisService.setCacheMapValue(imei,"alarms", "{\"ident\":3030,\"alarm\":[],\"type\":'alarm'}"); |
||||
redisService.setCacheMapValue(imei, "alarmsSync", "1"); |
||||
redisService.setCacheMapValue(imei, "disBan", "{\"disturb\": [], \"ident\": 2828, \"type\": 'disturb'}"); |
||||
redisService.setCacheMapValue(imei, "disBanSync", "1"); |
||||
redisService.setCacheMapValue(imei, "onlineStatus", "0"); |
||||
redisService.setCacheMapValue(imei, "agent", "20000"); |
||||
redisService.setCacheMapValue(imei, "deviceHead","YS"); |
||||
redisService.setCacheMapValue(imei, "familyPhoneList","[]"); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
/** |
||||
* 删除缓存 |
||||
*/ |
||||
private void delRedisKey(String imei,List<String>list){ |
||||
Map<String, Object> cacheMap = redisService.getCacheMap(imei); |
||||
log.info("redids 中的键值对:{}",cacheMap); |
||||
if (redisService.deleteObject(imei)){ |
||||
try { |
||||
Iterator<Map.Entry<String, Object>> iterator = cacheMap.entrySet().iterator(); |
||||
while (iterator.hasNext()){ |
||||
Map.Entry<String, Object> next = iterator.next(); |
||||
if (list.stream().anyMatch(a->a.equals(next.getKey()))){ |
||||
redisService.setCacheMapValue(imei,next.getKey(),next.getValue()); |
||||
} |
||||
} |
||||
}catch (Exception e){ |
||||
log.info("删除redis失败 imei{},数据{}",imei,cacheMap); |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
// 下发KAFKA
|
||||
public void sendKafkaTwo(String imei,Object object){ |
||||
log.info("下发到kafka的数据信息:{}",object); |
||||
kafkaTemplate.send(CommonConstant.WATCHPUSH_KAFKA, imei,JSON.toJSONString(object)).addCallback(success->{ |
||||
log.info("发送到kafka具体信息{},partition 分区 {},offset {}", success.getRecordMetadata().topic(),success.getRecordMetadata().partition(),success.getRecordMetadata().offset()); |
||||
|
||||
},failure -> { |
||||
//失败
|
||||
log.info("下发到kafka的数据信息失败:{}",failure.getMessage()); |
||||
log.info("发送到kafka具体信息{}",JSON.toJSONString(object)); |
||||
|
||||
}); |
||||
|
||||
|
||||
} |
||||
|
||||
/** |
||||
* 存入redis中 |
||||
*/ |
||||
private void setRedisKey(String type,String imei,String userId){ |
||||
String s = String.format(type+":%s:%s",imei, userId); |
||||
log.info("存入redis中的key:{},data:{}",s,userId); |
||||
redisService.setCacheObject(s,userId, 60L, TimeUnit.SECONDS); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
package com.ecell.internationalize.system; |
||||
|
||||
import com.ecell.internationalize.common.security.annotation.EnableCustomConfig; |
||||
import com.ecell.internationalize.common.security.annotation.EnableRyFeignClients; |
||||
import com.ecell.internationalize.common.swagger.annotation.EnableCustomSwagger2; |
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
import org.springframework.scheduling.annotation.EnableScheduling; |
||||
|
||||
/** |
||||
* @author borui |
||||
*/ |
||||
@EnableCustomConfig |
||||
@EnableCustomSwagger2 |
||||
@EnableRyFeignClients |
||||
@EnableScheduling |
||||
@SpringBootApplication(scanBasePackages = "com.ecell.internationalize") |
||||
public class EcellSystemApplication { |
||||
public static void main(String[] args) { |
||||
SpringApplication.run(EcellSystemApplication.class, args); |
||||
System.out.println("易赛后台服务管理系统启动成功"); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,126 @@
@@ -0,0 +1,126 @@
|
||||
package com.ecell.internationalize.system.controller; |
||||
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.security.utils.SecurityUtils; |
||||
import com.ecell.internationalize.common.system.annotation.SystemLog; |
||||
import com.ecell.internationalize.common.system.constant.FieldConstant; |
||||
import com.ecell.internationalize.common.system.utlis.UploadUtil; |
||||
import com.ecell.internationalize.system.entity.ActivityBanner; |
||||
import com.ecell.internationalize.system.service.ActivityBannerService; |
||||
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.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.Date; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* <p> |
||||
* 活动banner图 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author liy |
||||
* @since 2022-07-13 |
||||
*/ |
||||
@Api(value="活动banner图",tags={"活动banner图接口"}) |
||||
@RestController |
||||
@RequestMapping("/activity_banner") |
||||
public class ActivityBannerController { |
||||
@Autowired |
||||
private ActivityBannerService activityBannerService; |
||||
/** |
||||
* 活动banner图条件分页查询 |
||||
* @Author liy |
||||
* @Date 2022/7/14 16:38 |
||||
* @param map 分页条件查询体 |
||||
* @Return AjaxResult |
||||
*/ |
||||
@ApiOperation("条件分页查询活动banner图信息") |
||||
@PostMapping("banner/list") |
||||
public AjaxResult queryAllByPage(@RequestBody Map<String,Object> map){ |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),activityBannerService.findAllByPage(map)); |
||||
} |
||||
/** |
||||
* 活动banner图发布 |
||||
* @Author liy |
||||
* @Date 2022/7/14 16:38 |
||||
* @param activityBanner 实体类 |
||||
* @Return AjaxResult |
||||
*/ |
||||
@ApiOperation("活动banner图发布/取消发布") |
||||
@SystemLog(msg =FieldConstant.ACTIVITY_BANNER_BANNER,operation = FieldConstant.ACTIVITY_BANNER_PUBLISH) |
||||
@PostMapping("banner/changeStatus") |
||||
public AjaxResult changeStatusOrDelUser(@RequestBody @ApiParam(name="活动",value="传整个对象,修改其中status字段,(0:取消发布,1:发布)",required=true) ActivityBanner activityBanner){ |
||||
//1表示发布图片,新增默认0未发布
|
||||
if (FieldConstant.MATH_ONE.equals(activityBanner.getStatus())){ |
||||
activityBanner.setPublishUser("admin"); |
||||
activityBanner.setPublishTime(new Date()); |
||||
}else { |
||||
activityBanner.setPublishUser(null); |
||||
activityBanner.setPublishTime(null); |
||||
} |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),activityBannerService.updateById(activityBanner)); |
||||
} |
||||
/** |
||||
* 活动banner图删除 |
||||
* @Author liy |
||||
* @Date 2022/7/14 16:38 |
||||
* @param activityBanner 实体类 |
||||
* @Return AjaxResult |
||||
*/ |
||||
@ApiOperation("活动banner图删除") |
||||
@SystemLog(msg =FieldConstant.ACTIVITY_BANNER_BANNER,operation = FieldConstant.DELETE_OPERATOR) |
||||
@PostMapping("banner/del") |
||||
public AjaxResult del(@RequestBody @ApiParam(name="活动",value="传整个对象,修改其中delFlag字段,(0:删除,1:正常)",required=true) ActivityBanner activityBanner){ |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),activityBannerService.updateById(activityBanner)); |
||||
} |
||||
/** |
||||
* 活动banner图上传/新增 |
||||
* @Author liy |
||||
* @Date 2022/7/14 16:38 |
||||
* @param file 文件 |
||||
* @Return AjaxResult |
||||
*/ |
||||
@ApiOperation("活动banner图新增上传") |
||||
@SystemLog(msg =FieldConstant.ACTIVITY_BANNER_BANNER,operation = FieldConstant.SAVE_OPERATOR) |
||||
@PostMapping("banner/save") |
||||
public AjaxResult save(@RequestParam("file") MultipartFile file,@RequestParam("title") String title,@RequestParam("bannerOrder")Integer bannerOrder) throws IOException { |
||||
String path = UploadUtil.upload(file); |
||||
String id= UUID.randomUUID().toString(true); |
||||
ActivityBanner activityBanner=new ActivityBanner(); |
||||
activityBanner.setId(id); |
||||
activityBanner.setCreateUser(SecurityUtils.getUsername()); |
||||
activityBanner.setBannerOrder(bannerOrder); |
||||
activityBanner.setTitle(title); |
||||
activityBanner.setBanner(path); |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),activityBannerService.save(activityBanner)); |
||||
} |
||||
/** |
||||
* 活动banner图上传/修改 |
||||
* @Author liy |
||||
* @Date 2022/7/14 16:38 |
||||
* @param file 文件 |
||||
* @Return AjaxResult |
||||
*/ |
||||
@ApiOperation("活动banner图修改上传") |
||||
@SystemLog(msg =FieldConstant.ACTIVITY_BANNER_BANNER,operation = FieldConstant.UPDATE_OPERATOR) |
||||
@PostMapping("banner/update") |
||||
public AjaxResult update(@RequestParam(value = "file",required = false) MultipartFile file,@RequestParam("id")String id, @RequestParam("title") String title,@RequestParam("bannerOrder")Integer bannerOrder) throws IOException { |
||||
ActivityBanner activityBanner=new ActivityBanner(); |
||||
if (null!=file) { |
||||
String path = UploadUtil.upload(file); |
||||
activityBanner.setBanner(path); |
||||
} |
||||
activityBanner.setId(id); |
||||
activityBanner.setBannerOrder(bannerOrder); |
||||
activityBanner.setTitle(title); |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),activityBannerService.updateById(activityBanner)); |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,124 @@
@@ -0,0 +1,124 @@
|
||||
package com.ecell.internationalize.system.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import javax.validation.constraints.NotBlank; |
||||
import javax.validation.constraints.NotNull; |
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* <p> |
||||
* 广告 |
||||
* </p> |
||||
* |
||||
* @author liy |
||||
* @since 2022-07-14 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@Accessors(chain = true) |
||||
@TableName("advert") |
||||
public class Advert implements Serializable { |
||||
|
||||
private static final long serialVersionUID=1L; |
||||
|
||||
/** |
||||
* 主键Id |
||||
*/ |
||||
@TableId("id") |
||||
private String id; |
||||
|
||||
/** |
||||
* 排序号 |
||||
*/ |
||||
@NotNull(message = "排序序号不能为空") |
||||
private Integer advertOrder; |
||||
|
||||
/** |
||||
* 广告商 |
||||
*/ |
||||
@NotBlank(message = "广告商名称不能为空") |
||||
private String advertName; |
||||
|
||||
/** |
||||
* 广告商字母缩写 |
||||
*/ |
||||
@NotBlank(message = "广告商标识不能为空") |
||||
private String advertShortName; |
||||
|
||||
/** |
||||
* 开关状态(0:关闭,1:打开),默认0 |
||||
*/ |
||||
private String status; |
||||
|
||||
/** |
||||
* 开始时间1 |
||||
*/ |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date startTimeFirst; |
||||
|
||||
/** |
||||
* 开始时间2 |
||||
*/ |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date startTimeSecond; |
||||
|
||||
/** |
||||
* 开始时间3 |
||||
*/ |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date startTimeThird; |
||||
|
||||
/** |
||||
* 结束时间1 |
||||
*/ |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date endTimeFirst; |
||||
|
||||
/** |
||||
* 结束时间2 |
||||
*/ |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date endTimeSecond; |
||||
|
||||
/** |
||||
* 结束时间3 |
||||
*/ |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date endTimeThird; |
||||
|
||||
/** |
||||
* 删除标识(0:已删除,1:正常) |
||||
*/ |
||||
private String delFlag; |
||||
|
||||
/** |
||||
* 创建人 |
||||
*/ |
||||
private String createUser; |
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
@TableField(value = "create_time",fill = FieldFill.INSERT) |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date createTime; |
||||
/** |
||||
* 修改人 |
||||
*/ |
||||
private String updateUser; |
||||
/** |
||||
* 修改时间 |
||||
*/ |
||||
@TableField(value = "update_time",fill = FieldFill.UPDATE) |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date updateTime; |
||||
|
||||
} |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
package com.ecell.internationalize.system.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.ecell.internationalize.system.entity.ActivitySearch; |
||||
|
||||
/** |
||||
* <p> |
||||
* 服务类 |
||||
* </p> |
||||
* |
||||
* @author liy |
||||
* @since 2022-07-13 |
||||
*/ |
||||
public interface ActivitySearchService extends IService<ActivitySearch> { |
||||
|
||||
/** |
||||
* 热门搜索分页列表 |
||||
* @Author liy |
||||
* @Date 2022/7/14 11:42 |
||||
* @param page 分页 |
||||
* @return IPage |
||||
*/ |
||||
IPage<ActivitySearch> findAllByPage(Page<ActivitySearch> page); |
||||
} |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
package com.ecell.internationalize.system.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.ecell.internationalize.system.entity.Activity; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* <p> |
||||
* 活动 服务类 |
||||
* </p> |
||||
* |
||||
* @author liy |
||||
* @since 2022-07-13 |
||||
*/ |
||||
public interface ActivityService extends IService<Activity> { |
||||
/** |
||||
* 活动分页查询 |
||||
* @Author liy |
||||
* @Date 2022/7/14 16:42 |
||||
* @param map 分页查询体 |
||||
* @return IPage |
||||
*/ |
||||
IPage<Activity> findAllByPage(Map<String,Object> map); |
||||
/** |
||||
* 往期活动分页查询 |
||||
* @Author liy |
||||
* @Date 2022/7/14 16:42 |
||||
* @param map 分页查询体 |
||||
* @return IPage |
||||
*/ |
||||
IPage<Activity> queryLastListByPage(Map<String,Object> map); |
||||
} |
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
package com.ecell.internationalize.system.service.impl; |
||||
|
||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.ecell.internationalize.common.system.constant.FieldConstant; |
||||
import com.ecell.internationalize.system.entity.ActivitySearch; |
||||
import com.ecell.internationalize.system.mapper.ActivitySearchMapper; |
||||
import com.ecell.internationalize.system.service.ActivitySearchService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author liy |
||||
* @since 2022-07-13 |
||||
*/ |
||||
@Service |
||||
public class ActivitySearchServiceImpl extends ServiceImpl<ActivitySearchMapper, ActivitySearch> implements ActivitySearchService { |
||||
@Autowired |
||||
private ActivitySearchMapper activitySearchMapper; |
||||
/** |
||||
* 热门搜索分页列表 |
||||
* @Author liy |
||||
* @Date 2022/7/14 11:42 |
||||
* @param page 分页 |
||||
* @return IPage |
||||
*/ |
||||
@Override |
||||
public IPage<ActivitySearch> findAllByPage(Page<ActivitySearch> page) { |
||||
LambdaQueryWrapper<ActivitySearch> queryWrapper = new LambdaQueryWrapper<>(); |
||||
queryWrapper.eq(ActivitySearch::getDelFlag, FieldConstant.MATH_ONE); |
||||
queryWrapper.orderByAsc(ActivitySearch::getSearchOrder); |
||||
return activitySearchMapper.selectPage(page,queryWrapper); |
||||
} |
||||
} |
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
package com.ecell.internationalize.system.service.impl; |
||||
|
||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.ecell.internationalize.common.system.constant.FieldConstant; |
||||
import com.ecell.internationalize.system.entity.Activity; |
||||
import com.ecell.internationalize.system.mapper.ActivityMapper; |
||||
import com.ecell.internationalize.system.service.ActivityService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Date; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* <p> |
||||
* 活动 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author liy |
||||
* @since 2022-07-13 |
||||
*/ |
||||
@Service |
||||
public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> implements ActivityService { |
||||
@Autowired |
||||
private ActivityMapper activityMapper; |
||||
/** |
||||
* 活动分页查询 |
||||
* @Author liy |
||||
* @Date 2022/7/14 16:42 |
||||
* @param map 分页查询体 |
||||
* @return IPage |
||||
*/ |
||||
@Override |
||||
public IPage<Activity> findAllByPage(Map<String, Object> map) { |
||||
Page<Activity> page=new Page<>(Integer.parseInt(map.get(FieldConstant.CURRENT).toString()),Integer.parseInt(map.get(FieldConstant.SIZE).toString())); |
||||
LambdaQueryWrapper<Activity> queryWrapper = conditions(map); |
||||
return activityMapper.selectPage(page,queryWrapper); |
||||
} |
||||
/** |
||||
* 往期活动分页查询 |
||||
* @Author liy |
||||
* @Date 2022/7/14 16:42 |
||||
* @param map 分页查询体 |
||||
* @return IPage |
||||
*/ |
||||
@Override |
||||
public IPage<Activity> queryLastListByPage(Map<String, Object> map) { |
||||
Page<Activity> page=new Page<>(Integer.parseInt(map.get(FieldConstant.CURRENT).toString()),Integer.parseInt(map.get(FieldConstant.SIZE).toString())); |
||||
LambdaQueryWrapper<Activity> queryWrapper = conditions(map); |
||||
queryWrapper.lt(Activity::getExpiryDate,new Date()); |
||||
return activityMapper.selectPage(page,queryWrapper); |
||||
} |
||||
private LambdaQueryWrapper<Activity> conditions(Map<String, Object> map){ |
||||
LambdaQueryWrapper<Activity> queryWrapper = new LambdaQueryWrapper<>(); |
||||
if (map.containsKey(FieldConstant.ACTIVITY_TITLE)&&null!=map.get(FieldConstant.ACTIVITY_TITLE).toString()){ |
||||
queryWrapper.eq(Activity::getActivityTitle,map.get(FieldConstant.ACTIVITY_TITLE).toString()); |
||||
} |
||||
if (map.containsKey(FieldConstant.STATUS)&&null!=map.get(FieldConstant.STATUS).toString()){ |
||||
queryWrapper.eq(Activity::getStatus,map.get(FieldConstant.STATUS).toString()); |
||||
} |
||||
if (map.containsKey(FieldConstant.ACTIVITY_CATEGORY)&&null!=map.get(FieldConstant.ACTIVITY_CATEGORY).toString()){ |
||||
queryWrapper.eq(Activity::getActivityCategory,map.get(FieldConstant.ACTIVITY_CATEGORY).toString()); |
||||
} |
||||
if (map.containsKey(FieldConstant.ACTIVITY_AGE)&&null!=map.get(FieldConstant.ACTIVITY_AGE).toString()){ |
||||
queryWrapper.eq(Activity::getActivityAge,map.get(FieldConstant.ACTIVITY_AGE).toString()); |
||||
} |
||||
if (map.containsKey(FieldConstant.ACTIVITY_AREAS)&&null!=map.get(FieldConstant.ACTIVITY_AREAS).toString()){ |
||||
queryWrapper.eq(Activity::getActivityAreas,map.get(FieldConstant.ACTIVITY_AREAS).toString()); |
||||
} |
||||
queryWrapper.eq(Activity::getDelFlag, FieldConstant.MATH_ONE); |
||||
return queryWrapper; |
||||
} |
||||
} |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
<?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.ActivitySearchMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="BaseResultMap" type="com.ecell.internationalize.system.entity.ActivitySearch"> |
||||
<id column="id" property="id" /> |
||||
<result column="search_order" property="searchOrder" /> |
||||
<result column="search_name" property="searchName" /> |
||||
<result column="create_user" property="createUser" /> |
||||
<result column="create_time" property="createTime" /> |
||||
<result column="update_user" property="updateUser" /> |
||||
<result column="update_time" property="updateTime" /> |
||||
<result column="del_flag" property="delFlag" /> |
||||
</resultMap> |
||||
|
||||
<!-- 通用查询结果列 --> |
||||
<sql id="Base_Column_List"> |
||||
id, search_order, search_name, create_user, create_time, update_user, update_time, del_flag |
||||
</sql> |
||||
|
||||
</mapper> |
Loading…
Reference in new issue