| | |
| | | |
| | | import com.lunhan.water.common.*; |
| | | import com.lunhan.water.common.enums.*; |
| | | import com.lunhan.water.common.jwt.LoginUserDTO; |
| | | import com.lunhan.water.common.model.Tuple; |
| | | import com.lunhan.water.common.util.*; |
| | | import com.lunhan.water.entity.enums.EPayState; |
| | | import com.lunhan.water.entity.enums.EPayType; |
| | | import com.lunhan.water.repository.impl.UserLoginMapperImpl; |
| | | import com.lunhan.water.repository.po.UserLoginPO; |
| | | import org.apache.commons.lang3.BooleanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import com.lunhan.water.repository.impl.RechargeOrderMapperImpl; |
| | |
| | | public class RechargeOrderService extends BaseService { |
| | | @Autowired |
| | | private RechargeOrderMapperImpl mapper; |
| | | @Autowired |
| | | private UserLoginMapperImpl userLoginMapper; |
| | | |
| | | public ExecutedResult<Long> create(ReqCreateRechargeOrder request) { |
| | | public ExecutedResult<Long> create(LoginUserDTO loginUser,ReqCreateRechargeOrder request) { |
| | | // 转换po |
| | | UserLoginPO user = userLoginMapper.get4Openid(loginUser.getUserId()); |
| | | if(Objects.isNull(user)){ |
| | | return ExecutedResult.failed("用户信息不存在!"); |
| | | } |
| | | RechargeOrderPO item = RechargeOrderConvert.INSTANCE.toCreate(request); |
| | | // 设置状态 |
| | | //item.setStatus(EState.NORMAL.getValue()); |
| | | item.setOrderNo("CZ"+SnowFlakeUtil.getId()); |
| | | item.setPayState(EPayState.WAITING.getValue()); |
| | | item.setPayType(EPayType.WX_PAY.getValue()); |
| | | // 设置记录创建时间 |
| | | item.setCreateTime(LocalDateTimeUtil.nowTimeStamp()); |
| | | // 是否删除(逻辑删除)初始值 |