123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- package com.idea.oa.apply.service;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import com.idea.oa.apply.mapper.ApplyExtendMapper;
- import com.idea.oa.apply.mapper.ApplyUseMoneyExtendMapper;
- import com.idea.oa.apply.mapper.ApplyUseMoneyMapper;
- import com.idea.oa.apply.model.ApplyUseMoney;
- import com.idea.oa.apply.model.ApplyUseMoneyExample;
- import com.idea.oa.apply.model.inout.ApplyUseMoneyIn;
- import com.idea.oa.costManage.model.ExpenseLedger;
- import com.rockstar.common.base.BaseService;
- import com.rockstar.common.support.Convert;
- import com.rockstar.frame.model.FrameData;
- import com.rockstar.frame.model.extend.DateTrans;
- import com.rockstar.frame.model.extend.Tablepar;
- import com.rockstar.frame.service.FrameDataService;
- import com.rockstar.util.UUIDUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.*;
- @Service
- public class ApplyUseMoneyService implements BaseService<ApplyUseMoney, ApplyUseMoneyExample> {
- //文件mapper
- @Autowired
- private ApplyUseMoneyMapper modelMapper;
- @Autowired
- private ApplyUseMoneyExtendMapper applyUseMoneyExtendMapper;
- @Autowired
- private ApplyExtendMapper applyExtendMapper;
- /**
- * 分页查询
- *
- * @return
- */
- public PageInfo<ApplyUseMoney> list(Tablepar tablepar, ApplyUseMoney model, DateTrans dt) {
- PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
- List<ApplyUseMoney> list = null;//modelMapper.selectByExample(getCondition(model,dt));
- PageInfo<ApplyUseMoney> pageInfo = new PageInfo<>(list);
- return pageInfo;
- }
- public Object listAll(ApplyUseMoney model, DateTrans dt) {
- List<ApplyUseMoney> list = null;//modelMapper.selectByExample(getCondition(model,dt));
- return list;
- }
- @Override
- public int deleteByPrimaryKey(String ids) {
- List<String> lista = Convert.toListStrArray(ids);
- ApplyUseMoneyExample example = new ApplyUseMoneyExample();
- example.createCriteria().andIdIn(lista);
- return modelMapper.deleteByExample(example);
- }
- @Override
- public ApplyUseMoney selectByPrimaryKey(String id) {
- return modelMapper.selectByPrimaryKey(id);
- }
- @Override
- public int updateByPrimaryKeySelective(ApplyUseMoney record) {
- return modelMapper.updateByPrimaryKeySelective(record);
- }
- @Override
- public int updateByExampleSelective(ApplyUseMoney record, ApplyUseMoneyExample example) {
- return modelMapper.updateByExampleSelective(record, example);
- }
- @Override
- public int updateByExample(ApplyUseMoney record, ApplyUseMoneyExample example) {
- return modelMapper.updateByExample(record, example);
- }
- @Override
- public List<ApplyUseMoney> selectByExample(ApplyUseMoneyExample example) {
- return modelMapper.selectByExample(example);
- }
- @Override
- public long countByExample(ApplyUseMoneyExample example) {
- return modelMapper.countByExample(example);
- }
- @Override
- public int deleteByExample(ApplyUseMoneyExample example) {
- return modelMapper.deleteByExample(example);
- }
- public int insert(ApplyUseMoney record){
- record.setId(UUIDUtils.middleUUID());
- return insertWithoutId(record);
- }
- public int insertWithoutId(ApplyUseMoney record){
- record.setCreatedAt(new Date());
- return modelMapper.insert(record);
- }
- @Override
- public int insertSelective(ApplyUseMoney record) {
- record.setId(UUIDUtils.middleUUID());
- record.setCreatedAt(new Date());
- return modelMapper.insertSelective(record);
- }
- public ApplyUseMoneyIn getInfoByFlowMainPushId(String flowMainPushId) {
- return applyUseMoneyExtendMapper.getInfoByFlowMainPushId(flowMainPushId);
- }
- public ApplyUseMoneyIn getInfoByFlowMainId(String flowMainId) {
- return applyUseMoneyExtendMapper.getInfoByFlowMainId(flowMainId);
- }
- public List<ExpenseLedger> getUserMoneyByMoneyId(String flowMainId) {
- return applyUseMoneyExtendMapper.getUserMoneyByMoneyId(flowMainId);
- }
- @Autowired
- private FrameDataService frameDataService;
- public PageInfo<Map> findApplyUseMoneyListByInfo(Tablepar tablepar, String name, String startTime, String endTime) {
- PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
- List<Map> list = applyExtendMapper.findApplyUseMoneyListByInfo(name, startTime, endTime);
- for (Map map : list) {
- if (map.get("file_data_ids") != null) {
- List<Map<String, String>> fileList = new ArrayList<>();
- Map<String, String> stringStringHashMap=null;
- String[] file_data_ids = map.get("file_data_ids").toString().split(",");
- for (String file_data_id : file_data_ids) {
- stringStringHashMap = new HashMap<>();
- FrameData frameData = frameDataService.selectByPrimaryKey(file_data_id);
- stringStringHashMap.put("id",file_data_id);
- stringStringHashMap.put("fileName",frameData!=null?frameData.getFileName():null);
- fileList.add(stringStringHashMap);
- }
- map.put("file_data_ids",fileList);
- }
- }
- PageInfo<Map> pageInfo = new PageInfo<>(list);
- return pageInfo;
- }
- public List<Map> findAllApplyUseMoneyListByInfo(String name, String startTime, String endTime) {
- List<Map> list = applyExtendMapper.findApplyUseMoneyListByInfo(name, startTime, endTime);
- for (Map map : list) {
- if (map.get("file_data_ids") != null) {
- List<Map<String, String>> fileList = new ArrayList<>();
- Map<String, String> stringStringHashMap=null;
- String[] file_data_ids = map.get("file_data_ids").toString().split(",");
- for (String file_data_id : file_data_ids) {
- stringStringHashMap = new HashMap<>();
- FrameData frameData = frameDataService.selectByPrimaryKey(file_data_id);
- stringStringHashMap.put("id",file_data_id);
- stringStringHashMap.put("fileName",frameData!=null?frameData.getFileName():null);
- fileList.add(stringStringHashMap);
- }
- map.put("file_data_ids",fileList);
- }
- }
- return list;
- }
- }
|