社区、大客户 PC端接口已完成

This commit is contained in:
yuyang 2021-12-23 18:22:42 +08:00
parent 43a738ff1f
commit f80f0aa6b4
33 changed files with 1359 additions and 98 deletions

View File

@ -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){}

View File

@ -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<Map<String, Object>> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime);
List<Map<String, Object>> 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);
}

View File

@ -75,7 +75,7 @@ public interface XhpcHistoryOrderMapper {
* 历史订单记录PC
* @return
*/
List<Map<String,Object>> 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<Map<String,Object>> 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);
/**
* 获取费率时段

View File

@ -52,14 +52,14 @@ public interface IXhpcHistoryOrderService {
* 历史订单记录PC
* @return
*/
List<Map<String,Object>> 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<Map<String,Object>> 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;
/**

View File

@ -85,14 +85,18 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
}
@Override
public List<Map<String, Object>> 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<Map<String, Object>> 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<Map<String, Object>> list = getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime);
List<Map<String, Object>> 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");

View File

@ -675,7 +675,7 @@
and ho.type=#{type}
</if>
<if test="source !=null">
and co.source=#{source}
and ho.source=#{source}
</if>
<if test="plateNum !=null and plateNum !=''">
and co.Plate_num like concat('%', #{plateNum}, '%')
@ -717,31 +717,42 @@
and op.operator_id =#{operatorId}
</if>
<if test="number==1">
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)
)
</if>
<if test="number==2">
<if test="source !=null and source ==0">
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}, '%')))
<if test="source ==0">
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))
</if>
<if test="source !=null and source ==1">
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}, '%')))
<if test="source ==1">
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))
</if>
<if test="source ==2">
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))
</if>
<if test="source ==3">
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))
</if>
</if>
<if test="number==3">
<if test="source !=null and source ==0">
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}, '%')))
<if test="source ==0">
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))
</if>
<if test="source !=null and source ==1">
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}, '%')))
<if test="source ==1">
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))
</if>
<if test="source ==2">
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))
</if>
<if test="source ==3">
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))
</if>
</if>
<if test="status==1">
@ -750,6 +761,9 @@
<if test="status==2">
and co.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if>
<if test="personnelId !=null">
and ho.user_id=#{personnelId}
</if>
order by ho.create_time desc
</select>

View File

@ -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<Map<String, Object>> list = iXhpcRechargeOrderService.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
List<Map<String, Object>> 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);
}

View File

@ -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<Map<String, Object>> list = iXhpcRefundOrderService.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type);
List<Map<String, Object>> 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);
}

View File

@ -47,7 +47,7 @@ public interface XhpcRechargeOrderMapper {
* @param createTimeEnd
* @return
*/
public List<Map<String, Object>> 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<Map<String, Object>> 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);
/**
* 统计

View File

@ -63,7 +63,7 @@ public interface XhpcRefundOrderMapper {
* @param createTimeEnd
* @return
*/
public List<Map<String, Object>> 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<Map<String, Object>> 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);
/**

View File

@ -40,7 +40,7 @@ public interface IXhpcRechargeOrderService {
* @param createTimeEnd
* @return
*/
public List<Map<String, Object>> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type);
public List<Map<String, Object>> 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;
/**

View File

@ -42,7 +42,7 @@ public interface IXhpcRefundOrderService {
* @param createTimeEnd
* @return
*/
public List<Map<String, Object>> page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type);
public List<Map<String, Object>> 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;
/**

View File

@ -68,14 +68,14 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
* @return
*/
@Override
public List<Map<String, Object>> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) {
return xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
public List<Map<String, Object>> 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<Map<String, Object>> 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<Map<String, Object>> 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", "账号");

View File

@ -70,14 +70,14 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
* @return
*/
@Override
public List<Map<String, Object>> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) {
return xhpcRefundOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
public List<Map<String, Object>> 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<Map<String, Object>> 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<Map<String, Object>> list = xhpcRefundOrderMapper.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId);
// 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true);

View File

