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 4fd7137a..9592aac1 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 @@ -338,15 +338,19 @@ public class XhpcPileOrderController extends BaseController { if(!"".equals(stopReason) && stopReason!=null){ xhpcChargeOrder.setType(Integer.parseInt(stopReason)); if("40".equals(stopReason)){ - xhpcHistoryOrder.setStopReasonEvcs(0); - }else if("42".equals(stopReason) || "43".equals(stopReason)||"44".equals(stopReason)){ - xhpcHistoryOrder.setStopReasonEvcs(1); + xhpcHistoryOrder.setStopReasonEvcs(40); + }else if("42".equals(stopReason)){ + xhpcHistoryOrder.setStopReasonEvcs(42); + }else if("43".equals(stopReason)){ + xhpcHistoryOrder.setStopReasonEvcs(43); + }else if("44".equals(stopReason)){ + xhpcHistoryOrder.setStopReasonEvcs(44); }else if("41".equals(stopReason)){ - xhpcHistoryOrder.setStopReasonEvcs(2); + xhpcHistoryOrder.setStopReasonEvcs(41); }else if("48".equals(stopReason)){ - xhpcHistoryOrder.setStopReasonEvcs(3); + xhpcHistoryOrder.setStopReasonEvcs(48); }else{ - xhpcHistoryOrder.setStopReasonEvcs(5); + xhpcHistoryOrder.setStopReasonEvcs(49); } } }catch (Exception e){} diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java index 5029ee2e..257730bc 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java @@ -69,15 +69,16 @@ public class XhpcHistoryOrderController extends BaseController { * @param vinCode VIN码 * @param overStartTime 订单结束-开始时间 * @param overEndTime 订单结束-开始时间 + * @param personnelId 人员id * @return */ @GetMapping("/getListPage") public TableDataInfo getListPage(String phone,String transactionNumber,@RequestParam("status")Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,@RequestParam("userId") Long userId, Integer type, - String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime) + String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId) { startPage(); - List> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime); + List> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId); return getDataTable(listPage); } @@ -117,9 +118,10 @@ public class XhpcHistoryOrderController extends BaseController { String terminalName, String vinCode, String overStartTime, - String overEndTime) throws IOException { + String overEndTime, + Long personnelId) throws IOException { - xhpcHistoryOrderService.export(response, phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime); + xhpcHistoryOrderService.export(response, phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java index fa938110..ed4c8719 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java @@ -75,7 +75,7 @@ public interface XhpcHistoryOrderMapper { * 历史订单记录(PC) * @return */ - List> getListPage(@Param("phone")String phone,@Param("transactionNumber")String transactionNumber,@Param("status")Integer status,@Param("chargingStationName")String chargingStationName,@Param("operatorId")Long operatorId,@Param("source")Integer source,@Param("beginStartTime")String beginStartTime,@Param("beginEndTime")String beginEndTime,@Param("userId")Long userId,@Param("type")Integer type,@Param("number")Integer number,@Param("affiliationOrganization")String affiliationOrganization,@Param("evcsOrderNo")String evcsOrderNo,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber,@Param("terminalName")String terminalName,@Param("vinCode")String vinCode,@Param("overStartTime")String overStartTime,@Param("overEndTime")String overEndTime); + List> getListPage(@Param("phone")String phone,@Param("transactionNumber")String transactionNumber,@Param("status")Integer status,@Param("chargingStationName")String chargingStationName,@Param("operatorId")Long operatorId,@Param("source")Integer source,@Param("beginStartTime")String beginStartTime,@Param("beginEndTime")String beginEndTime,@Param("userId")Long userId,@Param("type")Integer type,@Param("number")Integer number,@Param("affiliationOrganization")String affiliationOrganization,@Param("evcsOrderNo")String evcsOrderNo,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber,@Param("terminalName")String terminalName,@Param("vinCode")String vinCode,@Param("overStartTime")String overStartTime,@Param("overEndTime")String overEndTime,@Param("personnelId")Long personnelId); /** * 获取费率时段 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java index 1a0f397c..456307ef 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java @@ -52,14 +52,14 @@ public interface IXhpcHistoryOrderService { * 历史订单记录(PC) * @return */ - List> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime); + List> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId); /** * 历史订单记录导出(PC) * @return */ - void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime) throws IOException; + void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId) throws IOException; /** diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java index 6197050e..16f32bfe 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java @@ -85,14 +85,18 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { } @Override - public List> getListPage(String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime) { + public List> getListPage(String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId) { Integer number = 0; + //电话和用户类型都不为null number =3 + //电话不为null,用户类型为null number =1 + //电话为null,用户类型不为null number=2 + //电话为null,用户类型为null number=0 if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) { number = 3; - } else if (!"".equals(phone) && phone != null) { + } else if (!"".equals(phone) && phone != null && source==null) { number = 1; - } else { + } else if(phone == null && source !=null) { number = 2; } //获取登陆用户 @@ -106,25 +110,25 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { if ("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())) { Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); //运营商看自己的场站 - list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime); + list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId); } else { //查询赋值的场站 - list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime); + list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId); } } } } else { - list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime); + list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId); } return list; } @Override - public void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime) throws IOException { + public void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId) throws IOException { - List> list = getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime); + List> list = getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId); // 通过工具类创建writer,默认创建xls格式 ExcelWriter writer = ExcelUtil.getWriter(true); writer.addHeaderAlias("historyOrderId", "历史订单ID"); 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 1df454c6..6ded72cf 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -675,7 +675,7 @@ and ho.type=#{type} - and co.source=#{source} + and ho.source=#{source} and co.Plate_num like concat('%', #{plateNum}, '%') @@ -717,31 +717,42 @@ and op.operator_id =#{operatorId} - and co.user_id in ( - SELECT cro.user_id - FROM xhpc_charge_order cro WHERE cro.source = 0 AND cro.user_id IN ( SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%')) + and ho.user_id in( + select internet_user_id as user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%') and internet_user_id in (select user_id from xhpc_history_order where source=1) union - SELECT cro.user_id FROM xhpc_charge_order cro WHERE cro.source = 1 AND cro.user_id IN (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%')) + select app_user_id as user_id from xhpc_app_user where phone like concat('%', #{phone}, '%') and app_user_id in (select user_id from xhpc_history_order where source=0) + union + select community_personnel_id as user_id from xhpc_community_personnel where account like concat('%', #{phone}, '%') and community_personnel_id in (select user_id from xhpc_history_order where source=2) + union + select customers_personnel_id as user_id from xhpc_customers_personnel where account like concat('%', #{phone}, '%') and customers_personnel_id in (select user_id from xhpc_history_order where source=3) ) - - and co.user_id in ( - SELECT cro.user_id FROM xhpc_charge_order cro WHERE cro.source = 0 AND cro.user_id IN ( SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%'))) + + and ho.user_id in(select app_user_id from xhpc_app_user where app_user_id in (select user_id from xhpc_history_order where source=0)) - - and co.user_id in ( - SELECT cro.user_id FROM xhpc_charge_order cro WHERE cro.source = 1 AND cro.user_id IN (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%'))) + + and ho.user_id in(select internet_user_id from xhpc_internet_user where internet_user_id in (select user_id from xhpc_history_order where source=1)) + + + and ho.user_id in(select community_personnel_id from xhpc_community_personnel where community_personnel_id in (select user_id from xhpc_history_order where source=2)) + + + and ho.user_id in(select customers_personnel_id from xhpc_customers_personnel where customers_personnel_id in (select user_id from xhpc_history_order where source=3)) - - and co.user_id in ( - SELECT cro.user_id FROM xhpc_charge_order cro WHERE cro.source = 0 AND cro.user_id IN ( SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%'))) + + and ho.user_id in(select app_user_id from xhpc_app_user where phone like concat('%', #{phone}, '%') and app_user_id in (select user_id from xhpc_history_order where source=0)) - - and co.user_id in ( - SELECT cro.user_id FROM xhpc_charge_order cro WHERE cro.source = 1 AND cro.user_id IN (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%'))) + + and ho.user_id in(select internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%') and internet_user_id in (select user_id from xhpc_history_order where source=1)) + + + and ho.user_id in(select community_personnel_id from xhpc_community_personnel where account like concat('%', #{phone}, '%') and community_personnel_id in (select user_id from xhpc_history_order where source=2)) + + + and ho.user_id in(select customers_personnel_id from xhpc_customers_personnel where account like concat('%', #{phone}, '%') and customers_personnel_id in (select user_id from xhpc_history_order where source=3)) @@ -750,6 +761,9 @@ and co.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) + + and ho.user_id=#{personnelId} + order by ho.create_time desc diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRechargeOrderController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRechargeOrderController.java index c245657a..f3ea159c 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRechargeOrderController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRechargeOrderController.java @@ -50,9 +50,9 @@ public class XhpcRechargeOrderController extends BaseController { */ //@PreAuthorize(hasPermi = "refund:order:page") @GetMapping("/page") - public TableDataInfo page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { + public TableDataInfo page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId) { startPage(); - List> list = iXhpcRechargeOrderService.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type); + List> list = iXhpcRechargeOrderService.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId); return getDataTable(list); } @@ -69,9 +69,12 @@ public class XhpcRechargeOrderController extends BaseController { String status, String createTimeStart, String createTimeEnd, - Integer type) throws IOException { + Integer type, + Integer source, + Integer userId) throws IOException { - iXhpcRechargeOrderService.export(response, phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type); + + iXhpcRechargeOrderService.export(response, phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId); } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java index 2dd5a392..655b0d23 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java @@ -103,9 +103,9 @@ public class XhpcRefundOrderController extends BaseController { */ //@PreAuthorize(hasPermi = "refund:order:page") @GetMapping("/page") - public TableDataInfo page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { + public TableDataInfo page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId) { startPage(); - List> list = iXhpcRefundOrderService.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type); + List> list = iXhpcRefundOrderService.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId); return getDataTable(list); } @@ -118,8 +118,10 @@ public class XhpcRefundOrderController extends BaseController { String status, String createTimeStart, String createTimeEnd, - Integer type) throws IOException { - iXhpcRefundOrderService.export(response, phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type); + Integer type, + Integer source, + Integer userId) throws IOException { + iXhpcRefundOrderService.export(response, phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId); } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRechargeOrderMapper.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRechargeOrderMapper.java index a61d756b..e0734153 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRechargeOrderMapper.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRechargeOrderMapper.java @@ -47,7 +47,7 @@ public interface XhpcRechargeOrderMapper { * @param createTimeEnd * @return */ - public List> page(@Param("phone") String phone, @Param("rechargeOrderNumber") String rechargeOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type); + public List> page(@Param("phone") String phone, @Param("rechargeOrderNumber") String rechargeOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("source")Integer source,@Param("userId")Integer userId); /** * 统计 diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java index f5bea4c7..0b82e388 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java @@ -63,7 +63,7 @@ public interface XhpcRefundOrderMapper { * @param createTimeEnd * @return */ - public List> page(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type); + public List> page(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("source")Integer source,@Param("userId")Integer userId); /** diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRechargeOrderService.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRechargeOrderService.java index 059c1f99..11a43ceb 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRechargeOrderService.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRechargeOrderService.java @@ -40,7 +40,7 @@ public interface IXhpcRechargeOrderService { * @param createTimeEnd * @return */ - public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type); + public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId); /** @@ -53,7 +53,7 @@ public interface IXhpcRechargeOrderService { * @param createTimeEnd * @return */ - public void export(HttpServletResponse response, String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) throws IOException; + public void export(HttpServletResponse response, String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type,Integer source,Integer userId) throws IOException; /** diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java index aaced891..a05cbd02 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java @@ -42,7 +42,7 @@ public interface IXhpcRefundOrderService { * @param createTimeEnd * @return */ - public List> page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type); + public List> page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId); @@ -56,7 +56,7 @@ public interface IXhpcRefundOrderService { * @param createTimeEnd * @return */ - public void export(HttpServletResponse response, String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) throws IOException; + public void export(HttpServletResponse response, String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type,Integer source,Integer userId) throws IOException; /** diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java index d1ecf172..0b80771c 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java @@ -68,14 +68,14 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService { * @return */ @Override - public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { - return xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type); + public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId) { + return xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId); } @Override - public void export(HttpServletResponse response, String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) throws IOException { - List> list = xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type); + public void export(HttpServletResponse response, String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type,Integer source,Integer userId) throws IOException { + List> list = xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId); // 通过工具类创建writer,默认创建xls格式 ExcelWriter writer = ExcelUtil.getWriter(true); @@ -85,7 +85,8 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService { writer.addHeaderAlias("amount", "退款金额"); writer.addHeaderAlias("alipayNumber", "账号"); writer.addHeaderAlias("prepayid", "微信编号"); - writer.addHeaderAlias("type", "充值渠道(1微信 2支付宝)"); + writer.addHeaderAlias("type", "充值渠道(1微信 2支付宝 3平台)"); + writer.addHeaderAlias("source", "订单来源(0 C端用户 1 流量方用户 2 社区用户 3 B端用户)"); writer.addHeaderAlias("status", "状态(0待支付 1充值成功,2充值失败)"); writer.addHeaderAlias("createTime", "充值时间"); writer.addHeaderAlias("phone", "账号"); diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java index bd33962f..7f1fb66b 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java @@ -70,14 +70,14 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService { * @return */ @Override - public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { - return xhpcRefundOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type); + public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId) { + return xhpcRefundOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId); } @Override - public void export(HttpServletResponse response, String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) throws IOException { - List> list = xhpcRefundOrderMapper.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type); + public void export(HttpServletResponse response, String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type,Integer source,Integer userId) throws IOException { + List> list = xhpcRefundOrderMapper.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId); // 通过工具类创建writer,默认创建xls格式 ExcelWriter writer = ExcelUtil.getWriter(true); diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRechargeOrderMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRechargeOrderMapper.xml index a25f1d23..27563848 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRechargeOrderMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRechargeOrderMapper.xml @@ -148,15 +148,41 @@ diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml index 004b8166..4616285e 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml @@ -180,13 +180,40 @@ xro.type,xro.examine_status examineStatus,xro.`status`,xro.source source,xro.create_time createTime, xau.phone,sdd.dict_label statusName,sdds.dict_label examineStatusName from xhpc_refund_order xro - LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id + LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id and xro.source =0 + LEFT JOIN xhpc_community_personnel cop on cop.community_personnel_id = xro.user_id and xro.source =2 + LEFT JOIN xhpc_customers_personnel cup on cup.customers_personnel_id = xro.user_id and xro.source =3 LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'refund_order_status' and sdd.dict_value = xro.`status` LEFT JOIN sys_dict_data sdds on sdds.`dict_type` = 'refund_examine_status' and sdds.dict_value = xro.examine_status where xro.del_flag = 0 - - and xau.phone like concat(concat('%', #{phone}), '%') + + + and xro.source=#{source} and xau.phone like concat(concat('%', #{phone}), '%') + + + and xro.source=#{source} and cop.account like concat(concat('%', #{phone}), '%') + + + and xro.source=#{source} and cup.account like concat(concat('%', #{phone}), '%') + + + + and xro.source=#{source} + + + and xau.app_user_id in ( + select app_user_id from xhpc_app_user where phone like concat(concat('%', #{phone}), '%') and app_user_id in + (select user_id from xhpc_recharge_order where source=0) + union + select community_personnel_id as app_user_id from xhpc_community_personnel where account like + concat(concat('%', #{phone}), '%') and community_personnel_id in (select user_id from xhpc_recharge_order + where source=2) + union + select customers_personnel_id as app_user_id from xhpc_customers_personnel where account like + concat(concat('%', #{phone}), '%') and community_personnel_id in (select user_id from xhpc_recharge_order + where source=3) + ) and xro.refund_order_number like concat(concat('%', #{refundOrderNumber}), '%') 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 index 1f7cfdff..6c486e31 100644 --- 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 @@ -3,11 +3,8 @@ 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.domain.XhpcCommunityPersonnel; -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.*; @@ -25,8 +22,6 @@ public class XhpcCommunityController extends BaseController { @Autowired private IXhpcCommunityService xhpcCommunityService; - @Autowired - private IMechanismService mechanismService; /** * 社区组树列表 @@ -53,8 +48,7 @@ public class XhpcCommunityController extends BaseController { */ @PostMapping(value = "/deleteCommunity") public AjaxResult deleteCommunity(@RequestBody XhpcCommunity xhpcCommunity) { - xhpcCommunityService.deleteCommunity(xhpcCommunity); - return AjaxResult.success(); + return xhpcCommunityService.deleteCommunity(xhpcCommunity); } /** @@ -75,16 +69,7 @@ public class XhpcCommunityController extends BaseController { return xhpcCommunityService.updateCommunity(xhpcCommunity); } - /** - * 数据维度 - * @param status 0 地区 1.运营商 2. 运营商-地区 - * @return - */ - @GetMapping(value = "/getMechanism") - public AjaxResult getMechanism(@RequestParam(value = "status")Integer status) { - List mechanismDtos = mechanismService.dataList(status); - return AjaxResult.success(mechanismDtos); - } + /** @@ -134,7 +119,7 @@ public class XhpcCommunityController extends BaseController { } /** - * 删除社区人员 + * 改变社区人员状态 */ @PostMapping(value = "/updateCommunityPersonnelStatus") public AjaxResult updateCommunityPersonnelStatus(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) { @@ -142,4 +127,12 @@ public class XhpcCommunityController extends BaseController { return AjaxResult.success(); } + /** + * 充值 + */ + @PostMapping(value = "/addRecharge") + public AjaxResult addRecharge(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) { + return xhpcCommunityService.addRecharge(xhpcCommunityPersonnel); + } + } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCustomersController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCustomersController.java new file mode 100644 index 00000000..d38ce91f --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCustomersController.java @@ -0,0 +1,133 @@ +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.user.domain.XhpcCustomers; +import com.xhpc.user.domain.XhpcCustomersPersonnel; +import com.xhpc.user.service.IXhpcCustomersService; +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/23 15:52 + */ +@RestController +@RequestMapping("/customers") +public class XhpcCustomersController extends BaseController { + + @Autowired + private IXhpcCustomersService xhpcCustomersService; + + /** + * 大客户组树列表 + */ + @GetMapping("/list") + public TableDataInfo list(String name) { + startPage(); + List> list = xhpcCustomersService.list(name); + return getDataTable(list); + } + + /** + * 新增大客户 + * + * @return + */ + @PostMapping(value = "/addCustomers") + public AjaxResult addCustomers(@RequestBody XhpcCustomers xhpcCustomers) { + return xhpcCustomersService.addCustomers(xhpcCustomers); + } + + /** + * 删除大客户 + */ + @PostMapping(value = "/deleteCustomers") + public AjaxResult deleteCustomers(@RequestBody XhpcCustomers xhpcCustomers) { + return xhpcCustomersService.deleteCustomers(xhpcCustomers); + } + + /** + * 查询大客户 + */ + @PostMapping(value = "/getCustomersById") + public AjaxResult getCustomersById(@RequestBody XhpcCustomers xhpcCustomers) { + return AjaxResult.success(xhpcCustomersService.getCustomersById(xhpcCustomers)); + } + + /** + * 编辑大客户组树 + * + * @return + */ + @PostMapping(value = "/updateCustomers") + public AjaxResult updateCustomers(@RequestBody XhpcCustomers xhpcCustomers) { + return xhpcCustomersService.updateCustomers(xhpcCustomers); + } + + /** + * 大客户人员列表 + */ + @GetMapping("/customersPersonnelList") + public TableDataInfo communityPersonnelList(Long customersId,String account,String phone,Integer status) { + startPage(); + List> list = xhpcCustomersService.customersPersonnelList(customersId, account, phone, status); + return getDataTable(list); + } + /** + * 大客户人员添加 + * + */ + @PostMapping(value = "/addCustomersPersonnel") + public AjaxResult addCustomersPersonnel(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { + return xhpcCustomersService.addCustomersPersonnel(xhpcCustomersPersonnel); + } + + /** + * 查看大客户人员 + * + */ + @PostMapping(value = "/getCustomersPersonnelById") + public AjaxResult getCustomersPersonnelById(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { + return AjaxResult.success(xhpcCustomersService.getCustomersPersonnelById(xhpcCustomersPersonnel)); + } + + /** + * 编辑大客户人员 + * + */ + @PostMapping(value = "/updateCustomersPersonnel") + public AjaxResult updateCustomersPersonnel(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { + return xhpcCustomersService.updateCustomersPersonnel(xhpcCustomersPersonnel); + } + + /** + * 删除社区人员 + */ + @PostMapping(value = "/deleteCustomersPersonnel") + public AjaxResult deleteCustomersPersonnel(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { + xhpcCustomersService.deleteCustomersPersonnel(xhpcCustomersPersonnel); + return AjaxResult.success(); + } + + /** + * 充值 + */ + @PostMapping(value = "/addRecharge") + public AjaxResult addRecharge(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { + return xhpcCustomersService.addRecharge(xhpcCustomersPersonnel); + } + + /** + * 改变社区人员状态 + */ + @PostMapping(value = "/updateCustomersPersonnelStatus") + public AjaxResult updateCustomersPersonnelStatus(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { + xhpcCustomersService.updateCustomersPersonnelStatus(xhpcCustomersPersonnel); + return AjaxResult.success(); + } +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcMechanismController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcMechanismController.java new file mode 100644 index 00000000..7fd9464c --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcMechanismController.java @@ -0,0 +1,35 @@ +package com.xhpc.user.controller; + +import com.xhpc.common.core.web.controller.BaseController; +import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.user.dto.MechanismDto; +import com.xhpc.user.service.IMechanismService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author yuyang + * @date 2021/12/23 16:20 + */ +@RestController +@RequestMapping("/mechanism") +public class XhpcMechanismController extends BaseController { + + @Autowired + private IMechanismService mechanismService; + /** + * 数据维度 + * @param status 0 地区 1.运营商 2. 运营商-地区 + * @return + */ + @GetMapping(value = "/getMechanism") + public AjaxResult getMechanism(@RequestParam(value = "status")Integer status) { + List mechanismDtos = mechanismService.dataList(status); + return AjaxResult.success(mechanismDtos); + } +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCommunityPersonnel.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCommunityPersonnel.java index ac3f7082..33f4c9ea 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCommunityPersonnel.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCommunityPersonnel.java @@ -35,8 +35,4 @@ public class XhpcCommunityPersonnel extends BaseEntity { private Integer status; private Integer delFlag; - /** - * 电站id - */ - private String chargingStationIds; } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCustomers.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCustomers.java new file mode 100644 index 00000000..e7d2c72f --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCustomers.java @@ -0,0 +1,86 @@ +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; + +/** + * 大客户组树 + * @author yuyang + * @date 2021/12/23 15:47 + */ +@Data +public class XhpcCustomers extends BaseEntity { + /** + * 大客户组ID + */ + private Long customersId; + + /** + * 大客户组名称 + */ + @NotEmpty(message = "大客户组名称不能为空") + @Length(min = 2,max = 10,message = "大客户组名称长度2~10之间") + private String name; + + /** + * 服务费优惠比例 + */ + private Double servicePreferential; + + /** + * 联系人 + */ + @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; + /** + * 运营商id + */ + private Long operatorId; + + /** + * 数据维度 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/domain/XhpcCustomersPersonnel.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCustomersPersonnel.java new file mode 100644 index 00000000..2e08ad8e --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcCustomersPersonnel.java @@ -0,0 +1,39 @@ +package com.xhpc.user.domain; + +import com.xhpc.common.core.web.domain.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author yuyang + * @date 2021/12/23 15:50 + */ +@Data +public class XhpcCustomersPersonnel extends BaseEntity { + + private Long customersPersonnelId; + + private Long customersId; + + 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; + +} 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 index 7f2e1684..7fd0d75d 100644 --- 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 @@ -2,6 +2,7 @@ package com.xhpc.user.mapper; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -61,4 +62,16 @@ public interface MechanismMapper { * 添加数据维度 */ int addMechanism(@Param("chargingStationIds") List chargingStationIds,@Param("mechanismId")Long mechanismId,@Param("source")Integer source); + + /** + * 增加一条平台充值记录 + * @param userId + * @param amount + * @param orderNumber + * @param type + * @param source + * @param date + * @return + */ + int addRechargeOrder(@Param("userId")Long userId, @Param("amount")BigDecimal amount, @Param("orderNumber")String orderNumber, @Param("type")Integer type, @Param("source")Integer source,@Param("date") String date); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCustomersMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCustomersMapper.java new file mode 100644 index 00000000..d758e985 --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCustomersMapper.java @@ -0,0 +1,99 @@ +package com.xhpc.user.mapper; + +import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.user.domain.XhpcCustomers; +import com.xhpc.user.domain.XhpcCustomersPersonnel; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/12/23 15:54 + */ +public interface XhpcCustomersMapper { + + /** + * 获取登陆用户信息 + */ + Map getLandUser(@Param("userId") Long userId); + + /** + * 大客户组树列表 + * + * @param name 桩名称 + * @return + */ + List> list(@Param("name") String name,@Param("operatorId") Long operatorId); + + /** + * 查询大客户组 + * @param customersId 大客户id + * @param name 名称 + * @param type 1 表示已社区id进行查询 2 排查社区id查询 + * @return + */ + Map getCustomersById(@Param("customersId")Long customersId,@Param("name")String name,@Param("type")Integer type); + + /** + * 添加大客户组 + * @param xhpcCustomers + * @return + */ + int addCustomers(XhpcCustomers xhpcCustomers); + + /** + * 检查改组是否还存在大客户人员 + */ + int countCustomersPersonnel(@Param("customersId")Long customersId); + /** + * 删除大客户组 + * @param customersId + */ + void deleteCustomers(@Param("customersId")Long customersId); + + /** + * 修改大客户组 + * @param xhpcCustomers + * @return + */ + int updateCustomers(XhpcCustomers xhpcCustomers); + + /** + * 大客户人员列表 + * @return + */ + List> customersPersonnelList(@Param("customersId")Long customersId,@Param("account")String account,@Param("phone")String phone,@Param("status")Integer status); + + + /** + * 查询大客户人员 + * @return + */ + Map getCustomersPersonnelById(@Param("customersPersonnelId")Long customersPersonnelId,@Param("phone")String phone,@Param("account")String account,@Param("type")Integer type); + + /** + * 新增大客户人员 + * @param + * @return + */ + int addCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel); + + /** + * 修改大客户人员 + * @return + */ + int updateCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel); + + /** + * 删除大客户人员 + * @param customersPersonnelId + */ + void deleteCustomersPersonnel(@Param("customersPersonnelId")Long customersPersonnelId); + + /** + * 社区人员状态改变 + */ + void updateCustomersPersonnelStatus(@Param("customersPersonnelId")Long customersPersonnelId,@Param("status")Integer status); +} 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 index 747da683..854bf4d2 100644 --- 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 @@ -2,6 +2,7 @@ package com.xhpc.user.service; import com.xhpc.user.dto.MechanismDto; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -27,4 +28,14 @@ public interface IMechanismService { * 添加数据维度 */ int addMechanism(List chargingStationIds,Long mechanismId,Integer source); + + + /** + * 增加充值记录 + * @param userId 充值的用户 + * @param source 0 C端用户 1 流量方用户 2社区用户 3B端用户 + * @param amount 金额 + * @return + */ + int addRechargeOrder(Long userId,Integer source, BigDecimal amount); } 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 index 85060c08..1f39401f 100644 --- 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 @@ -5,6 +5,7 @@ import com.xhpc.common.domain.XhpcChargingPile; import com.xhpc.user.domain.XhpcCommunity; import com.xhpc.user.domain.XhpcCommunityPersonnel; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -33,7 +34,7 @@ public interface IXhpcCommunityService { /** * 删除社区组树 */ - void deleteCommunity(XhpcCommunity xhpcCommunity); + AjaxResult deleteCommunity(XhpcCommunity xhpcCommunity); /** * 编辑社区组树 @@ -87,4 +88,10 @@ public interface IXhpcCommunityService { * 社区人员状态改变 */ void updateCommunityPersonnelStatus(XhpcCommunityPersonnel xhpcCommunityPersonnel); + + /** + * 社区人员状态改变 + */ + AjaxResult addRecharge(XhpcCommunityPersonnel xhpcCommunityPersonnel); + } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCustomersService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCustomersService.java new file mode 100644 index 00000000..6a6d86a3 --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCustomersService.java @@ -0,0 +1,94 @@ +package com.xhpc.user.service; + +import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.user.domain.XhpcCustomers; +import com.xhpc.user.domain.XhpcCustomersPersonnel; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/12/23 15:53 + */ +public interface IXhpcCustomersService { + + /** + * 大客户组列表 + * + * @param name 桩名称 + * @return + */ + List> list(String name); + + /** + * 新增大客户组树 + * + * @param + * @return + */ + AjaxResult addCustomers(XhpcCustomers xhpcCustomers); + + /** + * 删除大客户组树 + */ + AjaxResult deleteCustomers(XhpcCustomers xhpcCustomers); + + /** + * 查询大客户组 + * + * @return + */ + Map getCustomersById(XhpcCustomers xhpcCustomers); + + /** + * 编辑大客户组 + * + * @param + * @return + */ + AjaxResult updateCustomers(XhpcCustomers xhpcCustomers); + + /** + * 大客户人员列表 + * @return + */ + List> customersPersonnelList(Long customersId,String account,String phone,Integer status); + + /** + * 新增社区人员 + * @param + * @return + */ + AjaxResult addCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel); + + /** + * 查询社区人员 + * + * @return + */ + Map getCustomersPersonnelById(XhpcCustomersPersonnel xhpcCustomersPersonnel); + + /** + * 编辑社区组树 + * + * @param + * @return + */ + AjaxResult updateCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel); + + /** + * 删除社区人员 + */ + void deleteCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel); + + /** + * 充值 + */ + AjaxResult addRecharge(XhpcCustomersPersonnel xhpcCustomersPersonnel); + + /** + * 社区人员状态改变 + */ + void updateCustomersPersonnelStatus(XhpcCustomersPersonnel xhpcCustomersPersonnel); +} 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 index 10717af5..412261a8 100644 --- 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 @@ -1,6 +1,9 @@ package com.xhpc.user.service.impl; +import cn.hutool.core.date.DateUtil; +import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.utils.SecurityUtils; +import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.user.dto.MechanismDto; import com.xhpc.user.mapper.MechanismMapper; @@ -8,6 +11,8 @@ import com.xhpc.user.service.IMechanismService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.sql.Date; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -63,6 +68,12 @@ public class IMechanismServiceImpl implements IMechanismService { return mechanismMapper.addMechanism(chargingStationIds, mechanismId, source); } + @Override + public int addRechargeOrder(Long userId, Integer source, BigDecimal amount) { + String orderNumber = StringUtils.numFormat(userId, 1, StatusConstants.FLOWING_WATER_RECHARGE_TYPE); + return mechanismMapper.addRechargeOrder(userId,amount,orderNumber,3,source, DateUtil.date().toString()); + } + /** * 地区树 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 index 0ff15041..70bb2fac 100644 --- 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 @@ -9,7 +9,9 @@ import com.xhpc.user.service.IMechanismService; import com.xhpc.user.service.IXhpcCommunityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -48,7 +50,7 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { //名称重复不能入库 Map communityById = xhpcCommunityMapper.getCommunityById(null, xhpcCommunity.getName(), null); if(communityById !=null){ - return AjaxResult.error("社区名称重复"); + return AjaxResult.error("社区组名称重复"); } String chargingStationIds = xhpcCommunity.getChargingStationIds(); @@ -65,12 +67,17 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { } @Override - public void deleteCommunity(XhpcCommunity xhpcCommunity) { + public AjaxResult deleteCommunity(XhpcCommunity xhpcCommunity) { if(xhpcCommunity !=null && xhpcCommunity.getCommunityId() !=null){ int i = xhpcCommunityMapper.countCommunityPersonnel(xhpcCommunity.getCommunityId()); if(i==0){ xhpcCommunityMapper.deleteCommunity(xhpcCommunity.getCommunityId()); + return AjaxResult.success(); + }else{ + return AjaxResult.error("该社区组下有用户不能删除"); } + }else{ + return AjaxResult.error("请传社区组id"); } } @@ -108,6 +115,7 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { } @Override + @Transactional public AjaxResult addCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel) { String phone = xhpcCommunityPersonnel.getPhone(); String account = xhpcCommunityPersonnel.getAccount(); @@ -120,10 +128,16 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { return AjaxResult.error("账号重复"); } } + BigDecimal rechargeMoney = xhpcCommunityPersonnel.getRechargeMoney(); + if(new BigDecimal(0).compareTo(rechargeMoney)==-1){ + //增加社区用户的剩余金额 + xhpcCommunityPersonnel.setSurplusMoney(rechargeMoney); + } xhpcCommunityMapper.addCommunityPersonnel(xhpcCommunityPersonnel); - //增加一条充值记录 - + if(new BigDecimal(0).compareTo(rechargeMoney)==-1){ + mechanismService.addRechargeOrder(xhpcCommunityPersonnel.getCommunityPersonnelId(),2,rechargeMoney); + } return AjaxResult.success(); } @@ -137,7 +151,14 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { Long communityPersonnelId = xhpcCommunityPersonnel.getCommunityPersonnelId(); String phone = xhpcCommunityPersonnel.getPhone(); String account = xhpcCommunityPersonnel.getAccount(); - + BigDecimal rechargeMoney = xhpcCommunityPersonnel.getRechargeMoney(); + BigDecimal surplusMoney = xhpcCommunityPersonnel.getSurplusMoney(); + if( rechargeMoney!=null){ + return AjaxResult.error("充值金额不能填写"); + } + if( surplusMoney!=null){ + return AjaxResult.error("剩余金额不能填写"); + } Map communityPersonnelById = xhpcCommunityMapper.getCommunityPersonnelById(communityPersonnelId, phone, account, 2); if(communityPersonnelById !=null){ if(phone.equals(communityPersonnelById.get("phone").toString())){ @@ -160,4 +181,30 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { public void updateCommunityPersonnelStatus(XhpcCommunityPersonnel xhpcCommunityPersonnel) { xhpcCommunityMapper.updateCommunityPersonnelStatus(xhpcCommunityPersonnel.getCommunityPersonnelId(),xhpcCommunityPersonnel.getStatus()); } + + @Override + @Transactional + public AjaxResult addRecharge(XhpcCommunityPersonnel xhpcCommunityPersonnel) { + + BigDecimal rechargeMoney = xhpcCommunityPersonnel.getRechargeMoney(); + Long communityPersonnelId = xhpcCommunityPersonnel.getCommunityPersonnelId(); + if(new BigDecimal(0).compareTo(rechargeMoney)==-1){ + //增加社区用户的剩余金额 + Map communityPersonnelById = xhpcCommunityMapper.getCommunityPersonnelById(communityPersonnelId, null, null, 1); + if(communityPersonnelById !=null){ + BigDecimal surplusMoney = new BigDecimal(communityPersonnelById.get("surplusMoney").toString()); + BigDecimal rechargeMoney1 = new BigDecimal(communityPersonnelById.get("rechargeMoney").toString()); + + XhpcCommunityPersonnel xhpcCommunityPersonnel1=new XhpcCommunityPersonnel(); + xhpcCommunityPersonnel1.setCommunityPersonnelId(communityPersonnelId); + xhpcCommunityPersonnel1.setSurplusMoney(surplusMoney.add(rechargeMoney)); + xhpcCommunityPersonnel1.setRechargeMoney(rechargeMoney1.add(rechargeMoney)); + xhpcCommunityMapper.updateCommunityPersonnel(xhpcCommunityPersonnel1); + //增加充值记录 + mechanismService.addRechargeOrder(communityPersonnelId,2,rechargeMoney); + return AjaxResult.success(); + } + } + return AjaxResult.error("充值金额大于0"); + } } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java new file mode 100644 index 00000000..d97e025e --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java @@ -0,0 +1,219 @@ +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.XhpcCustomers; +import com.xhpc.user.domain.XhpcCustomersPersonnel; +import com.xhpc.user.mapper.XhpcCustomersMapper; +import com.xhpc.user.service.IMechanismService; +import com.xhpc.user.service.IXhpcCustomersService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/12/23 15:53 + */ +@Service +public class XhpcCustomersServiceImpl implements IXhpcCustomersService { + + @Autowired + private XhpcCustomersMapper xhpcCustomersMapper; + @Autowired + private IMechanismService mechanismService; + + @Override + public List> list(String name) { + Long userId = SecurityUtils.getUserId(); + List> list =new ArrayList<>(); + if(userId !=null){ + Map landUser = xhpcCustomersMapper.getLandUser(userId); + if(landUser !=null && landUser.get("userType") !=null){ + if("00".equals(landUser.get("userType").toString()) ){ + list = xhpcCustomersMapper.list(name,null); + }else{ + list = xhpcCustomersMapper.list(name,Long.parseLong(landUser.get("operatorId").toString())); + } + } + } + return list; + } + + @Override + public AjaxResult addCustomers(XhpcCustomers xhpcCustomers) { + + //名称重复不能入库 + Map communityById = xhpcCustomersMapper.getCustomersById(null, xhpcCustomers.getName(), null); + if(communityById !=null){ + return AjaxResult.error("大客户组名称重复"); + } + Long userId = SecurityUtils.getUserId(); + if(userId !=null){ + Map landUser = xhpcCustomersMapper.getLandUser(userId); + if(landUser !=null && landUser.get("userType") !=null){ + if("00".equals(landUser.get("userType").toString()) ){ + xhpcCustomers.setType(1); + }else{ + xhpcCustomers.setType(2); + xhpcCustomers.setOperatorId(Long.parseLong(landUser.get("operatorId").toString())); + } + } + }else{ + return AjaxResult.error("请重新登录"); + } + String chargingStationIds = xhpcCustomers.getChargingStationIds(); + if("".equals(chargingStationIds) || chargingStationIds ==null){ + xhpcCustomers.setStatus(0); + }else{ + xhpcCustomers.setStatus(1); + } + xhpcCustomersMapper.addCustomers(xhpcCustomers); + if(!"".equals(chargingStationIds) && chargingStationIds !=null){ + mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCustomers.getCustomersId(),1); + } + return AjaxResult.success(); + } + + @Override + public AjaxResult deleteCustomers(XhpcCustomers xhpcCustomers) { + if(xhpcCustomers !=null && xhpcCustomers.getCustomersId() !=null){ + int i = xhpcCustomersMapper.countCustomersPersonnel(xhpcCustomers.getCustomersId()); + if(i==0){ + xhpcCustomersMapper.deleteCustomers(xhpcCustomers.getCustomersId()); + return AjaxResult.success(); + }else{ + return AjaxResult.error("该大客户组下有用户不能删除"); + } + }else{ + return AjaxResult.error("请传大客户组id"); + } + } + + @Override + public Map getCustomersById(XhpcCustomers xhpcCustomers) { + return xhpcCustomersMapper.getCustomersById(xhpcCustomers.getCustomersId(), null, 1); + } + + @Override + public AjaxResult updateCustomers(XhpcCustomers xhpcCustomers) { + //名称重复不能入库 + Map customersById = xhpcCustomersMapper.getCustomersById(xhpcCustomers.getCustomersId(), xhpcCustomers.getName(), 2); + if(customersById !=null){ + return AjaxResult.error("大客户组名称重复"); + } + String chargingStationIds = xhpcCustomers.getChargingStationIds(); + if("".equals(chargingStationIds) || chargingStationIds ==null){ + xhpcCustomers.setStatus(0); + }else{ + xhpcCustomers.setStatus(1); + } + xhpcCustomersMapper.updateCustomers(xhpcCustomers); + mechanismService.updateMechanism(xhpcCustomers.getCustomersId(),1); + if(!"".equals(chargingStationIds) && chargingStationIds !=null){ + mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCustomers.getCustomersId(),0); + } + return AjaxResult.success(); + } + + @Override + public List> customersPersonnelList(Long customersId, String account, String phone, Integer status) { + return xhpcCustomersMapper.customersPersonnelList(customersId, account, phone, status); + } + + @Override + public AjaxResult addCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel) { + String phone = xhpcCustomersPersonnel.getPhone(); + String account = xhpcCustomersPersonnel.getAccount(); + Map communityPersonnelById = xhpcCustomersMapper.getCustomersPersonnelById(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 = xhpcCustomersPersonnel.getRechargeMoney(); + if(new BigDecimal(0).compareTo(rechargeMoney)==-1){ + //增加社区用户的剩余金额 + xhpcCustomersPersonnel.setSurplusMoney(rechargeMoney); + } + xhpcCustomersMapper.addCustomersPersonnel(xhpcCustomersPersonnel); + //增加一条充值记录 + if(new BigDecimal(0).compareTo(rechargeMoney)==-1){ + mechanismService.addRechargeOrder(xhpcCustomersPersonnel.getCustomersPersonnelId(),3,rechargeMoney); + } + return AjaxResult.success(); + } + + @Override + public Map getCustomersPersonnelById(XhpcCustomersPersonnel xhpcCustomersPersonnel) { + return xhpcCustomersMapper.getCustomersPersonnelById(xhpcCustomersPersonnel.getCustomersPersonnelId(), null, null, 1); + } + + @Override + public AjaxResult updateCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel) { + Long customersPersonnelId = xhpcCustomersPersonnel.getCustomersPersonnelId(); + String phone = xhpcCustomersPersonnel.getPhone(); + String account = xhpcCustomersPersonnel.getAccount(); + BigDecimal rechargeMoney = xhpcCustomersPersonnel.getRechargeMoney(); + BigDecimal surplusMoney = xhpcCustomersPersonnel.getSurplusMoney(); + if( rechargeMoney!=null){ + return AjaxResult.error("充值金额不能填写"); + } + if( surplusMoney!=null){ + return AjaxResult.error("剩余金额不能填写"); + } + Map customersPersonnelById = xhpcCustomersMapper.getCustomersPersonnelById(customersPersonnelId, phone, account, 2); + if(customersPersonnelById !=null){ + if(phone.equals(customersPersonnelById.get("phone").toString())){ + return AjaxResult.error("手机号重复"); + } + if(account.equals(customersPersonnelById.get("account").toString())){ + return AjaxResult.error("账号重复"); + } + } + xhpcCustomersMapper.updateCustomersPersonnel(xhpcCustomersPersonnel); + return AjaxResult.success(); + } + + @Override + public void deleteCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel) { + xhpcCustomersMapper.deleteCustomersPersonnel(xhpcCustomersPersonnel.getCustomersPersonnelId()); + } + + @Override + public AjaxResult addRecharge(XhpcCustomersPersonnel xhpcCustomersPersonnel) { + BigDecimal rechargeMoney = xhpcCustomersPersonnel.getRechargeMoney(); + Long customersPersonnelId = xhpcCustomersPersonnel.getCustomersPersonnelId(); + if(new BigDecimal(0).compareTo(rechargeMoney)==-1){ + //增加社区用户的剩余金额 + Map communityPersonnelById = xhpcCustomersMapper.getCustomersPersonnelById(customersPersonnelId, null, null, 1); + if(communityPersonnelById !=null){ + BigDecimal surplusMoney = new BigDecimal(communityPersonnelById.get("surplusMoney").toString()); + BigDecimal rechargeMoney1 = new BigDecimal(communityPersonnelById.get("rechargeMoney").toString()); + + XhpcCustomersPersonnel xhpcCustomersPersonnel1=new XhpcCustomersPersonnel(); + xhpcCustomersPersonnel1.setCustomersPersonnelId(customersPersonnelId); + xhpcCustomersPersonnel1.setSurplusMoney(surplusMoney.add(rechargeMoney)); + xhpcCustomersPersonnel1.setRechargeMoney(rechargeMoney1.add(rechargeMoney)); + xhpcCustomersMapper.updateCustomersPersonnel(xhpcCustomersPersonnel1); + //增加充值记录 + mechanismService.addRechargeOrder(customersPersonnelId,3,rechargeMoney); + return AjaxResult.success(); + } + } + return AjaxResult.error("充值金额大于0"); + } + + @Override + public void updateCustomersPersonnelStatus(XhpcCustomersPersonnel xhpcCustomersPersonnel) { + xhpcCustomersMapper.updateCustomersPersonnelStatus(xhpcCustomersPersonnel.getCustomersPersonnelId(),xhpcCustomersPersonnel.getStatus()); + } +} diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml index 99f6df29..5908be56 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml @@ -138,4 +138,8 @@ #{item},#{mechanismId},#{source} + + + INSERT INTO xhpc_recharge_order(user_id,recharge_order_number,amount,type,status,source,create_time) values (#{userId},#{orderNumber},#{amount},#{type},1,#{source},#{date}) + diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml index 99e57b88..42265840 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml @@ -338,6 +338,7 @@ account AS account, phone AS phone, recharge_money AS rechargeMoney, + surplus_money AS surplusMoney, type, status from xhpc_community_personnel @@ -366,6 +367,8 @@ name = #{name}, account = #{account}, phone = #{phone}, + recharge_money = #{rechargeMoney}, + surplus_money = #{surplusMoney}, type = #{type}, address = #{status}, del_flag = #{delFlag}, diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml new file mode 100644 index 00000000..148a2c3c --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml @@ -0,0 +1,385 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into xhpc_customers + + + customers_id, + + + name, + + + service_preferential, + + + contact_name, + + + contact_phone, + + + address, + + + dimension, + + + status, + + + del_flag, + + + create_time, + + + create_by, + + + update_time, + + + update_by, + + + remark, + + + + + #{customersId}, + + + #{name}, + + + #{servicePreferential}, + + + #{contactName}, + + + #{contactPhone}, + + + #{address}, + + + #{dimension}, + + + #{status}, + + + #{delFlag}, + + + #{createTime}, + + + #{createBy}, + + + #{updateTime}, + + + #{updateBy}, + + + #{remark}, + + + + + + update xhpc_customers + + name = #{name}, + service_preferential = #{servicePreferential}, + contact_name = #{contactName}, + contact_phone = #{contactPhone}, + address = #{address}, + address = #{dimension}, + address = #{status}, + del_flag = #{delFlag}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + remark = #{remark}, + + where customers_id=#{customersId} + + + + update xhpc_customers set del_flag =1 where customers_id=#{customersId} + + + + + + + + + + insert into xhpc_customers_personnel + + + customers_personnel_id, + + + customers_id, + + + name, + + + account, + + + recharge_money, + + + consume_money, + + + red_packet, + + + surplus_money, + + + phone, + + + type, + + + status, + + + del_flag, + + + create_time, + + + create_by, + + + update_time, + + + update_by, + + + remark, + + + + + #{customersPersonnelId}, + + + #{customersId}, + + + #{name}, + + + #{account}, + + + #{rechargeMoney}, + + + #{consumeMoney}, + + + #{redPacket}, + + + #{surplusMoney}, + + + #{phone}, + + + #{type}, + + + #{status}, + + + #{delFlag}, + + + #{createTime}, + + + #{createBy}, + + + #{updateTime}, + + + #{updateBy}, + + + #{remark}, + + + + + + + + + update xhpc_customers_personnel + + customers_id = #{customersId}, + name = #{name}, + account = #{account}, + phone = #{phone}, + recharge_money = #{rechargeMoney}, + surplus_money = #{surplusMoney}, + type = #{type}, + address = #{status}, + del_flag = #{delFlag}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + remark = #{remark}, + + where customers_personnel_id=#{customersPersonnelId} + + + + update xhpc_customers_personnel set del_flag=1 where customers_personnel_id=#{customersPersonnelId} + + + + update xhpc_customers_personnel set status=#{status} where customers_personnel_id=#{customersPersonnelId} + +