package com.dy.pipIrrRemote.monitor.p202404V201.cd35;
|
|
import com.dy.pipIrrGlobal.daoPr.PrIntakeVcMapper;
|
import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper;
|
import com.dy.pipIrrGlobal.daoRm.RmCommandOpenMapper;
|
import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper;
|
import com.dy.pipIrrGlobal.pojoRm.RmCommandOpen;
|
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
|
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
|
import com.dy.pipIrrRemote.monitor.common.ComSv;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* @Author: liurunyu
|
* @Date: 2025/6/30 08:30
|
* @Description
|
*/
|
@Slf4j
|
@Service("cd35Sv")
|
public class CdSv extends ComSv {
|
@Autowired
|
protected SeVirtualCardMapper seVirtualCardDao ;
|
@Autowired
|
protected PrWaterPriceMapper prWaterPriceDao ;
|
@Autowired
|
protected PrIntakeVcMapper prIntakeVcDao ;
|
@Autowired
|
protected RmCommandOpenMapper rmCommandOpenDao ;
|
|
public VoVirtualCard selectClientVtCardById(Long id){
|
return seVirtualCardDao.getVcById(id) ;
|
}
|
public Double selectWaterPrice(){
|
return prWaterPriceDao.getPrice() ;
|
}
|
/**
|
* 根据取水口ID获取与之绑定虚拟卡ID
|
* @param intakeId
|
* @return
|
*/
|
public Long selectVcIdByIntakeId(Long intakeId) {
|
return prIntakeVcDao.getVcIdByIntakeId(intakeId);
|
}
|
/**
|
* 设置虚拟卡被占用
|
*/
|
@Transactional(rollbackFor = Exception.class)
|
public void setVcUsed(Long id, Long intakeId){
|
SeVirtualCard po = new SeVirtualCard() ;
|
po.setId(id);
|
po.setIntakeId(intakeId);
|
po.setInUse((byte)1);
|
po.setOpenTime(new Date());
|
seVirtualCardDao.updateByPrimaryKeySelective(po);
|
}
|
|
public RmCommandOpen getCommandOpen(Long intakeId){
|
List<RmCommandOpen> list = rmCommandOpenDao.selectByIntakeId(intakeId) ;
|
if(list != null && list.size() > 0){
|
return list.get(0) ;
|
}
|
return null ;
|
}
|
|
@Transactional(rollbackFor = Exception.class)
|
public void saveCommandOpen(RmCommandOpen po){
|
rmCommandOpenDao.insert(po) ;
|
}
|
|
@Transactional(rollbackFor = Exception.class)
|
public void updateCommandOpen(RmCommandOpen po){
|
rmCommandOpenDao.updateByPrimaryKeySelective(po) ;
|
}
|
}
|