修改短信签名由小华充电改为翔桦充电

This commit is contained in:
2265829957@qq.com 2025-09-30 15:42:57 +08:00
parent d5f77307fb
commit 5be3ade7e8
72 changed files with 2606 additions and 413 deletions

View File

@ -19,5 +19,6 @@ public class PageRequest {
Integer pageNo = 1;
@JsonProperty(value = "PageSize", defaultValue = "10")
Integer pageSize = 10;
@JsonProperty("StationID")
String StationID = "";
}

File diff suppressed because one or more lines are too long

View File

@ -72,8 +72,8 @@ public class QueryPlaceholderRulesController {
PlaceholderRulesXinDianTu placeholderRulesXinDianTu = new PlaceholderRulesXinDianTu();
placeholderRulesXinDianTu.setStationID(stationId);
String startTime = DateUtil.format(xhpcPlacreholder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy-MM-dd HH:mm:ss");
String startTime = DateUtil.format(xhpcPlacreholder.getStartTime(), "yyyy.MM.dd HH:mm:ss");
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy.MM.dd HH:mm:ss");
placeholderRulesXinDianTu.setEffectStartTime(startTime);
placeholderRulesXinDianTu.setEffectEndTime(endTime);
placeholderRulesXinDianTu.setStatus(xhpcPlacreholder.getStatus());

View File

@ -198,6 +198,7 @@ public class QueryStationsInfoController {
String startTime = DateUtil.format(xhpcPlacreholder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy-MM-dd HH:mm:ss");
placeHolder.setEffectStartTime(DateUtil.parse(startTime,"yyyy-MM-dd HH:mm:ss"));
placeHolder.setEffectEndTime(DateUtil.parse(endTime,"yyyy-MM-dd HH:mm:ss"));
@ -209,6 +210,9 @@ public class QueryStationsInfoController {
PlaceHolderPrice placeHolderPrice = new PlaceHolderPrice();
placeHolderPrice.setStartTime(DateUtil.format(xhpcPlaceholderTimeOrder.getStartTime(),"HH:mm:ss"));
placeHolderPrice.setEndTime(DateUtil.format(xhpcPlaceholderTimeOrder.getEndTime(),"HH:mm:ss"));
if("00:00:00".equals(placeHolderPrice.getEndTime())){
placeHolderPrice.setEndTime("23:59:59");
}
placeHolderPrice.setPrice(xhpcPlaceholderTimeOrder.getPrice());
placeHolderPrices.add(placeHolderPrice);
}
@ -241,23 +245,39 @@ public class QueryStationsInfoController {
Long internetUserId = xhpcInternetUser.getInternetUserId();
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =
xhpcStationInternetBlacklistRepo.findByInternetUserId(internetUserId);
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
List<String> validStationKeys = new ArrayList<>();
for (String stationKey : stationKeys) {
boolean isValid = true;
if(pageRequest.getStationID() !=null && !"".equals(pageRequest.getStationID())){
//查询不合作的电桩
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
isValid = false;
if (!pageRequest.getStationID().equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
ChargingStationDto chargingStationDto = REDIS.getCacheObject("station:"+pageRequest.getStationID());
if (chargingStationDto.getPiles() != null) {
validStationKeys.add("station:"+pageRequest.getStationID());
break;
}
}
}
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
if (chargingStationDto.getPiles() != null) {
if (isValid) {
validStationKeys.add(stationKey);
}else{
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
for (String stationKey : stationKeys) {
boolean isValid = true;
//查询不合作的电桩
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
isValid = false;
}
}
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
if (chargingStationDto.getPiles() != null) {
if (isValid) {
validStationKeys.add(stationKey);
}
}
}
}
if (validStationKeys.size() > 0) {
Integer pageSize = pageRequest.getPageSize();
int totalPage = validStationKeys.size() % pageSize == 0 ? validStationKeys.size() / pageSize :

View File

@ -28,6 +28,12 @@ public interface PlaceholderIOrderRepository extends JpaRepository<XhpcPlacehold
List<XhpcPlaceholderOrder> findTop100ByOperatorIdEvcsAndTypeAndConfirmResultOrderByPlaceholderOrderIdAsc(String OperatorIdEvcs,int type,int confirmResult);
XhpcPlaceholderOrder findByPlaceholderOrderIdAndOperatorIdEvcsAndConfirmResultOrderByPlaceholderOrderIdAsc(Long placeholderOrderId,String OperatorIdEvcs,int confirmResult);
XhpcPlaceholderOrder findByPlaceholderOrderIdAndOperatorIdEvcsAndTypeAndConfirmResultOrderByPlaceholderOrderIdAsc(Long placeholderOrderId,String OperatorIdEvcs,int type,int confirmResult);
XhpcPlaceholderOrder findByPlaceholderOrderId(Long placeholderOrderId);
XhpcPlaceholderOrder findByPlaceholderOrderNumber(String placeholderOrderNumber);

View File

@ -16,6 +16,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.math.BigDecimal;
@ -31,6 +34,8 @@ import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
* @Date 2025-07-09 14:06
*/
@Component
@RestController
@RequestMapping("/overtimeOrderInfoTask")
public class NotificationOvertimeOrderInfoTask extends CoreDispatcher {
@Autowired
@ -43,7 +48,7 @@ public class NotificationOvertimeOrderInfoTask extends CoreDispatcher {
private final Logger logger = LoggerFactory.getLogger(NotificationOvertimeOrderInfoTask.class);
//9009开放定时任务 9099不开放
//@Scheduled(fixedRate = 1000 * 30)
@Scheduled(fixedRate = 1000 * 30)
public void run() throws IOException {
AuthSecretToken authSecretTokenOut =
@ -110,31 +115,140 @@ public class NotificationOvertimeOrderInfoTask extends CoreDispatcher {
List<XhpcPlaceholderTimeOrder> list = placeholderIOrderTimeRepository.findByPlaceholderOrderIdAndDelFlag(placeholderOrder.getPlaceholderOrderId(), 0);
List<OvertimeDetail> overtimeDetails =new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
XhpcPlaceholderTimeOrder xhpcPlaceholderTimeOrder = list.get(i);
if(placeholderOrder.getTotalMoney().compareTo(new BigDecimal(0.00))==0){
List<OvertimeDetail> overtimeDetails =new ArrayList<>();
OvertimeDetail overtimeDetail = new OvertimeDetail();
overtimeDetail.setDetailStartTime(DateUtil.format(xhpcPlaceholderTimeOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailEndTime(DateUtil.format(xhpcPlaceholderTimeOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailMoney(xhpcPlaceholderTimeOrder.getTotalmoney());
overtimeDetail.setOvertimePrice(xhpcPlaceholderTimeOrder.getPrice());
overtimeDetail.setDetailStartTime(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailEndTime(DateUtil.format(placeholderOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailMoney(placeholderOrder.getTotalMoney());
overtimeDetail.setOvertimePrice(new BigDecimal(0.2));
overtimeDetails.add(overtimeDetail);
placeholderOrderInfo.setOvertimeDetails(overtimeDetails);
}else{
List<OvertimeDetail> overtimeDetails =new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
XhpcPlaceholderTimeOrder xhpcPlaceholderTimeOrder = list.get(i);
OvertimeDetail overtimeDetail = new OvertimeDetail();
overtimeDetail.setDetailStartTime(DateUtil.format(xhpcPlaceholderTimeOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailEndTime(DateUtil.format(xhpcPlaceholderTimeOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailMoney(xhpcPlaceholderTimeOrder.getTotalmoney());
overtimeDetail.setOvertimePrice(xhpcPlaceholderTimeOrder.getPrice());
overtimeDetails.add(overtimeDetail);
}
placeholderOrderInfo.setOvertimeDetails(overtimeDetails);
}
placeholderOrderInfo.setOvertimeDetails(overtimeDetails);
final OvertimeOrderInfo pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
if (pushResp != null) {
placeholderOrder.setConfirmResult(pushResp.getSuccStat());
placeholderOrder.setStatus(3);
//logger.info("==============推送返回值================="+pushResp.toString());
placeholderIOrderRepository.save(placeholderOrder);
} else {
logger.error("快电3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
logger.error("快电3dp[{}] order[{}/{}] push fail", "MA005DBW1",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
}
}
}
}
@PostMapping("/v1/getXhpcPlaceholderOrder")
public void getXhpcPlaceholderOrder(Long placeholderOrderId) throws IOException {
AuthSecretToken authSecretTokenOut =
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
"MA005DBW1", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
if (authSecretTokenOut != null) {
final XhpcPlaceholderOrder placeholderOrder=placeholderIOrderRepository.findByPlaceholderOrderId(placeholderOrderId);
if(placeholderOrder.getConfirmResult()==-2){
PlaceholderOrderInfoKuaiDian placeholderOrderInfo = new PlaceholderOrderInfoKuaiDian();
placeholderOrderInfo.setOvertimeBillCode(placeholderOrder.getPlaceholderOrderNumber());
placeholderOrderInfo.setStartChargeSeq(placeholderOrder.getInternetSerialNumber());
placeholderOrderInfo.setOvertimeBillStatus(1);
placeholderOrderInfo.setConnectorId(placeholderOrder.getTerminalNumber());
placeholderOrderInfo.setBillEquipment(1);
placeholderOrderInfo.setStartTime(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
placeholderOrderInfo.setEndTime(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
placeholderOrderInfo.setTotalTimeSpan(0);
placeholderOrderInfo.setOvertimePrice(new BigDecimal(0));
placeholderOrderInfo.setTotalMoney(new BigDecimal(0.00));
List<OvertimeDetail> overtimeDetails =new ArrayList<>();
OvertimeDetail overtimeDetail = new OvertimeDetail();
overtimeDetail.setDetailStartTime(placeholderOrderInfo.getStartTime());
overtimeDetail.setDetailEndTime(placeholderOrderInfo.getStartTime());
overtimeDetail.setDetailMoney(new BigDecimal(0.00));
overtimeDetail.setOvertimePrice(new BigDecimal(0.00));
overtimeDetails.add(overtimeDetail);
placeholderOrderInfo.setOvertimeDetails(overtimeDetails);
final OvertimeOrderInfo pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
if (pushResp != null) {
if(pushResp.getSuccStat()==0){
placeholderOrder.setConfirmResult(-1);
}else{
placeholderOrder.setConfirmResult(pushResp.getSuccStat());
}
//logger.info("==============推送返回值================="+pushResp.toString());
placeholderIOrderRepository.save(placeholderOrder);
} else {
logger.error("新电途3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
}
}else if(placeholderOrder.getConfirmResult()==-1){
PlaceholderOrderInfoKuaiDian placeholderOrderInfo = new PlaceholderOrderInfoKuaiDian();
placeholderOrderInfo.setOvertimeBillCode(placeholderOrder.getPlaceholderOrderNumber());
placeholderOrderInfo.setStartChargeSeq(placeholderOrder.getInternetSerialNumber());
placeholderOrderInfo.setOvertimeBillStatus(3);
placeholderOrderInfo.setConnectorId(placeholderOrder.getTerminalNumber());
placeholderOrderInfo.setConnectorId(placeholderOrder.getTerminalNumber());
placeholderOrderInfo.setBillEquipment(1);
placeholderOrderInfo.setConnectorId(placeholderOrder.getTerminalNumber());
placeholderOrderInfo.setStartTime(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
placeholderOrderInfo.setEndTime(DateUtil.format(placeholderOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
placeholderOrderInfo.setTotalTimeSpan(placeholderOrder.getTotalTimeSpan());
placeholderOrderInfo.setOvertimePrice(placeholderOrder.getOvertimePrice());
placeholderOrderInfo.setTotalMoney(placeholderOrder.getTotalMoney());
if(placeholderOrder.getTotalMoney().compareTo(new BigDecimal(0.00))==0){
List<OvertimeDetail> overtimeDetails =new ArrayList<>();
OvertimeDetail overtimeDetail = new OvertimeDetail();
overtimeDetail.setDetailStartTime(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailEndTime(DateUtil.format(placeholderOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailMoney(placeholderOrder.getTotalMoney());
overtimeDetail.setOvertimePrice(new BigDecimal(0.2));
overtimeDetails.add(overtimeDetail);
placeholderOrderInfo.setOvertimeDetails(overtimeDetails);
}else{
List<XhpcPlaceholderTimeOrder> list = placeholderIOrderTimeRepository.findByPlaceholderOrderIdAndDelFlag(placeholderOrder.getPlaceholderOrderId(), 0);
List<OvertimeDetail> overtimeDetails =new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
XhpcPlaceholderTimeOrder xhpcPlaceholderTimeOrder = list.get(i);
OvertimeDetail overtimeDetail = new OvertimeDetail();
overtimeDetail.setDetailStartTime(DateUtil.format(xhpcPlaceholderTimeOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailEndTime(DateUtil.format(xhpcPlaceholderTimeOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
overtimeDetail.setDetailMoney(xhpcPlaceholderTimeOrder.getTotalmoney());
overtimeDetail.setOvertimePrice(xhpcPlaceholderTimeOrder.getPrice());
overtimeDetails.add(overtimeDetail);
}
placeholderOrderInfo.setOvertimeDetails(overtimeDetails);
}
final OvertimeOrderInfo pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
if (pushResp != null) {
placeholderOrder.setConfirmResult(pushResp.getSuccStat());
placeholderOrder.setStatus(3);
//logger.info("==============推送返回值================="+pushResp.toString());
placeholderIOrderRepository.save(placeholderOrder);
} else {
logger.error("快电3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
}
}
}
}
public OvertimeOrderInfo notify(PlaceholderOrderInfoKuaiDian placeholderOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {

View File

@ -40,93 +40,104 @@ public class NotificationStationInfoKuaiDianTask extends CoreDispatcher {
//9009开放定时任务 9099不开放
@Scheduled(cron = "0 50 0 1/1 * ? ")
//@Scheduled(cron = "0 0 0 1/1 * ? ")
public void run() throws IOException {
try{
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(1L);
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
AuthSecretToken authSecretTokenOut =
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA005DBW1", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
List<String> validStationKeys = new ArrayList<>();
for (String stationKey : stationKeys) {
boolean isValid = true;
//查询不合作的电桩
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
if (!stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
// maybe对接第三方
if (authSecretTokenOut != null) {
String chargingStationId = stationKey.substring(8);
//获取场站信息
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
cdStationInfo.setEquipmentInfos(new ArrayList<>());
//查询场站是桩是否对应上
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + stationDto.getRateModelId());
StringBuilder price = new StringBuilder();
StringBuilder svcPrice = new StringBuilder();
Integer t1Price = cacheRateModel.getT1Price();
Integer t1SvcPrice = cacheRateModel.getT1SvcPrice();
Integer t2Price = cacheRateModel.getT2Price();
Integer t2SvcPrice = cacheRateModel.getT2SvcPrice();
Integer t3Price = cacheRateModel.getT3Price();
Integer t3SvcPrice = cacheRateModel.getT3SvcPrice();
Integer t4Price = cacheRateModel.getT4Price();
Integer t4SvcPrice = cacheRateModel.getT4SvcPrice();
if(cacheRateModel.getTfPricesSeq() !=null && cacheRateModel.getTfPricesSeq().length>0){
price.append("{");
svcPrice.append("{");
for (int i = 0; i < cacheRateModel.getTfPricesSeq().length; i++) {
String time = getTime(i);
String s = cacheRateModel.getTfPricesSeq()[i];
if("00".equals(s)){
price.append(time).append(t1Price.toString()).append(",");
svcPrice.append(time).append(t1SvcPrice.toString()).append(",");
}else if("01".equals(s)){
price.append(time).append(t2Price.toString()).append(",");
svcPrice.append(time).append(t2SvcPrice.toString()).append(",");
}else if("02".equals(s)){
price.append(time).append(t3Price.toString()).append(",");
svcPrice.append(time).append(t3SvcPrice.toString()).append(",");
}else{
price.append(time).append(t4Price.toString()).append(",");
svcPrice.append(time).append(t4SvcPrice.toString()).append(",");
}
}
price.deleteCharAt(price.length()-1).append("}");
svcPrice.deleteCharAt(svcPrice.length()-1).append("}");
}
cdStationInfo.setElectricityFee(price.toString());
cdStationInfo.setServiceFee(svcPrice.toString());
Set<String> pks = stationDto.getPiles();
if (pks != null) {
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
for (String pileNo : pks) {
String pk = "pile:".concat(pileNo);
String skey = "cdjgpc:".concat(pk)+".notification";
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
if(cdEquipmentInfo==null || "".equals(cdEquipmentInfo.getEquipmentID())){
logger.info("该场站下面:"+pileNo+"桩未录入");
}else{
cdEquipmentInfos.add(cdEquipmentInfo);
}
}
cdStationInfo.setEquipmentInfos(cdEquipmentInfos);
}
cdStationInfo.setSwapMatchCarsName(null);
CommonRequest<CDStationInfo> commonRequest = new CommonRequest<>();
Map<String,Object> mapStationInfo =new HashMap<>();
mapStationInfo.put("StationInfo",cdStationInfo);
String data = JSONUtil.toJSONString(mapStationInfo);
System.out.println("===新电途====data========"+data);
commonRequest.setData(data);
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
System.out.println("===新电途==推送充电站信息==result========"+result);
}
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
isValid = false;
}
}
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
if (chargingStationDto.getPiles() != null) {
if (isValid) {
validStationKeys.add(stationKey);
}
}
}
for (String stationKey : validStationKeys) {
// maybe对接第三方
if (authSecretTokenOut != null) {
String chargingStationId = stationKey.substring(8);
//获取场站信息
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
cdStationInfo.setEquipmentInfos(new ArrayList<>());
//查询场站是桩是否对应上
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + stationDto.getRateModelId());
StringBuilder price = new StringBuilder();
StringBuilder svcPrice = new StringBuilder();
Integer t1Price = cacheRateModel.getT1Price();
Integer t1SvcPrice = cacheRateModel.getT1SvcPrice();
Integer t2Price = cacheRateModel.getT2Price();
Integer t2SvcPrice = cacheRateModel.getT2SvcPrice();
Integer t3Price = cacheRateModel.getT3Price();
Integer t3SvcPrice = cacheRateModel.getT3SvcPrice();
Integer t4Price = cacheRateModel.getT4Price();
Integer t4SvcPrice = cacheRateModel.getT4SvcPrice();
if(cacheRateModel.getTfPricesSeq() !=null && cacheRateModel.getTfPricesSeq().length>0){
price.append("{");
svcPrice.append("{");
for (int i = 0; i < cacheRateModel.getTfPricesSeq().length; i++) {
String time = getTime(i);
String s = cacheRateModel.getTfPricesSeq()[i];
if("00".equals(s)){
price.append(time).append(t1Price.toString()).append(",");
svcPrice.append(time).append(t1SvcPrice.toString()).append(",");
}else if("01".equals(s)){
price.append(time).append(t2Price.toString()).append(",");
svcPrice.append(time).append(t2SvcPrice.toString()).append(",");
}else if("02".equals(s)){
price.append(time).append(t3Price.toString()).append(",");
svcPrice.append(time).append(t3SvcPrice.toString()).append(",");
}else{
price.append(time).append(t4Price.toString()).append(",");
svcPrice.append(time).append(t4SvcPrice.toString()).append(",");
}
}
price.deleteCharAt(price.length()-1).append("}");
svcPrice.deleteCharAt(svcPrice.length()-1).append("}");
}
cdStationInfo.setElectricityFee(price.toString());
cdStationInfo.setServiceFee(svcPrice.toString());
Set<String> pks = stationDto.getPiles();
if (pks != null) {
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
for (String pileNo : pks) {
String pk = "pile:".concat(pileNo);
String skey = "cdjgpc:".concat(pk)+".notification";
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
if(cdEquipmentInfo==null || "".equals(cdEquipmentInfo.getEquipmentID())){
logger.info("该场站下面:"+pileNo+"桩未录入");
}else{
cdEquipmentInfos.add(cdEquipmentInfo);
}
}
cdStationInfo.setEquipmentInfos(cdEquipmentInfos);
}
cdStationInfo.setSwapMatchCarsName(null);
CommonRequest<CDStationInfo> commonRequest = new CommonRequest<>();
Map<String,Object> mapStationInfo =new HashMap<>();
mapStationInfo.put("StationInfo",cdStationInfo);
String data = JSONUtil.toJSONString(mapStationInfo);
System.out.println("===新电途====data========"+data);
commonRequest.setData(data);
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
System.out.println("===新电途==推送充电站信息==result========"+result);
}
}
}catch (Exception e){
e.printStackTrace();

View File

@ -14,6 +14,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;
@ -27,6 +30,8 @@ import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
* @Date 2025-07-08 14:31
*/
@Component
@RestController
@RequestMapping("/placeholderOrderInfoTask")
public class NotificationPlaceholderOrderInfoTask extends CoreDispatcher {
@ -45,7 +50,6 @@ public class NotificationPlaceholderOrderInfoTask extends CoreDispatcher {
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
"MA25CNM38", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
if (authSecretTokenOut != null) {
final List<XhpcPlaceholderOrder> notYetPushOrder =placeholderIOrderRepository.findTop100ByOperatorIdEvcsAndConfirmResultOrderByPlaceholderOrderIdAsc("MA25CNM38",-2);
for (XhpcPlaceholderOrder placeholderOrder : notYetPushOrder) {
@ -93,6 +97,7 @@ public class NotificationPlaceholderOrderInfoTask extends CoreDispatcher {
final ChargeOrderInfoResponse pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
if (pushResp != null) {
placeholderOrder.setStatus(9);
placeholderOrder.setConfirmResult(pushResp.getConfirmResult());
logger.debug("新电途3rd part order {} push result: {}", placeholderOrder.getSerialNumber(),pushResp.getConfirmResult());
//logger.info("==============推送返回值================="+pushResp.toString());
@ -104,6 +109,66 @@ public class NotificationPlaceholderOrderInfoTask extends CoreDispatcher {
}
}
@PostMapping("/v1/getNotificationPlaceholderOrderInfo")
public void getNotificationPlaceholderOrderInfo(Long placeholderOrderId) throws IOException {
AuthSecretToken authSecretTokenOut =
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
"MA25CNM38", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
logger.info("===========placeholderOrderId=========="+placeholderOrderId);
if (authSecretTokenOut != null) {
final XhpcPlaceholderOrder placeholderOrder=placeholderIOrderRepository.findByPlaceholderOrderId(placeholderOrderId);
if(placeholderOrder.getConfirmResult()==-2){
PlaceholderOrderInfo placeholderOrderInfo = new PlaceholderOrderInfo();
placeholderOrderInfo.setPlaceholderOrderID(placeholderOrder.getPlaceholderOrderNumber());
placeholderOrderInfo.setStarChargeSeq(placeholderOrder.getInternetSerialNumber());
placeholderOrderInfo.setTimeStart(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
placeholderOrderInfo.setTimeEnd(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
placeholderOrderInfo.setHoldTime(0);
placeholderOrderInfo.setActuallyPay(0.0);
placeholderOrderInfo.setBillEquipment(1);
placeholderOrderInfo.setStatus(1);
final ChargeOrderInfoResponse pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
if (pushResp != null) {
if(pushResp.getConfirmResult()==0){
placeholderOrder.setConfirmResult(-1);
}else{
placeholderOrder.setConfirmResult(pushResp.getConfirmResult());
}
logger.debug("新电途3rd part order {} push result: {}", placeholderOrder.getSerialNumber(),pushResp.getConfirmResult());
//logger.info("==============推送返回值================="+pushResp.toString());
placeholderIOrderRepository.save(placeholderOrder);
} else {
logger.error("新电途3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
}
}else if(placeholderOrder.getConfirmResult()==-1){
PlaceholderOrderInfo placeholderOrderInfo = new PlaceholderOrderInfo();
placeholderOrderInfo.setPlaceholderOrderID(placeholderOrder.getPlaceholderOrderNumber());
placeholderOrderInfo.setStarChargeSeq(placeholderOrder.getInternetSerialNumber());
placeholderOrderInfo.setTimeStart(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
placeholderOrderInfo.setTimeEnd(DateUtil.format(placeholderOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
placeholderOrderInfo.setHoldTime(placeholderOrder.getTotalTimeSpan());
placeholderOrderInfo.setActuallyPay(placeholderOrder.getTotalMoney().doubleValue());
placeholderOrderInfo.setBillEquipment(1);
placeholderOrderInfo.setStatus(9);
final ChargeOrderInfoResponse pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
if (pushResp != null) {
placeholderOrder.setConfirmResult(pushResp.getConfirmResult());
logger.debug("新电途3rd part order {} push result: {}", placeholderOrder.getSerialNumber(),pushResp.getConfirmResult());
//logger.info("==============推送返回值================="+pushResp.toString());
placeholderIOrderRepository.save(placeholderOrder);
} else {
logger.error("新电途3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
}
}
}
}
public ChargeOrderInfoResponse notify(PlaceholderOrderInfo placeholderOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {

View File

@ -2,6 +2,7 @@ package com.xhpc.evcs.notification.xindiantu;
import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.domain.PriceInfo;
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
@ -16,6 +17,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException;
@ -30,6 +34,8 @@ import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
* @Date 2025-08-06 15:30
*/
@Component
@RestController
@RequestMapping("/notificationPlaceholderRulesTask")
public class NotificationPlaceholderRulesTask extends CoreDispatcher {
@Resource
@ -43,17 +49,33 @@ public class NotificationPlaceholderRulesTask extends CoreDispatcher {
private final Logger logger = LoggerFactory.getLogger(NotificationPlaceholderRulesTask.class);
//9009开放定时任务 9099不开放
//@Scheduled(cron = "0 0 3 1/1 * ? ")
@Scheduled(cron = "0 0 3 1/1 * ? ")
@PostMapping("/v1/run")
public void run() throws IOException {
AuthSecretToken authSecretTokenOut =
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA25CNM38", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(1L);
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
List<String> validStationKeys = new ArrayList<>();
for (String stationKey : stationKeys) {
boolean isValid = true;
//查询不合作的电桩
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
if (!stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
isValid = false;
}
}
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
if (chargingStationDto.getPiles() != null) {
if (isValid) {
validStationKeys.add(stationKey);
}
}
}
for (String stationKey : validStationKeys) {
if (authSecretTokenOut != null) {
String stationId = stationKey.substring(8);
XhpcPlacreholder xhpcPlacreholder = placeholderIRepository.findByChargingStationIdAndDelFlag(Long.valueOf(stationId), 0);
@ -61,8 +83,8 @@ public class NotificationPlaceholderRulesTask extends CoreDispatcher {
PlaceholderRulesXinDianTu placeholderRulesXinDianTu = new PlaceholderRulesXinDianTu();
placeholderRulesXinDianTu.setStationID(stationId);
String startTime = DateUtil.format(xhpcPlacreholder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy-MM-dd HH:mm:ss");
String startTime = DateUtil.format(xhpcPlacreholder.getStartTime(), "yyyy.MM.dd HH:mm:ss");
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy.MM.dd HH:mm:ss");
placeholderRulesXinDianTu.setEffectStartTime(startTime);
placeholderRulesXinDianTu.setEffectEndTime(endTime);
placeholderRulesXinDianTu.setStatus(xhpcPlacreholder.getStatus());
@ -84,8 +106,6 @@ public class NotificationPlaceholderRulesTask extends CoreDispatcher {
notify(placeholderRulesXinDianTu,authSecretTokenOut);
}
}
}
}
}
@ -93,6 +113,7 @@ public class NotificationPlaceholderRulesTask extends CoreDispatcher {
public void notify(PlaceholderRulesXinDianTu placeholderRulesXinDianTu, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
String data = JSONUtil.toJSONString(placeholderRulesXinDianTu);
logger.error("新电途========placeholderRulesXinDianTu================"+data);
CommonRequest<PlaceholderRulesXinDianTu> commonRequest = new CommonRequest<>();
commonRequest.setData(data);
String responseBody = ok(commonRequest, "/notification_placeholder_rules", authSecretTokenOut);

View File

@ -40,93 +40,105 @@ public class NotificationStationInfoXinDianTuTask extends CoreDispatcher {
//9009开放定时任务 9099不开放
@Scheduled(cron = "0 40 0 1/1 * ? ")
//@Scheduled(cron = "0 1 0 1/1 * ? ")
public void run() throws IOException {
try{
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(3L);
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
AuthSecretToken authSecretTokenOut =
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA25CNM38", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
List<String> validStationKeys = new ArrayList<>();
for (String stationKey : stationKeys) {
boolean isValid = true;
//查询不合作的电桩
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
if (!stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
// maybe对接第三方
if (authSecretTokenOut != null) {
String chargingStationId = stationKey.substring(8);
//获取场站信息
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
cdStationInfo.setEquipmentInfos(new ArrayList<>());
//查询场站是桩是否对应上
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + stationDto.getRateModelId());
StringBuilder price = new StringBuilder();
StringBuilder svcPrice = new StringBuilder();
Integer t1Price = cacheRateModel.getT1Price();
Integer t1SvcPrice = cacheRateModel.getT1SvcPrice();
Integer t2Price = cacheRateModel.getT2Price();
Integer t2SvcPrice = cacheRateModel.getT2SvcPrice();
Integer t3Price = cacheRateModel.getT3Price();
Integer t3SvcPrice = cacheRateModel.getT3SvcPrice();
Integer t4Price = cacheRateModel.getT4Price();
Integer t4SvcPrice = cacheRateModel.getT4SvcPrice();
if(cacheRateModel.getTfPricesSeq() !=null && cacheRateModel.getTfPricesSeq().length>0){
price.append("{");
svcPrice.append("{");
for (int i = 0; i < cacheRateModel.getTfPricesSeq().length; i++) {
String time = getTime(i);
String s = cacheRateModel.getTfPricesSeq()[i];
if("00".equals(s)){
price.append(time).append(t1Price.toString()).append(",");
svcPrice.append(time).append(t1SvcPrice.toString()).append(",");
}else if("01".equals(s)){
price.append(time).append(t2Price.toString()).append(",");
svcPrice.append(time).append(t2SvcPrice.toString()).append(",");
}else if("02".equals(s)){
price.append(time).append(t3Price.toString()).append(",");
svcPrice.append(time).append(t3SvcPrice.toString()).append(",");
}else{
price.append(time).append(t4Price.toString()).append(",");
svcPrice.append(time).append(t4SvcPrice.toString()).append(",");
}
}
price.deleteCharAt(price.length()-1).append("}");
svcPrice.deleteCharAt(svcPrice.length()-1).append("}");
}
cdStationInfo.setElectricityFee(price.toString());
cdStationInfo.setServiceFee(svcPrice.toString());
Set<String> pks = stationDto.getPiles();
if (pks != null) {
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
for (String pileNo : pks) {
String pk = "pile:".concat(pileNo);
String skey = "cdjgpc:".concat(pk)+".notification";
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
if(cdEquipmentInfo==null || "".equals(cdEquipmentInfo.getEquipmentID())){
logger.info("该场站下面:"+pileNo+"桩未录入");
}else{
cdEquipmentInfos.add(cdEquipmentInfo);
}
}
cdStationInfo.setEquipmentInfos(cdEquipmentInfos);
}
cdStationInfo.setSwapMatchCarsName(null);
CommonRequest<CDStationInfo> commonRequest = new CommonRequest<>();
Map<String,Object> mapStationInfo =new HashMap<>();
mapStationInfo.put("StationInfo",cdStationInfo);
String data = JSONUtil.toJSONString(mapStationInfo);
System.out.println("===新电途====data========"+data);
commonRequest.setData(data);
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
System.out.println("===新电途==推送充电站信息==result========"+result);
}
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
isValid = false;
}
}
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
if (chargingStationDto.getPiles() != null) {
if (isValid) {
validStationKeys.add(stationKey);
}
}
}
for (String stationKey : validStationKeys) {
// maybe对接第三方
if (authSecretTokenOut != null) {
String chargingStationId = stationKey.substring(8);
//获取场站信息
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
cdStationInfo.setEquipmentInfos(new ArrayList<>());
//查询场站是桩是否对应上
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + stationDto.getRateModelId());
StringBuilder price = new StringBuilder();
StringBuilder svcPrice = new StringBuilder();
Integer t1Price = cacheRateModel.getT1Price();
Integer t1SvcPrice = cacheRateModel.getT1SvcPrice();
Integer t2Price = cacheRateModel.getT2Price();
Integer t2SvcPrice = cacheRateModel.getT2SvcPrice();
Integer t3Price = cacheRateModel.getT3Price();
Integer t3SvcPrice = cacheRateModel.getT3SvcPrice();
Integer t4Price = cacheRateModel.getT4Price();
Integer t4SvcPrice = cacheRateModel.getT4SvcPrice();
if(cacheRateModel.getTfPricesSeq() !=null && cacheRateModel.getTfPricesSeq().length>0){
price.append("{");
svcPrice.append("{");
for (int i = 0; i < cacheRateModel.getTfPricesSeq().length; i++) {
String time = getTime(i);
String s = cacheRateModel.getTfPricesSeq()[i];
if("00".equals(s)){
price.append(time).append(t1Price.toString()).append(",");
svcPrice.append(time).append(t1SvcPrice.toString()).append(",");
}else if("01".equals(s)){
price.append(time).append(t2Price.toString()).append(",");
svcPrice.append(time).append(t2SvcPrice.toString()).append(",");
}else if("02".equals(s)){
price.append(time).append(t3Price.toString()).append(",");
svcPrice.append(time).append(t3SvcPrice.toString()).append(",");
}else{
price.append(time).append(t4Price.toString()).append(",");
svcPrice.append(time).append(t4SvcPrice.toString()).append(",");
}
}
price.deleteCharAt(price.length()-1).append("}");
svcPrice.deleteCharAt(svcPrice.length()-1).append("}");
}
cdStationInfo.setElectricityFee(price.toString());
cdStationInfo.setServiceFee(svcPrice.toString());
Set<String> pks = stationDto.getPiles();
if (pks != null) {
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
for (String pileNo : pks) {
String pk = "pile:".concat(pileNo);
String skey = "cdjgpc:".concat(pk)+".notification";
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
if(cdEquipmentInfo==null || "".equals(cdEquipmentInfo.getEquipmentID())){
logger.info("该场站下面:"+pileNo+"桩未录入");
}else{
cdEquipmentInfos.add(cdEquipmentInfo);
}
}
cdStationInfo.setEquipmentInfos(cdEquipmentInfos);
}
cdStationInfo.setSwapMatchCarsName(null);
CommonRequest<CDStationInfo> commonRequest = new CommonRequest<>();
Map<String,Object> mapStationInfo =new HashMap<>();
mapStationInfo.put("StationInfo",cdStationInfo);
String data = JSONUtil.toJSONString(mapStationInfo);
System.out.println("===新电途====data========"+data);
commonRequest.setData(data);
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
System.out.println("===新电途==推送充电站信息==result========"+result);
}
}
}catch (Exception e){
e.printStackTrace();

View File

@ -1,4 +1,4 @@
# Tomcat 9009 不走推送 name: evcs 9099 走推送 name: jp 120.26.46.180:8858
# Tomcat 9009 不走推送 name: evcs 9099 走推送 name: jp mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server:
port: 9009
@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -426,6 +426,10 @@ public class SysUser extends BaseEntity
return tenantName+":"+getTenantId();
}
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
public String getCorpNo() {
return corpNo;
}

View File

@ -187,11 +187,11 @@ public class TokenController extends BaseController
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("code", random);
paramMap.put("phone", phone);
paramMap.put("content", "翔桦充电】您的验证码是:" + random + "有效期为5分钟。如非本人操作可不用理会。");
paramMap.put("content", "小华充电】您的验证码是:" + random + "有效期为5分钟。如非本人操作可不用理会。");
com.aliyun.dysmsapi20170525.Client client = createClient();
com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest()
.setSignName("翔桦充电")
.setSignName("小华充电")
.setTemplateCode("SMS_226786362")
.setTemplateParam("{\"code\":\""+random+"\"}")
.setPhoneNumbers(phone);

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -16,10 +16,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置
@ -35,7 +35,7 @@ spring:
datasource:
ds1:
nacos:
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
dataId: sentinel-ruoyi-gateway
groupId: DEFAULT_GROUP
data-type: json

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -57,7 +57,7 @@ public class XhpcTenantTask {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", domain.getContactNumber());
paramMap.put("tenantName", domain.getTenantName());
paramMap.put("content", "翔桦充电】尊敬的租户,您申请的租户(租户名称: " + domain.getTenantName() + ")还有15天到期请联系业务人员进行续费。");
paramMap.put("content", "小华充电】尊敬的租户,您申请的租户(租户名称: " + domain.getTenantName() + ")还有15天到期请联系业务人员进行续费。");
smsService.sendNotice(paramMap);
}
}

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -27,6 +27,7 @@
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/>
<result column="tenant_name" property="tenantName"/>
<result column="tenant_id" property="tenantId"/>
<result column="super_type" property="superType"/>
<result column="operator_id" property="operatorId"/>

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -0,0 +1,40 @@
package com.xhpc.activity.controller;
import com.xhpc.activity.service.IXhpcDeviceMessageService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* 储存占位费设备运行日志
*
* @author yuyang
* @Date 2025-09-17 14:37
*/
@RestController
@RequestMapping("/device")
public class XhpcDeviceMessageController extends BaseController {
@Resource
IXhpcDeviceMessageService xhpcDeviceMessageService;
//每3分钟储存一条有费用的占位费订单
@GetMapping("/getNameList")
@Scheduled(cron = "0 0/1 * * * ? ")
public void getNameList(){
xhpcDeviceMessageService.addXhpcDeviceMessage();
}
}

View File

@ -27,4 +27,12 @@ public interface XhpcDeviceMessageMapper {
int deleteMessageByDate(@Param("date")String date);
int addXhpcDeviceMessage(@Param("chargeOrderNo") String chargeOrderNo);
String getXhpcPlaceholderOrder();
int updateXhpcPlaceholderOrder(@Param("serialNumber") String serialNumber);
int addXhpcDeviceMessageGunStatus(@Param("chargeOrderNo") String chargeOrderNo ,@Param("gunNumber") String gunNumber);
}

View File

@ -0,0 +1,10 @@
package com.xhpc.activity.service;
/**
* @author yuyang
* @Date 2025-09-17 14:44
*/
public interface IXhpcDeviceMessageService {
void addXhpcDeviceMessage();
}

View File

@ -344,7 +344,7 @@ public class WorkOrderServiceImpl implements WorkOrderService {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("orderNo", orderId);
paramMap.put("phone", phoneList);
paramMap.put("content", "翔桦充电】您好,您有新的工单(工单号:" + orderId + ")待处理,请及时登陆后台查看并处理,谢谢。");
paramMap.put("content", "小华充电】您好,您有新的工单(工单号:" + orderId + ")待处理,请及时登陆后台查看并处理,谢谢。");
R r = smsService.sendNotice(paramMap);
XhpcWorkOrderPushMessageDomain messageDomain = new XhpcWorkOrderPushMessageDomain();

View File

@ -129,7 +129,7 @@ public class XhpcClearingBankServiceImpl implements XhpcClearingBankService {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", phone);
paramMap.put("code", random);
paramMap.put("content", "翔桦充电】您的动态码为:" + random + ",您正在进行提现到银行账户操作,如非本人操作,请忽略本短信!");
paramMap.put("content", "小华充电】您的动态码为:" + random + ",您正在进行提现到银行账户操作,如非本人操作,请忽略本短信!");
smsService.sendNotice(paramMap);
String key = "opcash:" + phone;

View File

@ -0,0 +1,41 @@
package com.xhpc.activity.service.impl;
import com.xhpc.activity.mapper.XhpcDeviceMessageMapper;
import com.xhpc.activity.service.IXhpcDeviceMessageService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author yuyang
* @Date 2025-09-17 14:45
*/
@Service
public class XhpcDeviceMessageServiceImpl implements IXhpcDeviceMessageService {
@Resource
XhpcDeviceMessageMapper xhpcDeviceMessageMapper;
@Override
public void addXhpcDeviceMessage() {
//查询当前已结算的占位费订单
String serialNumber = xhpcDeviceMessageMapper.getXhpcPlaceholderOrder();
if(serialNumber !=null && !"".equals(serialNumber)){
xhpcDeviceMessageMapper.addXhpcDeviceMessage(serialNumber);
xhpcDeviceMessageMapper.addXhpcDeviceMessageGunStatus(serialNumber,serialNumber.substring(0,16));
xhpcDeviceMessageMapper.updateXhpcPlaceholderOrder(serialNumber);
}
}
public static void main(String[] args) {
System.out.println("80836000050013012509161214298944".substring(0,16));
}
}

View File

@ -26,7 +26,7 @@ public class AutoClearDataTask {
@Scheduled(cron = "0 0 5 * * ?")
private void autoClearDeviceMessageData(){
String date = DateUtil.date2String(DateUtil.addDay(new Date(), -3), "yyyy-MM-dd");
String date = DateUtil.date2String(DateUtil.addDay(new Date(), -7), "yyyy-MM-dd");
messageMapper.deleteMessageByDate(date);
}

View File

@ -19,10 +19,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -151,4 +151,54 @@
order by m.charge_order_no asc, m.create_time asc
</select>
<insert id="addXhpcDeviceMessage">
INSERT INTO xhpc_device_message_24
SELECT * FROM xhpc_device_message
WHERE charge_order_no=#{chargeOrderNo}
</insert>
<select id="getXhpcPlaceholderOrder" resultType="String">
SELECT serial_number
FROM xhpc_placeholder_order
WHERE copy_status =0 and start_time &gt;= '2025-09-10 00:00:00'
AND (
(source != 1 AND act_price &gt; 0)
OR
(source = 1 AND status IN (3,9,10) and total_money &gt; 0)
)
ORDER BY placeholder_order_id asc
LIMIT 1;
</select>
<update id="updateXhpcPlaceholderOrder">
UPDATE xhpc_placeholder_order SET copy_status = 1 WHERE serial_number=#{serialNumber};
</update>
<insert id="addXhpcDeviceMessageGunStatus">
INSERT INTO xhpc_device_message_24
SELECT *
FROM xhpc_device_message
WHERE gun_number = #{gunNumber} and create_time &gt;
( SELECT create_time
FROM xhpc_device_message
WHERE charge_order_no = #{chargeOrderNo}
AND gun_status = 1
ORDER BY create_time DESC
LIMIT 1 )
AND create_time &lt;=
( SELECT create_time
FROM xhpc_device_message
WHERE gun_number = #{gunNumber}
AND gun_status = 0 and create_time &gt;=
( SELECT create_time
FROM xhpc_device_message
WHERE charge_order_no = #{chargeOrderNo}
AND gun_status = 1
ORDER BY create_time DESC
LIMIT 1 )
ORDER BY create_time asc
LIMIT 1 );
</insert>
</mapper>

View File

@ -93,45 +93,6 @@
where find_in_set(history_order_id, #{orderIds})
</update>
<!--
原查询方案
<select id="getOrderPage" resultType="map">
select
co.serial_number as 'serialNumber',
co.source as 'source',
case co.source when 0 then 'C端用户'
when 1 then '流量方用户'
when 2 then '社区用户'
when 3 then 'B端用户' end as 'sourceName',
replace(co.start_time, 'T', ' ') as 'startTime',
replace(co.end_time, 'T', ' ') as 'endTime'
from xhpc_charge_order as co
left join xhpc_charging_station as st on st.charging_station_id =co.charging_station_id
where co.del_flag =0
<if test="params.orderId!=null and params.orderId!=''">
and co.serial_number like concat('%', #{params.orderId},'%')
</if>
<if test="params.number !=0 and params.number ==1">
and co.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})
</if>
<if test="params.number !=0 and params.number ==2">
and co.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.operatorId})
</if>
<if test="params.tenantId != null and params.tenantId != ''">
and co.tenant_id = #{params.tenantId}
</if>
<if test="params.startTime!=null and params.startTime!=''">
and co.start_time <![CDATA[ >= ]]> #{params.startTime}
</if>
<if test="params.endTime !=null and params.endTime!=''">
and co.create_time <![CDATA[ <= ]]> #{params.endTime}
</if>
order by co.create_time desc
</select>-->
<select id="getOrderPage" resultType="map">
SELECT
co.serial_number AS 'serialNumber',
@ -142,8 +103,8 @@
WHEN 2 THEN '社区用户'
WHEN 3 THEN 'B端用户'
END AS 'sourceName',
co.start_time AS 'startTimeRaw', -- 原始数据
co.end_time AS 'endTimeRaw' -- 原始数据
co.start_time AS 'startTimeRaw',
co.end_time AS 'endTimeRaw'
FROM xhpc_charge_order co
LEFT JOIN xhpc_charging_station st
ON st.charging_station_id = co.charging_station_id
@ -171,13 +132,12 @@
AND co.tenant_id = #{params.tenantId}
</if>
<if test="params.startTime!=null and params.startTime!=''">
AND co.start_time >= #{params.startTime}
AND co.start_time &gt;= #{params.startTime}
</if>
<if test="params.endTime !=null and params.endTime!=''">
AND co.create_time <= #{params.endTime}
AND co.create_time &lt;= #{params.endTime}
</if>
ORDER BY co.create_time DESC
LIMIT 100; -- 必须添加分页限制
</select>

View File

@ -2,9 +2,14 @@ package com.xhpc.card.controller;
import com.xhpc.card.domain.*;
import com.xhpc.card.pojo.TIccardClientUsers;
import com.xhpc.card.pojo.TIccardInfo;
import com.xhpc.card.service.IXhpcCardService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcChargingPile;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@ -260,5 +265,13 @@ public class XhpcCardController extends BaseController {
return xhpcCardService.deleteClientUser(userId);
}
@PostMapping(value = "/addIccardInfo")
public R addIccardInfo(@RequestBody TIccardInfo iccardInfo) {
return xhpcCardService.addIccardInfo(iccardInfo);
}
@DeleteMapping("/{id}")
public R<Object> removeIccardInfo(@PathVariable Integer id) {
return xhpcCardService.removeIccardInfo(id);
}
}

View File

@ -75,4 +75,4 @@ public interface TIccardLogMapper {
*/
Long selectCountRechargeLogByUniqueId(@Param("uniqueId") String uniqueId);
}
}

View File

@ -2,6 +2,7 @@ package com.xhpc.card.service;
import com.xhpc.card.domain.*;
import com.xhpc.card.pojo.TIccardClientUsers;
import com.xhpc.card.pojo.TIccardInfo;
import com.xhpc.common.core.domain.R;
import java.util.List;
@ -201,4 +202,8 @@ public interface IXhpcCardService {
*/
R<Object> recoverToReportTheLossOfCard(Integer cardId);
R addIccardInfo(TIccardInfo iccardInfo);
R removeIccardInfo(Integer id);
}

View File

@ -471,7 +471,9 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
cardUserInfo.setBalance(tIccardInfo.getBalance());
cardUserInfo.setCardType(tIccardInfo.getCardtype());
XhpcOperator xhpcOperator = xhpcOperatorMapper.selectOneByCorpNoAndTenantId(tIccardInfo.getCorpno(), tokenService.getLoginUser().getSysUser().getTenantId());
cardUserInfo.setGrantOperatorName(xhpcOperator.getName());
if(xhpcOperator !=null && xhpcOperator.getName() !=null){
cardUserInfo.setGrantOperatorName(xhpcOperator.getName());
}
//离线用户账号
TIccardUsers tIccardUser = tIccardUsersMapper.selectByPrimaryKey(tIccardInfo.getUserindex());
cardUserInfo.setUserAccount(tIccardUser.getPhone());
@ -494,7 +496,9 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
cardUserInfo.setBalance(tIccardInfo.getBalance());
cardUserInfo.setCardType(tIccardInfo.getCardtype());
XhpcOperator xhpcOperator = xhpcOperatorMapper.selectOneByCorpNoAndTenantId(tIccardInfo.getCorpno(), tokenService.getLoginUser().getSysUser().getTenantId());
cardUserInfo.setGrantOperatorName(xhpcOperator.getName());
if(xhpcOperator !=null && xhpcOperator.getName() !=null){
cardUserInfo.setGrantOperatorName(xhpcOperator.getName());
}
return R.ok(cardUserInfo);
}
}
@ -888,6 +892,19 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
return R.ok();
}
@Override
public R addIccardInfo(TIccardInfo iccardInfo) {
tIccardInfoMapper.insertSelective(iccardInfo);
return R.ok();
}
@Override
public R removeIccardInfo(Integer id) {
tIccardInfoMapper.deleteByPrimaryKey(id);
return R.ok();
}
/**
* 用于QueryRechargeRecord方法封装DTO数据
*

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -203,4 +203,4 @@
createTime = #{createtime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
</mapper>

View File

@ -564,7 +564,7 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
//短信通知
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", timingCharging.getPhone());
paramMap.put("content", "【翔桦充电】计费--尊敬的用户,计费模型"+timingChargingModelId+"更新失败,请快速处理");
paramMap.put("content", "计费--尊敬的用户,计费模型"+timingChargingModelId+"更新失败,请快速处理");
smsService.sendNotice(paramMap);
executorService.execute(new Runnable() {

View File

@ -14,19 +14,19 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
com.xhpc.charging.station.mapper: debug
#logging:
# level:
# com.xhpc.charging.station.mapper: debug
oss:
enabled: true

View File

@ -48,12 +48,20 @@ public class XhpcPlaceholderOrder extends BaseEntity {
private String chargingMode;
private String driverId;
private String plateNum;
private String searchValue;
private Integer type;
private String operatorIdEvcs;
private Integer userStatus;
private BigDecimal rechargeMoney;
private BigDecimal refundMoney;
private BigDecimal actPrice;
private Integer actStatus;
private Integer appealStatus;
private String appealUserResult;
private String appealResult;
private Date appealTime;
private Date appealProcessTime;
private BigDecimal appealRefundMoney;
public XhpcPlaceholderOrder() {
}

View File

@ -12,12 +12,12 @@ public class AliyunTemplate {
/**
* 阿里云短信签名
*/
public static final String SIGNATURE_NAME = "翔桦充电";
public static final String SIGNATURE_NAME = "小华充电";
/**
* 阿里云短信签名
*/
public static final String SIGNATURE_OREDER_NAME = "小华充电订单异常";
public static final String SIGNATURE_OREDER_NAME = "翔桦充电订单异常";
/**
* 电量充满
*/
@ -71,4 +71,7 @@ public class AliyunTemplate {
*/
public static final String OPERATOR_ORDER_REFUND = "SMS_462691150";
public static final String OPERATOR_PLACEHOLDER_ORDER = "SMS_493685173";
public static final String OPERATOR_PLACEHOLDER_ORDER_MONEY = "SMS_493935178";
}

View File

@ -65,5 +65,8 @@ public class AliyunTemplateKeyWord {
*/
public static final String OPERATOR_ORDER_REFUND ="尊敬的管理员,用户退款订单";
public static final String OPERATOR_PLACEHOLDER_ORDER ="尊敬的用户,你的爱车已停止充电";
public static final String OPERATOR_PLACEHOLDER_ORDER_MONEY ="尊敬的用户你好,你的爱车已停止充电";
public static final String OPERATOR_CODE= "您的验证码是";
}

View File

@ -37,7 +37,7 @@ public class XhpcSmsController extends BaseController {
String signatureName = null;
String templateId = null;
signatureName = "翔桦充电";
signatureName = "小华充电";
templateId = "SMS_226786362";
if(phone !=null || "".equals(phone)){
if(!UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
@ -88,10 +88,8 @@ public class XhpcSmsController extends BaseController {
} else if (content.contains(AliyunTemplateKeyWord.CHARGE_MONEY_INSUFFICIENT)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.CHARGE_MONEY_INSUFFICIENT;
} else if (content.contains(AliyunTemplateKeyWord.CHARGE_FULL)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.CHARGE_FULL;
} else if (content.contains(AliyunTemplateKeyWord.REFUND_FAIL)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.REFUND_FAIL;
}else if (content.contains(AliyunTemplateKeyWord.CHARGING_MODEL)) {
@ -109,13 +107,24 @@ public class XhpcSmsController extends BaseController {
} else if (content.contains(AliyunTemplateKeyWord.OPERATOR_CASHED)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.OPERATOR_CASHED;
}else if (content.contains(AliyunTemplateKeyWord.OPERATOR_ORDER_REFUND)) {
signatureName = AliyunTemplate.SIGNATURE_OREDER_NAME;
templateId = AliyunTemplate.OPERATOR_ORDER_REFUND;
}else if (content.contains(AliyunTemplateKeyWord.OPERATOR_PLACEHOLDER_ORDER)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.OPERATOR_PLACEHOLDER_ORDER;
}else if (content.contains(AliyunTemplateKeyWord.OPERATOR_PLACEHOLDER_ORDER_MONEY)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.OPERATOR_PLACEHOLDER_ORDER_MONEY;
}
// else if (content.contains(AliyunTemplateKeyWord.OPERATOR_ORDER_REFUND)) {
// signatureName = AliyunTemplate.SIGNATURE_OREDER_NAME;
// templateId = AliyunTemplate.OPERATOR_ORDER_REFUND;
// }
xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap);
// else if (content.contains(AliyunTemplateKeyWord.CHARGE_FULL)) {
// signatureName = AliyunTemplate.SIGNATURE_NAME;
// templateId = AliyunTemplate.CHARGE_FULL;
// }
if(!"SMS_227005968".equals(templateId)){
xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap);
}
}
@GetMapping(value = "/getAliyunShortMessageInfo")

View File

@ -5,6 +5,7 @@ import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
@ -155,30 +156,41 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
XhpcSms xhpcSms = new XhpcSms();
try {
String captcha = redisService.getCacheObject(phone+":"+templateId);
if (!templateId.equals(captcha)) {
System.out.println("============发送短信==================");
//使用阿里云发送通知短信
Map<String, String> neededParam = aliyunSmsNotice(phone, signatureName, templateId, paramMap);
System.out.println("============neededParam=================="+neededParam);
//获取模板内容
String templateContent = neededParam.get("templateContent");
System.out.println("============templateContent=================="+templateContent);
//封装信息
xhpcSms.setPhone(phone);
xhpcSms.setContent(templateContent);
xhpcSms.setCreateTime(new Date());
xhpcSms.setRemark(neededParam.get("jsonResult"));
//使用阿里云发送通知短信
Map<String, String> neededParam = aliyunSmsNotice(phone, signatureName, templateId, paramMap);
//判断发送结果
String statusCode = neededParam.get("statusCode");
if (AliyunSendResult.SUCCESS.equals(statusCode)) {
xhpcSms.setStatus(0);
} else {
xhpcSms.setStatus(1);
}
xhpcSmsMapper.addXhpcSms(xhpcSms);
redisService.setCacheObject(phone+":"+templateId, templateId, 120L, TimeUnit.SECONDS);
}else{
System.out.println("============不发生发送短信==================");
}
//获取模板内容
String templateContent = neededParam.get("templateContent");
//封装信息
xhpcSms.setPhone(phone);
xhpcSms.setContent(templateContent);
xhpcSms.setCreateTime(new Date());
xhpcSms.setRemark(neededParam.get("jsonResult"));
//判断发送结果
String statusCode = neededParam.get("statusCode");
if (AliyunSendResult.SUCCESS.equals(statusCode)) {
xhpcSms.setStatus(0);
} else {
xhpcSms.setStatus(1);
}
} catch (Exception e) {
e.printStackTrace();
xhpcSms.setStatus(3);
xhpcSmsMapper.addXhpcSms(xhpcSms);
}
xhpcSmsMapper.addXhpcSms(xhpcSms);
}
@Override
@ -233,10 +245,10 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
private String getTemplateContent(String templateId, Map<String, String> paramMap) throws Exception {
if (AliyunTemplate.CHARGE_FULL.equals(templateId)) {
String battery = paramMap.get("battery");
return "尊敬的用户你的车辆已充电达至设定的SOC:" + battery + "%并停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。";
}
// if (AliyunTemplate.CHARGE_FULL.equals(templateId)) {
// String battery = paramMap.get("battery");
// return "尊敬的用户你的车辆已充电达至设定的SOC:" + battery + "%并停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。";
// }
if (AliyunTemplate.CHARGE_MONEY_INSUFFICIENT.equals(templateId)) {
String money = paramMap.get("money");
return "尊敬的用户,你的账户余额小于" + money + "元,为不影响您的正常充电,请您尽快充值交费,谢谢。";
@ -254,9 +266,22 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
String code = paramMap.get("code");
return "您的验证码是:" + code + "有效期为5分钟。如非本人操作可不用理会。";
}
if (AliyunTemplate.REFUND_FAIL.equals(templateId)) {
return "【翔桦充电】退款-尊敬的用户,当前退款人数较多,申请退款失败,请您重新提交申请!";
if (AliyunTemplate.OPERATOR_PLACEHOLDER_ORDER_MONEY.equals(templateId)) {
String time = paramMap.get("time");
String sumMoney = paramMap.get("sumMoney");
String number = paramMap.get("number");
return "尊敬的用户,你的爱车已停止充电"+time+"分钟前30分钟免费平台收取本次设备占用费"+sumMoney+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,试运行期间前三次免费,当前免费次数为"+number+",充电结束请及时挪车。";
}
if (AliyunTemplate.OPERATOR_PLACEHOLDER_ORDER.equals(templateId)) {
String time = paramMap.get("time");
String sumMoney = paramMap.get("sumMoney");
String number = paramMap.get("number");
return "尊敬的用户,你的爱车已停止充电"+time+"分钟前30分钟免费平台收取本次设备占用费"+sumMoney+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,试运行期间前三次免费,当前免费次数为"+number+",充电结束请及时挪车。";
}
// if (AliyunTemplate.REFUND_FAIL.equals(templateId)) {
// return "退款-尊敬的用户,当前退款人数较多,申请退款失败,请您重新提交申请!";
// }
// if (AliyunTemplate.OPERATOR_ORDER_REFUND.equals(templateId)) {
// String number=paramMap.get("number");
// return "【小华充电订单异常】尊敬的管理员,用户退款订单:"+number+",有问题请速速查看。";
@ -271,7 +296,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
SendSmsRequest sendSmsRequest = new SendSmsRequest();
sendSmsRequest.setPhoneNumbers("18123374652");
sendSmsRequest.setSignName("小华充电订单异常");
sendSmsRequest.setSignName("翔桦充电订单异常");
sendSmsRequest.setTemplateCode("SMS_462691150");
//添加模板参数
HashMap<String, String> paramMap = new HashMap<>();

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.xhpc.common.api.*;
import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
@ -89,6 +90,16 @@ public class XhpcPileOrderController extends BaseController {
return R.ok();
}
if(xhpcChargeOrder.getRateModelId()==null){
ChargingStationDto chargingStationDto = REDIS.getCacheObject("station:" + xhpcChargeOrder.getChargingStationId());
if(chargingStationDto.getRateModelId() !=null){
xhpcChargeOrder.setRateModelId(chargingStationDto.getRateModelId());
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
}
}
if (status == 1) {
userId = update(0, remark, orderNo, 0);
} else {

View File

@ -1,5 +1,6 @@
package com.xhpc.order.controller;
import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
@ -12,6 +13,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
@ -43,7 +45,14 @@ public class XhpcPlaceholderOrderController extends BaseController {
return getDataTable(listPage);
}
@GetMapping("/getAbnormalListPage")
public TableDataInfo getAbnormalListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, 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, Long personnelId, Integer confirmResult)
{
List<Map<String, Object>> listPage = xhpcPlaceholderOrderService.getAbnormalListPage(tenantId,chargingStationId,chargingPileId,terminalId,phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult);
return getDataTable(listPage);
}
/**
* 历史订单导出
* @param response 返回数据流
@ -91,18 +100,114 @@ public class XhpcPlaceholderOrderController extends BaseController {
xhpcPlaceholderOrderService.getTimingPriceTime(gunNumber);
}
//超过720分钟的都变成异常订单
//超过360分钟的都变成异常订单
@Scheduled(cron = "0 0/5 * * * ? ")
public void getAbnormal() {
xhpcPlaceholderOrderService.getAbnormal();
}
//查询异常订单枪状态
@Scheduled(cron = "0 0/1 * * * ? ")
public void getAbnormalTime() {
xhpcPlaceholderOrderService.getAbnormalTime();
}
@GetMapping("/getExamine")
public AjaxResult getExamine(@RequestParam Long placeholderOrderId, @RequestParam BigDecimal totalMoney, @RequestParam String startTime , @RequestParam String endTime){
public AjaxResult getExamine(@RequestParam Long placeholderOrderId,BigDecimal totalMoney, @RequestParam String startTime , @RequestParam String endTime){
return xhpcPlaceholderOrderService.getExamine(placeholderOrderId,totalMoney,startTime,endTime);
}
/**
* 订单来源第三方支付宝微信运营商权限划分
* @param internetUserIds 订单来源集合
* @return
*/
@GetMapping("/getSumSourceList")
public TableDataInfo getSumSourceList(HttpServletRequest request, String tenantId, Long operatorId, Long chargingStationId, Long chargingPileId, Long terminalId, String startTime, String endTime, String internetUserIds, String chargingStationIds) {
startPage();
List<Map<String, Object>> list = xhpcPlaceholderOrderService.getSumSourceList(request,tenantId,operatorId,chargingStationId,chargingPileId,terminalId,startTime,endTime,internetUserIds,chargingStationIds);
return getDataTable(list);
}
/**
* 订单来源统计导出
* @return
*/
@PostMapping("/internetUserInterval/export")
public void internetUserIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long operatorId,Long chargingStationId,Long chargingPileId,Long terminalId, String startTime, String endTime,String internetUserIds, String chargingStationIds) throws IOException {
xhpcPlaceholderOrderService.getSumSourceListExport(request,response,tenantId,operatorId,chargingStationId,chargingPileId,terminalId, startTime,endTime,internetUserIds,chargingStationIds);
}
/**
* 日期统计
* @param chargingStationIds 电站id集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
@GetMapping("/getDateIntervalPage")
public TableDataInfo getDateIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime,Long userId, Integer type)
{
List<Map<String, Object>> list = xhpcPlaceholderOrderService.getDateIntervalPage(request,tenantId,chargingStationId,chargingPileId,terminalId,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
return getDataTable(list);
}
/**
* 日期统计导出
* @param chargingStationIds 电站id集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
@PostMapping("/dateInterval/export")
public void dateIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime,Long userId,Integer type) throws IOException {
xhpcPlaceholderOrderService.dateIntervalExport(request,response,tenantId,chargingStationId,chargingPileId,terminalId, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
}
/**
* 电站统计
* @param chargingStationIds 电站集合
* @param operatorIds 运营商集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
@GetMapping("/getStationIntervalPage")
public TableDataInfo getStationIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, Long userId, Integer type)
{
List<Map<String, Object>> list = xhpcPlaceholderOrderService.getStationIntervalPage(request,tenantId,chargingStationId,chargingPileId,terminalId,chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type);
return getDataTable(list);
}
/**
* 电站统计导出
* @param chargingStationIds 电站集合
* @param operatorIds 运营商集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
@PostMapping("/stationInterval/export")
public void stationIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime,Long userId,Integer type) throws IOException {
xhpcPlaceholderOrderService.stationIntervalExport(request,response,tenantId,chargingStationId,chargingPileId,terminalId, chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type);
}
//==============================占位费查询================================
@GetMapping("/getPlaceholderIDs")
@ -110,4 +215,50 @@ public class XhpcPlaceholderOrderController extends BaseController {
xhpcPlaceholderOrderService.getPlaceholderIDs(stationIDs);
}
//==============================小程序接口================================
@GetMapping("/appealPlaceholderOrderList")
public TableDataInfo appealPlaceholderOrderList(HttpServletRequest request){
List<Map<String, Object>> listPage =xhpcPlaceholderOrderService.appealPlaceholderOrderList(request);
return getDataTable(listPage);
}
@PostMapping("/applyPlaceholderOrder")
public R applyPlaceholderOrder(HttpServletRequest request,@RequestBody Map<String, Object> map) {
if (map != null) {
Long placeholderOrderId = Long.parseLong(map.get("placeholderOrderId").toString());
String appealUserResult = map.get("appealUserResult").toString();
return xhpcPlaceholderOrderService.applyPlaceholderOrder(request,placeholderOrderId,appealUserResult);
}
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
@PostMapping("/applyPlaceholderOrderProcess")
public R applyPlaceholderOrderProcess(HttpServletRequest request,@RequestBody Map<String, Object> map) {
if (map != null) {
Long placeholderOrderId = Long.parseLong(map.get("placeholderOrderId").toString());
String refundType = map.get("refundType").toString();
BigDecimal actPrice =new BigDecimal(0);
if(!"reject".equals(refundType)){
if("full".equals(refundType)){
actPrice = new BigDecimal(map.get("placeholderTotalMoney").toString());
}else if("partial".equals(refundType)){
actPrice = new BigDecimal(map.get("refundAmount").toString());
}
}
String appealResult = map.get("appealResult").toString();
return xhpcPlaceholderOrderService.applyPlaceholderOrderProcess(request,placeholderOrderId,actPrice,refundType,appealResult);
}
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
@GetMapping("/appealPlaceholderOrderListPC")
public TableDataInfo appealPlaceholderOrderListPC(HttpServletRequest request,String tenantId,Long operatorId,String name, Integer type, String serialNumber, Long chargingStationId){
List<Map<String, Object>> listPage =xhpcPlaceholderOrderService.appealPlaceholderOrderListPC(request,tenantId,operatorId,name, type, serialNumber, chargingStationId);
return getDataTable(listPage);
}
}

View File

@ -191,6 +191,9 @@ public interface XhpcChargeOrderMapper {
*/
int insertUserAccountStatement(@Param("userId") Long userId,@Param("amount") BigDecimal amount,@Param("remainingSum") BigDecimal remainingSum,@Param("chargeOrderId") Long chargeOrderId,@Param("type") Integer type,@Param("date") Date date,@Param("source")Integer source);
int insertUserAccountStatementPlaceholder(@Param("userId") Long userId,@Param("amount") BigDecimal amount,@Param("remainingSum") BigDecimal remainingSum,@Param("placeholderOrderId") Long placeholderOrderId,@Param("type") Integer type,@Param("date") Date date,@Param("source")Integer source);
/**
* 获取费率
*/
@ -290,4 +293,8 @@ public interface XhpcChargeOrderMapper {
int getBlacklistUser(@Param("phone")String phone,@Param("vin")String vin,@Param("plateNnum")String plateNnum,@Param("chargingStationId")Long chargingStationId,@Param("time")String time);
List<Map<String,Object>> getXhpcTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("type")Integer type,@Param("userId")Long userId);
int getXhpcPlaceholderOrderNumber(@Param("userId")Long userId, @Param("source")Integer source, @Param("terminalId")String terminalId);
}

View File

@ -8,6 +8,7 @@ import com.xhpc.order.dto.XhpcPlaceholderTimeOrderDto;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -20,12 +21,16 @@ public interface XhpcPlaceholderOrderMapper {
XhpcPlaceholderOrder getXhpcPlaceholderOrderSerialNumber(@Param("serialNumber") String serialNumber);
int getXhpcChargeOrderStatus(@Param("serialNumber") String serialNumber);
List<XhpcPlaceholderTime> getXhpcPlaceholderTime(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("placeholderId")Long placeholderId);
int updateXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder );
List<Map<String,Object>> getListPage(@Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId, @Param("terminalId")Long terminalId, @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, @Param("confirmResult")Integer confirmResult, @Param("tenantId")String tenantId, @Param("isNotNull")Integer isNotNull);
List<Map<String,Object>> getAbnormalListPage(@Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId, @Param("terminalId")Long terminalId, @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, @Param("confirmResult")Integer confirmResult, @Param("tenantId")String tenantId, @Param("isNotNull")Integer isNotNull);
Map<String,Object> getById(@Param("placeholderOrderId")Long placeholderOrderId);
int insertXhpcPlaceholderTimeOrder(XhpcPlaceholderTimeOrderDto xhpcPlaceholderTimeOrderDto);
@ -45,4 +50,51 @@ public interface XhpcPlaceholderOrderMapper {
void getAbnormal();
XhpcPlaceholderOrder getAbnormalTime();
List<Map<String,Object>> getAbnormalTimeList();
int getXhpcPlaceholderOrderNumber(@Param("userId")Long userId, @Param("source")Integer source, @Param("terminalId")String terminalId);
XhpcPlaceholderOrder getByPlaceholderOrderId(@Param("placeholderOrderId")Long placeholderOrderId);
Map<String,Object> getXhpcDeviceMessage(@Param("chargeOrderNo")String chargeOrderNo, @Param("gunStatus")Integer gunStatus, @Param("tenantId")String tenantId,@Param("createTime") Date createTime);
/**
* 订单来源列表
* @return
*/
List<Map<String,Object>> getSumSourceList(@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds,@Param("chargingStationIdList")List<String> chargingStationIdList,@Param("tenantId")String tenantId,@Param("sysUserId")Long sysUserId,@Param("number")Integer number);
/**
* 日期统计
* @param chargingStationIds 电站id集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param type 1 平台 2 运营商 3流量方
* @return
*/
List<Map<String, Object>> getDateIntervalPage(@Param("chargingStationId") Long chargingStationId,@Param("chargingPileId") Long chargingPileId,@Param("terminalId") Long terminalId,@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 chargingStationIds 电站集合
* @param operatorUserId 运营商集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param type 1 平台 2 运营商 3流量方
* @return
*/
List<Map<String, Object>> getStationIntervalPage(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("chargingStationIds") List<String> chargingStationIds,@Param("operatorUserId") List<String> operatorUserId,@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);
int getXhpcHistoryOrderMessage(@Param("serialNumber")String serialNumber);
List<Map<String, Object>> appealPlaceholderOrderList(@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId") String tenantId);
List<Map<String, Object>> appealPlaceholderOrderListPC(@Param("operatorId")Long operatorId,@Param("name") String name, @Param("type") Integer type, @Param("serialNumber") String serialNumber, @Param("chargingStationId") Long chargingStationId,@Param("logOperatorId")Long logOperatorId,@Param("number")Integer number,@Param("tenantId") String tenantId);
}

View File

@ -243,4 +243,6 @@ public interface IXhpcChargeOrderService {
* @return
*/
List<Map<String,Object>> getXhpcTerminalList(Long chargingStationId,Long chargingPileId,Integer type,Long userId);
int getXhpcPlaceholderOrderNumber(Long userId, Integer source,String terminalId);
}

View File

@ -5,6 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcPlaceholderOrder;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
@ -23,6 +24,8 @@ public interface IXhpcPlaceholderOrderService {
List<Map<String,Object>> getListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, 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 confirmResult);
List<Map<String,Object>> getAbnormalListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, 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 confirmResult);
void export(HttpServletResponse response, String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, 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 confirmResult) throws IOException;
R getById(Long placeholderOrderId);
@ -31,8 +34,87 @@ public interface IXhpcPlaceholderOrderService {
void getAbnormal();
void getAbnormalTime();
R getPlaceholderIDs(String [] stationIDs);
AjaxResult getExamine(Long placeholderOrderId, BigDecimal totalMoney, String startTime , String endTime);
}
/**
* 订单来源列表
* @return
*/
List<Map<String, Object>> getSumSourceList(HttpServletRequest request, String tenantId, Long operatorId, Long chargingStationId, Long chargingPileId, Long terminalId, String startTime, String endTime, String sourceIds, String chargingStationIds);
/**
* 订单来源统计导出
* @return
*/
void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long operatorId,Long chargingStationId,Long chargingPileId,Long terminalId, String startTime, String endTime, String sourceIds,String chargingStationIds) throws IOException;
/**
* 日期统计
* @param chargingStationIds 电站id集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
List<Map<String, Object>> getDateIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type);
/**
* 日期统计导出
* @param chargingStationIds 电站id集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
void dateIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException;
/**
* 电站统计
* @param chargingStationIds 电站集合
* @param operatorIds 运营集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
List<Map<String, Object>> getStationIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type);
/**
* 电站统计导出
* @param chargingStationIds 电站集合
* @param operatorIds 运营集合
* @param internetUserId 流量方id
* @param operatorId 运营商id
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
void stationIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException;
List<Map<String,Object>> appealPlaceholderOrderList(HttpServletRequest request);
R applyPlaceholderOrder(HttpServletRequest request,Long placeholderOrderId,String appealUserResult);
R applyPlaceholderOrderProcess(HttpServletRequest request,Long placeholderOrderId,BigDecimal actPrice,String refundType,String appealResult);
List<Map<String,Object>> appealPlaceholderOrderListPC(HttpServletRequest request,String tenantId,Long operatorId,String name, Integer type, String serialNumber, Long chargingStationId);
}

View File

@ -589,7 +589,9 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
@Override
public int addUserAccountStatement(Long userId, BigDecimal amount, BigDecimal remainingSum, Long chargeOrderId,
Integer type, Date date,Integer source) {
if(type ==7){
return xhpcChargeOrderMapper.insertUserAccountStatementPlaceholder(userId, amount, remainingSum, chargeOrderId, type, date,source);
}
return xhpcChargeOrderMapper.insertUserAccountStatement(userId, amount, remainingSum, chargeOrderId, type, date,source);
}
@ -1282,28 +1284,28 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
executorService.execute(new Runnable() {
@Override
public void run() {
R r1 = powerPileService.startCharging(startChargingData);
logger.info("<<<<<<<<<<<<<<<<<<<<<VIN<<<充电返回>>>>>>VIN>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getCode() + ">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getMsg() + ">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getData() + ">>>>>>>>>>>>>>>>>");
if(r1.getCode() == 200){
try{
xhpcChargeOrder.setRateModelId(Long.valueOf(r1.getData().toString()));
xhpcChargeOrderMapper.updateXhpcChargeOrder(xhpcChargeOrder);
//插一帧实时数据
extracted(xhpcChargeOrder);
}catch (Exception e){
e.printStackTrace();
logger.error("update order[{}] failed.", orderNo);
}
}
}
});
// executorService.execute(new Runnable() {
// @Override
// public void run() {
// R r1 = powerPileService.startCharging(startChargingData);
// logger.info("<<<<<<<<<<<<<<<<<<<<<VIN<<<充电返回>>>>>>VIN>>>>>>>>>>>");
// logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getCode() + ">>>>>>>>>>>>>>>>>");
// logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getMsg() + ">>>>>>>>>>>>>>>>>");
// logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getData() + ">>>>>>>>>>>>>>>>>");
// if(r1.getCode() == 200){
// try{
// xhpcChargeOrder.setRateModelId(Long.valueOf(r1.getData().toString()));
// xhpcChargeOrderMapper.updateXhpcChargeOrder(xhpcChargeOrder);
// //插一帧实时数据
// extracted(xhpcChargeOrder);
// }catch (Exception e){
// e.printStackTrace();
// logger.error("update order[{}] failed.", orderNo);
// }
// }
//
// }
// });
Map<String,Object> map =new HashMap<>();
map.put("balance",userMessage.get("balance"));
map.put("serialNumber",orderNo);
@ -1344,8 +1346,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
}else if(qiang==4){
spear = "D";
}
operatorMessage.get("chargingStationName").toString().replace("翔桦充电","");
String str = operatorMessage.get("chargingStationName").toString().replace("翔桦充电", "");
operatorMessage.get("chargingStationName").toString().replace("小华充电","");
String str = operatorMessage.get("chargingStationName").toString().replace("小华充电", "");
if(str.length()>13){
str =str.substring(0,13);
}
@ -1354,7 +1356,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("battery", soc);
paramMap.put("phone", userMessage.get("phone").toString());
paramMap.put("content", "翔桦充电】尊敬的用户你的车辆已充电达至设定的SOC(" + soc + "%)。");
paramMap.put("content", "小华充电】尊敬的用户你的车辆已充电达至设定的SOC(" + soc + "%)。");
smsService.sendNotice(paramMap);
}
}
@ -1982,6 +1984,11 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
return xhpcChargeOrderMapper.getXhpcTerminalList(chargingStationId,chargingPileId,type,userId);
}
@Override
public int getXhpcPlaceholderOrderNumber(Long userId, Integer source, String terminalId) {
return xhpcChargeOrderMapper.getXhpcPlaceholderOrderNumber(userId, source, terminalId);
}
//判断双枪启规则
private AjaxResult startUpSuncha(Map<String, Object> userMessage,XhpcChargeOrder xhpcChargeOrder,XhpcTerminal xhpcTerminal,String tenantId,Integer source,String terminalSerialNumber,Integer type){

View File

@ -151,16 +151,19 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
String tenantId = loginUser.getTenantId();
Integer userType = loginUser.getUserType();
R user = userTypeService.getUser(null, userid, userType, null, tenantId);
// R user = userTypeService.getUser(null, userid, userType, null, tenantId);
//
// if(user !=null && user.getData() !=null){
// Map<String, Object> userMessage = (Map<String, Object>)user.getData();
// if (userMessage != null) {
// startPage();
// return xhpcHistoryOrderMapper.list(userid,userType,tenantId);
// }
// }
if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage != null) {
startPage();
return xhpcHistoryOrderMapper.list(userid,userType,tenantId);
}
}
return list;
// List<Map<String, Object>> list1 = xhpcHistoryOrderMapper.list(userid, userType, tenantId);
return xhpcHistoryOrderMapper.list(userid, userType, tenantId);
}
@Override

View File

@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.poi.excel.BigExcelWriter;
import cn.hutool.poi.excel.ExcelUtil;
import com.xhpc.common.api.SmsService;
import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.SecurityUtils;
@ -13,6 +14,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.domain.XhpcPlaceholderTime;
import com.xhpc.common.enums.StopReasonEnum;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.evcs.domain.PlaceholderRules;
@ -21,14 +23,17 @@ import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcPlaceholderOrder;
import com.xhpc.order.dto.XhpcPlaceholderTimeOrderDto;
import com.xhpc.order.mapper.XhpcPlaceholderOrderMapper;
import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcPlaceholderOrderService;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
@ -43,12 +48,18 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
@Service
public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhpcPlaceholderOrderService {
@Resource
XhpcPlaceholderOrderMapper xhpcPlaceholderOrderMapper;
@Autowired
private XhpcPlaceholderOrderMapper xhpcPlaceholderOrderMapper;
@Autowired
private TokenService tokenService;
@Autowired
private UserTypeService userTypeService;
@Autowired
private IXhpcChargeOrderService xhpcChargeOrderService;
@Autowired
private SmsService smsService;
@Autowired
private RedisService redisService;
@Override
public int insertXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder) {
@ -64,7 +75,9 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
String serialNumber = cacheGun.get("previousOrder").toString();
//查询订单
XhpcPlaceholderOrder xhpcPlaceholderOrder = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderSerialNumber(serialNumber);
if(xhpcPlaceholderOrder !=null){
int xhpcChargeOrderStatus = xhpcPlaceholderOrderMapper.getXhpcChargeOrderStatus(serialNumber);
if(xhpcPlaceholderOrder !=null && xhpcChargeOrderStatus==1){
if (xhpcPlaceholderOrder.getType() == 0 ) {
//删除占位费时间段收费表
// xhpcPlaceholderOrderMapper.deleteByPlaceholderOrderIdInt(xhpcPlaceholderOrder.getPlaceholderOrderId());
@ -286,7 +299,7 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
totalMoney = new BigDecimal(50);
}
xhpcPlaceholderOrder.setTotalMoney(totalMoney);
if (new BigDecimal(0).compareTo(new BigDecimal(between)) == 1) {
if (new BigDecimal(0).compareTo(new BigDecimal(between)) == -1) {
xhpcPlaceholderOrder.setOvertimePrice(totalMoney.divide(new BigDecimal(between), 2, BigDecimal.ROUND_HALF_UP));
} else {
xhpcPlaceholderOrder.setOvertimePrice(new BigDecimal("0.0"));
@ -313,10 +326,86 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
cacheOrder.put("OvertimeDetails", overtimeDetails);
REDIS.setCacheMap(orderKey, cacheOrder);
xhpcPlaceholderOrder.setType(1);
Map<String, Object> cacheGunYu =new HashMap<>();
//cacheGunYu.put("previousOrder","");
REDIS.setCacheMap(gunNumber, cacheGun);
if(xhpcPlaceholderOrder.getSource() !=1){
Long userId = xhpcPlaceholderOrder.getUserId();
Integer source = xhpcPlaceholderOrder.getSource();
String tenantId = xhpcPlaceholderOrder.getTenantId();
if(0 == xhpcPlaceholderOrder.getSource()){
xhpcPlaceholderOrder.setChargingMode("C端用户");
}else if(2 == xhpcPlaceholderOrder.getSource()){
xhpcPlaceholderOrder.setChargingMode("社区用户");
}else{
xhpcPlaceholderOrder.setChargingMode("B端用户");
}
BigDecimal totalMoney1 = xhpcPlaceholderOrder.getTotalMoney();
xhpcPlaceholderOrder.setStatus(3);
if(totalMoney1.compareTo(new BigDecimal(0))>0){
System.out.println("==========11111============");
String key ="placeholderOrder:" +source+ tenantId+userId;
int number =0;
if(redisService.getCacheObject(key) !=null){
String numberYu = redisService.getCacheObject(key).toString();
int numbers =Integer.parseInt(numberYu);
numbers++;
number=numbers;
redisService.setCacheObject(key, numbers);
}else{
redisService.setCacheObject(key, 1);
number=1;
}
System.out.println("==========2222============");
R user = userTypeService.getUser(null, userId, source, null, tenantId);
if(number>3){
if(user !=null && user.getData() !=null ){
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
String phone =userMessage.get("phone").toString();
BigDecimal balance1 =new BigDecimal(userMessage.get("balance").toString());
BigDecimal subtract = balance1.subtract(totalMoney1);
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract,source,tenantId);
if(i==0){
//扣钱失败
System.out.println("<<<<<<<<<<<<<<<<扣钱失败>>>>userId>>>>>>>>>>>>>"+userId+">>subtract>>>>>>>>"+subtract+">>balance1>>>>>>>>"+balance1+">>source>>>>>>>>"+source);
}else{
//添加流水
xhpcChargeOrderService.addUserAccountStatement(userId,totalMoney1, subtract, xhpcPlaceholderOrder.getPlaceholderOrderId(), 7, new Date(),source);
}
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("time", xhpcPlaceholderOrder.getTotalTimeSpan()+"");
paramMap.put("sumMoney",totalMoney1.toString());
paramMap.put("phone", phone);
paramMap.put("content", "尊敬的用户你好,你的爱车已停止充电"+xhpcPlaceholderOrder.getTotalTimeSpan()+"分钟前30分钟免费平台收取本次设备占用费"+totalMoney1+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,充电结束请及时挪车。");
smsService.sendNotice(paramMap);
//平台用户直接余额扣钱
xhpcPlaceholderOrder.setActPrice(xhpcPlaceholderOrder.getTotalMoney());
xhpcPlaceholderOrder.setActStatus(1);
}
}else{
//发送短信
//平台用户直接余额扣钱
if(user !=null && user.getData() !=null ){
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
String phone =userMessage.get("phone").toString();
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("time", xhpcPlaceholderOrder.getTotalTimeSpan()+"");
paramMap.put("sumMoney",totalMoney1.toString());
paramMap.put("number", number+"");
paramMap.put("phone", phone);
paramMap.put("content", "尊敬的用户,你的爱车已停止充电"+xhpcPlaceholderOrder.getTotalTimeSpan()+"分钟前30分钟免费平台收取本次设备占用费"+totalMoney1+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,试运行期间前三次免费,当前免费次数为"+number+",充电结束请及时挪车。");
smsService.sendNotice(paramMap);
}
xhpcPlaceholderOrder.setActPrice(new BigDecimal(0));
xhpcPlaceholderOrder.setActStatus(1);
}
}else{
xhpcPlaceholderOrder.setActPrice(new BigDecimal(0));
xhpcPlaceholderOrder.setActStatus(1);
}
}
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
}
}
@ -369,6 +458,44 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
return list;
}
@Override
public List<Map<String, Object>> getAbnormalListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, 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 confirmResult) {
Integer number = 0;
if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) {
number = 3;
} else if (!"".equals(phone) && phone != null && source == null) {
number = 1;
} else if (phone == null && source != null) {
number = 2;
}
//获取登陆用户
Long logUserId = SecurityUtils.getUserId();
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
//桩的统计该时段金额
List<Map<String, Object>> list = new ArrayList<>();
if (!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())) {
startPage();
if (UserTypeUtil.SYS_SUPER_TYPE_ONE.equals(loginUser.getSuperType())) {
tenantId = loginUser.getTenantId();
Long logOperatorId = sysUser.getOperatorId();
list = xhpcPlaceholderOrderMapper.getAbnormalListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())) {
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
list = xhpcPlaceholderOrderMapper.getAbnormalListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
} else {
list = xhpcPlaceholderOrderMapper.getAbnormalListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
} else {
startPage();
list = xhpcPlaceholderOrderMapper.getAbnormalListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
return list;
}
@Override
public void export(HttpServletResponse response, String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, 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 confirmResult) throws IOException {
@ -702,6 +829,67 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
xhpcPlaceholderOrderMapper.getAbnormal();
}
@Override
public void getAbnormalTime() {
List<Map<String, Object>> mapList = xhpcPlaceholderOrderMapper.getAbnormalTimeList();
for (int i = 0; i < mapList.size(); i++) {
Map<String, Object> map = mapList.get(i);
BigDecimal totalPrice = new BigDecimal(map.get("totalPrice").toString());
XhpcPlaceholderOrder xhpcPlaceholderOrder =new XhpcPlaceholderOrder();
xhpcPlaceholderOrder.setPlaceholderOrderId(Long.parseLong(map.get("placeholderOrderId").toString()));
int source = Integer.parseInt(map.get("source").toString());
if( source!=1) {
if (0 == source) {
xhpcPlaceholderOrder.setChargingMode("C端用户");
} else if (2 == source) {
xhpcPlaceholderOrder.setChargingMode("社区用户");
} else {
xhpcPlaceholderOrder.setChargingMode("B端用户");
}
}
xhpcPlaceholderOrder.setSerialNumber(map.get("serialNumber").toString());
xhpcPlaceholderOrder.setTenantId(map.get("tenantId").toString());
if(map.get("startTime").toString().length()==19){
xhpcPlaceholderOrder.setStartTime(DateUtil.parse(map.get("startTime").toString().replace("T", " ")));
}else{
xhpcPlaceholderOrder.setStartTime(DateUtil.parse(map.get("startTime").toString()));
}
if(new BigDecimal(0).compareTo(totalPrice)==0){
if(map.get("startTime").toString().length()==19){
xhpcPlaceholderOrder.setEndTime(DateUtil.parse(map.get("startTime").toString().replace("T", " ")));
}else{
xhpcPlaceholderOrder.setEndTime(DateUtil.parse(map.get("startTime").toString()));
}
xhpcPlaceholderOrder.setTotalTimeSpan(0);
xhpcPlaceholderOrder.setOvertimePrice(new BigDecimal(0));
xhpcPlaceholderOrder.setTotalMoney(new BigDecimal(0));
xhpcPlaceholderOrder.setType(1);
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
}else{
Map<String, Object> map1 = xhpcPlaceholderOrderMapper.getXhpcDeviceMessage(xhpcPlaceholderOrder.getSerialNumber().substring(0,16), 0, xhpcPlaceholderOrder.getTenantId(),xhpcPlaceholderOrder.getStartTime());
if(map1 !=null && map1.get("createTime") !=null){
System.out.println(map1.get("createTime").toString());
if(map1.get("createTime").toString().length()==19){
getExamine(xhpcPlaceholderOrder.getPlaceholderOrderId(),null,DateUtil.format(xhpcPlaceholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"),DateUtil.format(DateUtil.parse(map1.get("createTime").toString().replace("T"," "), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss"));
}else{
getExamine(xhpcPlaceholderOrder.getPlaceholderOrderId(),null,DateUtil.format(xhpcPlaceholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"),DateUtil.format(DateUtil.parse(map1.get("createTime").toString(), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss"));
}
}else{
// if(map.get("startTime").toString().length()==19){
// xhpcPlaceholderOrder.setEndTime(DateUtil.parse(map.get("startTime").toString().replace("T", " ")));
// }else{
// xhpcPlaceholderOrder.setEndTime(DateUtil.parse(map.get("startTime").toString()));
// }
// xhpcPlaceholderOrder.setTotalTimeSpan(0);
// xhpcPlaceholderOrder.setOvertimePrice(new BigDecimal(0));
// xhpcPlaceholderOrder.setTotalMoney(new BigDecimal(0));
xhpcPlaceholderOrder.setType(3);
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
}
}
}
}
@Override
public R getPlaceholderIDs(String[] stationIDs) {
@ -721,19 +909,672 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
}
@Override
public AjaxResult getExamine(Long placeholderOrderId, BigDecimal totalMoney, String startTime, String endTime) {
public AjaxResult getExamine(Long placeholderOrderId, BigDecimal totalMoneyYu, String startTimeYu, String endTimeYu) {
XhpcPlaceholderOrder placeholderOrder=new XhpcPlaceholderOrder();
placeholderOrder.setPlaceholderOrderId(placeholderOrderId);
placeholderOrder.setTotalMoney(totalMoney);
placeholderOrder.setStartTime(DateUtil.parse(startTime,"yyyy-MM-dd HH:mm:ss"));
placeholderOrder.setEndTime(DateUtil.parse(endTime,"yyyy-MM-dd HH:mm:ss"));
placeholderOrder.setType(1);
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(placeholderOrder);
XhpcPlaceholderOrder xhpcPlaceholderOrder=xhpcPlaceholderOrderMapper.getByPlaceholderOrderId(placeholderOrderId);
xhpcPlaceholderOrder.setPlaceholderOrderId(placeholderOrderId);
xhpcPlaceholderOrder.setStartTime(DateUtil.parse(startTimeYu,"yyyy-MM-dd HH:mm:ss"));
xhpcPlaceholderOrder.setEndTime(DateUtil.parse(endTimeYu,"yyyy-MM-dd HH:mm:ss"));
xhpcPlaceholderOrder.setTotalTimeSpan((int) DateUtil.between(xhpcPlaceholderOrder.getStartTime(), xhpcPlaceholderOrder.getEndTime(), DateUnit.MINUTE));
xhpcPlaceholderOrder.setType(1);
DateTime startTime = DateUtil.parse(DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss");
DateTime endTime = DateUtil.parse(DateUtil.format(xhpcPlaceholderOrder.getEndTime(), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss");
String start = DateUtil.formatTime(startTime);
String end = DateUtil.formatTime(endTime);
DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd");
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
long between = DateUtil.between(endTime, startTime, DateUnit.MINUTE);
xhpcPlaceholderOrder.setEndTime(endTime);
xhpcPlaceholderOrder.setTotalTimeSpan((int) between);
BigDecimal totalMoney = new BigDecimal("0.0");
int freeTime = (int) xhpcPlaceholderOrder.getFreeTime();
if (freeTime - between > 0) {
between = 0L;
} else{
between = between - freeTime;
if (betweenDay > 0) {
for (int m = 0; m <= betweenDay; m++) {
if(m==0){
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, "23:59:59", xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse(start, pattern).getTime();
Long endOne = DateUtil.parse("23:59:59", pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse(start, pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse("23:59:59", pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
}else if(m>0 && m<betweenDay){
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime("00:00:00", "23:59:59", xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse("00:00:00", pattern).getTime();
Long endOne = DateUtil.parse("23:59:59", pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse("00:00:00", pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse("23:59:59", pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
}else{
List<XhpcPlaceholderTime> xhpcPlaceholderTimeTwo = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime("00:00:00", end, xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeTwo.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeTwo.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse("00:00:00", pattern).getTime();
Long endOne = DateUtil.parse(end, pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse("00:00:00", pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse(end, pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
}
}
}else {
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, end, xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse(start, pattern).getTime();
Long endOne = DateUtil.parse(end, pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse(start, pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse(end, pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
}
}
if(totalMoney.compareTo(new BigDecimal(50)) == 1){
totalMoney = new BigDecimal(50);
}
xhpcPlaceholderOrder.setTotalMoney(totalMoney);
if (new BigDecimal(0).compareTo(new BigDecimal(between)) == -1) {
xhpcPlaceholderOrder.setOvertimePrice(totalMoney.divide(new BigDecimal(between), 2, BigDecimal.ROUND_HALF_UP));
} else {
xhpcPlaceholderOrder.setOvertimePrice(new BigDecimal("0.0"));
}
//xhpcPlaceholderOrder.setTotalMoney(totalMoneyYu);
if(xhpcPlaceholderOrder.getSource() !=1){
Long userId = xhpcPlaceholderOrder.getUserId();
Integer source = xhpcPlaceholderOrder.getSource();
String tenantId = xhpcPlaceholderOrder.getTenantId();
BigDecimal totalMoney1 = xhpcPlaceholderOrder.getTotalMoney();
if(0 == xhpcPlaceholderOrder.getSource()){
xhpcPlaceholderOrder.setChargingMode("C端用户");
}else if(2 == xhpcPlaceholderOrder.getSource()){
xhpcPlaceholderOrder.setChargingMode("社区用户");
}else{
xhpcPlaceholderOrder.setChargingMode("B端用户");
}
if(totalMoney1.compareTo(new BigDecimal(0))>0){
String key ="placeholderOrder:" +source+ tenantId+userId;
int number =0;
if(redisService.getCacheObject(key) !=null){
String numberYu = redisService.getCacheObject(key).toString();
int numbers =Integer.parseInt(numberYu);
numbers++;
number=numbers;
redisService.setCacheObject(key, numbers);
}else{
redisService.setCacheObject(key, 1);
number=1;
}
R user = userTypeService.getUser(null, userId, source, null, tenantId);
if(number>3){
if(user !=null && user.getData() !=null ){
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
String phone =userMessage.get("phone").toString();
BigDecimal balance1 =new BigDecimal(userMessage.get("balance").toString());
BigDecimal subtract = balance1.subtract(totalMoney1);
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract,source,tenantId);
if(i==0){
//扣钱失败
System.out.println("<<<<<<<<<<<<<<<<扣钱失败>>>>userId>>>>>>>>>>>>>"+userId+">>subtract>>>>>>>>"+subtract+">>balance1>>>>>>>>"+balance1+">>source>>>>>>>>"+source);
}else{
//添加流水
xhpcChargeOrderService.addUserAccountStatement(userId,totalMoney1, subtract, xhpcPlaceholderOrder.getPlaceholderOrderId(), 7, new Date(),source);
}
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("time", xhpcPlaceholderOrder.getTotalTimeSpan()+"");
paramMap.put("sumMoney",totalMoney1.toString());
paramMap.put("phone", phone);
paramMap.put("content", "尊敬的用户你好,你的爱车已停止充电"+xhpcPlaceholderOrder.getTotalTimeSpan()+"分钟前30分钟免费平台收取本次设备占用费"+totalMoney1+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,充电结束请及时挪车。");
smsService.sendNotice(paramMap);
//平台用户直接余额扣钱
xhpcPlaceholderOrder.setActPrice(xhpcPlaceholderOrder.getTotalMoney());
xhpcPlaceholderOrder.setActStatus(1);
}
}else{
//发送短信
//平台用户直接余额扣钱
if(user !=null && user.getData() !=null ){
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
String phone =userMessage.get("phone").toString();
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("time", xhpcPlaceholderOrder.getTotalTimeSpan()+"");
paramMap.put("sumMoney",totalMoney1.toString());
paramMap.put("number", number+"");
paramMap.put("phone", phone);
paramMap.put("content", "尊敬的用户,你的爱车已停止充电"+xhpcPlaceholderOrder.getTotalTimeSpan()+"分钟前30分钟免费平台收取本次设备占用费"+totalMoney1+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,试运行期间前三次免费,当前免费次数为"+number+",充电结束请及时挪车。");
smsService.sendNotice(paramMap);
}
xhpcPlaceholderOrder.setActPrice(new BigDecimal(0));
xhpcPlaceholderOrder.setActStatus(1);
}
}else{
xhpcPlaceholderOrder.setActPrice(new BigDecimal(0));
xhpcPlaceholderOrder.setActStatus(1);
}
}
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
return AjaxResult.success();
}
@Override
public List<Map<String, Object>> getSumSourceList(HttpServletRequest request, String tenantId, Long operatorId, Long chargingStationId, Long chargingPileId, Long terminalId, String startTime, String endTime, String sourceIds, String chargingStationIds) {
List<String> sourceList =new ArrayList<>();
if(!"".equals(sourceIds) && sourceIds !=null){
sourceList= Arrays.asList(sourceIds.split(","));
}
List<String> chargingStationIdList =new ArrayList<>();
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
chargingStationIdList= Arrays.asList(chargingStationIds.split(","));
}
LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
Long sysUserId = sysUser.getUserId();
List<Map<String, Object>> list =new ArrayList<>();
if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){
//运维管理人员
startPage();
list = xhpcPlaceholderOrderMapper.getSumSourceList(operatorId,chargingStationId,chargingPileId,terminalId,startTime, endTime, sourceList, chargingStationIdList,tenantId,sysUserId,2);
}else{
if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){
list = xhpcPlaceholderOrderMapper.getSumSourceList(operatorId,chargingStationId,chargingPileId,terminalId,startTime, endTime, sourceList, chargingStationIdList,loginUser.getTenantId(),sysUserId,0);
}else{
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
startPage();
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
list = xhpcPlaceholderOrderMapper.getSumSourceList(operatorId,chargingStationId,chargingPileId,terminalId,startTime, endTime, sourceList,chargingStationIdList,tenantId,logOperatorId,1);
}else{
//查询赋值的场站
list = xhpcPlaceholderOrderMapper.getSumSourceList(operatorId,chargingStationId,chargingPileId,terminalId,startTime, endTime, sourceList, chargingStationIdList,tenantId,sysUserId,2);
}
}else{
startPage();
list = xhpcPlaceholderOrderMapper.getSumSourceList(operatorId,chargingStationId,chargingPileId,terminalId,startTime, endTime, sourceList, chargingStationIdList,tenantId,sysUserId,0);
}
}
}
return list;
}
@Override
public void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long operatorId,Long chargingStationId,Long chargingPileId,Long terminalId, String startTime, String endTime, String sourceIds, String chargingStationIds) throws IOException {
List<Map<String, Object>> list = getSumSourceList(request,tenantId,operatorId,chargingStationId,chargingPileId,terminalId,startTime, endTime, sourceIds,chargingStationIds);
// 通过工具类创建writer默认创建xls格式
BigExcelWriter writer = ExcelUtil.getBigWriter("temp_" + System.currentTimeMillis() + ".xlsx");
writer.addHeaderAlias("kudaiDianMoney", "快电总费用");
writer.addHeaderAlias("henDaMoney", "恒大总费用");
writer.addHeaderAlias("xinDianTuMoney", "新电途总费用");
writer.addHeaderAlias("refundMoney", "新电途退款费用");
writer.addHeaderAlias("refundMoney", "新电途用户已支付费用");
writer.addHeaderAlias("xiaoJuMoney", "小桔总费用");
writer.addHeaderAlias("cheWeiJiaMoney", "车为家总费用");
writer.addHeaderAlias("sourceName", "用户类型");
// 默认的未添加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);
}
@Override
public List<Map<String, Object>> getDateIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
List<String> chargingStationIdList =new ArrayList<>();
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
chargingStationIdList= Arrays.asList(chargingStationIds.split(","));
}
//获取登陆用户
LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
Long sysUserId = sysUser.getUserId();
//获取登陆用户
List<Map<String, Object>> list =new ArrayList<>();
if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){
//运维管理人员
startPage();
list = xhpcPlaceholderOrderMapper.getDateIntervalPage(chargingStationId,chargingPileId,terminalId,chargingStationIdList, internetUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
}else{
if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){
list =xhpcPlaceholderOrderMapper.getDateIntervalPage(chargingStationId,chargingPileId,terminalId,chargingStationIdList, internetUserId, operatorId, startTime, endTime, 0,sysUserId,loginUser.getTenantId());
}else{
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
startPage();
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
list = xhpcPlaceholderOrderMapper.getDateIntervalPage(chargingStationId,chargingPileId,terminalId, chargingStationIdList,internetUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId);
}else{
//查询赋值的场站
list = xhpcPlaceholderOrderMapper.getDateIntervalPage(chargingStationId,chargingPileId,terminalId,chargingStationIdList, internetUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
}
}else{
startPage();
list =xhpcPlaceholderOrderMapper.getDateIntervalPage(chargingStationId,chargingPileId,terminalId,chargingStationIdList, internetUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId);
}
}
}
return list;
}
@Override
public void dateIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list =new ArrayList<>();
//获取登陆用户
list = getDateIntervalPage(request,tenantId,chargingStationId,chargingPileId,terminalId,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
// 通过工具类创建writer默认创建xls格式
BigExcelWriter writer = ExcelUtil.getBigWriter("temp_" + System.currentTimeMillis() + ".xlsx");
writer.addHeaderAlias("createTime", "日期");
writer.addHeaderAlias("kudaiDianMoney", "快电总费用");
writer.addHeaderAlias("henDaMoney", "恒大总费用");
writer.addHeaderAlias("xinDianTuMoney", "新电途总费用");
writer.addHeaderAlias("refundMoney", "新电途退款费用");
writer.addHeaderAlias("refundMoney", "新电途用户已支付费用");
writer.addHeaderAlias("xiaoJuMoney", "小桔总费用");
writer.addHeaderAlias("cheWeiJiaMoney", "车为家总费用");
writer.addHeaderAlias("actPrice", "C端用户总用");
// 默认的未添加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);
}
@Override
public List<Map<String, Object>> getStationIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds, String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
List<String> chargingStationIdList =new ArrayList<>();
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
chargingStationIdList= Arrays.asList(chargingStationIds.split(","));
}
List<String> operatorUserId =new ArrayList<>();
if(!"".equals(operatorIds) && operatorIds !=null){
operatorUserId= Arrays.asList(operatorIds.split(","));
}
LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
Long sysUserId = sysUser.getUserId();
List<Map<String, Object>> list =new ArrayList<>();
if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){
//运维管理人员
startPage();
list = xhpcPlaceholderOrderMapper.getStationIntervalPage(chargingStationId,chargingPileId,terminalId,chargingStationIdList,operatorUserId,internetUserId,operatorId,startTime,endTime,2,sysUserId,tenantId);
}else{
if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){
list =xhpcPlaceholderOrderMapper.getStationIntervalPage(chargingStationId,chargingPileId,terminalId,chargingStationIdList,operatorUserId,internetUserId,operatorId,startTime,endTime,0,sysUserId,loginUser.getTenantId());
}else{
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
startPage();
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
list = xhpcPlaceholderOrderMapper.getStationIntervalPage(chargingStationId,chargingPileId,terminalId,chargingStationIdList,operatorUserId,internetUserId,operatorId,startTime,endTime,1,logOperatorId,tenantId);
}else{
//查询赋值的场站
list = xhpcPlaceholderOrderMapper.getStationIntervalPage(chargingStationId,chargingPileId,terminalId,chargingStationIdList,operatorUserId,internetUserId,operatorId,startTime,endTime,2,sysUserId,tenantId);
}
}else{
startPage();
list =xhpcPlaceholderOrderMapper.getStationIntervalPage(chargingStationId,chargingPileId,terminalId,chargingStationIdList,operatorUserId,internetUserId,operatorId,startTime,endTime,0,sysUserId,tenantId);
}
}
}
return list;
}
@Override
public void stationIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list =new ArrayList<>();
list =getStationIntervalPage(request,tenantId,chargingStationId,chargingPileId,terminalId,chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type);
// 通过工具类创建writer默认创建xls格式
BigExcelWriter writer = ExcelUtil.getBigWriter("temp_" + System.currentTimeMillis() + ".xlsx");
writer.addHeaderAlias("chargingStationName", "电站名称");
writer.addHeaderAlias("operatorName", "运营商名称");
writer.addHeaderAlias("kudaiDianMoney", "快电总费用");
writer.addHeaderAlias("henDaMoney", "恒大总费用");
writer.addHeaderAlias("xinDianTuMoney", "新电途总费用");
writer.addHeaderAlias("refundMoney", "新电途退款费用");
writer.addHeaderAlias("refundMoney", "新电途用户已支付费用");
writer.addHeaderAlias("xiaoJuMoney", "小桔总费用");
writer.addHeaderAlias("cheWeiJiaMoney", "车为家总费用");
writer.addHeaderAlias("CDuanMoney", "C端用户总用");
writer.addHeaderAlias("sheQuMoney", "社区总费用");
writer.addHeaderAlias("BDuanMoney", "B端总费用");
// 默认的未添加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);
}
@Override
public List<Map<String, Object>> appealPlaceholderOrderList(HttpServletRequest request) {
//获取登陆用户
LoginUser loginUser = tokenService.getLoginUser(request);
String tenantId = loginUser.getTenantId();
return xhpcPlaceholderOrderMapper.appealPlaceholderOrderList(loginUser.getUserid(),loginUser.getUserType(),tenantId);
}
@Override
public R applyPlaceholderOrder(HttpServletRequest request, Long placeholderOrderId, String appealUserResult) {
XhpcPlaceholderOrder placeholderOrder = xhpcPlaceholderOrderMapper.getByPlaceholderOrderId(placeholderOrderId);
if(placeholderOrder.getAppealStatus() !=0){
return R.fail("该占位费订单已申述过");
}
XhpcPlaceholderOrder xhpcPlaceholderOrder = new XhpcPlaceholderOrder();
xhpcPlaceholderOrder.setPlaceholderOrderId(placeholderOrderId);
xhpcPlaceholderOrder.setAppealUserResult(appealUserResult);
xhpcPlaceholderOrder.setAppealStatus(1);
xhpcPlaceholderOrder.setAppealTime(new Date());
int i = xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
if(i>0){
return R.ok();
}
return R.fail("申述失败,请稍后再申述");
}
@Override
public R applyPlaceholderOrderProcess(HttpServletRequest request, Long placeholderOrderId, BigDecimal actPrice,String refundType,String appealResult) {
XhpcPlaceholderOrder placeholderOrder = xhpcPlaceholderOrderMapper.getByPlaceholderOrderId(placeholderOrderId);
XhpcPlaceholderOrder xhpcPlaceholderOrder = new XhpcPlaceholderOrder();
xhpcPlaceholderOrder.setPlaceholderOrderId(placeholderOrderId);
xhpcPlaceholderOrder.setAppealResult(appealResult);
xhpcPlaceholderOrder.setAppealProcessTime(new Date());
BigDecimal subtractYu=new BigDecimal(0);
if(!"reject".equals(refundType)){
//申述成功用户进行充值金额
xhpcPlaceholderOrder.setAppealStatus(2);
if(placeholderOrder.getActPrice().compareTo(actPrice)==1){
//剩余金额
subtractYu = actPrice;
xhpcPlaceholderOrder.setActPrice(placeholderOrder.getActPrice().subtract(actPrice));
}else {
subtractYu = placeholderOrder.getActPrice();
xhpcPlaceholderOrder.setActPrice(new BigDecimal(0));
}
xhpcPlaceholderOrder.setAppealRefundMoney(actPrice);
int i = xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
if(i>0){
Long userId = placeholderOrder.getUserId();
Integer source = placeholderOrder.getSource();
String tenantId = placeholderOrder.getTenantId();
//用户进行发送红包
R user = userTypeService.getUser(null, userId, source, null, tenantId);
if(user !=null && user.getData() !=null ){
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
BigDecimal balance1 =new BigDecimal(userMessage.get("balance").toString());
BigDecimal subtract = balance1.add(subtractYu);
int y = xhpcChargeOrderService.updateUserBalance(userId, subtract, source,tenantId);
if(y==0){
//增加金额失败
System.out.println("<<<<<<<<<<<<<<<<增加金额失败>>>>placeholderOrder.getSernumber>>>>>>>>>>>>>"+placeholderOrder.getSerialNumber());
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}else{
//添加流水
xhpcChargeOrderService.addUserAccountStatement(userId,subtractYu, subtract, xhpcPlaceholderOrder.getPlaceholderOrderId(), 7, new Date(),source);
}
}
return R.ok();
}
}else{
//申述失败
xhpcPlaceholderOrder.setAppealStatus(3);
int i = xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
if(i>0){
return R.ok();
}
}
return R.fail("申述失败,请稍后再申述");
}
@Override
public List<Map<String, Object>> appealPlaceholderOrderListPC(HttpServletRequest request, String tenantId, Long operatorId, String name, Integer type, String serialNumber, Long chargingStationId) {
LoginUser loginUser = tokenService.getLoginUser(request);
//获取登陆用户
SysUser sysUser = loginUser.getSysUser();
Long userId = sysUser.getUserId();
//桩的统计该时段金额
List<Map<String, Object>> list =new ArrayList<>();
if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){
//运维管理人员
startPage();
return xhpcPlaceholderOrderMapper.appealPlaceholderOrderListPC(operatorId,name, type, serialNumber, chargingStationId,userId,2,tenantId);
}else{
if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){
list= xhpcPlaceholderOrderMapper.appealPlaceholderOrderListPC(operatorId,name, type, serialNumber, chargingStationId,userId,0,loginUser.getTenantId());
}else{
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
list= xhpcPlaceholderOrderMapper.appealPlaceholderOrderListPC(operatorId,name, type, serialNumber, chargingStationId,logOperatorId,1,tenantId);
}else{
//查询赋值的场站
list= xhpcPlaceholderOrderMapper.appealPlaceholderOrderListPC(operatorId,name, type, serialNumber, chargingStationId,userId,2,tenantId);
}
}else{
list= xhpcPlaceholderOrderMapper.appealPlaceholderOrderListPC(operatorId,name, type, serialNumber, chargingStationId,userId,0,tenantId);
}
}
}
return list;
}
public static void main(String[] args) {
System.out.println("MA005DBW1250704215222124198".substring(0,9));
System.out.println("80836000100006022509051657454064".substring(0,16));
}
}

View File

@ -677,6 +677,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
if("小桔".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("4");
}
if("车为家".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("7");
}
xhpcHistoryOrder.setStartTime(xhpcChargeOrder.getStartTime());
if(xhpcChargeOrder.getEndTime()==null ){
xhpcHistoryOrder.setEndTime(xhpcChargeOrder.getStartTime());
@ -1623,7 +1626,18 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
if(xhpcPlaceholderMap !=null){
//占位订单生成
XhpcPlaceholderOrder placeholderOrder = new XhpcPlaceholderOrder();
placeholderOrder.setChargingMode(xhpcHistoryOrder.getChargingMode());
if(xhpcHistoryOrder.getSource() !=1){
if(0 == xhpcHistoryOrder.getSource()){
placeholderOrder.setChargingMode("C端用户");
}else if(2 == xhpcHistoryOrder.getSource()){
placeholderOrder.setChargingMode("社区用户");
}else{
placeholderOrder.setChargingMode("B端用户");
}
}else{
placeholderOrder.setChargingMode(xhpcHistoryOrder.getChargingMode());
}
placeholderOrder.setDriverId(xhpcChargeOrder.getDriverId());
placeholderOrder.setHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
placeholderOrder.setChargingStationId(xhpcHistoryOrder.getChargingStationId());
@ -1981,7 +1995,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
if("小桔".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("4");
}
if("车为家".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("7");
}
Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+xhpcChargeOrder.getSerialNumber());
if(pushOrder !=null){
if(pushOrder.get("operatorId3rdpty") !=null){

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -666,6 +666,11 @@
values (#{userId}, #{amount}, #{remainingSum}, #{chargeOrderId}, #{type}, #{date},#{source})
</insert>
<insert id="insertUserAccountStatementPlaceholder">
INSERT INTO xhpc_user_account_statement(user_id, amount, remaining_sum, placeholder_order_id, type, create_time,source)
values (#{userId}, #{amount}, #{remainingSum}, #{placeholderOrderId}, #{type}, #{date},#{source})
</insert>
<select id="getRateModelId" resultMap="XhpcRateMap">
select *
from xhpc_rate
@ -939,4 +944,8 @@
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if>
</select>
<select id="getXhpcPlaceholderOrderNumber" resultType="int">
select count(placeholder_order_id) number from xhpc_placeholder_order where user_id=#{userId} and source=#{source} and tenant_id=#{tenantId} and total_money &gt; 0
</select>
</mapper>

View File

@ -917,6 +917,11 @@
ho.act_price as actPrice,
ho.total_power as chargingDegree,
co.charging_time as chargingTime,
xpo.start_time as placeholderStartTime,
xpo.end_time as placeholderEndTime,
xpo.total_time_span as placeholderTotalTimeSpen,
xpo.total_money as placeholderTotalMoney,
xpo.type as placeholderType,
case when ho.parking_voucher=1 then '否'
else '是'
end as 'barrierGateRecordName'
@ -924,6 +929,7 @@
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id
left join xhpc_placeholder_order as xpo on ho.history_order_id = xpo.history_order_id
where ho.status=0 and ho.del_flag=0 and ho.user_id =#{userId}
<if test="tenantId !=null and tenantId !=''">
and ho.tenant_id =#{tenantId}
@ -959,6 +965,11 @@
te.serial_number as terminalSerialNumber,
co.Plate_num as plateNum,
ho.stop_reason_evcs as typeName,
xpo.start_time as placeholderStartTime,
xpo.end_time as placeholderEndTime,
xpo.total_time_span as placeholderTotalTimeSpen,
xpo.total_money as placeholderTotalMoney,
xpo.type as placeholderType,
case when ho.parking_voucher=2 then '是'
else '否'
end as 'barrierGateRecordName'
@ -966,6 +977,7 @@
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id
left join xhpc_placeholder_order as xpo on ho.history_order_id = xpo.history_order_id
where ho.status=0 and ho.del_flag=0
<if test="userId !=null">
and ho.user_id =#{userId}

View File

@ -41,13 +41,23 @@
<result column="charging_mode" property="chargingMode"/>
<result column="driver_id" property="driverId"/>
<result column="plate_num" property="plateNum"/>
<result column="search_value" property="searchValue"/>
<result column="type" property="type"/>
<result column="operator_id_evcs" property="operatorIdEvcs"/>
<result column="user_status" property="userStatus"/>
<result column="recharge_money" property="rechargeMoney"/>
<result column="refund_money" property="refundMoney"/>
<result column="internet_id_evcs" property="internetIdEvcs"/>
<result column="act_price" property="actPrice"/>
<result column="act_status" property="actStatus"/>
<result column="appeal_status" property="appealStatus"/>
<result column="appeal_user_result" property="appealUserResult"/>
<result column="appeal_result" property="appealResult"/>
<result column="appeal_time" property="appealTime"/>
<result column="appeal_process_time" property="appealProcessTime"/>
<result column="appeal_refund_money" property="appealRefundMoney"/>
</resultMap>
<insert id="insertXhpcPlaceholderOrder" parameterType="com.xhpc.order.domain.XhpcPlaceholderOrder"
useGeneratedKeys="true" keyProperty="placeholderOrderId">
insert into xhpc_placeholder_order
@ -259,6 +269,10 @@
select * from xhpc_placeholder_order where serial_number =#{serialNumber} and del_flag =0 and type =0
</select>
<select id="getXhpcChargeOrderStatus" resultType="int">
select status from xhpc_charge_order where serial_number=#{serialNumber}
</select>
<select id="getXhpcPlaceholderTime" resultType="com.xhpc.common.domain.XhpcPlaceholderTime">
select
start_time as startTime,
@ -301,6 +315,33 @@
<if test="type != null">
type = #{type},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="actPrice != null">
act_price = #{actPrice},
</if>
<if test="actStatus != null">
act_status = #{actStatus},
</if>
<if test="appealStatus != null">
appeal_status = #{appealStatus},
</if>
<if test="appealUserResult != null">
appeal_user_result = #{appealUserResult},
</if>
<if test="appealResult != null">
appeal_result = #{appealResult},
</if>
<if test="appealTime != null">
appeal_time = #{appealTime},
</if>
<if test="appealProcessTime != null">
appeal_process_time = #{appealProcessTime},
</if>
<if test="appealRefundMoney !=null">
appeal_refund_money =#{appealRefundMoney}
</if>
</set>
where placeholder_order_id = #{placeholderOrderId}
</update>
@ -468,6 +509,166 @@
order by ho.create_time desc
</select>
<select id="getAbnormalListPage" resultType="map">
select
ho.placeholder_order_id as placeholderOrderId,
ho.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.power as power,
cp.type as type,
ho.internet_serial_number as internetSerialNumber,
ho.start_time as startTime,
ho.end_time as endTime,
ho.source as source,
TIMESTAMPDIFF(MINUTE, IFNULL(ho.start_time, NOW()), NOW()) minutes,
case when ho.source=0 then "C端用户"
when ho.source=1 then "流量方用户"
when ho.source=2 then "社区用户"
else "B端客户!"
end sourceName,
case when ho.confirm_Result=-2 then "未推送"
when ho.confirm_Result=-1 then "已推送占位中订单"
when ho.confirm_Result=0 then "推送已完成"
else "争议订单!"
end confirmResultName,
ho.free_time as freeTime,
ho.max_fee as maxFee,
ho.total_time_span as totalTimeSpan,
ho.placeholder_order_number as placeholderOrderNumber,
TIMESTAMPDIFF(MINUTE, IFNULL(ho.start_time, NOW()), NOW()) minutes,
case when ho.status=1 then "占位中"
when ho.status=2 then "等待"
when ho.status=3 then "已完成"
when ho.status=4 then "取消"
when ho.status=9 then "已结束"
else "已支付"
end statusName,
case when ho.bill_equipment=1 then "充电桩"
when ho.bill_equipment=2 then "地锁"
when ho.bill_equipment=3 then "车位监控"
else "道闸"
end billEquipmentName,
ho.total_time_span as totalTimeSpan,
ho.total_money as totalMoney,
ho.price as price,
inu.name as internetName,
apu.phone as appUserPhone,
cop.account as communityAccount,
cup.account as customersAccount,
ho.driver_id as internetUserPhone,
ho.plate_num as plateNum,
case when ho.charging_mode="1" then "快电"
when ho.charging_mode="2" then "恒大"
when ho.charging_mode="3" then "新电途"
when ho.charging_mode="4" then "小桔"
when ho.charging_mode="微信" then "微信"
when ho.charging_mode="支付宝" then "支付宝"
when ho.charging_mode="App" then "App"
when ho.charging_mode="刷卡" then "刷卡"
else "vin码"
end chargingModeName
from xhpc_placeholder_order as ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null and ho.source=1
left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null and ho.source=0
left join xhpc_community_personnel as cop on cop.community_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=2
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=3
where ho.del_flag=0 and (ho.type=2 or ho.type=3)
<if test="chargingStationId !=null">
and ho.charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and ho.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId} and del_flag=0)
</if>
<if test="terminalId !=null">
and ho.terminal_id=#{terminalId}
</if>
<if test="confirmResult !=null">
and ho.confirm_Result =#{confirmResult}
</if>
<if test="source !=null">
and ho.source=#{source}
</if>
<if test="internetId !=null">
and inu.internet_user_id=#{internetId}
</if>
<if test="internetSerialNumber !=null and internetSerialNumber !=''">
and ho.internet_serial_number like concat('%', #{internetSerialNumber}, '%')
</if>
<if test="terminalName !=null and terminalName !=''">
and ter.name like concat(#{terminalName}, '%')
</if>
<if test="beginStartTime !=null and beginStartTime !=''">
and ho.start_time &gt;= #{beginStartTime}
</if>
<if test="beginEndTime !=null and beginEndTime !=''">
and ho.start_time &lt;= #{beginEndTime}
</if>
<if test="overStartTime !=null and overStartTime !=''">
and ho.end_time &gt;= #{overStartTime}
</if>
<if test="overEndTime !=null and overEndTime !=''">
and ho.end_time &lt;= #{overEndTime}
</if>
<if test="transactionNumber !=null and transactionNumber !=''">
and ho.serial_number like concat('%', #{transactionNumber}, '%')
</if>
<if test="operatorId !=null">
and ho.operator_id =#{operatorId}
</if>
<if test="number==2">
<if test="source ==0">
and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0)
</if>
<if test="source ==1">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1)
</if>
<if test="source ==2">
and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2)
</if>
<if test="source ==3">
and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3)
</if>
</if>
<if test="number==3">
<if test="source ==0">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0 and xau.phone LIKE concat('%',#{phone}, '%'))
</if>
<if test="source ==1">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1 and xiu.phone LIKE concat('%',#{phone}, '%'))
</if>
<if test="source ==2">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2 and xcp.account LIKE concat('%',#{phone}, '%'))
</if>
<if test="source ==3">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%'))
</if>
</if>
<if test="status==1">
and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<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>
<if test="tenantId !=null and '' !=tenantId">
and ho.tenant_id=#{tenantId}
</if>
<!-- <if test="isNotNull==1">-->
<!-- and ho.total_price &gt;=0-->
<!-- </if>-->
order by ho.create_time desc
</select>
<select id="getById" resultType="map">
select
@ -692,7 +893,289 @@
</select>
<update id="getAbnormal">
update xhpc_placeholder_order set type=2 where TIMESTAMPDIFF(MINUTE, IFNULL(start_time, NOW()), NOW()) &gt; 720 and (status=1 or status=2) and type =0
update xhpc_placeholder_order set type=2 where TIMESTAMPDIFF(MINUTE, IFNULL(start_time, NOW()), NOW()) &gt; 360 and (status=1 or status=2) and type =0
</update>
<select id="getAbnormalTime" resultMap="xhpcPlaceholderOrderMap">
select * from xhpc_placeholder_order where type=2 limit 1
</select>
<select id="getAbnormalTimeList" resultType="map">
select
ifnull(xho.total_price,0) as totalPrice,
xpo.serial_number as serialNumber,
xho.tenant_id as tenantId,
DATE_FORMAT( xho.start_time, "%Y-%m-%d %H:%i:%s" ) startTime,
xho.source as source,
xpo.placeholder_order_id as placeholderOrderId
from xhpc_placeholder_order xpo
left join xhpc_history_order xho on xpo.history_order_id = xho.history_order_id
where xpo.type=2 limit 10
</select>
<select id="getXhpcPlaceholderOrderNumber" resultType="int">
select count(placeholder_order_id) number from xhpc_placeholder_order where user_id=#{userId} and source=#{source} and tenant_id=#{tenantId} and total_money &gt; 0 and type =1
</select>
<select id="getByPlaceholderOrderId" resultMap="xhpcPlaceholderOrderMap">
select * from xhpc_placeholder_order where placeholder_order_id=#{placeholderOrderId}
</select>
<select id="getXhpcDeviceMessage" resultType="map">
SELECT create_time
FROM xhpc_device_message
WHERE gun_number = #{chargeOrderNo}
AND create_time &gt;=#{createTime}
AND charge_order_no = '00000000000000000000000000000000'
AND gun_status = 0
AND device_message_id &lt; (SELECT MIN(device_message_id) as first_non_zero_id
FROM xhpc_device_message
WHERE gun_number = #{chargeOrderNo}
AND create_time &gt;=#{createTime}
AND charge_order_no != '00000000000000000000000000000000')
ORDER BY device_message_id DESC
LIMIT 1;
</select>
<select id="getSumSourceList" resultType="map">
select
SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END) AS "kudaiDianMoney",
SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END) AS "henDaMoney",
SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END) AS "xinDianTuMoney",
format(ifnull(sum(ss.refund_money),0), 2) refundMoney,
format(ifnull(sum(ss.recharge_money),0),2) rechargeMoney,
SUM(CASE WHEN ss.charging_mode = 4 THEN total_money ELSE 0 END) AS "xiaoJuMoney",
SUM(CASE WHEN ss.charging_mode = 7 THEN total_money ELSE 0 END) AS "cheWeiJiaMoney",
SUM(CASE WHEN ss.charging_mode = 'C端用户' THEN act_price ELSE 0 END) AS "CDuanMoney",
SUM(CASE WHEN ss.charging_mode = '社区用户' THEN act_price ELSE 0 END) AS "sheQuMoney",
SUM(CASE WHEN ss.charging_mode = 'B端用户' THEN act_price ELSE 0 END) AS "BDuanMoney",
case
when ss.charging_mode=1 then "快电"
when ss.charging_mode=2 then "恒大"
when ss.charging_mode=3 then "新电途"
when ss.charging_mode=4 then "小桔"
when ss.charging_mode=7 then "车为家"
when ss.charging_mode='社区用户' then "社区用户"
when ss.charging_mode='B端用户' then "B端用户"
else "C端用户"
end sourceName
from xhpc_placeholder_order as ss
left join xhpc_charging_station cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_operator xo on cs.operator_id = xo.operator_id
where ss.del_flag=0 and (ss.status=3 or ss.status=9 or ss.status=10) and ss.type=1
<if test="startTime !=null and startTime !=''">
and ss.start_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
and ss.end_time &lt;= #{endTime}
</if>
<if test="operatorId !=null">
and cs.operator_id =#{operatorId}
</if>
<if test="chargingStationId !=null">
and ss.charging_station_id =#{chargingStationId}
</if>
<if test="sourceIds !=null and sourceIds.size()>0">
and ss.charging_mode in
<foreach collection="sourceIds" open="(" item="sourceId" separator="," close=")" >
#{sourceId}
</foreach>
</if>
<if test="chargingStationIdList !=null and chargingStationIdList.size()>0">
and ss.charging_station_id in
<foreach collection="chargingStationIdList" open="(" item="chargingStationId" separator="," close=")" >
#{chargingStationId}
</foreach>
</if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
<if test="number==1">
and ss.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{sysUserId})
</if>
<if test="number==2">
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{sysUserId})
</if>
group by ss.charging_mode
</select>
<select id="getDateIntervalPage" resultType="map">
select
DATE(ss.create_time) AS createTime,
SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END) AS "kudaiDianMoney",
SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END) AS "henDaMoney",
SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END) AS "xinDianTuMoney",
format(ifnull(sum(ss.refund_money),0), 2) refundMoney,
format(ifnull(sum(ss.recharge_money),0),2) rechargeMoney,
SUM(CASE WHEN ss.charging_mode = 4 THEN total_money ELSE 0 END) AS "xiaoJuMoney",
SUM(CASE WHEN ss.charging_mode = 7 THEN total_money ELSE 0 END) AS "cheWeiJiaMoney",
SUM(CASE WHEN ss.source = 0 THEN act_price ELSE 0 END) AS "actPrice"
from xhpc_placeholder_order ss
left join xhpc_charging_station cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_operator xo on cs.operator_id = xo.operator_id
where ss.del_flag=0 and (ss.status=3 or ss.status=9 or ss.status=10) and ss.type=1
<if test="chargingStationIds !=null and chargingStationIds.size()>0">
and ss.charging_station_id in
<foreach collection="chargingStationIds" open="(" item="chargingStationId" separator="," close=")" >
#{chargingStationId}
</foreach>
</if>
<if test="chargingStationId !=null">
and ss.charging_station_id =#{chargingStationId}
</if>
<if test="startTime !=null and startTime !=''">
and ss.start_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
and ss.end_time &lt;= #{endTime}
</if>
<if test="type==1">
and ss.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<if test="type==2">
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
<if test="operatorId !=null">
and cs.operator_id =#{operatorId}
</if>
group by DATE_FORMAT(ss.create_time,'%Y-%m-%d')
order by DATE_FORMAT(ss.create_time,'%Y-%m-%d') desc
</select>
<select id="getStationIntervalPage" resultType="map">
select
SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END) AS "kudaiDianMoney",
SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END) AS "henDaMoney",
SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END) AS "xinDianTuMoney",
format(ifnull(sum(ss.refund_money),0), 2) refundMoney,
format(ifnull(sum(ss.recharge_money),0),2) rechargeMoney,
SUM(CASE WHEN ss.charging_mode = 4 THEN total_money ELSE 0 END) AS "xiaoJuMoney",
SUM(CASE WHEN ss.charging_mode = 7 THEN total_money ELSE 0 END) AS "cheWeiJiaMoney",
SUM(CASE WHEN ss.source = 0 THEN act_price ELSE 0 END) AS "actPrice",
cs.name as chargingStationName,
xo.name operatorName
from xhpc_placeholder_order as ss
left join xhpc_charging_station cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_operator xo on cs.operator_id = xo.operator_id
where ss.del_flag=0 and (ss.status=3 or ss.status=9 or ss.status=10) and ss.type=1
<if test="startTime !=null and startTime !=''">
and ss.start_time &gt;= #{startTime}
</if>
<if test="chargingStationId !=null">
and cs.charging_station_id =#{chargingStationId}
</if>
<if test="endTime !=null and endTime !=''">
and ss.end_time &lt;= #{endTime}
</if>
<if test="operatorUserId !=null and operatorUserId.size()>0">
and xo.operator_id in
<foreach collection="operatorUserId" open="(" item="operatorIds" separator="," close=")" >
#{operatorIds}
</foreach>
</if>
<if test="type==1">
and cs.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<if test="type==2">
and cs.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
<if test="operatorId !=null">
and xo.operator_id =#{operatorId}
</if>
group by ss.charging_station_id
</select>
<select id="getXhpcHistoryOrderMessage" resultType="int">
select count(*) as totalPrice from xhpc_history_order where serial_number =#{serialNumber} and total_price &gt; 0 limit 1
</select>
<select id="appealPlaceholderOrderList" resultType="map">
select
ho.placeholder_order_id as placeholderOrderId,
ho.serial_number as serialNumber,
ct.name as stationName,
ter.name as terminalName,
ho.appeal_refund_money as appealRefundMoney,
ho.start_time as placeholderStartTime,
ho.end_time as placeholderEndTime,
ho.total_time_span as placeholderTotalTimeSpen,
ho.act_price as placeholderTotalMoney,
ho.appeal_status as status,
case when ho.appeal_status=0 then "未申诉"
when ho.appeal_status=1 then "申述中"
when ho.appeal_status=2 then "申述成功"
else "申述失败"
end appealStatusText,
ho.appeal_result as appealResult,
ho.appeal_user_result as appealUserResult,
ho.appeal_time as appealTime,
ho.appeal_process_time as appealProcessTime
from xhpc_placeholder_order ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
where ho.del_flag = 0 and ho.source !=1 and ho.act_status =1 and ho.type =1
and ho.user_id =#{userId} and ho.source=#{source} and ho.tenant_id =#{tenantId}
order by ho.create_time desc limit 200
</select>
<select id="appealPlaceholderOrderListPC" resultType="map">
select
ho.placeholder_order_id as placeholderOrderId,
ho.serial_number as serialNumber,
ct.name as stationName,
ter.name as terminalName,
ho.appeal_refund_money as appealRefundMoney,
concat(cp.name,'号桩') as chargingPileName,
ho.start_time as placeholderStartTime,
ho.end_time as placeholderEndTime,
ho.total_time_span as placeholderTotalTimeSpen,
ho.act_price as placeholderTotalMoney,
ho.appeal_status as status,
case when ho.appeal_status=0 then "未申诉"
when ho.appeal_status=1 then "申述中"
when ho.appeal_status=2 then "申述成功"
else "申述失败"
end appealStatusText,
ho.appeal_result as appealResult,
ho.appeal_user_result as appealUserResult,
ho.appeal_time as appealTime,
ho.appeal_process_time as appealProcessTime
from xhpc_placeholder_order ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
left join xhpc_charging_pile as cp on ter.terminal_id = cp.charging_pile_id
where ho.del_flag = 0 and ho.source !=1 and ho.act_status =1 and ho.type =1 and ho.appeal_status !=0
<if test="name !=null and name !=''">
and cp.name like CONCAT('%',#{name},'%')
</if>
<if test="operatorId !=null">
and ct.operator_id =#{operatorId}
</if>
<if test="serialNumber !=null and serialNumber!=''">
and ho.serial_number=#{serialNumber}
</if>
<if test="chargingStationId !=null and chargingStationId!=''">
and ct.charging_station_id=#{chargingStationId}
</if>
<if test="number !=0 and number ==1">
and ct.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="number !=0 and number ==2">
and ct.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
<if test="tenantId !=null and tenantId !=''">
and ho.tenant_id=#{tenantId}
</if>
order by ho.create_time desc
</select>
</mapper>

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -201,10 +201,6 @@
and xro.source=#{source} and cup.account like concat('%', #{phone}, '%')
</if>
</if>
<if test="source != null">
and xro.source=#{source}
</if>
<if test="rechargeOrderNumber != null and rechargeOrderNumber != ''">
and xro.recharge_order_number like concat('%', #{rechargeOrderNumber}, '%')
</if>

View File

@ -37,6 +37,14 @@ public class XhpcDeviceMessage {
* 状态
*/
private Integer status;
/**
* 插枪状态
*/
private Integer gunStatus;
/**
* 插编码
*/
private String gunNumber;
/**
* 备注描述

View File

@ -291,6 +291,8 @@ public class RealtimeDataLogic implements ServiceLogic {
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessage.setGunStatus(Integer.parseInt(realtimeData.getVehicleGunStatus()));
deviceMessage.setGunNumber(terminalId);
deviceMessageMapper.insertByDomain(deviceMessage);
//实时数据推送设备充电中状态变化
executorService.execute(new Runnable() {

View File

@ -18,10 +18,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -10,6 +10,8 @@
<result property="content" column="content"/>
<result property="chargeOrderNo" column="charge_order_no"/>
<result property="status" column="status"/>
<result property="gunStatus" column="gun_status"/>
<result property="gunNumber" column="gun_number"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
@ -70,6 +72,8 @@
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="gunStatus != null">gun_status,</if>
<if test="gunNumber != null">gun_number,</if>
create_time,
update_time
)values(
@ -81,6 +85,8 @@
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="gunStatus != null">#{gunStatus},</if>
<if test="gunNumber != null">#{gunNumber},</if>
sysdate(),
sysdate()
)

View File

@ -42,8 +42,12 @@ public class InvoicedOrderResponse {
private Long orderId;
@JsonProperty("orderNumber")
private String orderNumber;
@JsonProperty("totalMoney")
private BigDecimal totalMoney;
@JsonProperty("orderMoney")
private BigDecimal orderMoney;
@JsonProperty("placeholderMoney")
private BigDecimal placeholderMoney;
@JsonProperty("orderTime")
private String orderTime;

View File

@ -64,6 +64,15 @@ public class XhpcInvoice implements Serializable {
*/
private BigDecimal invoiceOrderServiceTotalMoney;
/**
* 发票包含的订单的占位费金额
*/
private BigDecimal placeholderMoney;
/**
* 发票包含的订单的总金额
*/
private BigDecimal totalMoney;
/**
* 公司地址
*/

View File

@ -352,6 +352,12 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
orderDatasDTO.setOrderId((Long) data.get("historyOrderId"));
orderDatasDTO.setOrderNumber((String) data.get("serialNumber"));
orderDatasDTO.setOrderMoney(new BigDecimal(data.get("actPrice").toString()));
if(data.get("placeholderMoney") !=null && new BigDecimal(data.get("placeholderMoney").toString()).compareTo(new BigDecimal(0))>0){
orderDatasDTO.setTotalMoney(new BigDecimal(data.get("actPrice").toString()).add(new BigDecimal(data.get("placeholderMoney").toString())));
}else{
orderDatasDTO.setTotalMoney(new BigDecimal(data.get("actPrice").toString()));
}
orderDatasDTO.setPlaceholderMoney(new BigDecimal(data.get("placeholderMoney").toString()));
//因为数据库中存储的时间类型为datetime所以Mybatis会将其转换为LocalDateTime类型对象我们不能直接得到Date所以我们需要对其进行转换
LocalDateTime createTime = (LocalDateTime) data.get("createTime");
ZoneId zoneId = ZoneId.systemDefault();

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -117,25 +117,27 @@
<select id="findByCondition" resultType="Map">
SELECT
history_order_id as historyOrderId,
serial_number as serialNumber,
act_price as actPrice,
create_time as createTime,
DATE_FORMAT(create_time,'%Y-%m') AS belongsTime
xho.history_order_id as historyOrderId,
xho.serial_number as serialNumber,
xho.act_price as actPrice,
xho.create_time as createTime,
DATE_FORMAT(xho.create_time,'%Y-%m') AS belongsTime,
xpo.act_price as placeholderMoney
FROM
xhpc_history_order
xhpc_history_order xho
left join xhpc_placeholder_order xpo on xpo.history_order_id =xho.history_order_id and appeal_status !=1
WHERE
user_id = #{invoicedOrdersRequest.userId}
AND source = #{invoicedOrdersRequest.userType}
AND create_time &lt;= #{invoicedOrdersRequest.currentTime}
xho.user_id = #{invoicedOrdersRequest.userId}
AND xho.source = #{invoicedOrdersRequest.userType}
AND xho.create_time &lt;= #{invoicedOrdersRequest.currentTime}
<if test="lockOrderNumberList!=null">
AND history_order_id
AND xho.history_order_id
<foreach collection="lockOrderNumberList" item="historyOrderId" open="not in (" close=")" separator=",">
#{historyOrderId}
</foreach>
</if>
ORDER BY
create_time DESC
xho.create_time DESC
</select>
<select id="findAllOrdersByCondition" resultType="java.lang.Long">
SELECT

View File

@ -16,10 +16,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
config:
# 配置中心地址
server-addr: 120.26.46.180:8858
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
# 配置文件格式
file-extension: yml
# 共享配置