FundsServiceImpl.java 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. package com.ghsc.partybuild.service.impl;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import com.ghsc.partybuild.mapper.DjFundsuseMapper;
  5. import com.ghsc.partybuild.mapper.FundsCQuery;
  6. import com.ghsc.partybuild.model.CfDictionary;
  7. import com.ghsc.partybuild.model.DjFundsuseWithBLOBs;
  8. import com.ghsc.partybuild.service.DictionaryService;
  9. import com.ghsc.partybuild.service.FundsService;
  10. import com.ghsc.partybuild.util.DateUtils;
  11. import com.ghsc.partybuild.util.MapUtils;
  12. import com.ghsc.partybuild.util.StringUtils;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.stereotype.Service;
  15. import java.util.Date;
  16. import java.util.HashMap;
  17. import java.util.List;
  18. /**
  19. * 党组织经费
  20. *
  21. * @author pj
  22. */
  23. @Service("fundsService")
  24. public class FundsServiceImpl implements FundsService {
  25. @Autowired
  26. private FundsCQuery fundsCquery;
  27. @Autowired
  28. private DjFundsuseMapper djFundsuseMapper;
  29. @Autowired
  30. private StringUtils stringUtils;
  31. @Autowired
  32. private MapUtils mapUtils;
  33. @Autowired
  34. private DictionaryService dictionaryService;
  35. @Autowired
  36. private DateUtils dateUtils;
  37. @Override
  38. public PageInfo<HashMap<String, Object>> getFundsUseList(int page, int rows,String dzzmc, String partyCode, String beginTime, String endTime, Integer expendScope, Integer expendType) {
  39. List<CfDictionary> dicExpendScope = dictionaryService.getDictionaryListByDicTypeKey("expendScope");
  40. List<CfDictionary> dicExpendType = dictionaryService.getDictionaryListByDicTypeKey("expendType");
  41. PageHelper.startPage(page, rows);
  42. List<HashMap<String, Object>> list = fundsCquery.selectFundsUseList(dzzmc,partyCode, beginTime, endTime, expendScope, expendType);
  43. for (HashMap<String, Object> item : list) {
  44. if (item.get("EXPENDSCOPE") != null) {
  45. item.put("EXPENDSCOPENAME", dictionaryService.getDicByKey(Integer.parseInt(item.get("EXPENDSCOPE").toString()), dicExpendScope).getDicvalue());
  46. }
  47. if (item.get("EXPENDTYPE") != null) {
  48. item.put("EXPENDTYPENAME", dictionaryService.getDicByKey(Integer.parseInt(item.get("EXPENDTYPE").toString()), dicExpendType).getDicvalue());
  49. }
  50. }
  51. PageInfo<HashMap<String, Object>> result = new PageInfo(list);
  52. return result;
  53. }
  54. @Override
  55. public DjFundsuseWithBLOBs getFundsuseById(String id) {
  56. return djFundsuseMapper.selectByPrimaryKey(id);
  57. }
  58. @Override
  59. public int saveFundsuse(DjFundsuseWithBLOBs model, String userId, String userName) {
  60. int result = 0;
  61. DjFundsuseWithBLOBs dbModel = getFundsuseById(model.getFundsuseid());
  62. if (dbModel == null || (dbModel != null && stringUtils.IsNullOrEmpty(dbModel.getFundsuseid()))) {
  63. model.setCreatetime(new Date());
  64. model.setCreateuserid(userId);
  65. model.setCreateusername(userName);
  66. model.setOperatestate("A");
  67. model.setOperatetime(new Date());
  68. model.setSyncstate("N");
  69. result = djFundsuseMapper.insert(model);
  70. } else {
  71. model.setUpdatetime(new Date());
  72. model.setUpdateuserid(userId);
  73. model.setUpdateusername(userName);
  74. model.setOperatestate("M");
  75. model.setOperatetime(new Date());
  76. model.setSyncstate("N");
  77. result = djFundsuseMapper.updateByPrimaryKeyWithBLOBs(model);
  78. }
  79. return result;
  80. }
  81. @Override
  82. public int deleteFundsuseById(String id) {
  83. return djFundsuseMapper.deleteByPrimaryKey(id);
  84. }
  85. /**
  86. * @param page
  87. * @param rows
  88. * @param partyCode
  89. * @param year
  90. * @return
  91. */
  92. @Override
  93. public PageInfo<HashMap<String, Object>> getFundsUsageSummary(int page, int rows, String partyCode, String dzzmc,Integer year,boolean isApp) {
  94. PageHelper.startPage(page, rows);
  95. List<HashMap<String, Object>> list = fundsCquery.selectFundsUsageSummary(partyCode, dzzmc,year,null,isApp);
  96. PageInfo<HashMap<String, Object>> result = new PageInfo(list);
  97. return result;
  98. }
  99. @Override
  100. public HashMap<String, Object> getFundsUsageSummaryByDzzdm(Integer year,String dzzdm) {
  101. List<HashMap<String, Object>> list = fundsCquery.selectFundsUsageSummary(null,null, year,dzzdm,true);
  102. return list.stream().findFirst().get();
  103. }
  104. /**
  105. * @param page
  106. * @param rows
  107. * @param partyCode
  108. * @param year
  109. * @return
  110. */
  111. @Override
  112. public PageInfo<HashMap<String, Object>> getFundsUsageDetails(int page, int rows, String partyCode, Integer year) {
  113. PageHelper.startPage(page, rows);
  114. List<HashMap<String, Object>> list = fundsCquery.selectFundsUsageDetails(partyCode, year);
  115. PageInfo<HashMap<String, Object>> result = new PageInfo(list);
  116. return result;
  117. }
  118. /**
  119. * @param partyCode
  120. * @param expendscope
  121. * @param year
  122. * @return
  123. */
  124. @Override
  125. public List<HashMap<String, Object>> getPartyFundsUsage( String partyCode, Integer expendscope,Integer year) {
  126. List<HashMap<String, Object>> list = fundsCquery.selectPartyFundsUsage(partyCode, expendscope,year);
  127. return list;
  128. }
  129. }