Blame view

parking-module-system/src/main/java/com/zteits/sys/biz/SysOpAdviceServiceImpl.java 3.49 KB
55f68655   王彪总   新项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  package com.zteits.sys.biz;
  
  import com.github.pagehelper.PageInfo;
  import com.zteits.clouds.api.apibase.bean.BizResult;
  import com.zteits.clouds.api.apibase.bean.PageBean;
  import com.zteits.clouds.api.apibase.constants.ErrorType;
  import com.zteits.clouds.api.apibase.exception.BizException;
  import com.zteits.clouds.api.dto.sys.SysOpAdviceDTO;
  import com.zteits.clouds.api.dto.sys.param.OpAdviceNumOfReadStateQueryReq;
  import com.zteits.clouds.api.dto.sys.param.OpAdviceReadStateUpdateReq;
  import com.zteits.clouds.api.dto.sys.param.SysOpAdviceForPageQueryReq;
  import com.zteits.clouds.api.dto.sys.param.SysOpAdviceSaveRequest;
  import com.zteits.clouds.api.service.sys.advice.SysOpAdviceService;
  import com.zteits.sys.dao.SysOpAdviceDao;
  import com.zteits.sys.domain.SysOpAdvice;
  import com.zteits.sys.pagepaper.PageBeanUtil;
  
  import org.springframework.beans.BeanUtils;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  
  /**
   * Copyright: Copyright (c) 2018  zteits
   *
   * @ClassName: com.zteits.sys.biz
   * @Description:
   * @version: v1.0.0
   * @author: atao
   * @date: 2018/8/9   下午3:27
   * Modification History:
   * Date         Author          Version      Description
   * ---------------------------------------------------------*
   * 2018/8/9      atao          v1.0.0          创建
   */
  @Component
  public class SysOpAdviceServiceImpl implements SysOpAdviceService {
  
      @Autowired
      private SysOpAdviceDao sysOpAdviceDao;
  
      @Override
      public BizResult<PageBean<SysOpAdviceDTO>> querySysOpAdviceForPage(SysOpAdviceForPageQueryReq req) {
  
  //        if (req.getOpId() == null) {
  //            throw new BizException(ErrorType.PARAMM_NULL, "人员编码");
  //        }
  
          PageInfo<SysOpAdvice> pageInfo = sysOpAdviceDao.querySysOpAdviceForPage(req);
  
          PageBean<SysOpAdviceDTO> pageBean = new PageBean<>();
          if (null != pageInfo) {
              PageBeanUtil.copyProperties(pageInfo, pageBean, SysOpAdviceDTO.class);
          }
          return new BizResult<>(pageBean);
      }
  
      @Override
      public BizResult<Integer> updateOpAdviceReadState(OpAdviceReadStateUpdateReq req) {
          if (req.getOpId() == null) {
              throw new BizException(ErrorType.PARAMM_NULL, "人员编码");
          }
  
          if (req.getReadState() == null) {
              throw new BizException(ErrorType.PARAMM_NULL, "阅读状态");
          }
  
          Integer num = sysOpAdviceDao.updateOpAdviceReadState(req);
  
          return new BizResult<>(num);
      }
  
      @Override
      public BizResult<Integer> queryOpAdviceNumOfReadState(OpAdviceNumOfReadStateQueryReq req) {
          if (req.getOpId() == null) {
              throw new BizException(ErrorType.PARAMM_NULL, "人员编码");
          }
  
          if (req.getReadState() == null) {
              throw new BizException(ErrorType.PARAMM_NULL, "阅读状态");
          }
  
          Integer num = sysOpAdviceDao.queryOpAdviceNumOfReadState(req);
  
          return new BizResult<>(num);
      }
  
      @Override
      public BizResult<Boolean> saveOpAdviceInfo(SysOpAdviceSaveRequest req) {
          if (req.getOpId() == null) {
              throw new BizException(ErrorType.PARAMM_NULL, "人员编码");
          }
          if (req.getAdviceType() == null) {
              throw new BizException(ErrorType.PARAMM_NULL, "消息类型");
          }
          SysOpAdvice sysOpAdvice = new SysOpAdvice();
          BeanUtils.copyProperties(req, sysOpAdvice);
          Boolean result = sysOpAdviceDao.saveSysOpAdvice(sysOpAdvice);
          return new BizResult<>(result);
      }
  }