修改判断

This commit is contained in:
2025-09-01 12:06:35 +08:00
parent 5d3bb2a092
commit 47c9368a96

View File

@ -56,7 +56,17 @@ public class ReceiveServiceImpl implements ReceiveService {
map.put("code","500"); map.put("code","500");
return map; return map;
} }
BatteryRule batteryRule = JSON.parseObject(String.valueOf(syncRequest.getData()), BatteryRule.class); BatteryRule batteryRule = new BatteryRule();
try {
batteryRule = JSON.parseObject(String.valueOf(syncRequest.getData()), BatteryRule.class);
}catch (Exception e)
{
map.put("msg","数据格式错误");
map.put("exception",e.getMessage());
map.put("code","500");
return map;
}
if (batteryRule.getTitle() == null || batteryRule.getTitle().isEmpty()){ if (batteryRule.getTitle() == null || batteryRule.getTitle().isEmpty()){
map.put("msg","套餐名称不能为空"); map.put("msg","套餐名称不能为空");
map.put("code","500"); map.put("code","500");
@ -168,6 +178,13 @@ public class ReceiveServiceImpl implements ReceiveService {
map.put("code", "500"); map.put("code", "500");
return map; return map;
} }
if(user.getIsmerchant() == 1){
if (user.getStoreId() == null || user.getStoreId().isEmpty()) {
map.put("msg", "用户为商户时门店不能为空");
map.put("code", "500");
return map;
}
}
BaseUser baseUser = new BaseUser(); BaseUser baseUser = new BaseUser();
@ -194,6 +211,7 @@ public class ReceiveServiceImpl implements ReceiveService {
UserStore userStore = new UserStore(); UserStore userStore = new UserStore();
String storeIds = user.getStoreId(); String storeIds = user.getStoreId();
String[] storeIdsArray = storeIds.split(","); String[] storeIdsArray = storeIds.split(",");
for (String storeId : storeIdsArray) { for (String storeId : storeIdsArray) {
userStore.setStoreId(Long.parseLong(storeId)); userStore.setStoreId(Long.parseLong(storeId));