叉车部署
This commit is contained in:
parent
0bb922ddc1
commit
5dc6592314
|
@ -192,6 +192,10 @@ public class Area extends BaseEntity implements LogBizParam
|
|||
@ApiModelProperty("超时是否自动断电")
|
||||
private Boolean timeoutLock;
|
||||
|
||||
@Excel(name = "骑行前是否需要绕车检查视频")
|
||||
@ApiModelProperty("骑行前是否需要绕车检查视频")
|
||||
private Boolean needCheckVideo;
|
||||
|
||||
@Override
|
||||
public Object logBizId() {
|
||||
return id;
|
||||
|
|
|
@ -49,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ba.ring_radius,
|
||||
ba.required_ring_radius,
|
||||
ba.timeout_lock,
|
||||
ba.need_check_video,
|
||||
su.nick_name as user_name,
|
||||
su.agent_id as agent_id,
|
||||
su.user_name as user_phone,
|
||||
|
@ -177,6 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="ringRadius != null">ring_radius,</if>
|
||||
<if test="requiredRingRadius != null">required_ring_radius,</if>
|
||||
<if test="timeoutLock != null">timeout_lock,</if>
|
||||
<if test="needCheckVideo != null">need_check_video,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
|
@ -216,7 +218,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="ringRadius != null">#{ringRadius},</if>
|
||||
<if test="requiredRingRadius != null">#{requiredRingRadius},</if>
|
||||
<if test="timeoutLock != null">#{timeoutLock},</if>
|
||||
</trim>
|
||||
<if test="needCheckVideo != null">#{needCheckVideo},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateArea" parameterType="Area">
|
||||
|
@ -265,6 +268,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="data.ringRadius != null">ring_radius = #{data.ringRadius},</if>
|
||||
<if test="data.requiredRingRadius != null">required_ring_radius = #{data.requiredRingRadius},</if>
|
||||
<if test="data.timeoutLock != null">timeout_lock = #{data.timeoutLock},</if>
|
||||
<if test="data.needCheckVideo != null">need_check_video = #{data.needCheckVideo},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteAreaById" parameterType="Long">
|
||||
|
|
|
@ -24,17 +24,18 @@ import lombok.Getter;
|
|||
@AllArgsConstructor
|
||||
public enum ChannelApiType {
|
||||
|
||||
WECHAT("WX", "微信支付",WxPayService.class, false),
|
||||
ALI("ALI", "支付宝", AliPayService.class, true),
|
||||
BANK("BANK", "银行卡", null, false),
|
||||
BALANCE("BALANCE", "余额支付", null, true),
|
||||
TM_WX("TM_WX", "太米微信支付", TmPayService.class, true),
|
||||
CREDIT("CREDIT", "挂账", CreditPayServiceImpl.class, true);
|
||||
WECHAT("WX", "微信支付",WxPayService.class, false, true),
|
||||
ALI("ALI", "支付宝", AliPayService.class, true, true),
|
||||
BANK("BANK", "银行卡", null, false, true),
|
||||
BALANCE("BALANCE", "余额支付", null, true, true),
|
||||
TM_WX("TM_WX", "太米微信支付", TmPayService.class, true, true),
|
||||
CREDIT("CREDIT", "挂账", CreditPayServiceImpl.class, true, false);
|
||||
|
||||
private final String type;
|
||||
private final String name;
|
||||
private final Class<? extends PayApi> payApi;
|
||||
private final Boolean isRefundSync; // 退款是否同步通知
|
||||
private final Boolean needPay; // 是否需要前端调起支付
|
||||
|
||||
public static ChannelApiType parse(String type) {
|
||||
for (ChannelApiType value : ChannelApiType.values()) {
|
||||
|
|
|
@ -38,7 +38,6 @@ public class Credit extends BaseEntity
|
|||
|
||||
@Excel(name = "额度限制")
|
||||
@ApiModelProperty("额度限制")
|
||||
@NotNull(message = "额度限制不能为空", groups = {ValidGroup.Create.class})
|
||||
@Min(value = 0, message = "额度限制不能小于0")
|
||||
private BigDecimal limitAmount;
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="addUsedAmount">
|
||||
update bst_credit bc
|
||||
set bc.used_amount = bc.used_amount + #{amount}
|
||||
where bc.id = #{id} and bc.used_amount + #{amount} <= bc.limit_amount
|
||||
where bc.id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -23,4 +23,5 @@ public interface CreditValidator {
|
|||
* @return
|
||||
*/
|
||||
boolean hasPermission(List<Long> ids, AreaJoinPermission permission);
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public class CreditConverterImpl implements CreditConverter {
|
|||
po.setLimitAmount(data.getLimitAmount());
|
||||
po.setCreateId(data.getCreateId());
|
||||
po.setAreaId(data.getAreaId());
|
||||
po.setLogo(data.getLogo());
|
||||
return po;
|
||||
}
|
||||
|
||||
|
@ -53,6 +54,7 @@ public class CreditConverterImpl implements CreditConverter {
|
|||
po.setStatus(data.getStatus());
|
||||
po.setLimitAmount(data.getLimitAmount());
|
||||
po.setAreaId(data.getAreaId());
|
||||
po.setLogo(data.getLogo());
|
||||
return po;
|
||||
|
||||
}
|
||||
|
|
|
@ -34,4 +34,5 @@ public class CreditValidatorImpl implements CreditValidator {
|
|||
List<Long> creditIds = creditMapper.selectIdList(query);
|
||||
return new HashSet<>(creditIds).containsAll(ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,4 +80,16 @@ public class CreditPay extends BaseEntity
|
|||
@Excel(name = "支付时间")
|
||||
@ApiModelProperty("支付时间")
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@Excel(name = "运营区名称")
|
||||
@ApiModelProperty("运营区名称")
|
||||
private String areaName;
|
||||
|
||||
@Excel(name = "挂账方名称")
|
||||
@ApiModelProperty("挂账方名称")
|
||||
private String creditName;
|
||||
|
||||
@Excel(name = "挂账用户名称")
|
||||
@ApiModelProperty("挂账用户名称")
|
||||
private String creditUserName;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bcp.bst_type,
|
||||
bcp.description,
|
||||
bcp.status,
|
||||
bcp.pay_time
|
||||
bcp.pay_time,
|
||||
bcp.area_name,
|
||||
bcp.credit_name,
|
||||
bcp.credit_user_name
|
||||
from bst_credit_pay bcp
|
||||
</sql>
|
||||
|
||||
|
@ -40,6 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.description != null and query.description != ''"> and bcp.description like concat('%', #{query.description}, '%')</if>
|
||||
<if test="query.status != null and query.status != ''"> and bcp.status = #{query.status}</if>
|
||||
<if test="query.eqOutTradeNo != null and query.eqOutTradeNo != ''"> and bcp.out_trade_no = #{query.eqOutTradeNo}</if>
|
||||
<if test="query.areaName != null and query.areaName != ''"> and bcp.area_name like concat('%', #{query.areaName}, '%')</if>
|
||||
<if test="query.creditName != null and query.creditName != ''"> and bcp.credit_name like concat('%', #{query.creditName}, '%')</if>
|
||||
<if test="query.creditUserName != null and query.creditUserName != ''"> and bcp.credit_user_name like concat('%', #{query.creditUserName}, '%')</if>
|
||||
${query.params.dataScope}
|
||||
</sql>
|
||||
|
||||
|
@ -73,6 +79,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="payTime != null">pay_time,</if>
|
||||
<if test="areaName != null and areaName != ''">area_name,</if>
|
||||
<if test="creditName != null and creditName != ''">credit_name,</if>
|
||||
<if test="creditUserName != null and creditUserName != ''">credit_user_name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="no != null and no != ''">#{no},</if>
|
||||
|
@ -90,6 +99,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="payTime != null">#{payTime},</if>
|
||||
<if test="areaName != null and areaName != ''">#{areaName},</if>
|
||||
<if test="creditName != null and creditName != ''">#{creditName},</if>
|
||||
<if test="creditUserName != null and creditUserName != ''">#{creditUserName},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -117,6 +129,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="data.status != null and data.status != ''">status = #{data.status},</if>
|
||||
<if test="data.areaId != null">area_id = #{data.areaId},</if>
|
||||
<if test="data.payTime != null">pay_time = #{data.payTime},</if>
|
||||
<if test="data.areaName != null and data.areaName != ''">area_name = #{data.areaName},</if>
|
||||
<if test="data.creditName != null and data.creditName != ''">credit_name = #{data.creditName},</if>
|
||||
<if test="data.creditUserName != null and data.creditUserName != ''">credit_user_name = #{data.creditUserName},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteCreditPayById" parameterType="Long">
|
||||
|
|
|
@ -159,7 +159,6 @@ public class CreditPayServiceImpl implements CreditPayService, PayApi
|
|||
PayVO pay = payService.selectByNo(payable.payableOutTradeNo());
|
||||
ServiceUtil.assertion(pay == null, "编号为%s的支付单不存在", payable.payableOutTradeNo());
|
||||
|
||||
|
||||
// 创建挂账支付单
|
||||
CreditPay po = new CreditPay();
|
||||
po.setOutTradeNo(payable.payableOutTradeNo());
|
||||
|
@ -171,6 +170,9 @@ public class CreditPayServiceImpl implements CreditPayService, PayApi
|
|||
po.setCreditUserId(creditUser.getId());
|
||||
po.setUserId(creditUser.getUserId());
|
||||
po.setAreaId(creditUser.getAreaId());
|
||||
po.setAreaName(creditUser.getAreaName());
|
||||
po.setCreditName(creditUser.getCreditName());
|
||||
po.setCreditUserName(creditUser.getUserName());
|
||||
// 业务信息
|
||||
po.setBstId(pay.getBstId());
|
||||
po.setBstType(pay.getBstType());
|
||||
|
|
|
@ -36,7 +36,6 @@ public class CreditUser extends BaseEntity
|
|||
|
||||
@Excel(name = "每月限额")
|
||||
@ApiModelProperty("每月限额")
|
||||
@NotNull(message = "每月限额不能为空", groups = {ValidGroup.Create.class})
|
||||
@Min(value = 0, message = "每月限额不能小于0")
|
||||
private BigDecimal limitAmount;
|
||||
|
||||
|
|
|
@ -10,4 +10,7 @@ public class CreditUserQuery extends CreditUserVO {
|
|||
|
||||
@ApiModelProperty("id列表")
|
||||
private List<Long> ids;
|
||||
|
||||
@ApiModelProperty("排除id")
|
||||
private Long excludeId;
|
||||
}
|
||||
|
|
|
@ -80,4 +80,11 @@ public interface CreditUserMapper
|
|||
* @return
|
||||
*/
|
||||
int addUsedAmount(@Param("id") Long id, @Param("amount") BigDecimal amount);
|
||||
|
||||
/**
|
||||
* 查询数量
|
||||
* @param query 查询条件
|
||||
* @return 数量
|
||||
*/
|
||||
int selectCount(@Param("query") CreditUserQuery query);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.creditName != null and query.creditName != ''"> and bc.name like concat('%', #{query.creditName}, '%')</if>
|
||||
<if test="query.areaName != null and query.areaName != ''"> and ba.name like concat('%', #{query.areaName}, '%')</if>
|
||||
<if test="query.areaId != null "> and bc.area_id = #{query.areaId}</if>
|
||||
<if test="query.excludeId != null "> and bcu.id != #{query.excludeId}</if>
|
||||
<if test="query.ids != null and query.ids.size > 0">
|
||||
and bcu.id in
|
||||
<foreach item="item" collection="query.ids" open="(" separator="," close=")">
|
||||
|
@ -64,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectCreditUserById" parameterType="Long" resultMap="CreditUserResult">
|
||||
<include refid="selectCreditUserVo"/>
|
||||
where id = #{id}
|
||||
where bcu.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertCreditUser" parameterType="CreditUser" useGeneratedKeys="true" keyProperty="id">
|
||||
|
@ -128,7 +129,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="addUsedAmount">
|
||||
update bst_credit_user bcu
|
||||
set bcu.used_amount = bcu.used_amount + #{amount}
|
||||
where bcu.id = #{id} and bcu.used_amount + #{amount} <= bcu.limit_amount
|
||||
where bcu.id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<!-- selectCount -->
|
||||
|
||||
<select id="selectCount" parameterType="CreditUserQuery" resultType="Integer">
|
||||
select count(bcu.id)
|
||||
from <include refid="searchTables"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -18,4 +18,10 @@ public interface CreditUserValidator {
|
|||
* 校验权限
|
||||
*/
|
||||
boolean hasPermission(List<Long> ids, AreaJoinPermission permission);
|
||||
|
||||
/**
|
||||
* 校验挂账用户
|
||||
* @param id
|
||||
*/
|
||||
void validate(Long id);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinPermission;
|
||||
|
@ -13,6 +14,7 @@ import com.ruoyi.bst.creditUser.domain.CreditUserQuery;
|
|||
import com.ruoyi.bst.creditUser.domain.CreditUserVO;
|
||||
import com.ruoyi.bst.creditUser.mapper.CreditUserMapper;
|
||||
import com.ruoyi.bst.creditUser.service.CreditUserService;
|
||||
import com.ruoyi.bst.creditUser.service.CreditUserValidator;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.MathUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
@ -29,6 +31,12 @@ public class CreditUserServiceImpl implements CreditUserService
|
|||
@Autowired
|
||||
private CreditUserMapper creditUserMapper;
|
||||
|
||||
@Autowired
|
||||
private CreditUserValidator creditUserValidator;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
/**
|
||||
* 查询挂账用户
|
||||
*
|
||||
|
@ -76,7 +84,15 @@ public class CreditUserServiceImpl implements CreditUserService
|
|||
public int insertCreditUser(CreditUser creditUser)
|
||||
{
|
||||
creditUser.setCreateTime(DateUtils.getNowDate());
|
||||
return creditUserMapper.insertCreditUser(creditUser);
|
||||
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
int rows = creditUserMapper.insertCreditUser(creditUser);
|
||||
if (rows > 0) {
|
||||
creditUserValidator.validate(creditUser.getId());
|
||||
}
|
||||
return rows;
|
||||
});
|
||||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,7 +104,14 @@ public class CreditUserServiceImpl implements CreditUserService
|
|||
@Override
|
||||
public int updateCreditUser(CreditUser creditUser)
|
||||
{
|
||||
return creditUserMapper.updateCreditUser(creditUser);
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
int rows = creditUserMapper.updateCreditUser(creditUser);
|
||||
if (rows > 0) {
|
||||
creditUserValidator.validate(creditUser.getId());
|
||||
}
|
||||
return rows;
|
||||
});
|
||||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,9 +8,11 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinPermission;
|
||||
import com.ruoyi.bst.creditUser.domain.CreditUserQuery;
|
||||
import com.ruoyi.bst.creditUser.domain.CreditUserVO;
|
||||
import com.ruoyi.bst.creditUser.mapper.CreditUserMapper;
|
||||
import com.ruoyi.bst.creditUser.service.CreditUserValidator;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
||||
@Service
|
||||
|
@ -36,5 +38,30 @@ public class CreditUserValidatorImpl implements CreditUserValidator {
|
|||
return new HashSet<>(creditUserIds).containsAll(ids);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void validate(Long id) {
|
||||
CreditUserVO creditUser = creditUserMapper.selectCreditUserById(id);
|
||||
ServiceUtil.assertion(creditUser == null, "挂账用户不存在");
|
||||
|
||||
// 判断是否重复挂账
|
||||
boolean isRepeat = this.isRepeat(creditUser.getUserId(), creditUser.getCreditId(), creditUser.getId());
|
||||
ServiceUtil.assertion(isRepeat, "挂账用户%s已存在%s中,请勿重复挂账", creditUser.getUserName(), creditUser.getCreditName());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private boolean isRepeat(Long userId, Long creditId, Long id) {
|
||||
if (userId == null || creditId == null) {
|
||||
return false;
|
||||
}
|
||||
CreditUserQuery query = new CreditUserQuery();
|
||||
query.setUserId(userId);
|
||||
query.setCreditId(creditId);
|
||||
query.setExcludeId(id);
|
||||
int count = creditUserMapper.selectCount(query);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -160,6 +160,7 @@ public class OrderConverterImpl implements OrderConverter{
|
|||
|
||||
// 设备
|
||||
DeviceVO device = deviceService.selectDeviceById(dto.getDeviceId());
|
||||
deviceAssembler.assembleIot(device);
|
||||
bo.setDevice(device);
|
||||
|
||||
if (device != null) {
|
||||
|
@ -457,6 +458,7 @@ public class OrderConverterImpl implements OrderConverter{
|
|||
DeviceVO newDevice = null;
|
||||
if (dto.getDeviceId() != null) {
|
||||
newDevice = deviceService.selectDeviceById(dto.getDeviceId());
|
||||
deviceAssembler.assembleIot(newDevice);
|
||||
ServiceUtil.assertion(newDevice == null, "ID为%s的设备不存在", dto.getDeviceId());
|
||||
} else if (StringUtils.isNotBlank(dto.getDeviceSn())) {
|
||||
newDevice = deviceService.selectDeviceBySn(dto.getDeviceSn());
|
||||
|
|
|
@ -349,7 +349,6 @@ public class PayServiceImpl implements PayService {
|
|||
this.handleSuccess(pay.getNo(), LocalDateTime.now());
|
||||
}, 1L, TimeUnit.SECONDS);
|
||||
} else {
|
||||
vo.setNeedPay(true);
|
||||
// 获取渠道信息
|
||||
ChannelVO channel = channelService.selectChannelByChannelId(pay.getChannelId());
|
||||
ServiceUtil.assertion(channel == null, "ID为%s的支付渠道不存在", pay.getChannelId());
|
||||
|
@ -357,7 +356,11 @@ public class PayServiceImpl implements PayService {
|
|||
channel.getName());
|
||||
|
||||
// 获取API
|
||||
PayApi payApi = ChannelApiType.getPayApi(channel.getApiType());
|
||||
ChannelApiType apiType = ChannelApiType.parse(channel.getApiType());
|
||||
ServiceUtil.assertion(apiType == null, "ID为%s的支付渠道API类型不存在", pay.getChannelId());
|
||||
vo.setNeedPay(apiType.getNeedPay());
|
||||
|
||||
PayApi payApi = apiType.getPayApi(apiType);
|
||||
ServiceUtil.assertion(payApi == null, "当前支付渠道开发中,请尝试其他渠道");
|
||||
|
||||
// 获取应用信息
|
||||
|
|
Loading…
Reference in New Issue
Block a user