| | |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @EnableTransactionManagement//启动事务功能 |
| | | public class GunsApplication /*extends SpringBootServletInitializer*/ { |
| | | public class GunsApplication { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | // @Override |
| | | // protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | // return builder.sources(GunsApplication.class); |
| | | // } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.CommercialWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 广告控制器 |
| | | */ |
| | | @RestController |
| | | @RequestMapping() |
| | | public class CommercialController { |
| | | |
| | | @Autowired |
| | | private ICommercialService commercialService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/commercial/queryCommercialList") |
| | | @ServiceLog(name = "获取广告列表", url = "/api/driver/queryCommercialList") |
| | | @ApiOperation(value = "获取广告列表", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "广告类型(1=弹窗广告,2=底部广告)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "设备类型(1=小程序,2=司机端)", name = "device", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<CommercialWarpper>> queryCommercialList(Integer type, Integer device, HttpServletRequest request){ |
| | | if(ToolUtil.isEmpty(type)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | | if(ToolUtil.isEmpty(device)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("device")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<CommercialWarpper> commercialWarppers = commercialService.queryCommercialList(uid, type, device); |
| | | return ResponseWarpper.success(commercialWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/driverPassLogin") |
| | | @ServiceLog(name = "司机密码登录", url = "/base/driver/driverPassLogin") |
| | | @ApiOperation(value = "司机密码登录", tags = {"司机端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "密码", name = "password", required = true, dataType = "string"), |
| | | }) |
| | | public ResponseWarpper<TokenWarpper> driverPassLogin(String receiver, String phone, String password){ |
| | | if(ToolUtil.isEmpty(receiver)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("receiver")); |
| | | } |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("phone")); |
| | | } |
| | | if(ToolUtil.isEmpty(password)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("password")); |
| | | } |
| | | try { |
| | | ResultUtil<TokenWarpper> tokenWarpper = driverService.driverPassLogin(receiver, phone, password); |
| | | return ResponseWarpper.success(tokenWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/flushedToken") |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Commercial; |
| | | import com.supersavedriving.driver.modular.system.warpper.CommercialWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface CommercialMapper extends BaseMapper<Commercial> { |
| | | |
| | | |
| | | /** |
| | | * 获取广告列表 |
| | | * @param type 广告类型(1=弹窗广告) |
| | | * @param device 设备(1=小程序,2=司机端) |
| | | * @return |
| | | */ |
| | | List<CommercialWarpper> queryCommercialList(@Param("type") Integer type, @Param("device") Integer device); |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.CommercialUserEject; |
| | | |
| | | public interface CommercialUserEjectMapper extends BaseMapper<CommercialUserEject> { |
| | | } |
New file |
| | |
| | | <?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.supersavedriving.driver.modular.system.dao.CommercialMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.Commercial"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="name" property="name"/> |
| | | <result column="device" property="device"/> |
| | | <result column="isJump" property="isJump"/> |
| | | <result column="jumpType" property="jumpType"/> |
| | | <result column="jumpUrl" property="jumpUrl"/> |
| | | <result column="html" property="html"/> |
| | | <result column="sort" property="sort"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createUserId" property="createUserId"/> |
| | | <result column="createTime" property="createTime"/> |
| | | <result column="updateUserId" property="updateUserId"/> |
| | | <result column="updateTime" property="updateTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryCommercialList" resultType="com.supersavedriving.driver.modular.system.warpper.CommercialWarpper"> |
| | | select |
| | | `name`, |
| | | `type`, |
| | | isJump, |
| | | jumpType, |
| | | jumpUrl, |
| | | html |
| | | from t_commercial where status = 1 |
| | | <if test="null != type"> |
| | | and `type` = #{type} |
| | | </if> |
| | | <if test="null != device"> |
| | | and device = #{device} |
| | | </if> |
| | | order by sort limit 0, 3 |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?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.supersavedriving.driver.modular.system.dao.CommercialUserEjectMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.CommercialUserEject"> |
| | | <id column="id" property="id"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="lastDate" property="lastDate"/> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | <result column="inviterId" property="inviterId"/> |
| | | <result column="agentId" property="agentId"/> |
| | | <result column="branchOfficeId" property="branchOfficeId"/> |
| | | <result column="balance" property="balance"/> |
| | | <result column="approvalStatus" property="approvalStatus"/> |
| | | <result column="approvalNotes" property="approvalNotes"/> |
| | | <result column="approvalUserId" property="approvalUserId"/> |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 广告实体类 |
| | | */ |
| | | @Data |
| | | @TableName("t_commercial") |
| | | public class Commercial { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=弹窗广告,2=底部广告) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 广告名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 设备(1=小程序,2=司机端) |
| | | */ |
| | | @TableField("device") |
| | | private Integer device; |
| | | /** |
| | | * 是否跳转(0=否,1=是) |
| | | */ |
| | | @TableField("isJump") |
| | | private Integer isJump; |
| | | /** |
| | | * 跳转类型(1=内部跳转,2=外部跳转) |
| | | */ |
| | | @TableField("jumpType") |
| | | private Integer jumpType; |
| | | /** |
| | | * 跳转链接 |
| | | */ |
| | | @TableField("jumpUrl") |
| | | private String jumpUrl; |
| | | /** |
| | | * 富文本内容 |
| | | */ |
| | | @TableField("html") |
| | | private String html; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加人员id |
| | | */ |
| | | @TableField("createUserId") |
| | | private Integer createUserId; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 修改人员id |
| | | */ |
| | | @TableField("updateUserId") |
| | | private Integer updateUserId; |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @TableField("updateTime") |
| | | private Date updateTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 用户弹框广告记录 |
| | | */ |
| | | @Data |
| | | @TableName("t_commercial_user_eject") |
| | | public class CommercialUserEject{ |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableField("id") |
| | | private Long id; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 最后弹出日期 |
| | | */ |
| | | @TableField("lastDate") |
| | | private Date lastDate; |
| | | } |
| | |
| | | @TableField("branchOfficeId") |
| | | private Integer branchOfficeId; |
| | | /** |
| | | * 账户余额 |
| | | */ |
| | | @TableField("balance") |
| | | private Double balance; |
| | | /** |
| | | * 审核状态(1=待审核,2=已同意,3=已拒绝) |
| | | */ |
| | | @TableField("approvalStatus") |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 司机上下班记录 |
| | | */ |
| | | @Data |
| | | @TableName("t_driver_work") |
| | | public class DriverWork { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 上班时间 |
| | | */ |
| | | @TableField("workTime") |
| | | private Date workTime; |
| | | /** |
| | | * 下班时间 |
| | | */ |
| | | @TableField("offWorkTime") |
| | | private Date offWorkTime; |
| | | /** |
| | | * 在线时长(秒) |
| | | */ |
| | | @TableField("onlineTime") |
| | | private |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.Commercial; |
| | | import com.supersavedriving.driver.modular.system.warpper.CommercialWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 广告接口 |
| | | */ |
| | | public interface ICommercialService extends IService<Commercial> { |
| | | |
| | | |
| | | /** |
| | | * 获取广告列表数据 |
| | | * @param type 广告类型(1=弹窗广告) |
| | | * @param device 设备(1=小程序,2=司机端) |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<CommercialWarpper> queryCommercialList(Integer uid, Integer type, Integer device) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.CommercialUserEject; |
| | | |
| | | public interface ICommercialUserEjectService extends IService<CommercialUserEject> { |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 司机密码登录 |
| | | * @param receiver 国家代码+86 |
| | | * @param phone 手机号 |
| | | * @param password 密码 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<TokenWarpper> driverPassLogin(String receiver, String phone, String password) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 刷新token |
| | | * @param uid |
| | | * @return |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.CommercialMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Commercial; |
| | | import com.supersavedriving.driver.modular.system.model.CommercialUserEject; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialService; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialUserEjectService; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.CommercialWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 广告逻辑类 |
| | | */ |
| | | @Service |
| | | public class CommercialServiceImpl extends ServiceImpl<CommercialMapper, Commercial> implements ICommercialService { |
| | | |
| | | @Autowired |
| | | private ICommercialUserEjectService commercialUserEjectService; |
| | | |
| | | |
| | | /** |
| | | * 获取广告列表 |
| | | * @param type 广告类型(1=弹窗广告) |
| | | * @param device 设备(1=小程序,2=司机端) |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CommercialWarpper> queryCommercialList(Integer uid, Integer type, Integer device) throws Exception { |
| | | if(type == 1){//弹框广告 |
| | | CommercialUserEject commercialUserEject = commercialUserEjectService.selectOne(new EntityWrapper<CommercialUserEject>().eq("userType", 2) |
| | | .eq("userId", uid).last(" and DATE_FORMAT(now(), '%Y%m%d') = DATE_FORMAT(lastDate, '%Y%m%d')")); |
| | | if(null != commercialUserEject){ |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | List<CommercialWarpper> commercialWarppers = this.baseMapper.queryCommercialList(type, device); |
| | | if(type == 1 && commercialWarppers.size() > 0){//记录弹窗 |
| | | CommercialUserEject commercialUserEject = new CommercialUserEject(); |
| | | commercialUserEject.setId(Long.valueOf(UUIDUtil.getNumberRandom(16))); |
| | | commercialUserEject.setLastDate(new Date()); |
| | | commercialUserEject.setUserId(uid); |
| | | commercialUserEject.setUserType(2); |
| | | commercialUserEjectService.insert(commercialUserEject); |
| | | } |
| | | return commercialWarppers; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.CommercialUserEjectMapper; |
| | | import com.supersavedriving.driver.modular.system.model.CommercialUserEject; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialUserEjectService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class CommercialUserEjectServiceImpl extends ServiceImpl<CommercialUserEjectMapper, CommercialUserEject> implements ICommercialUserEjectService { |
| | | } |
| | |
| | | if(!value.equals(code)){ |
| | | return ResultUtil.error("短信验证码无效"); |
| | | } |
| | | String token = getToken(phone, code); |
| | | if(ToolUtil.isEmpty(token)){ |
| | | return ResultUtil.error("登录异常,请联系管理员。"); |
| | | } |
| | | Driver driver = this.selectOne(new EntityWrapper<Driver>().eq("phone", phone).ne("status", 3)); |
| | | if(null == driver){ |
| | | return ResultUtil.error("请先进行注册"); |
| | |
| | | if(driver.getApprovalStatus() == 3){ |
| | | return ResultUtil.error("账号审核不通过,请重新申请。"); |
| | | } |
| | | |
| | | String token = getToken(phone, code); |
| | | if(ToolUtil.isEmpty(token)){ |
| | | return ResultUtil.error("登录异常,请联系管理员。"); |
| | | } |
| | | TokenWarpper tokenWarpper = new TokenWarpper(); |
| | | tokenWarpper.setToken(token); |
| | | tokenWarpper.setValidTime(7200L); |
| | |
| | | |
| | | |
| | | /** |
| | | * 司机密码登录 |
| | | * @param receiver 国家代码+86 |
| | | * @param phone 手机号 |
| | | * @param password 密码 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<TokenWarpper> driverPassLogin(String receiver, String phone, String password) throws Exception { |
| | | Driver driver = this.selectOne(new EntityWrapper<Driver>().eq("phone", phone).ne("status", 3)); |
| | | if(null == driver){ |
| | | return ResultUtil.error("请先进行注册"); |
| | | } |
| | | if(driver.getStatus() == 2){ |
| | | return ResultUtil.error("账号已被冻结,请联系管理员。"); |
| | | } |
| | | if(driver.getApprovalStatus() == 1){ |
| | | return ResultUtil.error("账号正在审核中。"); |
| | | } |
| | | if(driver.getApprovalStatus() == 3){ |
| | | return ResultUtil.error("账号审核不通过,请重新申请。"); |
| | | } |
| | | if(!driver.getPassword().equals(ShiroKit.md5(password, salt))){ |
| | | return ResultUtil.error("账号密码错误。"); |
| | | } |
| | | String token = getToken(phone, password); |
| | | if(ToolUtil.isEmpty(token)){ |
| | | return ResultUtil.error("登录异常,请联系管理员。"); |
| | | } |
| | | TokenWarpper tokenWarpper = new TokenWarpper(); |
| | | tokenWarpper.setToken(token); |
| | | tokenWarpper.setValidTime(7200L); |
| | | tokenWarpper.setIsSetPassword(ToolUtil.isEmpty(driver.getPassword()) ? 0 : 1); |
| | | return ResultUtil.success(tokenWarpper); |
| | | } |
| | | |
| | | /** |
| | | * 获取身份凭证 |
| | | * @param phone |
| | | * @param password |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * socket推单处理类 |
| | | */ |
| | | @Component |
| | | public class PushUtil { |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | private Map<String, JSONObject> pushMap = new HashMap<>();//存储需要定时推送的数据 |
| | | |
| | | private Map<String, Timer> taskMap = new HashMap<>();//存储定时推送的定时器 |
| | | |
| | | |
| | | |
| | | /** |
| | | * 推送强迫下线 |
| | | * @param id |
| | | * @param type |
| | | */ |
| | | public void pushOffline(Integer id, Integer type){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "OFFLINE"); |
| | | msg.put("data", new Object()); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel |
| | | public class CommercialWarpper { |
| | | @ApiModelProperty("广告名称") |
| | | private String name; |
| | | @ApiModelProperty("广告类型(1=弹窗广告,2=底部广告)") |
| | | private Integer type; |
| | | @ApiModelProperty("是否跳转(0=否,1=是)") |
| | | private Integer isJump; |
| | | @ApiModelProperty("跳转类型(1=内部跳转,2=外部跳转)") |
| | | private Integer jumpType; |
| | | @ApiModelProperty("跳转链接") |
| | | private String jumpUrl; |
| | | @ApiModelProperty("H5页面") |
| | | private String html; |
| | | } |
| | |
| | | Target Server Version : 50637 |
| | | File Encoding : 65001 |
| | | |
| | | Date: 09/02/2023 00:20:49 |
| | | Date: 09/02/2023 23:16:27 |
| | | */ |
| | | |
| | | SET NAMES utf8mb4; |
| | |
| | | INSERT INTO `t_branch_office` VALUES (1, 1, 'test', '1566666666', '393733352@qq.com', '510000', '四川省', '510100', '成都市', '510107', '武侯区', 1, '2023-02-03 14:53:48'); |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_commercial |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_commercial`; |
| | | CREATE TABLE `t_commercial` ( |
| | | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', |
| | | `type` int(1) NULL DEFAULT NULL COMMENT '类型(1=弹窗广告,2=底部广告)', |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '名称', |
| | | `device` int(1) NULL DEFAULT NULL COMMENT '设备(1=小程序,2=司机端)', |
| | | `isJump` int(1) NULL DEFAULT NULL COMMENT '是否跳转(0=否,1=是)', |
| | | `jumpType` int(1) NULL DEFAULT NULL COMMENT '跳转类型(1=内部跳转,2=外部跳转)', |
| | | `jumpUrl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '跳转连接', |
| | | `html` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '富文本', |
| | | `sort` int(11) NULL DEFAULT NULL COMMENT '排序', |
| | | `status` int(1) NULL DEFAULT NULL COMMENT '状态(1=正常,2=冻结,3=删除)', |
| | | `createTime` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', |
| | | `createUserId` int(11) NULL DEFAULT NULL COMMENT '添加人员id', |
| | | `updateTime` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', |
| | | `updateUserId` int(11) NULL DEFAULT NULL COMMENT '更新人员id', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '广告' ROW_FORMAT = Compact; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of t_commercial |
| | | -- ---------------------------- |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_commercial_user_eject |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_commercial_user_eject`; |
| | | CREATE TABLE `t_commercial_user_eject` ( |
| | | `id` bigint(20) NOT NULL COMMENT '主键', |
| | | `userType` int(1) NULL DEFAULT NULL COMMENT '用户类型(1=用户,2=司机)', |
| | | `userId` int(11) NULL DEFAULT NULL COMMENT '用户id', |
| | | `lastDate` date NULL DEFAULT NULL COMMENT '最后浏览日期', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户浏览弹框广告记录' ROW_FORMAT = Compact; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of t_commercial_user_eject |
| | | -- ---------------------------- |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_complaint |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_complaint`; |
| | |
| | | `inviterId` int(11) NULL DEFAULT NULL COMMENT '邀约人id', |
| | | `agentId` int(11) NULL DEFAULT NULL COMMENT '代理商id', |
| | | `branchOfficeId` int(11) NULL DEFAULT NULL COMMENT '分公司id', |
| | | `balance` decimal(10, 2) NULL DEFAULT NULL COMMENT '账户余额', |
| | | `approvalStatus` int(1) NULL DEFAULT NULL COMMENT '审核状态(1=待审核,2=已同意,3=已拒绝)', |
| | | `approvalNotes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '审核注释', |
| | | `approvalUserId` int(11) NULL DEFAULT NULL COMMENT '审核用户id', |
| | |
| | | -- ---------------------------- |
| | | -- Records of t_driver |
| | | -- ---------------------------- |
| | | INSERT INTO `t_driver` VALUES (1, '6450492139306606', NULL, '11', '15828353127', NULL, NULL, NULL, 'kk', '18382330577', NULL, '11', NULL, '11', '11', 1, 11, 1, 1, 1, '', NULL, NULL, 1, '2023-02-08 23:48:29'); |
| | | INSERT INTO `t_driver` VALUES (1, '6450492139306606', NULL, '11', '15828353127', NULL, NULL, NULL, 'kk', '18382330577', NULL, '11', NULL, '11', '11', 1, 11, 1, 1, NULL, 1, '', NULL, NULL, 1, '2023-02-08 23:48:29'); |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_driver_work |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_driver_work`; |
| | | CREATE TABLE `t_driver_work` ( |
| | | `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', |
| | | `driverId` int(11) NULL DEFAULT NULL COMMENT '司机id', |
| | | `workTime` datetime(0) NULL DEFAULT NULL COMMENT '上班时间', |
| | | `offWorkTime` datetime(0) NULL DEFAULT NULL COMMENT '下班时间', |
| | | `onlineTime` bigint(20) NULL DEFAULT NULL COMMENT '在线时长(秒)', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '司机上下班记录' ROW_FORMAT = Compact; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of t_driver_work |
| | | -- ---------------------------- |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_evaluate |