| | |
| | | import com.yeshi.fanli.entity.push.PushGoods;
|
| | | import com.yeshi.fanli.entity.push.PushGoodsGroup;
|
| | | import com.yeshi.fanli.entity.push.PushGoodsRecord;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.exception.push.PushGoodsGroupException;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | |
| | | public class PushController {
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | | @Resource
|
| | | private PushRecordService pushRecordService;
|
| | |
| | | private PushService pushService;
|
| | |
|
| | | @Resource
|
| | | private PushGoodsService PushGoodsService;
|
| | | private PushGoodsService pushGoodsService;
|
| | |
|
| | | @Resource
|
| | | private PushGoodsGroupService pushGoodsGroupService;
|
| | |
| | |
|
| | | @RequestMapping(value = "callback", method = RequestMethod.POST)
|
| | | public void callback(AcceptData acceptData, String pushId, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("不存在该系统"));
|
| | | return;
|
| | |
| | | public void insertIOSDeviceToken(AcceptData acceptData, String deviceToken, PrintWriter out) {
|
| | | if (!StringUtil.isNullOrEmpty(acceptData.getDevice()) && !StringUtil.isNullOrEmpty(deviceToken)) {
|
| | | // 添加设备活跃记录
|
| | | DeviceActive da = new DeviceActive();
|
| | | da.setDeviceToken(deviceToken);
|
| | | da.setPlatform(DeviceActive.PLATFORM_IOS);
|
| | | da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
|
| | | da.setDevice(acceptData.getDevice());
|
| | | deviceActiveService.addDeviceActive(da);
|
| | | iosPushService.addDeviceToken(null, Integer.parseInt(acceptData.getVersion()), deviceToken,
|
| | | acceptData.getDevice());
|
| | | out.print(JsonUtil.loadTrue(0, null, "成功"));
|
| | |
| | | @RequestMapping(value = "/uidBindDeviceToken", method = RequestMethod.POST)
|
| | | public void uidBindIOSDeviceToken(AcceptData acceptData, Long uid, String deviceToken, PrintWriter out) {
|
| | | if (uid != null && uid != 0 && !StringUtil.isNullOrEmpty(deviceToken)) {
|
| | | // 添加设备活跃记录
|
| | | DeviceActive da = new DeviceActive();
|
| | | da.setDeviceToken(deviceToken);
|
| | | da.setPlatform(DeviceActive.PLATFORM_IOS);
|
| | | da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
|
| | | da.setDevice(acceptData.getDevice());
|
| | | deviceActiveService.addDeviceActive(da);
|
| | | // 添加token
|
| | | iosPushService.addDeviceToken(uid, Integer.parseInt(acceptData.getVersion()), deviceToken,
|
| | | acceptData.getDevice());
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 解绑推送
|
| | | * 商品推送记录
|
| | | *
|
| | | * @param acceptData
|
| | | * @param out
|
| | |
| | |
|
| | | // 设备注册时间
|
| | | Date createTime = deviceActive.getCreateTime();
|
| | | count = PushGoodsService.countHistoryByPushTime(uid, createTime);
|
| | | count = pushGoodsService.countHistoryByPushTime(uid, createTime);
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | list = PushGoodsService.listHistoryByPushTime((page - 1) * pageSize, pageSize, uid, createTime);
|
| | | list = pushGoodsService.listHistoryByPushTime((page - 1) * pageSize, pageSize, uid, createTime);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (PushGoods pushGoods : list) {
|
| | | JSONObject result = new JSONObject();
|