ソースを参照

活动助力助力条件修改

半月无霜 4 年 前
コミット
a21dd86d26

+ 5 - 2
ymall/src/main/java/com/liangjian11/ymall/mapper/activityCenter/ActivityHelperMapper.java

@@ -31,6 +31,9 @@ public interface ActivityHelperMapper extends BaseMapper<ActivityHelper> {
 	 */
 	@Select(" SELECT count(1) FROM activityhelper ${filterSql} ")
 	Integer getCount(@Param("filterSql") String filterSql);
-
-
+	
+	@Select(" SELECT count(1) FROM activityjointor A " +
+			" JOIN activityhelper B ON A.id = B.acjoinid " +
+			" WHERE  A.acid = #{acid} AND B.helperunionid = #{unionid} ")
+	Integer getHelpedCount(@Param("acid") Integer acid, @Param("unionid") String unionid);
 }

+ 4 - 0
ymall/src/main/java/com/liangjian11/ymall/service/impl/activityCenter/ActivityHelperServiceImpl.java

@@ -62,6 +62,10 @@ public class ActivityHelperServiceImpl implements ActivityHelperService {
 		Integer count = this.getHelpedCount(acjoinId, unionid);
 		if(count>0)
 			return ResultUtil.createFail("助力失败,不能重复助力");
+		Integer acid = info.getAcid();// 活动ID
+		int num = ahMapper.getHelpedCount(acid, unionid);
+		if(num>0)
+			return ResultUtil.createFail("助力失败,您已帮别人助力");
 		
 		ActivityHelper helper = new ActivityHelper();
 		helper.setAcjoinid(acjoinId);

+ 1 - 1
ymall/src/main/resources/application.yml

@@ -11,7 +11,7 @@ logging:
 
 spring:
     profiles:
-        active: pgprodtest
+        active: pgdev
     cache:
         type: ehcache
         ehcache:

+ 5 - 2
ymall/src/test/java/com/liangjian11/ymall/ServiceTest.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.liangjian11.ymall.controller.common.WechatController;
 import com.liangjian11.ymall.handle.WxMpHandle;
 import com.liangjian11.ymall.mapper.UserAccountMapper;
+import com.liangjian11.ymall.mapper.activityCenter.ActivityHelperMapper;
 import com.liangjian11.ymall.mapper.activityCenter.ActivityJointorMapper;
 import com.liangjian11.ymall.model.Doctor;
 import com.liangjian11.ymall.model.UserAccount;
@@ -53,12 +54,14 @@ public class ServiceTest {
 	@Autowired
 	private ActivityJointorMapper ajMapper;
 	@Autowired
+	private ActivityHelperMapper ahMapper;
+	@Autowired
   	private HospitalDomain hospitalDomain;
 	
 	@Test
 	public void runTest(){
-		String token = wxMpHandle.getToken();
-		System.out.println(token);
+		Integer a = ahMapper.getHelpedCount(28, "oZh4guJFWppeFPZLnhwOig20MqtA");
+		System.out.println(a);
 	}
 
 	@Test