This commit is contained in:
2265829957@qq.com 2026-01-17 15:26:41 +08:00
parent 9ce1d4794c
commit 3a5cab69fb
9 changed files with 1414 additions and 1 deletions

View File

@ -147,7 +147,7 @@ public class CheckChargeOrderController {
// //
// System.out.println("==========sss==============="+s); // System.out.println("==========sss==============="+s);
String date= "NR0oe4La+0SLizVoKCDfRkj37avo59qzZBUm7BFSmU+XA81uaP2614Vjbb7VvhRRumS4LwHu6CR981cKMxNM57w7bhdEl/7Q0euTasU7M8fo7HcWH9akyN4bKS3jzYeGs7Zm+J7MXj1713oBDANjUtAbzy+hFyOQH/QOl91vhehanzG9gvc5yOL/PUnSb50sVSCOGEQqF65I7nzmQrgr9PiJzV32kpb2n2GnXurZG6HJ48OAoFfKwrEUfqGTE2OSHeGi4GcPbuuhxvaiFTS4yVtlra494NGaAvpDWCW3uNeaOqdyDGXxJS6SbKRqCPlMdFGcRRAVujKsQ7Q2Yl5WK7pNFeLWC48wBDzPHpd+var8BeUf83D5v6GHDxCnrbbCEk3G2y/uPJm0P1qmEpNu/jwg7WI3rjphVXLOBtPVtdyyXBDOp+6R8WTXk4r6fVCdPznsVHb5Ikh/sW2wWrkugxplwNs11mQHhwnWCzkQSwNCYB1SKy48U5/mUPdYViWrnHBZjQrJY2F3uETvm8lTZfLVRUyuK0A7SAelsoyxAFPqyw5HEm+5K0cDvOBWZ2QMHzsTofZSw80ROVxOYjmKgIAGLjoNme2FHtqUlXiWLriesAdNLoyr6uUaELKwmJLXEhD52n0dXxhT+UbhKdmdQ3uOZUUpukUUYEbLEkNWpPUy9CZQsFeiVFF96dHHnKDXtTdzpV8ZSkU/nQ75CVOdtRynvrnrzVROrYihrbtrR4F5fq2rrdn2AJePTrFoJU1JED4RjoaAmWbTGUyUM4nfn83fe+l0twtfKLUEYtgVF2iw9wIkHGW0/rLTHr59qqX99BkgxHA0NVCbCA5X+wImk+6wGaQ9kZ1B8bSDR+X2FVR5QcDPUOOIt2q7Zc6qTZcO0b9VniYQx08D7jDXpMz+VoH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nX0tV3M3rZY+aTPxAYoWwtl/vl7bRydfjuy2X5CD+hr5X8YR2KhJqCzc7GWusinzGAY0BVTHqkisGo8EqzacGD1mWrMSdTWqoPnzqogLbcAnzxI2Dt1HR38fEIo+sS8AtTOacrx6F8GyvRw96ZnXcnuViy3Mr58lkAZ8p3qwFfBTlsYziMfKKZSOHFV8ZUwTyyXqpE+M4iRxSCByaGDZ52MuvRg6Sowr9GaGE+gS6R4tg3/tUfebRLZEO1mZdEV/9xSFtPSUdCVLyEVAxHtjVOclI9RtJNmbzHEGhx/RKuo5BOVmiheMRXYHgwayhzpczOOJshlb93yVzVfwH6YuXUI26fEZppdF/daCx+T31xB8gYk0O+anRGEs6JueNifPISPfn818k8nKYvGb2Mim+bQT8ML9eOvl/2vVCE5He6m5mmkfmHp6cmcnAqsjU8Q11LN24JskAMfa6QmFfOUFF1vo+qIjEz7j6Ei1s7iMJAo8tXyB7HxLt5SxjaD4IXTy2mPfC8i/c0J2Bv6fhvPoJa2KPZy5hEi/sR6fvCXLHNErzbhi4HBtuKwpxPfsBZ+zPuyKf9GaAtB9Vp1P/5DZeBJWnCzpcVutWbSRwnYgIrKMj3pbHCYCwNI/9EbUJzGwy+UdD2eWeVs85iEGfQwb7usoj5/Vk9SRSyh+oV3qhnQLrDTsAwrd3EgSz7AR6y2qmgb2JY0zzobNKoEy58vb3k/Q0JlkjImwAeIhaxhjh5OgvTkH/Mz1Yg/KCDaMaI+5Hg+moVncfVkN9OQ6UW3k5E6b8qpZXmyhZ4zncCiF55IThPw3omlKQ//ck+KiF4=" ;
String s2 = decryptString(date, "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6"); String s2 = decryptString(date, "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6");

View File

@ -27,6 +27,8 @@ public class UserTypeUtil {
public static final Integer COMMUNIT_TYPE = 2; public static final Integer COMMUNIT_TYPE = 2;
//B端大客户 //B端大客户
public static final Integer CUSTOMERS_TYPE = 3; public static final Integer CUSTOMERS_TYPE = 3;
//车队
public static final Integer MOTORCADE_TYPE = 4;
//重新登录 //重新登录
public static final Integer LOGIN_TYPE = 1999; public static final Integer LOGIN_TYPE = 1999;

View File

@ -0,0 +1,163 @@
package com.xhpc.user.controller;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.user.domain.XhpcCommunity;
import com.xhpc.user.domain.XhpcCommunityPersonnel;
import com.xhpc.user.domain.XhpcMotorcade;
import com.xhpc.user.domain.XhpcMotorcadePersonnel;
import com.xhpc.user.service.IXhpcMotorcadeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* 车队
*
* @author yuyang
* @Date 2026-01-15 14:13
*/
@RestController
@RequestMapping("/motorcade")
public class XhpcMotorcadeController extends BaseController {
@Autowired
private IXhpcMotorcadeService xhpcMotorcadeService;
/**
* 车队列表
*/
@GetMapping("/userList")
public R userList(HttpServletRequest request, String name) {
return R.ok(xhpcMotorcadeService.userList(request,name));
}
/**
* 车队组树列表
*/
@GetMapping("/list")
public TableDataInfo list(HttpServletRequest request, String name) {
List<Map<String, Object>> list = xhpcMotorcadeService.list(request,name);
return getDataTable(list);
}
/**
* 新增车队组树
*
* @return
*/
@Log(title = "车队", businessType = BusinessType.INSERT)
@PostMapping(value = "/addMotorcade")
public AjaxResult addMotorcade(HttpServletRequest request, @RequestBody XhpcMotorcade xhpcMotorcade) {
return xhpcMotorcadeService.addMotorcade(request,xhpcMotorcade);
}
/**
* 删除车队组树
*/
@Log(title = "车队", businessType = BusinessType.DELETE)
@PostMapping(value = "/deleteMotorcade")
public AjaxResult deleteMotorcade(@RequestBody XhpcMotorcade xhpcMotorcade) {
return xhpcMotorcadeService.deleteMotorcade(xhpcMotorcade);
}
/**
* 查询车队组
*/
@PostMapping(value = "/getMotorcadeById")
public AjaxResult getMotorcadeById(@RequestBody XhpcMotorcade xhpcMotorcade) {
return AjaxResult.success(xhpcMotorcadeService.getMotorcadeById(xhpcMotorcade));
}
/**
* 编辑车队组树
*
* @return
*/
@Log(title = "车队", businessType = BusinessType.UPDATE)
@PostMapping(value = "/updateMotorcade")
public AjaxResult updateMotorcade(@RequestBody XhpcMotorcade xhpcMotorcade) {
return xhpcMotorcadeService.updateMotorcade(xhpcMotorcade);
}
/**
* 车队人员列表
*/
@GetMapping("/motorcadePersonnelList")
public TableDataInfo motorcadePersonnelList(Long communityId,String account,String phone,Integer status) {
startPage();
List<Map<String, Object>> list = xhpcMotorcadeService.motorcadePersonnelList(communityId, account, phone, status);
return getDataTable(list);
}
/**
* 车队人员添加
*
*/
@Log(title = "车队人员", businessType = BusinessType.INSERT)
@PostMapping(value = "/addMotorcadePersonnel")
public AjaxResult addMotorcadePersonnel(HttpServletRequest request,@RequestBody XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
return xhpcMotorcadeService.addMotorcadePersonnel(request,xhpcMotorcadePersonnel);
}
/**
* 查看车队人员
*
*/
@PostMapping(value = "/getMotorcadePersonnelById")
public AjaxResult getMotorcadePersonnelById(@RequestBody XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
return AjaxResult.success(xhpcMotorcadeService.getMotorcadePersonnelById(xhpcMotorcadePersonnel));
}
/**
* 编辑车队人员
*
*/
@Log(title = "车队人员", businessType = BusinessType.UPDATE)
@PostMapping(value = "/updateMotorcadePersonnel")
public AjaxResult updateMotorcadePersonnel(@RequestBody XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
return xhpcMotorcadeService.updateMotorcadePersonnel(xhpcMotorcadePersonnel);
}
/**
* 删除车队人员
*/
@Log(title = "车队人员", businessType = BusinessType.DELETE)
@PostMapping(value = "/deleteMotorcadePersonnel")
public AjaxResult deleteMotorcadePersonnel(@RequestBody XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
xhpcMotorcadeService.deleteMotorcadePersonnel(xhpcMotorcadePersonnel);
return AjaxResult.success();
}
/**
* 改变车队人员状态
*/
@Log(title = "车队人员-状态", businessType = BusinessType.UPDATE)
@PostMapping(value = "/updateMotorcadePersonnelStatus")
public AjaxResult updateMotorcadePersonnelStatus(@RequestBody XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
xhpcMotorcadeService.updateMotorcadePersonnelStatus(xhpcMotorcadePersonnel);
return AjaxResult.success();
}
/**
* 充值
*/
@Log(title = "车队人员-充值", businessType = BusinessType.INSERT)
@PostMapping(value = "/addRecharge")
public AjaxResult addRecharge(@RequestBody XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
xhpcMotorcadePersonnel.setRechargeType(UserTypeUtil.RECHARGE_PT);
return xhpcMotorcadeService.addRecharge(xhpcMotorcadePersonnel);
}
}

View File

@ -0,0 +1,105 @@
package com.xhpc.user.domain;
import com.xhpc.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.poi.hpsf.Decimal;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
/**
* 车队
*
* @author yuyang
* @Date 2026-01-15 14:06
*/
@Data
public class XhpcMotorcade extends BaseEntity {
/**
* 车队ID
*/
private Long motorcadeId;
/**
* 社区组名称
*/
@NotEmpty(message = "车队名称不能为空")
@Length(min = 2,max = 10,message = "车队名称长度2~10之间")
private String name;
/**
* 0总金额提成 1服务费提成 2电量抽成
*/
private Integer motorcadeType;
/**
* 服务费优惠比例
*/
private Double servicePreferential;
/**
* 享受折扣人数最低限制
*/
private Integer minPeople;
/**
* 联系人
*/
@NotEmpty(message = "联系人不能为空")
private String contactName;
/**
* 联系人电话
*/
@NotEmpty(message = "联系人电话不能为空")
private String contactPhone;
/**
* 地址
*/
@NotEmpty(message = "地址不能为空")
@Length(max = 200,message = "地址最大200位")
private String address;
/**
* 父级为0子集为父级id
*/
private Long parentId;
/**
* 社区组类型 1.平台 2.运营商
*/
private Integer type;
/**
* 数据维度 0 地区 1.运营商 2. 运营商地区
*/
@NotEmpty(message = "数据维度不能为空")
private String dimension;
/**
* 是否有不参与合作的场站 0 没有 1有
*/
private Integer status;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
/**
* 电站id
*/
private String chargingStationIds;
/**
* 运营商id
*/
private Long operatorId;
private Integer ilk;
private BigDecimal totalAmount;
}

View File

@ -0,0 +1,90 @@
package com.xhpc.user.domain;
import com.xhpc.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import java.math.BigDecimal;
/**
* 车队人员
*
* @author yuyang
* @Date 2026-01-15 14:09
*/
@Data
public class XhpcMotorcadePersonnel extends BaseEntity {
private Long motorcadePersonnelId;
private Long motorcadeId;
private String name;
private String account;
private BigDecimal rechargeMoney;
private BigDecimal consumeMoney;
private BigDecimal redPacket;
private BigDecimal surplusMoney;
private String phone;
private Integer type;
private Integer status;
private Integer delFlag;
/**
* 是否有退款订单审核0无 1有
*/
private Integer isRefundApplication;
private Integer soc;
/**
* 头像地址
*/
private String avatar;
/**
* weixin_open_id
*/
@Length(max = 50, message = "openId不能超过50位")
private String weixinOpenId;
/**
* alipay_open_id
*/
@Length(max = 50, message = "openId不能超过50位")
private String alipayOpenId;
/**
* 微信是否登录0未登录 1已登录
*/
private Integer weixinLogin;
/**
* 支付宝是否登录0未登录 1已登录
*/
private Integer alipayLogin;
/**
* 充值渠道1微信 2支付宝 3平台)
*/
private Integer rechargeType;
/**
* 充值订单id退款订单id
*/
private Long moneyOrderId;
private Long createId;
private Integer createType;
private String vinNumber;
}

View File

@ -0,0 +1,114 @@
package com.xhpc.user.mapper;
import com.xhpc.user.domain.XhpcCommunity;
import com.xhpc.user.domain.XhpcCommunityPersonnel;
import com.xhpc.user.domain.XhpcMotorcade;
import com.xhpc.user.domain.XhpcMotorcadePersonnel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author yuyang
* @Date 2026-01-15 14:15
*/
public interface XhpcMotorcadeMapper {
/**
* 获取登陆用户信息
*/
Map<String, Object> getLandUser(@Param("userId") Long userId);
/**
* 车队组树列表
*
* @param name 桩名称
* @return
*/
List<Map<String, Object>> list(@Param("name") String name, @Param("tenantId") String tenantId);
/**
* 车队组树列表
*
* @param name 桩名称
* @return
*/
List<Map<String, Object>> tree(@Param("name") String name,@Param("tenantId") String tenantId);
/**
* 添加车队组
* @return
*/
int addMotorcade(XhpcMotorcade xhpcMotorcade);
/**
* 修改车队组
* @return
*/
int updateMotorcade(XhpcMotorcade xhpcMotorcade);
/**
* 删除车队车队组
*/
void deleteMotorcade(@Param("motorcadeId")Long motorcadeId);
/**
* 检查改组是否还存在车队人员
*/
int countMotorcadePersonnel(@Param("motorcadeId")Long motorcadeId);
/**
* 查询车队组
* @param motorcadeId 车队id
* @param name 名称
* @param type 1 表示已车队id进行查询 2 排查车队id查询
* @return
*/
Map<String, Object> getMotorcadeById(@Param("motorcadeId")Long motorcadeId,@Param("name")String name,@Param("type")Integer type);
List<Map<String, Object>> motorcadePersonnelTree(@Param("motorcadeId")String motorcadeId);
/**
* 车队人员列表
* @return
*/
List<Map<String, Object>> motorcadePersonnelList(@Param("motorcadeId")Long motorcadeId,@Param("account")String account,@Param("phone")String phone,@Param("status")Integer status);
/**
* 添加车队人员
* @return
*/
int addMotorcadePersonnel(XhpcMotorcadePersonnel XhpcMotorcadePersonnel);
/**
* 查询车队人员
* @return
*/
Map<String, Object> getMotorcadePersonnelById(@Param("motorcadePersonnelId")Long motorcadePersonnelId,@Param("phone")String phone,@Param("account")String account,@Param("type")Integer type);
/**
* 修改车队人员
* @return
*/
int updateMotorcadePersonnel(XhpcMotorcadePersonnel XhpcMotorcadePersonnel);
/**
* 删除车队社人员
* @param motorcadePersonnelId
*/
void deleteMotorcadePersonnel(@Param("motorcadePersonnelId")Long motorcadePersonnelId);
/**
* 车队人员状态改变
*/
void updateMotorcadePersonnelStatus(@Param("motorcadePersonnelId")Long motorcadePersonnelId,@Param("status")Integer status);
/**
* 根据用户id获取车队组
*/
Map<String, Object> getMotorcadePersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId,@Param("chargingStationId")Long chargingStationId);
}

View File

@ -0,0 +1,111 @@
package com.xhpc.user.service;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.user.domain.XhpcCommunity;
import com.xhpc.user.domain.XhpcCommunityPersonnel;
import com.xhpc.user.domain.XhpcMotorcade;
import com.xhpc.user.domain.XhpcMotorcadePersonnel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* @author yuyang
* @Date 2026-01-15 14:14
*/
public interface IXhpcMotorcadeService {
/**
* 车队组树列表
*
* @param name 桩名称
* @return
*/
List<Map<String, Object>> userList(HttpServletRequest request, String name);
/**
* 车队组树列表
*
* @param name 桩名称
* @return
*/
List<Map<String, Object>> list(HttpServletRequest request, String name);
/**
* 新增车队组树
*
* @param
* @return
*/
AjaxResult addMotorcade(HttpServletRequest request, XhpcMotorcade xhpcMotorcade);
/**
* 删除车队组树
*/
AjaxResult deleteMotorcade(XhpcMotorcade xhpcMotorcade);
/**
* 编辑车队组树
*
* @param
* @return
*/
AjaxResult updateMotorcade(XhpcMotorcade xhpcMotorcade);
/**
* 查询车队组
*
* @return
*/
Map<String, Object> getMotorcadeById(XhpcMotorcade xhpcMotorcade);
/**
* 车队人员列表
* @return
*/
List<Map<String, Object>> motorcadePersonnelList(Long motorcadeId,String account,String phone,Integer status);
/**
* 新增车队人员
* @param
* @return
*/
AjaxResult addMotorcadePersonnel(HttpServletRequest request, XhpcMotorcadePersonnel xhpcMotorcadePersonnel);
/**
* 查询车队人员
*
* @return
*/
Map<String, Object> getMotorcadePersonnelById(XhpcMotorcadePersonnel xhpcMotorcadePersonnel);
/**
* 编辑车队组树
*
* @param
* @return
*/
AjaxResult updateMotorcadePersonnel(XhpcMotorcadePersonnel xhpcMotorcadePersonnel);
/**
* 删除车队人员
*/
void deleteMotorcadePersonnel(XhpcMotorcadePersonnel xhpcMotorcadePersonnel);
/**
* 车队人员状态改变
*/
void updateMotorcadePersonnelStatus(XhpcMotorcadePersonnel xhpcMotorcadePersonnel);
/**
* 充值
*/
AjaxResult addRecharge(XhpcMotorcadePersonnel xhpcMotorcadePersonnel);
/**
* 根据用户id获取车队组
*/
Map<String, Object> getMotorcadePersonnelUserId(Long userId,String tenantId,Long chargingStationId);
}

View File

@ -0,0 +1,332 @@
package com.xhpc.user.service.impl;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import com.xhpc.user.domain.XhpcCommunity;
import com.xhpc.user.domain.XhpcCommunityPersonnel;
import com.xhpc.user.domain.XhpcMotorcade;
import com.xhpc.user.domain.XhpcMotorcadePersonnel;
import com.xhpc.user.mapper.XhpcMotorcadeMapper;
import com.xhpc.user.service.IMechanismService;
import com.xhpc.user.service.IXhpcMotorcadeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
/**
* @author yuyang
* @Date 2026-01-15 14:15
*/
@Service
public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorcadeService {
@Resource
private XhpcMotorcadeMapper xhpcMotorcadeMapper;
@Resource
IMechanismService mechanismService;
@Resource
TokenService tokenService;
@Override
public List<Map<String, Object>> userList(HttpServletRequest request, String name) {
Long userId = SecurityUtils.getUserId();
List<Map<String, Object>> list =new ArrayList<>();
LoginUser loginUser = tokenService.getLoginUser(request);
if(userId !=null){
String userType = loginUser.getSysUser().getUserType();
if(UserTypeUtil.SYS_USER_TYPE_ZERO.equals(userType)){
list = xhpcMotorcadeMapper.tree(name, loginUser.getTenantId());
}
}
Iterator<Map<String, Object>> iterator = list.iterator();
while (iterator.hasNext()){
Map<String, Object> commMap = iterator.next();
List<Map<String, Object>> userMapList = xhpcMotorcadeMapper.communityPersonnelTree(commMap.get("id").toString().replaceAll("COMM_", ""));
if (userMapList.size() < 1){
iterator.remove();
} else {
commMap.put("children", userMapList);
}
}
return list;
}
@Override
public List<Map<String, Object>> list(HttpServletRequest request, String name) {
Long userId = SecurityUtils.getUserId();
List<Map<String, Object>> list =new ArrayList<>();
LoginUser loginUser = tokenService.getLoginUser(request);
if(userId !=null){
startPage();
String userType = loginUser.getSysUser().getUserType();
if(UserTypeUtil.SYS_USER_TYPE_ZERO.equals(userType)){
list = xhpcMotorcadeMapper.list(name,loginUser.getTenantId());
}
}
return list;
}
@Override
public AjaxResult addMotorcade(HttpServletRequest request, XhpcMotorcade xhpcMotorcade) {
R r= judgeXhpcCommunity(xhpcMotorcade);
if(r.getCode() !=200){
return AjaxResult.error(r.getMsg());
}
//名称重复不能入库
Map<String, Object> communityById = xhpcMotorcadeMapper.getMotorcadeById(null, xhpcMotorcade.getName(), null);
if(communityById !=null){
return AjaxResult.error("车队组名称重复");
}
String chargingStationIds = xhpcMotorcade.getChargingStationIds();
if("".equals(chargingStationIds) || chargingStationIds ==null){
xhpcMotorcade.setStatus(0);
}else{
xhpcMotorcade.setStatus(1);
}
Long userId = SecurityUtils.getUserId();
if(userId !=null){
LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType()) || UserTypeUtil.SYS_USER_TYPE_THREE.equals(sysUser.getUserType())){
xhpcMotorcade.setType(2);
xhpcMotorcade.setOperatorId(sysUser.getOperatorId());
}else{
xhpcMotorcade.setType(1);
}
}else{
return AjaxResult.error("请重新登录");
}
xhpcMotorcadeMapper.addMotorcade(xhpcMotorcade);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcMotorcade.getMotorcadeId(),3);
}
return AjaxResult.success();
}
@Override
public AjaxResult deleteMotorcade(XhpcMotorcade xhpcMotorcade) {
if(xhpcMotorcade !=null && xhpcMotorcade.getMotorcadeId() !=null){
int i = xhpcMotorcadeMapper.countMotorcadePersonnel(xhpcMotorcade.getMotorcadeId());
if(i==0){
xhpcMotorcadeMapper.deleteMotorcade(xhpcMotorcade.getMotorcadeId());
return AjaxResult.success();
}else{
return AjaxResult.error("该车队组下有用户不能删除");
}
}else{
return AjaxResult.error("请传车队组id");
}
}
@Override
public AjaxResult updateMotorcade(XhpcMotorcade xhpcMotorcade) {
R r = judgeXhpcCommunity(xhpcMotorcade);
if(r.getCode()!=200){
return AjaxResult.error(r.getMsg());
}
//名称重复不能入库
Map<String, Object> communityById = xhpcMotorcadeMapper.getMotorcadeById(xhpcMotorcade.getMotorcadeId(), xhpcMotorcade.getName(), 2);
if(communityById !=null){
return AjaxResult.error("社区名称重复");
}
String chargingStationIds = xhpcMotorcade.getChargingStationIds();
if("".equals(chargingStationIds) || chargingStationIds ==null){
xhpcMotorcade.setStatus(0);
}else{
xhpcMotorcade.setStatus(1);
}
xhpcMotorcadeMapper.updateMotorcade(xhpcMotorcade);
mechanismService.updateMechanism(xhpcMotorcade.getMotorcadeId(),3);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcMotorcade.getMotorcadeId(),3);
}
return AjaxResult.success();
}
@Override
public Map<String, Object> getMotorcadeById(XhpcMotorcade xhpcMotorcade) {
return xhpcMotorcadeMapper.getMotorcadeById(xhpcMotorcade.getMotorcadeId(),null,1);
}
@Override
public List<Map<String, Object>> motorcadePersonnelList(Long motorcadeId, String account, String phone, Integer status) {
return xhpcMotorcadeMapper.motorcadePersonnelList(motorcadeId, account, phone, status);
}
@Override
public AjaxResult addMotorcadePersonnel(HttpServletRequest request, XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
R r = judgeXhpcCommunityPersonnel(xhpcMotorcadePersonnel);
if(r.getCode()!=200){
return AjaxResult.error(r.getMsg());
}
String phone = xhpcMotorcadePersonnel.getPhone();
String account = xhpcMotorcadePersonnel.getAccount();
Map<String, Object> communityPersonnelById = xhpcMotorcadeMapper.getMotorcadePersonnelById(null, phone, account, 3);
if(communityPersonnelById !=null){
if(phone.equals(communityPersonnelById.get("phone").toString())){
return AjaxResult.error("手机号重复");
}
if(account.equals(communityPersonnelById.get("account").toString())){
return AjaxResult.error("账号重复");
}
}
BigDecimal rechargeMoney = xhpcMotorcadePersonnel.getRechargeMoney();
if(new BigDecimal(0).compareTo(rechargeMoney)==-1){
//增加社区用户的剩余金额
xhpcMotorcadePersonnel.setSurplusMoney(rechargeMoney);
}
Long userId = SecurityUtils.getUserId();
if(userId !=null){
LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType()) || UserTypeUtil.SYS_USER_TYPE_THREE.equals(sysUser.getUserType())){
xhpcMotorcadePersonnel.setCreateType(2);
xhpcMotorcadePersonnel.setCreateId(sysUser.getOperatorId());
}else{
xhpcMotorcadePersonnel.setCreateType(1);
}
}else{
return AjaxResult.error("请重新登录");
}
xhpcMotorcadeMapper.addMotorcadePersonnel(xhpcMotorcadePersonnel);
//增加一条充值记录
if(new BigDecimal(0).compareTo(rechargeMoney)==-1){
mechanismService.addRechargeOrder(xhpcMotorcadePersonnel.getMotorcadePersonnelId(),UserTypeUtil.MOTORCADE_TYPE,rechargeMoney,rechargeMoney,UserTypeUtil.RECHARGE_PT);
}
return AjaxResult.success();
}
@Override
public Map<String, Object> getMotorcadePersonnelById(XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
return xhpcMotorcadeMapper.getMotorcadePersonnelById(xhpcMotorcadePersonnel.getMotorcadePersonnelId(), null, null, 1);
}
@Override
public AjaxResult updateMotorcadePersonnel(XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
R r = judgeXhpcCommunityPersonnel(xhpcMotorcadePersonnel);
if(r.getCode()!=200){
return AjaxResult.error(r.getMsg());
}
Long motorcadePersonnelId = xhpcMotorcadePersonnel.getMotorcadePersonnelId();
String phone = xhpcMotorcadePersonnel.getPhone();
String account = xhpcMotorcadePersonnel.getAccount();
BigDecimal rechargeMoney = xhpcMotorcadePersonnel.getRechargeMoney();
BigDecimal surplusMoney = xhpcMotorcadePersonnel.getSurplusMoney();
if( rechargeMoney!=null){
return AjaxResult.error("充值金额不能填写");
}
if( surplusMoney!=null){
return AjaxResult.error("剩余金额不能填写");
}
Map<String, Object> communityPersonnelById = xhpcMotorcadeMapper.getMotorcadePersonnelById(motorcadePersonnelId, phone, account, 2);
if(communityPersonnelById !=null){
if(phone.equals(communityPersonnelById.get("phone").toString())){
return AjaxResult.error("手机号重复");
}
if(account.equals(communityPersonnelById.get("account").toString())){
return AjaxResult.error("账号重复");
}
}
xhpcMotorcadeMapper.updateMotorcadePersonnel(xhpcMotorcadePersonnel);
return AjaxResult.success();
}
@Override
public void deleteMotorcadePersonnel(XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
xhpcMotorcadeMapper.deleteMotorcadePersonnel(xhpcMotorcadePersonnel.getMotorcadePersonnelId());
}
@Override
public void updateMotorcadePersonnelStatus(XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
xhpcMotorcadeMapper.updateMotorcadePersonnelStatus(xhpcMotorcadePersonnel.getMotorcadePersonnelId(),xhpcMotorcadePersonnel.getStatus());
}
@Override
public AjaxResult addRecharge(XhpcMotorcadePersonnel xhpcMotorcadePersonnel) {
//充值金额
BigDecimal rechargeMoney = xhpcMotorcadePersonnel.getRechargeMoney();
Long motorcadePersonnelId = xhpcMotorcadePersonnel.getMotorcadePersonnelId();
if(rechargeMoney !=null &&new BigDecimal(0).compareTo(rechargeMoney)==-1){
//增加社区用户的剩余金额
Map<String, Object> communityPersonnelById = xhpcMotorcadeMapper.getMotorcadePersonnelById(motorcadePersonnelId, null, null, 1);
if(communityPersonnelById !=null){
BigDecimal surplusMoney = new BigDecimal(communityPersonnelById.get("surplusMoney").toString());
//原本充值金额
BigDecimal rechargeMoney1 = new BigDecimal(communityPersonnelById.get("rechargeMoney").toString());
XhpcMotorcadePersonnel xhpcMotorcadePersonnel1=new XhpcMotorcadePersonnel();
xhpcMotorcadePersonnel1.setMotorcadePersonnelId(motorcadePersonnelId);
BigDecimal remainingSum = surplusMoney.add(rechargeMoney);
xhpcMotorcadePersonnel1.setSurplusMoney(remainingSum);
xhpcMotorcadePersonnel1.setRechargeMoney(rechargeMoney1.add(rechargeMoney));
xhpcMotorcadeMapper.updateMotorcadePersonnel(xhpcMotorcadePersonnel1);
Long rechargeOrderId=null;
if(UserTypeUtil.RECHARGE_PT.equals(xhpcMotorcadePersonnel.getRechargeType())){
//增加充值记录
rechargeOrderId = mechanismService.addRechargeOrder(motorcadePersonnelId, UserTypeUtil.MOTORCADE_TYPE, rechargeMoney, remainingSum, xhpcMotorcadePersonnel.getRechargeType());
}else{
rechargeOrderId=xhpcMotorcadePersonnel.getMoneyOrderId();
}
//增加用户流水
mechanismService.insertUserAccount(motorcadePersonnelId,rechargeMoney,remainingSum,null,rechargeOrderId,null,UserTypeUtil.INSERT_BALANCE,xhpcMotorcadePersonnel1.getTenantId(),UserTypeUtil.MOTORCADE_TYPE);
return AjaxResult.success();
}
}
return AjaxResult.error("充值金额必需大于0");
}
@Override
public Map<String, Object> getMotorcadePersonnelUserId(Long userId, String tenantId, Long chargingStationId) {
return xhpcMotorcadeMapper.getMotorcadePersonnelUserId(userId, tenantId,chargingStationId);
}
public R judgeXhpcCommunity(XhpcMotorcade xhpcMotorcade){
if(xhpcMotorcade.getName()==null || "".equals(xhpcMotorcade.getName())){
return R.fail("名称必填");
}
if(xhpcMotorcade.getContactName()==null || "".equals(xhpcMotorcade.getContactName())){
return R.fail("联系人必填");
}
if(xhpcMotorcade.getContactPhone()==null || "".equals(xhpcMotorcade.getContactPhone())){
return R.fail("联系人电话必填");
}
if(xhpcMotorcade.getAddress()==null || "".equals(xhpcMotorcade.getAddress())){
return R.fail("地址必填");
}
return R.ok();
}
public R judgeXhpcCommunityPersonnel(XhpcMotorcadePersonnel xhpcMotorcadePersonnel){
if(xhpcMotorcadePersonnel.getName()==null || "".equals(xhpcMotorcadePersonnel.getName())){
return R.fail("名称必填");
}
if(xhpcMotorcadePersonnel.getAccount()==null || "".equals(xhpcMotorcadePersonnel.getAccount()) || !"CD".equals(xhpcMotorcadePersonnel.getAccount().substring(0,2))){
return R.fail("账号必填且CD开头10位");
}
if(xhpcMotorcadePersonnel.getPhone()==null || "".equals(xhpcMotorcadePersonnel.getPhone()) || xhpcMotorcadePersonnel.getPhone().length()!=11){
return R.fail("绑定手机号必填");
}
return R.ok();
}
}

