Browse Source

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents

# Conflicts:
#	src/main/resources/application.yml
傅行帆 5 years ago
parent
commit
c9bc724de4

+ 1
- 1
pom.xml View File

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.huiju</groupId>
12 12
 	<artifactId>estateagents</artifactId>
13
-	<version>v.0.01</version>
13
+	<version>v0.0.2</version>
14 14
 	<name>estateagents</name>
15 15
 	<description>置业经纪人</description>
16 16
 

+ 21
- 13
src/main/java/com/huiju/estateagents/controller/TaCheckinController.java View File

@@ -36,7 +36,7 @@ import java.util.List;
36 36
  * @since 2019-07-24
37 37
  */
38 38
 @RestController
39
-@RequestMapping("/")
39
+@RequestMapping("/api")
40 40
 public class TaCheckinController extends BaseController {
41 41
 
42 42
     private final Logger logger = LoggerFactory.getLogger(TaCheckinController.class);
@@ -53,14 +53,14 @@ public class TaCheckinController extends BaseController {
53 53
      * @param pageSize
54 54
      * @return
55 55
      */
56
-    @RequestMapping(value="/taCheckin",method= RequestMethod.GET)
56
+    @RequestMapping(value="/taCheckin/activity/{activity}",method= RequestMethod.GET)
57 57
     public ResponseBean taCheckinList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
58
-                                      @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
58
+                                      @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,String activity){
59 59
         ResponseBean responseBean = new ResponseBean();
60 60
         try {
61 61
             //使用分页插件
62 62
 		    IPage<TaCheckin> pg = new Page<>(pageNum, pageSize);
63
-            IPage<TaCheckin> result = iTaCheckinService.getUndisplayedCustomerList(pg);
63
+            IPage<TaCheckin> result = iTaCheckinService.getUndisplayedCustomerList(pg,activity);
64 64
             for (int i = 0;i<result.getRecords().size();i++){
65 65
                 result.getRecords().get(i).setStatus(1);
66 66
             }
@@ -87,18 +87,26 @@ public class TaCheckinController extends BaseController {
87 87
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
88 88
         }
89 89
         TaPerson person = taPersons.get(0);
90
-        TaCheckin taCheckin = new TaCheckin();
91
-        taCheckin.setStatus(0);
92
-        taCheckin.setActivity(activity);
93
-        taCheckin.setName(person.getNickname());
94
-        taCheckin.setAvatar(person.getAvatarurl());
95
-        taCheckin.setCheckinTime(LocalDateTime.now());
90
+
91
+
96 92
         try {
97
-            if (iTaCheckinService.save(taCheckin)){
98
-                responseBean.success(taCheckin);
93
+            if(iTaCheckinService.isCustomerChecked(activity,person.getPersonId())>0){
94
+                ResponseBean.success("您已签到过此活动");
99 95
             }else {
100
-                responseBean.error("保存失败",ResponseBean.ERROR_UNAVAILABLE);
96
+                TaCheckin taCheckin = new TaCheckin();
97
+                taCheckin.setStatus(0);
98
+                taCheckin.setPersonId(person.getPersonId());
99
+                taCheckin.setActivity(activity);
100
+                taCheckin.setName(person.getNickname());
101
+                taCheckin.setAvatar(person.getAvatarurl());
102
+                taCheckin.setCheckinTime(LocalDateTime.now());
103
+                if (iTaCheckinService.save(taCheckin)){
104
+                    responseBean.success(taCheckin);
105
+                }else {
106
+                    responseBean.error("保存失败",ResponseBean.ERROR_UNAVAILABLE);
107
+                }
101 108
             }
109
+
102 110
         }catch (Exception e){
103 111
             logger.error("taCheckinAdd -=- {}",e.toString());
104 112
             responseBean.error("保存失败"+e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);

+ 5
- 0
src/main/java/com/huiju/estateagents/entity/TaCheckin.java View File

@@ -34,6 +34,11 @@ public class TaCheckin implements Serializable {
34 34
      */
35 35
     private String name;
36 36
 
37
+    /**
38
+     * 签到人id
39
+     */
40
+    private String personId;
41
+
37 42
     /**
38 43
      * 签到时间
39 44
      */

+ 2
- 1
src/main/java/com/huiju/estateagents/interceptor/AccessInterceptor.java View File

@@ -16,7 +16,8 @@ public class AccessInterceptor implements HandlerInterceptor {
16 16
     private String[] whiteList = {
17 17
             "/wx/chat", // 聊天暂时不鉴权
18 18
             "/api/wx/login",
19
-            "/api/admin/signin"
19
+            "/api/admin/signin",
20
+            "/api/taCheckin/activity"
20 21
     };
21 22
 
22 23
     /*

+ 3
- 1
src/main/java/com/huiju/estateagents/mapper/TaCheckinMapper.java View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6 6
 import com.huiju.estateagents.entity.TaCheckin;
7 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
8 9
 
9 10
 /**
10 11
  * <p>
@@ -16,6 +17,7 @@ import org.apache.ibatis.annotations.Mapper;
16 17
  */
17 18
 @Mapper
18 19
 public interface TaCheckinMapper extends BaseMapper<TaCheckin> {
19
-    IPage<TaCheckin>getUndisplayedCustomerList(IPage<TaCheckin> pg);
20
+    IPage<TaCheckin>getUndisplayedCustomerList(IPage<TaCheckin> pg, @Param("activity")String activity);
21
+    Integer isCustomerChecked(@Param("activity")String activity,@Param("personId")String personId);
20 22
 
21 23
 }

+ 2
- 1
src/main/java/com/huiju/estateagents/service/ITaCheckinService.java View File

@@ -14,6 +14,7 @@ import com.huiju.estateagents.entity.TaCheckin;
14 14
  * @since 2019-07-24
15 15
  */
16 16
 public interface ITaCheckinService extends IService<TaCheckin> {
17
-    IPage<TaCheckin> getUndisplayedCustomerList(IPage<TaCheckin> pg);
17
+    IPage<TaCheckin> getUndisplayedCustomerList(IPage<TaCheckin> pg,String activity);
18
+    Integer isCustomerChecked(String activity,String personId);
18 19
 
19 20
 }

+ 7
- 2
src/main/java/com/huiju/estateagents/service/impl/TaCheckinServiceImpl.java View File

@@ -22,8 +22,13 @@ public class TaCheckinServiceImpl extends ServiceImpl<TaCheckinMapper, TaCheckin
22 22
     TaCheckinMapper taCheckinMapper;
23 23
 
24 24
     @Override
25
-    public IPage<TaCheckin> getUndisplayedCustomerList(IPage<TaCheckin> pg){
26
-        return taCheckinMapper.getUndisplayedCustomerList(pg);
25
+    public IPage<TaCheckin> getUndisplayedCustomerList(IPage<TaCheckin> pg,String activity){
26
+        return taCheckinMapper.getUndisplayedCustomerList(pg,activity);
27
+    }
28
+
29
+    @Override
30
+    public Integer isCustomerChecked(String activity,String personId){
31
+        return taCheckinMapper.isCustomerChecked(activity,personId);
27 32
     }
28 33
 
29 34
 }

+ 11
- 0
src/main/resources/mapper/TaCheckinMapper.xml View File

@@ -8,6 +8,17 @@
8 8
         ta_checkin
9 9
         WHERE
10 10
         STATUS &lt; 1
11
+        AND activity = #{activity}
12
+    </select>
13
+
14
+    <select id="isCustomerChecked" resultType="com.huiju.estateagents.entity.TaCheckin">
15
+        SELECT
16
+        count(1)
17
+        FROM
18
+        ta_checkin
19
+        WHERE
20
+        activity = #{activity}
21
+        AND person_id = #{personId}
11 22
     </select>
12 23
 
13 24
 </mapper>