修改角色名称,统计增加机构统计
This commit is contained in:
parent
749bfd102c
commit
6055228c6b
@ -565,4 +565,7 @@ CREATE TABLE `xhpc_message_board_receive_user`
|
|||||||
DEFAULT CHARSET = utf8mb4 COMMENT ='用来保存每个租户后台显示的用户的信息列表';
|
DEFAULT CHARSET = utf8mb4 COMMENT ='用来保存每个租户后台显示的用户的信息列表';
|
||||||
|
|
||||||
ALTER TABLE `ry-cloud`.`t_iccard_info`
|
ALTER TABLE `ry-cloud`.`t_iccard_info`
|
||||||
ADD COLUMN `tenant_id` varchar(10) NOT NULL DEFAULT '000000' COMMENT '租户id' AFTER `createTime`;
|
ADD COLUMN `tenant_id` varchar(10) NOT NULL DEFAULT '000000' COMMENT '租户id' AFTER `createTime`;
|
||||||
|
|
||||||
|
ALTER TABLE `xhpc_statistics_station`
|
||||||
|
ADD COLUMN `source` INT(4) NULL COMMENT '订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)' AFTER `tenant_id`;
|
||||||
@ -960,6 +960,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId());
|
xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId());
|
||||||
xhpcSt.setChargingPileId(xhpc.getChargingPileId());
|
xhpcSt.setChargingPileId(xhpc.getChargingPileId());
|
||||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||||
|
xhpcSt.setSource(xhpc.getSource());
|
||||||
xhpcSt.setInternetDegreeCommission(xhpc.getInternetDegreeCommission());
|
xhpcSt.setInternetDegreeCommission(xhpc.getInternetDegreeCommission());
|
||||||
for (int i = type; i <4 ; i++) {
|
for (int i = type; i <4 ; i++) {
|
||||||
xhpcSt.setType(i);
|
xhpcSt.setType(i);
|
||||||
|
|||||||
@ -227,6 +227,24 @@ public class XhpcStatisticsController extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构统计
|
||||||
|
* @param chargingStationIds 电站id集合
|
||||||
|
* @param internetUserId 流量方id
|
||||||
|
* @param operatorId 运营商id
|
||||||
|
* @param startTime 订单开始时间
|
||||||
|
* @param endTime 订单结束时间
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param type 1 平台 2 运营商 3流量方
|
||||||
|
* @param source 订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getMechanismPage")
|
||||||
|
public TableDataInfo getMechanismPage(HttpServletRequest request,String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type,@RequestParam("source")Integer source)
|
||||||
|
{
|
||||||
|
List<Map<String, Object>> list = xhpcStatisticsService.getMechanismPage(request,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type,source);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
// -------- 导出数据 ------------
|
// -------- 导出数据 ------------
|
||||||
|
|
||||||
@ -320,4 +338,21 @@ public class XhpcStatisticsController extends BaseController {
|
|||||||
xhpcStatisticsService.terminalIntervalExport(request,response, chargingStationId,terminalId,operatorId,startTime,endTime,userId,type);
|
xhpcStatisticsService.terminalIntervalExport(request,response, chargingStationId,terminalId,operatorId,startTime,endTime,userId,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构导出
|
||||||
|
* @param chargingStationIds 电站id集合
|
||||||
|
* @param internetUserId 流量方id
|
||||||
|
* @param operatorId 运营商id
|
||||||
|
* @param startTime 订单开始时间
|
||||||
|
* @param endTime 订单结束时间
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param type 1 平台 2 运营商 3流量方
|
||||||
|
* @param source 订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getMechanismPage/export")
|
||||||
|
public void getMechanismExport(HttpServletRequest request,HttpServletResponse response,String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type,@RequestParam("source")Integer source)throws IOException
|
||||||
|
{
|
||||||
|
xhpcStatisticsService.getMechanismExport(request,response,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type,source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,4 +132,9 @@ public class XhpcStatisticsStation extends BaseEntity {
|
|||||||
* 租户id
|
* 租户id
|
||||||
*/
|
*/
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)
|
||||||
|
*/
|
||||||
|
private Integer source;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -128,6 +129,20 @@ public interface XhpcStatisticsServiceMapper {
|
|||||||
*/
|
*/
|
||||||
List<Map<String, Object>> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);
|
List<Map<String, Object>> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构统计
|
||||||
|
* @param chargingStationIds 电站id集合
|
||||||
|
* @param internetUserId 流量方id
|
||||||
|
* @param operatorId 运营商id
|
||||||
|
* @param startTime 订单开始时间
|
||||||
|
* @param endTime 订单结束时间
|
||||||
|
* @param type 1 平台 2 运营商 3流量方
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getMechanismPage(@Param("chargingStationIds") List<String> chargingStationIds, @Param("internetUserId") Long internetUserId, @Param("operatorId") Long operatorId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") Integer type, @Param("userId")Long userId, @Param("tenantId")String tenantId,@Param("source")Integer source);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加时段订单统计
|
* 添加时段订单统计
|
||||||
* @param xhpcStatisticsTimeInterval
|
* @param xhpcStatisticsTimeInterval
|
||||||
|
|||||||
@ -152,6 +152,23 @@ public interface IXhpcStatisticsService {
|
|||||||
*/
|
*/
|
||||||
List<Map<String, Object>> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds);
|
List<Map<String, Object>> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构统计
|
||||||
|
* @param chargingStationIds 电站id集合
|
||||||
|
* @param internetUserId 流量方id
|
||||||
|
* @param operatorId 运营商id
|
||||||
|
* @param startTime 订单开始时间
|
||||||
|
* @param endTime 订单结束时间
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param type 1 平台 2 运营商 3流量方
|
||||||
|
* @param source 订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getMechanismPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type,Integer source);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加时段订单统计
|
* 添加时段订单统计
|
||||||
* @param xhpcStatisticsTimeInterval
|
* @param xhpcStatisticsTimeInterval
|
||||||
@ -244,5 +261,5 @@ public interface IXhpcStatisticsService {
|
|||||||
*/
|
*/
|
||||||
void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException;
|
void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException;
|
||||||
|
|
||||||
|
void getMechanismExport(HttpServletRequest request,HttpServletResponse response,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type,Integer source) throws IOException ;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -428,6 +428,42 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
|||||||
return xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId);
|
return xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getMechanismPage(HttpServletRequest request, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type,Integer source) {
|
||||||
|
|
||||||
|
if (getJudge(internetUserId, operatorId, type)){
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<String> chargingStationId =new ArrayList<>();
|
||||||
|
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
|
||||||
|
chargingStationId= Arrays.asList(chargingStationIds.split(","));
|
||||||
|
}
|
||||||
|
//获取登陆用户
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
|
SysUser sysUser = loginUser.getSysUser();
|
||||||
|
String tenantId = loginUser.getTenantId();
|
||||||
|
Long sysUserId = sysUser.getUserId();
|
||||||
|
//获取登陆用户
|
||||||
|
List<Map<String, Object>> list =new ArrayList<>();
|
||||||
|
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
|
||||||
|
startPage();
|
||||||
|
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||||
|
Long logOperatorId = sysUser.getOperatorId();
|
||||||
|
//运营商看自己的场站
|
||||||
|
list = xhpcStatisticsServiceMapper.getMechanismPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId,source);
|
||||||
|
}else{
|
||||||
|
//查询赋值的场站
|
||||||
|
list = xhpcStatisticsServiceMapper.getMechanismPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId,source);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
startPage();
|
||||||
|
list =xhpcStatisticsServiceMapper.getMechanismPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId,source);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval) {
|
public void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval) {
|
||||||
xhpcStatisticsServiceMapper.addStatisticsTime(xhpcStatisticsTimeInterval);
|
xhpcStatisticsServiceMapper.addStatisticsTime(xhpcStatisticsTimeInterval);
|
||||||
@ -756,5 +792,48 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
|||||||
IoUtil.close(out);
|
IoUtil.close(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getMechanismExport(HttpServletRequest request, HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type, Integer source) throws IOException {
|
||||||
|
List<Map<String, Object>> list = getMechanismPage(request,chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type,source);
|
||||||
|
|
||||||
|
// 通过工具类创建writer,默认创建xls格式
|
||||||
|
ExcelWriter writer = ExcelUtil.getWriter(true);
|
||||||
|
writer.addHeaderAlias("internetUserName", "流量方名称");
|
||||||
|
writer.addHeaderAlias("chargingDegree", "电量");
|
||||||
|
writer.addHeaderAlias("chargingTime", "充电时长(小时)");
|
||||||
|
writer.addHeaderAlias("chargingNumber", "充电次数");
|
||||||
|
writer.addHeaderAlias("powerPrice", "电费");
|
||||||
|
writer.addHeaderAlias("servicePrice", "服务费");
|
||||||
|
writer.addHeaderAlias("totalPrice", "订单总价");
|
||||||
|
writer.addHeaderAlias("promotionDiscount", "抵扣的总金额");
|
||||||
|
writer.addHeaderAlias("actPrice", "用户支付金额");
|
||||||
|
writer.addHeaderAlias("actPowerPrice", "运营商电费");
|
||||||
|
writer.addHeaderAlias("actServicePrice", "运营商服务费");
|
||||||
|
writer.addHeaderAlias("internetCommission", "流量方总金额抽成");
|
||||||
|
writer.addHeaderAlias("internetSvcCommission", "流量方服务费抽成");
|
||||||
|
writer.addHeaderAlias("platformCommission", "平台总金额抽成");
|
||||||
|
writer.addHeaderAlias("platformSvcCommisssion", "平台服务费抽成");
|
||||||
|
writer.addHeaderAlias("operationCommission", "运维总金额抽成");
|
||||||
|
writer.addHeaderAlias("operationSvcCommission", "运维服务费抽成");
|
||||||
|
writer.addHeaderAlias("createTime", "日期");
|
||||||
|
|
||||||
|
// 默认的,未添加alias的属性也会写出,如果想只写出加了别名的字段,可以调用此方法排除之
|
||||||
|
writer.setOnlyAlias(true);
|
||||||
|
// 一次性写出内容,使用默认样式,强制输出标题
|
||||||
|
writer.write(list, true);
|
||||||
|
//out为OutputStream,需要写出到的目标流
|
||||||
|
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
|
||||||
|
ServletOutputStream out = response.getOutputStream();
|
||||||
|
|
||||||
|
writer.flush(out, true);
|
||||||
|
// 关闭writer,释放内存
|
||||||
|
writer.close();
|
||||||
|
//此处记得关闭输出Servlet流
|
||||||
|
IoUtil.close(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -420,6 +420,68 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getMechanismPage" resultType="map">
|
||||||
|
select
|
||||||
|
sum(charging_degree) chargingDegree,
|
||||||
|
sum(charging_time) chargingTime,
|
||||||
|
sum(charging_number) chargingNumber,
|
||||||
|
sum(power_price) powerPrice,
|
||||||
|
sum(service_price) servicePrice,
|
||||||
|
sum(total_price) totalPrice,
|
||||||
|
sum(act_price) actPrice,
|
||||||
|
sum(act_power_price) actPowerPrice,
|
||||||
|
sum(act_service_price) actServicePrice,
|
||||||
|
sum(promotion_discount) promotionDiscount,
|
||||||
|
sum(internet_commission) internetCommission,
|
||||||
|
sum(internet_svc_commission) internetSvcCommission,
|
||||||
|
sum(internet_degree_commission) internetDegreeCommission,
|
||||||
|
sum(platform_commission) platformCommission,
|
||||||
|
sum(platform_svc_commisssion) platformSvcCommisssion,
|
||||||
|
sum(operation_commission) operationCommission,
|
||||||
|
sum(operation_svc_commission) operationSvcCommission,
|
||||||
|
DATE_FORMAT(create_time,'%Y-%m-%d') createTime,
|
||||||
|
source as source,
|
||||||
|
CASE
|
||||||
|
WHEN source = 2 THEN
|
||||||
|
"社区用户"
|
||||||
|
WHEN source = 3 THEN
|
||||||
|
"B端用户"
|
||||||
|
ELSE
|
||||||
|
"未知用户"
|
||||||
|
END typeName
|
||||||
|
from xhpc_statistics_station
|
||||||
|
where del_flag=0 and type=2
|
||||||
|
<if test="source !=null">
|
||||||
|
and source=#{source}
|
||||||
|
</if>
|
||||||
|
<if test="source ==null">
|
||||||
|
and source in (2,3)
|
||||||
|
</if>
|
||||||
|
<if test="chargingStationIds !=null and chargingStationIds.size()>0">
|
||||||
|
and charging_station_id in
|
||||||
|
<foreach collection="chargingStationIds" open="(" item="chargingStationId" separator="," close=")" >
|
||||||
|
#{chargingStationId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="startTime !=null and startTime !=''">
|
||||||
|
and create_time >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime !=null and endTime !=''">
|
||||||
|
and create_time <= #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="type==1">
|
||||||
|
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
||||||
|
</if>
|
||||||
|
<if test="type==2">
|
||||||
|
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
||||||
|
</if>
|
||||||
|
<if test="tenantId !=null and tenantId !=''">
|
||||||
|
and tenant_id = #{tenantId}
|
||||||
|
</if>
|
||||||
|
group by DATE_FORMAT(create_time,'%Y-%m-%d')
|
||||||
|
order by DATE_FORMAT(create_time,'%Y-%m-%d') desc
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="addStatisticsTime">
|
<insert id="addStatisticsTime">
|
||||||
insert into xhpc_statistics_time_interval
|
insert into xhpc_statistics_time_interval
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@ -693,7 +755,10 @@
|
|||||||
charging_mode,
|
charging_mode,
|
||||||
</if>
|
</if>
|
||||||
<if test="null != internetDegreeCommission ">
|
<if test="null != internetDegreeCommission ">
|
||||||
internet_degree_commission
|
internet_degree_commission,
|
||||||
|
</if>
|
||||||
|
<if test="null != source ">
|
||||||
|
source,
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
@ -781,6 +846,9 @@
|
|||||||
<if test="null != internetDegreeCommission ">
|
<if test="null != internetDegreeCommission ">
|
||||||
#{internetDegreeCommission},
|
#{internetDegreeCommission},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="null != source ">
|
||||||
|
#{source},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class XhpcUserController extends BaseController {
|
|||||||
return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在");
|
return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在");
|
||||||
}
|
}
|
||||||
SysRole role = new SysRole();
|
SysRole role = new SysRole();
|
||||||
role.setRoleName(sysUser.getUserName());
|
role.setRoleName("平台用户");
|
||||||
role.setRoleKey(sysUser.getUserName());
|
role.setRoleKey(sysUser.getUserName());
|
||||||
role.setRoleSort("1");
|
role.setRoleSort("1");
|
||||||
iXhpcUserService.insertRole(role);
|
iXhpcUserService.insertRole(role);
|
||||||
@ -138,7 +138,7 @@ public class XhpcUserController extends BaseController {
|
|||||||
return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在");
|
return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在");
|
||||||
}
|
}
|
||||||
SysRole role = new SysRole();
|
SysRole role = new SysRole();
|
||||||
role.setRoleName(sysUser.getUserName());
|
role.setRoleName("运营商用户");
|
||||||
role.setRoleKey(sysUser.getUserName());
|
role.setRoleKey(sysUser.getUserName());
|
||||||
role.setRoleSort("1");
|
role.setRoleSort("1");
|
||||||
iXhpcUserService.insertRole(role);
|
iXhpcUserService.insertRole(role);
|
||||||
@ -237,9 +237,6 @@ public class XhpcUserController extends BaseController {
|
|||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void addXhpcDataDimension(Long[] menuIds,Long userId){
|
private void addXhpcDataDimension(Long[] menuIds,Long userId){
|
||||||
if(menuIds !=null){
|
if(menuIds !=null){
|
||||||
//添加数据维度
|
//添加数据维度
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user