更新10.9

This commit is contained in:
许允枞 2024-10-09 09:50:26 +08:00
parent 7ed57397c0
commit 127d1b7a8a
3 changed files with 63 additions and 31 deletions

View File

@ -39,7 +39,7 @@
<select id="getByStoreId" resultMap="IntegralSettingsMap"> <select id="getByStoreId" resultMap="IntegralSettingsMap">
select select
id, refuel_points_rules, refuel_points_function, refuel_scene_type, refuel_amount_type, refuel_value_participation, refuel_scene_rules, refuel_consumption_amount, refuel_points, refuel_fuel_amount, refuel_fuel_volume, recharge_give, invite_give, invite_give_rules, sign_in_function, sign_in_rules, points_obtained, points_rules, store_id, create_time, update_time, create_by, update_by, chain_store_id id, refuel_points_rules, refuel_points_function, refuel_scene_type, refuel_amount_type, refuel_value_participation, refuel_scene_rules, refuel_consumption_amount, refuel_points, refuel_fuel_amount, refuel_fuel_volume, recharge_give, invite_give, invite_give_rules, sign_in_function, sign_in_rules, points_obtained, points_rules, store_id, create_time, update_time, create_by, update_by, chain_store_id, sign_applicable_rules, sign_cycle
from integral_settings from integral_settings
where store_id = #{storeId} where store_id = #{storeId}
</select> </select>

View File

@ -286,7 +286,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
List<IntegralDetail> signInGifts = integralDetailMapper.signInGiftsYesterday("签到赠送", ljUserVos.getId(), ljUserVos.getChainStoreId()); List<IntegralDetail> signInGifts = integralDetailMapper.signInGiftsYesterday("签到赠送", ljUserVos.getId(), ljUserVos.getChainStoreId());
if (ObjectUtil.isEmpty(signInGifts)) { if (ObjectUtil.isEmpty(signInGifts)) {
extracted(ljUserVos, jsonArray, 0); extracted(integralSetting, ljUserVos, jsonArray, 0);
} else { } else {
String changeReason = signInGifts.get(0).getChangeReason(); String changeReason = signInGifts.get(0).getChangeReason();
@ -310,7 +310,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
// if (dayInt > 8 && 8< jsonArray.size()) { // if (dayInt > 8 && 8< jsonArray.size()) {
// extracted(ljUserVos, jsonArray, dayInt); // extracted(ljUserVos, jsonArray, dayInt);
// } else if (dayInt >= 1 && dayInt <= jsonArray.size()) { // } else if (dayInt >= 1 && dayInt <= jsonArray.size()) {
extracted(ljUserVos, jsonArray, dayInt); extracted(integralSetting, ljUserVos, jsonArray, dayInt - 1);
// } // }
} }
} }
@ -366,13 +366,13 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
integralSettingsList.add(integralSettings1); integralSettingsList.add(integralSettings1);
} }
integralSettingsVo.setIntegralSettings(integralSettingsList); integralSettingsVo.setIntegralSettings(integralSettingsList);
}else if (integralSettings.getSignApplicableRules() == 1) { } else if (integralSettings.getSignApplicableRules() == 1) {
for (int i = 0; i < jsonArray.size(); i++) { for (int i = 0; i < jsonArray.size(); i++) {
String day = jsonArray.getJSONObject(i).get("day").toString(); String day = jsonArray.getJSONObject(i).get("day").toString();
Integer points = Integer.parseInt(jsonArray.getJSONObject(i).get("integral").toString()); Integer points = Integer.parseInt(jsonArray.getJSONObject(i).get("integral").toString());
IntegralSettingsBo integralSettings1 = new IntegralSettingsBo(); IntegralSettingsBo integralSettings1 = new IntegralSettingsBo();
// integralSettings1.setIntegralName(day); // integralSettings1.setIntegralName(day);
integralSettings1.setIntegralName("" +( i + 1 )+ ""); integralSettings1.setIntegralName("" + (i + 1) + "");
integralSettings1.setIntegral(points); integralSettings1.setIntegral(points);
integralSettingsList.add(integralSettings1); integralSettingsList.add(integralSettings1);
} }
@ -391,27 +391,27 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
// 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();
StringBuilder classColor = new StringBuilder(); StringBuilder classColor = new StringBuilder();
numbers.append(0); numbers.append(0);
while (matcher.find()) { while (matcher.find()) {
numbers.append(matcher.group()); numbers.append(matcher.group());
classColor.append(matcher.group()); classColor.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());
integralSettingsVo.setClassColor(Integer.parseInt(classColor.toString())); integralSettingsVo.setClassColor(Integer.parseInt(classColor.toString()));
} else { } else {
integralSettingsVo.setSignInDays("0"); integralSettingsVo.setSignInDays("0");
} }
// } // }
@ -474,17 +474,48 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
} }
} }
private void extracted(LJUserVo ljUserVos, JSONArray jsonArray, int dayInt) { private void extracted(IntegralSettings integralSetting, LJUserVo ljUserVos, JSONArray jsonArray, int dayInt) {
IntegralDetail integralDetail = new IntegralDetail(); IntegralDetail integralDetail = new IntegralDetail();
integralDetail.setStoreId(ljUserVos.getStoreId()); integralDetail.setStoreId(ljUserVos.getStoreId());
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
if (dayInt >= 8) { //判断有没有规则
jsonObject = jsonArray.getJSONObject(7); if (integralSetting.getSignApplicableRules() == 0) {
jsonObject = jsonArray.getJSONObject(0);
} else if (integralSetting.getSignApplicableRules() == 1) {
switch (integralSetting.getSignCycle()) {
case 0:
// System.out.println("dayInt: " + dayInt);
// System.out.println("jsonArray size: " + jsonArray.size());
} else { if (dayInt >= 6) {
jsonObject = jsonArray.getJSONObject(dayInt); jsonObject = jsonArray.getJSONObject(6);
} else {
jsonObject = jsonArray.getJSONObject(dayInt);
}
break;
case 1:
if (dayInt >= 13) {
jsonObject = jsonArray.getJSONObject(13);
}else {
jsonObject = jsonArray.getJSONObject(dayInt);
}
break;
case 2:
if (dayInt >= 29) {
jsonObject = jsonArray.getJSONObject(29);
}else {
jsonObject = jsonArray.getJSONObject(dayInt);
}
break;
}
} }
// if (dayInt >= 8) {
// jsonObject = jsonArray.getJSONObject(7);
//
// } else {
// jsonObject = jsonArray.getJSONObject(dayInt);
// }
Map<String, Object> map = new HashMap<>(jsonObject); Map<String, Object> map = new HashMap<>(jsonObject);

View File

@ -112,6 +112,7 @@
this.getList() this.getList()
} }
}) })
this.getList()
} }
}, },
// //