From db52a6974c38bf180743e6e738c8e119cb916887 Mon Sep 17 00:00:00 2001 From: "2265829957@qq.com" <2265829957@qq.com> Date: Wed, 28 Jan 2026 13:46:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E9=98=9F=E5=90=8E=E4=BB=A3=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/XhpcMotorcadeController.java | 4 +-- .../com/xhpc/user/domain/XhpcMotorcade.java | 1 + .../impl/XhpcMotorcadeServiceImpl.java | 28 +++++++++++++++++-- .../resources/mapper/XhpcMotorcadeMapper.xml | 10 ++++++- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcMotorcadeController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcMotorcadeController.java index a20409ea..0045b809 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcMotorcadeController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcMotorcadeController.java @@ -95,9 +95,9 @@ public class XhpcMotorcadeController extends BaseController { * 车队人员列表 */ @GetMapping("/motorcadePersonnelList") - public TableDataInfo motorcadePersonnelList(Long communityId,String account,String phone,Integer status) { + public TableDataInfo motorcadePersonnelList(Long motorcadeId,String account,String phone,Integer status) { startPage(); - List> list = xhpcMotorcadeService.motorcadePersonnelList(communityId, account, phone, status); + List> list = xhpcMotorcadeService.motorcadePersonnelList(motorcadeId, account, phone, status); return getDataTable(list); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcMotorcade.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcMotorcade.java index 2cd5ec1e..5e1bed35 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcMotorcade.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcMotorcade.java @@ -102,4 +102,5 @@ public class XhpcMotorcade extends BaseEntity { private BigDecimal totalAmount; + private String mark; } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcMotorcadeServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcMotorcadeServiceImpl.java index 0a07633c..b4cee604 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcMotorcadeServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcMotorcadeServiceImpl.java @@ -52,7 +52,7 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc Iterator> iterator = list.iterator(); while (iterator.hasNext()){ Map commMap = iterator.next(); - List> userMapList = xhpcMotorcadeMapper.communityPersonnelTree(commMap.get("id").toString().replaceAll("COMM_", "")); + List> userMapList = xhpcMotorcadeMapper.motorcadePersonnelTree(commMap.get("id").toString().replaceAll("COMM_", "")); if (userMapList.size() < 1){ iterator.remove(); } else { @@ -83,10 +83,13 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc if(r.getCode() !=200){ return AjaxResult.error(r.getMsg()); } + if(xhpcMotorcade.getMotorcadeId() !=null){ + return updateMotorcade(xhpcMotorcade); + } //名称重复不能入库 Map communityById = xhpcMotorcadeMapper.getMotorcadeById(null, xhpcMotorcade.getName(), null); if(communityById !=null){ - return AjaxResult.error("车队组名称重复"); + return AjaxResult.error("车队名称重复"); } String chargingStationIds = xhpcMotorcade.getChargingStationIds(); @@ -108,6 +111,9 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc }else{ return AjaxResult.error("请重新登录"); } + + xhpcMotorcade.setMark(generateRandomString(10)); + xhpcMotorcadeMapper.addMotorcade(xhpcMotorcade); if(!"".equals(chargingStationIds) && chargingStationIds !=null){ mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcMotorcade.getMotorcadeId(),3); @@ -139,7 +145,7 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc //名称重复不能入库 Map communityById = xhpcMotorcadeMapper.getMotorcadeById(xhpcMotorcade.getMotorcadeId(), xhpcMotorcade.getName(), 2); if(communityById !=null){ - return AjaxResult.error("社区名称重复"); + return AjaxResult.error("车队名称重复"); } String chargingStationIds = xhpcMotorcade.getChargingStationIds(); @@ -311,6 +317,9 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc if(xhpcMotorcade.getAddress()==null || "".equals(xhpcMotorcade.getAddress())){ return R.fail("地址必填"); } + if(xhpcMotorcade.getIlk()==null ){ + return R.fail("付款类型必填"); + } return R.ok(); } @@ -329,4 +338,17 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc return R.ok(); } + + public String generateRandomString(int length) { + String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + Random random = new Random(); + StringBuilder sb = new StringBuilder(length); + + for (int i = 0; i < length; i++) { + int index = random.nextInt(characters.length()); + sb.append(characters.charAt(index)); + } + + return sb.toString(); + } } diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcMotorcadeMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcMotorcadeMapper.xml index 22c66246..e354d64c 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcMotorcadeMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcMotorcadeMapper.xml @@ -125,6 +125,9 @@ total_amount, + + mark, + @@ -187,6 +190,9 @@ #{totalAmount}, + + #{mark}, + @@ -233,6 +239,8 @@ co.contact_phone as contactPhone, co.address as address, co.dimension as dimension, + co.ilk as ilk, + co.total_amount as totalAmount, co.status as status, group_concat(me.charging_station_id) chargingStationIds from xhpc_motorcade co @@ -292,7 +300,7 @@ order by create_time desc - + insert into xhpc_motorcade_personnel