Browse Source

getCustomerById

胡轶钦 5 years ago
parent
commit
e5154aaec5

+ 47
- 1
src/main/java/com/huiju/estateagents/controller/TaPointsExchangeController.java View File

5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.huiju.estateagents.base.BaseController;
6
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.ResponseBean;
7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
8
 import com.huiju.estateagents.entity.TaPointsExchange;
9
 import com.huiju.estateagents.entity.TaPointsExchange;
9
 import com.huiju.estateagents.service.ITaPointsExchangeService;
10
 import com.huiju.estateagents.service.ITaPointsExchangeService;
10
 import org.slf4j.Logger;
11
 import org.slf4j.Logger;
44
      */
45
      */
45
     @RequestMapping(value="/admin/taPointsExchange",method= RequestMethod.GET)
46
     @RequestMapping(value="/admin/taPointsExchange",method= RequestMethod.GET)
46
     public ResponseBean taPointsExchangeList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
     public ResponseBean taPointsExchangeList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
-                                             @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
48
+                                             @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
49
+                                             @RequestParam(value ="personName",required = false) String personName,
50
+                                             @RequestParam(value ="phone",required = false) String phone,
51
+                                             @RequestParam(value ="personType",required = false) String personType,
52
+                                             @RequestParam(value ="targetName",required = false) String targetName,
53
+                                             @RequestParam(value ="startCreateDate",required = false) String startCreateDate,
54
+                                             @RequestParam(value ="endCreateDate",required = false) String endCreateDate,
55
+                                             @RequestParam(value ="startVerifyDate",required = false) String startVerifyDate,
56
+                                             @RequestParam(value ="endVerifyDate",required = false) String endVerifyDate,
57
+                                             @RequestParam(value ="status",required = false) Integer status,
58
+                                             @RequestParam(value ="tel",required = false) String tel){
48
         ResponseBean responseBean = new ResponseBean();
59
         ResponseBean responseBean = new ResponseBean();
49
         try {
60
         try {
50
             //使用分页插件
61
             //使用分页插件
51
             TaPointsExchange taPointsExchange = new TaPointsExchange();
62
             TaPointsExchange taPointsExchange = new TaPointsExchange();
63
+            taPointsExchange.setPersonName(personName);
64
+            taPointsExchange.setPhone(phone);
65
+            taPointsExchange.setPersonType(personType);
66
+            taPointsExchange.setTargetName(targetName);
67
+            taPointsExchange.setStartCreateDate(startCreateDate);
68
+            taPointsExchange.setEndCreateDate(endCreateDate);
69
+            taPointsExchange.setStartVerifyDate(startVerifyDate);
70
+            taPointsExchange.setEndVerifyDate(endVerifyDate);
71
+            taPointsExchange.setStatus(status);
72
+            taPointsExchange.setTel(tel);
52
             
73
             
53
             responseBean = iTaPointsExchangeService.selectList(pageNum,pageSize,taPointsExchange);
74
             responseBean = iTaPointsExchangeService.selectList(pageNum,pageSize,taPointsExchange);
54
 
75
 
59
         }
80
         }
60
         return responseBean;
81
         return responseBean;
61
     }
82
     }
83
+    
84
+    /**
85
+     * 修改对象
86
+     * @param taPointsExchange 实体对象
87
+     * @return
88
+     */
89
+    @RequestMapping(value="/admin/taPointsExchange/change",method= RequestMethod.PUT)
90
+    public ResponseBean taPointsExchangeStatusChange(@RequestBody TaPointsExchange taPointsExchange){
91
+        ResponseBean responseBean = new ResponseBean();
92
+        try {
93
+            if (null != taPointsExchange.getStatus() && !taPointsExchange.getStatus().equals(CommConstant.STATUS_NORMAL)){
94
+                taPointsExchange.setStatus(CommConstant.STATUS_NORMAL);
95
+            }
96
+            if (iTaPointsExchangeService.updateById(taPointsExchange)){
97
+                responseBean.addSuccess(taPointsExchange);
98
+            }else {
99
+                responseBean.addError("fail");
100
+            }
101
+        }catch (Exception e){
102
+            e.printStackTrace();
103
+            logger.error("taPointsExchangeUpdate -=- {}",e.toString());
104
+            responseBean.addError(e.getMessage());
105
+        }
106
+        return responseBean;
107
+    }
62
 
108
 
