| | |
| | | package com.ld.igds.sh.service; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ld.igds.constant.RedisConst; |
| | | import com.ld.igds.inout.InoutConstant; |
| | | import com.ld.igds.log.service.InteStatusLogService; |
| | | import com.ld.igds.models.InoutNoticeIn; |
| | |
| | | import com.ld.igds.sh.param.BaseParam; |
| | | import com.ld.igds.sh.service.impl.HApiShServiceImpl; |
| | | import com.ld.igds.sh.util.ApiShConst; |
| | | import com.ld.igds.sh.util.ApiShUtil; |
| | | import com.ld.igds.sh.util.RespCodeEnum; |
| | | import com.ld.igds.sh.util.RespUtil; |
| | | import com.ld.igds.util.ContextUtil; |
| | |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import java.util.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 粮食入库信息数据接口 |
| | |
| | | |
| | | String companyId = ContextUtil.getDefaultCompanyId(); |
| | | |
| | | String key = RedisConst.buildKey(companyId, ApiShConst.API_SH_1302); |
| | | Date startTime = (Date) redisUtil.get(key); |
| | | if(null == startTime){ |
| | | startTime = DateUtils.addDays(param.getEndTime(), -30); |
| | | // String key = RedisConst.buildKey(companyId, ApiShConst.API_SH_1112); |
| | | // Date startTime = (Date) redisUtil.get(key); |
| | | // if(null == startTime){ |
| | | // startTime = DateUtils.addDays(param.getEndTime(), -30); |
| | | // } |
| | | // redisUtil.set(key, param.getEndTime()); |
| | | if(null == param.getStartTime()){ |
| | | param.setStartTime(DateUtils.addDays(param.getEndTime(), -1)); |
| | | } |
| | | redisUtil.set(key, param.getEndTime()); |
| | | |
| | | //查询数据 |
| | | List<InoutRecord> inoutRecords = hApiShServiceImpl.listInoutRecord(companyId, param.getDepotId(), startTime, param.getEndTime(), InoutConstant.TYPE_IN); |
| | | List<InoutRecord> inoutRecords = hApiShServiceImpl.listInoutRecord(companyId, param.getDepotId(), param.getStartTime(), param.getEndTime(), InoutConstant.TYPE_IN); |
| | | |
| | | //响应数据为空则直接返回响应码2000 |
| | | if (inoutRecords == null || inoutRecords.isEmpty()) { |
| | |
| | | for (InoutRecord inoutRecord : inoutRecords) { |
| | | dto = new Dto1302(); |
| | | dto.setYwdh("14" + inoutRecord.getId().substring(4, 14)); |
| | | dto.setHwbm(inoutRecord.getDepotId()); |
| | | dto.setHwbm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()) + "01"); |
| | | dto.setYwrq(DateFormatUtils.format(inoutRecord.getCompleteTime(),"yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | dto.setCyr(StringUtils.isEmpty(inoutRecord.getUserName())?"0":inoutRecord.getUserName()); |
| | |
| | | dto.setMzjlsj(DateFormatUtils.format(inoutRecord.getFullWeightTime(),"yyyy-MM-dd HH:mm:ss")); |
| | | dto.setPz(inoutRecord.getEmptyWeight() + ""); |
| | | dto.setPzjlsj(DateFormatUtils.format(inoutRecord.getEmptyWeightTime(),"yyyy-MM-dd HH:mm:ss")); |
| | | // dto.setZjkl(inoutRecord.getDeSum() + ""); TODO |
| | | dto.setZjkl(inoutRecord.getDeCheck() + ""); |
| | | dto.setJz(inoutRecord.getSettleWeight() + ""); |
| | | dto.setCmsj(DateFormatUtils.format(inoutRecord.getCompleteTime(),"yyyy-MM-dd HH:mm:ss")); |
| | | dto.setCmqrmgryxm(StringUtils.isEmpty(inoutRecord.getCompleteUser())?"0":inoutRecord.getCompleteUser()); |
| | |
| | | } |
| | | dto.setDjmgryxm(StringUtils.isEmpty(inoutRecord.getRegisterUser())?"0":inoutRecord.getRegisterUser()); |
| | | dto.setRkdnm(StringUtils.isEmpty(inoutRecord.getNoticeId())?"0":inoutRecord.getNoticeId()); |
| | | dto.setZznm(inoutRecord.getDepotId().substring(0, 21)); |
| | | dto.setZznm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()).substring(0, 21)); |
| | | dto.setSxh(inoutRecord.getId().substring(10)); |
| | | if(InoutConstant.RECORD_STATUS_DEL.equals(inoutRecord.getRecordStatus()) || |
| | | InoutConstant.RECORD_STATUS_ERROR.equals(inoutRecord.getRecordStatus())){ |
| | | "ERROR".equals(inoutRecord.getRecordStatus())){ |
| | | dto.setDjzt("4"); //已作废 |
| | | }else { |
| | | dto.setDjzt("2"); //入库完成 |
| | |
| | | dto.setJssj(DateFormatUtils.format((inoutSettle.getPayTime() == null?new Date():inoutSettle.getPayTime()),"yyyy-MM-dd HH:mm:ss")); |
| | | dto.setJsjz(inoutSettle.getSettleWeight() + ""); |
| | | dto.setJsdj(inoutSettle.getPayPrice() + ""); |
| | | dto.setJsje(inoutSettle.getPaySum() + ""); |
| | | dto.setJsje(inoutSettle.getPayMoney() + ""); |
| | | }else { |
| | | dto.setJssj(DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
| | | dto.setJsjz("0.0"); |