diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java index a0aaedcbf..b6cf39bf3 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java @@ -215,5 +215,10 @@ public class FleetMemberController extends BaseController { public ResponseObject editLimit(@RequestBody FleetMember fleetMember){ return getSuccessResult(fleetMemberService.editLimit(fleetMember)); } + + @PutMapping("signOUTMember") + public ResponseObject signOUTMember(Integer memberId){ + return getSuccessResult(fleetMemberService.signOUTMember(memberId)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetConsumeRecord.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetConsumeRecord.java index 177081f39..ddb3dfabb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetConsumeRecord.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetConsumeRecord.java @@ -89,6 +89,18 @@ public class FleetConsumeRecord extends BaseEntity implements Serializable { * 更新时间 */ private Date updateTime; + /** + * 余额变化类型 0:-减少 1:增加 + */ + private String changeType; + /** + * 消费来源 + */ + private String fromType; + /** + * 余额变化之后的值 + */ + private Double afterTheChange; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetConsumeRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetConsumeRecordMapper.xml index 526a0e7ed..decd493e2 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetConsumeRecordMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetConsumeRecordMapper.xml @@ -24,17 +24,22 @@ ORDER BY create_time DESC diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java index 0ac7a28fb..6934d28e9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java @@ -94,4 +94,11 @@ public interface FleetMemberService { * @return */ int editLimitPC(FleetMember fleetMember); + + /** + * 注销车队成员 + * @param memberId + * @return + */ + int signOUTMember(Integer memberId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetConsumeRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetConsumeRecordServiceImpl.java index 9a89f9031..1e13a11e9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetConsumeRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetConsumeRecordServiceImpl.java @@ -3,15 +3,21 @@ package com.fuint.business.fleet.service.impl; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.business.fleet.entity.FleetConsumeRecord; +import com.fuint.business.fleet.entity.FleetInfo; +import com.fuint.business.fleet.entity.FleetMember; import com.fuint.business.fleet.mapper.FleetConsumeRecordMapper; +import com.fuint.business.fleet.mapper.FleetInfoMapper; +import com.fuint.business.fleet.mapper.FleetMemberMapper; import com.fuint.business.fleet.service.FleetConsumeRecordService; import com.fuint.business.fleet.vo.FleetConsumeRecordVo; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -23,6 +29,10 @@ import org.springframework.stereotype.Service; @Service("fleetConsumeRecordService") public class FleetConsumeRecordServiceImpl extends ServiceImpl implements FleetConsumeRecordService { + @Autowired + private FleetInfoMapper fleetInfoMapper; + @Autowired + private FleetMemberMapper fleetMemberMapper; @Override public IPage queryPage(Page page, FleetConsumeRecord fleetInfo) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); @@ -84,7 +94,23 @@ public class FleetConsumeRecordServiceImpl extends ServiceImpl queryByPageUni(Page page, FleetConsumeRecordVo fleetConsumeRecord) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); - fleetConsumeRecord.setFleetMemberId(nowAccountInfo.getId()); + //判断当前登陆人是否是车队负责人 + FleetInfo fleetInfo = fleetInfoMapper.selectOne(new LambdaQueryWrapper() + .eq(FleetInfo::getId, fleetConsumeRecord.getFleetId()) + .eq(FleetInfo::getUserId, nowAccountInfo.getId())); + //如果为空,则是车队成员,则查询当前用户的消费记录 + if (ObjectUtil.isEmpty(fleetInfo)) { + FleetMember fleetMember = fleetMemberMapper.selectOne(new LambdaQueryWrapper() + .eq(FleetMember::getUserId, nowAccountInfo.getId()) + .eq(FleetMember::getFleetId, fleetConsumeRecord.getFleetId())); + if (ObjectUtil.isEmpty(fleetMember)) { + throw new RuntimeException("未绑定该车队,无法查看当前车队成员信息"); + } + fleetConsumeRecord.setFleetMemberId(fleetMember.getId()); + }else { + // 查询当前车队的名称 + fleetConsumeRecord.setFleetName(fleetInfo.getFleetName()); + } if (ObjectUtil.isNotEmpty(fleetConsumeRecord.getStartTime())) { DateTime parse = DateUtil.parse(fleetConsumeRecord.getStartTime(), "yyyy-MM"); fleetConsumeRecord.setStartTime(DateUtil.beginOfMonth(parse).toString()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java index 8cdd3c6fe..e36e876cf 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java @@ -319,6 +319,20 @@ public class FleetMemberServiceImpl extends ServiceImpl