63
     /**
109
     /**
64
      * 保存对象
110
      * 保存对象

+ 18
- 16
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java View File

105
         }
105
         }
106
     }
106
     }
107
 
107
 
108
-    @PostMapping("/customer/recommend")
109
-    public ResponseBean getCustomerList (@RequestParam(value ="name",defaultValue = "false") String name,
110
-                                         @RequestParam(value ="tel",defaultValue = "false") String tel,
111
-                                         @RequestParam(value ="buildingId",defaultValue = "false") String buildingId,
112
-                                         @RequestParam(value ="consultName",defaultValue = "false") String consultName,
113
-                                         @RequestParam(value ="consultTel",defaultValue = "false") String consultTel,
108
+    @GetMapping("/admin/customer/recommend")
109
+    public ResponseBean getCustomerList (@RequestParam(value ="name",required = false) String name,
110
+                                         @RequestParam(value ="tel",required = false) String tel,
111
+                                         @RequestParam(value ="buildingId",required = false) String buildingId,
112
+                                         @RequestParam(value ="consultName",required = false) String consultName,
113
+                                         @RequestParam(value ="consultTel",required = false) String consultTel,
114
                                          @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
114
                                          @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
115
                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
115
                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
116
         try{
116
         try{
121
         }
121
         }
122
     }
122
     }
123
 
123
 
124
-    @PostMapping("/customer/recommend/{customerId}")
125
-    public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize,String customerId){
124
+    @GetMapping("/admin/customer/recommend/{customerId}")
125
+    public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId){
126
         String buildingId="";
126
         String buildingId="";
127
         try{
127
         try{
128
             return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,customerId,buildingId));
128
             return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,customerId,buildingId));
159
      * @param taRecommendCustomer 实体对象
159
      * @param taRecommendCustomer 实体对象
160
      * @return
160
      * @return
161
      */
161
      */
162
-    @RequestMapping(value="/customer/recommend/edit/{id}",method= RequestMethod.PUT)
162
+    @RequestMapping(value="/admin/customer/recommend/edit/{id}",method= RequestMethod.PUT)
163
     public ResponseBean taRecommendCustomerUpdate(@PathVariable String id,
163
     public ResponseBean taRecommendCustomerUpdate(@PathVariable String id,
164
             @RequestBody TaRecommendCustomer taRecommendCustomer){
164
             @RequestBody TaRecommendCustomer taRecommendCustomer){
165
         ResponseBean responseBean = new ResponseBean();
165
         ResponseBean responseBean = new ResponseBean();
177
         return responseBean;
177
         return responseBean;
178
     }
178
     }
179
 
179
 
