Blame view

service-user/src/main/java/com/java110/user/smo/impl/OwnerCarAttrInnerServiceSMOImpl.java 3.2 KB
88e030b7   王彪总   init project
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
  package com.java110.user.smo.impl;
  
  
  import com.java110.core.base.smo.BaseServiceSMO;
  import com.java110.intf.user.IOwnerCarAttrInnerServiceSMO;
  import com.java110.dto.PageDto;
  import com.java110.dto.owner.OwnerCarAttrDto;
  import com.java110.dto.user.UserDto;
  import com.java110.po.owner.OwnerCarAttrPo;
  import com.java110.user.dao.IOwnerCarAttrServiceDao;
  import com.java110.utils.util.BeanConvertUtil;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RestController;
  
  import java.util.ArrayList;
  import java.util.List;
  
  /**
   * @ClassName FloorInnerServiceSMOImpl
   * @Description 业主车辆属性内部服务实现类
   * @Author wuxw
   * @Date 2019/4/24 9:20
   * @Version 1.0
   * add by wuxw 2019/4/24
   **/
  @RestController
  public class OwnerCarAttrInnerServiceSMOImpl extends BaseServiceSMO implements IOwnerCarAttrInnerServiceSMO {
  
      @Autowired
      private IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl;
  
  
      @Override
      public List<OwnerCarAttrDto> queryOwnerCarAttrs(@RequestBody OwnerCarAttrDto ownerCarAttrDto) {
  
          //校验是否传了 分页信息
  
          int page = ownerCarAttrDto.getPage();
  
          if (page != PageDto.DEFAULT_PAGE) {
              ownerCarAttrDto.setPage((page - 1) * ownerCarAttrDto.getRow());
          }
  
          List<OwnerCarAttrDto> ownerCarAttrs = BeanConvertUtil.covertBeanList(ownerCarAttrServiceDaoImpl.getOwnerCarAttrInfo(BeanConvertUtil.beanCovertMap(ownerCarAttrDto)), OwnerCarAttrDto.class);
  
          return ownerCarAttrs;
      }
  
      /**
       * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
       *
9750b443   王彪总   fix(config): 更新配置...
53
       * @param ownerCarAttr 项目业主车辆属性信息
88e030b7   王彪总   init project
54
55
56
57
58
59
60
61
62
63
64
65
66
       * @param users        用户列表
       */
      private void refreshOwnerCarAttr(OwnerCarAttrDto ownerCarAttr, List<UserDto> users) {
          for (UserDto user : users) {
              if (ownerCarAttr.getAttrId().equals(user.getUserId())) {
                  BeanConvertUtil.covertBean(user, ownerCarAttr);
              }
          }
      }
  
      /**
       * 获取批量userId
       *
9750b443   王彪总   fix(config): 更新配置...
67
       * @param ownerCarAttrs 项目楼信息
88e030b7   王彪总   init project
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
       * @return 批量userIds 信息
       */
      private String[] getUserIds(List<OwnerCarAttrDto> ownerCarAttrs) {
          List<String> userIds = new ArrayList<String>();
          for (OwnerCarAttrDto ownerCarAttr : ownerCarAttrs) {
              userIds.add(ownerCarAttr.getAttrId());
          }
  
          return userIds.toArray(new String[userIds.size()]);
      }
  
      @Override
      public int queryOwnerCarAttrsCount(@RequestBody OwnerCarAttrDto ownerCarAttrDto) {
          return ownerCarAttrServiceDaoImpl.queryOwnerCarAttrsCount(BeanConvertUtil.beanCovertMap(ownerCarAttrDto));
      }
  
      @Override
      public int saveOwnerCarAttr(@RequestBody OwnerCarAttrPo ownerCarAttrPo) {
          return ownerCarAttrServiceDaoImpl.saveOwnerCarAttr(BeanConvertUtil.beanCovertMap(ownerCarAttrPo));
      }
  
      public IOwnerCarAttrServiceDao getOwnerCarAttrServiceDaoImpl() {
          return ownerCarAttrServiceDaoImpl;
      }
  
      public void setOwnerCarAttrServiceDaoImpl(IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl) {
          this.ownerCarAttrServiceDaoImpl = ownerCarAttrServiceDaoImpl;
      }
  
  }