|  |  |  | 
|---|
|  |  |  | 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.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_1308); | 
|---|
|  |  |  | 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<InoutSettle> settleList = hApiShServiceImpl.listInoutSettle(companyId, param.getDepotId(), startTime, param.getEndTime(), InoutConstant.TYPE_OUT); | 
|---|
|  |  |  | List<InoutSettle> settleList = hApiShServiceImpl.listInoutSettle(companyId, param.getDepotId(), param.getStartTime(), param.getEndTime(), InoutConstant.TYPE_OUT); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //响应数据为空则直接返回响应码2000 | 
|---|
|  |  |  | if (settleList == null || settleList.isEmpty()) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | dto.setJssl(String.valueOf(settle.getSettleWeight())); | 
|---|
|  |  |  | dto.setJsdj(settle.getPayPrice() + ""); | 
|---|
|  |  |  | dto.setJsje(settle.getPaySum() + ""); | 
|---|
|  |  |  | dto.setJsje(settle.getPayMoney() + ""); | 
|---|
|  |  |  | if(null == settle.getPayTime()){ | 
|---|
|  |  |  | settle.setPayTime(new Date()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | dto.setFkr(settle.getPayUser()); | 
|---|
|  |  |  | inoutRecord = hApiShServiceImpl.getInoutRecord(companyId, settle.getId()); | 
|---|
|  |  |  | if(null != inoutRecord){ | 
|---|
|  |  |  | dto.setZznm(inoutRecord.getDepotId().substring(0, 21)); | 
|---|
|  |  |  | dto.setZznm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()).substring(0, 21)); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | dto.setZznm("0"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | dto.setJsyxm(StringUtils.isEmpty(settle.getPayUser())?"0":settle.getPayUser()); | 
|---|
|  |  |  | dto.setShrxm(StringUtils.isEmpty(settle.getPayUser())?"0":settle.getPayUser()); | 
|---|
|  |  |  | dto.setShsj(DateFormatUtils.format(settle.getPayTime(),"yyyy-MM-dd HH:mm:ss")); | 
|---|
|  |  |  | //  dto.setKhmc(StringUtils.isEmpty(settle.getCustomerName())?"0":settle.getCustomerName()); TODO | 
|---|
|  |  |  | dto.setKhmc(StringUtils.isEmpty(settle.getPayee())?"0":settle.getPayee()); | 
|---|
|  |  |  | dto.setZdrxm(StringUtils.isEmpty(settle.getPayUser())?"0":settle.getPayUser()); | 
|---|
|  |  |  | dto.setZdsj(DateFormatUtils.format(settle.getPayTime(),"yyyy-MM-dd HH:mm:ss")); | 
|---|
|  |  |  | dto.setJsfsmc(StringUtils.isEmpty(settle.getPayType())?"0":settle.getPayType()); | 
|---|
|  |  |  | dto.setSjjssl(settle.getSettleWeight() + ""); | 
|---|
|  |  |  | dto.setSjjsje(settle.getPaySum() + ""); | 
|---|
|  |  |  | dto.setSjjsje(settle.getPayMoney() + ""); | 
|---|
|  |  |  | dto.setHjsl(settle.getSettleWeight() + ""); | 
|---|
|  |  |  | dto.setSkfsbh(StringUtils.isEmpty(settle.getPayType())?"0":settle.getPayType()); | 
|---|
|  |  |  |  | 
|---|