车队后代接口
This commit is contained in:
parent
3a5cab69fb
commit
db52a6974c
@ -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<Map<String, Object>> list = xhpcMotorcadeService.motorcadePersonnelList(communityId, account, phone, status);
|
||||
List<Map<String, Object>> list = xhpcMotorcadeService.motorcadePersonnelList(motorcadeId, account, phone, status);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ -102,4 +102,5 @@ public class XhpcMotorcade extends BaseEntity {
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private String mark;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
|
||||
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_", ""));
|
||||
List<Map<String, Object>> 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<String, Object> 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<String, Object> 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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,6 +125,9 @@
|
||||
<if test="null != totalAmount">
|
||||
total_amount,
|
||||
</if>
|
||||
<if test="null != mark">
|
||||
mark,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != motorcadeId">
|
||||
@ -187,6 +190,9 @@
|
||||
<if test="null != totalAmount">
|
||||
#{totalAmount},
|
||||
</if>
|
||||
<if test="null != mark">
|
||||
#{mark},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -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
|
||||
</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
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != motorcadePersonnelId">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user