| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ld.igds.constant.FoodVariety; |
| | | import com.ld.igds.constant.RedisConst; |
| | | import com.ld.igds.inout.InoutConstant; |
| | | import com.ld.igds.log.service.InteStatusLogService; |
| | | import com.ld.igds.models.InoutNoticeOut; |
| | |
| | | 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_1306); |
| | | 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_OUT); |
| | | List<InoutRecord> inoutRecords = hApiShServiceImpl.listInoutRecord(companyId, param.getDepotId(), param.getStartTime(), param.getEndTime(), InoutConstant.TYPE_OUT); |
| | | |
| | | //响应数据为空则直接返回响应码2000 |
| | | if (inoutRecords == null || inoutRecords.isEmpty()) { |
| | |
| | | for (InoutRecord inoutRecord : inoutRecords) { |
| | | dto = new Dto1306(); |
| | | dto.setYwdh("14" + inoutRecord.getId().substring(4, 14)); |
| | | dto.setHwbm(inoutRecord.getDepotId()); |
| | | dto.setHwbm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()) + "01"); |
| | | dto.setCktzdh(inoutRecord.getNoticeId()); |
| | | dto.setYwlx("1"); |
| | | dto.setYwrq(DateFormatUtils.format(inoutRecord.getCompleteTime(),"yyyy-MM-dd HH:mm:ss")); |
| | |
| | | dto.setDjmgryxm(StringUtils.isEmpty(inoutRecord.getFoodVariety())?"0":inoutRecord.getRegisterUser()); |
| | | dto.setCmqrmgryxm(StringUtils.isEmpty(inoutRecord.getCompleteUser())?"0":inoutRecord.getCompleteUser()); |
| | | dto.setNm(inoutRecord.getId()); |
| | | dto.setZznm(inoutRecord.getDepotId().substring(0, 21)); |
| | | dto.setZznm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()).substring(0, 21)); |
| | | dto.setDjbh(inoutRecord.getId()); |
| | | dto.setSxh(inoutRecord.getId().substring(10)); |
| | | if(InoutConstant.RECORD_STATUS_DEL.equals(inoutRecord.getRecordStatus()) ){ |
| | | if(InoutConstant.RECORD_STATUS_DEL.equals(inoutRecord.getRecordStatus()) || |
| | | "ERROR".equals(inoutRecord.getRecordStatus())){ |
| | | dto.setDjzt("4"); //已作废 |
| | | }else { |
| | | dto.setDjzt("2"); //出库完成 |
| | |
| | | dto.setJzqj(DateFormatUtils.format(inoutRecord.getCompleteTime(),"yyyy-MM-dd HH:mm:ss")); |
| | | dto.setNx(StringUtils.isEmpty(inoutRecord.getFoodYear())?"0":inoutRecord.getFoodYear()); |
| | | dto.setKcxznm(StringUtils.isEmpty(inoutRecord.getFoodType())?"0":inoutRecord.getFoodType()); |
| | | dto.setApclcf(inoutRecord.getDepotId()); |
| | | dto.setApclhw(inoutRecord.getDepotId()); |
| | | dto.setSjclcf(inoutRecord.getDepotId()); |
| | | dto.setSjclcfnm(inoutRecord.getDepotId()); |
| | | dto.setSjclhw(inoutRecord.getDepotId()); |
| | | dto.setSjclhwnm(inoutRecord.getDepotId()); |
| | | dto.setApclcf(ApiShUtil.getGbDepotId(inoutRecord.getDepotId())); |
| | | dto.setApclhw(ApiShUtil.getGbDepotId(inoutRecord.getDepotId())); |
| | | dto.setSjclcf(ApiShUtil.getGbDepotId(inoutRecord.getDepotId())); |
| | | dto.setSjclcfnm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId())); |
| | | dto.setSjclhw(ApiShUtil.getGbDepotId(inoutRecord.getDepotId())); |
| | | dto.setSjclhwnm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId())); |
| | | dto.setBgy(StringUtils.isEmpty(inoutRecord.getHandleUser())?"0":inoutRecord.getHandleUser()); |
| | | dto.setQtkl(inoutRecord.getDeOther() + ""); |
| | | dto.setLhnd(StringUtils.isEmpty(inoutRecord.getFoodYear())?"0":inoutRecord.getFoodYear()); |