FeeDetailServiceDaoImpl.java 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. package com.java110.fee.dao.impl;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.java110.utils.constant.ResponseConstant;
  4. import com.java110.utils.exception.DAOException;
  5. import com.java110.utils.util.DateUtil;
  6. import com.java110.core.base.dao.BaseServiceDao;
  7. import com.java110.fee.dao.IFeeDetailServiceDao;
  8. import com.java110.utils.util.StringUtil;
  9. import org.slf4j.Logger;
  10. import com.java110.core.log.LoggerFactory;
  11. import org.springframework.stereotype.Service;
  12. import java.util.Date;
  13. import java.util.List;
  14. import java.util.Map;
  15. /**
  16. * 费用明细服务 与数据库交互
  17. * Created by wuxw on 2017/4/5.
  18. */
  19. @Service("feeDetailServiceDaoImpl")
  20. //@Transactional
  21. public class FeeDetailServiceDaoImpl extends BaseServiceDao implements IFeeDetailServiceDao {
  22. private static Logger logger = LoggerFactory.getLogger(FeeDetailServiceDaoImpl.class);
  23. /**
  24. * 费用明细信息封装
  25. * @param businessFeeDetailInfo 费用明细信息 封装
  26. * @throws DAOException DAO异常
  27. */
  28. @Override
  29. public void saveBusinessFeeDetailInfo(Map businessFeeDetailInfo) throws DAOException {
  30. businessFeeDetailInfo.put("month", DateUtil.getCurrentMonth());
  31. // 查询business_user 数据是否已经存在
  32. logger.debug("保存费用明细信息 入参 businessFeeDetailInfo : {}",businessFeeDetailInfo);
  33. int saveFlag = sqlSessionTemplate.insert("feeDetailServiceDaoImpl.saveBusinessFeeDetailInfo",businessFeeDetailInfo);
  34. if(saveFlag < 1){
  35. throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存费用明细数据失败:"+ JSONObject.toJSONString(businessFeeDetailInfo));
  36. }
  37. }
  38. /**
  39. * 查询费用明细信息
  40. * @param info bId 信息
  41. * @return 费用明细信息
  42. * @throws DAOException DAO异常
  43. */
  44. @Override
  45. public List<Map> getBusinessFeeDetailInfo(Map info) throws DAOException {
  46. logger.debug("查询费用明细信息 入参 info : {}",info);
  47. List<Map> businessFeeDetailInfos = sqlSessionTemplate.selectList("feeDetailServiceDaoImpl.getBusinessFeeDetailInfo",info);
  48. return businessFeeDetailInfos;
  49. }
  50. /**
  51. * 保存费用明细信息 到 instance
  52. * @param info bId 信息
  53. * @throws DAOException DAO异常
  54. */
  55. @Override
  56. public void saveFeeDetailInfoInstance(Map info) throws DAOException {
  57. logger.debug("保存费用明细信息Instance 入参 info : {}",info);
  58. int saveFlag = sqlSessionTemplate.insert("feeDetailServiceDaoImpl.saveFeeDetailInfoInstance",info);
  59. if(saveFlag < 1){
  60. throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存费用明细信息Instance数据失败:"+ JSONObject.toJSONString(info));
  61. }
  62. }
  63. /**
  64. * 查询费用明细信息(instance)
  65. * @param info bId 信息
  66. * @return List<Map>
  67. * @throws DAOException DAO异常
  68. */
  69. @Override
  70. public List<Map> getFeeDetailInfo(Map info) throws DAOException {
  71. logger.debug("查询费用明细信息 入参 info : {}",info);
  72. List<Map> infos = sqlSessionTemplate.selectList("feeDetailServiceDaoImpl.getFeeDetailInfo",info);
  73. return infos;
  74. }
  75. /**
  76. * 修改费用明细信息
  77. * @param info 修改信息
  78. * @throws DAOException DAO异常
  79. */
  80. @Override
  81. public void updateFeeDetailInfoInstance(Map info) throws DAOException {
  82. logger.debug("修改费用明细信息Instance 入参 info : {}",info);
  83. int saveFlag = sqlSessionTemplate.update("feeDetailServiceDaoImpl.updateFeeDetailInfoInstance",info);
  84. if(saveFlag < 1){
  85. throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改费用明细信息Instance数据失败:"+ JSONObject.toJSONString(info));
  86. }
  87. }
  88. /**
  89. * 查询费用明细数量
  90. * @param info 费用明细信息
  91. * @return 费用明细数量
  92. */
  93. @Override
  94. public int queryFeeDetailsCount(Map info) {
  95. logger.debug("查询费用明细数据 入参 info : {}",info);
  96. List<Map> businessFeeDetailInfos = sqlSessionTemplate.selectList("feeDetailServiceDaoImpl.queryFeeDetailsCount", info);
  97. if (businessFeeDetailInfos.size() < 1) {
  98. return 0;
  99. }
  100. return Integer.parseInt(businessFeeDetailInfos.get(0).get("count").toString());
  101. }
  102. @Override
  103. public void saveFeeDetail(Map feeDetail) throws DAOException {
  104. logger.debug("保存明细 入参 info : {}",feeDetail);
  105. int saveFlag = sqlSessionTemplate.update("feeDetailServiceDaoImpl.saveFeeDetail",feeDetail);
  106. if(saveFlag < 1){
  107. throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存明细 数据失败:"+ JSONObject.toJSONString(feeDetail));
  108. }
  109. }
  110. }