合并代码

dev-discount
袁野 3 years ago
commit 08eb8f91d7
  1. 17
      hai-bweb/src/main/java/com/bweb/config/RedisConfig.java
  2. 27
      hai-bweb/src/main/java/com/bweb/config/msg/OilPriceTaskMsgListener.java
  3. 59
      hai-bweb/src/main/java/com/bweb/config/msg/RedisKeyExpirationListener.java
  4. 13
      hai-bweb/src/main/java/com/bweb/controller/CommonController.java
  5. 65
      hai-bweb/src/main/java/com/bweb/controller/HighGasController.java
  6. 126
      hai-bweb/src/main/java/com/bweb/controller/HighGasOilPriceTaskController.java
  7. 82
      hai-bweb/src/main/java/com/bweb/controller/HighMerAmountController.java
  8. 1
      hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java
  9. 19
      hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java
  10. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  11. 114
      hai-cweb/src/main/java/com/cweb/controller/HighGasController.java
  12. 17
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  13. 2
      hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java
  14. 21
      hai-service/src/main/java/com/hai/common/utils/DateUtil.java
  15. 1
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceMapperExt.java
  16. 43
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceTaskMapper.java
  17. 14
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceTaskSqlProvider.java
  18. 122
      hai-service/src/main/java/com/hai/dao/HighMerchantAccountMapper.java
  19. 38
      hai-service/src/main/java/com/hai/dao/HighMerchantAccountMapperExt.java
  20. 318
      hai-service/src/main/java/com/hai/dao/HighMerchantAccountSqlProvider.java
  21. 18
      hai-service/src/main/java/com/hai/entity/HighGasOilPriceTask.java
  22. 70
      hai-service/src/main/java/com/hai/entity/HighGasOilPriceTaskExample.java
  23. 214
      hai-service/src/main/java/com/hai/entity/HighMerchantAccount.java
  24. 934
      hai-service/src/main/java/com/hai/entity/HighMerchantAccountExample.java
  25. 3
      hai-service/src/main/java/com/hai/msg/entity/MsgTopic.java
  26. 6
      hai-service/src/main/java/com/hai/service/CommonService.java
  27. 6
      hai-service/src/main/java/com/hai/service/HighGasOilPriceTaskService.java
  28. 45
      hai-service/src/main/java/com/hai/service/HighMerchantAccountService.java
  29. 5
      hai-service/src/main/java/com/hai/service/impl/BsCompanyServiceImpl.java
  30. 7
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  31. 89
      hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java
  32. 37
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceTaskServiceImpl.java
  33. 93
      hai-service/src/main/java/com/hai/service/impl/HighMerchantAccountServiceImpl.java
  34. 8
      hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java
  35. 2
      hai-service/src/main/java/com/hai/service/impl/HighOilCardRecordServiceImpl.java

@ -1,14 +1,19 @@
package com.bweb.config; package com.bweb.config;
import com.bweb.config.msg.OilPriceTaskMsgListener;
import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.hai.msg.entity.MsgTopic;
import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.*; import org.springframework.data.redis.core.*;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer;
@ -17,6 +22,18 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@EnableCaching //开启注解 @EnableCaching //开启注解
public class RedisConfig extends CachingConfigurerSupport { public class RedisConfig extends CachingConfigurerSupport {
@Bean
public RedisMessageListenerContainer redisMessageListenerContainer(RedisConnectionFactory factory) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(factory);
//可以添加多个 messageListener
container.addMessageListener(new OilPriceTaskMsgListener(), new PatternTopic(MsgTopic.oilPriceTask.getName()));
return container;
}
/** /**
* retemplate相关配置 * retemplate相关配置
* @param factory * @param factory

@ -0,0 +1,27 @@
package com.bweb.config.msg;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
@Service(value = "driverLBSMsgListener")
public class OilPriceTaskMsgListener implements MessageListener {
private static Logger logger = LoggerFactory.getLogger(OilPriceTaskMsgListener.class);
private RedisTemplate<String, Object> redisTemplate;
@Override
public void onMessage(Message message, byte[] pattern) {
System.out.println(message);
}
}

@ -0,0 +1,59 @@
package com.bweb.config.msg;
import com.hai.entity.HighGasOilPriceTask;
import com.hai.msg.entity.MsgTopic;
import com.hai.service.HighGasOilPriceTaskService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author hurui
* @version 1.0
* @ClassName RedisKeyExpirationListener
* @description: TODO
* @date 2021/8/19 10:00
*/
@Component
public class RedisKeyExpirationListener extends KeyExpirationEventMessageListener {
private static Logger logger = LoggerFactory.getLogger(RedisKeyExpirationListener.class);
@Resource
private HighGasOilPriceTaskService gasOilPriceTaskService;
public RedisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
super(listenerContainer);
}
public void onMessage(Message message, byte[] pattern) {
try {
if (message != null && StringUtils.isNotBlank(message.toString())) {
// 加油站价格任务
if (message.toString().contains(MsgTopic.oilPriceTask.getName())) {
// 截取任务id
Long taskId = Long.parseLong(StringUtils.substringAfterLast(message.toString(), MsgTopic.oilPriceTask.getName() + "-"));
if (taskId != null) {
// 查询任务
HighGasOilPriceTask gasOilPriceTask = gasOilPriceTaskService.getDetailById(taskId);
if (gasOilPriceTask != null) {
// 任务处理
gasOilPriceTaskService.businessHandle(gasOilPriceTask);
}
}
}
}
} catch (Exception e) {
logger.error("redis过期事件异常:", e);
}
}
}

