Browse Source

watero母亲节活动

wangxiaoming 6 years ago
parent
commit
840f2813ff

+ 5 - 5
watero-common-core/src/main/java/com/iamberry/wechat/core/entity/mothMovable/MothMovable.java

@@ -28,7 +28,7 @@ public class MothMovable  implements  Serializable{
     //创建时间'
     private Date mothMovaCreateTime;
 
-    private String userNickname;
+    private String mothMovaName;
 
     public Integer getMothMovaId(){
         return mothMovaId;
@@ -102,11 +102,11 @@ public class MothMovable  implements  Serializable{
         this.mothMovaCreateTime=mothMovaCreateTime;
     }
 
-    public String getUserNickname() {
-        return userNickname;
+    public String getMothMovaName() {
+        return mothMovaName;
     }
 
-    public void setUserNickname(String userNickname) {
-        this.userNickname = userNickname;
+    public void setMothMovaName(String mothMovaName) {
+        this.mothMovaName = mothMovaName;
     }
 }

+ 1 - 1
watero-wechat-interface/src/main/java/com/iamberry/wechat/face/mothMovable/MothMovableService.java

@@ -46,5 +46,5 @@ public interface MothMovableService {
      * @param
      * @return Integer
      */
-    Integer  scanInfo(Integer  mothMovaId,String openId);
+    Integer  scanInfo(String  mothMovaOpenId,String openId);
 }

+ 4 - 0
watero-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/mothMovableMapper.xml

@@ -5,6 +5,7 @@
         <result    column="moth_mova_id"    property="mothMovaId" />
         <result    column="moth_mova_open_id"    property="mothMovaOpenId" />
         <result    column="moth_mova_head"    property="mothMovaHead" />
+        <result    column="moth_mova_name"    property="mothMovaName" />
         <result    column="moth_mova_text"    property="mothMovaText" />
         <result    column="moth_mova_share_url"    property="mothMovaShareUrl" />
         <result    column="moth_mova_back_type"    property="mothMovaBackType" />
@@ -16,6 +17,7 @@
         t.moth_mova_id,
         t.moth_mova_open_id,
         t.moth_mova_head,
+        t.moth_mova_name,
         t.moth_mova_text,
         t.moth_mova_share_url,
         t.moth_mova_back_type,
@@ -62,6 +64,7 @@
         moth_mova_id,
         moth_mova_open_id,
         moth_mova_head,
+        moth_mova_name,
         moth_mova_text,
         moth_mova_share_url,
         moth_mova_back_type,
@@ -73,6 +76,7 @@
         #{mothMovaId},
         #{mothMovaOpenId},
         #{mothMovaHead},
+        #{mothMovaName},
         #{mothMovaText},
         #{mothMovaShareUrl},
         #{mothMovaBackType},

+ 10 - 3
watero-wechat-service/src/main/java/com/iamberry/wechat/service/mothMovable/MothMovableServiceImpl.java

@@ -167,7 +167,7 @@ public class MothMovableServiceImpl  implements MothMovableService {
         ImageUtils.pressPost(newImg,
                 headImg,PosterNumUtils.HEAD_X,PosterNumUtils.HEAD_Y,
                 codeImg,PosterNumUtils.CODE_X,PosterNumUtils.CODE_Y,
-                mothMovable.getUserNickname(),PosterNumUtils.TEXT_X,PosterNumUtils.TEXT_Y,new Color(221,106,140),PosterNumUtils.TEXT_FONT_SIZE,
+                mothMovable.getMothMovaName(),PosterNumUtils.TEXT_X,PosterNumUtils.TEXT_Y,new Color(221,106,140),PosterNumUtils.TEXT_FONT_SIZE,
                 mothMovable.getMothMovaText(),PosterNumUtils.TEXT_CONTENT_X,PosterNumUtils.TEXT_CONTENT_Y,new Color(0,0,0),PosterNumUtils.TEXT_CONTENT_FONT_SIZE
         );
         return true;
@@ -193,9 +193,16 @@ public class MothMovableServiceImpl  implements MothMovableService {
     }
 
     @Override
-    public Integer scanInfo(Integer mothMovaId, String openId) {
+    public Integer scanInfo(String mothMovaOpenId, String openId) {
+        MothMovable mothMovable = new MothMovable();
+        mothMovable.setMothMovaOpenId(mothMovaOpenId);
+        List<MothMovable> mothMovableList = mothMovableMapper.getMothMovableList(mothMovable);
+        if(mothMovableList == null || mothMovableList.size() < 1){
+            return 0;
+        }
+        mothMovable = mothMovableList.get(0);
         MothPopularity mothPopularity = new MothPopularity();
-        mothPopularity.setMothPopuId(mothMovaId);
+        mothPopularity.setMothMovaId(mothMovable.getMothMovaId());
         mothPopularity.setMothPopuOpenId(openId);
         return mothPopularityMapper.save(mothPopularity);
     }

+ 6 - 10
watero-wechat-service/src/main/java/com/iamberry/wechat/service/wechat/WeChatServiceImpl.java

@@ -315,23 +315,19 @@ public class WeChatServiceImpl implements WeChatService {
 	public Status scannQrcodeMothMovable(Map<String, String> requestMap, String fromUserName,Boolean isSubscription) {
 		Status status = new Status();
 		String senceid = requestMap.get("EventKey");//场景值
-
+		logger.info("===== 母亲节扫码进入活动 =====1senceid:"+senceid);
 		Member member = refreshUserInfo(fromUserName);
 
 		senceid = senceid.replaceAll(ResultInfo.barCodeMothMovable,"");//替换标识前的字符串
 		if(!isSubscription){
 			senceid = senceid.replaceAll(ResultInfo.barCode,"");
 		}
+		logger.info("===== 母亲节扫码进入活动 =====2senceid:"+senceid);
 
-		Integer mothMovaId = Integer.valueOf(senceid);
-		Integer flag = mothMovableService.scanInfo(mothMovaId,member.getUserOpenid());
-		if(flag < 1){
-			status.setCountext("");
-			status.setFlag(false);
-		}else{
-			status.setCountext("");
-			status.setFlag(false);
-		}
+		Integer flag = mothMovableService.scanInfo(senceid,member.getUserOpenid());
+		logger.info("===== 母亲节扫码进入活动 =====flag:"+flag);
+		status.setCountext("活动链接:");
+		status.setFlag(false);
 		return status;
 	}
 

+ 5 - 2
watero-wechat-web/src/main/java/com/iamberry/wechat/handles/mothMovable/MothMovableHandler.java

@@ -75,7 +75,7 @@ public class MothMovableHandler {
         mothMovable.setMothMovaHead(member.getUserHead());
 
         String name = java.net.URLDecoder.decode( member.getUserNickname(), ENCODE);
-        mothMovable.setUserNickname(name);
+        mothMovable.setMothMovaName(name);
         try {
             Integer falg = mothMovableService.save(mothMovable,realPath);
         }catch (Exception e){
@@ -100,6 +100,7 @@ public class MothMovableHandler {
         ResultMsg msg = new ResultMsg();
 
         Member member = WechatUtils.getUserBySession(request);
+        member = memberService.getMemberByUserOpenId(member.getUserOpenid());
 
         //进入活动的UV埋点
         AcceStatistics acceStatistics = new AcceStatistics();
@@ -115,7 +116,9 @@ public class MothMovableHandler {
         mothMovable.setMothMovaOpenId(member.getUserOpenid());
         List<MothMovable>  mothMovableList = mothMovableService.getMothMovableList(mothMovable);
         if(mothMovableList == null || mothMovableList.size() < 1){  //未参与活动
-            return new ResultMsg(false,  ResultMsg.ERROR, "未参与活动,请参与活动!",null);
+            msg = new ResultMsg(false,  ResultMsg.ERROR, "未参与活动,请参与活动!",null);
+            msg.setData(member);
+            return msg;
         }
         mothMovable = mothMovableList.get(0);
         msg.setData(mothMovable);