mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-18 00:38:33 +08:00
汇鑫大厦用户扫码自动把用户加入集团
This commit is contained in:
@@ -10,7 +10,9 @@ import com.jsowell.common.response.RestApiResponse;
|
|||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.common.util.file.AliyunOssUploadUtils;
|
import com.jsowell.common.util.file.AliyunOssUploadUtils;
|
||||||
import com.jsowell.common.util.file.FileUtils;
|
import com.jsowell.common.util.file.FileUtils;
|
||||||
|
import com.jsowell.pile.service.MemberGroupService;
|
||||||
import com.jsowell.pile.service.PileBasicInfoService;
|
import com.jsowell.pile.service.PileBasicInfoService;
|
||||||
|
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.GroundLockInfoVO;
|
import com.jsowell.pile.vo.uniapp.GroundLockInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.PileConnectorVO;
|
import com.jsowell.pile.vo.uniapp.PileConnectorVO;
|
||||||
import com.jsowell.service.PileService;
|
import com.jsowell.service.PileService;
|
||||||
@@ -33,6 +35,9 @@ public class JumpController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PileBasicInfoService pileBasicInfoService;
|
private PileBasicInfoService pileBasicInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MemberGroupService memberGroupService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询充电桩详情
|
* 查询充电桩详情
|
||||||
* http://localhost:8080/app-xcx-h5/pile/pileDetail/{pileSn}
|
* http://localhost:8080/app-xcx-h5/pile/pileDetail/{pileSn}
|
||||||
@@ -44,8 +49,9 @@ public class JumpController extends BaseController {
|
|||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
// 进入充电桩详情做一下鉴权
|
// 进入充电桩详情做一下鉴权
|
||||||
getMemberIdByAuthorization(request);
|
String memberId = getMemberIdByAuthorization(request);
|
||||||
PileConnectorVO vo = pileService.getPileDetailByPileSn(pileSn);
|
PileConnectorVO vo = pileService.getPileDetailByPileSn(pileSn);
|
||||||
|
addMember2MemberGroup(memberId, vo);
|
||||||
response = new RestApiResponse<>(vo);
|
response = new RestApiResponse<>(vo);
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
logger.warn("app-xcx-h5查询充电桩详情 warn", e);
|
logger.warn("app-xcx-h5查询充电桩详情 warn", e);
|
||||||
@@ -58,6 +64,21 @@ public class JumpController extends BaseController {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addMember2MemberGroup(String memberId, PileConnectorVO vo) {
|
||||||
|
if (vo == null || StringUtils.isBlank(memberId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PileInfoVO pileInfo = vo.getPileInfo();
|
||||||
|
if (pileInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String stationId = pileInfo.getStationId();
|
||||||
|
if (!StringUtils.equals(stationId, "159")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memberGroupService.addMember2MemberGroup(memberId, pileInfo.getMerchantId());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询充电枪口详情
|
* 查询充电枪口详情
|
||||||
* http://localhost:8080/app-xcx-h5/pile/connectorDetail/{pileConnectorCode}
|
* http://localhost:8080/app-xcx-h5/pile/connectorDetail/{pileConnectorCode}
|
||||||
@@ -69,8 +90,9 @@ public class JumpController extends BaseController {
|
|||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
// 进入充电桩详情做一下鉴权
|
// 进入充电桩详情做一下鉴权
|
||||||
getMemberIdByAuthorization(request);
|
String memberId = getMemberIdByAuthorization(request);
|
||||||
PileConnectorVO vo = pileService.getConnectorDetail(pileConnectorCode);
|
PileConnectorVO vo = pileService.getConnectorDetail(pileConnectorCode);
|
||||||
|
addMember2MemberGroup(memberId, vo);
|
||||||
response = new RestApiResponse<>(vo);
|
response = new RestApiResponse<>(vo);
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
logger.warn("app-xcx-h5查询充电枪口详情 warn param:{}", pileConnectorCode, e);
|
logger.warn("app-xcx-h5查询充电枪口详情 warn param:{}", pileConnectorCode, e);
|
||||||
|
|||||||
@@ -92,9 +92,6 @@ public class PileService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderBasicInfoService orderBasicInfoService;
|
private OrderBasicInfoService orderBasicInfoService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private YKCPushCommandService ykcPushCommandService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PileRemoteService pileRemoteService;
|
private PileRemoteService pileRemoteService;
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,11 @@ public class BaseController {
|
|||||||
return getLoginUser().getUsername();
|
return getLoginUser().getUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过authorization获取memberId
|
||||||
|
* @param authorization
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getMemberIdByAuthorization(String authorization) {
|
public String getMemberIdByAuthorization(String authorization) {
|
||||||
if (StringUtils.isBlank(authorization)) {
|
if (StringUtils.isBlank(authorization)) {
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
|
throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
|
||||||
@@ -187,26 +192,13 @@ public class BaseController {
|
|||||||
return memberId;
|
return memberId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过request获取memberId
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getMemberIdByAuthorization(HttpServletRequest request) {
|
public String getMemberIdByAuthorization(HttpServletRequest request) {
|
||||||
return getMemberIdByAuthorization(request.getHeader("Authorization"));
|
return getMemberIdByAuthorization(request.getHeader("Authorization"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前登录账号有权限的运营商部门id
|
|
||||||
*
|
|
||||||
* 平台管理员账号会返回空数组
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
/*public List<String> getDeptIds() {
|
|
||||||
// 获取登录账号信息
|
|
||||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
|
||||||
if (authorizedMap == null) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds();
|
|
||||||
if (CollectionUtils.isNotEmpty(merchantDeptIds)) {
|
|
||||||
return merchantDeptIds;
|
|
||||||
}
|
|
||||||
return new ArrayList<>();
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public interface MemberGroupMapper {
|
|||||||
* @param id 会员组主键
|
* @param id 会员组主键
|
||||||
* @return 会员组
|
* @return 会员组
|
||||||
*/
|
*/
|
||||||
public MemberGroup selectMemberGroupById(Long id);
|
MemberGroup selectMemberGroupById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询会员组列表
|
* 查询会员组列表
|
||||||
@@ -33,7 +33,7 @@ public interface MemberGroupMapper {
|
|||||||
* @param memberGroup 会员组
|
* @param memberGroup 会员组
|
||||||
* @return 会员组集合
|
* @return 会员组集合
|
||||||
*/
|
*/
|
||||||
public List<MemberGroup> selectMemberGroupList(MemberGroup memberGroup);
|
List<MemberGroup> selectMemberGroupList(MemberGroup memberGroup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增会员组
|
* 新增会员组
|
||||||
@@ -41,7 +41,7 @@ public interface MemberGroupMapper {
|
|||||||
* @param memberGroup 会员组
|
* @param memberGroup 会员组
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertMemberGroup(MemberGroup memberGroup);
|
int insertMemberGroup(MemberGroup memberGroup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改会员组
|
* 修改会员组
|
||||||
@@ -49,7 +49,7 @@ public interface MemberGroupMapper {
|
|||||||
* @param memberGroup 会员组
|
* @param memberGroup 会员组
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateMemberGroup(MemberGroup memberGroup);
|
int updateMemberGroup(MemberGroup memberGroup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除会员组
|
* 删除会员组
|
||||||
@@ -57,7 +57,7 @@ public interface MemberGroupMapper {
|
|||||||
* @param id 会员组主键
|
* @param id 会员组主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteMemberGroupById(Long id);
|
int deleteMemberGroupById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除会员组
|
* 批量删除会员组
|
||||||
@@ -65,7 +65,7 @@ public interface MemberGroupMapper {
|
|||||||
* @param ids 需要删除的数据主键集合
|
* @param ids 需要删除的数据主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteMemberGroupByIds(Long[] ids);
|
int deleteMemberGroupByIds(Long[] ids);
|
||||||
|
|
||||||
List<MemberGroupVO> queryMemberGroupList(MemberGroupDTO dto);
|
List<MemberGroupVO> queryMemberGroupList(MemberGroupDTO dto);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,6 +100,7 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
// 生成编号
|
// 生成编号
|
||||||
memberGroup.setGroupCode(generateGroupCode());
|
memberGroup.setGroupCode(generateGroupCode());
|
||||||
memberGroup.setCreateTime(DateUtils.getNowDate());
|
memberGroup.setCreateTime(DateUtils.getNowDate());
|
||||||
|
memberGroup.setDelFlag(DelFlagEnum.NORMAL.getValue());
|
||||||
try {
|
try {
|
||||||
String createBy = SecurityUtils.getLoginUser().getUsername();
|
String createBy = SecurityUtils.getLoginUser().getUsername();
|
||||||
memberGroup.setCreateBy(createBy);
|
memberGroup.setCreateBy(createBy);
|
||||||
@@ -108,10 +108,10 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBetween(memberGroup.getDiscount())) {
|
// if (isBetween(memberGroup.getDiscount())) {
|
||||||
// 入库除以10
|
// // 入库除以10
|
||||||
memberGroup.setDiscount(memberGroup.getDiscount().divide(BigDecimal.TEN, 2, RoundingMode.DOWN));
|
// memberGroup.setDiscount(memberGroup.getDiscount().divide(BigDecimal.TEN, 2, RoundingMode.DOWN));
|
||||||
}
|
// }
|
||||||
return memberGroupMapper.insertMemberGroup(memberGroup);
|
return memberGroupMapper.insertMemberGroup(memberGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,11 +288,21 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据运营商id查询会员组
|
||||||
|
* @param merchantId 运营商id
|
||||||
|
* @return 会员组VO
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MemberGroupVO queryByMerchantId(String merchantId) {
|
public MemberGroupVO queryByMerchantId(String merchantId) {
|
||||||
return memberGroupMapper.queryByMerchantId(merchantId);
|
return memberGroupMapper.queryByMerchantId(merchantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据站点id查询会员组
|
||||||
|
* @param stationId 站点id
|
||||||
|
* @return 会员组VO
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MemberGroupVO queryByStationId(String stationId) {
|
public MemberGroupVO queryByStationId(String stationId) {
|
||||||
return memberGroupMapper.queryByStationId(stationId);
|
return memberGroupMapper.queryByStationId(stationId);
|
||||||
|
|||||||
Reference in New Issue
Block a user