|
@@ -7,9 +7,8 @@ import com.yunzhi.shigongli.common.BaseController;
|
7
|
7
|
import com.yunzhi.shigongli.common.Constants;
|
8
|
8
|
import com.yunzhi.shigongli.common.ResponseBean;
|
9
|
9
|
import com.yunzhi.shigongli.entity.TaResource;
|
10
|
|
-import com.yunzhi.shigongli.service.ITaImageService;
|
11
|
|
-import com.yunzhi.shigongli.service.ITaResourceService;
|
12
|
|
-import com.yunzhi.shigongli.service.ITaTargetTypeService;
|
|
10
|
+import com.yunzhi.shigongli.entity.TaSave;
|
|
11
|
+import com.yunzhi.shigongli.service.*;
|
13
|
12
|
import com.yunzhi.shigongli.vo.ResourceFieldVO;
|
14
|
13
|
import io.swagger.annotations.Api;
|
15
|
14
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -23,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
23
|
22
|
import org.springframework.web.bind.annotation.RequestMapping;
|
24
|
23
|
import org.springframework.web.bind.annotation.RequestMethod;
|
25
|
24
|
import org.springframework.web.bind.annotation.RequestParam;
|
26
|
|
-import com.yunzhi.shigongli.service.ITaTouristService;
|
27
|
25
|
import com.yunzhi.shigongli.entity.TaTourist;
|
28
|
26
|
import org.springframework.web.bind.annotation.RestController;
|
29
|
27
|
|
|
@@ -55,6 +53,9 @@ public class TaTouristController extends BaseController {
|
55
|
53
|
@Autowired
|
56
|
54
|
public ITaTargetTypeService taTargetTypeService;
|
57
|
55
|
|
|
56
|
+ @Autowired
|
|
57
|
+ public ITaSaveService iTaSaveService;
|
|
58
|
+
|
58
|
59
|
|
59
|
60
|
/**
|
60
|
61
|
* 分页查询列表
|
|
@@ -139,10 +140,38 @@ public class TaTouristController extends BaseController {
|
139
|
140
|
* 根据id查询对象
|
140
|
141
|
* @param id 实体ID
|
141
|
142
|
*/
|
142
|
|
- @RequestMapping(value="/{plat}/taTourist/{id}",method= RequestMethod.GET)
|
|
143
|
+ @RequestMapping(value="/admin/taTourist/{id}",method= RequestMethod.GET)
|
|
144
|
+ @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
|
|
145
|
+ public ResponseBean taTouristGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
|
146
|
+ TaTourist taTourist = iTaTouristService.getById(id);
|
|
147
|
+ if (Constants.STATUS_DELETED.equals(taTourist.getStatus())) {
|
|
148
|
+ return ResponseBean.error("景点不存在", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
149
|
+ }
|
|
150
|
+
|
|
151
|
+ TaResource taResource = taResourceService.getByTarget(Constants.TARGET_TOURIST, id);
|
|
152
|
+ taTourist.setPvNum(taResource.getPvNum());
|
|
153
|
+ taTourist.setUvNum(taResource.getUvNum());
|
|
154
|
+ taTourist.setLikeNum(taResource.getLikeNum());
|
|
155
|
+ taTourist.setImageList(iTaImageService.getListBy(Constants.TARGET_TOURIST, id));
|
|
156
|
+ taTourist.setTypeList(taTargetTypeService.getListBy(Constants.TARGET_TOURIST, id));
|
|
157
|
+
|
|
158
|
+ try {
|
|
159
|
+ taResourceService.recordPerson(Constants.TARGET_TOURIST, id, getCurrentPerson());
|
|
160
|
+ } catch (Exception e) {
|
|
161
|
+ e.printStackTrace();
|
|
162
|
+ }
|
|
163
|
+
|
|
164
|
+ return ResponseBean.success(taTourist);
|
|
165
|
+ }
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+ /**
|
|
169
|
+ * 根据id查询对象
|
|
170
|
+ * @param id 实体ID
|
|
171
|
+ */
|
|
172
|
+ @RequestMapping(value="/admin/tourist/{id}",method= RequestMethod.GET)
|
143
|
173
|
@ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
|
144
|
|
- public ResponseBean taTouristGet(@ApiParam(value = "客户端", allowableValues = "wx,admin") @PathVariable String plat,
|
145
|
|
- @ApiParam("对象ID") @PathVariable String id) throws Exception{
|
|
174
|
+ public ResponseBean getWxDetail(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
146
|
175
|
TaTourist taTourist = iTaTouristService.getById(id);
|
147
|
176
|
if (Constants.STATUS_DELETED.equals(taTourist.getStatus())) {
|
148
|
177
|
return ResponseBean.error("景点不存在", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
@@ -155,12 +184,14 @@ public class TaTouristController extends BaseController {
|
155
|
184
|
taTourist.setImageList(iTaImageService.getListBy(Constants.TARGET_TOURIST, id));
|
156
|
185
|
taTourist.setTypeList(taTargetTypeService.getListBy(Constants.TARGET_TOURIST, id));
|
157
|
186
|
|
158
|
|
- if ("wx".equals(plat)) {
|
159
|
|
- try {
|
160
|
|
- taResourceService.recordPerson(Constants.TARGET_TOURIST, id, getCurrentPerson());
|
161
|
|
- } catch (Exception e) {
|
162
|
|
- e.printStackTrace();
|
163
|
|
- }
|
|
187
|
+ // 是否收藏
|
|
188
|
+ TaSave taSave = iTaSaveService.getByTarget(Constants.TARGET_TOURIST, id, getCurrentPerson().getPersonId());
|
|
189
|
+ taTourist.setIsSaved(null == taSave ? 0 : 1);
|
|
190
|
+
|
|
191
|
+ try {
|
|
192
|
+ taResourceService.recordPerson(Constants.TARGET_TOURIST, id, getCurrentPerson());
|
|
193
|
+ } catch (Exception e) {
|
|
194
|
+ e.printStackTrace();
|
164
|
195
|
}
|
165
|
196
|
|
166
|
197
|
return ResponseBean.success(taTourist);
|