TempCarFeeConfigAttrInnerServiceSMOImpl.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package com.java110.fee.smo.impl;
  2. import com.java110.fee.dao.ITempCarFeeConfigAttrServiceDao;
  3. import com.java110.intf.fee.ITempCarFeeConfigAttrInnerServiceSMO;
  4. import com.java110.dto.tempCarFeeConfigAttr.TempCarFeeConfigAttrDto;
  5. import com.java110.intf.user.IUserInnerServiceSMO;
  6. import com.java110.utils.util.BeanConvertUtil;
  7. import com.java110.core.base.smo.BaseServiceSMO;
  8. import com.java110.dto.user.UserDto;
  9. import com.java110.dto.PageDto;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.web.bind.annotation.RequestBody;
  12. import org.springframework.web.bind.annotation.RestController;
  13. import java.util.ArrayList;
  14. import java.util.List;
  15. /**
  16. * @ClassName FloorInnerServiceSMOImpl
  17. * @Description 临时车收费标准属性内部服务实现类
  18. * @Author wuxw
  19. * @Date 2019/4/24 9:20
  20. * @Version 1.0
  21. * add by wuxw 2019/4/24
  22. **/
  23. @RestController
  24. public class TempCarFeeConfigAttrInnerServiceSMOImpl extends BaseServiceSMO implements ITempCarFeeConfigAttrInnerServiceSMO {
  25. @Autowired
  26. private ITempCarFeeConfigAttrServiceDao tempCarFeeConfigAttrServiceDaoImpl;
  27. @Autowired
  28. private IUserInnerServiceSMO userInnerServiceSMOImpl;
  29. @Override
  30. public List<TempCarFeeConfigAttrDto> queryTempCarFeeConfigAttrs(@RequestBody TempCarFeeConfigAttrDto tempCarFeeConfigAttrDto) {
  31. //校验是否传了 分页信息
  32. int page = tempCarFeeConfigAttrDto.getPage();
  33. if (page != PageDto.DEFAULT_PAGE) {
  34. tempCarFeeConfigAttrDto.setPage((page - 1) * tempCarFeeConfigAttrDto.getRow());
  35. }
  36. List<TempCarFeeConfigAttrDto> tempCarFeeConfigAttrs = BeanConvertUtil.covertBeanList(tempCarFeeConfigAttrServiceDaoImpl.getTempCarFeeConfigAttrInfo(BeanConvertUtil.beanCovertMap(tempCarFeeConfigAttrDto)), TempCarFeeConfigAttrDto.class);
  37. if (tempCarFeeConfigAttrs == null || tempCarFeeConfigAttrs.size() == 0) {
  38. return tempCarFeeConfigAttrs;
  39. }
  40. String[] userIds = getUserIds(tempCarFeeConfigAttrs);
  41. //根据 userId 查询用户信息
  42. List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
  43. for (TempCarFeeConfigAttrDto tempCarFeeConfigAttr : tempCarFeeConfigAttrs) {
  44. refreshTempCarFeeConfigAttr(tempCarFeeConfigAttr, users);
  45. }
  46. return tempCarFeeConfigAttrs;
  47. }
  48. /**
  49. * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
  50. *
  51. * @param tempCarFeeConfigAttr 小区临时车收费标准属性信息
  52. * @param users 用户列表
  53. */
  54. private void refreshTempCarFeeConfigAttr(TempCarFeeConfigAttrDto tempCarFeeConfigAttr, List<UserDto> users) {
  55. for (UserDto user : users) {
  56. if (tempCarFeeConfigAttr.getAttrId().equals(user.getUserId())) {
  57. BeanConvertUtil.covertBean(user, tempCarFeeConfigAttr);
  58. }
  59. }
  60. }
  61. /**
  62. * 获取批量userId
  63. *
  64. * @param tempCarFeeConfigAttrs 小区楼信息
  65. * @return 批量userIds 信息
  66. */
  67. private String[] getUserIds(List<TempCarFeeConfigAttrDto> tempCarFeeConfigAttrs) {
  68. List<String> userIds = new ArrayList<String>();
  69. for (TempCarFeeConfigAttrDto tempCarFeeConfigAttr : tempCarFeeConfigAttrs) {
  70. userIds.add(tempCarFeeConfigAttr.getAttrId());
  71. }
  72. return userIds.toArray(new String[userIds.size()]);
  73. }
  74. @Override
  75. public int queryTempCarFeeConfigAttrsCount(@RequestBody TempCarFeeConfigAttrDto tempCarFeeConfigAttrDto) {
  76. return tempCarFeeConfigAttrServiceDaoImpl.queryTempCarFeeConfigAttrsCount(BeanConvertUtil.beanCovertMap(tempCarFeeConfigAttrDto)); }
  77. public ITempCarFeeConfigAttrServiceDao getTempCarFeeConfigAttrServiceDaoImpl() {
  78. return tempCarFeeConfigAttrServiceDaoImpl;
  79. }
  80. public void setTempCarFeeConfigAttrServiceDaoImpl(ITempCarFeeConfigAttrServiceDao tempCarFeeConfigAttrServiceDaoImpl) {
  81. this.tempCarFeeConfigAttrServiceDaoImpl = tempCarFeeConfigAttrServiceDaoImpl;
  82. }
  83. public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
  84. return userInnerServiceSMOImpl;
  85. }
  86. public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
  87. this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
  88. }
  89. }