ApplyUseMoneyService.java 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. package com.idea.oa.apply.service;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import com.idea.oa.apply.mapper.ApplyExtendMapper;
  5. import com.idea.oa.apply.mapper.ApplyUseMoneyExtendMapper;
  6. import com.idea.oa.apply.mapper.ApplyUseMoneyMapper;
  7. import com.idea.oa.apply.model.ApplyUseMoney;
  8. import com.idea.oa.apply.model.ApplyUseMoneyExample;
  9. import com.idea.oa.apply.model.inout.ApplyUseMoneyIn;
  10. import com.idea.oa.costManage.model.ExpenseLedger;
  11. import com.rockstar.common.base.BaseService;
  12. import com.rockstar.common.support.Convert;
  13. import com.rockstar.frame.model.FrameData;
  14. import com.rockstar.frame.model.extend.DateTrans;
  15. import com.rockstar.frame.model.extend.Tablepar;
  16. import com.rockstar.frame.service.FrameDataService;
  17. import com.rockstar.util.UUIDUtils;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.stereotype.Service;
  20. import java.util.*;
  21. @Service
  22. public class ApplyUseMoneyService implements BaseService<ApplyUseMoney, ApplyUseMoneyExample> {
  23. //文件mapper
  24. @Autowired
  25. private ApplyUseMoneyMapper modelMapper;
  26. @Autowired
  27. private ApplyUseMoneyExtendMapper applyUseMoneyExtendMapper;
  28. @Autowired
  29. private ApplyExtendMapper applyExtendMapper;
  30. /**
  31. * 分页查询
  32. *
  33. * @return
  34. */
  35. public PageInfo<ApplyUseMoney> list(Tablepar tablepar, ApplyUseMoney model, DateTrans dt) {
  36. PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
  37. List<ApplyUseMoney> list = null;//modelMapper.selectByExample(getCondition(model,dt));
  38. PageInfo<ApplyUseMoney> pageInfo = new PageInfo<>(list);
  39. return pageInfo;
  40. }
  41. public Object listAll(ApplyUseMoney model, DateTrans dt) {
  42. List<ApplyUseMoney> list = null;//modelMapper.selectByExample(getCondition(model,dt));
  43. return list;
  44. }
  45. @Override
  46. public int deleteByPrimaryKey(String ids) {
  47. List<String> lista = Convert.toListStrArray(ids);
  48. ApplyUseMoneyExample example = new ApplyUseMoneyExample();
  49. example.createCriteria().andIdIn(lista);
  50. return modelMapper.deleteByExample(example);
  51. }
  52. @Override
  53. public ApplyUseMoney selectByPrimaryKey(String id) {
  54. return modelMapper.selectByPrimaryKey(id);
  55. }
  56. @Override
  57. public int updateByPrimaryKeySelective(ApplyUseMoney record) {
  58. return modelMapper.updateByPrimaryKeySelective(record);
  59. }
  60. @Override
  61. public int updateByExampleSelective(ApplyUseMoney record, ApplyUseMoneyExample example) {
  62. return modelMapper.updateByExampleSelective(record, example);
  63. }
  64. @Override
  65. public int updateByExample(ApplyUseMoney record, ApplyUseMoneyExample example) {
  66. return modelMapper.updateByExample(record, example);
  67. }
  68. @Override
  69. public List<ApplyUseMoney> selectByExample(ApplyUseMoneyExample example) {
  70. return modelMapper.selectByExample(example);
  71. }
  72. @Override
  73. public long countByExample(ApplyUseMoneyExample example) {
  74. return modelMapper.countByExample(example);
  75. }
  76. @Override
  77. public int deleteByExample(ApplyUseMoneyExample example) {
  78. return modelMapper.deleteByExample(example);
  79. }
  80. public int insert(ApplyUseMoney record){
  81. record.setId(UUIDUtils.middleUUID());
  82. return insertWithoutId(record);
  83. }
  84. public int insertWithoutId(ApplyUseMoney record){
  85. record.setCreatedAt(new Date());
  86. return modelMapper.insert(record);
  87. }
  88. @Override
  89. public int insertSelective(ApplyUseMoney record) {
  90. record.setId(UUIDUtils.middleUUID());
  91. record.setCreatedAt(new Date());
  92. return modelMapper.insertSelective(record);
  93. }
  94. public ApplyUseMoneyIn getInfoByFlowMainPushId(String flowMainPushId) {
  95. return applyUseMoneyExtendMapper.getInfoByFlowMainPushId(flowMainPushId);
  96. }
  97. public ApplyUseMoneyIn getInfoByFlowMainId(String flowMainId) {
  98. return applyUseMoneyExtendMapper.getInfoByFlowMainId(flowMainId);
  99. }
  100. public List<ExpenseLedger> getUserMoneyByMoneyId(String flowMainId) {
  101. return applyUseMoneyExtendMapper.getUserMoneyByMoneyId(flowMainId);
  102. }
  103. @Autowired
  104. private FrameDataService frameDataService;
  105. public PageInfo<Map> findApplyUseMoneyListByInfo(Tablepar tablepar, String name, String startTime, String endTime) {
  106. PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
  107. List<Map> list = applyExtendMapper.findApplyUseMoneyListByInfo(name, startTime, endTime);
  108. for (Map map : list) {
  109. if (map.get("file_data_ids") != null) {
  110. List<Map<String, String>> fileList = new ArrayList<>();
  111. Map<String, String> stringStringHashMap=null;
  112. String[] file_data_ids = map.get("file_data_ids").toString().split(",");
  113. for (String file_data_id : file_data_ids) {
  114. stringStringHashMap = new HashMap<>();
  115. FrameData frameData = frameDataService.selectByPrimaryKey(file_data_id);
  116. stringStringHashMap.put("id",file_data_id);
  117. stringStringHashMap.put("fileName",frameData!=null?frameData.getFileName():null);
  118. fileList.add(stringStringHashMap);
  119. }
  120. map.put("file_data_ids",fileList);
  121. }
  122. }
  123. PageInfo<Map> pageInfo = new PageInfo<>(list);
  124. return pageInfo;
  125. }
  126. public List<Map> findAllApplyUseMoneyListByInfo(String name, String startTime, String endTime) {
  127. List<Map> list = applyExtendMapper.findApplyUseMoneyListByInfo(name, startTime, endTime);
  128. for (Map map : list) {
  129. if (map.get("file_data_ids") != null) {
  130. List<Map<String, String>> fileList = new ArrayList<>();
  131. Map<String, String> stringStringHashMap=null;
  132. String[] file_data_ids = map.get("file_data_ids").toString().split(",");
  133. for (String file_data_id : file_data_ids) {
  134. stringStringHashMap = new HashMap<>();
  135. FrameData frameData = frameDataService.selectByPrimaryKey(file_data_id);
  136. stringStringHashMap.put("id",file_data_id);
  137. stringStringHashMap.put("fileName",frameData!=null?frameData.getFileName():null);
  138. fileList.add(stringStringHashMap);
  139. }
  140. map.put("file_data_ids",fileList);
  141. }
  142. }
  143. return list;
  144. }
  145. }