|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.huiju.estateagents.base.BaseController;
|
7
|
7
|
import com.huiju.estateagents.base.ResponseBean;
|
|
8
|
+import com.huiju.estateagents.common.CommConstant;
|
8
|
9
|
import com.huiju.estateagents.entity.TaShareContent;
|
9
|
10
|
import com.huiju.estateagents.service.TaShareContentService;
|
10
|
11
|
import org.slf4j.Logger;
|
|
@@ -18,6 +19,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
18
|
19
|
import org.springframework.web.bind.annotation.ResponseBody;
|
19
|
20
|
import org.springframework.web.bind.annotation.RestController;
|
20
|
21
|
|
|
22
|
+import javax.servlet.http.HttpServletRequest;
|
|
23
|
+import java.time.LocalDateTime;
|
|
24
|
+
|
21
|
25
|
/**
|
22
|
26
|
* <p>
|
23
|
27
|
* 前端控制器
|
|
@@ -27,7 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
|
27
|
31
|
* @since 2019-09-21
|
28
|
32
|
*/
|
29
|
33
|
@RestController
|
30
|
|
-@RequestMapping("/")
|
|
34
|
+@RequestMapping("/api")
|
31
|
35
|
public class TaShareContentController extends BaseController {
|
32
|
36
|
|
33
|
37
|
private final Logger logger = LoggerFactory.getLogger(TaShareContentController.class);
|
|
@@ -67,10 +71,13 @@ public class TaShareContentController extends BaseController {
|
67
|
71
|
* @param shareContent 实体对象
|
68
|
72
|
* @return
|
69
|
73
|
*/
|
70
|
|
- @RequestMapping(value="/shareContent",method= RequestMethod.POST)
|
71
|
|
- public ResponseBean shareContentAdd(@RequestBody TaShareContent shareContent){
|
|
74
|
+ @RequestMapping(value="/admin/shareContent",method= RequestMethod.POST)
|
|
75
|
+ public ResponseBean shareContentAdd(@RequestBody TaShareContent shareContent, HttpServletRequest request){
|
72
|
76
|
ResponseBean responseBean = new ResponseBean();
|
73
|
77
|
try {
|
|
78
|
+ shareContent.setStatus(CommConstant.STATUS_NORMAL);
|
|
79
|
+ shareContent.setOrgId(getOrgId(request));
|
|
80
|
+ shareContent.setCreateDate(LocalDateTime.now());
|
74
|
81
|
if (iShareContentService.save(shareContent)){
|
75
|
82
|
responseBean.addSuccess(shareContent);
|
76
|
83
|
}else {
|
|
@@ -112,10 +119,11 @@ public class TaShareContentController extends BaseController {
|
112
|
119
|
* @param shareContent 实体对象
|
113
|
120
|
* @return
|
114
|
121
|
*/
|
115
|
|
- @RequestMapping(value="/shareContent/{id}",method= RequestMethod.PUT)
|
|
122
|
+ @RequestMapping(value="/admin/shareContent/{id}",method= RequestMethod.PUT)
|
116
|
123
|
public ResponseBean shareContentUpdate(@PathVariable Integer id,
|
117
|
124
|
@RequestBody TaShareContent shareContent){
|
118
|
125
|
ResponseBean responseBean = new ResponseBean();
|
|
126
|
+ shareContent.setShareContentId(id);
|
119
|
127
|
try {
|
120
|
128
|
if (iShareContentService.updateById(shareContent)){
|
121
|
129
|
responseBean.addSuccess(shareContent);
|
|
@@ -131,14 +139,13 @@ public class TaShareContentController extends BaseController {
|
131
|
139
|
}
|
132
|
140
|
|
133
|
141
|
/**
|
134
|
|
- * 根据id查询对象
|
135
|
|
- * @param id 实体ID
|
|
142
|
+ * 查询对象
|
136
|
143
|
*/
|
137
|
|
- @RequestMapping(value="/shareContent/{id}",method= RequestMethod.GET)
|
138
|
|
- public ResponseBean shareContentGet(@PathVariable Integer id){
|
|
144
|
+ @RequestMapping(value="/admin/shareContent",method= RequestMethod.GET)
|
|
145
|
+ public ResponseBean shareContentGet(@RequestParam String targetId,@RequestParam String targetType ){
|
139
|
146
|
ResponseBean responseBean = new ResponseBean();
|
140
|
147
|
try {
|
141
|
|
- responseBean.addSuccess(iShareContentService.getById(id));
|
|
148
|
+ responseBean.addSuccess(iShareContentService.getPostersForTarget(targetId,targetType));
|
142
|
149
|
}catch (Exception e){
|
143
|
150
|
e.printStackTrace();
|
144
|
151
|
logger.error("shareContentDelete -=- {}",e.toString());
|