weiximei hace 6 años
padre
commit
100e88f09d

+ 51
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java Ver fichero

@@ -0,0 +1,51 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.huiju.config.entity.UserElement;
6
+import com.community.huiju.model.TaUser;
7
+import com.community.huiju.model.TpTicket;
8
+import com.community.huiju.service.ITicketService;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiImplicitParam;
11
+import io.swagger.annotations.ApiImplicitParams;
12
+import io.swagger.annotations.ApiOperation;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.cloud.context.config.annotation.RefreshScope;
15
+import org.springframework.web.bind.annotation.*;
16
+
17
+import javax.servlet.http.HttpSession;
18
+
19
+@RestController
20
+@RefreshScope
21
+@RequestMapping("/")
22
+@Api("工单API")
23
+public class TicketController {
24
+
25
+    @Autowired
26
+    private ITicketService iTicketService;
27
+
28
+    @RequestMapping(value = "/ticket/service/{communityId}",method = RequestMethod.GET)
29
+    @ApiOperation(value = "获取 报修/投诉/联系单 各3条数据",notes = "根据 小区编号,第几页,一页多少行")
30
+    @ApiImplicitParams({
31
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "communityId",value = "小区编号"),
32
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "pageCode",value = "第几页"),
33
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "pageSize",value = "一页多少数据"),
34
+    })
35
+    public ResponseBean getService(@PathVariable(value = "communityId") String communityId,
36
+                                   @RequestParam(value = "pageCode",defaultValue = "1") Integer pageCode,
37
+                                   @RequestParam(value = "pageSize",defaultValue = "3") Integer pageSize,
38
+                                   HttpSession session) {
39
+        ResponseBean response = new ResponseBean();
40
+
41
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
42
+
43
+        TpTicket tpTicket = new TpTicket();
44
+        tpTicket.setCommunityId(Integer.valueOf(communityId));
45
+        tpTicket.setTaUserId(userElement.getId());
46
+
47
+        response = iTicketService.getList(tpTicket,pageCode,pageSize);
48
+        return response;
49
+    }
50
+
51
+}

+ 3
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java Ver fichero

@@ -15,8 +15,10 @@ public interface ITicketService {
15 15
     /**
16 16
      * 根据 小区ID 用户ID 类型 查询数据
17 17
      * @param tpTicket
18
+     * @param pageCode
19
+     * @param pageSize
18 20
      * @return
19 21
      */
20
-    ResponseBean getList(TpTicket tpTicket);
22
+    ResponseBean getList(TpTicket tpTicket,Integer pageCode, Integer pageSize);
21 23
 
22 24
 }

+ 53
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java Ver fichero

@@ -5,8 +5,11 @@ import com.community.huiju.dao.TpTicketMapper;
5 5
 import com.community.huiju.model.TpTicket;
6 6
 import com.community.huiju.service.ITicketService;
7 7
 import com.community.huiju.vo.TpTicketVO;
8
+import com.github.pagehelper.PageHelper;
9
+import com.google.common.collect.Lists;
8 10
 import com.google.common.collect.Maps;
9 11
 import lombok.extern.slf4j.Slf4j;
12
+import org.springframework.beans.BeanUtils;
10 13
 import org.springframework.beans.factory.annotation.Autowired;
11 14
 import org.springframework.stereotype.Service;
12 15
 
@@ -14,6 +17,7 @@ import java.util.List;
14 17
 import java.util.Map;
15 18
 
16 19
 /**
20
+ * 工单业务 实现
17 21
  * @author weiximei
18 22
  */
19 23
 @Service("iTicketService")
@@ -24,14 +28,59 @@ public class TicketServiceImpl implements ITicketService {
24 28
     private TpTicketMapper tpTicketMapper;
25 29
 
26 30
     @Override
27
-    public ResponseBean getList(TpTicket tpTicket) {
31
+    public ResponseBean getList(TpTicket tpTicket,Integer pageCode, Integer pageSize) {
32
+
33
+        ResponseBean<Map<String,Object>> responseBean = new ResponseBean();
34
+        Map<String,Object> result = Maps.newHashMap();
28 35
 
29 36
         Map<String,Object> parameter = Maps.newHashMap();
30 37
         parameter.put("communityId",tpTicket.getCommunityId());
31 38
         parameter.put("taUserId",tpTicket.getTaUserId());
32
-        parameter.put("type",tpTicket.getType());
33
-        List<TpTicket> tpTicketList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
39
+        //  0 代表 报修  1 代表 投诉  2代表 联系单
40
+        parameter.put("type",0);
41
+
42
+        // 报修
43
+        PageHelper.startPage(pageCode,pageSize);
44
+        List<TpTicket> tpTicketRepairsList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
45
+
46
+        List<TpTicketVO> repairsList = Lists.newArrayList();
47
+        tpTicketRepairsList.stream().forEach(e->{
48
+            TpTicketVO tpTicketVO = new TpTicketVO();
49
+            BeanUtils.copyProperties(e,tpTicketVO);
50
+            repairsList.add(tpTicketVO);
51
+        });
52
+
53
+        // 投诉
54
+        //  0 代表 报修  1 代表 投诉  2代表 联系单
55
+        parameter.put("type",1);
56
+        PageHelper.startPage(pageCode,pageSize);
57
+        List<TpTicket> tpTicketComplaintList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
58
+
59
+        List<TpTicketVO> complaintList = Lists.newArrayList();
60
+        tpTicketComplaintList.stream().forEach(e->{
61
+            TpTicketVO tpTicketVO = new TpTicketVO();
62
+            BeanUtils.copyProperties(e,tpTicketVO);
63
+            complaintList.add(tpTicketVO);
64
+        });
65
+
66
+        // 联系工单
67
+        //  0 代表 报修  1 代表 投诉  2代表 联系单
68
+        parameter.put("type",2);
69
+        PageHelper.startPage(pageCode,pageSize);
70
+        List<TpTicket> tpTicketLiaisonList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
71
+
72
+        List<TpTicketVO> liaisonList = Lists.newArrayList();
73
+        tpTicketLiaisonList.stream().forEach(e->{
74
+            TpTicketVO tpTicketVO = new TpTicketVO();
75
+            BeanUtils.copyProperties(e,tpTicketVO);
76
+            liaisonList.add(tpTicketVO);
77
+        });
78
+
79
+        result.put("repairs",repairsList);
80
+        result.put("complaint",complaintList);
81
+        result.put("liaison",liaisonList);
34 82
 
35
-        return null;
83
+        responseBean.addSuccess(result);
84
+        return responseBean;
36 85
     }
37 86
 }

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class Ver fichero