| | |
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenOPPO;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenVIVO;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenXM;
|
| | | 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.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | 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.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenOPPOService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenVIVOService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenXMService;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.service.inter.push.PushGoodsGroupService;
|
| | | import com.yeshi.fanli.service.inter.push.PushGoodsRecordService;
|
| | |
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.factory.JumpDetailParamsFactory;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | | @Controller
|
| | | @RequestMapping(value = "api/v1/push")
|
| | | public class PushController {
|
| | |
|
| | | @Resource
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | |
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | |
|
| | | @Resource
|
| | | private DeviceTokenOPPOService deviceTokenOPPOService;
|
| | |
|
| | | @Resource
|
| | | private DeviceTokenVIVOService deviceTokenVIVOService;
|
| | |
|
| | | @Resource
|
| | | private DeviceTokenXMService deviceTokenXMService;
|
| | |
|
| | | @RequestMapping(value = "callback", method = RequestMethod.POST)
|
| | | public void callback(AcceptData acceptData, String pushId, PrintWriter out) {
|
| | |
| | | * @param uid
|
| | | * @param deviceToken
|
| | | */
|
| | |
|
| | | @RequestSerializableByKey(key = "#acceptData.device")
|
| | | @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)) {
|
| | |
| | | * -用户ID
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "#acceptData.device")
|
| | | @RequestMapping(value = "/bindHWPush", method = RequestMethod.POST)
|
| | | public void bindHWDeviceToken(AcceptData acceptData, String token, Long uid, PrintWriter out) {
|
| | | deviceTokenHWService.addDeviceToken(token, acceptData.getDevice(), uid);
|
| | | deviceTokenHWService.addDeviceToken(token, acceptData.getDevice(), uid,
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | | out.print(JsonUtil.loadTrueResult("成功"));
|
| | | }
|
| | |
|
| | |
| | | // 统计商品数量
|
| | | long totalgoods = 0;
|
| | | // 商品id
|
| | | Long auctionId = null;
|
| | | CommonGoods commonGoods = null;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(picture)) {
|
| | | try {
|
| | | List<PushGoodsGroup> listGroup = pushGoodsGroupService.getAllInfoByPushId(pushId);
|
| | |
| | |
|
| | | PushGoodsGroup pushGoodsGroup = listGroup.get(0);
|
| | | if (pushGoodsGroup != null) {
|
| | | CommonGoods commonGoods = pushGoodsGroup.getCommonGoods();
|
| | | commonGoods = pushGoodsGroup.getCommonGoods();
|
| | | if (commonGoods != null) {
|
| | | picture = commonGoods.getPicture();
|
| | | auctionId = commonGoods.getGoodsId();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | result.put("picture", picture);
|
| | | result.put("picture", TbImgUtil.getTBSize320Img(picture));
|
| | |
|
| | | String fontColor1 = "#666666";
|
| | | String fontColor2 = "#E5005C";
|
| | |
| | |
|
| | | JumpDetailV2 jumpDetail = null;
|
| | | if (totalgoods == 1) {
|
| | |
|
| | | params = JumpDetailParamsFactory.createGoodsParams(auctionId);
|
| | | params = JumpDetailParamsFactory.createGoodsParams(commonGoods.getGoodsId(),
|
| | | commonGoods.getGoodsType());
|
| | | // 单个商品跳转商品详情
|
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("goodsdetail");
|
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("goodsdetail",
|
| | | Constant.getPlatformCode(acceptData.getPlatform()),
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | } else {
|
| | | String url = configService.get("push_goods_details");
|
| | | String url = configService.get(ConfigKeyEnum.pushGoodsDetails.getKey());
|
| | | if (url == null) {
|
| | | url = "";
|
| | | }
|
| | |
| | | params = JumpDetailParamsFactory.createWEBParams(url);
|
| | |
|
| | | // 跳转推荐详情
|
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("web");
|
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("web",
|
| | | Constant.getPlatformCode(acceptData.getPlatform()),
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | | }
|
| | | result.put("params", params);
|
| | | result.put("jumpDetail", jumpDetail);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping("registerOppo")
|
| | | public void registerOppo(AcceptData acceptData, String registerId, Long uid, PrintWriter out) {
|
| | | DeviceActive deviceActive = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (deviceActive != null) {
|
| | | DeviceTokenOPPO oppo = new DeviceTokenOPPO();
|
| | | oppo.setDeviceActiveId(deviceActive.getId());
|
| | | oppo.setRegisterId(registerId);
|
| | | oppo.setUid(uid);
|
| | | deviceTokenOPPOService.addDeviceTokenOPPO(oppo);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | @RequestMapping("registerVivo")
|
| | | public void registerVivo(AcceptData acceptData, String regId, Long uid, PrintWriter out) {
|
| | | DeviceActive deviceActive = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (deviceActive != null) {
|
| | | DeviceTokenVIVO vivo = new DeviceTokenVIVO();
|
| | | vivo.setDeviceActiveId(deviceActive.getId());
|
| | | vivo.setRegisterId(regId);
|
| | | vivo.setUid(uid);
|
| | | deviceTokenVIVOService.addDeviceTokenVIVO(vivo);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | @RequestMapping("registerXM")
|
| | | public void registerXM(AcceptData acceptData, String regId, Long uid, PrintWriter out) {
|
| | | DeviceActive deviceActive = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (deviceActive != null) {
|
| | | DeviceTokenXM xm = new DeviceTokenXM();
|
| | | xm.setDeviceActiveId(deviceActive.getId());
|
| | | xm.setRegisterId(regId);
|
| | | xm.setUid(uid);
|
| | | deviceTokenXMService.addDeviceToken(xm);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | }
|