diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java index bb5c6116..86ae23de 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java @@ -87,8 +87,8 @@ public class XhpcChargeOrderController extends BaseController { */ @GetMapping("/stopUp") public AjaxResult stopUp(@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Long chargingOrderId){ - logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>>>>"); - logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>>>>"); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>chargingOrderId>>>"+chargingOrderId); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>chargingOrderId>>>"+chargingOrderId); return iXhpcChargeOrderService.stopUp(userId, serialNumber, chargingOrderId); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java index 65d05c43..4fd7137a 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java @@ -106,7 +106,7 @@ public class XhpcPileOrderController extends BaseController { */ @GetMapping("/chargeOrder/pileStop") public R pileStop(@RequestParam(value = "orderNo")String orderNo, @RequestParam(value = "status")Integer status,@RequestParam(value = "remark") String remark) { - logger.info("桩停止回调接口>>>>>状态:"+status+"备注++"+"remark"+"订单号"+orderNo); + logger.info("桩停止回调接口>>>>>状态:"+status+"备注++"+remark+"订单号"+orderNo); //解析订单编号 Integer code = 500; diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index cc0585cb..1df454c6 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -650,12 +650,17 @@ ho.platform_svc_commisssion as platformSvcCommisssion, ho.operation_commission as operationCommission, ho.operation_svc_commission as operationSvcCommission, - ho.charging_mode as chargingModeName, case when co.source=0 then "C端用户" when co.source=1 then "流量方用户" when co.source=2 then "社区用户" else "B端客户!" - end sourceName + end sourceName, + case when ho.charging_mode="1" then "快电" + when ho.charging_mode="2" then "恒大" + when ho.charging_mode="3" then "新电途" + when ho.charging_mode="4" then "小桔" + else "C端客户" + end chargingModeName from xhpc_history_order as ho left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id left join xhpc_operator as op on op.operator_id = ct.operator_id diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommunityController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommunityController.java new file mode 100644 index 00000000..11d1f2c5 --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommunityController.java @@ -0,0 +1,71 @@ +package com.xhpc.user.controller; + +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.domain.XhpcChargingPile; +import com.xhpc.user.domain.XhpcCommunity; +import com.xhpc.user.dto.MechanismDto; +import com.xhpc.user.service.IMechanismService; +import com.xhpc.user.service.IXhpcCommunityService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/12/20 10:12 + */ +@RestController +@RequestMapping("/community") +public class XhpcCommunityController extends BaseController { + + @Autowired + private IXhpcCommunityService xhpcCommunityService; + @Autowired + private IMechanismService mechanismService; + + /** + * 社区组树列表 + */ + @GetMapping("/list") + public TableDataInfo list(String name) { + startPage(); + List> list = xhpcCommunityService.list(name); + return getDataTable(list); + } + + /** + * 新增社区组树 + * + * @return + */ + @PostMapping(value = "/addCommunity") + public AjaxResult addCommunity(@RequestBody XhpcCommunity xhpcCommunity) { + return xhpcCommunityService.addCommunity(xhpcCommunity); + } + + /** + * 删除社区组树 + */ + @PostMapping(value = "/deleteCommunity") + public AjaxResult deleteCommunity(@RequestBody XhpcCommunity xhpcCommunity) { + xhpcCommunityService.deleteCommunity(xhpcCommunity); + return AjaxResult.success(); + } + + + /** + * 数据维度 + * @param status 0 地区 1.运营商 2. 运营商-地区 + * @return + */ + @GetMapping(value = "/getMechanism") + public AjaxResult getMechanism(@RequestParam(value = "status")Integer status) { + List mechanismDtos = mechanismService.dataList(1L, status); + return AjaxResult.success(mechanismDtos); + } + +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCommunity.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCommunity.java new file mode 100644 index 00000000..7ec02213 --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCommunity.java @@ -0,0 +1,87 @@ +package com.xhpc.user.domain; + +import com.xhpc.common.core.web.domain.BaseEntity; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotEmpty; + +/** + * 社区组 + * yuyang + */ +@Data +public class XhpcCommunity extends BaseEntity { + + /** + * 社区组ID + */ + private Long communityId; + + /** + * 社区组名称 + */ + @NotEmpty(message = "社区组名称不能为空") + @Length(min = 2,max = 10,message = "社区组名称长度2~10之间") + private String name; + + /** + * 服务费优惠比例 + */ + 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 Integer dimension; + + /** + * 是否有不参与合作的场站 (0 没有 1有) + */ + private Integer status; + + /** + * 删除标志(0代表存在 2代表删除) + */ + private Integer delFlag; + + /** + * 电站id + */ + private String chargingStationIds; +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/dto/MechanismDto.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/dto/MechanismDto.java new file mode 100644 index 00000000..2e18a86a --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/dto/MechanismDto.java @@ -0,0 +1,20 @@ +package com.xhpc.user.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author yuyang + * @date 2021/12/21 10:42 + */ +@Data +public class MechanismDto { + + private Integer id; + + private String label; + + private List children; + +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/MechanismMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/MechanismMapper.java new file mode 100644 index 00000000..fc99e58b --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/MechanismMapper.java @@ -0,0 +1,54 @@ +package com.xhpc.user.mapper; + +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/12/20 14:36 + */ +public interface MechanismMapper { + + /** + * 获取登陆用户信息 + */ + Map getLandUser(@Param("userId") Long userId); + + /** + * 通过登录用户查询省地址 + * @param userId + * @return 结果 + */ + public List> groupProvinceById(@Param("userId") Long userId, @Param("type") Integer type, @Param("operatorId")Long operatorId); + + /** + * 通过登录用户分组查询市地址 + * @return 结果 + */ + public List> groupCityById(@Param("userId") Long userId, @Param("type") Integer type,@Param("provinceCode") String provinceCode, @Param("operatorId")Long operatorId); + /** + * 通过登录用户分组查询区地址 + * @return 结果 + */ + public List> groupAreaById(@Param("userId") Long userId, @Param("type") Integer type,@Param("cityCode") String cityCode, @Param("operatorId")Long operatorId); + + /** + * 通过登录用户分组查询运营商 + * @return 结果 + */ + public List> groupOperatorById(@Param("userId") Long userId, @Param("type") Integer type,@Param("code") String cityCode); + + /** + * 通过登录用户分组查询场站 + * @return 结果 + */ + public List> dataCodeById(@Param("userId") Long userId, @Param("type") Integer type,@Param("code") String cityCode); + + /** + * 通过登录用户分组查询场站 + * @return 结果 + */ + public List> dataChargingStationId(@Param("userId") Long userId, @Param("type") Integer type,@Param("operatorId") String operatorId,@Param("code") String cityCode); +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCommunityMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCommunityMapper.java new file mode 100644 index 00000000..8c48cc77 --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCommunityMapper.java @@ -0,0 +1,46 @@ +package com.xhpc.user.mapper; + +import com.xhpc.user.domain.XhpcCommunity; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +public interface XhpcCommunityMapper { + + /** + * 获取登陆用户信息 + */ + Map getLandUser(@Param("userId") Long userId); + + /** + * 社区组树列表 + * + * @param name 桩名称 + * @return + */ + List> list(@Param("name") String name); + + /** + * 添加数据维度 + */ + int addMechanism(@Param("chargingStationIds") List chargingStationIds,@Param("mechanismId")Long mechanismId,@Param("source")Integer source); + + /** + * 添加社区组 + * @param xhpcCommunity + * @return + */ + int addCommunity(XhpcCommunity xhpcCommunity); + + /** + * 社区社区组 + * @param communityId + */ + void deleteCommunity(@Param("communityId")Long communityId); + + /** + * 检查改组是否还存在社区人员 + */ + int countCommunityPersonnel(@Param("communityId")Long communityId); +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IMechanismService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IMechanismService.java new file mode 100644 index 00000000..4147397d --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IMechanismService.java @@ -0,0 +1,21 @@ +package com.xhpc.user.service; + +import com.xhpc.user.dto.MechanismDto; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/12/20 14:30 + */ +public interface IMechanismService { + + /** + * 用户拥有数据权限 + * + * @param userId 用户id + * @return 结果 + */ + public List dataList(Long userId, Integer status); +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommunityService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommunityService.java new file mode 100644 index 00000000..14f7ae7e --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommunityService.java @@ -0,0 +1,36 @@ +package com.xhpc.user.service; + +import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.common.domain.XhpcChargingPile; +import com.xhpc.user.domain.XhpcCommunity; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/12/20 9:59 + */ +public interface IXhpcCommunityService { + + /** + * 社区组树列表 + * + * @param name 桩名称 + * @return + */ + List> list(String name); + + /** + * 新增社区组树 + * + * @param + * @return + */ + AjaxResult addCommunity(XhpcCommunity xhpcCommunity); + + /** + * 删除社区组树 + */ + void deleteCommunity(XhpcCommunity xhpcCommunity); +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/IMechanismServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/IMechanismServiceImpl.java new file mode 100644 index 00000000..539839e6 --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/IMechanismServiceImpl.java @@ -0,0 +1,218 @@ +package com.xhpc.user.service.impl; + +import com.xhpc.common.core.utils.SecurityUtils; +import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.user.dto.MechanismDto; +import com.xhpc.user.mapper.MechanismMapper; +import com.xhpc.user.service.IMechanismService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/12/20 14:30 + */ +@Service +public class IMechanismServiceImpl implements IMechanismService { + + @Autowired + private MechanismMapper mechanismMapper; + @Override + public List dataList(Long userId, Integer status) { + //获取登陆用户 + //Long logUserId = SecurityUtils.getUserId(); + Long logUserId = 1L; + int type =1; + //根据权限获取场站 + if(logUserId !=1){ + Map landUser = mechanismMapper.getLandUser(logUserId); + if(landUser !=null){ + if(landUser.get("userType") !=null){ + if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ + Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); + logUserId=logOperatorId; + type =1; + }else{ + type =2; + } + } + } + }else{ + type=0; + } + if(status==0){ + return regionTree(logUserId,type); + }else if(status==1){ + return operatorTree(logUserId,type); + }else{ + return operatorRegionTree(logUserId,type); + } + } + + + /** + * 地区树 + * @param userId + * @param type + * @return + */ + public List regionTree(Long userId, Integer type){ + List mechanismDtos =new ArrayList<>(); + //省 + List> list = mechanismMapper.groupProvinceById(userId, type,null); + if(list !=null && list.size()>0){ + for (Map map:list) { + MechanismDto mechanismDto =new MechanismDto(); + String code = map.get("code").toString(); + mechanismDto.setId(Integer.valueOf(code)); + mechanismDto.setLabel(map.get("name").toString()); + List mechanismCityList =new ArrayList<>(); + //市 + List> cityList = mechanismMapper.groupCityById(userId, type, code,null); + for (Map cityMap:cityList) { + MechanismDto mechanismCity =new MechanismDto(); + String codeCity = cityMap.get("code").toString(); + mechanismCity.setId(Integer.valueOf(codeCity)); + mechanismCity.setLabel(cityMap.get("name").toString()); + List mechanismAreaList =new ArrayList<>(); + //区 + List> areaList = mechanismMapper.groupAreaById(userId, type, codeCity,null); + for (Map areaMap:areaList) { + MechanismDto mechanismArea =new MechanismDto(); + String codeArea = areaMap.get("code").toString(); + mechanismArea.setId(Integer.valueOf(codeArea)); + mechanismArea.setLabel(areaMap.get("name").toString()); + List mechanismOperatorList =new ArrayList<>(); + //运营商 + List> operatorList = mechanismMapper.groupOperatorById(userId, type, codeArea); + for (Map operatorMap:operatorList) { + MechanismDto mechanismOperator =new MechanismDto(); + String operatorId = operatorMap.get("operatorId").toString(); + mechanismOperator.setId(Integer.valueOf(operatorId)); + mechanismOperator.setLabel(operatorMap.get("name").toString()); + List mechanismdataList =new ArrayList<>(); + //场站 + List> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,codeArea); + for (Map dataMap:dataList) { + MechanismDto mechanismData =new MechanismDto(); + String codeData = dataMap.get("chargingStationId").toString(); + mechanismData.setId(Integer.valueOf(codeData)); + mechanismData.setLabel(dataMap.get("name").toString()); + mechanismdataList.add(mechanismData); + } + mechanismOperator.setChildren(mechanismdataList); + mechanismOperatorList.add(mechanismOperator); + } + mechanismArea.setChildren(mechanismOperatorList); + mechanismAreaList.add(mechanismArea); + } + mechanismCity.setChildren(mechanismAreaList); + mechanismCityList.add(mechanismCity); + } + mechanismDto.setChildren(mechanismCityList); + mechanismDtos.add(mechanismDto); + } + } + return mechanismDtos; + } + + /** + * 运营商树 + */ + public List operatorTree(Long userId, Integer type){ + List mechanismDtos =new ArrayList<>(); + List> operatorList = mechanismMapper.groupOperatorById(userId, type, null); + if(operatorList !=null && operatorList.size()>0){ + for (Map operatorMap:operatorList) { + MechanismDto mechanismOperator =new MechanismDto(); + String operatorId = operatorMap.get("operatorId").toString(); + mechanismOperator.setId(Integer.valueOf(operatorId)); + mechanismOperator.setLabel(operatorMap.get("name").toString()); + List mechanismdataList =new ArrayList<>(); + //场站 + List> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,null); + for (Map dataMap:dataList) { + MechanismDto mechanismData =new MechanismDto(); + String codeData = dataMap.get("chargingStationId").toString(); + mechanismData.setId(Integer.valueOf(codeData)); + mechanismData.setLabel(dataMap.get("name").toString()); + mechanismdataList.add(mechanismData); + } + mechanismOperator.setChildren(mechanismdataList); + mechanismDtos.add(mechanismOperator); + } + } + return mechanismDtos; + } + + /** + * 运营商--地区树 + * @param userId + * @param type + * @return + */ + public List operatorRegionTree(Long userId, Integer type){ + + List mechanismDtos =new ArrayList<>(); + List> operatorList = mechanismMapper.groupOperatorById(userId, type, null); + if(operatorList !=null && operatorList.size()>0){ + for (Map operatorMap:operatorList) { + MechanismDto mechanismOperator =new MechanismDto(); + String operatorId = operatorMap.get("operatorId").toString(); + mechanismOperator.setId(Integer.valueOf(operatorId)); + mechanismOperator.setLabel(operatorMap.get("name").toString()); + List mechanismdataList =new ArrayList<>(); + //省 + List> list = mechanismMapper.groupProvinceById(userId, 3,Long.valueOf(operatorId)); + for (Map map:list) { + MechanismDto mechanismDto =new MechanismDto(); + String code = map.get("code").toString(); + mechanismDto.setId(Integer.valueOf(code)); + mechanismDto.setLabel(map.get("name").toString()); + List mechanismCityList =new ArrayList<>(); + //市 + List> cityList = mechanismMapper.groupCityById(userId, 3, code,Long.valueOf(operatorId)); + for (Map cityMap:cityList) { + MechanismDto mechanismCity =new MechanismDto(); + String codeCity = cityMap.get("code").toString(); + mechanismCity.setId(Integer.valueOf(codeCity)); + mechanismCity.setLabel(cityMap.get("name").toString()); + List mechanismAreaList =new ArrayList<>(); + //区 + List> areaList = mechanismMapper.groupAreaById(userId, 3,codeCity,Long.valueOf(operatorId)); + for (Map areaMap:areaList) { + MechanismDto mechanismArea =new MechanismDto(); + String codeArea = areaMap.get("code").toString(); + mechanismArea.setId(Integer.valueOf(codeArea)); + mechanismArea.setLabel(areaMap.get("name").toString()); + List mechanismOperatorList =new ArrayList<>(); + //场站 + List> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,codeArea); + for (Map dataMap:dataList) { + MechanismDto mechanismData =new MechanismDto(); + String codeData = dataMap.get("chargingStationId").toString(); + mechanismData.setId(Integer.valueOf(codeData)); + mechanismData.setLabel(dataMap.get("name").toString()); + mechanismOperatorList.add(mechanismData); + } + mechanismArea.setChildren(mechanismOperatorList); + mechanismAreaList.add(mechanismArea); + } + mechanismCity.setChildren(mechanismAreaList); + mechanismCityList.add(mechanismCity); + } + mechanismDto.setChildren(mechanismCityList); + mechanismdataList.add(mechanismDto); + } + mechanismOperator.setChildren(mechanismdataList); + mechanismDtos.add(mechanismOperator); + } + } + return mechanismDtos; + } +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java new file mode 100644 index 00000000..85bb1c8c --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java @@ -0,0 +1,64 @@ +package com.xhpc.user.service.impl; + +import com.xhpc.common.core.utils.SecurityUtils; +import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.user.domain.XhpcCommunity; +import com.xhpc.user.mapper.XhpcCommunityMapper; +import com.xhpc.user.service.IXhpcCommunityService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/12/20 9:59 + */ +@Service +public class XhpcCommunityServiceImpl implements IXhpcCommunityService { + + @Autowired + private XhpcCommunityMapper xhpcCommunityMapper; + + @Override + public List> list(String name) { + Long userId = SecurityUtils.getUserId(); + List> list =new ArrayList<>(); + if(userId !=null){ + Map landUser = xhpcCommunityMapper.getLandUser(userId); + if(landUser !=null && landUser.get("userType") !=null){ + if("00".equals(landUser.get("userType").toString())){ + list = xhpcCommunityMapper.list(name); + } + } + } + return list; + } + + @Override + public AjaxResult addCommunity(XhpcCommunity xhpcCommunity) { + + String chargingStationIds = xhpcCommunity.getChargingStationIds(); + if("".equals(chargingStationIds) || chargingStationIds ==null){ + xhpcCommunity.setStatus(0); + } + xhpcCommunityMapper.addCommunity(xhpcCommunity); + if(!"".equals(chargingStationIds) && chargingStationIds !=null){ + xhpcCommunityMapper.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCommunity.getCommunityId(),1); + } + return AjaxResult.success(); + } + + @Override + public void deleteCommunity(XhpcCommunity xhpcCommunity) { + if(xhpcCommunity !=null && xhpcCommunity.getCommunityId() !=null){ + int i = xhpcCommunityMapper.countCommunityPersonnel(xhpcCommunity.getCommunityId()); + if(i==0){ + xhpcCommunityMapper.deleteCommunity(xhpcCommunity.getCommunityId()); + } + } + } +} diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml new file mode 100644 index 00000000..ed042905 --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml new file mode 100644 index 00000000..06cebfa8 --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into xhpc_mechanism (charging_station_id,mechanism_id,source) VALUE (#{item},#{mechanismId},#{source}) + + + + + insert into xhpc_community + + + community_id, + + + name, + + + service_preferential, + + + min_people, + + + contact_name, + + + contact_phone, + + + address, + + + dimension, + + + del_flag, + + + create_time, + + + create_by, + + + update_time, + + + update_by, + + + remark, + + + + + #{communityId}, + + + #{name}, + + + #{servicePreferential}, + + + #{minPeople}, + + + #{contactName}, + + + #{contactPhone}, + + + #{address}, + + + #{dimension}, + + + #{delFlag}, + + + #{createTime}, + + + #{createBy}, + + + #{updateTime}, + + + #{updateBy}, + + + #{remark}, + + + + + + update xhpc_community set del_flag =1 where community_id=#{communityId} + + + +