diff --git a/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java b/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java index 2de11c09c..e7e4ac899 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java @@ -1129,7 +1129,11 @@ public class OrderService { List result = Lists.newArrayList(); // 查询会员在站点是否是白名单用户 PileStationWhitelist whitelist = pileStationWhitelistService.queryWhitelistByMemberId(dto.getStationId(), dto.getMemberId()); - boolean flag = whitelist != null; + boolean flag = false; + if (whitelist != null) { + flag = true; + } + if (flag) { result.add( PayModeVO.builder() diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberBasicInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberBasicInfoController.java index 085a1e60b..b32433084 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberBasicInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberBasicInfoController.java @@ -154,6 +154,11 @@ public class MemberBasicInfoController extends BaseController { return getDataTable(list); } + /** + * 修改车牌号信息 + * @param relation + * @return + */ @PreAuthorize("@ss.hasPermi('member:info:edit')") @Log(title = "修改车牌号信息", businessType = BusinessType.UPDATE) @PostMapping("/updatePlateNumber") @@ -174,4 +179,13 @@ public class MemberBasicInfoController extends BaseController { logger.info("后管解除绑定用户:{} 的车牌号:{}", relation.getMemberId(), relation.getLicensePlateNumber()); return toAjax(i); } + + /** + * 修改平台测试员状态 + * + */ + public AjaxResult updatePlatformTester() { + AjaxResult result = new AjaxResult(); + return result; + } } diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileMerchantInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileMerchantInfoController.java index 7de832f47..2e0b8f889 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileMerchantInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileMerchantInfoController.java @@ -5,6 +5,7 @@ import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.domain.AjaxResult; import com.jsowell.common.core.page.TableDataInfo; import com.jsowell.common.enums.BusinessType; +import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.poi.ExcelUtil; import com.jsowell.pile.domain.PileMerchantInfo; import com.jsowell.pile.dto.CreateMerchantDTO; @@ -79,7 +80,14 @@ public class PileMerchantInfoController extends BaseController { @Log(title = "充电桩运营商信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody CreateMerchantDTO pileMerchantInfo) { - return toAjax(pileMerchantInfoService.insertPileMerchantInfo(pileMerchantInfo)); + AjaxResult result; + try { + int i = pileMerchantInfoService.insertPileMerchantInfo(pileMerchantInfo); + result = toAjax(i); + } catch (BusinessException e) { + result = AjaxResult.error(e.getMessage()); + } + return result; } /** diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java index db6cedb0a..e119d2c71 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java @@ -5,6 +5,7 @@ import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.entity.SysDept; import com.jsowell.common.core.domain.entity.SysUser; import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; +import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.DictUtils; import com.jsowell.common.util.SecurityUtils; @@ -17,6 +18,7 @@ import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.system.service.SysDeptService; import com.jsowell.system.service.SysUserService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -91,6 +93,9 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService { @Override @Transactional public int insertPileMerchantInfo(CreateMerchantDTO dto) { + // 校验参数 + verifyParameters(dto); + // 1. 新增sys_dept SysDept dept = new SysDept(); dept.setParentId(100L); @@ -130,6 +135,46 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService { return i; } + /** + * verifyParameters + */ + private void verifyParameters(CreateMerchantDTO dto) { + PileMerchantInfo pileMerchantInfo; + // 校验组织机构代码是否重复 + if (StringUtils.isNotBlank(dto.getOrganizationCode())) { + pileMerchantInfo = new PileMerchantInfo(); + pileMerchantInfo.setOrganizationCode(dto.getOrganizationCode()); + List pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoList(pileMerchantInfo); + if (CollectionUtils.isNotEmpty(pileMerchantInfos)) { + throw new BusinessException("", "输入的组织机构代码已存在"); + } + } + + // 校验运营商名称是否重复 + if (StringUtils.isNotBlank(dto.getMerchantName())) { + pileMerchantInfo = new PileMerchantInfo(); + pileMerchantInfo.setMerchantName(dto.getMerchantName()); + List pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoList(pileMerchantInfo); + if (CollectionUtils.isNotEmpty(pileMerchantInfos)) { + for (PileMerchantInfo merchantInfo : pileMerchantInfos) { + if (StringUtils.equals(merchantInfo.getMerchantName(), dto.getMerchantName())) { + throw new BusinessException("", "输入的运营商名称已存在"); + } + } + } + } + + // 校验手机号是否重复 + if (StringUtils.isNotBlank(dto.getManagerPhone())) { + pileMerchantInfo = new PileMerchantInfo(); + pileMerchantInfo.setManagerPhone(dto.getManagerPhone()); + List pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoList(pileMerchantInfo); + if (CollectionUtils.isNotEmpty(pileMerchantInfos)) { + throw new BusinessException("", "输入的管理员电话已存在"); + } + } + } + /** * 修改充电桩运营商信息 *