Merge remote-tracking branch 'origin/master'
| | |
| | | private LocalDateTime createTime; |
| | | @TableField(exist = false) |
| | | private String avatar; |
| | | @TableField(exist = false) |
| | | private String name; |
| | | |
| | | |
| | | } |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Set; |
| | | |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | |
| | | public R<Partner> getPartnerById(Integer id) { |
| | | return R.fail("根据id获取合作商信息失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Set<Integer>> authSite(Integer partnerId, String siteMenu) { |
| | | return R.fail("获取合作商授权的站点数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @PostMapping("/partner/getPartnerById/{id}") |
| | | R<Partner> getPartnerById(@PathVariable("id") Integer id); |
| | | |
| | | |
| | | /** |
| | | * 获取合作商授权的站点数据 |
| | | * @param partnerId |
| | | * @param siteMenu |
| | | * @return |
| | | */ |
| | | @PostMapping("/partner/authSite/{partnerId}") |
| | | R<Set<Integer>> authSite(@PathVariable("partnerId") Integer partnerId, @RequestParam("siteMenu") String siteMenu); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(String orderId) { |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(String ids) { |
| | | return R.fail("根据订单编号s获取所有监测数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<List<UploadRealTimeMonitoringData>> getDataByOrderCode(String code) { |
| | |
| | | |
| | | @Override |
| | | public R<UploadRealTimeMonitoringPageData> getAll(MongoChargingOrderQuery mongoChargingOrderQuery) { |
| | | return null; |
| | | return R.fail("getAll:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | |
| | | /** |
| | | * 批量查询 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/uploadRealTimeMonitoringData/getOrderInfoByCodes") |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(@RequestParam("orderId") String orderId); |
| | | @GetMapping(value = "/uploadRealTimeMonitoringData/getOrderInfoByCodes/{ids}") |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(@PathVariable("ids") String ids); |
| | | /** |
| | | * 根据订单编号获取所有监测数据 |
| | | * @param code |
| | |
| | | @ApiModelProperty(value = "充电枪code ") |
| | | private String chargingGunCode; |
| | | @ApiModelProperty(value = "开始时间2020-01-01 00:00:00 - 2021-01-01 23:59:59") |
| | | private String startTime; |
| | | private String createTime; |
| | | @ApiModelProperty(value = "结束时间2020-01-01 00:00:00 - 2021-01-01 23:59:59") |
| | | private String endTime; |
| | | private String lastTime; |
| | | @ApiModelProperty(value = "订单来源 1明星 2快电 3新电途") |
| | | private Integer orderSource; |
| | | @ApiModelProperty(value = "用户ids 前端忽略") |
| | |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取32位大写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_32_upper(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).toUpperCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取32位小写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_32_lower(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).toLowerCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取16位大写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_16_upper(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).substring(8, 24).toUpperCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取16位小写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_16_lower(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).substring(8, 24).toLowerCase(); |
| | | return ""; |
| | | } |
| | | |
| | | } |
| | |
| | | for (TInviteUser record : page.getRecords()) { |
| | | TAppUser byId = appUserService.getById(record.getBeInvitedAppUserId()); |
| | | record.setAvatar(byId.getAvatar()); |
| | | record.setName(byId.getName()); |
| | | } |
| | | return R.ok(page); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.query.GetPartnerList; |
| | | import com.ruoyi.chargingPile.api.query.SetPermissionConfiguration; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ResetPassword; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | Partner partner = partnerService.getPartner(id); |
| | | return R.ok(partner); |
| | | } |
| | | |
| | | /** |
| | | * 获取合作商授权的站点数据 |
| | | * @param partnerId |
| | | * @param siteMenu |
| | | * @return |
| | | */ |
| | | @PostMapping("/authSite/{partnerId}") |
| | | public R<Set<Integer>> authSite(@PathVariable("partnerId") Integer partnerId, @RequestParam("siteMenu") String siteMenu){ |
| | | Set<Integer> integers = partnerService.authSite(partnerId, SiteMenu.valueOf(siteMenu)); |
| | | return R.ok(integers); |
| | | } |
| | | } |
| | |
| | | dto.setAuditStatus(1); |
| | | accountingStrategyService.updateById(dto); |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> detail.setAccountingStrategyId(dto.getId())); |
| | | dto.getAccountingStrategyDetails().forEach(detail -> { |
| | | detail.setAccountingStrategyId(dto.getId()); |
| | | detail.setId(null); |
| | | }); |
| | | accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); |
| | | }else { |
| | | Long userId = SecurityUtils.getLoginUser().getUserid(); |
| | |
| | | @ResponseBody |
| | | @GetMapping("/getRepairList") |
| | | @ApiOperation(value = "获取报修记录列表数据", tags = {"管理后台-设备监控"}) |
| | | public AjaxResult<PageInfo<TRepair>> getRepairList(String name, String siteId, BasePage basePage){ |
| | | public AjaxResult<PageInfo<TRepair>> getRepairList(String name, Integer siteId, BasePage basePage){ |
| | | PageInfo<TRepair> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | List<TRepair> repairList = repairService.getRepairList(pageInfo, name, siteId); |
| | | pageInfo.setRecords(repairList); |
| | |
| | | /** |
| | | * 获取故障信息列表 |
| | | * @param pageInfo |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, @Param("siteId") Integer siteId); |
| | | List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, @Param("siteIds") List<Integer> siteIds); |
| | | } |
| | |
| | | * 获取列表数据 |
| | | * @param pageInfo |
| | | * @param name |
| | | * @param siteId |
| | | * @param siteIds |
| | | * @return |
| | | */ |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, @Param("name") String name, @Param("siteId") String siteId); |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, @Param("name") String name, @Param("siteIds") List<Integer> siteIds); |
| | | |
| | | } |
| | |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, String siteId); |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, Integer siteId); |
| | | |
| | | /** |
| | | * 添加报修记录 |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TFaultMessageMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | @Override |
| | | public void add(TFaultMessage dto) { |
| | |
| | | */ |
| | | @Override |
| | | public List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, Integer siteId) { |
| | | return this.baseMapper.getFaultMessageList(pageInfo, siteId); |
| | | //校验合作商权限 |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == siteId || 0 == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | Set<Integer> data = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | siteIds = new ArrayList<>(data); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = data; |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(siteId); |
| | | } |
| | | return this.baseMapper.getFaultMessageList(pageInfo, siteIds); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TRepairMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TRepairService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取报修记录列表 |
| | | * @param name |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, String siteId) { |
| | | return this.baseMapper.getRepairList(pageInfo, name, siteId); |
| | | public List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, Integer siteId) { |
| | | //校验合作商权限 |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == siteId || 0 == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | Set<Integer> data = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | siteIds = new ArrayList<>(data); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = data; |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(siteId); |
| | | } |
| | | return this.baseMapper.getRepairList(pageInfo, name, siteIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | </if> |
| | | AND site_id IS NULL |
| | | AND (parent_id IS NULL OR audit_status = 1 OR audit_status = 2) |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | |
| | | left join t_charging_pile b on (a.charging_pile_id = b.id) |
| | | left join t_site c on (a.site_id = c.id) |
| | | where a.del_flag = 0 |
| | | <if test="null != siteId"> |
| | | and a.site_id = #{siteId} |
| | | <if test="null != siteIds and siteIds.size() > 0"> |
| | | and a.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" close=")" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | |
| | | <if test="null != name and '' != name"> |
| | | and a.repairman like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != siteId"> |
| | | and a.site_id = #{siteId} |
| | | <if test="null != siteIds and siteIds.size() > 0"> |
| | | and a.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | |
| | | |
| | | /** |
| | | * 批量查询 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getOrderInfoByCodes") |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(@RequestParam("orderId") String orderId){ |
| | | @GetMapping(value = "/getOrderInfoByCodes/{ids}") |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(@PathVariable("ids") String ids){ |
| | | List<UploadRealTimeMonitoringData> res = new ArrayList<>(); |
| | | for (String s : orderId.split(",")) { |
| | | for (String s : ids.split(",")) { |
| | | List<UploadRealTimeMonitoringData> dataByOrderCode = uploadRealTimeMonitoringDataService.getDataByOrderCode(s); |
| | | if(dataByOrderCode.size() > 0){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = dataByOrderCode.get(0); |
| | |
| | | List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, strategyId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list(); |
| | | |
| | | for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) { |
| | | if (byId.getVipDiscountAmount()!=null){ |
| | | if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ |
| | | BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setVipDiscount(multiply); |
| | | } |
| | | bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | |
| | | if (byId.getCouponDiscountAmount()!=null){ |
| | | if (byId.getCouponDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ |
| | | BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setCouponDiscount(multiply); |
| | |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | Map<String,Object> map = chargingOrderService.countAll(sixBefore); |
| | | BigDecimal data = parkingLotClient.getRecordAmount(sixBefore).getData(); |
| | | if (map ==null){ |
| | | map = new HashMap<String,Object>(); |
| | | } |
| | | map.put("parkingAmount",data); |
| | | BigDecimal data1 = shoppingOrderService.getSumAmount(sixBefore); |
| | | map.put("shopAmount",data1); |
| | |
| | | public R watchChargingOrder(@RequestBody MongoChargingOrderQuery mongoChargingOrderQuery) { |
| | | |
| | | mongoChargingOrderQuery.setPageSize(10); |
| | | UploadRealTimeMonitoringPageData data1 = uploadRealTimeMonitoringDataClient.getAll(mongoChargingOrderQuery).getData(); |
| | | R<UploadRealTimeMonitoringPageData> all = uploadRealTimeMonitoringDataClient.getAll(mongoChargingOrderQuery); |
| | | UploadRealTimeMonitoringPageData data1 = all.getData(); |
| | | |
| | | List<ChargingOrderAndUploadRealTimeMonitoringDataDto> dtos = new ArrayList<>(); |
| | | Map<String,ChargingOrderVO> map = new HashMap<>(); |
| | |
| | | |
| | | //车辆用途 |
| | | List<Map<String, Object>> carMap = chargingOrderService.carUserMethod(); |
| | | |
| | | //车辆品牌 |
| | | List<Map<String, Object>> carBrandMap = chargingOrderService.carUserBrand(); |
| | | List<String> brands = new ArrayList<>(); |
| | | for (Map<String, Object> objectMap : carBrandMap) { |
| | | brands.add(objectMap.get("vehicle_brand").toString()); |
| | | } |
| | | |
| | | Long count = chargingOrderService.countCar(brands); |
| | | Map<String, Object> others = new HashMap<>(); |
| | | others.put("vehicle_brand","其他"); |
| | | others.put("counts",count); |
| | | carBrandMap.add(others); |
| | | //本地车数量 |
| | | Map<String,Object> localCarMap = chargingOrderService.countLocalCar(); |
| | | |
| | |
| | | @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-设备运维分析"}) |
| | | public R<TCharingUserEquimentVO> equipment(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | List<Integer> siteIds =new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId()==null) { |
| | | if (statisticsQueryDto.getSiteId()==null||statisticsQueryDto.getSiteId()==0) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 19:07 |
| | |
| | | List<Map<String, Object>> needElec1(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | Long countNoTag(); |
| | | |
| | | Long countCar(@Param("brands") List<String> brands); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<GetOrderEvaluatePageListDTO> getPageList(@Param("query") GetOrderEvaluatePageList pageList, @Param("evaluationTagIds") List<Integer> evaluationTagIds, |
| | | PageInfo<GetOrderEvaluatePageListDTO> pageInfo); |
| | | @Param("siteIds") List<Integer> siteIds, PageInfo<GetOrderEvaluatePageListDTO> pageInfo); |
| | | |
| | | /** |
| | | * 查询站点下的所有订单评价 |
| | |
| | | * @return |
| | | */ |
| | | List<TChargingOrder> getChargingOrder(TChargingOrderVo order); |
| | | |
| | | Long countCar(List<String> brands); |
| | | } |
| | |
| | | myChargingOrderInfo.setChargeMode(chargingGun.getChargeMode()); |
| | | String name = chargingGunClient.getAllName(chargingOrder.getChargingGunId()).getData(); |
| | | myChargingOrderInfo.setName(name); |
| | | if(null != chargingOrder.getAppUserCarId()){ |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarByIds(Arrays.asList(chargingOrder.getAppUserCarId())).getData().get(0); |
| | | myChargingOrderInfo.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | | }else{ |
| | | myChargingOrderInfo.setLicensePlate("无"); |
| | | if(Objects.nonNull(chargingOrder.getAppUserCarId())){ |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarById(chargingOrder.getAppUserCarId().toString()).getData(); |
| | | if(null != tAppUserCar){ |
| | | myChargingOrderInfo.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | | }else{ |
| | | myChargingOrderInfo.setLicensePlate("无"); |
| | | } |
| | | } |
| | | myChargingOrderInfo.setStartTime(chargingOrder.getStartTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); |
| | | myChargingOrderInfo.setEndTime(chargingOrder.getEndTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); |
| | |
| | | if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ |
| | | return R.fail("退款金额需小于支付金额"); |
| | | } |
| | | if ((tChargingOrder.getRechargeAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ |
| | | tChargingOrder.setStatus(5); |
| | | } |
| | | |
| | | |
| | | TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); |
| | |
| | | if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ |
| | | return R.fail("退款金额需小于支付金额"); |
| | | } |
| | | if ((tChargingOrder.getPaymentAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ |
| | | tChargingOrder.setStatus(5); |
| | | } |
| | | |
| | | TShoppingOrderRefund chargingOrderRefund = new TShoppingOrderRefund(); |
| | | chargingOrderRefund.setShoppingOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | |
| | | tChargingOrder.setRefundStatus(2); |
| | | tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | | |
| | | if (payOrderQueryDto.getRefundAmount().compareTo(tChargingOrder.getPaymentAmount())==0){ |
| | | tChargingOrder.setStatus(5); |
| | | } |
| | | |
| | | shoppingOrderService.updateById(tChargingOrder); |
| | | |
| | | shoppingOrderRefundService.save(chargingOrderRefund); |
| | |
| | | if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ |
| | | return R.fail("退款金额需小于支付金额"); |
| | | } |
| | | |
| | | |
| | | TVipOrderRefund chargingOrderRefund = new TVipOrderRefund(); |
| | | chargingOrderRefund.setVipOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | |
| | | tSettlementConfirm.setRemark(dto.getRemark()); |
| | | tSettlementConfirm.setServicePartner(dto.getServicePartner()); |
| | | tSettlementConfirm.setServiceMoney(dto.getServiceMoney()); |
| | | BigDecimal subtract = new BigDecimal("1").subtract(dto.getProportionPartner()); |
| | | BigDecimal subtract = new BigDecimal("1").subtract(dto.getProportionPartner().multiply(new BigDecimal("0.01"))); |
| | | // 总电损费用 |
| | | BigDecimal divide = tSettlementConfirm.getProportionMoney().divide(subtract, 2, RoundingMode.HALF_DOWN); |
| | | // 平台承担电损 |
| | |
| | | } |
| | | // 充电总时长 |
| | | |
| | | Long temp = 0L; |
| | | Long temp = 1L; |
| | | if (StringUtils.hasLength(stringBuilder.toString())){ |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getOrderInfoByCodes(stringBuilder.substring(0,stringBuilder.length()-1)).getData(); |
| | | temp+=(data6.stream().mapToLong(UploadRealTimeMonitoringData::getCumulative_charging_time).sum()*60); |
| | | String substring = stringBuilder.substring(0, stringBuilder.length() - 1); |
| | | for (String s : substring.split(",")) { |
| | | UploadRealTimeMonitoringData data6 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(s).getData(); |
| | | if (data6!=null){ |
| | | temp+=(data6.getCumulative_charging_time()*60); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | List<TChargingPile> data = siteClient.getPileListBySiteId(tSettlementConfirm.getSiteId()).getData(); |
| | | // 计算充电桩的功率平均值 |
| | |
| | | if (tSettlementConfirm.getSiteId().equals(settlementConfirm.getSiteId())){ |
| | | // 电站相同比较收入涨幅跌幅 |
| | | if (tSettlementConfirm.getIncome().compareTo(BigDecimal.ZERO)>0){ |
| | | BigDecimal subtract = tSettlementConfirm.getIncome().subtract(settlementConfirm.getIncome()).divide(tSettlementConfirm.getIncome()).setScale(2, RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); |
| | | BigDecimal subtract = tSettlementConfirm.getIncome().subtract(settlementConfirm.getIncome()).divide(tSettlementConfirm.getIncome(),2, RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); |
| | | tSettlementConfirm.setIncomePercentage(subtract+"%"); |
| | | }else { |
| | | tSettlementConfirm.setIncomePercentage("100"+"%"); |
| | |
| | | } |
| | | return this.list(queryWrapper.orderByDesc(TChargingOrder::getCreateTime)); |
| | | } |
| | | |
| | | @Override |
| | | public Long countCar(List<String> brands) { |
| | | return this.baseMapper.countCar(brands); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.TEvaluationTagClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.other.api.feignClient.*; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.math.BigDecimal; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private PartnerClient partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | |
| | | |
| | |
| | | List<TEvaluationTagVO> data = evaluationTagClient.getTagList(pageList.getEvaluateType()).getData(); |
| | | evaluationTagIds = data.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList()); |
| | | } |
| | | List<GetOrderEvaluatePageListDTO> list = this.baseMapper.getPageList(pageList, evaluationTagIds, pageInfo); |
| | | |
| | | //校验合作商权限 |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == pageList.getSiteId() || 0 == pageList.getSiteId()){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | Set<Integer> data = partnerService.authSite(objectId, "/data/site").getData(); |
| | | siteIds = new ArrayList<>(data); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = data; |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(pageList.getSiteId()); |
| | | } |
| | | |
| | | List<GetOrderEvaluatePageListDTO> list = this.baseMapper.getPageList(pageList, evaluationTagIds, siteIds, pageInfo); |
| | | for (GetOrderEvaluatePageListDTO dto : list) { |
| | | TAppUser appUser = appUserClient.getUserById(dto.getAppUserId()).getData(); |
| | | if(null != appUser){ |
| | |
| | | String phone = appUser.getPhone(); |
| | | dto.setPhone(phone.substring(0, 3) + "****" + phone.substring(6)); |
| | | } |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(dto.getSiteId())).getData().get(0); |
| | | dto.setSiteName(site.getName()); |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(dto.getSiteId())).getData(); |
| | | if(null != data1 && data1.size() > 0){ |
| | | Site site = data1.get(0); |
| | | dto.setSiteName(site.getName()); |
| | | } |
| | | List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, dto.getId())); |
| | | List<Integer> tagIds = tOrderEvaluateTags.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList()); |
| | | if(tagIds.size() > 0){ |
| | |
| | | title, |
| | | `status`, |
| | | order_amount, |
| | | order_amount as payment_amount , |
| | | payment_amount as payment_amount , |
| | | create_time, |
| | | end_time, |
| | | pay_time, |
| | | refund_status, |
| | | (order_amount) as final_amount, |
| | | (recharge_amount-refund_amount) as final_amount, |
| | | del_flag, |
| | | app_user_id |
| | | FROM |
| | |
| | | |
| | | </select> |
| | | <select id="countAll" resultType="java.util.Map"> |
| | | select sum(electrovalence) as electrovalence,sum(service_charge) as service_charge,ROUND(sum(electrovalence+service_charge) * 0.0006, 2) as commission_amount,sum(sharing_amount) as sharing_amount |
| | | select sum(electrovalence) as electrovalence,sum(service_charge) as service_charge,ROUND(sum(electrovalence+service_charge) * 0.006, 2) as commission_amount,sum(sharing_amount) as sharing_amount |
| | | from t_charging_order |
| | | where create_time >= #{sixBefore} and del_flag = 0 and recharge_payment_status = 2 |
| | | </select> |
| | |
| | | <select id="getDateData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%H:00' ) as time, |
| | | CAST(SUM(service_charge-coupon_discount_amount) AS DECIMAL(20, 6)) as servicecharge, |
| | | CAST(SUM(service_charge) AS DECIMAL(20, 6)) as servicecharge, |
| | | CAST(SUM(charging_capacity) AS DECIMAL(20, 6)) as electrovalence, |
| | | CAST(SUM(electrovalence) AS DECIMAL(20, 4)) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | <select id="getWeekData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge-coupon_discount_amount) as servicecharge, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(charging_capacity) as electrovalence, |
| | | SUM(electrovalence) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | <select id="getMonthData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge-coupon_discount_amount) as servicecharge, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(charging_capacity) as electrovalence, |
| | | SUM(electrovalence) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | <select id="getYearData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge-coupon_discount_amount) as servicecharge, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(charging_capacity) as electrovalence, |
| | | SUM(electrovalence) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | <select id="getByDate" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge-coupon_discount_amount) as servicecharge, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(charging_capacity) as electrovalence, |
| | | SUM(electrovalence) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | SELECT |
| | | 'today' AS data_type, |
| | | '1' as type, |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS time, |
| | | DATE_FORMAT( create_time, '%H:00' ) AS time, |
| | | count(DISTINCT app_user_id) AS counts |
| | | FROM |
| | | t_charging_order |
| | | WHERE |
| | | del_flag = 0 |
| | | AND recharge_payment_status = 2 |
| | | AND ISNULL( refund_status ) |
| | | AND DATE ( create_time ) = CURDATE() |
| | | GROUP BY |
| | | time |
| | |
| | | `charging_pile_order`.`t_charging_order` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | WHERE co.del_flag = 0 and |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and tc.type = 4 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | |
| | | `charging_pile_order`.`t_charging_order` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | WHERE co.del_flag = 0 and |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and tc.type in (2,3) |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1 |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =1 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | ) and au.del_flag = 0 |
| | | |
| | | </select> |
| | | <select id="countCar" resultType="java.lang.Long"> |
| | | select count(1) |
| | | from |
| | | charging_pile_account.t_app_user_car |
| | | where del_flag = 0 and vehicle_brand not in |
| | | <foreach collection="brands" item="brand" open="(" separator="," close=")"> |
| | | #{brand} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="null != query.siteId"> |
| | | and b.site_id = #{query.siteId} |
| | | </if> |
| | | <if test="null != siteIds and siteIds.size() > 0"> |
| | | and b.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | | <select id="goodTop" resultType="java.util.Map"> |
| | |
| | | </select> |
| | | <select id="getSumAmout" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | SUM(payment_amount) AS paymentAmount |
| | | SUM(payment_amount-refund_amount) AS paymentAmount |
| | | FROM |
| | | t_vip_order |
| | | WHERE |