123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- package com.steerinfo.dil.controller;
- import com.steerinfo.dil.feign.ESFeign;
- import com.steerinfo.dil.mapper.SaleLogMapper;
- 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.dil.util.SaleLogUtil;
- 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;
- @Autowired
- SaleLogUtil saleLogUtil;
- @Autowired
- SaleLogMapper saleLogMapper;
- /**
- * 展示公告信息
- * @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<String,Object> mapVal,
- Integer pageNum,
- Integer pageSize,
- Integer apiId){
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- List<Map<String, Object>> 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<String,Object> mapVal,
- Integer pageNum,
- Integer pageSize,
- Integer apiId,String con){
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- if (con!=null&&!(con.equals("undefined"))){
- mapVal.put("con", "%" + con + "%");
- }
- List<Map<String, Object>> 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<String,Object> mapVal,
- Integer pageNum,
- Integer pageSize,
- Integer apiId,
- String con){
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- if (con!=null&&!(con.equals("undefined"))){
- mapVal.put("con", "%" + con + "%");
- }
- List<Map<String, Object>> 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<String,Object> mapVal,
- Integer pageNum,
- Integer pageSize,
- Integer apiId,
- String con){
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- if (con!=null&&!(con.equals("undefined"))){
- mapVal.put("con", "%" + con + "%");
- }
- List<Map<String, Object>> 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<String, Object> 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<String, Object> 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<Map<String,Object>> 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<Map<String,Object>> 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<String, Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- String con) {
- if (mapValue==null){
- mapValue=new HashMap<>();
- }
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- List<Map<String, Object>> 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<String, Object> mapValue){
- //String orgcode= (String) mapValue.get("orgcodezs");
- String userId="";
- if (mapValue!=null){
- userId=(String) mapValue.get("userId");
- }
- if ("".equals(userId)){
- return failed();
- }
- List<Map<String, Object>> 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<String, Object> mapValue){
- if (mapValue==null ||mapValue.get("userId")==null){
- return failed();
- }
- List<Map<String, Object>> noticeData = dilNoticeService.getNoticeAll(mapValue);
- return success(noticeData);
- }
- @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 = "/getNoticeUser")
- public RESTfulResult getNoticeUser(@RequestBody(required = false) Map<String, Object> mapValue,
- @RequestParam("pageNum") Integer pageNum,
- @RequestParam("pageSize") Integer pageSize,
- @RequestParam("apiId") Integer apiId) {
- if (mapValue==null){
- mapValue=new HashMap<>();
- }
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- List<Map<String, Object>> columnList = dilNoticeService.getNoticeUser(mapValue);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
- return success(data);
- }
- /**
- * 查询所有日志
- * @param mapValue
- * @param pageNum
- * @param pageSize
- * @param apiId=522
- * @return
- */
- @PostMapping(value = "/selectAllLog")
- public RESTfulResult test(@RequestBody(required = false) Map<String, Object> mapValue,
- @RequestParam("pageNum") Integer pageNum,
- @RequestParam("pageSize") Integer pageSize,
- @RequestParam("apiId") Integer apiId) {
- PageHelper.startPage(pageNum, pageSize);
- List<Map<String, Object>> list = saleLogMapper.selectAllLog(mapValue);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, null, list);
- return success(data);
- }
- /**
- * TEST ADD LOG
- * @param mapValue
- * @return
- */
- @PostMapping(value = "/addSaleLog")
- public void test(@RequestBody(required = false) Map<String, Object> mapValue) {
- saleLogUtil.logOrder(new BigDecimal(1),"测试",mapValue,SaleLogUtil.INSERT);
- }
- }
|