暂存
This commit is contained in:
		| @@ -1,9 +1,6 @@ | ||||
| package com.stdiet.web.controller.custom; | ||||
|  | ||||
| import com.aliyun.vod20170321.models.GetPlayInfoResponseBody; | ||||
| import com.aliyun.vod20170321.models.GetVideoInfoResponseBody; | ||||
| import com.aliyun.vod20170321.models.GetVideoListResponseBody; | ||||
| import com.itextpdf.io.util.DateTimeUtil; | ||||
| import com.stdiet.common.core.controller.BaseController; | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.common.core.page.TableDataInfo; | ||||
| @@ -21,7 +18,6 @@ import com.stdiet.custom.dto.response.MessageNoticeResponse; | ||||
| import com.stdiet.custom.dto.response.NutritionalVideoResponse; | ||||
| import com.stdiet.custom.page.WxLogInfo; | ||||
| import com.stdiet.custom.service.*; | ||||
| import org.aspectj.weaver.loadtime.Aj; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import org.springframework.web.multipart.MultipartFile; | ||||
| @@ -100,6 +96,7 @@ public class WechatAppletController extends BaseController { | ||||
|  | ||||
|     /** | ||||
|      * 同步客户信息 | ||||
|      * | ||||
|      * @param sysWxUserInfo | ||||
|      * @return | ||||
|      */ | ||||
| @@ -116,10 +113,10 @@ public class WechatAppletController extends BaseController { | ||||
|         } else { | ||||
|             sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo); | ||||
|         } | ||||
|         Map<String,Object> result = new HashMap<>(); | ||||
|         Map<String, Object> result = new HashMap<>(); | ||||
|         //根据手机号查询返回用户加密ID | ||||
|         SysCustomer customer = sysCustomerService.getCustomerByPhone(sysWxUserInfo.getPhone()); | ||||
|         result.put("customerId", customer != null ? AesUtils.encrypt(customer.getId()+"", null) : null); | ||||
|         result.put("customerId", customer != null ? AesUtils.encrypt(customer.getId() + "", null) : null); | ||||
|         //查询未读消息数量 | ||||
|         SysMessageNotice messageParam = new SysMessageNotice(); | ||||
|         messageParam.setReadType(0); | ||||
| @@ -337,9 +334,9 @@ public class WechatAppletController extends BaseController { | ||||
|     @GetMapping(value = "/getCustomerMessage") | ||||
|     public TableDataInfo getCustomerMessage(SysMessageNotice sysMessageNotice) { | ||||
|         startPage(); | ||||
|         if(StringUtils.isNotEmpty(sysMessageNotice.getCustomerId())){ | ||||
|         if (StringUtils.isNotEmpty(sysMessageNotice.getCustomerId())) { | ||||
|             sysMessageNotice.setMessageCustomer(Long.parseLong(AesUtils.decrypt(sysMessageNotice.getCustomerId(), null))); | ||||
|         }else{ | ||||
|         } else { | ||||
|             sysMessageNotice.setMessageCustomer(0L); | ||||
|         } | ||||
|         List<MessageNoticeResponse> list = sysMessageNoticeService.getCustomerMessage(sysMessageNotice); | ||||
| @@ -350,7 +347,7 @@ public class WechatAppletController extends BaseController { | ||||
|      * 更新用户通知消息已读状态 | ||||
|      */ | ||||
|     @GetMapping(value = "/updateMessageReadStatus") | ||||
|     public AjaxResult updateMessageReadStatus(@RequestParam("id")Long id) { | ||||
|     public AjaxResult updateMessageReadStatus(@RequestParam("id") Long id) { | ||||
|         SysMessageNotice sysMessageNotice = new SysMessageNotice(); | ||||
|         sysMessageNotice.setReadType(1); | ||||
|         sysMessageNotice.setId(id); | ||||
| @@ -366,29 +363,29 @@ public class WechatAppletController extends BaseController { | ||||
|         startPage(); | ||||
|         //int total = 0; | ||||
|         //List<NutritionalVideoResponse> nutritionalVideoList = new ArrayList<>(); | ||||
|         try{ | ||||
|         try { | ||||
|             /**GetVideoListResponseBody videoListResponseBody = AliyunVideoUtils.getVideoListByPage(null, "Normal", 1, 10); | ||||
|             if(videoListResponseBody != null){ | ||||
|                 total = videoListResponseBody.total; | ||||
|                 for (GetVideoListResponseBody.GetVideoListResponseBodyVideoListVideo video : videoListResponseBody.videoList.video) { | ||||
|                     NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse(); | ||||
|                     nutritionalVideoResponse.setCoverURL(video.getCoverURL()); | ||||
|                     nutritionalVideoResponse.setTitle(video.getTitle()); | ||||
|                     nutritionalVideoResponse.setVideoId(video.getVideoId()); | ||||
|                     nutritionalVideoResponse.setDescription(video.getDescription()); | ||||
|                     nutritionalVideoResponse.setTags(video.getTags()); | ||||
|                     nutritionalVideoList.add(nutritionalVideoResponse); | ||||
|                     System.out.println(video.getVideoId()); | ||||
|                     System.out.println(video.getCoverURL()); | ||||
|                     System.out.println(video.getTitle()); | ||||
|                     System.out.println(video.getDescription()); | ||||
|                 } | ||||
|             } | ||||
|             System.out.println();**/ | ||||
|              if(videoListResponseBody != null){ | ||||
|              total = videoListResponseBody.total; | ||||
|              for (GetVideoListResponseBody.GetVideoListResponseBodyVideoListVideo video : videoListResponseBody.videoList.video) { | ||||
|              NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse(); | ||||
|              nutritionalVideoResponse.setCoverURL(video.getCoverURL()); | ||||
|              nutritionalVideoResponse.setTitle(video.getTitle()); | ||||
|              nutritionalVideoResponse.setVideoId(video.getVideoId()); | ||||
|              nutritionalVideoResponse.setDescription(video.getDescription()); | ||||
|              nutritionalVideoResponse.setTags(video.getTags()); | ||||
|              nutritionalVideoList.add(nutritionalVideoResponse); | ||||
|              System.out.println(video.getVideoId()); | ||||
|              System.out.println(video.getCoverURL()); | ||||
|              System.out.println(video.getTitle()); | ||||
|              System.out.println(video.getDescription()); | ||||
|              } | ||||
|              } | ||||
|              System.out.println();**/ | ||||
|             sysNutritionalVideo.setShowFlag(1); | ||||
|             List<SysNutritionalVideo> list = sysNutritionalVideoService.selectSysNutritionalVideoList(sysNutritionalVideo); | ||||
|             return getDataTable(list); | ||||
|         }catch (Exception e){ | ||||
|         } catch (Exception e) { | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
|         return null; | ||||
| @@ -402,13 +399,13 @@ public class WechatAppletController extends BaseController { | ||||
|     public AjaxResult getVideoDetailById(@RequestParam(value = "videoId") String videoId) { | ||||
|         AjaxResult result = AjaxResult.success(); | ||||
|         NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse(); | ||||
|         try{ | ||||
|         try { | ||||
|             SysNutritionalVideo sysNutritionalVideo = sysNutritionalVideoService.selectSysNutritionalVideByVideoId(videoId); | ||||
|             if(sysNutritionalVideo != null){ | ||||
|             if (sysNutritionalVideo != null) { | ||||
|                 GetPlayInfoResponseBody playInfoResponseBody = AliyunVideoUtils.getVideoVisitDetail(videoId); | ||||
|                 //GetVideoInfoResponseBody videoInfoResponseBody = AliyunVideoUtils.getVideoById(videoId); | ||||
|                 List<GetPlayInfoResponseBody.GetPlayInfoResponseBodyPlayInfoListPlayInfo> playList = playInfoResponseBody.playInfoList.playInfo; | ||||
|                 if(playList != null && playList.size() > 0){ | ||||
|                 if (playList != null && playList.size() > 0) { | ||||
|                     nutritionalVideoResponse.setPlayUrl(playList.get(0).getPlayURL()); | ||||
|                 } | ||||
|                 nutritionalVideoResponse.setDescription(sysNutritionalVideo.getDescription()); | ||||
| @@ -416,7 +413,7 @@ public class WechatAppletController extends BaseController { | ||||
|                 nutritionalVideoResponse.setTitle(sysNutritionalVideo.getTitle()); | ||||
|                 nutritionalVideoResponse.setCreateTime(DateUtils.dateTime(sysNutritionalVideo.getCreateTime())); | ||||
|             } | ||||
|         }catch (Exception e){ | ||||
|         } catch (Exception e) { | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
|         result.put("videoDetail", nutritionalVideoResponse); | ||||
| @@ -431,11 +428,13 @@ public class WechatAppletController extends BaseController { | ||||
|         SysWxUserInfo curWxUserInfo = sysWxUserInfoService.selectSysWxUserInfoById(sysWxUserInfo.getOpenid()); | ||||
|  | ||||
|         // 第一次尝试匹配,搜索sys_wx_user_info表,尝试查找cus_id,此时不需要手机号 | ||||
|         if (StringUtils.isEmpty(sysWxUserInfo.getPhone()) && StringUtils.isNull(curWxUserInfo) || StringUtils.isNull(curWxUserInfo.getCusId())) { | ||||
|         if (StringUtils.isEmpty(sysWxUserInfo.getPhone()) && (StringUtils.isNull(curWxUserInfo) || StringUtils.isNull(curWxUserInfo.getCusId()))) { | ||||
|             // 如果没找到任何信息,此时为未登录过的新用户 || 没有cusId,没有创建用户信息 | ||||
|             return AjaxResult.error(5000, "需要手机号进一步匹配"); | ||||
|         } else { | ||||
|             // 第二次尝试匹配,带上手机号,先去sys_customer查找,找到就更新sys_wx_user_info表,并返回一系列登录后的数据 | ||||
|         } | ||||
|  | ||||
|         // 第二次尝试匹配,带上手机号,先去sys_customer查找,找到就更新sys_wx_user_info表,并返回一系列登录后的数据 | ||||
|         if (StringUtils.isNotEmpty(sysWxUserInfo.getPhone())) { | ||||
|             SysCustomer sysCustomer = iSysCustomerService.getCustomerByPhone(sysWxUserInfo.getPhone()); | ||||
|             if (StringUtils.isNull(sysCustomer)) { | ||||
|                 return AjaxResult.error(5003, "未查到用户信息,请联系销售顾问"); | ||||
| @@ -444,11 +443,15 @@ public class WechatAppletController extends BaseController { | ||||
|             if (StringUtils.isNull(curWxUserInfo)) { | ||||
|                 // 新增sys_wx_user_info | ||||
|                 sysWxUserInfo.setCusId(sysCustomer.getId()); | ||||
|                 sysWxUserInfo.setCreateTime(DateUtils.getNowDate()); | ||||
|                 sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         // 更新sys_wx_user_info数据,并返回一系列登录后的数据 | ||||
|         curWxUserInfo.setUpdateTime(DateUtils.getNowDate()); | ||||
|         sysWxUserInfoService.updateSysWxUserInfo(curWxUserInfo); | ||||
|  | ||||
|         return AjaxResult.success(curWxUserInfo); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user