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 { //文件mapper @Autowired private ApplyUseMoneyMapper modelMapper; @Autowired private ApplyUseMoneyExtendMapper applyUseMoneyExtendMapper; @Autowired private ApplyExtendMapper applyExtendMapper; /** * 分页查询 * * @return */ public PageInfo list(Tablepar tablepar, ApplyUseMoney model, DateTrans dt) { PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize()); List list = null;//modelMapper.selectByExample(getCondition(model,dt)); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } public Object listAll(ApplyUseMoney model, DateTrans dt) { List list = null;//modelMapper.selectByExample(getCondition(model,dt)); return list; } @Override public int deleteByPrimaryKey(String ids) { List 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 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 getUserMoneyByMoneyId(String flowMainId) { return applyUseMoneyExtendMapper.getUserMoneyByMoneyId(flowMainId); } @Autowired private FrameDataService frameDataService; public PageInfo findApplyUseMoneyListByInfo(Tablepar tablepar, String name, String startTime, String endTime) { PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize()); List list = applyExtendMapper.findApplyUseMoneyListByInfo(name, startTime, endTime); for (Map map : list) { if (map.get("file_data_ids") != null) { List> fileList = new ArrayList<>(); Map 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 pageInfo = new PageInfo<>(list); return pageInfo; } public List findAllApplyUseMoneyListByInfo(String name, String startTime, String endTime) { List list = applyExtendMapper.findApplyUseMoneyListByInfo(name, startTime, endTime); for (Map map : list) { if (map.get("file_data_ids") != null) { List> fileList = new ArrayList<>(); Map 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; } }