@ -38,6 +38,19 @@ public class CommonController {
private SecConfigService secConfigService; private SecConfigService secConfigService;
@RequestMapping(value="/getProvinceList",method= RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询省级列表")
public ResponseData getProvinceList(){
try {
return ResponseMsgUtil.success(commonService.getProvinceList());
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getRegionsByParentId",method= RequestMethod.GET) @RequestMapping(value="/getRegionsByParentId",method= RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "分级查询区域信息") @ApiOperation(value = "分级查询区域信息")

@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -53,6 +54,9 @@ public class HighGasController {
@Resource @Resource
private HighMerchantStoreService merchantStoreService; private HighMerchantStoreService merchantStoreService;
@Resource
private HighMerchantAccountService merchantAccountService;
@Resource @Resource
private HighUserService highUserService; private HighUserService highUserService;
@ -65,6 +69,35 @@ public class HighGasController {
@Resource @Resource
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@RequestMapping(value="/getMerGasStatistical",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询商户油站统计")
public ResponseData getMerGasStatistical() {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null || userInfoModel.getMerchant() == null) {
log.error("HighGasController -> getMerGasStatistical() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
BigDecimal account = new BigDecimal("0");
// 查询商户余额
HighMerchantAccount merchantAccount = merchantAccountService.getStoreAccountDetail(userInfoModel.getMerchant().getId());
if (merchantAccount != null) {
account = merchantAccount.getAmounts();
}
Map<String, Object> param = new HashMap<>();
param.put("amount", account.subtract(merchantAccountService.countMerGasOilAmount(userInfoModel.getMerchant().getId())));
param.put("storeList", merchantAccountService.getStoreGasOilAmountByMer(userInfoModel.getMerchant().getId()));
return ResponseMsgUtil.success(param);
} catch (Exception e) {
log.error("HighGasController -> getMerGasStatistical() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getGasStatistical",method = RequestMethod.POST) @RequestMapping(value="/getGasStatistical",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询油站统计") @ApiOperation(value = "查询油站统计")
@ -157,6 +190,38 @@ public class HighGasController {
} }
} }
@RequestMapping(value="/getGasSelectList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询油站选择列表")
public ResponseData getGasSelectList() {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
log.error("HighGasController -> disabledOil() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String, Object> param = new HashMap<>();
param.put("type", 1);
param.put("sourceType", 1);
param.put("status", 1);
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) {
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) {
param.put("companyId", userInfoModel.getBsCompany().getId());
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
return ResponseMsgUtil.success(merchantStoreService.getMerchantStoreList(param));
} catch (Exception e) {
log.error("HighGasController -> getGasSelectList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/exportGasOrder",method = RequestMethod.GET) @RequestMapping(value="/exportGasOrder",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "导出油站订单") @ApiOperation(value = "导出油站订单")

@ -6,9 +6,19 @@ import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighGasOilPriceTask;
import com.hai.entity.HighMerchantStore;
import com.hai.entity.SecDictionary;
import com.hai.entity.SecRegion;
import com.hai.enum_type.GasTaskPriceTypeEnum;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.CommonService;
import com.hai.service.HighGasOilPriceTaskService; import com.hai.service.HighGasOilPriceTaskService;
import com.hai.service.HighMerchantStoreService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -18,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Controller @Controller
@ -30,18 +41,97 @@ public class HighGasOilPriceTaskController {
@Resource @Resource
private HighGasOilPriceTaskService gasOilPriceTaskService; private HighGasOilPriceTaskService gasOilPriceTaskService;
@RequestMapping(value="/addTask",method = RequestMethod.POST) @Resource
private HighMerchantStoreService merchantStoreService;
@Resource
private CommonService commonService;
@Resource
private UserCenter userCenter;
@RequestMapping(value="/batchAddTask",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "增加任务") @ApiOperation(value = "批量增加任务")
public ResponseData addTask(@RequestBody JSONObject body) { public ResponseData batchAddTask(@RequestBody List<HighGasOilPriceTask> taskList) {
try { try {
if (body.getLong("regionId") == null UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
|| body.getInteger("oilNo") == null if (userInfoModel == null) {
|| body.getBigDecimal("price") == null log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
if (taskList == null || taskList.size() == 0) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
for (HighGasOilPriceTask task : taskList) {
if (task.getPriceType() == null
|| task.getPrice() == null
|| task.getOilNo() == null
|| task.getExecutionType() == null
) { ) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!",""); log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
// 执行方式 1. 立刻执行 2. 定时执行
if (task.getExecutionType().equals(2) && task.getStartTime() == null) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置执行时间");
}
// 价格类型 1. 国标价 2. 油站价 3. 优惠幅度
if (task.getPriceType().equals(GasTaskPriceTypeEnum.type1.getStatus())) {
if (task.getRegionId() == null) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置区域");
}
// 加油站
SecRegion region = commonService.getRegionsById(task.getRegionId());
if (region == null) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到区域");
}
task.setRegionId(region.getRegionId());
task.setRegionName(region.getRegionName());
}
// 价格类型 1. 国标价 2. 油站价 3. 优惠幅度
if (task.getPriceType().equals(GasTaskPriceTypeEnum.type2.getStatus())
|| task.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())) {
if (task.getMerStoreId() == null) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置加油站");
}
// 加油站
HighMerchantStore store = merchantStoreService.getDetailById(task.getMerStoreId());
if (store == null) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站");
}
task.setRegionId(store.getRegionId());
task.setRegionName(store.getRegionName());
task.setMerStoreId(store.getId());
task.setMerStoreKey(store.getStoreKey());
task.setMerStoreName(store.getStoreName());
task.setMerStoreAddress(store.getAddress());
}
// 查询油品
SecDictionary oil = commonService.mappingSysCode("GAS_OIL_TYPE", task.getOilNo().toString());
if (oil == null) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
task.setOilType(Integer.parseInt(oil.getExt1()));
task.setOilTypeName(oil.getExt2());
task.setOilNoName(oil.getCodeName());
task.setOpUserId(userInfoModel.getSecUser().getId());
task.setOpUserName(userInfoModel.getSecUser().getUserName());
}
gasOilPriceTaskService.batchAddTask(taskList);
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");
@ -91,6 +181,7 @@ public class HighGasOilPriceTaskController {
public ResponseData getTaskList(@RequestParam(name = "regionId", required = false) Integer regionId, public ResponseData getTaskList(@RequestParam(name = "regionId", required = false) Integer regionId,
@RequestParam(name = "regionName", required = false) String regionName, @RequestParam(name = "regionName", required = false) String regionName,
@RequestParam(name = "merStoreId", required = false) Integer merStoreId, @RequestParam(name = "merStoreId", required = false) Integer merStoreId,
@RequestParam(name = "merStoreKey", required = false) String merStoreKey,
@RequestParam(name = "merStoreName", required = false) String merStoreName, @RequestParam(name = "merStoreName", required = false) String merStoreName,
@RequestParam(name = "oilType", required = false) Integer oilType, @RequestParam(name = "oilType", required = false) Integer oilType,
@RequestParam(name = "oilNo", required = false) Integer oilNo, @RequestParam(name = "oilNo", required = false) Integer oilNo,
@ -100,10 +191,31 @@ public class HighGasOilPriceTaskController {
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) { @RequestParam(name = "pageSize", required = true) Integer pageSize) {
try { try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
log.error("HighGasController -> disabledOil() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("regionId", regionId); param.put("regionId", regionId);
param.put("regionName", regionName); param.put("regionName", regionName);
param.put("status", status); param.put("merStoreId", merStoreId);
param.put("merStoreKey", merStoreKey);
param.put("merStoreName", merStoreName);
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) {
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) {
param.put("regionId", userInfoModel.getBsCompany().getRegionId());
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type3.getType())) {
param.put("merStoreId", userInfoModel.getMerchantStore().getId());
}
param.put("oilType", oilType);
param.put("oilNo", oilNo);
param.put("priceType", priceType);
param.put("executionType", executionType);
param.put("status", status); param.put("status", status);
PageHelper.startPage(pageNum,pageSize); PageHelper.startPage(pageNum,pageSize);

@ -0,0 +1,82 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighMerchantStoreAccount;
import com.hai.enum_type.MerStoreAmountSourceTypeEnum;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighCompanyTwoPwdService;
import com.hai.service.HighMerchantAccountService;
import com.hai.service.HighMerchantStoreAccountRecordService;
import com.hai.service.HighMerchantStoreAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DeadlockLoserDataAccessException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/merAccount")
@Api(value = "商户门店接口")
public class HighMerAmountController {
private static Logger log = LoggerFactory.getLogger(HighMerAmountController.class);
@Resource
private HighMerchantAccountService merchantAccountService;
@Resource
private UserCenter userCenter;
@RequestMapping(value = "/recharge", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "余额充值")
public synchronized ResponseData recharge(@RequestBody JSONObject body) {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");
}
if (userInfoModel.getBsCompany() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");
}
if (body.getLong("merId") == null || body.getBigDecimal("amount") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
if (body.getBigDecimal("amount").compareTo(new BigDecimal("0")) == -1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "充值金额不能小于0");
}
Map<String, Object> map = new HashMap<>();
map.put("sourceType", MerStoreAmountSourceTypeEnum.type1.getType());
map.put("sourceContent", "充值额度:" + body.getBigDecimal("amount") + " 元");
map.put("opUserId", userInfoModel.getSecUser().getId());
map.put("opUserName", userInfoModel.getSecUser().getUserName());
merchantAccountService.recharge(body.getLong("merId"), body.getBigDecimal("amount"), map);
return ResponseMsgUtil.success("操作成功");
} catch (DeadlockLoserDataAccessException deadlockLoserDataAccessException) {
log.error("HighActivityController -> userLottery() error!", "服务器繁忙");
return ResponseMsgUtil.builderResponse(ErrorCode.SERVER_BUSY_ERROR.getCode(),ErrorCode.SERVER_BUSY_ERROR.getMsg(),null);
} catch (Exception e) {
log.error("HighCompanyAmountController --> recharge() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -101,7 +101,6 @@ public class HighMerchantController {
} }
} }
@RequestMapping(value="/updateMerchant",method = RequestMethod.POST) @RequestMapping(value="/updateMerchant",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "修改商户") @ApiOperation(value = "修改商户")

@ -208,14 +208,25 @@ public class HighMerchantStoreController {
log.error("BsStudentController --> addStudent() error!", "未找到门店信息"); log.error("BsStudentController --> addStudent() error!", "未找到门店信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店信息"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店信息");
} }
BsCompany company = bsCompanyService.getCompanyById(store.getCompanyId());
if (company == null) {
log.error("HighMerchantStoreController -> insertMerchantStore() error!","未找到分公司");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, "");
}
Map<String, SecRegion> regionMap = commonService.getParentInfoByRegionId(highMerchantStore.getRegionId()); Map<String, SecRegion> regionMap = commonService.getParentInfoByRegionId(highMerchantStore.getRegionId());
if (highMerchantStore.getType() != null && highMerchantStore.getType().equals(1)) {
highMerchantStore.setRegionId(Long.parseLong(company.getRegionId()));
highMerchantStore.setRegionName(commonService.getRegionName(Long.parseLong(company.getRegionId())));
} else {
// 如果是重庆市的区县,使用重庆市的区域代码 // 如果是重庆市的区县,使用重庆市的区域代码
if (regionMap.get("region").getRegionId().intValue() == 500100) { if (regionMap.get("region").getRegionId().intValue() == 500100) {
store.setRegionId(regionMap.get("region").getParentId()); highMerchantStore.setRegionId(regionMap.get("region").getParentId());
store.setRegionName(regionMap.get("region").getRegionName()); highMerchantStore.setRegionName(regionMap.get("region").getRegionName());
} else { } else {
store.setRegionId(regionMap.get("region").getRegionId()); highMerchantStore.setRegionId(regionMap.get("region").getRegionId());
store.setRegionName(regionMap.get("region").getRegionName()); highMerchantStore.setRegionName(regionMap.get("region").getRegionName());
}
} }
if (highMerchantStore.getBrandId() != null) { if (highMerchantStore.getBrandId() != null) {

File diff suppressed because one or more lines are too long

@ -112,6 +112,45 @@ public class HighGasController {
PageInfo<Map<String, Object>> mapPageInfo = PageUtil.initPageInfoObj(pageNum, distance.size(), pageSize, new PageInfo<>(distance)); PageInfo<Map<String, Object>> mapPageInfo = PageUtil.initPageInfoObj(pageNum, distance.size(), pageSize, new PageInfo<>(distance));
for (Map<String, Object> map : mapPageInfo.getList()) { for (Map<String, Object> map : mapPageInfo.getList()) {
if (StringUtils.isNotBlank(MapUtils.getString(map, "oil_no"))) { if (StringUtils.isNotBlank(MapUtils.getString(map, "oil_no"))) {
if (MapUtils.getInteger(map, "source_type").equals(1)) {
// 查询是否配置了【油站的】优惠比例
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no"));
if (tyAgentPrice != null) {
// 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN));
// 油枪价 - 优惠幅度
BigDecimal price = new BigDecimal(MapUtils.getString(map, "price_gun")).subtract(new BigDecimal(MapUtils.getString(map, "preferential_margin")));
// (油枪价 - 优惠幅度) * 系统折扣
map.put("price_vip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP));
} else {
// 查询是否配置了【油品】优惠比例
HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no"));
if (gasDiscountOilPrice != null) {
// 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN));
// 油枪价 - 优惠幅度
BigDecimal price = new BigDecimal(MapUtils.getString(map, "price_gun")).subtract(new BigDecimal(MapUtils.getString(map, "preferential_margin")));
// (油枪价 - 优惠幅度) * 系统折扣
map.put("price_vip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
// 查询是否配置了【代理商】优惠比例
if (isTyAgent != null && isTyAgent == true) {
HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no"));
if (agentPrice != null) {
// 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN));
// 油枪价 - 优惠幅度
BigDecimal price = new BigDecimal(MapUtils.getString(map, "price_gun")).subtract(new BigDecimal(MapUtils.getString(map, "preferential_margin")));
// (油枪价 - 优惠幅度) * 系统折扣
map.put("price_vip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
} else if (MapUtils.getInteger(map, "source_type").equals(2)) {
// 查询是否配置了【油站的】优惠比例 // 查询是否配置了【油站的】优惠比例
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no"));
if (tyAgentPrice != null) { if (tyAgentPrice != null) {
@ -142,6 +181,7 @@ public class HighGasController {
} }
} }
} }
}
return ResponseMsgUtil.success(mapPageInfo); return ResponseMsgUtil.success(mapPageInfo);
} }
@ -271,6 +311,43 @@ public class HighGasController {
oilPriceMap.put("priceVip", oilPrice.getPriceVip()); oilPriceMap.put("priceVip", oilPrice.getPriceVip());
oilPriceMap.put("priceGun", oilPrice.getPriceGun()); oilPriceMap.put("priceGun", oilPrice.getPriceGun());
oilPriceMap.put("priceOfficial", oilPrice.getPriceOfficial()); oilPriceMap.put("priceOfficial", oilPrice.getPriceOfficial());
// 查询是否配置了【油站的】优惠比例
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, store.getId(), oilPrice.getOilNo().toString());
if (tyAgentPrice != null) {
// 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN));
// 油枪价 - 优惠幅度
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin());
// (油枪价 - 优惠幅度) * 系统折扣
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP));
} else {
// 查询是否配置了【油品】优惠比例
HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(oilPrice.getOilNo().toString());
if (gasDiscountOilPrice != null) {
// 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN));
// 油枪价 - 优惠幅度
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin());
// (油枪价 - 优惠幅度) * 系统折扣
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
// 查询是否配置了【代理商】优惠比例
if (isTyAgent != null && isTyAgent == true) {
HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, store.getId(), oilPrice.getOilNo().toString());
if (agentPrice != null) {
// 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN));
// 油枪价 - 优惠幅度
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin());
// (油枪价 - 优惠幅度) * 系统折扣
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
oilPriceMapList.add(oilPriceMap); oilPriceMapList.add(oilPriceMap);
} }
param.put("oilPriceList", oilPriceMapList); param.put("oilPriceList", oilPriceMapList);
@ -418,6 +495,43 @@ public class HighGasController {
oilPriceMap.put("priceVip", oilPrice.getPriceVip()); oilPriceMap.put("priceVip", oilPrice.getPriceVip());
oilPriceMap.put("priceGun", oilPrice.getPriceGun()); oilPriceMap.put("priceGun", oilPrice.getPriceGun());
oilPriceMap.put("priceOfficial", oilPrice.getPriceOfficial()); oilPriceMap.put("priceOfficial", oilPrice.getPriceOfficial());
// 查询是否配置了【油站的】优惠比例
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, store.getId(), oilPrice.getOilNo().toString());
if (tyAgentPrice != null) {
// 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN));
// 油枪价 - 优惠幅度
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin());
// (油枪价 - 优惠幅度) * 系统折扣
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP));
} else {
// 查询是否配置了【油品】优惠比例
HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(oilPrice.getOilNo().toString());
if (gasDiscountOilPrice != null) {
// 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN));
// 油枪价 - 优惠幅度
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin());
// (油枪价 - 优惠幅度) * 系统折扣
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
// 查询是否配置了【代理商】优惠比例
if (isTyAgent != null && isTyAgent == true) {
HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, store.getId(), oilPrice.getOilNo().toString());
if (agentPrice != null) {
// 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN));
// 油枪价 - 优惠幅度
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin());
// (油枪价 - 优惠幅度) * 系统折扣
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
oilPriceMapList.add(oilPriceMap); oilPriceMapList.add(oilPriceMap);
} }
param.put("oilPriceList", oilPriceMapList); param.put("oilPriceList", oilPriceMapList);

@ -55,6 +55,9 @@ public class HighOrderController {
@Autowired @Autowired
private UserCenter userCenter; private UserCenter userCenter;
@Resource
private CommonService commonService;
@Resource @Resource
private HighOrderService highOrderService; private HighOrderService highOrderService;
@ -220,8 +223,18 @@ public class HighOrderController {
log.error("HighOrderController --> addOrder() error!", "参数错误"); log.error("HighOrderController --> addOrder() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
if (childOrder.getGoodsPrice().compareTo(new BigDecimal("800")) == 1){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "加油金额不能超过800元"); // 加油限制
if (childOrder.getGasOilType().equals(1)) {
SecDictionary refuelLimit = commonService.mappingSysName("REFUEL_LIMIT", "汽油");
if (refuelLimit != null && childOrder.getGoodsPrice().compareTo(new BigDecimal(refuelLimit.getCodeValue())) == 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "汽油加油金额不能超过" + refuelLimit.getCodeValue()+"元");
}
} else if (childOrder.getGasOilType().equals(2)){
SecDictionary refuelLimit = commonService.mappingSysName("REFUEL_LIMIT", "柴油");
if (refuelLimit != null && childOrder.getGoodsPrice().compareTo(new BigDecimal(refuelLimit.getCodeValue())) == 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "柴油加油金额不能超过" + refuelLimit.getCodeValue()+"元");
}
} }
if (highOrderService.getGasTheDayOrderNum(userInfoModel.getHighUser().getId()) >= 1) { if (highOrderService.getGasTheDayOrderNum(userInfoModel.getHighUser().getId()) >= 1) {

@ -151,7 +151,7 @@ public class HighGasSchedule {
} }
} }
@Scheduled(cron = "0 1 7 * * ?") //每日7点1分执行一次 @Scheduled(cron = "0 30 7 * * ?") //每日7点1分执行一次
public void refreshPriceOfficial() throws Exception { public void refreshPriceOfficial() throws Exception {
gasOilPriceOfficialService.refreshPriceOfficial(); gasOilPriceOfficialService.refreshPriceOfficial();

@ -34,6 +34,19 @@ public class DateUtil {
public static final String Y_M = "yyyy-MM"; public static final String Y_M = "yyyy-MM";
private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//计算两个时间相差的秒数
public static long getSecondDiff(Date startTime, Date endTime) {
try {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long eTime = endTime.getTime();
long sTime = startTime.getTime();
long diff = (eTime - sTime) / 1000;
return diff;
} catch (Exception e) {
log.error("getSecondDiff error", e);
}
return 0;
}
public static Integer getThisYear(){ public static Integer getThisYear(){
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
@ -765,9 +778,11 @@ public class DateUtil {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String a = "51130319931105651X"; String a = "51130319931105651X";
System.out.println(a.substring(6,10));
System.out.println(a.substring(10,12));
System.out.println(a.substring(12,14)); Date date = new Date();
date.setTime(1653979200000L);
System.out.println(getSecondDiff(new Date(), date));
} }
} }

@ -22,6 +22,7 @@ public interface HighGasOilPriceMapperExt {
" a.price_gun," + " a.price_gun," +
" a.price_vip," + " a.price_vip," +
" a.price_official," + " a.price_official," +
" a.preferential_margin," +
" b.* " + " b.* " +
" FROM" + " FROM" +
" high_gas_oil_price a," + " high_gas_oil_price a," +

@ -40,25 +40,27 @@ public interface HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt
@Insert({ @Insert({
"insert into high_gas_oil_price_task (region_id, region_name, ", "insert into high_gas_oil_price_task (region_id, region_name, ",
"mer_store_id, mer_store_name, ", "mer_store_key, mer_store_id, ",
"mer_store_address, oil_type, ", "mer_store_name, mer_store_address, ",
"oil_type_name, oil_no, ", "oil_type, oil_type_name, ",
"oil_no_name, price_type, ", "oil_no, oil_no_name, ",
"price, execution_type, ", "price_type, price, ",
"start_time, `status`, ", "execution_type, start_time, ",
"create_time, update_time, ", "`status`, create_time, ",
"op_user_id, op_user_name, ", "update_time, op_user_id, ",
"ext_1, ext_2, ext_3)", "op_user_name, ext_1, ",
"ext_2, ext_3)",
"values (#{regionId,jdbcType=BIGINT}, #{regionName,jdbcType=VARCHAR}, ", "values (#{regionId,jdbcType=BIGINT}, #{regionName,jdbcType=VARCHAR}, ",
"#{merStoreId,jdbcType=BIGINT}, #{merStoreName,jdbcType=VARCHAR}, ", "#{merStoreKey,jdbcType=VARCHAR}, #{merStoreId,jdbcType=BIGINT}, ",
"#{merStoreAddress,jdbcType=VARCHAR}, #{oilType,jdbcType=INTEGER}, ", "#{merStoreName,jdbcType=VARCHAR}, #{merStoreAddress,jdbcType=VARCHAR}, ",
"#{oilTypeName,jdbcType=VARCHAR}, #{oilNo,jdbcType=INTEGER}, ", "#{oilType,jdbcType=INTEGER}, #{oilTypeName,jdbcType=VARCHAR}, ",
"#{oilNoName,jdbcType=VARCHAR}, #{priceType,jdbcType=INTEGER}, ", "#{oilNo,jdbcType=INTEGER}, #{oilNoName,jdbcType=VARCHAR}, ",
"#{price,jdbcType=DECIMAL}, #{executionType,jdbcType=INTEGER}, ", "#{priceType,jdbcType=INTEGER}, #{price,jdbcType=DECIMAL}, ",
"#{startTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", "#{executionType,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{opUserId,jdbcType=BIGINT}, #{opUserName,jdbcType=VARCHAR}, ", "#{updateTime,jdbcType=TIMESTAMP}, #{opUserId,jdbcType=BIGINT}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{opUserName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighGasOilPriceTask record); int insert(HighGasOilPriceTask record);
@ -72,6 +74,7 @@ public interface HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="region_id", property="regionId", jdbcType=JdbcType.BIGINT), @Result(column="region_id", property="regionId", jdbcType=JdbcType.BIGINT),
@Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR), @Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_key", property="merStoreKey", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_id", property="merStoreId", jdbcType=JdbcType.BIGINT), @Result(column="mer_store_id", property="merStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_store_name", property="merStoreName", jdbcType=JdbcType.VARCHAR), @Result(column="mer_store_name", property="merStoreName", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_address", property="merStoreAddress", jdbcType=JdbcType.VARCHAR), @Result(column="mer_store_address", property="merStoreAddress", jdbcType=JdbcType.VARCHAR),
@ -96,7 +99,7 @@ public interface HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt
@Select({ @Select({
"select", "select",
"id, region_id, region_name, mer_store_id, mer_store_name, mer_store_address, ", "id, region_id, region_name, mer_store_key, mer_store_id, mer_store_name, mer_store_address, ",
"oil_type, oil_type_name, oil_no, oil_no_name, price_type, price, execution_type, ", "oil_type, oil_type_name, oil_no, oil_no_name, price_type, price, execution_type, ",
"start_time, `status`, create_time, update_time, op_user_id, op_user_name, ext_1, ", "start_time, `status`, create_time, update_time, op_user_id, op_user_name, ext_1, ",
"ext_2, ext_3", "ext_2, ext_3",
@ -107,6 +110,7 @@ public interface HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="region_id", property="regionId", jdbcType=JdbcType.BIGINT), @Result(column="region_id", property="regionId", jdbcType=JdbcType.BIGINT),
@Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR), @Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_key", property="merStoreKey", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_id", property="merStoreId", jdbcType=JdbcType.BIGINT), @Result(column="mer_store_id", property="merStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_store_name", property="merStoreName", jdbcType=JdbcType.VARCHAR), @Result(column="mer_store_name", property="merStoreName", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_address", property="merStoreAddress", jdbcType=JdbcType.VARCHAR), @Result(column="mer_store_address", property="merStoreAddress", jdbcType=JdbcType.VARCHAR),
@ -142,6 +146,7 @@ public interface HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt
"update high_gas_oil_price_task", "update high_gas_oil_price_task",
"set region_id = #{regionId,jdbcType=BIGINT},", "set region_id = #{regionId,jdbcType=BIGINT},",
"region_name = #{regionName,jdbcType=VARCHAR},", "region_name = #{regionName,jdbcType=VARCHAR},",
"mer_store_key = #{merStoreKey,jdbcType=VARCHAR},",
"mer_store_id = #{merStoreId,jdbcType=BIGINT},", "mer_store_id = #{merStoreId,jdbcType=BIGINT},",
"mer_store_name = #{merStoreName,jdbcType=VARCHAR},", "mer_store_name = #{merStoreName,jdbcType=VARCHAR},",
"mer_store_address = #{merStoreAddress,jdbcType=VARCHAR},", "mer_store_address = #{merStoreAddress,jdbcType=VARCHAR},",

@ -36,6 +36,10 @@ public class HighGasOilPriceTaskSqlProvider {
sql.VALUES("region_name", "#{regionName,jdbcType=VARCHAR}"); sql.VALUES("region_name", "#{regionName,jdbcType=VARCHAR}");
} }
if (record.getMerStoreKey() != null) {
sql.VALUES("mer_store_key", "#{merStoreKey,jdbcType=VARCHAR}");
}
if (record.getMerStoreId() != null) { if (record.getMerStoreId() != null) {
sql.VALUES("mer_store_id", "#{merStoreId,jdbcType=BIGINT}"); sql.VALUES("mer_store_id", "#{merStoreId,jdbcType=BIGINT}");
} }
@ -124,6 +128,7 @@ public class HighGasOilPriceTaskSqlProvider {
} }
sql.SELECT("region_id"); sql.SELECT("region_id");
sql.SELECT("region_name"); sql.SELECT("region_name");
sql.SELECT("mer_store_key");
sql.SELECT("mer_store_id"); sql.SELECT("mer_store_id");
sql.SELECT("mer_store_name"); sql.SELECT("mer_store_name");
sql.SELECT("mer_store_address"); sql.SELECT("mer_store_address");
@ -172,6 +177,10 @@ public class HighGasOilPriceTaskSqlProvider {
sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}"); sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}");
} }
if (record.getMerStoreKey() != null) {
sql.SET("mer_store_key = #{record.merStoreKey,jdbcType=VARCHAR}");
}
if (record.getMerStoreId() != null) { if (record.getMerStoreId() != null) {
sql.SET("mer_store_id = #{record.merStoreId,jdbcType=BIGINT}"); sql.SET("mer_store_id = #{record.merStoreId,jdbcType=BIGINT}");
} }
@ -259,6 +268,7 @@ public class HighGasOilPriceTaskSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("region_id = #{record.regionId,jdbcType=BIGINT}"); sql.SET("region_id = #{record.regionId,jdbcType=BIGINT}");
sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}"); sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}");
sql.SET("mer_store_key = #{record.merStoreKey,jdbcType=VARCHAR}");
sql.SET("mer_store_id = #{record.merStoreId,jdbcType=BIGINT}"); sql.SET("mer_store_id = #{record.merStoreId,jdbcType=BIGINT}");
sql.SET("mer_store_name = #{record.merStoreName,jdbcType=VARCHAR}"); sql.SET("mer_store_name = #{record.merStoreName,jdbcType=VARCHAR}");
sql.SET("mer_store_address = #{record.merStoreAddress,jdbcType=VARCHAR}"); sql.SET("mer_store_address = #{record.merStoreAddress,jdbcType=VARCHAR}");
@ -296,6 +306,10 @@ public class HighGasOilPriceTaskSqlProvider {
sql.SET("region_name = #{regionName,jdbcType=VARCHAR}"); sql.SET("region_name = #{regionName,jdbcType=VARCHAR}");
} }
if (record.getMerStoreKey() != null) {
sql.SET("mer_store_key = #{merStoreKey,jdbcType=VARCHAR}");
}
if (record.getMerStoreId() != null) { if (record.getMerStoreId() != null) {
sql.SET("mer_store_id = #{merStoreId,jdbcType=BIGINT}"); sql.SET("mer_store_id = #{merStoreId,jdbcType=BIGINT}");
} }

@ -0,0 +1,122 @@
package com.hai.dao;
import com.hai.entity.HighMerchantAccount;
import com.hai.entity.HighMerchantAccountExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface HighMerchantAccountMapper extends HighMerchantAccountMapperExt {
@SelectProvider(type=HighMerchantAccountSqlProvider.class, method="countByExample")
long countByExample(HighMerchantAccountExample example);
@DeleteProvider(type=HighMerchantAccountSqlProvider.class, method="deleteByExample")
int deleteByExample(HighMerchantAccountExample example);
@Delete({
"delete from high_merchant_account",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_merchant_account (mer_id, mer_name, ",
"account_no, amounts, ",
"`status`, create_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, ",
"#{accountNo,jdbcType=VARCHAR}, #{amounts,jdbcType=DECIMAL}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighMerchantAccount record);
@InsertProvider(type=HighMerchantAccountSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighMerchantAccount record);
@SelectProvider(type=HighMerchantAccountSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
@Result(column="account_no", property="accountNo", jdbcType=JdbcType.VARCHAR),
@Result(column="amounts", property="amounts", jdbcType=JdbcType.DECIMAL),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<HighMerchantAccount> selectByExample(HighMerchantAccountExample example);
@Select({
"select",
"id, mer_id, mer_name, account_no, amounts, `status`, create_time, update_time, ",
"ext_1, ext_2, ext_3",
"from high_merchant_account",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
@Result(column="account_no", property="accountNo", jdbcType=JdbcType.VARCHAR),
@Result(column="amounts", property="amounts", jdbcType=JdbcType.DECIMAL),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
HighMerchantAccount selectByPrimaryKey(Long id);
@UpdateProvider(type=HighMerchantAccountSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighMerchantAccount record, @Param("example") HighMerchantAccountExample example);
@UpdateProvider(type=HighMerchantAccountSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighMerchantAccount record, @Param("example") HighMerchantAccountExample example);
@UpdateProvider(type=HighMerchantAccountSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighMerchantAccount record);
@Update({
"update high_merchant_account",
"set mer_id = #{merId,jdbcType=BIGINT},",
"mer_name = #{merName,jdbcType=VARCHAR},",
"account_no = #{accountNo,jdbcType=VARCHAR},",
"amounts = #{amounts,jdbcType=DECIMAL},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighMerchantAccount record);
}

@ -0,0 +1,38 @@
package com.hai.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* mapper扩展类
*/
public interface HighMerchantAccountMapperExt {
@Select({"select " +
" case when sum(b.total_price) is not null then sum(b.total_price) ELSE 0 end " +
" from high_child_order a, high_order b" +
" where goods_type = 3 " +
" and a.order_id = b.id" +
" and goods_id in (SELECT id from high_merchant_store where merchant_id = #{merId}) " +
" and b.order_status in (2,3,6,7)"})
BigDecimal countMerGasOilAmount(@Param("merId") Long merId);
@Select({
" SELECT ms.id, ms.store_name, ms.address," +
" (select " +
" case when sum(b.total_price) is not null then sum(b.total_price) else 0 end" +
" from high_child_order a, high_order b" +
" where a.order_id = b.id" +
" and goods_type = 3" +
" and goods_id = ms.id" +
" and b.order_status in (2,3,6,7)) countPrice" +
" from high_merchant_store ms where ms.merchant_id = #{merId}" +
" ORDER BY countPrice desc"
})
List<Map<String, Object>> selectStoreGasOilAmountByMer(@Param("merId") Long merId);
}

@ -0,0 +1,318 @@
package com.hai.dao;
import com.hai.entity.HighMerchantAccount;
import com.hai.entity.HighMerchantAccountExample.Criteria;
import com.hai.entity.HighMerchantAccountExample.Criterion;
import com.hai.entity.HighMerchantAccountExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class HighMerchantAccountSqlProvider {
public String countByExample(HighMerchantAccountExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_merchant_account");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(HighMerchantAccountExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("high_merchant_account");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(HighMerchantAccount record) {
SQL sql = new SQL();
sql.INSERT_INTO("high_merchant_account");
if (record.getMerId() != null) {
sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}");
}
if (record.getMerName() != null) {
sql.VALUES("mer_name", "#{merName,jdbcType=VARCHAR}");
}
if (record.getAccountNo() != null) {
sql.VALUES("account_no", "#{accountNo,jdbcType=VARCHAR}");
}
if (record.getAmounts() != null) {
sql.VALUES("amounts", "#{amounts,jdbcType=DECIMAL}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(HighMerchantAccountExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("mer_id");
sql.SELECT("mer_name");
sql.SELECT("account_no");
sql.SELECT("amounts");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("high_merchant_account");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
HighMerchantAccount record = (HighMerchantAccount) parameter.get("record");
HighMerchantAccountExample example = (HighMerchantAccountExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("high_merchant_account");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getMerId() != null) {
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
}
if (record.getMerName() != null) {
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}");
}
if (record.getAccountNo() != null) {
sql.SET("account_no = #{record.accountNo,jdbcType=VARCHAR}");
}
if (record.getAmounts() != null) {
sql.SET("amounts = #{record.amounts,jdbcType=DECIMAL}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("high_merchant_account");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}");
sql.SET("account_no = #{record.accountNo,jdbcType=VARCHAR}");
sql.SET("amounts = #{record.amounts,jdbcType=DECIMAL}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
HighMerchantAccountExample example = (HighMerchantAccountExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(HighMerchantAccount record) {
SQL sql = new SQL();
sql.UPDATE("high_merchant_account");
if (record.getMerId() != null) {
sql.SET("mer_id = #{merId,jdbcType=BIGINT}");
}
if (record.getMerName() != null) {
sql.SET("mer_name = #{merName,jdbcType=VARCHAR}");
}
if (record.getAccountNo() != null) {
sql.SET("account_no = #{accountNo,jdbcType=VARCHAR}");
}
if (record.getAmounts() != null) {
sql.SET("amounts = #{amounts,jdbcType=DECIMAL}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, HighMerchantAccountExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -29,6 +29,11 @@ public class HighGasOilPriceTask implements Serializable {
*/ */
private String regionName; private String regionName;
/**
* 加油站编号
*/
private String merStoreKey;
/** /**
* 加油站id * 加油站id
*/ */
@ -75,7 +80,7 @@ public class HighGasOilPriceTask implements Serializable {
private BigDecimal price; private BigDecimal price;
/** /**
* 执行类型 1. 立刻执行 2. 定时执行 * 执行方式 1. 立刻执行 2. 定时执行
*/ */
private Integer executionType; private Integer executionType;
@ -141,6 +146,14 @@ public class HighGasOilPriceTask implements Serializable {
this.regionName = regionName; this.regionName = regionName;
} }
public String getMerStoreKey() {
return merStoreKey;
}
public void setMerStoreKey(String merStoreKey) {
this.merStoreKey = merStoreKey;
}
public Long getMerStoreId() { public Long getMerStoreId() {
return merStoreId; return merStoreId;
} }
@ -308,6 +321,7 @@ public class HighGasOilPriceTask implements Serializable {
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getRegionId() == null ? other.getRegionId() == null : this.getRegionId().equals(other.getRegionId())) && (this.getRegionId() == null ? other.getRegionId() == null : this.getRegionId().equals(other.getRegionId()))
&& (this.getRegionName() == null ? other.getRegionName() == null : this.getRegionName().equals(other.getRegionName())) && (this.getRegionName() == null ? other.getRegionName() == null : this.getRegionName().equals(other.getRegionName()))
&& (this.getMerStoreKey() == null ? other.getMerStoreKey() == null : this.getMerStoreKey().equals(other.getMerStoreKey()))
&& (this.getMerStoreId() == null ? other.getMerStoreId() == null : this.getMerStoreId().equals(other.getMerStoreId())) && (this.getMerStoreId() == null ? other.getMerStoreId() == null : this.getMerStoreId().equals(other.getMerStoreId()))
&& (this.getMerStoreName() == null ? other.getMerStoreName() == null : this.getMerStoreName().equals(other.getMerStoreName())) && (this.getMerStoreName() == null ? other.getMerStoreName() == null : this.getMerStoreName().equals(other.getMerStoreName()))
&& (this.getMerStoreAddress() == null ? other.getMerStoreAddress() == null : this.getMerStoreAddress().equals(other.getMerStoreAddress())) && (this.getMerStoreAddress() == null ? other.getMerStoreAddress() == null : this.getMerStoreAddress().equals(other.getMerStoreAddress()))
@ -336,6 +350,7 @@ public class HighGasOilPriceTask implements Serializable {
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getRegionId() == null) ? 0 : getRegionId().hashCode()); result = prime * result + ((getRegionId() == null) ? 0 : getRegionId().hashCode());
result = prime * result + ((getRegionName() == null) ? 0 : getRegionName().hashCode()); result = prime * result + ((getRegionName() == null) ? 0 : getRegionName().hashCode());
result = prime * result + ((getMerStoreKey() == null) ? 0 : getMerStoreKey().hashCode());
result = prime * result + ((getMerStoreId() == null) ? 0 : getMerStoreId().hashCode()); result = prime * result + ((getMerStoreId() == null) ? 0 : getMerStoreId().hashCode());
result = prime * result + ((getMerStoreName() == null) ? 0 : getMerStoreName().hashCode()); result = prime * result + ((getMerStoreName() == null) ? 0 : getMerStoreName().hashCode());
result = prime * result + ((getMerStoreAddress() == null) ? 0 : getMerStoreAddress().hashCode()); result = prime * result + ((getMerStoreAddress() == null) ? 0 : getMerStoreAddress().hashCode());
@ -367,6 +382,7 @@ public class HighGasOilPriceTask implements Serializable {
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", regionId=").append(regionId); sb.append(", regionId=").append(regionId);
sb.append(", regionName=").append(regionName); sb.append(", regionName=").append(regionName);
sb.append(", merStoreKey=").append(merStoreKey);
sb.append(", merStoreId=").append(merStoreId); sb.append(", merStoreId=").append(merStoreId);
sb.append(", merStoreName=").append(merStoreName); sb.append(", merStoreName=").append(merStoreName);
sb.append(", merStoreAddress=").append(merStoreAddress); sb.append(", merStoreAddress=").append(merStoreAddress);

@ -316,6 +316,76 @@ public class HighGasOilPriceTaskExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMerStoreKeyIsNull() {
addCriterion("mer_store_key is null");
return (Criteria) this;
}
public Criteria andMerStoreKeyIsNotNull() {
addCriterion("mer_store_key is not null");
return (Criteria) this;
}
public Criteria andMerStoreKeyEqualTo(String value) {
addCriterion("mer_store_key =", value, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyNotEqualTo(String value) {
addCriterion("mer_store_key <>", value, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyGreaterThan(String value) {
addCriterion("mer_store_key >", value, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyGreaterThanOrEqualTo(String value) {
addCriterion("mer_store_key >=", value, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyLessThan(String value) {
addCriterion("mer_store_key <", value, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyLessThanOrEqualTo(String value) {
addCriterion("mer_store_key <=", value, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyLike(String value) {
addCriterion("mer_store_key like", value, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyNotLike(String value) {
addCriterion("mer_store_key not like", value, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyIn(List<String> values) {
addCriterion("mer_store_key in", values, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyNotIn(List<String> values) {
addCriterion("mer_store_key not in", values, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyBetween(String value1, String value2) {
addCriterion("mer_store_key between", value1, value2, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreKeyNotBetween(String value1, String value2) {
addCriterion("mer_store_key not between", value1, value2, "merStoreKey");
return (Criteria) this;
}
public Criteria andMerStoreIdIsNull() { public Criteria andMerStoreIdIsNull() {
addCriterion("mer_store_id is null"); addCriterion("mer_store_id is null");
return (Criteria) this; return (Criteria) this;

@ -0,0 +1,214 @@
package com.hai.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* high_merchant_account
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class HighMerchantAccount implements Serializable {
private Long id;
/**
* 商户id
*/
private Long merId;
/**
* 商户名称
*/
private String merName;
/**
* 账户号码
*/
private String accountNo;
/**
* 账户余额
*/
private BigDecimal amounts;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMerId() {
return merId;
}
public void setMerId(Long merId) {
this.merId = merId;
}
public String getMerName() {
return merName;
}
public void setMerName(String merName) {
this.merName = merName;
}
public String getAccountNo() {
return accountNo;
}
public void setAccountNo(String accountNo) {
this.accountNo = accountNo;
}
public BigDecimal getAmounts() {
return amounts;
}
public void setAmounts(BigDecimal amounts) {
this.amounts = amounts;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
HighMerchantAccount other = (HighMerchantAccount) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId()))
&& (this.getMerName() == null ? other.getMerName() == null : this.getMerName().equals(other.getMerName()))
&& (this.getAccountNo() == null ? other.getAccountNo() == null : this.getAccountNo().equals(other.getAccountNo()))
&& (this.getAmounts() == null ? other.getAmounts() == null : this.getAmounts().equals(other.getAmounts()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getMerId() == null) ? 0 : getMerId().hashCode());
result = prime * result + ((getMerName() == null) ? 0 : getMerName().hashCode());
result = prime * result + ((getAccountNo() == null) ? 0 : getAccountNo().hashCode());
result = prime * result + ((getAmounts() == null) ? 0 : getAmounts().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", merId=").append(merId);
sb.append(", merName=").append(merName);
sb.append(", accountNo=").append(accountNo);
sb.append(", amounts=").append(amounts);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -0,0 +1,934 @@
package com.hai.entity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class HighMerchantAccountExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public HighMerchantAccountExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public Long getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andMerIdIsNull() {
addCriterion("mer_id is null");
return (Criteria) this;
}
public Criteria andMerIdIsNotNull() {
addCriterion("mer_id is not null");
return (Criteria) this;
}
public Criteria andMerIdEqualTo(Long value) {
addCriterion("mer_id =", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdNotEqualTo(Long value) {
addCriterion("mer_id <>", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdGreaterThan(Long value) {
addCriterion("mer_id >", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdGreaterThanOrEqualTo(Long value) {
addCriterion("mer_id >=", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdLessThan(Long value) {
addCriterion("mer_id <", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdLessThanOrEqualTo(Long value) {
addCriterion("mer_id <=", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdIn(List<Long> values) {
addCriterion("mer_id in", values, "merId");
return (Criteria) this;
}
public Criteria andMerIdNotIn(List<Long> values) {
addCriterion("mer_id not in", values, "merId");
return (Criteria) this;
}
public Criteria andMerIdBetween(Long value1, Long value2) {
addCriterion("mer_id between", value1, value2, "merId");
return (Criteria) this;
}
public Criteria andMerIdNotBetween(Long value1, Long value2) {
addCriterion("mer_id not between", value1, value2, "merId");
return (Criteria) this;
}
public Criteria andMerNameIsNull() {
addCriterion("mer_name is null");
return (Criteria) this;
}
public Criteria andMerNameIsNotNull() {
addCriterion("mer_name is not null");
return (Criteria) this;
}
public Criteria andMerNameEqualTo(String value) {
addCriterion("mer_name =", value, "merName");
return (Criteria) this;
}
public Criteria andMerNameNotEqualTo(String value) {
addCriterion("mer_name <>", value, "merName");
return (Criteria) this;
}
public Criteria andMerNameGreaterThan(String value) {
addCriterion("mer_name >", value, "merName");
return (Criteria) this;
}
public Criteria andMerNameGreaterThanOrEqualTo(String value) {
addCriterion("mer_name >=", value, "merName");
return (Criteria) this;
}
public Criteria andMerNameLessThan(String value) {
addCriterion("mer_name <", value, "merName");
return (Criteria) this;
}
public Criteria andMerNameLessThanOrEqualTo(String value) {
addCriterion("mer_name <=", value, "merName");
return (Criteria) this;
}
public Criteria andMerNameLike(String value) {
addCriterion("mer_name like", value, "merName");
return (Criteria) this;
}
public Criteria andMerNameNotLike(String value) {
addCriterion("mer_name not like", value, "merName");
return (Criteria) this;
}
public Criteria andMerNameIn(List<String> values) {
addCriterion("mer_name in", values, "merName");
return (Criteria) this;
}
public Criteria andMerNameNotIn(List<String> values) {
addCriterion("mer_name not in", values, "merName");
return (Criteria) this;
}
public Criteria andMerNameBetween(String value1, String value2) {
addCriterion("mer_name between", value1, value2, "merName");
return (Criteria) this;
}
public Criteria andMerNameNotBetween(String value1, String value2) {
addCriterion("mer_name not between", value1, value2, "merName");
return (Criteria) this;
}
public Criteria andAccountNoIsNull() {
addCriterion("account_no is null");
return (Criteria) this;
}
public Criteria andAccountNoIsNotNull() {
addCriterion("account_no is not null");
return (Criteria) this;
}
public Criteria andAccountNoEqualTo(String value) {
addCriterion("account_no =", value, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoNotEqualTo(String value) {
addCriterion("account_no <>", value, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoGreaterThan(String value) {
addCriterion("account_no >", value, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoGreaterThanOrEqualTo(String value) {
addCriterion("account_no >=", value, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoLessThan(String value) {
addCriterion("account_no <", value, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoLessThanOrEqualTo(String value) {
addCriterion("account_no <=", value, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoLike(String value) {
addCriterion("account_no like", value, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoNotLike(String value) {
addCriterion("account_no not like", value, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoIn(List<String> values) {
addCriterion("account_no in", values, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoNotIn(List<String> values) {
addCriterion("account_no not in", values, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoBetween(String value1, String value2) {
addCriterion("account_no between", value1, value2, "accountNo");
return (Criteria) this;
}
public Criteria andAccountNoNotBetween(String value1, String value2) {
addCriterion("account_no not between", value1, value2, "accountNo");
return (Criteria) this;
}
public Criteria andAmountsIsNull() {
addCriterion("amounts is null");
return (Criteria) this;
}
public Criteria andAmountsIsNotNull() {
addCriterion("amounts is not null");
return (Criteria) this;
}
public Criteria andAmountsEqualTo(BigDecimal value) {
addCriterion("amounts =", value, "amounts");
return (Criteria) this;
}
public Criteria andAmountsNotEqualTo(BigDecimal value) {
addCriterion("amounts <>", value, "amounts");
return (Criteria) this;
}
public Criteria andAmountsGreaterThan(BigDecimal value) {
addCriterion("amounts >", value, "amounts");
return (Criteria) this;
}
public Criteria andAmountsGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("amounts >=", value, "amounts");
return (Criteria) this;
}
public Criteria andAmountsLessThan(BigDecimal value) {
addCriterion("amounts <", value, "amounts");
return (Criteria) this;
}
public Criteria andAmountsLessThanOrEqualTo(BigDecimal value) {
addCriterion("amounts <=", value, "amounts");
return (Criteria) this;
}
public Criteria andAmountsIn(List<BigDecimal> values) {
addCriterion("amounts in", values, "amounts");
return (Criteria) this;
}
public Criteria andAmountsNotIn(List<BigDecimal> values) {
addCriterion("amounts not in", values, "amounts");
return (Criteria) this;
}
public Criteria andAmountsBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("amounts between", value1, value2, "amounts");
return (Criteria) this;
}
public Criteria andAmountsNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("amounts not between", value1, value2, "amounts");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andExt1IsNull() {
addCriterion("ext_1 is null");
return (Criteria) this;
}
public Criteria andExt1IsNotNull() {
addCriterion("ext_1 is not null");
return (Criteria) this;
}
public Criteria andExt1EqualTo(String value) {
addCriterion("ext_1 =", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotEqualTo(String value) {
addCriterion("ext_1 <>", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1GreaterThan(String value) {
addCriterion("ext_1 >", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1GreaterThanOrEqualTo(String value) {
addCriterion("ext_1 >=", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1LessThan(String value) {
addCriterion("ext_1 <", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1LessThanOrEqualTo(String value) {
addCriterion("ext_1 <=", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1Like(String value) {
addCriterion("ext_1 like", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotLike(String value) {
addCriterion("ext_1 not like", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1In(List<String> values) {
addCriterion("ext_1 in", values, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotIn(List<String> values) {
addCriterion("ext_1 not in", values, "ext1");
return (Criteria) this;
}
public Criteria andExt1Between(String value1, String value2) {
addCriterion("ext_1 between", value1, value2, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotBetween(String value1, String value2) {
addCriterion("ext_1 not between", value1, value2, "ext1");
return (Criteria) this;
}
public Criteria andExt2IsNull() {
addCriterion("ext_2 is null");
return (Criteria) this;
}
public Criteria andExt2IsNotNull() {
addCriterion("ext_2 is not null");
return (Criteria) this;
}
public Criteria andExt2EqualTo(String value) {
addCriterion("ext_2 =", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotEqualTo(String value) {
addCriterion("ext_2 <>", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2GreaterThan(String value) {
addCriterion("ext_2 >", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2GreaterThanOrEqualTo(String value) {
addCriterion("ext_2 >=", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2LessThan(String value) {
addCriterion("ext_2 <", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2LessThanOrEqualTo(String value) {
addCriterion("ext_2 <=", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2Like(String value) {
addCriterion("ext_2 like", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotLike(String value) {
addCriterion("ext_2 not like", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2In(List<String> values) {
addCriterion("ext_2 in", values, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotIn(List<String> values) {
addCriterion("ext_2 not in", values, "ext2");
return (Criteria) this;
}
public Criteria andExt2Between(String value1, String value2) {
addCriterion("ext_2 between", value1, value2, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotBetween(String value1, String value2) {
addCriterion("ext_2 not between", value1, value2, "ext2");
return (Criteria) this;
}
public Criteria andExt3IsNull() {
addCriterion("ext_3 is null");
return (Criteria) this;
}
public Criteria andExt3IsNotNull() {
addCriterion("ext_3 is not null");
return (Criteria) this;
}
public Criteria andExt3EqualTo(String value) {
addCriterion("ext_3 =", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotEqualTo(String value) {
addCriterion("ext_3 <>", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3GreaterThan(String value) {
addCriterion("ext_3 >", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3GreaterThanOrEqualTo(String value) {
addCriterion("ext_3 >=", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3LessThan(String value) {
addCriterion("ext_3 <", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3LessThanOrEqualTo(String value) {
addCriterion("ext_3 <=", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3Like(String value) {
addCriterion("ext_3 like", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotLike(String value) {
addCriterion("ext_3 not like", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3In(List<String> values) {
addCriterion("ext_3 in", values, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotIn(List<String> values) {
addCriterion("ext_3 not in", values, "ext3");
return (Criteria) this;
}
public Criteria andExt3Between(String value1, String value2) {
addCriterion("ext_3 between", value1, value2, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotBetween(String value1, String value2) {
addCriterion("ext_3 not between", value1, value2, "ext3");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

@ -3,7 +3,8 @@ package com.hai.msg.entity;
public enum MsgTopic { public enum MsgTopic {
// 门店账户业务员 // 门店账户业务员
MerStoreAccount("mer-store-account"); MerStoreAccount("mer-store-account"),
oilPriceTask("OIL-PRICE-TASK");
private String name; private String name;

@ -147,6 +147,12 @@ public interface CommonService {
*/ */
SecRegion getRegionsById(Long regionId); SecRegion getRegionsById(Long regionId);
/**
* 查询省级列表
* @return
*/
List<SecRegion> getProvinceList();
/** /**
* 根据地区名称模糊查询 * 根据地区名称模糊查询
* @param regionName * @param regionName

@ -17,6 +17,12 @@ public interface HighGasOilPriceTaskService {
*/ */
void editData(HighGasOilPriceTask gasOilPriceTask); void editData(HighGasOilPriceTask gasOilPriceTask);
/**
* 批量增加价格任务
* @param taskList
*/
void batchAddTask(List<HighGasOilPriceTask> taskList);
/** /**
* 增加价格任务 * 增加价格任务
* @param gasOilPriceTask * @param gasOilPriceTask

@ -0,0 +1,45 @@
package com.hai.service;
import com.hai.entity.HighMerchantAccount;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
public interface HighMerchantAccountService {
/**
* 编辑商户账户
* @param merchantAccount
*/
void editMerchantAccount(HighMerchantAccount merchantAccount);
/**
* 充值
* @param merId
* @param amount
* @param otherParam
*/
void recharge(Long merId, BigDecimal amount, Map<String, Object> otherParam);
/**
* 查询商户账户
* @param merId
* @return
*/
HighMerchantAccount getStoreAccountDetail(Long merId);
/**
* 统计商户加油金额
* @param merId
* @return
*/
BigDecimal countMerGasOilAmount(Long merId);
/**
* 查询门店加油金额
* @param merId
* @return
*/
List<Map<String, Object>> getStoreGasOilAmountByMer(Long merId);
}

@ -89,7 +89,10 @@ public class BsCompanyServiceImpl implements BsCompanyService {
public BsCompany getCompanyById(Long id) { public BsCompany getCompanyById(Long id) {
BsCompany company =bsCompanyMapper.selectByPrimaryKey(id); BsCompany company =bsCompanyMapper.selectByPrimaryKey(id);
if (company.getRegionId() != null) { if (company.getRegionId() != null) {
// company.setRegionName(commonService.getRegionName(Long.valueOf(company.getRegionId()))); SecRegion region = commonService.getRegionsById(Long.parseLong(company.getRegionId()));
if (region != null) {
company.setRegionName(region.getRegionName());
}
} }
return company; return company;
} }

@ -410,6 +410,13 @@ public class CommonServiceImpl implements CommonService {
return regionMapper.selectByPrimaryKey(regionId); return regionMapper.selectByPrimaryKey(regionId);
} }
@Override
public List<SecRegion> getProvinceList() {
SecRegionExample example = new SecRegionExample();
example.createCriteria().andParentIdIsNull().andStatusEqualTo(1);
return regionMapper.selectByExample(example);
}
@Override @Override
public SecRegion getRegionsByName(String regionName) { public SecRegion getRegionsByName(String regionName) {
SecRegionExample example = new SecRegionExample(); SecRegionExample example = new SecRegionExample();

@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -134,12 +135,74 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
} }
discount = discount.divide(new BigDecimal("100")); discount = discount.divide(new BigDecimal("100"));
// 枪价 // 枪价
BigDecimal priceGun = null; BigDecimal priceGun;
// 优惠价 // 优惠价
BigDecimal priceVip = null; BigDecimal priceVip;
// 优惠幅度
BigDecimal preferentialMargin = new BigDecimal("0");
// 来源类型 1:平台自建 2:团油 // 查询油站价格
if (store.getSourceType().equals(2)) { HighGasOilPrice gasOilPrice = gasOilPriceService.getGasOilPriceByStoreAndOilNo(goodsId, Integer.parseInt(oilNo));
if (gasOilPrice == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格");
}
priceGun = gasOilPrice.getPriceGun();
priceVip = gasOilPrice.getPriceVip();
preferentialMargin = gasOilPrice.getPreferentialMargin();
// 国标价
BigDecimal priceOfficial = gasOilPrice.getPriceOfficial();
GasPayPriceModel payPriceModel = new GasPayPriceModel();
if (store.getSourceType().equals(1)) {
// 嗨森逛平台价 国标价 * 折扣
BigDecimal pricePlatform = priceGun.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
// 加油金额
payPriceModel.setOilingPrice(oilingPrice);
// 加油站枪价
payPriceModel.setPriceGun(priceGun);
// 加油站优惠价
payPriceModel.setPriceVip(priceVip);
// 加油站国标价
payPriceModel.setPriceOfficial(priceOfficial);
// 平台价
payPriceModel.setPricePlatform(pricePlatform);
// 加油升数,计算方式:加油金额 / 枪价
payPriceModel.setOilLiters(oilingPrice.divide(priceGun, 2, BigDecimal.ROUND_HALF_DOWN));
// 平台折扣,我们平台或者代理商设置的折扣
payPriceModel.setDiscount(discount.compareTo(new BigDecimal("1.00")) == 0 ? new BigDecimal("100") : discount);
// 加油补贴, 计算方式:加油站枪价 - 加油站VIP价
payPriceModel.setOilSubsidy(priceGun.subtract(priceVip));
// 折扣,1 -平台折扣
BigDecimal decimal1 = new BigDecimal("1").subtract(discount);
// 油枪价 - 优惠幅度
BigDecimal price = payPriceModel.getPriceGun().subtract(preferentialMargin);
// 优惠价格 (油枪价 - 优惠幅度) * 系统折扣
payPriceModel.setPricePreferences(price.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
// 每升优惠 枪价 - 优惠价格
payPriceModel.setLitersPreferences(priceGun.subtract(payPriceModel.getPricePreferences()));
// 本次优惠 加油升数 * 每升优惠
payPriceModel.setTotalPreferences(payPriceModel.getOilLiters().multiply(payPriceModel.getLitersPreferences()).setScale(2, BigDecimal.ROUND_DOWN));
// 支付价格 加油金额 - 本次优惠
payPriceModel.setPayPrice(oilingPrice.subtract(payPriceModel.getTotalPreferences()));
} else if (store.getSourceType().equals(2)) {
// 查询油站油品价格 // 查询油站油品价格
JSONObject oilPriceObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), oilNo); JSONObject oilPriceObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), oilNo);
if (oilPriceObject == null) { if (oilPriceObject == null) {
@ -154,24 +217,10 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
priceGun = priceDetail.getBigDecimal("priceGun"); priceGun = priceDetail.getBigDecimal("priceGun");
// 团油优惠价 // 团油优惠价
priceVip = priceDetail.getBigDecimal("priceVip"); priceVip = priceDetail.getBigDecimal("priceVip");
}
HighGasOilPrice gasOilPrice = gasOilPriceService.getGasOilPriceByStoreAndOilNo(goodsId, Integer.parseInt(oilNo));
if (gasOilPrice == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格");
}
if (priceGun == null) {
priceGun = gasOilPrice.getPriceGun();
}
if (priceVip == null) {
priceVip = gasOilPrice.getPriceVip();
}
// 团油国标价
BigDecimal priceOfficial = gasOilPrice.getPriceOfficial();
// 嗨森逛平台价 国标价 * 折扣 // 嗨森逛平台价 国标价 * 折扣
BigDecimal pricePlatform = priceGun.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal pricePlatform = priceGun.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
GasPayPriceModel payPriceModel = new GasPayPriceModel();
// 加油金额 // 加油金额
payPriceModel.setOilingPrice(oilingPrice); payPriceModel.setOilingPrice(oilingPrice);
@ -191,7 +240,7 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
payPriceModel.setOilLiters(oilingPrice.divide(priceGun, 2, BigDecimal.ROUND_HALF_DOWN)); payPriceModel.setOilLiters(oilingPrice.divide(priceGun, 2, BigDecimal.ROUND_HALF_DOWN));
// 平台折扣,我们平台或者代理商设置的折扣 // 平台折扣,我们平台或者代理商设置的折扣
payPriceModel.setDiscount(discount.compareTo(new BigDecimal("1.00")) == 0 ? new BigDecimal("0") : discount); payPriceModel.setDiscount(discount.compareTo(new BigDecimal("1.00")) == 0 ? new BigDecimal("100") : discount);
// 加油补贴, 计算方式:团油枪价 - 团油VIP价 // 加油补贴, 计算方式:团油枪价 - 团油VIP价
payPriceModel.setOilSubsidy(priceGun.subtract(priceVip)); payPriceModel.setOilSubsidy(priceGun.subtract(priceVip));
@ -213,7 +262,7 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
// 支付价格 // 支付价格
payPriceModel.setPayPrice(oilingPrice.subtract(payPriceModel.getTotalPreferences())); payPriceModel.setPayPrice(oilingPrice.subtract(payPriceModel.getTotalPreferences()));
}
return payPriceModel; return payPriceModel;
} }
} }

@ -3,6 +3,8 @@ package com.hai.service.impl;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.RedisUtil;
import com.hai.dao.HighGasOilPriceTaskMapper; import com.hai.dao.HighGasOilPriceTaskMapper;
import com.hai.entity.HighGasOilPrice; import com.hai.entity.HighGasOilPrice;
import com.hai.entity.HighGasOilPriceOfficial; import com.hai.entity.HighGasOilPriceOfficial;
@ -11,12 +13,15 @@ import com.hai.entity.HighGasOilPriceTaskExample;
import com.hai.enum_type.GasTaskExecutionTypeEnum; import com.hai.enum_type.GasTaskExecutionTypeEnum;
import com.hai.enum_type.GasTaskPriceTypeEnum; import com.hai.enum_type.GasTaskPriceTypeEnum;
import com.hai.enum_type.GasTaskStatusEnum; import com.hai.enum_type.GasTaskStatusEnum;
import com.hai.msg.entity.MsgTopic;
import com.hai.service.HighGasOilPriceOfficialService; import com.hai.service.HighGasOilPriceOfficialService;
import com.hai.service.HighGasOilPriceService; import com.hai.service.HighGasOilPriceService;
import com.hai.service.HighGasOilPriceTaskService; import com.hai.service.HighGasOilPriceTaskService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
@ -26,6 +31,9 @@ import java.util.Map;
@Service("gasOilPriceTaskService") @Service("gasOilPriceTaskService")
public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskService { public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskService {
@Resource
private RedisUtil redisUtil;
@Resource @Resource
private HighGasOilPriceTaskMapper gasOilPriceTaskMapper; private HighGasOilPriceTaskMapper gasOilPriceTaskMapper;
@ -48,20 +56,35 @@ public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskServic
} }
@Override @Override
@Transactional(propagation= Propagation.REQUIRED)
public void batchAddTask(List<HighGasOilPriceTask> taskList) {
for (HighGasOilPriceTask task : taskList) {
addTask(task);
}
}
@Override
@Transactional(propagation= Propagation.REQUIRED)
public void addTask(HighGasOilPriceTask gasOilPriceTask) { public void addTask(HighGasOilPriceTask gasOilPriceTask) {
editData(gasOilPriceTask); editData(gasOilPriceTask);
// 立刻执行 // 立刻执行
if (gasOilPriceTask.getExecutionType().equals(GasTaskExecutionTypeEnum.type1.getStatus())) { if (gasOilPriceTask.getExecutionType().equals(GasTaskExecutionTypeEnum.type1.getStatus())) {
businessHandle(gasOilPriceTask); businessHandle(gasOilPriceTask);
}
} else if (gasOilPriceTask.getExecutionType().equals(GasTaskExecutionTypeEnum.type2.getStatus())) {
long time = DateUtil.getSecondDiff(new Date(), gasOilPriceTask.getStartTime());
if (time >= 1) {
redisUtil.set(MsgTopic.oilPriceTask.getName() + "-" + gasOilPriceTask.getId(), "", time);
} else {
businessHandle(gasOilPriceTask);
}
}
} }
@Override @Override
@Transactional(propagation= Propagation.REQUIRED)
public void businessHandle(HighGasOilPriceTask gasOilPriceTask) { public void businessHandle(HighGasOilPriceTask gasOilPriceTask) {
// 立刻执行 // 立刻执行
if (gasOilPriceTask.getExecutionType().equals(GasTaskExecutionTypeEnum.type1.getStatus())) {
gasOilPriceTask.setStartTime(new Date()); gasOilPriceTask.setStartTime(new Date());
gasOilPriceTask.setStatus(GasTaskStatusEnum.status2.getStatus()); gasOilPriceTask.setStatus(GasTaskStatusEnum.status2.getStatus());
editData(gasOilPriceTask); editData(gasOilPriceTask);
@ -105,7 +128,6 @@ public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskServic
} }
} }
}
@Override @Override
public HighGasOilPriceTask getDetailById(Long taskId) { public HighGasOilPriceTask getDetailById(Long taskId) {
@ -121,6 +143,9 @@ public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskServic
} }
detail.setStatus(GasTaskStatusEnum.status0.getStatus()); detail.setStatus(GasTaskStatusEnum.status0.getStatus());
editData(detail); editData(detail);
// 从redis中删除任务
redisUtil.del(MsgTopic.oilPriceTask.getName() + "-" + taskId);
} }
@Override @Override
@ -145,6 +170,10 @@ public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskServic
criteria.andMerStoreNameLike("%" + MapUtils.getString(param, "merStoreName") + "%"); criteria.andMerStoreNameLike("%" + MapUtils.getString(param, "merStoreName") + "%");
} }
if (StringUtils.isNotBlank(MapUtils.getString(param, "merStoreKey"))) {
criteria.andMerStoreKeyLike("%" + MapUtils.getString(param, "merStoreKey") + "%");
}
if (MapUtils.getInteger(param, "oilType") != null) { if (MapUtils.getInteger(param, "oilType") != null) {
criteria.andOilTypeEqualTo(MapUtils.getInteger(param, "oilType")); criteria.andOilTypeEqualTo(MapUtils.getInteger(param, "oilType"));
} }

@ -0,0 +1,93 @@
package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.BankNumberUtil;
import com.hai.dao.HighMerchantAccountMapper;
import com.hai.entity.HighMerchant;
import com.hai.entity.HighMerchantAccount;
import com.hai.entity.HighMerchantAccountExample;
import com.hai.entity.HighMerchantStoreAccount;
import com.hai.model.HighMerchantModel;
import com.hai.model.HighMerchantStoreModel;
import com.hai.service.HighMerchantAccountService;
import com.hai.service.HighMerchantService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("merchantAccountService")
public class HighMerchantAccountServiceImpl implements HighMerchantAccountService {
@Resource
private HighMerchantAccountMapper merchantAccountMapper;
@Resource
private HighMerchantService merchantService;
@Override
public void editMerchantAccount(HighMerchantAccount merchantAccount) {
if (merchantAccount.getId() == null) {
merchantAccount.setAccountNo(BankNumberUtil.getBrankNumber("6"));
merchantAccount.setCreateTime(new Date());
merchantAccount.setUpdateTime(new Date());
merchantAccount.setStatus(1);
merchantAccountMapper.insert(merchantAccount);
} else {
merchantAccount.setUpdateTime(new Date());
merchantAccountMapper.updateByPrimaryKey(merchantAccount);
}
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void recharge(Long merId, BigDecimal amount, Map<String, Object> otherParam) {
// 查询商户
HighMerchant merchant = merchantService.getDetailById(merId);
if (merchant == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户");
}
// 是否开通了账户
HighMerchantAccount account = getStoreAccountDetail(merId);
if (account == null) {
account = new HighMerchantAccount();
account.setMerId(merId);
account.setAmounts(new BigDecimal("0"));
}
// 变更前金额
BigDecimal beforeAmount = account.getAmounts();
// 计算金额
account.setAmounts(account.getAmounts().add(amount));
// 变更后金额
BigDecimal afterAmount = account.getAmounts();
editMerchantAccount(account);
}
@Override
public HighMerchantAccount getStoreAccountDetail(Long merId) {
HighMerchantAccountExample example = new HighMerchantAccountExample();
example.createCriteria().andStatusEqualTo(1).andMerIdEqualTo(merId);
List<HighMerchantAccount> list = merchantAccountMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public BigDecimal countMerGasOilAmount(Long merId) {
return merchantAccountMapper.countMerGasOilAmount(merId);
}
@Override
public List<Map<String, Object>> getStoreGasOilAmountByMer(Long merId) {
return merchantAccountMapper.selectStoreGasOilAmountByMer(merId);
}
}

@ -178,6 +178,14 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService {
HighMerchantStoreExample example = new HighMerchantStoreExample(); HighMerchantStoreExample example = new HighMerchantStoreExample();
HighMerchantStoreExample.Criteria criteria = example.createCriteria(); HighMerchantStoreExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getInteger(map, "sourceType") != null) {
criteria.andSourceTypeEqualTo(MapUtils.getInteger(map, "sourceType"));
}
if (MapUtils.getLong(map, "companyId") != null) { if (MapUtils.getLong(map, "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId")); criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId"));
} }

@ -36,7 +36,7 @@ public class HighOilCardRecordServiceImpl implements HighOilCardRecordService {
oilCardRecord.setOpUserName(userInfoModel.getSecUser().getUserName()); oilCardRecord.setOpUserName(userInfoModel.getSecUser().getUserName());
} }
HighUserModel userModel = userCenter.getSessionModel(HighUserModel.class); HighUserModel userModel = userCenter.getSessionModel(HighUserModel.class);
if (userModel == null) { if (userModel != null) {
oilCardRecord.setOpUserId(userModel.getHighUser().getId()); oilCardRecord.setOpUserId(userModel.getHighUser().getId());
oilCardRecord.setOpUserName(userModel.getHighUser().getName()); oilCardRecord.setOpUserName(userModel.getHighUser().getName());
} }

Loading…
Cancel
Save