更新9.26
This commit is contained in:
parent
2ec927d3b0
commit
aebd7f67d3
@ -104,5 +104,10 @@ public class FleetInfoController extends BaseController {
|
||||
public ResponseObject addFleetInfo(@RequestBody FleetInfo fleetInfo) {
|
||||
return getSuccessResult(fleetInfoService.addFleetInfo(fleetInfo));
|
||||
}
|
||||
|
||||
@GetMapping("/getFleetInfoByFleetId")
|
||||
public ResponseObject getFleetInfoByFleetId(@Param("fleetId")Integer fleetId){
|
||||
return getSuccessResult(fleetInfoService.queryByFleetId(fleetId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,4 +75,6 @@ public interface FleetInfoService {
|
||||
* @return
|
||||
*/
|
||||
int addFleetInfo(FleetInfo fleetInfo);
|
||||
|
||||
FleetInfoUniVo queryByFleetId(Integer fleetId);
|
||||
}
|
||||
|
@ -296,6 +296,29 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper,FleetInfo>
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FleetInfoUniVo queryByFleetId(Integer fleetId) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
//查询当前登录人的车队信息
|
||||
FleetMember fleetMembers = fleetMemberMapper.selectOne(new LambdaQueryWrapper<FleetMember>()
|
||||
.eq(FleetMember::getFleetId, fleetId)
|
||||
.eq(FleetMember::getUserId, nowAccountInfo.getId()));
|
||||
//获取所在车队的id集合
|
||||
// List<Integer> fleetIds = fleetMembers.stream().map(FleetMember::getFleetId).collect(Collectors.toList());
|
||||
if (ObjectUtil.isEmpty(fleetMembers)) {
|
||||
throw new RuntimeException("未绑定车队");
|
||||
}
|
||||
|
||||
FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper<FleetInfo>()
|
||||
.eq(FleetInfo::getId, fleetId));
|
||||
|
||||
|
||||
FleetInfoUniVo fleetInfoUniVo = BeanUtil.copyProperties(fleetInfo, FleetInfoUniVo.class);
|
||||
fleetInfoUniVo.setStoreName(mtStoreMapper.selectById(fleetInfo.getStoreId()).getName());
|
||||
|
||||
return fleetInfoUniVo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建用户的基础信息
|
||||
|
@ -350,52 +350,68 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
||||
LambdaQueryWrapper<IntegralSettings> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(IntegralSettings::getStoreId, storeId);
|
||||
IntegralSettings integralSettings = integralSettingsMapper.selectOne(queryWrapper);
|
||||
JSONArray jsonArray = JSONArray.parseArray(integralSettings.getPointsObtained());
|
||||
IntegralSettingsVo integralSettingsVo = new IntegralSettingsVo();
|
||||
List<IntegralSettingsBo> integralSettingsList = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
String day = jsonArray.getJSONObject(i).get("day").toString();
|
||||
Integer points = Integer.parseInt(jsonArray.getJSONObject(i).get("integral").toString());
|
||||
IntegralSettingsBo integralSettings1 = new IntegralSettingsBo();
|
||||
integralSettings1.setIntegralName(day);
|
||||
integralSettings1.setIntegral(points);
|
||||
integralSettingsList.add(integralSettings1);
|
||||
}
|
||||
integralSettingsVo.setIntegralSettings(integralSettingsList);
|
||||
if (ObjectUtil.isNotEmpty(integralSettings)) {
|
||||
JSONArray jsonArray = JSONArray.parseArray(integralSettings.getPointsObtained());
|
||||
if (ObjectUtil.isNotEmpty(integralSettings.getSignApplicableRules()) && integralSettings.getSignApplicableRules() == 0) {
|
||||
int length = 30;
|
||||
for (int i = 0; i < length; i++) {
|
||||
IntegralSettingsBo integralSettings1 = new IntegralSettingsBo();
|
||||
if (ObjectUtil.isNotEmpty(jsonArray.getJSONObject(0))) {
|
||||
Integer points = Integer.parseInt(jsonArray.getJSONObject(0).get("integral").toString());
|
||||
integralSettings1.setIntegral(points);
|
||||
}
|
||||
integralSettings1.setIntegralName("第" + i + 1 + "天");
|
||||
integralSettingsList.add(integralSettings1);
|
||||
}
|
||||
}else if (ObjectUtil.isNotEmpty(integralSettings.getSignApplicableRules()) && integralSettings.getSignApplicableRules() == 1) {
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
String day = jsonArray.getJSONObject(i).get("day").toString();
|
||||
Integer points = Integer.parseInt(jsonArray.getJSONObject(i).get("integral").toString());
|
||||
IntegralSettingsBo integralSettings1 = new IntegralSettingsBo();
|
||||
// integralSettings1.setIntegralName(day);
|
||||
integralSettings1.setIntegralName("第" +( i + 1 )+ "天");
|
||||
integralSettings1.setIntegral(points);
|
||||
integralSettingsList.add(integralSettings1);
|
||||
}
|
||||
integralSettingsVo.setIntegralSettings(integralSettingsList);
|
||||
}
|
||||
|
||||
DateTime now = DateUtil.date();
|
||||
DateTime yesterDay = DateUtil.offsetDay(now, -1);
|
||||
//查询连续签到天数
|
||||
IntegralDetail integralDetail = integralDetailMapper.selectOne(new LambdaQueryWrapper<IntegralDetail>()
|
||||
.eq(IntegralDetail::getUserId, nowAccountInfo.getId())
|
||||
.eq(IntegralDetail::getStoreId, storeId)
|
||||
.eq(IntegralDetail::getType, "签到赠送")
|
||||
.between(IntegralDetail::getCreateTime, DateUtil.beginOfDay(yesterDay), now)
|
||||
.orderBy(true, false, IntegralDetail::getCreateTime).last("limit 1"));
|
||||
DateTime now = DateUtil.date();
|
||||
DateTime yesterDay = DateUtil.offsetDay(now, -1);
|
||||
//查询连续签到天数
|
||||
IntegralDetail integralDetail = integralDetailMapper.selectOne(new LambdaQueryWrapper<IntegralDetail>()
|
||||
.eq(IntegralDetail::getUserId, nowAccountInfo.getId())
|
||||
.eq(IntegralDetail::getStoreId, storeId)
|
||||
.eq(IntegralDetail::getType, "签到赠送")
|
||||
.between(IntegralDetail::getCreateTime, DateUtil.beginOfDay(yesterDay), now)
|
||||
.orderBy(true, false, IntegralDetail::getCreateTime).last("limit 1"));
|
||||
|
||||
// if (CollUtil.isNotEmpty(day)) {
|
||||
// IntegralDetail integralDetail = day.get(0);
|
||||
if (ObjectUtil.isNotEmpty(integralDetail)) {
|
||||
// 正则表达式,匹配数字
|
||||
Pattern pattern = Pattern.compile("\\d+");
|
||||
Matcher matcher = pattern.matcher(integralDetail.getChangeReason());
|
||||
StringBuilder numbers = new StringBuilder();
|
||||
numbers.append(0);
|
||||
while (matcher.find()) {
|
||||
numbers.append(matcher.group());
|
||||
}
|
||||
if (StrUtil.isEmpty(numbers)) {
|
||||
integralSettingsVo.setSignInDays("0");
|
||||
}
|
||||
String str = numbers.toString();
|
||||
if (Integer.parseInt(str) >= 10) {
|
||||
numbers.deleteCharAt(0);
|
||||
}
|
||||
integralSettingsVo.setSignInDays(numbers.toString());
|
||||
}else {
|
||||
if (ObjectUtil.isNotEmpty(integralDetail)) {
|
||||
// 正则表达式,匹配数字
|
||||
Pattern pattern = Pattern.compile("\\d+");
|
||||
Matcher matcher = pattern.matcher(integralDetail.getChangeReason());
|
||||
StringBuilder numbers = new StringBuilder();
|
||||
numbers.append(0);
|
||||
while (matcher.find()) {
|
||||
numbers.append(matcher.group());
|
||||
}
|
||||
if (StrUtil.isEmpty(numbers)) {
|
||||
integralSettingsVo.setSignInDays("0");
|
||||
}
|
||||
String str = numbers.toString();
|
||||
if (Integer.parseInt(str) >= 10) {
|
||||
numbers.deleteCharAt(0);
|
||||
}
|
||||
integralSettingsVo.setSignInDays(numbers.toString());
|
||||
} else {
|
||||
integralSettingsVo.setSignInDays("0");
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
return integralSettingsVo;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user