package com.steerinfo.dil.controller; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.model.DilNotice; import com.steerinfo.dil.service.IDilNoticeService; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.PageListAdd; import com.steerinfo.framework.controller.RESTfulResult; import com.steerinfo.framework.service.pagehelper.PageHelper; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; /** * DilNotice RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-12-08 02:21 * 类描述 * 修订历史: * 日期:2021-12-08 * 作者:generator * 参考: * 描述:DilNotice RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/dilnotices") public class DilNoticeController extends BaseRESTfulController { @Autowired IDilNoticeService dilNoticeService; @Autowired ColumnDataUtil columnDataUtil; @Autowired ESFeign esFeign; /** * 展示公告信息 * @param mapVal * @param pageNum * @param pageSize * @param apiId * @return */ @ApiOperation(value="获取列表", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "359", required = false, dataType = "BigDecimal"), }) //获取整个的通知日期,标题,发布人 @PostMapping(value = "/getNoticeList") public RESTfulResult getNoticeList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId){ PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = dilNoticeService.getNoticeList(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList); return success(data); } @ApiOperation(value="获取销售公司通知列表", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "414", required = false, dataType = "BigDecimal"), }) //获取整个的通知日期,标题,发布人 @PostMapping(value = "/getMarketingNoticeList") public RESTfulResult getMarketingNoticeList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId,String con){ PageHelper.startPage(pageNum, pageSize); //分页查询数据 if (con!=null&&!(con.equals("undefined"))){ mapVal.put("con", "%" + con + "%"); } List> columnList = dilNoticeService.getMarketingNoticeList(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList); return success(data); } @ApiOperation(value="获取承运商通知列表", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "414", required = false, dataType = "BigDecimal"), }) //获取整个的通知日期,标题,发布人 @PostMapping(value = "/getCarrierNoticeList") public RESTfulResult getCarrierNoticeList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, String con){ PageHelper.startPage(pageNum, pageSize); //分页查询数据 if (con!=null&&!(con.equals("undefined"))){ mapVal.put("con", "%" + con + "%"); } List> columnList = dilNoticeService.getCarrierNoticeList(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList); return success(data); } @ApiOperation(value="获取收获客户通知列表", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "414", required = false, dataType = "BigDecimal"), }) //获取整个的通知日期,标题,发布人 @PostMapping(value = "/getClientNoticeList") public RESTfulResult getClientNoticeList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, String con){ PageHelper.startPage(pageNum, pageSize); //分页查询数据 if (con!=null&&!(con.equals("undefined"))){ mapVal.put("con", "%" + con + "%"); } List> columnList = dilNoticeService.getClientNoticeList(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList); return success(data); } /** * 创建通知信息 * @param dilNotice * @return */ @ApiOperation(value="创建", notes="根据DilNotice对象创建") @ApiImplicitParam(name = "dilNotice", value = "详细实体dilNotice", required = true, dataType = "DilNotice") @PostMapping(value = "/insertNotice") public RESTfulResult insertNotice(@RequestBody DilNotice dilNotice){ int result = dilNoticeService.insertNotice(dilNotice); return success(result); } /** * @author:zyf * @version:1.0 * @Date:2022-09-26 * @Description:发布通知 */ @ApiOperation(value="发布通知", notes="根据DilNotice对象发布通知") @ApiImplicitParam(name = "dilNotice", value = "详细实体dilNotice", required = true, dataType = "DilNotice") @PostMapping(value = "/releaseNotice") public RESTfulResult releaseNotice(@RequestBody DilNotice dilNotice){ int result = dilNoticeService.releaseNotice(dilNotice); if (result==0){ return failed("失败"); } return success(result); } /** * 根据id更新通知信息 * @param dilNotice * @return */ @ApiOperation(value="更新通知信息", notes="根据url的id来指定更新对象,并根据传过来的dilNotice信息来更新详细信息") @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short"), @ApiImplicitParam(name = "dilNotice", value = "详细实体dilNotice", required = true, dataType = "DilNotice") }) @PostMapping(value = "/updateNotice", produces = "application/json;charset=UTF-8") public RESTfulResult updateNotice( @RequestBody DilNotice dilNotice){ int result = dilNoticeService.updateNotice(dilNotice); return success(result); } @PostMapping(value = "/updateNoticeStatus") public RESTfulResult updateNoticeStatus(@RequestBody(required = false) Map map){ String userId = (String) map.get("userId"); int noticeId= (int) map.get("noticeId"); int result = dilNoticeService.updateNoticeStatus(userId,noticeId); return success(result); } @PostMapping(value = "/readAll") public RESTfulResult readAll(@RequestBody(required = false) Map map){ int result = dilNoticeService.readAll(map); return success(result); } /** * 根据id删除通知信息 * @param id * @return */ @ApiOperation(value="删除", notes="根据url的id来指定删除对象") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short") @PostMapping(value = "/deleteNotice/{id}") public RESTfulResult deleteNotice(@PathVariable("id") BigDecimal id){ return success(dilNoticeService.deleteNotice(id)); } /** * 根据userId获取用户名字 * @param userId * @return */ @ApiOperation(value="删除", notes="根据url的id来指定删除对象") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short") @PostMapping(value = "/queryName/{userId}") public RESTfulResult queryName(@PathVariable("userId") String userId){ return success(dilNoticeService.queryName(userId)); } /** * 根据id获取通知信息 * @param id * @return */ @ApiOperation(value="获取通知详细信息", notes="根据url的id来获取详细信息") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") @PostMapping(value = "/getNoticeById/{id}") public RESTfulResult getNoticeById(@PathVariable("id") BigDecimal id){ List> list= dilNoticeService.getNoticeById(id); return success(list); } /** * 根据permissions获取最新通知信息 * @param permissions * @return */ @ApiOperation(value="获取通知详细信息", notes="根据url的id来获取详细信息") @ApiImplicitParam(paramType = "path", name = "permission", value = "permission", required = true, dataType = "String") @PostMapping(value = "/getNewNoticeByPermission/{permissions}") public RESTfulResult getNewNoticeByPermission(@PathVariable("permissions")String permissions){ BigDecimal permission=new BigDecimal(permissions); List> list= dilNoticeService.getNewNoticeByPermission(permission); return success(list); } @ApiOperation(value = "模糊查询通知信息", notes = "分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "196", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/getNoticeResultList") public RESTfulResult getNoticeResultList(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String con) { if (mapValue==null){ mapValue=new HashMap<>(); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = dilNoticeService.getNoticeList(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList); return success(data); } /** * @author:zyf * @version:2.0 * @Date:2022-10-14 * @Description:获取通知数据 */ @ApiOperation(value = "查询通知信息", notes = "根据传过来的orgcode查询") @PostMapping(value = "/getNotice") public RESTfulResult getNotice(@RequestBody(required = false) Map mapValue){ //String orgcode= (String) mapValue.get("orgcodezs"); String userId=""; if (mapValue!=null){ userId=(String) mapValue.get("userId"); } if ("".equals(userId)){ return failed(); } List> noticeData = dilNoticeService.getNoticeData(userId); return success(noticeData); //return null; } /** * @author:zyf * @version:2.0 * @Date:2022-10-14 * @Description:获取通知数据 */ @ApiOperation(value = "查询通知信息", notes = "根据传过来的orgcode查询") @PostMapping(value = "/getNoticeAll") public RESTfulResult getNoticeAll(@RequestBody(required = false) Map mapValue){ if (mapValue==null ||mapValue.get("userId")==null){ return failed(); } List> noticeData = dilNoticeService.getNoticeAll(mapValue); return success(noticeData); } }