ApplyPaymentService.java 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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.ApplyPaymentExtendMapper;
  6. import com.idea.oa.apply.mapper.ApplyPaymentMapper;
  7. import com.idea.oa.apply.model.ApplyPayment;
  8. import com.idea.oa.apply.model.ApplyPaymentExample;
  9. import com.idea.oa.apply.model.inout.ApplyPaymentIn;
  10. import com.idea.oa.outsource.model.OutOrderPay;
  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 ApplyPaymentService implements BaseService<ApplyPayment, ApplyPaymentExample> {
  23. //文件mapper
  24. @Autowired
  25. private ApplyPaymentMapper modelMapper;
  26. @Autowired
  27. private ApplyPaymentExtendMapper applyPaymentExtendMapper;
  28. @Autowired
  29. private ApplyExtendMapper applyExtendMapper;
  30. /**
  31. * 分页查询
  32. *
  33. * @return
  34. */
  35. public PageInfo<ApplyPayment> list(Tablepar tablepar, ApplyPayment model, DateTrans dt) {
  36. PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
  37. List<ApplyPayment> list = null;//modelMapper.selectByExample(getCondition(model,dt));
  38. PageInfo<ApplyPayment> pageInfo = new PageInfo<>(list);
  39. return pageInfo;
  40. }
  41. public Object listAll(ApplyPayment model, DateTrans dt) {
  42. List<ApplyPayment> 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. ApplyPaymentExample example = new ApplyPaymentExample();
  49. example.createCriteria().andIdIn(lista);
  50. return modelMapper.deleteByExample(example);
  51. }
  52. @Override
  53. public ApplyPayment selectByPrimaryKey(String id) {
  54. return modelMapper.selectByPrimaryKey(id);
  55. }
  56. @Override
  57. public int updateByPrimaryKeySelective(ApplyPayment record) {
  58. return modelMapper.updateByPrimaryKeySelective(record);
  59. }
  60. @Override
  61. public int updateByExampleSelective(ApplyPayment record, ApplyPaymentExample example) {
  62. return modelMapper.updateByExampleSelective(record, example);
  63. }
  64. @Override
  65. public int updateByExample(ApplyPayment record, ApplyPaymentExample example) {
  66. return modelMapper.updateByExample(record, example);
  67. }
  68. @Override
  69. public List<ApplyPayment> selectByExample(ApplyPaymentExample example) {
  70. return modelMapper.selectByExample(example);
  71. }
  72. @Override
  73. public long countByExample(ApplyPaymentExample example) {
  74. return modelMapper.countByExample(example);
  75. }
  76. @Override
  77. public int deleteByExample(ApplyPaymentExample example) {
  78. return modelMapper.deleteByExample(example);
  79. }
  80. public int insert(ApplyPayment record) {
  81. record.setId(UUIDUtils.middleUUID());
  82. return insertWithoutId(record);
  83. }
  84. public int insertWithoutId(ApplyPayment record) {
  85. return modelMapper.insert(record);
  86. }
  87. @Override
  88. public int insertSelective(ApplyPayment record) {
  89. record.setId(UUIDUtils.middleUUID());
  90. record.setCreatedAt(new Date());
  91. return modelMapper.insertSelective(record);
  92. }
  93. public ApplyPaymentIn getInfoByFlowMainPushId(String flowMainPushId) {
  94. return applyPaymentExtendMapper.getInfoByFlowMainPushId(flowMainPushId);
  95. }
  96. public ApplyPaymentIn getInfoByFlowMainId(String flowMainId) {
  97. return applyPaymentExtendMapper.getInfoByFlowMainId(flowMainId);
  98. }
  99. public Double getTotalMoneyByProId(String proId) {
  100. return applyPaymentExtendMapper.getTotalMoneyByProId(proId);
  101. }
  102. public Double getTotalPayMoneyByProId(String proId) {
  103. return applyPaymentExtendMapper.getTotalPayMoneyByProId(proId);
  104. }
  105. public Double getTotalPayMoneyByOrderNo(String orderNo) {
  106. return applyPaymentExtendMapper.getTotalPayMoneyByOrderNo(orderNo);
  107. }
  108. public OutOrderPay getApplyPaymentByFlowMainId(String flowMainId) {
  109. return applyPaymentExtendMapper.getApplyPaymentByFlowMainId(flowMainId);
  110. }
  111. @Autowired
  112. private FrameDataService frameDataService;
  113. public PageInfo<Map> findApplyPaymentListByInfo(Tablepar tablepar, String name, String startTime, String endTime) {
  114. PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
  115. List<Map> list = applyExtendMapper.findApplyPaymentListByInfo(name, startTime, endTime);
  116. for (Map map : list) {
  117. if (map.get("file_data_ids") != null) {
  118. List<Map<String, String>> fileList = new ArrayList<>();
  119. Map<String, String> stringStringHashMap=null;
  120. String[] file_data_ids = map.get("file_data_ids").toString().split(",");
  121. for (String file_data_id : file_data_ids) {
  122. stringStringHashMap = new HashMap<>();
  123. FrameData frameData = frameDataService.selectByPrimaryKey(file_data_id);
  124. stringStringHashMap.put("id",file_data_id);
  125. stringStringHashMap.put("fileName",frameData!=null?frameData.getFileName():null);
  126. fileList.add(stringStringHashMap);
  127. }
  128. map.put("file_data_ids",fileList);
  129. }
  130. }
  131. PageInfo<Map> pageInfo = new PageInfo<>(list);
  132. return pageInfo;
  133. }
  134. public List<Map> findAllApplyPaymentListByInfo(String name, String startTime, String endTime) {
  135. List<Map> list = applyExtendMapper.findApplyPaymentListByInfo(name, startTime, endTime);
  136. for (Map map : list) {
  137. if (map.get("file_data_ids") != null) {
  138. List<Map<String, String>> fileList = new ArrayList<>();
  139. Map<String, String> stringStringHashMap=null;
  140. String[] file_data_ids = map.get("file_data_ids").toString().split(",");
  141. for (String file_data_id : file_data_ids) {
  142. stringStringHashMap = new HashMap<>();
  143. FrameData frameData = frameDataService.selectByPrimaryKey(file_data_id);
  144. stringStringHashMap.put("id",file_data_id);
  145. stringStringHashMap.put("fileName",frameData!=null?frameData.getFileName():null);
  146. fileList.add(stringStringHashMap);
  147. }
  148. map.put("file_data_ids",fileList);
  149. }
  150. }
  151. return list;
  152. }
  153. }