车队后代接口

This commit is contained in:
2265829957@qq.com 2026-01-28 13:46:45 +08:00
parent 3a5cab69fb
commit db52a6974c
4 changed files with 37 additions and 6 deletions

View File

@ -95,9 +95,9 @@ public class XhpcMotorcadeController extends BaseController {
* 车队人员列表 * 车队人员列表
*/ */
@GetMapping("/motorcadePersonnelList") @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(); startPage();
List<Map<String, Object>> list = xhpcMotorcadeService.motorcadePersonnelList(communityId, account, phone, status); List<Map<String, Object>> list = xhpcMotorcadeService.motorcadePersonnelList(motorcadeId, account, phone, status);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -102,4 +102,5 @@ public class XhpcMotorcade extends BaseEntity {
private BigDecimal totalAmount; private BigDecimal totalAmount;
private String mark;
} }

View File

@ -52,7 +52,7 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
Iterator<Map<String, Object>> iterator = list.iterator(); Iterator<Map<String, Object>> iterator = list.iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map<String, Object> commMap = iterator.next(); Map<String, Object> commMap = iterator.next();
List<Map<String, Object>> userMapList = xhpcMotorcadeMapper.communityPersonnelTree(commMap.get("id").toString().replaceAll("COMM_", "")); List<Map<String, Object>> userMapList = xhpcMotorcadeMapper.motorcadePersonnelTree(commMap.get("id").toString().replaceAll("COMM_", ""));
if (userMapList.size() < 1){ if (userMapList.size() < 1){
iterator.remove(); iterator.remove();
} else { } else {
@ -83,10 +83,13 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
if(r.getCode() !=200){ if(r.getCode() !=200){
return AjaxResult.error(r.getMsg()); return AjaxResult.error(r.getMsg());
} }
if(xhpcMotorcade.getMotorcadeId() !=null){
return updateMotorcade(xhpcMotorcade);
}
//名称重复不能入库 //名称重复不能入库
Map<String, Object> communityById = xhpcMotorcadeMapper.getMotorcadeById(null, xhpcMotorcade.getName(), null); Map<String, Object> communityById = xhpcMotorcadeMapper.getMotorcadeById(null, xhpcMotorcade.getName(), null);
if(communityById !=null){ if(communityById !=null){
return AjaxResult.error("车队名称重复"); return AjaxResult.error("车队名称重复");
} }
String chargingStationIds = xhpcMotorcade.getChargingStationIds(); String chargingStationIds = xhpcMotorcade.getChargingStationIds();
@ -108,6 +111,9 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
}else{ }else{
return AjaxResult.error("请重新登录"); return AjaxResult.error("请重新登录");
} }
xhpcMotorcade.setMark(generateRandomString(10));
xhpcMotorcadeMapper.addMotorcade(xhpcMotorcade); xhpcMotorcadeMapper.addMotorcade(xhpcMotorcade);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcMotorcade.getMotorcadeId(),3); mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcMotorcade.getMotorcadeId(),3);
@ -139,7 +145,7 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
//名称重复不能入库 //名称重复不能入库
Map<String, Object> communityById = xhpcMotorcadeMapper.getMotorcadeById(xhpcMotorcade.getMotorcadeId(), xhpcMotorcade.getName(), 2); Map<String, Object> communityById = xhpcMotorcadeMapper.getMotorcadeById(xhpcMotorcade.getMotorcadeId(), xhpcMotorcade.getName(), 2);
if(communityById !=null){ if(communityById !=null){
return AjaxResult.error("社区名称重复"); return AjaxResult.error("车队名称重复");
} }
String chargingStationIds = xhpcMotorcade.getChargingStationIds(); String chargingStationIds = xhpcMotorcade.getChargingStationIds();
@ -311,6 +317,9 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
if(xhpcMotorcade.getAddress()==null || "".equals(xhpcMotorcade.getAddress())){ if(xhpcMotorcade.getAddress()==null || "".equals(xhpcMotorcade.getAddress())){
return R.fail("地址必填"); return R.fail("地址必填");
} }
if(xhpcMotorcade.getIlk()==null ){
return R.fail("付款类型必填");
}
return R.ok(); return R.ok();
} }
@ -329,4 +338,17 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
return R.ok(); 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();
}
} }

View File

@ -125,6 +125,9 @@
<if test="null != totalAmount"> <if test="null != totalAmount">
total_amount, total_amount,
</if> </if>
<if test="null != mark">
mark,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != motorcadeId"> <if test="null != motorcadeId">
@ -187,6 +190,9 @@
<if test="null != totalAmount"> <if test="null != totalAmount">
#{totalAmount}, #{totalAmount},
</if> </if>
<if test="null != mark">
#{mark},
</if>
</trim> </trim>
</insert> </insert>
@ -233,6 +239,8 @@
co.contact_phone as contactPhone, co.contact_phone as contactPhone,
co.address as address, co.address as address,
co.dimension as dimension, co.dimension as dimension,
co.ilk as ilk,
co.total_amount as totalAmount,
co.status as status, co.status as status,
group_concat(me.charging_station_id) chargingStationIds group_concat(me.charging_station_id) chargingStationIds
from xhpc_motorcade co from xhpc_motorcade co
@ -292,7 +300,7 @@
order by create_time desc order by create_time desc
</select> </select>
<insert id="addMotorcadePersonnel" parameterType="com.xhpc.user.domain.XhpcMotorcadePersonnel" useGeneratedKeys="true" keyProperty="communityPersonnelId"> <insert id="addMotorcadePersonnel" parameterType="com.xhpc.user.domain.XhpcMotorcadePersonnel" useGeneratedKeys="true" keyProperty="motorcadePersonnelId">
insert into xhpc_motorcade_personnel insert into xhpc_motorcade_personnel
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != motorcadePersonnelId"> <if test="null != motorcadePersonnelId">