mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-04 18:10:10 +08:00
update 鉴权卡启动充电
This commit is contained in:
@@ -278,10 +278,7 @@ public class MemberService {
|
||||
.build();
|
||||
checkVerificationCode(registerAndLoginDTO);
|
||||
// 判断当前鉴权卡是否被绑定过
|
||||
PileAuthCard authCard = PileAuthCard.builder()
|
||||
.logicCard(dto.getLogicCard())
|
||||
.build();
|
||||
PileAuthCard pileAuthCardInfo = pileAuthCardService.selectPileAuthCardInfo(authCard);
|
||||
PileAuthCard pileAuthCardInfo = pileAuthCardService.selectCardInfoByLogicCard(dto.getLogicCard());
|
||||
if (pileAuthCardInfo == null){
|
||||
// 为空说明没查到此卡信息
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_THIS_CARD_HAS_NO_INFO);
|
||||
@@ -294,10 +291,12 @@ public class MemberService {
|
||||
// 密钥不一致,不能绑定
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SECRET_KEY_NOT_SAME);
|
||||
}
|
||||
authCard.setMemberId(dto.getMemberId());
|
||||
authCard.setStatus("1"); // 1-正常使用
|
||||
authCard.setCreateBy(dto.getMemberId());
|
||||
authCard.setId(pileAuthCardInfo.getId());
|
||||
PileAuthCard authCard = PileAuthCard.builder()
|
||||
.memberId(dto.getMemberId())
|
||||
.status("1") // 1-正常使用
|
||||
.createBy(dto.getMemberId())
|
||||
.id(pileAuthCardInfo.getId())
|
||||
.build();
|
||||
return pileAuthCardService.updatePileAuthCard(authCard);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,10 +128,7 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
||||
if (StringUtils.equals("01", startMode)) {
|
||||
// 刷卡启动充电
|
||||
// 根据传过来的物理卡号查询数据库中此卡信息
|
||||
PileAuthCard pileAuthCard = PileAuthCard.builder()
|
||||
.logicCard(physicsCard)
|
||||
.build();
|
||||
PileAuthCard pileAuthCardInfo = pileAuthCardService.selectPileAuthCardInfo(pileAuthCard);
|
||||
PileAuthCard pileAuthCardInfo = pileAuthCardService.selectCardInfoByLogicCard(physicsCard);
|
||||
if (pileAuthCardInfo == null) {
|
||||
// 未查到此卡信息
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_THIS_CARD_HAS_NO_INFO);
|
||||
@@ -202,8 +199,11 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
||||
pileTransactionService.doCreateOrder(createOrderTransactionDTO);
|
||||
|
||||
// 将卡状态改为启动锁定
|
||||
pileAuthCard.setId(pileAuthCardInfo.getId());
|
||||
pileAuthCard.setStatus("2");
|
||||
PileAuthCard pileAuthCard = PileAuthCard.builder()
|
||||
.id(pileAuthCardInfo.getId())
|
||||
.logicCard(physicsCard)
|
||||
.status("2")
|
||||
.build();
|
||||
pileAuthCardService.updatePileAuthCard(pileAuthCard);
|
||||
}
|
||||
} catch (BusinessException e){
|
||||
|
||||
@@ -546,15 +546,15 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
|
||||
}
|
||||
if (!StringUtils.equals("0000000000000000", data.getLogicCard())) {
|
||||
// 根据物理卡号查出所属用户
|
||||
PileAuthCard pileAuthCard = PileAuthCard.builder()
|
||||
.logicCard(data.getLogicCard())
|
||||
.build();
|
||||
PileAuthCard cardInfo = pileAuthCardService.selectPileAuthCardInfo(pileAuthCard);
|
||||
PileAuthCard cardInfo = pileAuthCardService.selectCardInfoByLogicCard(data.getLogicCard());
|
||||
if (cardInfo != null) {
|
||||
orderBasicInfo.setMemberId(cardInfo.getMemberId());
|
||||
// 将此卡状态改为正常
|
||||
pileAuthCard.setId(cardInfo.getId());
|
||||
pileAuthCard.setStatus("1");
|
||||
PileAuthCard pileAuthCard = PileAuthCard.builder()
|
||||
.logicCard(data.getLogicCard())
|
||||
.id(cardInfo.getId())
|
||||
.status("1")
|
||||
.build();
|
||||
pileAuthCardService.updatePileAuthCard(pileAuthCard);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import com.jsowell.pile.domain.PileAuthCard;
|
||||
import com.jsowell.pile.dto.PileAuthCardDTO;
|
||||
import com.jsowell.pile.vo.web.PileAuthCardVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
@@ -87,4 +88,12 @@ public interface PileAuthCardMapper {
|
||||
public int deletePileAuthCardByIds(Long[] ids);
|
||||
|
||||
int unBindingCard(PileAuthCard pileAuthCard);
|
||||
|
||||
/**
|
||||
* 根据逻辑卡号查询某状态的鉴权卡信息
|
||||
* @param status
|
||||
* @param logicCard
|
||||
* @return
|
||||
*/
|
||||
PileAuthCard selectSomeStatusCardInfo(@Param("status") String status, @Param("logicCard") String logicCard);
|
||||
}
|
||||
|
||||
@@ -96,4 +96,19 @@ public interface IPileAuthCardService {
|
||||
int deactivateCard(Long id);
|
||||
|
||||
int unBindingCard(PileAuthCard pileAuthCard);
|
||||
|
||||
/**
|
||||
* 根据逻辑卡号查询某状态的鉴权卡信息
|
||||
* @param status
|
||||
* @param logicCard
|
||||
* @return
|
||||
*/
|
||||
PileAuthCard selectSomeStatusCardInfo(String status, String logicCard);
|
||||
|
||||
/**
|
||||
* 通过逻辑卡号查询卡信息
|
||||
* @param logicCard
|
||||
* @return
|
||||
*/
|
||||
PileAuthCard selectCardInfoByLogicCard(String logicCard);
|
||||
}
|
||||
|
||||
@@ -180,4 +180,25 @@ public class PileAuthCardServiceImpl implements IPileAuthCardService {
|
||||
public int unBindingCard(PileAuthCard pileAuthCard) {
|
||||
return pileAuthCardMapper.unBindingCard(pileAuthCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据逻辑卡号查询某状态的鉴权卡信息
|
||||
* @param status
|
||||
* @param logicCard
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PileAuthCard selectSomeStatusCardInfo(String status, String logicCard) {
|
||||
return pileAuthCardMapper.selectSomeStatusCardInfo(status, logicCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过逻辑卡号查询卡信息
|
||||
* @param logicCard
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PileAuthCard selectCardInfoByLogicCard(String logicCard) {
|
||||
return selectSomeStatusCardInfo(null, logicCard);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +144,21 @@
|
||||
and logic_card = #{logicCard,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<select id="selectSomeStatusCardInfo" resultType="com.jsowell.pile.domain.PileAuthCard">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from
|
||||
pile_auth_card
|
||||
where 1 = 1
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="logicCard != null and logicCard != ''">
|
||||
and logic_card = #{logicCard,jdbcType=VARCHAR}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getPileAuthCardInfoList" resultType="com.jsowell.pile.vo.web.PileAuthCardVO">
|
||||
select
|
||||
t1.id,
|
||||
|
||||
Reference in New Issue
Block a user