@ -148,15 +148,41 @@
</select>
<select id="page" parameterType="java.lang.Long" resultType="java.util.Map">
select xro.recharge_order_id rechargeOrderId ,xro.recharge_order_number rechargeOrderNumber,
select
xro.recharge_order_id rechargeOrderId ,xro.recharge_order_number rechargeOrderNumber,
xro.alipay_number alipayNumber ,xro.prepay_id prepayid,xro.user_id userId,xro.amount,
xro.type ,xro.`status`,xro.create_time createTime,xro.source source,xau.phone,sdd.dict_label statusName
xro.type ,xro.`status`,xro.create_time createTime,xro.source source,
xau.phone,cop.account communityAccount,cup.account customersAccount,
sdd.dict_label statusName
from xhpc_recharge_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` = 'recharge_order_status' and sdd.dict_value = xro.`status`
where xro.del_flag = 0
<if test="phone != null and phone != ''">
and xau.phone like concat(concat('%', #{phone}), '%')
<if test="source != null and phone != null">
<if test="source==0 ">
and xro.source=#{source} and xau.phone like concat(concat('%', #{phone}), '%')
</if>
<if test="source=2">
and xro.source=#{source} and cop.account like concat(concat('%', #{phone}), '%')
</if>
<if test="source=3">
and xro.source=#{source} and cup.account like concat(concat('%', #{phone}), '%')
</if>
</if>
<if test="source != null and phone == null">
and xro.source=#{source}
</if>
<if test="source == null and and phone != null">
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 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)
)
</if>
<if test="rechargeOrderNumber != null and rechargeOrderNumber != ''">
and xro.recharge_order_number like concat(concat('%', #{rechargeOrderNumber}), '%')
@ -173,6 +199,9 @@
<if test="type != null and type != ''">
AND xro.type = #{type}
</if>
<if test="userId != null">
and xro.userId=#{userId}
</if>
ORDER BY xro.create_time DESC
</select>

View File

@ -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
<if test="phone != null and phone != ''">
and xau.phone like concat(concat('%', #{phone}), '%')
<if test="source != null and phone != null">
<if test="source==0 ">
and xro.source=#{source} and xau.phone like concat(concat('%', #{phone}), '%')
</if>
<if test="source=2">
and xro.source=#{source} and cop.account like concat(concat('%', #{phone}), '%')
</if>
<if test="source=3">
and xro.source=#{source} and cup.account like concat(concat('%', #{phone}), '%')
</if>
</if>
<if test="source != null and phone == null">
and xro.source=#{source}
</if>
<if test="source == null and and phone != null">
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)
)
</if>
<if test="refundOrderNumber != null and refundOrderNumber != ''">
and xro.refund_order_number like concat(concat('%', #{refundOrderNumber}), '%')

View File

@ -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<MechanismDto> 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);
}
}

View File

@ -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<Map<String, Object>> 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<Map<String, Object>> 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();
}
}

View File

@ -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<MechanismDto> mechanismDtos = mechanismService.dataList(status);
return AjaxResult.success(mechanismDtos);
}
}

View File

@ -35,8 +35,4 @@ public class XhpcCommunityPersonnel extends BaseEntity {
private Integer status;
private Integer delFlag;
/**
* 电站id
*/
private String chargingStationIds;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<String> 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);
}

View File

@ -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<String, Object> getLandUser(@Param("userId") Long userId);
/**
* 大客户组树列表
*
* @param name 桩名称
* @return
*/
List<Map<String, Object>> list(@Param("name") String name,@Param("operatorId") Long operatorId);
/**
* 查询大客户组
* @param customersId 大客户id
* @param name 名称
* @param type 1 表示已社区id进行查询 2 排查社区id查询
* @return
*/
Map<String, Object> 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<Map<String, Object>> customersPersonnelList(@Param("customersId")Long customersId,@Param("account")String account,@Param("phone")String phone,@Param("status")Integer status);
/**
* 查询大客户人员
* @return
*/
Map<String, Object> 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);
}

View File

@ -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<String> 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);
}

View File

@ -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);
}

View File

@ -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<Map<String, Object>> list(String name);
/**
* 新增大客户组树
*
* @param
* @return
*/
AjaxResult addCustomers(XhpcCustomers xhpcCustomers);
/**
* 删除大客户组树
*/
AjaxResult deleteCustomers(XhpcCustomers xhpcCustomers);
/**
* 查询大客户组
*
* @return
*/
Map<String, Object> getCustomersById(XhpcCustomers xhpcCustomers);
/**
* 编辑大客户组
*
* @param
* @return
*/
AjaxResult updateCustomers(XhpcCustomers xhpcCustomers);
/**
* 大客户人员列表
* @return
*/
List<Map<String, Object>> customersPersonnelList(Long customersId,String account,String phone,Integer status);
/**
* 新增社区人员
* @param
* @return
*/
AjaxResult addCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel);
/**
* 查询社区人员
*
* @return
*/
Map<String, Object> getCustomersPersonnelById(XhpcCustomersPersonnel xhpcCustomersPersonnel);
/**
* 编辑社区组树
*
* @param
* @return
*/
AjaxResult updateCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel);
/**
* 删除社区人员
*/
void deleteCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel);
/**
* 充值
*/
AjaxResult addRecharge(XhpcCustomersPersonnel xhpcCustomersPersonnel);
/**
* 社区人员状态改变
*/
void updateCustomersPersonnelStatus(XhpcCustomersPersonnel xhpcCustomersPersonnel);
}

View File

@ -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());
}
/**
* 地区树

View File

@ -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<String, Object> 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<String, Object> 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<String, Object> 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");
}
}

View File

@ -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<Map<String, Object>> list(String name) {
Long userId = SecurityUtils.getUserId();
List<Map<String, Object>> list =new ArrayList<>();
if(userId !=null){
Map<String, Object> 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<String, Object> communityById = xhpcCustomersMapper.getCustomersById(null, xhpcCustomers.getName(), null);
if(communityById !=null){
return AjaxResult.error("大客户组名称重复");
}
Long userId = SecurityUtils.getUserId();
if(userId !=null){
Map<String, Object> 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<String, Object> getCustomersById(XhpcCustomers xhpcCustomers) {
return xhpcCustomersMapper.getCustomersById(xhpcCustomers.getCustomersId(), null, 1);
}
@Override
public AjaxResult updateCustomers(XhpcCustomers xhpcCustomers) {
//名称重复不能入库
Map<String, Object> 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<Map<String, Object>> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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());
}
}

View File

@ -138,4 +138,8 @@
#{item},#{mechanismId},#{source}
</foreach>
</insert>
<insert id="addRechargeOrder">
INSERT INTO xhpc_recharge_order(user_id,recharge_order_number,amount,type,status,source,create_time) values (#{userId},#{orderNumber},#{amount},#{type},1,#{source},#{date})
</insert>
</mapper>

View File

@ -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 @@
<if test="name != null">name = #{name},</if>
<if test="account != null">account = #{account},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="rechargeMoney != null">recharge_money = #{rechargeMoney},</if>
<if test="surplusMoney != null">surplus_money = #{surplusMoney},</if>
<if test="type != null">type = #{type},</if>
<if test="status != null">address = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>

View File

@ -0,0 +1,385 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.user.mapper.XhpcCustomersMapper">
<resultMap type="com.xhpc.user.domain.XhpcCustomers" id="XhpcCustomersResult">
<result column="customers_id" property="customersId"/>
<result column="name" property="name"/>
<result column="service_preferential" property="servicePreferential"/>
<result column="contact_name" property="contactName"/>
<result column="contact_phone" property="contactPhone"/>
<result column="address" property="address"/>
<result column="parent_id" property="parentId"/>
<result column="type" property="type"/>
<result column="dimension" property="dimension"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/>
</resultMap>
<select id="getLandUser" resultType="map">
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
</select>
<select id="list" resultType="map">
select
customers_id as customersId,
name as name
from xhpc_customers
where del_flag =0
<if test="name !=null and name !=''">
and name like CONCAT('%',#{name},'%')
</if>
<if test="operatorId !=null">
and operator_id=#{operatorId}
</if>
</select>
<insert id="addCustomers" parameterType="com.xhpc.user.domain.XhpcCustomers" useGeneratedKeys="true" keyProperty="customersId">
insert into xhpc_customers
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != customersId">
customers_id,
</if>
<if test="null != name and '' != name">
name,
</if>
<if test="null != servicePreferential">
service_preferential,
</if>
<if test="null != contactName and '' != contactName">
contact_name,
</if>
<if test="null != contactPhone and '' != contactPhone">
contact_phone,
</if>
<if test="null != address and '' != address">
address,
</if>
<if test="null != dimension">
dimension,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != customersId">
#{customersId},
</if>
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != servicePreferential">
#{servicePreferential},
</if>
<if test="null != contactName and '' != contactName">
#{contactName},
</if>
<if test="null != contactPhone and '' != contactPhone">
#{contactPhone},
</if>
<if test="null != address and '' != address">
#{address},
</if>
<if test="null != dimension">
#{dimension},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
</trim>
</insert>
<update id="updateCustomers" parameterType="com.xhpc.user.domain.XhpcCustomers" useGeneratedKeys="true" keyProperty="customersId">
update xhpc_customers
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="servicePreferential != null">service_preferential = #{servicePreferential},</if>
<if test="contactName != null">contact_name = #{contactName},</if>
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
<if test="address != null">address = #{address},</if>
<if test="dimension != null">address = #{dimension},</if>
<if test="status != null">address = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where customers_id=#{customersId}
</update>
<update id="deleteCustomers">
update xhpc_customers set del_flag =1 where customers_id=#{customersId}
</update>
<select id="countCustomersPersonnel" resultType="java.lang.Integer">
select count(customers_personnel_id) from xhpc_customers_personnel where customers_id=#{customersId} and del_flag=0
</select>
<select id="getCustomersById" resultType="map">
select
co.customers_id as customersId,
co.name as name,
co.service_preferential as servicePreferential,
co.contact_name as contactName,
co.contact_phone as contactPhone,
co.address as address,
co.dimension as dimension,
co.status as status,
group_concat(me.charging_station_id) chargingStationIds
from xhpc_customers co
left join xhpc_mechanism me on me.mechanism_id = co.customers_id and me.source = 1 and me.del_flag =0
where 1=1
<if test="customersId !=null and type !=null and type==1">
and co.customers_id=#{customersId}
</if>
<if test="customersId !=null and type !=null and type==2">
and co.customers_id !=#{customersId}
</if>
<if test="name !=null">
and co.name =#{name}
</if>
limit 1
</select>
<select id="customersPersonnelList" resultType="map">
SELECT
customers_personnel_id AS customersPersonnelId,
name AS name,
customers_id AS customersId,
account AS account,
phone AS phone,
recharge_money AS rechargeMoney,
consume_money AS consumeMoney,
red_packet AS redPacket,
surplus_money AS surplusMoney,
type,
status
FROM
xhpc_customers_personnel
where customers_id=#{customersId} and del_flag=0
<if test="account !=null and account !=''">
and account like concat(concat('%', #{account}), '%')
</if>
<if test="phone !=null and phone !=''">
and phone like concat(concat('%', #{phone}), '%')
</if>
<if test="status !=null">
and status=#{status}
</if>
</select>
<insert id="addCustomersPersonnel" parameterType="com.xhpc.user.domain.XhpcCustomersPersonnel" useGeneratedKeys="true" keyProperty="customersPersonnelId">
insert into xhpc_customers_personnel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != customersPersonnelId">
customers_personnel_id,
</if>
<if test="null != customersId">
customers_id,
</if>
<if test="null != name and '' != name">
name,
</if>
<if test="null != account">
account,
</if>
<if test="null != rechargeMoney">
recharge_money,
</if>
<if test="null != consumeMoney">
consume_money,
</if>
<if test="null != redPacket">
red_packet,
</if>
<if test="null != surplusMoney">
surplus_money,
</if>
<if test="null != phone">
phone,
</if>
<if test="null != type">
type,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != customersPersonnelId">
#{customersPersonnelId},
</if>
<if test="null != customersId">
#{customersId},
</if>
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != account">
#{account},
</if>
<if test="null != rechargeMoney">
#{rechargeMoney},
</if>
<if test="null != consumeMoney">
#{consumeMoney},
</if>
<if test="null != redPacket">
#{redPacket},
</if>
<if test="null != surplusMoney">
#{surplusMoney},
</if>
<if test="null != phone">
#{phone},
</if>
<if test="null != type">
#{type},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
</trim>
</insert>
<select id="getCustomersPersonnelById" resultType="map">
select
customers_personnel_id AS customersPersonnelId,
name AS name,
customers_id AS customersId,
account AS account,
phone AS phone,
recharge_money AS rechargeMoney,
surplus_money AS surplusMoney,
type,
status
from xhpc_customers_personnel
where del_flag =0
<if test="customersPersonnelId !=null and type !=null and type==1">
and customers_personnel_id=#{customersPersonnelId}
</if>
<if test="type !=null and type==3">
and phone =#{phone} or account =#{account}
</if>
<if test="customersPersonnelId !=null and type !=null and type==2">
and customers_personnel_id !=#{customersPersonnelId}
and customers_personnel_id in ( select customers_personnel_id from xhpc_customers_personnel where phone =#{phone} or account =#{account} and del_flag =0)
</if>
limit 1
</select>
<update id="updateCustomersPersonnel">
update xhpc_customers_personnel
<trim prefix="SET" suffixOverrides=",">
<if test="customersId != null">customers_id = #{customersId},</if>
<if test="name != null">name = #{name},</if>
<if test="account != null">account = #{account},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="rechargeMoney != null">recharge_money = #{rechargeMoney},</if>
<if test="surplusMoney != null">surplus_money = #{surplusMoney},</if>
<if test="type != null">type = #{type},</if>
<if test="status != null">address = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where customers_personnel_id=#{customersPersonnelId}
</update>
<update id="deleteCustomersPersonnel">
update xhpc_customers_personnel set del_flag=1 where customers_personnel_id=#{customersPersonnelId}
</update>
<update id="updateCustomersPersonnelStatus">
update xhpc_customers_personnel set status=#{status} where customers_personnel_id=#{customersPersonnelId}
</update>
</mapper>