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.ApplyPaymentExtendMapper; import com.idea.oa.apply.mapper.ApplyPaymentMapper; import com.idea.oa.apply.model.ApplyPayment; import com.idea.oa.apply.model.ApplyPaymentExample; import com.idea.oa.apply.model.inout.ApplyPaymentIn; import com.idea.oa.outsource.model.OutOrderPay; 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 ApplyPaymentService implements BaseService { //文件mapper @Autowired private ApplyPaymentMapper modelMapper; @Autowired private ApplyPaymentExtendMapper applyPaymentExtendMapper; @Autowired private ApplyExtendMapper applyExtendMapper; /** * 分页查询 * * @return */ public PageInfo list(Tablepar tablepar, ApplyPayment 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(ApplyPayment model, DateTrans dt) { List list = null;//modelMapper.selectByExample(getCondition(model,dt)); return list; } @Override public int deleteByPrimaryKey(String ids) { List lista = Convert.toListStrArray(ids); ApplyPaymentExample example = new ApplyPaymentExample(); example.createCriteria().andIdIn(lista); return modelMapper.deleteByExample(example); } @Override public ApplyPayment selectByPrimaryKey(String id) { return modelMapper.selectByPrimaryKey(id); } @Override public int updateByPrimaryKeySelective(ApplyPayment record) { return modelMapper.updateByPrimaryKeySelective(record); } @Override public int updateByExampleSelective(ApplyPayment record, ApplyPaymentExample example) { return modelMapper.updateByExampleSelective(record, example); } @Override public int updateByExample(ApplyPayment record, ApplyPaymentExample example) { return modelMapper.updateByExample(record, example); } @Override public List selectByExample(ApplyPaymentExample example) { return modelMapper.selectByExample(example); } @Override public long countByExample(ApplyPaymentExample example) { return modelMapper.countByExample(example); } @Override public int deleteByExample(ApplyPaymentExample example) { return modelMapper.deleteByExample(example); } public int insert(ApplyPayment record) { record.setId(UUIDUtils.middleUUID()); return insertWithoutId(record); } public int insertWithoutId(ApplyPayment record) { return modelMapper.insert(record); } @Override public int insertSelective(ApplyPayment record) { record.setId(UUIDUtils.middleUUID()); record.setCreatedAt(new Date()); return modelMapper.insertSelective(record); } public ApplyPaymentIn getInfoByFlowMainPushId(String flowMainPushId) { return applyPaymentExtendMapper.getInfoByFlowMainPushId(flowMainPushId); } public ApplyPaymentIn getInfoByFlowMainId(String flowMainId) { return applyPaymentExtendMapper.getInfoByFlowMainId(flowMainId); } public Double getTotalMoneyByProId(String proId) { return applyPaymentExtendMapper.getTotalMoneyByProId(proId); } public Double getTotalPayMoneyByProId(String proId) { return applyPaymentExtendMapper.getTotalPayMoneyByProId(proId); } public Double getTotalPayMoneyByOrderNo(String orderNo) { return applyPaymentExtendMapper.getTotalPayMoneyByOrderNo(orderNo); } public OutOrderPay getApplyPaymentByFlowMainId(String flowMainId) { return applyPaymentExtendMapper.getApplyPaymentByFlowMainId(flowMainId); } @Autowired private FrameDataService frameDataService; public PageInfo findApplyPaymentListByInfo(Tablepar tablepar, String name, String startTime, String endTime) { PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize()); List list = applyExtendMapper.findApplyPaymentListByInfo(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 findAllApplyPaymentListByInfo(String name, String startTime, String endTime) { List list = applyExtendMapper.findApplyPaymentListByInfo(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; } }