更新9.28
This commit is contained in:
parent
3d1db972d5
commit
4b735e02ce
@ -127,5 +127,15 @@ public class FleetInfoController extends BaseController {
|
||||
public ResponseObject getFleetInfoByFleetId(@Param("fleetId")Integer fleetId){
|
||||
return getSuccessResult(fleetInfoService.queryByFleetId(fleetId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户是否是该车队的管理员
|
||||
* @param fleetId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/ifFleetAdmin")
|
||||
public ResponseObject ifFleetAdmin(Integer fleetId) {
|
||||
return getSuccessResult(fleetInfoService.ifFleetAdmin(fleetId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
</select>
|
||||
<select id="selectRemainCreditLimitByFleetId" resultType="java.lang.Double"
|
||||
parameterType="java.lang.Integer">
|
||||
select count(remaining_credit_limit)
|
||||
select SUM(remaining_credit_limit)
|
||||
from fleet_member
|
||||
where fleet_id = #{fleetId} and secondary_card_type = 2
|
||||
</select>
|
||||
|
@ -91,4 +91,11 @@ public interface FleetInfoService {
|
||||
* @return
|
||||
*/
|
||||
int editFleetInfo(FleetInfo fleetInfo);
|
||||
|
||||
/**
|
||||
* 判断当前是否是车队管理员(小程序)
|
||||
* @param fleetId
|
||||
* @return
|
||||
*/
|
||||
int ifFleetAdmin(Integer fleetId);
|
||||
}
|
||||
|
@ -377,6 +377,24 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper, FleetInfo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前是否是车队管理员(小程序)
|
||||
*
|
||||
* @param fleetId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int ifFleetAdmin(Integer fleetId) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper<FleetInfo>()
|
||||
.eq(FleetInfo::getId, fleetId)
|
||||
.eq(FleetInfo::getUserId, nowAccountInfo.getId()));
|
||||
if (ObjectUtil.isNotEmpty(fleetInfo)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建用户的基础信息
|
||||
|
@ -203,29 +203,29 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
|
||||
if (ObjectUtil.isNotEmpty(fleetMember1) && fleetMember1.getId() != fleetMember.getId()) {
|
||||
return 0;
|
||||
}
|
||||
//添加到车队额度变化表
|
||||
FleetLinesChange fleetLinesChange = new FleetLinesChange();
|
||||
if (ObjectUtil.isNotEmpty(fleetMember)) {
|
||||
fleetLinesChange.setFleetId(fleetMember.getFleetId());
|
||||
fleetLinesChange.setUserId(fleetMember.getUserId());
|
||||
fleetLinesChange.setStoreId(fleetMember.getStoreId());
|
||||
fleetLinesChange.setAdjustType(fleetMember.getAdjustType());
|
||||
fleetLinesChange.setAdjustLimit(fleetMember.getAdjustLimit());
|
||||
//剩余额度
|
||||
if (ObjectUtil.isNotEmpty(fleetMember1.getRemainingCreditLimit())) {
|
||||
if (fleetMember.getAdjustType().equals("0")) {
|
||||
fleetLinesChange.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() + fleetMember.getAdjustLimit());
|
||||
} else {
|
||||
if (fleetMember1.getRemainingCreditLimit() < fleetMember.getAdjustLimit()) {
|
||||
throw new RuntimeException("当前剩余额度不足,无法扣除");
|
||||
}
|
||||
fleetLinesChange.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() - fleetMember.getAdjustLimit());
|
||||
}
|
||||
}
|
||||
fleetLinesChange.setCreateBy(nowAccountInfo.getId().toString());
|
||||
fleetLinesChange.setCreateTime(DateUtil.date().toLocalDateTime());
|
||||
fleetLinesChangeService.insertFleetLinesChange(fleetLinesChange);
|
||||
}
|
||||
// //添加到车队额度变化表
|
||||
// FleetLinesChange fleetLinesChange = new FleetLinesChange();
|
||||
// if (ObjectUtil.isNotEmpty(fleetMember)) {
|
||||
// fleetLinesChange.setFleetId(fleetMember.getFleetId());
|
||||
// fleetLinesChange.setUserId(fleetMember.getUserId());
|
||||
// fleetLinesChange.setStoreId(fleetMember.getStoreId());
|
||||
// fleetLinesChange.setAdjustType(fleetMember.getAdjustType());
|
||||
// fleetLinesChange.setAdjustLimit(fleetMember.getAdjustLimit());
|
||||
// //剩余额度
|
||||
// if (ObjectUtil.isNotEmpty(fleetMember1.getRemainingCreditLimit())) {
|
||||
// if (fleetMember.getAdjustType().equals("0")) {
|
||||
// fleetLinesChange.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() + fleetMember.getAdjustLimit());
|
||||
// } else {
|
||||
// if (fleetMember1.getRemainingCreditLimit() < fleetMember.getAdjustLimit()) {
|
||||
// throw new RuntimeException("当前剩余额度不足,无法扣除");
|
||||
// }
|
||||
// fleetLinesChange.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() - fleetMember.getAdjustLimit());
|
||||
// }
|
||||
// }
|
||||
// fleetLinesChange.setCreateBy(nowAccountInfo.getId().toString());
|
||||
// fleetLinesChange.setCreateTime(DateUtil.date().toLocalDateTime());
|
||||
// fleetLinesChangeService.insertFleetLinesChange(fleetLinesChange);
|
||||
// }
|
||||
return baseMapper.updateById(fleetMember);
|
||||
}
|
||||
|
||||
@ -317,6 +317,7 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
|
||||
fleetInfo.setRechargeAmount(fleetInfo.getRechargeAmount() + (fleetMember.getAdjustLimit() * recharge));
|
||||
fleetInfo.setGiveAmount(fleetInfo.getGiveAmount() + (fleetMember.getAdjustLimit() * give));
|
||||
}
|
||||
int i = fleetInfoMapper.updateById(fleetInfo);
|
||||
}
|
||||
if (fleetMember.getAdjustType().equals("0")) {
|
||||
fleetLinesChange.setRemainingCreditLimit(fleetMember1.getRemainingCreditLimit() + fleetMember.getAdjustLimit());
|
||||
|
Loading…
Reference in New Issue
Block a user