180
-    @RequestMapping(value = "/wx/customer/recommend/get/{id}")
181
-    public ResponseBean getSingleCustomer(String customerId) {
180
+    @RequestMapping(value = "/wx/customer/recommend/get/{id}", method = RequestMethod.GET)
181
+    public ResponseBean getSingleCustomer(@PathVariable(value = "id") String customerId) {
182
         ResponseBean responseBean = new ResponseBean();
182
         ResponseBean responseBean = new ResponseBean();
183
         try {
183
         try {
184
             responseBean.addSuccess(taRecommendCustomerService.getById(customerId));
184
             responseBean.addSuccess(taRecommendCustomerService.getById(customerId));
189
         return responseBean;
189
         return responseBean;
190
     }
190
     }
191
 
191
 
192
-    @RequestMapping(value = "/customer/recommend/{id}")
193
-    public ResponseBean getCustomerById(String customerId) {
192
+
193
+    @RequestMapping(value = "/admin/customer/recommend/getById/{id}", method = RequestMethod.GET)
194
+    public ResponseBean getRecommendCustomerById(@PathVariable(value = "id") String customerId) {
194
         ResponseBean responseBean = new ResponseBean();
195
         ResponseBean responseBean = new ResponseBean();
195
         try {
196
         try {
196
             responseBean.addSuccess(taRecommendCustomerService.getCustomerById(customerId));
197
             responseBean.addSuccess(taRecommendCustomerService.getCustomerById(customerId));
201
         return responseBean;
202
         return responseBean;
202
     }
203
     }
203
 
204
 
204
-    @RequestMapping(value = "/customer/recommend/get/{id}")
205
-    public ResponseBean getCutomerDetail(String id) {
205
+
206
+    @GetMapping(value = "/admin/customer/recommend/get/{id}")
207
+    public ResponseBean getCutomerDetail(@PathVariable String id) {
206
         ResponseBean responseBean = new ResponseBean();
208
         ResponseBean responseBean = new ResponseBean();
207
         try {
209
         try {
208
             responseBean.addSuccess(taRecommendCustomerService.getCustomerDetail(id));
210
             responseBean.addSuccess(taRecommendCustomerService.getCustomerDetail(id));
213
         return responseBean;
215
         return responseBean;
214
     }
216
     }
215
 
217
 
216
-    @PostMapping("/customer/recommend/drift")
218
+    @GetMapping("/admin/customer/recommend/drift")
217
     public ResponseBean getDriftCustomerList (@RequestParam(value ="buildingId",defaultValue = "false") String buildingId,
219
     public ResponseBean getDriftCustomerList (@RequestParam(value ="buildingId",defaultValue = "false") String buildingId,
218
                                          @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
220
                                          @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
219
                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
221
                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){

+ 3
- 0
src/main/java/com/huiju/estateagents/entity/TaPointsExchange.java View File

120
     
120
     
121
     @TableField(exist = false)
121
     @TableField(exist = false)
122
     private String endVerifyDate;
122
     private String endVerifyDate;
123
+    
124
+    @TableField(exist = false)
125
+    private String tel;
123
 }
126
 }

+ 2
- 1
src/main/java/com/huiju/estateagents/mapper/TaPointsExchangeMapper.java View File

4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.huiju.estateagents.entity.TaPointsExchange;
5
 import com.huiju.estateagents.entity.TaPointsExchange;
6
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
7
 
8
 
8
 import java.util.List;
9
 import java.util.List;
9
 
10
 
18
 @Mapper
19
 @Mapper
19
 public interface TaPointsExchangeMapper extends BaseMapper<TaPointsExchange> {
20
 public interface TaPointsExchangeMapper extends BaseMapper<TaPointsExchange> {
20
 	
21
 	
21
-	List<TaPointsExchange> selectListByParams(Page page, TaPointsExchange taPointsExchange);
22
+	List<TaPointsExchange> selectListByParams(Page page,@Param("taPointsExchange") TaPointsExchange taPointsExchange);
22
 }
23
 }

+ 31
- 0
src/main/resources/mapper/TaPointsExchangeMapper.xml View File

24
         FROM
24
         FROM
25
             ta_points_exchange t
25
             ta_points_exchange t
26
             LEFT JOIN ta_person p ON t.person_id = p.person_id
26
             LEFT JOIN ta_person p ON t.person_id = p.person_id
27
+        where 1=1
28
+        <if test="taPointsExchange.status != null and taPointsExchange.status != '' or taPointsExchange.status ==0">
29
+            and  t.`status` = #{taPointsExchange.status}
30
+        </if>
31
+        <if test="taPointsExchange.personName != null and taPointsExchange.personName != ''">
32
+            and  t.person_name like concat('%',#{taPointsExchange.personName},'%')
33
+        </if>
34
+        <if test="taPointsExchange.phone != null and taPointsExchange.phone != ''">
35
+            and  t.phone like concat('%',#{taPointsExchange.phone},'%')
36
+        </if>
37
+        <if test="taPointsExchange.tel != null and taPointsExchange.tel != ''">
38
+            and  t.phone = #{taPointsExchange.tel}
39
+        </if>
40
+        <if test="taPointsExchange.personType != null and taPointsExchange.personType != ''">
41
+            and  p.person_type = #{taPointsExchange.personType}
42
+        </if>
43
+        <if test="taPointsExchange.targetName != null and taPointsExchange.targetName != ''">
44
+            and  t.target_name like concat('%',#{taPointsExchange.targetName},'%')
45
+        </if>
46
+        <if test="taPointsExchange.startCreateDate != null and taPointsExchange.startCreateDate != ''">
47
+            and  date_format(t.create_date,'%Y-%m-%d') >= date_format(#{taPointsExchange.startCreateDate},'%Y-%m-%d')
48
+        </if>
49
+        <if test="taPointsExchange.endCreateDate != null and taPointsExchange.endCreateDate != ''">
50
+            and  date_format(t.create_date,'%Y-%m-%d') &lt;= date_format(#{taPointsExchange.endCreateDate},'%Y-%m-%d')
51
+        </if>
52
+        <if test="taPointsExchange.startVerifyDate != null and taPointsExchange.startVerifyDate != ''">
53
+            and  date_format(t.verify_date,'%Y-%m-%d') >= date_format(#{taPointsExchange.startVerifyDate},'%Y-%m-%d')
54
+        </if>
55
+        <if test="taPointsExchange.endVerifyDate != null and taPointsExchange.endVerifyDate != ''">
56
+            and  date_format(t.verify_date,'%Y-%m-%d') &lt;= date_format(#{taPointsExchange.startVerifyDate},'%Y-%m-%d')
57
+        </if>
27
     </select>
58
     </select>
28
 </mapper>
59
 </mapper>