更新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) {
|
public ResponseObject addFleetInfo(@RequestBody FleetInfo fleetInfo) {
|
||||||
return getSuccessResult(fleetInfoService.addFleetInfo(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
|
* @return
|
||||||
*/
|
*/
|
||||||
int addFleetInfo(FleetInfo fleetInfo);
|
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<>();
|
LambdaQueryWrapper<IntegralSettings> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(IntegralSettings::getStoreId, storeId);
|
queryWrapper.eq(IntegralSettings::getStoreId, storeId);
|
||||||
IntegralSettings integralSettings = integralSettingsMapper.selectOne(queryWrapper);
|
IntegralSettings integralSettings = integralSettingsMapper.selectOne(queryWrapper);
|
||||||
JSONArray jsonArray = JSONArray.parseArray(integralSettings.getPointsObtained());
|
|
||||||
IntegralSettingsVo integralSettingsVo = new IntegralSettingsVo();
|
IntegralSettingsVo integralSettingsVo = new IntegralSettingsVo();
|
||||||
List<IntegralSettingsBo> integralSettingsList = new ArrayList<>();
|
List<IntegralSettingsBo> integralSettingsList = new ArrayList<>();
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
if (ObjectUtil.isNotEmpty(integralSettings)) {
|
||||||
String day = jsonArray.getJSONObject(i).get("day").toString();
|
JSONArray jsonArray = JSONArray.parseArray(integralSettings.getPointsObtained());
|
||||||
Integer points = Integer.parseInt(jsonArray.getJSONObject(i).get("integral").toString());
|
if (ObjectUtil.isNotEmpty(integralSettings.getSignApplicableRules()) && integralSettings.getSignApplicableRules() == 0) {
|
||||||
IntegralSettingsBo integralSettings1 = new IntegralSettingsBo();
|
int length = 30;
|
||||||
integralSettings1.setIntegralName(day);
|
for (int i = 0; i < length; i++) {
|
||||||
integralSettings1.setIntegral(points);
|
IntegralSettingsBo integralSettings1 = new IntegralSettingsBo();
|
||||||
integralSettingsList.add(integralSettings1);
|
if (ObjectUtil.isNotEmpty(jsonArray.getJSONObject(0))) {
|
||||||
}
|
Integer points = Integer.parseInt(jsonArray.getJSONObject(0).get("integral").toString());
|
||||||
integralSettingsVo.setIntegralSettings(integralSettingsList);
|
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 now = DateUtil.date();
|
||||||
DateTime yesterDay = DateUtil.offsetDay(now, -1);
|
DateTime yesterDay = DateUtil.offsetDay(now, -1);
|
||||||
//查询连续签到天数
|
//查询连续签到天数
|
||||||
IntegralDetail integralDetail = integralDetailMapper.selectOne(new LambdaQueryWrapper<IntegralDetail>()
|
IntegralDetail integralDetail = integralDetailMapper.selectOne(new LambdaQueryWrapper<IntegralDetail>()
|
||||||
.eq(IntegralDetail::getUserId, nowAccountInfo.getId())
|
.eq(IntegralDetail::getUserId, nowAccountInfo.getId())
|
||||||
.eq(IntegralDetail::getStoreId, storeId)
|
.eq(IntegralDetail::getStoreId, storeId)
|
||||||
.eq(IntegralDetail::getType, "签到赠送")
|
.eq(IntegralDetail::getType, "签到赠送")
|
||||||
.between(IntegralDetail::getCreateTime, DateUtil.beginOfDay(yesterDay), now)
|
.between(IntegralDetail::getCreateTime, DateUtil.beginOfDay(yesterDay), now)
|
||||||
.orderBy(true, false, IntegralDetail::getCreateTime).last("limit 1"));
|
.orderBy(true, false, IntegralDetail::getCreateTime).last("limit 1"));
|
||||||
|
|
||||||
// if (CollUtil.isNotEmpty(day)) {
|
// if (CollUtil.isNotEmpty(day)) {
|
||||||
// IntegralDetail integralDetail = day.get(0);
|
// IntegralDetail integralDetail = day.get(0);
|
||||||
if (ObjectUtil.isNotEmpty(integralDetail)) {
|
if (ObjectUtil.isNotEmpty(integralDetail)) {
|
||||||
// 正则表达式,匹配数字
|
// 正则表达式,匹配数字
|
||||||
Pattern pattern = Pattern.compile("\\d+");
|
Pattern pattern = Pattern.compile("\\d+");
|
||||||
Matcher matcher = pattern.matcher(integralDetail.getChangeReason());
|
Matcher matcher = pattern.matcher(integralDetail.getChangeReason());
|
||||||
StringBuilder numbers = new StringBuilder();
|
StringBuilder numbers = new StringBuilder();
|
||||||
numbers.append(0);
|
numbers.append(0);
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
numbers.append(matcher.group());
|
numbers.append(matcher.group());
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(numbers)) {
|
if (StrUtil.isEmpty(numbers)) {
|
||||||
integralSettingsVo.setSignInDays("0");
|
integralSettingsVo.setSignInDays("0");
|
||||||
}
|
}
|
||||||
String str = numbers.toString();
|
String str = numbers.toString();
|
||||||
if (Integer.parseInt(str) >= 10) {
|
if (Integer.parseInt(str) >= 10) {
|
||||||
numbers.deleteCharAt(0);
|
numbers.deleteCharAt(0);
|
||||||
}
|
}
|
||||||
integralSettingsVo.setSignInDays(numbers.toString());
|
integralSettingsVo.setSignInDays(numbers.toString());
|
||||||
}else {
|
} else {
|
||||||
integralSettingsVo.setSignInDays("0");
|
integralSettingsVo.setSignInDays("0");
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
return integralSettingsVo;
|
return integralSettingsVo;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user