mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-17 08:18:34 +08:00
update
This commit is contained in:
@@ -267,25 +267,29 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int removeStationFromMemberGroup(MemberGroupDTO dto) {
|
public int removeStationFromMemberGroup(MemberGroupDTO dto) {
|
||||||
|
int result = 0;
|
||||||
String stationId = dto.getStationId();
|
String stationId = dto.getStationId();
|
||||||
String groupCode = dto.getGroupCode();
|
String groupCode = dto.getGroupCode();
|
||||||
if (StringUtils.isBlank(stationId) || StringUtils.isBlank(groupCode)) {
|
if (StringUtils.isBlank(stationId) || StringUtils.isBlank(groupCode)) {
|
||||||
return 0;
|
return result;
|
||||||
}
|
}
|
||||||
MemberGroup memberGroup = memberGroupMapper.selectByGroupCode(groupCode);
|
MemberGroup memberGroup = memberGroupMapper.selectByGroupCode(groupCode);
|
||||||
if (Objects.isNull(memberGroup)) {
|
if (Objects.isNull(memberGroup)) {
|
||||||
return 0;
|
return result;
|
||||||
}
|
}
|
||||||
List<String> stationIds = Lists.newArrayList(StringUtils.split(memberGroup.getStationId(), ","));
|
List<String> stationIds = Lists.newArrayList(StringUtils.split(memberGroup.getStationId(), ","));
|
||||||
if (CollectionUtils.isNotEmpty(stationIds)) {
|
if (CollectionUtils.isNotEmpty(stationIds)) {
|
||||||
stationIds.remove(stationId);
|
stationIds.remove(stationId);
|
||||||
memberGroup.setStationId(StringUtils.join(stationIds, ","));
|
memberGroup.setStationId(StringUtils.join(stationIds, ","));
|
||||||
memberGroupMapper.updateMemberGroup(memberGroup);
|
result = memberGroupMapper.updateMemberGroup(memberGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除该站点的会员优惠计费模板
|
// 删除该站点的会员优惠计费模板
|
||||||
pileBillingTemplateService.deletePreferentialBillingTemplate(stationId);
|
int i = pileBillingTemplateService.deletePreferentialBillingTemplate(stationId);
|
||||||
return 0;
|
if (i > 0) {
|
||||||
|
result = result + i;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -467,17 +467,21 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 站点id保存到数据库
|
// 站点id保存到数据库
|
||||||
String groupCode = dto.getGroupCode();
|
MemberGroupVO memberGroupVO = memberGroupService.queryByGroupCode(dto.getGroupCode());
|
||||||
MemberGroupVO memberGroupVO = memberGroupService.queryByGroupCode(groupCode);
|
|
||||||
if (Objects.nonNull(memberGroupVO)) {
|
if (Objects.nonNull(memberGroupVO)) {
|
||||||
|
List<String> stationIdList = Lists.newArrayList(); // 站点id集合
|
||||||
|
if (StringUtils.isNotBlank(memberGroupVO.getStationId())) {
|
||||||
|
stationIdList = Lists.newArrayList(StringUtils.split(memberGroupVO.getStationId(), ","));
|
||||||
|
}
|
||||||
// 查询该站点是否已经创建过会员优惠计费模板了
|
// 查询该站点是否已经创建过会员优惠计费模板了
|
||||||
List<String> stationIdList = Lists.newArrayList(StringUtils.split(memberGroupVO.getStationId(), ","));
|
|
||||||
if (CollectionUtils.isNotEmpty(stationIdList) && stationIdList.contains(dto.getStationId())) {
|
if (CollectionUtils.isNotEmpty(stationIdList) && stationIdList.contains(dto.getStationId())) {
|
||||||
throw new BusinessException("", "该站点已经创建过会员优惠计费模板");
|
throw new BusinessException("", "该站点已经创建过会员优惠计费模板");
|
||||||
}
|
}
|
||||||
|
// 更新数据
|
||||||
MemberGroup updateData = new MemberGroup();
|
MemberGroup updateData = new MemberGroup();
|
||||||
updateData.setId(memberGroupVO.getId());
|
updateData.setId(memberGroupVO.getId());
|
||||||
updateData.setStationId(memberGroupVO.getStationId() + "," + dto.getStationId());
|
stationIdList.add(dto.getStationId());
|
||||||
|
updateData.setStationId(StringUtils.join(stationIdList.stream().sorted().collect(Collectors.toList()), ","));
|
||||||
memberGroupService.updateMemberGroup(updateData);
|
memberGroupService.updateMemberGroup(updateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user