| | |
| | | import com.thhy.general.common.BasicStatus; |
| | | import com.thhy.general.config.SysUserInfo; |
| | | import com.thhy.general.exception.BasicException; |
| | | import com.thhy.general.utils.DeepCopyUtils; |
| | | import com.thhy.general.utils.UserInfoUtils; |
| | | import com.thhy.mobile.modules.biz.cultivated.entity.PipeCultivated; |
| | | import com.thhy.mobile.modules.biz.cultivated.entity.PipeIntoListVo; |
| | | import com.thhy.mobile.modules.biz.pipecheckrecord.entity.PipeCheckRecord; |
| | | import com.thhy.mobile.modules.biz.pipecheckrecord.mapper.PipeCheckRecordMapper; |
| | | import com.thhy.mobile.modules.biz.pipeinfo.entity.*; |
| | | import com.thhy.mobile.modules.biz.pipeinfo.mapper.PipeInfoMapper; |
| | | import com.thhy.mobile.modules.biz.pipeinfo.service.PipeInfoService; |
| | | import com.thhy.mobile.modules.biz.repo.entity.RepoRecord; |
| | | import com.thhy.mobile.modules.biz.steelproduce.entity.ProduceDto; |
| | | import com.thhy.mobile.modules.biz.steelproduce.entity.ProduceMonthVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | |
| | | PipeInfo pipeInfo1 = pipeInfoMapper.queryByPipeNum(pipeInfo.getPipeNum()); |
| | | pipeInfoMapper.updateRingNum(pipeInfo1.getRingNum(), pipeInfo.getRingNum()); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> updateDateInfo(PipeInfo pipeInfo) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | PipeInfo pinfos = pipeInfoMapper.queryByPipeNum(pipeInfo.getPipeNum()); |
| | | |
| | | Boolean result = pipeInfoMapper.compelteByRingNumAndPro(pinfos.getRingNum(), pinfos.getProId()); |
| | | if(result==null||!result){ |
| | | throw new BasicException(BasicStatus.RING_NOT_COMPLETE); |
| | | } |
| | | List<PipeIntoListVo> intoListVos = pipeInfoMapper.queryByRingNumAndPro(pinfos.getRingNum(),pinfos.getProId()); |
| | | |
| | | PipeInfo pinfo = pipeInfoMapper.queryByPipeNum(intoListVos.get(0).getPipeNum()); |
| | | if(pinfo.getCheckResult().equals(0)){ |
| | | //水养 |
| | | //PipeCultivated pipeCultivated = pipeInfoMapper.queryWaterTimeByPipeNum(pipeInfo.getPipeNum()); |
| | | |
| | | } |
| | | |
| | | map.put("inModTime",pinfo.getIntoModTime()); |
| | | map.put("outModTime",pinfo.getOutModTime()); |
| | | map.put("placingInTime",pinfo.getPlacingInTime()); |
| | | map.put("placingOutTime",pinfo.getPlacingOutTime()); |
| | | map.put("pouringTime",pinfo.getPouringTime()); |
| | | |
| | | map.put("checkTime",pinfo.getCheckTime()); |
| | | |
| | | PipeCultivated pipeCultivated = pipeInfoMapper.queryWaterTimeByPipeNum(pipeInfo.getPipeNum()); |
| | | map.put("inWaterFlag",false); |
| | | map.put("OutWaterFlag",false); |
| | | map.put("inRepoFlag",false); |
| | | if(pipeCultivated!=null){ |
| | | map.put("inWaterFlag",true); |
| | | map.put("inWaterTime",pipeCultivated.getCreateTime()); |
| | | |
| | | if(pipeCultivated.getOutWater()==2){ |
| | | map.put("OutWaterFlag",true); |
| | | map.put("OutWaterTime",pipeCultivated.getOutTime()); |
| | | RepoRecord repoRecord = pipeInfoMapper.queryRepoDate(pipeInfo.getPipeNum()); |
| | | if(repoRecord!=null){ |
| | | map.put("inRepoFlag",true); |
| | | map.put("inRepoTime",repoRecord.getCreateTime()); |
| | | } |
| | | return map; |
| | | }else{ |
| | | return map; |
| | | } |
| | | }else{ |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void updatePipeDate(PipeDateDto pipeDateDto) { |
| | | PipeInfo pinfo = pipeInfoMapper.queryByPipeNum(pipeDateDto.getPipeNum()); |
| | | |
| | | Boolean result = pipeInfoMapper.compelteByRingNumAndPro(pinfo.getRingNum(), pinfo.getProId()); |
| | | if(result==null||!result){ |
| | | throw new BasicException(BasicStatus.RING_NOT_COMPLETE); |
| | | } |
| | | List<PipeIntoListVo> intoListVos = pipeInfoMapper.queryByRingNumAndPro(pinfo.getRingNum(),pinfo.getProId()); |
| | | |
| | | for(int i=0;i<intoListVos.size();i++){ |
| | | PipeDateDto pd = createNewDate(pipeDateDto,i); |
| | | pd.setPipeNum(intoListVos.get(i).getPipeNum()); |
| | | pipeInfoMapper.updatePipeDateByNum(pd); |
| | | //入模 |
| | | } |
| | | PipeCultivated pipeCultivated = pipeInfoMapper.queryWaterTimeByPipeNum(pipeDateDto.getPipeNum()); |
| | | if (pipeCultivated!=null) { |
| | | pipeCultivated.setCreateTime(pipeDateDto.getInWaterTime()); |
| | | pipeInfoMapper.updateInWaterTime(pipeCultivated); |
| | | if(pipeCultivated.getOutWater()==2){ |
| | | pipeCultivated.setOutTime(pipeDateDto.getOutWaterTime()); |
| | | pipeInfoMapper.updateOutWaterTime(pipeCultivated); |
| | | } |
| | | } |
| | | |
| | | RepoRecord repoRecord = pipeInfoMapper.queryRepoDate(pipeDateDto.getPipeNum()); |
| | | |
| | | if (repoRecord!=null) { |
| | | repoRecord.setCreateTime(pipeDateDto.getInRepoTime()); |
| | | pipeInfoMapper.updateInRepoTime(repoRecord); |
| | | } |
| | | } |
| | | |
| | | public PipeDateDto createNewDate(PipeDateDto pipeDateDto,int index){ |
| | | PipeDateDto pd = new PipeDateDto(); |
| | | if(index==0){ |
| | | DeepCopyUtils.copy(pipeDateDto,pd); |
| | | }else{ |
| | | pd.setInModTime(addMiu(pipeDateDto.getInModTime(),5*index)); |
| | | pd.setOutModTime(addMiu(pipeDateDto.getOutModTime(),5*index)); |
| | | pd.setPouringTime(addMiu(pipeDateDto.getPouringTime(),5*index)); |
| | | pd.setCheckTime(addMiu(pipeDateDto.getCheckTime(),5*index)); |
| | | pd.setPlacingInTime(addMiu(pipeDateDto.getPlacingInTime(),5*index)); |
| | | pd.setPlacingOutTime(addMiu(pipeDateDto.getPlacingOutTime(),5*index)); |
| | | if (pipeDateDto.getInRepoTime()!=null) { |
| | | pd.setInRepoTime(addMiu(pipeDateDto.getInRepoTime(),5*index)); |
| | | } |
| | | if (pipeDateDto.getInWaterTime()!=null) { |
| | | pd.setInWaterTime(addMiu(pipeDateDto.getInWaterTime(),5*index)); |
| | | } |
| | | if (pipeDateDto.getOutWaterTime()!=null) { |
| | | pd.setOutWaterTime(addMiu(pipeDateDto.getOutWaterTime(),5*index)); |
| | | } |
| | | } |
| | | return pd; |
| | | } |
| | | |
| | | public Date addMiu(Date oldTime,int amount){ |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(oldTime); |
| | | calendar.add(Calendar.MINUTE,amount); |
| | | return calendar.getTime(); |
| | | } |
| | | } |