Browse Source

服务商页面领券BUG处理

anderx 7 years ago
parent
commit
7f574f65b2

+ 18 - 2
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -52,6 +52,8 @@ import com.goafanti.demand.service.DemandService;
 import com.goafanti.portal.bo.AchievementObject;
 import com.goafanti.user.service.UserIdentityService;
 import com.goafanti.user.service.UserService;
+import com.goafanti.voucher.bo.JtVoucherDetailListBo;
+import com.goafanti.voucher.bo.JtVoucherListBo;
 import com.goafanti.voucher.service.VoucherDetailService;
 import com.goafanti.voucher.service.VoucherService;
 
@@ -783,12 +785,26 @@ public class PublicController extends BaseController {
 		return res;
 	}
 	
+	@SuppressWarnings("unchecked")
 	@RequestMapping(value = "/getUserVoucher", method = RequestMethod.GET)
 	@ResponseBody
 	public Result getUserVoucher(String uid,Integer pageNo,Integer pageSize){
 		Result res = new Result();
-		res.data(voucherService.selectVoucherList(null,1,1,4,uid, pageNo, pageSize));
-		return res;
+		Pagination<JtVoucherListBo> p=voucherService.selectVoucherList(null,1,1,4,uid, pageNo, pageSize);
+		List<JtVoucherListBo> vl=(List<JtVoucherListBo>) p.getList();
+		if (TokenManager.getUserId()==null) return res.data(p);
+		List<String> l=voucherDetailService.getTokenVoucher();
+		for (JtVoucherListBo jt : vl) {
+			for (String s : l) {
+				if (s.equals(jt.getId())) {
+					jt.setIsGet(1);
+				}else {
+					jt.setIsGet(0);
+				}
+				
+			}
+		}
+		return 	res.data(p);
 	}
 	@RequestMapping(value = "/userGetVoucher", method = RequestMethod.POST)
 	@ResponseBody

+ 2 - 0
src/main/java/com/goafanti/common/dao/JtVoucherDetailMapper.java

@@ -73,4 +73,6 @@ public interface JtVoucherDetailMapper {
 	 * @mbg.generated  Tue Oct 16 15:59:34 CST 2018
 	 */
 	int updateByPrimaryKey(JtVoucherDetail record);
+
+	List<String> getTokenVoucher(String uid);
 }

+ 6 - 0
src/main/java/com/goafanti/common/mapper/JtVoucherDetailMapper.xml

@@ -365,4 +365,10 @@
 		and  a.source = #{source,jdbcType=INTEGER}
 	</if>
   </select>
+  <select id="getTokenVoucher" resultType="java.lang.String">
+  select b.id from jt_voucher_detail a 
+    left join jt_voucher b on a.voucher_id = b.id
+    where b.source=4 
+    and a.use_uid= #{uid,jdbcType=VARCHAR}
+  </select>
 </mapper>

+ 1 - 1
src/main/java/com/goafanti/core/shiro/token/UserRealm.java

@@ -60,7 +60,7 @@ public class UserRealm extends AuthorizingRealm {
 			return new SimpleAuthenticationInfo(aftUser, aftUser.getPassword(), passwordUtil.getAftSalt(aftUser),
 					getName());
 		} else {
-			User user = userService.selectByMobieAndType(token.getUsername(), token.getType());
+			User user = userService.selectByMobieAndType(token.getUsername().trim(), token.getType());
 			if (null == user) {
 				throw new UnknownAccountException();
 			}

+ 17 - 0
src/main/java/com/goafanti/voucher/bo/JtVoucherListBo.java

@@ -10,6 +10,7 @@ public class JtVoucherListBo {
 		private String grantingUid;
 		private String limitUse;
 		private String limitProjectId;
+		private Integer isGet;
 		public String getId() {
 			return id;
 		}
@@ -64,5 +65,21 @@ public class JtVoucherListBo {
 		public void setLimitProjectId(String limitProjectId) {
 			this.limitProjectId = limitProjectId;
 		}
+		public Integer getIsGet() {
+			if (this.isGet==null) {
+				return 0;
+			}
+			return isGet;
+		}
+		public void setIsGet(Integer isGet) {
+			this.isGet = isGet;
+		}
+		@Override
+		public String toString() {
+			return "JtVoucherListBo [id=" + id + ", name=" + name + ", source=" + source + ", money=" + money
+					+ ", durationDay=" + durationDay + ", activeState=" + activeState + ", grantingUid=" + grantingUid
+					+ ", limitUse=" + limitUse + ", limitProjectId=" + limitProjectId + ", isGet=" + isGet + "]";
+		}
+		
 		
 }

+ 4 - 0
src/main/java/com/goafanti/voucher/service/VoucherDetailService.java

@@ -1,5 +1,7 @@
 package com.goafanti.voucher.service;
 
+import java.util.List;
+
 import com.goafanti.common.model.JtVoucherDetail;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.voucher.bo.JtVoucherDetailListBo;
@@ -16,6 +18,8 @@ public interface VoucherDetailService {
 	Pagination<JtVoucherDetailListBo> selectVoucherDetailList(String name,Integer limitUse,String userMobile,Integer source,Integer sort,Integer sortType,Integer pageNo,Integer pageSize);
 
 	int saveUserGetVoucher(String uid, String vid);
+
+	List<String> getTokenVoucher();
 	
 	
 }

+ 5 - 0
src/main/java/com/goafanti/voucher/service/impl/VoucherDetailServiceImpl.java

@@ -87,6 +87,11 @@ public class VoucherDetailServiceImpl extends BaseMybatisDao<JtVoucherDetailMapp
 	}
 
 	
+	public List<String> getTokenVoucher() {
+		return jtVoucherDetailMapper.getTokenVoucher(TokenManager.getUserId());
+	}
+
+	
 
 	
 }

+ 1 - 0
src/main/webapp/WEB-INF/views/portal/invitation.html

@@ -40,6 +40,7 @@
         <div class="ruleBottom">
             <a href="javascript:;">立即邀请客户</a>
             <a href="javascript:;">立即邀请商家</a>
+            
         </div>
     </div>
    <!-- 下面公共底部 -->