package com.allpayx.atsmpservice.service.impl; import com.allpayx.atsmpservice.common.CommonMethod; import com.allpayx.atsmpservice.common.GetExcelInfoUtil; import com.allpayx.atsmpservice.exception.CheckException; import com.allpayx.atsmpservice.exception.FormalException; import com.allpayx.atsmpservice.mapper.master.UserMapper; import com.allpayx.atsmpservice.mapper.slaver.AtsTxMapper; import com.allpayx.atsmpservice.message.CommonMessage; import com.allpayx.atsmpservice.param.RequestParam.RecoredConfirmInfoRequest; import com.allpayx.atsmpservice.param.ResponseParam.RecoredConfirmInfoResponse; import com.allpayx.atsmpservice.service.UserService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.util.List; /** * @Company : AllPay * @author : lei.chen * @CreateDate : 2019/2/26 16:58 */ @Service public class UserServiceImpl implements UserService { @Autowired private UserMapper userMapper; @Autowired private AtsTxMapper atsTxMapper; /** *入账信息查询 */ @Override public PageInfo selectRecordConfirmInfo(RecoredConfirmInfoRequest recoredConfirmInfo) { PageHelper.startPage(recoredConfirmInfo.getPage_num(),recoredConfirmInfo.getPage_size()); List recoredConfirmInfoResponse = null; try { recoredConfirmInfoResponse = atsTxMapper.selectRecordConfirmInfo(recoredConfirmInfo); } catch (Exception e) { e.printStackTrace(); throw new CheckException("查询入账信息时发生异常\r errorInfo:"+e.getLocalizedMessage()); } if(recoredConfirmInfoResponse.size()==0){ throw new FormalException("入账信息为空"); } for(int i =0;i< recoredConfirmInfoResponse.size();i++){ if(recoredConfirmInfoResponse.get(i).getDone_time()!=null){ String done_time = recoredConfirmInfoResponse.get(i).getDone_time().substring(0,recoredConfirmInfoResponse.get(i).getDone_time().indexOf(".")); recoredConfirmInfoResponse.get(i).setDone_time(done_time);} String create_time = recoredConfirmInfoResponse.get(i).getCreate_time().substring(0,recoredConfirmInfoResponse.get(i).getCreate_time().indexOf(".")); recoredConfirmInfoResponse.get(i).setCreate_time(create_time); } PageInfo PageInfo = new PageInfo<>(recoredConfirmInfoResponse); return PageInfo; } @Override public List getRecoredExportReport(RecoredConfirmInfoRequest recoredConfirmInfo) { List recoredConfirmInfoResponse = null; try { recoredConfirmInfoResponse = atsTxMapper.selectRecordConfirmInfo(recoredConfirmInfo); } catch (Exception e) { e.printStackTrace(); throw new CheckException("查询入账信息时发生异常\r errorInfo:"+e.getLocalizedMessage()); } if(recoredConfirmInfoResponse.size()==0){ throw new FormalException("入账信息为空"); } for(int i =0;i< recoredConfirmInfoResponse.size();i++){ String create_time = recoredConfirmInfoResponse.get(i).getCreate_time().substring(0,recoredConfirmInfoResponse.get(i).getCreate_time().indexOf(".")); recoredConfirmInfoResponse.get(i).setCreate_time(create_time); if(recoredConfirmInfoResponse.get(i).getDone_time()!=null){ String done_time = recoredConfirmInfoResponse.get(i).getDone_time().substring(0,recoredConfirmInfoResponse.get(i).getDone_time().indexOf(".")); recoredConfirmInfoResponse.get(i).setDone_time(done_time);} } return recoredConfirmInfoResponse; } @Override public void insertRecoredImportReport(MultipartFile file) { //根据传入的入账信息Excel表格文件,解析出需要插入的集合数据 List excelInfo = GetExcelInfoUtil.getExcelInfo(file); if(excelInfo.size()==0){ throw new FormalException("Excel表格文件信息为空"); } for(int i=0;i