View File

@ -0,0 +1,496 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.user.mapper.XhpcMotorcadeMapper">
<resultMap type="com.xhpc.user.domain.XhpcMotorcade" id="XhpcMotorcadeResult">
<result column="motorcade_id" property="motorcadeId"/>
<result column="name" property="name"/>
<result column="service_preferential" property="servicePreferential"/>
<result column="min_people" property="minPeople"/>
<result column="contact_name" property="contactName"/>
<result column="contact_phone" property="contactPhone"/>
<result column="address" property="address"/>
<result column="parent_id" property="parentId"/>
<result column="type" property="type"/>
<result column="dimension" property="dimension"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/>
<result column="motorcade_type" property="motorcadeType"/>
<result column="ilk" property="ilk"/>
<result column="total_amount" property="totalAmount"/>
</resultMap>
<select id="getLandUser" resultType="map">
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
</select>
<select id="tree" resultType="map">
select
concat('CD_', motorcade_id) as id,
name as name
from xhpc_motorcade
where del_flag =0
<if test="name !=null and name !=''">
and name like CONCAT('%',#{name},'%')
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
order by create_time desc
</select>
<select id="list" resultType="map">
select
motorcade_id as motorcadeId,
name as name
from xhpc_motorcade
where del_flag =0
<if test="name !=null and name !=''">
and name like CONCAT('%',#{name},'%')
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
order by create_time desc
</select>
<insert id="addMotorcade" parameterType="com.xhpc.user.domain.XhpcMotorcade" useGeneratedKeys="true" keyProperty="motorcadeId">
insert into xhpc_motorcade
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != motorcadeId">
motorcade_id,
</if>
<if test="null != name and '' != name">
name,
</if>
<if test="null != servicePreferential">
service_preferential,
</if>
<if test="null != minPeople">
min_people,
</if>
<if test="null != contactName and '' != contactName">
contact_name,
</if>
<if test="null != contactPhone and '' != contactPhone">
contact_phone,
</if>
<if test="null != address and '' != address">
address,
</if>
<if test="null != dimension">
dimension,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != type">
type,
</if>
<if test="null != operatorId">
operatorId,
</if>
<if test="null != motorcadeType">
motorcade_type,
</if>
<if test="null != ilk">
ilk,
</if>
<if test="null != totalAmount">
total_amount,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != motorcadeId">
#{motorcadeId},
</if>
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != servicePreferential">
#{servicePreferential},
</if>
<if test="null != minPeople">
#{minPeople},
</if>
<if test="null != contactName and '' != contactName">
#{contactName},
</if>
<if test="null != contactPhone and '' != contactPhone">
#{contactPhone},
</if>
<if test="null != address and '' != address">
#{address},
</if>
<if test="null != dimension">
#{dimension},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != type">
#{type},
</if>
<if test="null != operatorId">
#{operatorId},
</if>
<if test="null != motorcadeType">
#{motorcadeType},
</if>
<if test="null != ilk">
#{ilk},
</if>
<if test="null != totalAmount">
#{totalAmount},
</if>
</trim>
</insert>
<update id="updateMotorcade" parameterType="com.xhpc.user.domain.XhpcMotorcade" useGeneratedKeys="true" keyProperty="motorcadeId">
update xhpc_motorcade
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="servicePreferential != null">service_preferential = #{servicePreferential},</if>
<if test="minPeople != null">min_people = #{minPeople},</if>
<if test="contactName != null">contact_name = #{contactName},</if>
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
<if test="address != null">address = #{address},</if>
<if test="dimension != null">dimension = #{dimension},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="motorcadeType != null">motorcade_type = #{motorcadeType},</if>
<if test="ilk != null">ilk = #{ilk},</if>
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
</trim>
where motorcade_id=#{motorcadeId}
</update>
<update id="deleteMotorcade">
update xhpc_motorcade set del_flag =1 where motorcade_id=#{motorcadeId}
</update>
<select id="countMotorcadePersonnel" resultType="java.lang.Integer">
select count(motorcade_personnel_id) from xhpc_motorcade_personnel where motorcade_id=#{motorcadeId} and del_flag=0
</select>
<select id="getMotorcadeById" resultType="map">
select
co.motorcade_id as motorcadeId,
co.name as name,
co.service_preferential as servicePreferential,
co.motorcade_type as motorcadeType,
co.min_people as minPeople,
co.contact_name as contactName,
co.contact_phone as contactPhone,
co.address as address,
co.dimension as dimension,
co.status as status,
group_concat(me.charging_station_id) chargingStationIds
from xhpc_motorcade co
left join xhpc_mechanism me on me.mechanism_id = co.motorcade_id and me.source = 3 and me.del_flag =0
where 1=1
<if test="motorcadeId !=null and type !=null and type==1">
and co.motorcade_id=#{motorcadeId}
</if>
<if test="motorcadeId !=null and type !=null and type==2">
and co.motorcade_id !=#{motorcadeId}
</if>
<if test="name !=null">
and co.name =#{name}
</if>
limit 1
</select>
<select id="motorcadePersonnelTree" resultType="map">
SELECT
motorcade_personnel_id AS id,
name AS name
FROM
xhpc_motorcade_personnel
where motorcade_id=#{motorcadeId} and del_flag=0 and status=0
order by create_time desc
</select>
<select id="motorcadePersonnelList" resultType="map">
SELECT
motorcade_personnel_id AS motorcadePersonnelId,
name AS name,
motorcade_id AS motorcadeId,
weixin_open_id as weixinOpenId,
alipay_open_id AS alipayOpenId,
account AS account,
tenant_id as tenantId,
phone AS phone,
recharge_money AS rechargeMoney,
consume_money AS consumeMoney,
red_packet AS redPacket,
surplus_money AS surplusMoney,
type,
vin_number as vinNumber,
status
FROM
xhpc_motorcade_personnel
where motorcade_id=#{motorcadeId} and del_flag=0
<if test="account !=null and account !=''">
and account like concat('%', #{account}, '%')
</if>
<if test="phone !=null and phone !=''">
and phone like concat('%', #{phone}, '%')
</if>
<if test="status !=null">
and status=#{status}
</if>
order by create_time desc
</select>
<insert id="addMotorcadePersonnel" parameterType="com.xhpc.user.domain.XhpcMotorcadePersonnel" useGeneratedKeys="true" keyProperty="communityPersonnelId">
insert into xhpc_motorcade_personnel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != motorcadePersonnelId">
motorcade_personnel_id,
</if>
<if test="null != motorcadeId">
motorcade_id,
</if>
<if test="null != name and '' != name">
name,
</if>
<if test="null != account">
account,
</if>
<if test="null != rechargeMoney">
recharge_money,
</if>
<if test="null != consumeMoney">
consume_money,
</if>
<if test="null != redPacket">
red_packet,
</if>
<if test="null != surplusMoney">
surplus_money,
</if>
<if test="null != phone">
phone,
</if>
<if test="null != type">
type,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != createId">
create_id,
</if>
<if test="null != createType">
create_type,
</if>
<if test="null != vinNumber">
vin_number,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != motorcadePersonnelId">
#{motorcadePersonnelId},
</if>
<if test="null != motorcadeId">
#{motorcadeId},
</if>
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != account">
#{account},
</if>
<if test="null != rechargeMoney">
#{rechargeMoney},
</if>
<if test="null != consumeMoney">
#{consumeMoney},
</if>
<if test="null != redPacket">
#{redPacket},
</if>
<if test="null != surplusMoney">
#{surplusMoney},
</if>
<if test="null != phone">
#{phone},
</if>
<if test="null != type">
#{type},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != createId">
#{createId},
</if>
<if test="null != createType">
#{createType},
</if>
<if test="null != vinNumber">
#{vinNumber},
</if>
</trim>
</insert>
<select id="getMotorcadePersonnelById" resultType="map">
select
motorcade_personnel_id AS motorcadePersonnelId,
name AS name,
motorcade_id AS motorcadeId,
account AS account,
phone AS phone,
recharge_money AS rechargeMoney,
surplus_money AS surplusMoney,
type,
vin_number AS vinNumber,
status
from xhpc_motorcade_personnel
where del_flag =0
<if test="motorcadePersonnelId !=null and type !=null and type==1">
and motorcade_personnel_id=#{motorcadePersonnelId}
</if>
<if test="type !=null and type==3">
and phone =#{phone} or account =#{account}
</if>
<if test="motorcadePersonnelId !=null and type !=null and type==2">
and motorcade_personnel_id !=#{motorcadePersonnelId}
and motorcade_personnel_id in ( select motorcade_personnel_id from xhpc_motorcade_personnel where phone =#{phone} or account =#{account} and del_flag =0)
</if>
limit 1
</select>
<update id="updateMotorcadePersonnel">
update xhpc_motorcade_personnel
<trim prefix="SET" suffixOverrides=",">
<if test="motorcadeId != null">motorcade_id = #{motorcadeId},</if>
<if test="name != null">name = #{name},</if>
<if test="account != null">account = #{account},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="rechargeMoney != null">recharge_money = #{rechargeMoney},</if>
<if test="surplusMoney != null">surplus_money = #{surplusMoney},</if>
<if test="type != null">type = #{type},</if>
<if test="status != null">address = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="vinNumber != null">vin_number = #{vinNumber},</if>
<if test="isRefundApplication != null">is_refund_application = #{isRefundApplication},</if>
</trim>
where motorcade_personnel_id=#{motorcadePersonnelId}
</update>
<update id="deleteMotorcadePersonnel">
update xhpc_motorcade_personnel set del_flag=1 where motorcade_personnel_id=#{motorcadePersonnelId}
</update>
<update id="updateMotorcadePersonnelStatus">
update xhpc_motorcade_personnel set status=#{status} where motorcade_personnel_id=#{motorcadePersonnelId}
</update>
<select id="getMotorcadePersonnelUserId" resultType="map">
select
co.motorcade_type motorcadeType,
co.service_preferential servicePreferential
from xhpc_motorcade co
join xhpc_mechanism me on me.mechanism_id = co.motorcade_id and me.source = 3 and me.del_flag =0
where co.motorcade_id = (select motorcade_id from xhpc_motorcade_personnel where motorcade_personnel_id=#{userId} and tenant_id=#{tenantId} and del_flag =0)
<if test="chargingStationId !=null">
and me.charging_station_id=#{chargingStationId}
</if>
</select>
</mapper>