|
@ -8,22 +8,15 @@ import com.yihu.jw.entity.adv.AdvertisementPuttingAdminDO;
|
|
import com.yihu.jw.restmodel.advertisement.AdvertisementPuttingAdminVO;
|
|
import com.yihu.jw.restmodel.advertisement.AdvertisementPuttingAdminVO;
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.rm.adv.AdvsementMapping;
|
|
import com.yihu.jw.rm.adv.AdvsementMapping;
|
|
|
|
|
|
import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.MediaType;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@ -42,23 +35,21 @@ public class AdvertisementPuttingAdminEndPoint extends EnvelopRestEndpoint {
|
|
if (id==null||"".equals(id)){
|
|
if (id==null||"".equals(id)){
|
|
return "请确认该广告是否存在!";
|
|
return "请确认该广告是否存在!";
|
|
}
|
|
}
|
|
System.out.println(id);
|
|
|
|
String str=advrtisementService.updateDelStatus(id);
|
|
String str=advrtisementService.updateDelStatus(id);
|
|
System.out.println(str);
|
|
|
|
return str;
|
|
return str;
|
|
|
|
|
|
}
|
|
}
|
|
// @GetMapping(value = "/single")
|
|
|
|
// @ApiOperation(value = "获取单条广告信息")
|
|
|
|
// public Envelop doctorHosplist(
|
|
|
|
// @ApiParam(name = "id", value = "广告id")
|
|
|
|
// @RequestParam(value = "id", required = true) String doctorId) throws Exception {
|
|
|
|
// JSONObject jsonObject = advrtisementService.getOneDoctorInfo(doctorId);
|
|
|
|
// if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
|
|
|
|
// return failed(jsonObject.getString("msg"));
|
|
|
|
// }
|
|
|
|
// return success(jsonObject.getJSONObject("msg"));
|
|
|
|
// }
|
|
|
|
|
|
@GetMapping(value = "/single")
|
|
|
|
@ApiOperation(value = "获取单条广告信息")
|
|
|
|
public Envelop doctorHosplist(
|
|
|
|
@ApiParam(name = "id", value = "广告id")
|
|
|
|
@RequestParam(value = "id", required = true) String doctorId) throws Exception {
|
|
|
|
JSONObject jsonObject = advrtisementService.getOneAdvInfo(doctorId);
|
|
|
|
if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
|
|
|
|
return failed(jsonObject.getString("msg"));
|
|
|
|
}
|
|
|
|
return success(jsonObject.getJSONObject("msg"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = AdvsementMapping.AdvsementReusetMapping.LAUNCHADVERTISEMENT )
|
|
@GetMapping(value = AdvsementMapping.AdvsementReusetMapping.LAUNCHADVERTISEMENT )
|
|
@ -72,7 +63,7 @@ public class AdvertisementPuttingAdminEndPoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
@GetMapping(value = AdvsementMapping.AdvsementReusetMapping.FORBIDDENADVERTISEMENT)
|
|
@GetMapping(value = AdvsementMapping.AdvsementReusetMapping.FORBIDDENADVERTISEMENT)
|
|
@ApiOperation(value = "禁用广告")
|
|
@ApiOperation(value = "禁用广告")
|
|
public String forbiddenAdverisement(@RequestParam String id){
|
|
|
|
|
|
public String forbiddenAdvertisement(@RequestParam String id){
|
|
if (id==null||"".equals(id)){
|
|
if (id==null||"".equals(id)){
|
|
return "请确认广告是否存在";
|
|
return "请确认广告是否存在";
|
|
}
|
|
}
|
|
@ -80,30 +71,20 @@ public class AdvertisementPuttingAdminEndPoint extends EnvelopRestEndpoint {
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping(value = AdvsementMapping.AdvsementReusetMapping.SENDADVERTISEMENT)
|
|
@PostMapping(value = AdvsementMapping.AdvsementReusetMapping.SENDADVERTISEMENT)
|
|
@ApiOperation(value = "新增广告")
|
|
|
|
public ObjEnvelop<AdvertisementPuttingAdminVO> sendAdvertisement(
|
|
|
|
@ApiParam(name = "json_data", value = "Json数据", required = true)
|
|
|
|
@RequestBody String jsonData) throws Exception {
|
|
|
|
AdvertisementPuttingAdminDO adminDO=toEntity(jsonData,AdvertisementPuttingAdminDO.class);
|
|
|
|
advrtisementService.save(adminDO);
|
|
|
|
return success(adminDO,AdvertisementPuttingAdminVO.class);
|
|
|
|
|
|
@ApiOperation(value = "新增/更新广告")
|
|
|
|
public Envelop sendAdvertisement(
|
|
|
|
@ApiParam(name = "jsonData", value = "Json数据", required = true)
|
|
|
|
@RequestParam String jsonData) throws Exception {
|
|
|
|
try {
|
|
|
|
AdvertisementPuttingAdminDO adminDO=advrtisementService.saveAdv(jsonData);
|
|
|
|
return success("操作成功",adminDO);
|
|
|
|
} catch (Exception e) {
|
|
|
|
return failedException(e);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = AdvsementMapping.AdvsementReusetMapping.UPDATE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
|
@ApiOperation(value = "更新广告")
|
|
|
|
public ObjEnvelop<AdvertisementPuttingAdminVO> update(
|
|
|
|
@ApiParam(name = "json_data",value = "json数据",required = true)
|
|
|
|
@RequestBody String jsonData) throws IOException {
|
|
|
|
AdvertisementPuttingAdminDO adminDO=toEntity(jsonData,AdvertisementPuttingAdminDO.class);
|
|
|
|
if (null == adminDO.getId()||"".equals(adminDO.getId())) {
|
|
|
|
return failed("ID不能为空", ObjEnvelop.class);
|
|
|
|
}
|
|
|
|
adminDO=advrtisementService.save(adminDO);
|
|
|
|
return success(adminDO,AdvertisementPuttingAdminVO.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = AdvsementMapping.AdvsementReusetMapping.SEL)
|
|
@GetMapping(value = AdvsementMapping.AdvsementReusetMapping.SEL)
|
|
@ApiOperation(value = "获取分页")
|
|
@ApiOperation(value = "获取分页")
|
|
public PageEnvelop<AdvertisementPuttingAdminVO> page (
|
|
public PageEnvelop<AdvertisementPuttingAdminVO> page (
|
|
@ -121,33 +102,11 @@ public class AdvertisementPuttingAdminEndPoint extends EnvelopRestEndpoint {
|
|
int count = (int)advrtisementService.getCount(filters);
|
|
int count = (int)advrtisementService.getCount(filters);
|
|
return success(list, count, page, size, AdvertisementPuttingAdminVO.class);
|
|
return success(list, count, page, size, AdvertisementPuttingAdminVO.class);
|
|
}
|
|
}
|
|
// public List<AdvertisementPuttingAdminDO>findLike(
|
|
|
|
// @ApiParam(name = "title",value = "模糊查询",required = false)
|
|
|
|
// @RequestParam(value = "title",required = false) String title,
|
|
|
|
// @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
|
// @RequestParam(value = "page") int page,
|
|
|
|
// @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
|
// @RequestParam(value = "size") int size){
|
|
|
|
// if (title==null){
|
|
|
|
// return advrtisementService.findAllAdvertisement((page-1)*size,size);
|
|
|
|
// }
|
|
|
|
// return advrtisementService.titleLike(title,(page-1)*size,size);
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = AdvsementMapping.AdvsementReusetMapping.SELECTLike)
|
|
@GetMapping(value = AdvsementMapping.AdvsementReusetMapping.SELECTLike)
|
|
@ApiOperation(value = "获取列表")
|
|
@ApiOperation(value = "获取列表")
|
|
// public List<AdvertisementPuttingAdminDO>findLikeCan(
|
|
|
|
// @ApiParam(name = "title",value = "模糊查询",required = false,defaultValue = "")
|
|
|
|
// @RequestParam(value = "title",required = false) String title,
|
|
|
|
// @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
|
// @RequestParam(value = "page") int page,
|
|
|
|
// @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
|
// @RequestParam(value = "size") int size) {
|
|
|
|
// if (title==null){
|
|
|
|
// return advrtisementService.findAdvertisementList((page-1)*size,size);
|
|
|
|
// }
|
|
|
|
// return advrtisementService.titleLikeAndCan(title,(page-1)*size,size);
|
|
|
|
// }
|
|
|
|
|
|
|
|
public ListEnvelop<AdvertisementPuttingAdminVO> page(
|
|
public ListEnvelop<AdvertisementPuttingAdminVO> page(
|
|
@ApiParam(name = "fields",value = "返回的字段,为空返回全部字段")
|
|
@ApiParam(name = "fields",value = "返回的字段,为空返回全部字段")
|
|
@RequestParam(value = "fields",required = false)String fields,
|
|
@RequestParam(value = "fields",required = false)String fields,
|
|
@ -156,15 +115,7 @@ public class AdvertisementPuttingAdminEndPoint extends EnvelopRestEndpoint {
|
|
@ApiParam(name = "sorts",value = "排序,规则参见说明文档")
|
|
@ApiParam(name = "sorts",value = "排序,规则参见说明文档")
|
|
@RequestParam(value = "sorts",required = false)String sorts) throws ParseException {
|
|
@RequestParam(value = "sorts",required = false)String sorts) throws ParseException {
|
|
List<AdvertisementPuttingAdminDO>list=advrtisementService.search(fields,filters,sorts);
|
|
List<AdvertisementPuttingAdminDO>list=advrtisementService.search(fields,filters,sorts);
|
|
return success(list,AdvertisementPuttingAdminVO.class);
|
|
|
|
|
|
return success(list, AdvertisementPuttingAdminVO.class);
|
|
}
|
|
}
|
|
|
|
|
|
// @GetMapping(value = "/play")
|
|
|
|
// @ApiOperation(value = "播放设置")
|
|
|
|
// public String updatePlay(@ApiParam(value = "play_id")
|
|
|
|
// @RequestParam(value = "play_id") int playId){
|
|
|
|
// advrtisementService.updatePlay(playId);
|
|
|
|
// return "设置成功";
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
}
|