合并代码

dev-discount
袁野 3 years ago
commit 7a067d780d
  1. 113
      hai-bweb/src/main/java/com/bweb/controller/HighGasOilPriceOfficialController.java
  2. 118
      hai-bweb/src/main/java/com/bweb/controller/HighGasOilPriceTaskController.java
  3. 18
      hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java
  4. 7
      hai-cweb/src/main/java/com/cweb/controller/HighGasController.java
  5. 13
      hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java
  6. 27
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceMapperExt.java
  7. 167
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceTaskMapper.java
  8. 7
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceTaskMapperExt.java
  9. 472
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceTaskSqlProvider.java
  10. 393
      hai-service/src/main/java/com/hai/entity/HighGasOilPriceTask.java
  11. 1634
      hai-service/src/main/java/com/hai/entity/HighGasOilPriceTaskExample.java
  12. 35
      hai-service/src/main/java/com/hai/enum_type/GasTaskExecutionTypeEnum.java
  13. 36
      hai-service/src/main/java/com/hai/enum_type/GasTaskPriceTypeEnum.java
  14. 36
      hai-service/src/main/java/com/hai/enum_type/GasTaskStatusEnum.java
  15. 16
      hai-service/src/main/java/com/hai/service/HighGasOilPriceOfficialService.java
  16. 8
      hai-service/src/main/java/com/hai/service/HighGasOilPriceService.java
  17. 52
      hai-service/src/main/java/com/hai/service/HighGasOilPriceTaskService.java
  18. 53
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceOfficialServiceImpl.java
  19. 5
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceServiceImpl.java
  20. 171
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceTaskServiceImpl.java

@ -0,0 +1,113 @@
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.utils.ResponseMsgUtil;
import com.hai.entity.HighGasOilPrice;
import com.hai.entity.HighGasOilPriceOfficial;
import com.hai.model.ResponseData;
import com.hai.service.HighGasOilPriceOfficialService;
import com.hai.service.HighGasOilPriceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping(value = "/gasOilPriceOfficial")
@Api(value = "油品价格配置")
public class HighGasOilPriceOfficialController {
private static Logger log = LoggerFactory.getLogger(HighGasOilPriceOfficialController.class);
@Resource
private HighGasOilPriceOfficialService gasOilPriceOfficialService;
private HighGasOilPriceService highGasOilPriceService;
@RequestMapping(value="/updateOilPriceOfficial",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改油品国标价价格")
public ResponseData updateOilPriceOfficial(@RequestBody JSONObject body) {
try {
if (body.getLong("regionId") == null
|| body.getInteger("oilNo") == null
|| body.getBigDecimal("price") == null
) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
HighGasOilPriceOfficial price = gasOilPriceOfficialService.getPrice(body.getLong("regionId"), body.getInteger("oilNo"));
if (price == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到价格");
}
price.setPriceOfficial(body.getBigDecimal("price"));
gasOilPriceOfficialService.editPrice(body.getLong("regionId"), body.getInteger("oilNo"), body.getBigDecimal("price"));
new Thread(() -> {
// 查询区域下的油品
List<HighGasOilPrice> list = highGasOilPriceService.getPriceListByRegionAndOilNo(body.getLong("regionId"), body.getInteger("oilNo"));
for (HighGasOilPrice gasOilPrice : list) {
gasOilPrice.setPriceOfficial(body.getBigDecimal("price"));
highGasOilPriceService.editGasOilPrice(gasOilPrice);
}
}).start();
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGasOilPriceOfficialController -> updateOilPriceOfficial() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getOilPriceOfficialDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询油品国标价详情")
public ResponseData getOilPriceOfficialDetail(@RequestParam(name = "regionId", required = true) Long regionId,
@RequestParam(name = "oilNo", required = true) Integer oilNo) {
try {
return ResponseMsgUtil.success(gasOilPriceOfficialService.getPrice(regionId,oilNo));
} catch (Exception e) {
log.error("HighGasOilPriceOfficialController -> getOilPriceOfficialDetail() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getOilPriceOfficialList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询油品国标价列表")
public ResponseData getOilPriceOfficialList(@RequestParam(name = "regionName", required = false) String regionName,
@RequestParam(name = "oilNo", required = false) Integer oilNo,
@RequestParam(name = "oilType", required = false) Integer oilType,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String, Object> param = new HashMap<>();
param.put("regionName", regionName);
param.put("oilNo", oilNo);
param.put("oilType", oilType);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(gasOilPriceOfficialService.getPriceList(param)));
} catch (Exception e) {
log.error("HighGasOilPriceOfficialController -> getOilPriceOfficialList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,118 @@
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.utils.ResponseMsgUtil;
import com.hai.model.ResponseData;
import com.hai.service.HighGasOilPriceTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/gasOilPriceTask")
@Api(value = "油品价格配置")
public class HighGasOilPriceTaskController {
private static Logger log = LoggerFactory.getLogger(HighGasOilPriceTaskController.class);
@Resource
private HighGasOilPriceTaskService gasOilPriceTaskService;
@RequestMapping(value="/addTask",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "增加任务")
public ResponseData addTask(@RequestBody JSONObject body) {
try {
if (body.getLong("regionId") == null
|| body.getInteger("oilNo") == null
|| body.getBigDecimal("price") == null
) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGasOilPriceTaskController -> addTask() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/delTask",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除任务")
public ResponseData delTask(@RequestBody JSONObject body) {
try {
if (body.getLong("taskId") == null) {
log.error("HighGasOilPriceTaskController -> delTask() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
gasOilPriceTaskService.delTask(body.getLong("taskId"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGasOilPriceTaskController -> delTask() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getTaskDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询任务详情")
public ResponseData getTaskDetail(@RequestParam(name = "taskId", required = true) Long taskId) {
try {
return ResponseMsgUtil.success(gasOilPriceTaskService.getDetailById(taskId));
} catch (Exception e) {
log.error("HighGasOilPriceTaskController -> getTaskDetail() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getTaskList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询任务列表")
public ResponseData getTaskList(@RequestParam(name = "regionId", required = false) Integer regionId,
@RequestParam(name = "regionName", required = false) String regionName,
@RequestParam(name = "merStoreId", required = false) Integer merStoreId,
@RequestParam(name = "merStoreName", required = false) String merStoreName,
@RequestParam(name = "oilType", required = false) Integer oilType,
@RequestParam(name = "oilNo", required = false) Integer oilNo,
@RequestParam(name = "priceType", required = false) Integer priceType,
@RequestParam(name = "executionType", required = false) Integer executionType,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String, Object> param = new HashMap<>();
param.put("regionId", regionId);
param.put("regionName", regionName);
param.put("status", status);
param.put("status", status);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(gasOilPriceTaskService.getTaskList(param)));
} catch (Exception e) {
log.error("HighGasOilPriceTaskController -> getTaskList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -11,15 +11,13 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.BsCompany;
import com.hai.entity.HighMerchant; import com.hai.entity.HighMerchant;
import com.hai.entity.HighMerchantStore; import com.hai.entity.HighMerchantStore;
import com.hai.entity.SecRegion; import com.hai.entity.SecRegion;
import com.hai.enum_type.MerchantStoreSourceType; import com.hai.enum_type.MerchantStoreSourceType;
import com.hai.model.*; import com.hai.model.*;
import com.hai.service.CommonService; import com.hai.service.*;
import com.hai.service.HighMerchantService;
import com.hai.service.HighMerchantStoreService;
import com.hai.service.SecUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -57,6 +55,9 @@ public class HighMerchantStoreController {
@Resource @Resource
private HighMerchantStoreService highMerchantStoreService; private HighMerchantStoreService highMerchantStoreService;
@Resource
private BsCompanyService bsCompanyService;
@Resource @Resource
private HighMerchantService highMerchantService; private HighMerchantService highMerchantService;
@ -95,12 +96,17 @@ public class HighMerchantStoreController {
log.error("HighMerchantStoreController -> insertMerchantStore() error!","未找到商户"); log.error("HighMerchantStoreController -> insertMerchantStore() error!","未找到商户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, "");
} }
BsCompany company = bsCompanyService.getCompanyById(merchant.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)) { if (highMerchantStore.getType() != null && highMerchantStore.getType().equals(1)) {
highMerchantStore.setRegionId(regionMap.get("region").getParentId()); highMerchantStore.setRegionId(Long.parseLong(company.getRegionId()));
highMerchantStore.setRegionName(commonService.getRegionName(regionMap.get("region").getParentId())); highMerchantStore.setRegionName(commonService.getRegionName(Long.parseLong(company.getRegionId())));
} else { } else {
// 如果是重庆市的区县,使用重庆市的区域代码 // 如果是重庆市的区县,使用重庆市的区域代码
if (regionMap.get("region").getRegionId().intValue() == 500100) { if (regionMap.get("region").getRegionId().intValue() == 500100) {

@ -232,6 +232,7 @@ public class HighGasController {
param.put("cityName", null); param.put("cityName", null);
param.put("countyCode", null); param.put("countyCode", null);
param.put("countyName", null); param.put("countyName", null);
param.put("goodsId", store.getId());
param.put("gasId", store.getStoreKey()); param.put("gasId", store.getStoreKey());
param.put("gasName", store.getStoreName()); param.put("gasName", store.getStoreName());
param.put("gasAddress", store.getAddress()); param.put("gasAddress", store.getAddress());
@ -280,6 +281,7 @@ public class HighGasController {
JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(storeKey); JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(storeKey);
if (jsonObject != null && jsonObject.getString("code").equals("200")) { if (jsonObject != null && jsonObject.getString("code").equals("200")) {
JSONObject result = jsonObject.getJSONObject("result"); JSONObject result = jsonObject.getJSONObject("result");
result.put("goodsId", store.getId());
// 原始油品价格 // 原始油品价格
JSONArray originalOilPriceList = result.getJSONArray("oilPriceList"); JSONArray originalOilPriceList = result.getJSONArray("oilPriceList");
@ -350,6 +352,9 @@ public class HighGasController {
@RequestParam(name = "latitude", required = true) String latitude, @RequestParam(name = "latitude", required = true) String latitude,
@RequestParam(name = "isTyAgent", required = false) Boolean isTyAgent) { @RequestParam(name = "isTyAgent", required = false) Boolean isTyAgent) {
try { try {
if (StringUtils.isBlank(latitude) || StringUtils.isBlank(latitude)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String, Object> station = gasOilPriceService.recentGasStation(longitude, latitude); Map<String, Object> station = gasOilPriceService.recentGasStation(longitude, latitude);
if (station == null) { if (station == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "附近没有加油站哦"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "附近没有加油站哦");
@ -374,6 +379,7 @@ public class HighGasController {
param.put("cityName", null); param.put("cityName", null);
param.put("countyCode", null); param.put("countyCode", null);
param.put("countyName", null); param.put("countyName", null);
param.put("goodsId", store.getId());
param.put("gasId", store.getStoreKey()); param.put("gasId", store.getStoreKey());
param.put("gasName", store.getStoreName()); param.put("gasName", store.getStoreName());
param.put("gasAddress", store.getAddress()); param.put("gasAddress", store.getAddress());
@ -422,6 +428,7 @@ public class HighGasController {
JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(MapUtils.getString(station, "storeKey")); JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(MapUtils.getString(station, "storeKey"));
if (jsonObject != null && jsonObject.getString("code").equals("200")) { if (jsonObject != null && jsonObject.getString("code").equals("200")) {
JSONObject result = jsonObject.getJSONObject("result"); JSONObject result = jsonObject.getJSONObject("result");
result.put("goodsId", store.getId());
// 原始油品价格 // 原始油品价格
JSONArray originalOilPriceList = result.getJSONArray("oilPriceList"); JSONArray originalOilPriceList = result.getJSONArray("oilPriceList");

@ -7,10 +7,12 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.config.TuanYouConfig; import com.hai.config.TuanYouConfig;
import com.hai.entity.HighGasOilPrice; import com.hai.entity.HighGasOilPrice;
import com.hai.entity.HighGasOilPriceOfficial;
import com.hai.entity.HighMerchantStore; import com.hai.entity.HighMerchantStore;
import com.hai.enum_type.GasOilPriceStatusEnum; import com.hai.enum_type.GasOilPriceStatusEnum;
import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantModel;
import com.hai.model.HighMerchantStoreModel; import com.hai.model.HighMerchantStoreModel;
import com.hai.service.HighGasOilPriceOfficialService;
import com.hai.service.HighGasOilPriceService; import com.hai.service.HighGasOilPriceService;
import com.hai.service.HighMerchantService; import com.hai.service.HighMerchantService;
import com.hai.service.HighMerchantStoreService; import com.hai.service.HighMerchantStoreService;
@ -37,6 +39,9 @@ public class HighGasSchedule {
@Resource @Resource
private HighGasOilPriceService highGasOilPriceService; private HighGasOilPriceService highGasOilPriceService;
@Resource
private HighGasOilPriceOfficialService gasOilPriceOfficialService;
@Scheduled(cron = "0 0 1 * * ?") //每日凌晨1点执行一次 @Scheduled(cron = "0 0 1 * * ?") //每日凌晨1点执行一次
public void certification() throws Exception { public void certification() throws Exception {
HighMerchantModel merchant = highMerchantService.getMerchantById(39L); HighMerchantModel merchant = highMerchantService.getMerchantById(39L);
@ -145,4 +150,12 @@ public class HighGasSchedule {
} }
} }
} }
@Scheduled(cron = "0 1 7 * * ?") //每日7点1分执行一次
public void refreshPriceOfficial() throws Exception {
gasOilPriceOfficialService.refreshPriceOfficial();
gasOilPriceOfficialService.refreshGasPriceOfficial(null, null);
}
} }

@ -1,7 +1,11 @@
package com.hai.dao; package com.hai.dao;
import com.hai.entity.HighGasOilPrice;
import org.apache.ibatis.annotations.Param; 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.Select;
import org.apache.ibatis.type.JdbcType;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,4 +41,27 @@ public interface HighGasOilPriceMapperExt {
" FROM high_merchant_store a,high_gas_oil_price b where a.type = 1 and a.`status` = 1 and a.id = b.merchant_store_id and b.`status` = 1 GROUP BY a.id" + " FROM high_merchant_store a,high_gas_oil_price b where a.type = 1 and a.`status` = 1 and a.id = b.merchant_store_id and b.`status` = 1 GROUP BY a.id" +
" ORDER BY distance asc LIMIT 1 "}) " ORDER BY distance asc LIMIT 1 "})
Map<String,Object> recentGasStation(@Param("longitude") String longitude,@Param("latitude") String latitude); Map<String,Object> recentGasStation(@Param("longitude") String longitude,@Param("latitude") String latitude);
@Select({" select b.* from high_merchant_store a, high_gas_oil_price b " +
" where a.id = b.merchant_store_id " +
" and a.`status` = 1 " +
" and a.region_id = #{regionId} " +
" and b.oil_no = #{oilNo} "})
@Results({
@Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
@Result(column="merchant_store_id", property="merchantStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER),
@Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR),
@Result(column="preferential_margin", property="preferentialMargin", jdbcType=JdbcType.DECIMAL),
@Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL),
@Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL),
@Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL),
@Result(column="oil_type", property="oilType", jdbcType=JdbcType.INTEGER),
@Result(column="oil_type_name", property="oilTypeName", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@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<HighGasOilPrice> selectPriceListByRegionAndOilNo(@Param("regionId") Long regionId, @Param("oilNo") Integer oilNo);
} }

@ -0,0 +1,167 @@
package com.hai.dao;
import com.hai.entity.HighGasOilPriceTask;
import com.hai.entity.HighGasOilPriceTaskExample;
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 HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt {
@SelectProvider(type=HighGasOilPriceTaskSqlProvider.class, method="countByExample")
long countByExample(HighGasOilPriceTaskExample example);
@DeleteProvider(type=HighGasOilPriceTaskSqlProvider.class, method="deleteByExample")
int deleteByExample(HighGasOilPriceTaskExample example);
@Delete({
"delete from high_gas_oil_price_task",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_gas_oil_price_task (region_id, region_name, ",
"mer_store_id, mer_store_name, ",
"mer_store_address, 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, ext_2, ext_3)",
"values (#{regionId,jdbcType=BIGINT}, #{regionName,jdbcType=VARCHAR}, ",
"#{merStoreId,jdbcType=BIGINT}, #{merStoreName,jdbcType=VARCHAR}, ",
"#{merStoreAddress,jdbcType=VARCHAR}, #{oilType,jdbcType=INTEGER}, ",
"#{oilTypeName,jdbcType=VARCHAR}, #{oilNo,jdbcType=INTEGER}, ",
"#{oilNoName,jdbcType=VARCHAR}, #{priceType,jdbcType=INTEGER}, ",
"#{price,jdbcType=DECIMAL}, #{executionType,jdbcType=INTEGER}, ",
"#{startTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{opUserId,jdbcType=BIGINT}, #{opUserName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighGasOilPriceTask record);
@InsertProvider(type=HighGasOilPriceTaskSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighGasOilPriceTask record);
@SelectProvider(type=HighGasOilPriceTaskSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="region_id", property="regionId", jdbcType=JdbcType.BIGINT),
@Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_id", property="merStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_store_name", property="merStoreName", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_address", property="merStoreAddress", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_type", property="oilType", jdbcType=JdbcType.INTEGER),
@Result(column="oil_type_name", property="oilTypeName", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER),
@Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR),
@Result(column="price_type", property="priceType", jdbcType=JdbcType.INTEGER),
@Result(column="price", property="price", jdbcType=JdbcType.DECIMAL),
@Result(column="execution_type", property="executionType", jdbcType=JdbcType.INTEGER),
@Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
@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="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@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<HighGasOilPriceTask> selectByExample(HighGasOilPriceTaskExample example);
@Select({
"select",
"id, region_id, region_name, mer_store_id, mer_store_name, mer_store_address, ",
"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, ",
"ext_2, ext_3",
"from high_gas_oil_price_task",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="region_id", property="regionId", jdbcType=JdbcType.BIGINT),
@Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_id", property="merStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_store_name", property="merStoreName", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_store_address", property="merStoreAddress", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_type", property="oilType", jdbcType=JdbcType.INTEGER),
@Result(column="oil_type_name", property="oilTypeName", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER),
@Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR),
@Result(column="price_type", property="priceType", jdbcType=JdbcType.INTEGER),
@Result(column="price", property="price", jdbcType=JdbcType.DECIMAL),
@Result(column="execution_type", property="executionType", jdbcType=JdbcType.INTEGER),
@Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
@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="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@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)
})
HighGasOilPriceTask selectByPrimaryKey(Long id);
@UpdateProvider(type=HighGasOilPriceTaskSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighGasOilPriceTask record, @Param("example") HighGasOilPriceTaskExample example);
@UpdateProvider(type=HighGasOilPriceTaskSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighGasOilPriceTask record, @Param("example") HighGasOilPriceTaskExample example);
@UpdateProvider(type=HighGasOilPriceTaskSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighGasOilPriceTask record);
@Update({
"update high_gas_oil_price_task",
"set region_id = #{regionId,jdbcType=BIGINT},",
"region_name = #{regionName,jdbcType=VARCHAR},",
"mer_store_id = #{merStoreId,jdbcType=BIGINT},",
"mer_store_name = #{merStoreName,jdbcType=VARCHAR},",
"mer_store_address = #{merStoreAddress,jdbcType=VARCHAR},",
"oil_type = #{oilType,jdbcType=INTEGER},",
"oil_type_name = #{oilTypeName,jdbcType=VARCHAR},",
"oil_no = #{oilNo,jdbcType=INTEGER},",
"oil_no_name = #{oilNoName,jdbcType=VARCHAR},",
"price_type = #{priceType,jdbcType=INTEGER},",
"price = #{price,jdbcType=DECIMAL},",
"execution_type = #{executionType,jdbcType=INTEGER},",
"start_time = #{startTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"op_user_id = #{opUserId,jdbcType=BIGINT},",
"op_user_name = #{opUserName,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighGasOilPriceTask record);
}

@ -0,0 +1,7 @@
package com.hai.dao;
/**
* mapper扩展类
*/
public interface HighGasOilPriceTaskMapperExt {
}

@ -0,0 +1,472 @@
package com.hai.dao;
import com.hai.entity.HighGasOilPriceTask;
import com.hai.entity.HighGasOilPriceTaskExample.Criteria;
import com.hai.entity.HighGasOilPriceTaskExample.Criterion;
import com.hai.entity.HighGasOilPriceTaskExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class HighGasOilPriceTaskSqlProvider {
public String countByExample(HighGasOilPriceTaskExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_gas_oil_price_task");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(HighGasOilPriceTaskExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("high_gas_oil_price_task");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(HighGasOilPriceTask record) {
SQL sql = new SQL();
sql.INSERT_INTO("high_gas_oil_price_task");
if (record.getRegionId() != null) {
sql.VALUES("region_id", "#{regionId,jdbcType=BIGINT}");
}
if (record.getRegionName() != null) {
sql.VALUES("region_name", "#{regionName,jdbcType=VARCHAR}");
}
if (record.getMerStoreId() != null) {
sql.VALUES("mer_store_id", "#{merStoreId,jdbcType=BIGINT}");
}
if (record.getMerStoreName() != null) {
sql.VALUES("mer_store_name", "#{merStoreName,jdbcType=VARCHAR}");
}
if (record.getMerStoreAddress() != null) {
sql.VALUES("mer_store_address", "#{merStoreAddress,jdbcType=VARCHAR}");
}
if (record.getOilType() != null) {
sql.VALUES("oil_type", "#{oilType,jdbcType=INTEGER}");
}
if (record.getOilTypeName() != null) {
sql.VALUES("oil_type_name", "#{oilTypeName,jdbcType=VARCHAR}");
}
if (record.getOilNo() != null) {
sql.VALUES("oil_no", "#{oilNo,jdbcType=INTEGER}");
}
if (record.getOilNoName() != null) {
sql.VALUES("oil_no_name", "#{oilNoName,jdbcType=VARCHAR}");
}
if (record.getPriceType() != null) {
sql.VALUES("price_type", "#{priceType,jdbcType=INTEGER}");
}
if (record.getPrice() != null) {
sql.VALUES("price", "#{price,jdbcType=DECIMAL}");
}
if (record.getExecutionType() != null) {
sql.VALUES("execution_type", "#{executionType,jdbcType=INTEGER}");
}
if (record.getStartTime() != null) {
sql.VALUES("start_time", "#{startTime,jdbcType=TIMESTAMP}");
}
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.getOpUserId() != null) {
sql.VALUES("op_user_id", "#{opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.VALUES("op_user_name", "#{opUserName,jdbcType=VARCHAR}");
}
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(HighGasOilPriceTaskExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("region_id");
sql.SELECT("region_name");
sql.SELECT("mer_store_id");
sql.SELECT("mer_store_name");
sql.SELECT("mer_store_address");
sql.SELECT("oil_type");
sql.SELECT("oil_type_name");
sql.SELECT("oil_no");
sql.SELECT("oil_no_name");
sql.SELECT("price_type");
sql.SELECT("price");
sql.SELECT("execution_type");
sql.SELECT("start_time");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("op_user_id");
sql.SELECT("op_user_name");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("high_gas_oil_price_task");
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) {
HighGasOilPriceTask record = (HighGasOilPriceTask) parameter.get("record");
HighGasOilPriceTaskExample example = (HighGasOilPriceTaskExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("high_gas_oil_price_task");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getRegionId() != null) {
sql.SET("region_id = #{record.regionId,jdbcType=BIGINT}");
}
if (record.getRegionName() != null) {
sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}");
}
if (record.getMerStoreId() != null) {
sql.SET("mer_store_id = #{record.merStoreId,jdbcType=BIGINT}");
}
if (record.getMerStoreName() != null) {
sql.SET("mer_store_name = #{record.merStoreName,jdbcType=VARCHAR}");
}
if (record.getMerStoreAddress() != null) {
sql.SET("mer_store_address = #{record.merStoreAddress,jdbcType=VARCHAR}");
}
if (record.getOilType() != null) {
sql.SET("oil_type = #{record.oilType,jdbcType=INTEGER}");
}
if (record.getOilTypeName() != null) {
sql.SET("oil_type_name = #{record.oilTypeName,jdbcType=VARCHAR}");
}
if (record.getOilNo() != null) {
sql.SET("oil_no = #{record.oilNo,jdbcType=INTEGER}");
}
if (record.getOilNoName() != null) {
sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}");
}
if (record.getPriceType() != null) {
sql.SET("price_type = #{record.priceType,jdbcType=INTEGER}");
}
if (record.getPrice() != null) {
sql.SET("price = #{record.price,jdbcType=DECIMAL}");
}
if (record.getExecutionType() != null) {
sql.SET("execution_type = #{record.executionType,jdbcType=INTEGER}");
}
if (record.getStartTime() != null) {
sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}");
}
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.getOpUserId() != null) {
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
}
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_gas_oil_price_task");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("region_id = #{record.regionId,jdbcType=BIGINT}");
sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}");
sql.SET("mer_store_id = #{record.merStoreId,jdbcType=BIGINT}");
sql.SET("mer_store_name = #{record.merStoreName,jdbcType=VARCHAR}");
sql.SET("mer_store_address = #{record.merStoreAddress,jdbcType=VARCHAR}");
sql.SET("oil_type = #{record.oilType,jdbcType=INTEGER}");
sql.SET("oil_type_name = #{record.oilTypeName,jdbcType=VARCHAR}");
sql.SET("oil_no = #{record.oilNo,jdbcType=INTEGER}");
sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}");
sql.SET("price_type = #{record.priceType,jdbcType=INTEGER}");
sql.SET("price = #{record.price,jdbcType=DECIMAL}");
sql.SET("execution_type = #{record.executionType,jdbcType=INTEGER}");
sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}");
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("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
HighGasOilPriceTaskExample example = (HighGasOilPriceTaskExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(HighGasOilPriceTask record) {
SQL sql = new SQL();
sql.UPDATE("high_gas_oil_price_task");
if (record.getRegionId() != null) {
sql.SET("region_id = #{regionId,jdbcType=BIGINT}");
}
if (record.getRegionName() != null) {
sql.SET("region_name = #{regionName,jdbcType=VARCHAR}");
}
if (record.getMerStoreId() != null) {
sql.SET("mer_store_id = #{merStoreId,jdbcType=BIGINT}");
}
if (record.getMerStoreName() != null) {
sql.SET("mer_store_name = #{merStoreName,jdbcType=VARCHAR}");
}
if (record.getMerStoreAddress() != null) {
sql.SET("mer_store_address = #{merStoreAddress,jdbcType=VARCHAR}");
}
if (record.getOilType() != null) {
sql.SET("oil_type = #{oilType,jdbcType=INTEGER}");
}
if (record.getOilTypeName() != null) {
sql.SET("oil_type_name = #{oilTypeName,jdbcType=VARCHAR}");
}
if (record.getOilNo() != null) {
sql.SET("oil_no = #{oilNo,jdbcType=INTEGER}");
}
if (record.getOilNoName() != null) {
sql.SET("oil_no_name = #{oilNoName,jdbcType=VARCHAR}");
}
if (record.getPriceType() != null) {
sql.SET("price_type = #{priceType,jdbcType=INTEGER}");
}
if (record.getPrice() != null) {
sql.SET("price = #{price,jdbcType=DECIMAL}");
}
if (record.getExecutionType() != null) {
sql.SET("execution_type = #{executionType,jdbcType=INTEGER}");
}
if (record.getStartTime() != null) {
sql.SET("start_time = #{startTime,jdbcType=TIMESTAMP}");
}
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.getOpUserId() != null) {
sql.SET("op_user_id = #{opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{opUserName,jdbcType=VARCHAR}");
}
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, HighGasOilPriceTaskExample 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());
}
}
}

@ -0,0 +1,393 @@
package com.hai.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* high_gas_oil_price_task
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class HighGasOilPriceTask implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 区域id
*/
private Long regionId;
/**
* 区域名称
*/
private String regionName;
/**
* 加油站id
*/
private Long merStoreId;
/**
* 加油站名称
*/
private String merStoreName;
/**
* 加油站地址
*/
private String merStoreAddress;
/**
* 油品类型 1:汽油:2:柴油;3:天然气
*/
private Integer oilType;
/**
* 油品类型名 1:汽油:2:柴油;3:天然气
*/
private String oilTypeName;
/**
* 油号
*/
private Integer oilNo;
/**
* 油品名称
*/
private String oilNoName;
/**
* 价格类型 1. 国标价 2. 油站价 3. 优惠幅度
*/
private Integer priceType;
/**
* 价格
*/
private BigDecimal price;
/**
* 执行类型 1. 立刻执行 2. 定时执行
*/
private Integer executionType;
/**
* 执行时间
*/
private Date startTime;
/**
* 状态 0删除 1等待中 2已执行
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 操作人id
*/
private Long opUserId;
/**
* 操作人名称
*/
private String opUserName;
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 getRegionId() {
return regionId;
}
public void setRegionId(Long regionId) {
this.regionId = regionId;
}
public String getRegionName() {
return regionName;
}
public void setRegionName(String regionName) {
this.regionName = regionName;
}
public Long getMerStoreId() {
return merStoreId;
}
public void setMerStoreId(Long merStoreId) {
this.merStoreId = merStoreId;
}
public String getMerStoreName() {
return merStoreName;
}
public void setMerStoreName(String merStoreName) {
this.merStoreName = merStoreName;
}
public String getMerStoreAddress() {
return merStoreAddress;
}
public void setMerStoreAddress(String merStoreAddress) {
this.merStoreAddress = merStoreAddress;
}
public Integer getOilType() {
return oilType;
}
public void setOilType(Integer oilType) {
this.oilType = oilType;
}
public String getOilTypeName() {
return oilTypeName;
}
public void setOilTypeName(String oilTypeName) {
this.oilTypeName = oilTypeName;
}
public Integer getOilNo() {
return oilNo;
}
public void setOilNo(Integer oilNo) {
this.oilNo = oilNo;
}
public String getOilNoName() {
return oilNoName;
}
public void setOilNoName(String oilNoName) {
this.oilNoName = oilNoName;
}
public Integer getPriceType() {
return priceType;
}
public void setPriceType(Integer priceType) {
this.priceType = priceType;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getExecutionType() {
return executionType;
}
public void setExecutionType(Integer executionType) {
this.executionType = executionType;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
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 Long getOpUserId() {
return opUserId;
}
public void setOpUserId(Long opUserId) {
this.opUserId = opUserId;
}
public String getOpUserName() {
return opUserName;
}
public void setOpUserName(String opUserName) {
this.opUserName = opUserName;
}
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;
}
HighGasOilPriceTask other = (HighGasOilPriceTask) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getRegionId() == null ? other.getRegionId() == null : this.getRegionId().equals(other.getRegionId()))
&& (this.getRegionName() == null ? other.getRegionName() == null : this.getRegionName().equals(other.getRegionName()))
&& (this.getMerStoreId() == null ? other.getMerStoreId() == null : this.getMerStoreId().equals(other.getMerStoreId()))
&& (this.getMerStoreName() == null ? other.getMerStoreName() == null : this.getMerStoreName().equals(other.getMerStoreName()))
&& (this.getMerStoreAddress() == null ? other.getMerStoreAddress() == null : this.getMerStoreAddress().equals(other.getMerStoreAddress()))
&& (this.getOilType() == null ? other.getOilType() == null : this.getOilType().equals(other.getOilType()))
&& (this.getOilTypeName() == null ? other.getOilTypeName() == null : this.getOilTypeName().equals(other.getOilTypeName()))
&& (this.getOilNo() == null ? other.getOilNo() == null : this.getOilNo().equals(other.getOilNo()))
&& (this.getOilNoName() == null ? other.getOilNoName() == null : this.getOilNoName().equals(other.getOilNoName()))
&& (this.getPriceType() == null ? other.getPriceType() == null : this.getPriceType().equals(other.getPriceType()))
&& (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
&& (this.getExecutionType() == null ? other.getExecutionType() == null : this.getExecutionType().equals(other.getExecutionType()))
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
&& (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.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId()))
&& (this.getOpUserName() == null ? other.getOpUserName() == null : this.getOpUserName().equals(other.getOpUserName()))
&& (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 + ((getRegionId() == null) ? 0 : getRegionId().hashCode());
result = prime * result + ((getRegionName() == null) ? 0 : getRegionName().hashCode());
result = prime * result + ((getMerStoreId() == null) ? 0 : getMerStoreId().hashCode());
result = prime * result + ((getMerStoreName() == null) ? 0 : getMerStoreName().hashCode());
result = prime * result + ((getMerStoreAddress() == null) ? 0 : getMerStoreAddress().hashCode());
result = prime * result + ((getOilType() == null) ? 0 : getOilType().hashCode());
result = prime * result + ((getOilTypeName() == null) ? 0 : getOilTypeName().hashCode());
result = prime * result + ((getOilNo() == null) ? 0 : getOilNo().hashCode());
result = prime * result + ((getOilNoName() == null) ? 0 : getOilNoName().hashCode());
result = prime * result + ((getPriceType() == null) ? 0 : getPriceType().hashCode());
result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
result = prime * result + ((getExecutionType() == null) ? 0 : getExecutionType().hashCode());
result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().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 + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode());
result = prime * result + ((getOpUserName() == null) ? 0 : getOpUserName().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(", regionId=").append(regionId);
sb.append(", regionName=").append(regionName);
sb.append(", merStoreId=").append(merStoreId);
sb.append(", merStoreName=").append(merStoreName);
sb.append(", merStoreAddress=").append(merStoreAddress);
sb.append(", oilType=").append(oilType);
sb.append(", oilTypeName=").append(oilTypeName);
sb.append(", oilNo=").append(oilNo);
sb.append(", oilNoName=").append(oilNoName);
sb.append(", priceType=").append(priceType);
sb.append(", price=").append(price);
sb.append(", executionType=").append(executionType);
sb.append(", startTime=").append(startTime);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", opUserId=").append(opUserId);
sb.append(", opUserName=").append(opUserName);
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,35 @@
package com.hai.enum_type;
/**
* 加油站价格任务
* @author hurui
*/
public enum GasTaskExecutionTypeEnum {
type1(1 , "立刻执行"),
type2(2 , "定时执行"),
;
private Integer status;
private String name;
GasTaskExecutionTypeEnum(int status , String name) {
this.status = status;
this.name = name;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,36 @@
package com.hai.enum_type;
/**
* 加油站价格任务
* @author hurui
*/
public enum GasTaskPriceTypeEnum {
type1(1 , "国标价"),
type2(2 , "油站价"),
type3(3 , "优惠幅度"),
;
private Integer status;
private String name;
GasTaskPriceTypeEnum(int status , String name) {
this.status = status;
this.name = name;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,36 @@
package com.hai.enum_type;
/**
* 加油站价格任务
* @author hurui
*/
public enum GasTaskStatusEnum {
status0(0 , "删除"),
status1(1 , "等待中"),
status2(2 , "已执行"),
;
private Integer status;
private String name;
GasTaskStatusEnum(int status , String name) {
this.status = status;
this.name = name;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -3,6 +3,8 @@ package com.hai.service;
import com.hai.entity.HighGasOilPriceOfficial; import com.hai.entity.HighGasOilPriceOfficial;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/** /**
* 油品国标价 * 油品国标价
@ -25,8 +27,22 @@ public interface HighGasOilPriceOfficialService {
*/ */
HighGasOilPriceOfficial getPrice(Long regionId, Integer oilNo); HighGasOilPriceOfficial getPrice(Long regionId, Integer oilNo);
/**
* 查询价格列表
* @param param
* @return
*/
List<HighGasOilPriceOfficial> getPriceList(Map<String, Object> param);
/** /**
* 刷新获取最新的国标价 * 刷新获取最新的国标价
*/ */
void refreshPriceOfficial(); void refreshPriceOfficial();
/**
* 刷新油站的国标价全部
* @param regionId 区域
* @param oilNo 油品
*/
void refreshGasPriceOfficial(Long regionId, Integer oilNo);
} }

@ -35,6 +35,14 @@ public interface HighGasOilPriceService {
*/ */
List<HighGasOilPrice> getGasOilPriceByStore(Long storeId); List<HighGasOilPrice> getGasOilPriceByStore(Long storeId);
/**
* 根据区域和油品 查询数据列表
* @param regionId
* @param oilNo
* @return
*/
List<HighGasOilPrice> getPriceListByRegionAndOilNo(Long regionId, Integer oilNo);
/** /**
* 根据区域和油号查询门店 * 根据区域和油号查询门店
* @param regionId * @param regionId

@ -0,0 +1,52 @@
package com.hai.service;
import com.hai.entity.HighGasOilPriceTask;
import java.util.List;
import java.util.Map;
/**
* 加油站价格任务
* @author hurui
*/
public interface HighGasOilPriceTaskService {
/**
* 编辑数据
* @param gasOilPriceTask
*/
void editData(HighGasOilPriceTask gasOilPriceTask);
/**
* 增加价格任务
* @param gasOilPriceTask
*/
void addTask(HighGasOilPriceTask gasOilPriceTask);
/**
* 业务处理
* @param gasOilPriceTask
*/
void businessHandle(HighGasOilPriceTask gasOilPriceTask);
/**
* 根据id 查询详情
* @param taskId
* @return
*/
HighGasOilPriceTask getDetailById(Long taskId);
/**
* 删除任务
* @param taskId
*/
void delTask(Long taskId);
/**
* 查询任务列表
* @param param
* @return
*/
List<HighGasOilPriceTask> getTaskList(Map<String, Object> param);
}

@ -4,12 +4,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.HttpsUtils;
import com.hai.dao.HighGasOilPriceOfficialMapper; import com.hai.dao.HighGasOilPriceOfficialMapper;
import com.hai.entity.HighGasOilPriceOfficial; import com.hai.entity.*;
import com.hai.entity.HighGasOilPriceOfficialExample;
import com.hai.entity.SecDictionary;
import com.hai.entity.SecRegion;
import com.hai.service.CommonService; import com.hai.service.CommonService;
import com.hai.service.HighGasOilPriceOfficialService; import com.hai.service.HighGasOilPriceOfficialService;
import com.hai.service.HighGasOilPriceService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -24,6 +25,9 @@ public class HighGasOilPriceOfficialServiceImpl implements HighGasOilPriceOffici
@Resource @Resource
private HighGasOilPriceOfficialMapper gasOilPriceOfficialMapper; private HighGasOilPriceOfficialMapper gasOilPriceOfficialMapper;
@Resource
private HighGasOilPriceService highGasOilPriceService;
@Resource @Resource
private CommonService commonService; private CommonService commonService;
@ -61,6 +65,30 @@ public class HighGasOilPriceOfficialServiceImpl implements HighGasOilPriceOffici
return null; return null;
} }
@Override
public List<HighGasOilPriceOfficial> getPriceList(Map<String, Object> param) {
HighGasOilPriceOfficialExample example = new HighGasOilPriceOfficialExample();
HighGasOilPriceOfficialExample.Criteria criteria = example.createCriteria().andStatusEqualTo(1);
if (StringUtils.isNotBlank(MapUtils.getString(param, "regionName"))) {
criteria.andRegionNameLike("%" + MapUtils.getString(param, "regionName") + "%");
}
if (MapUtils.getLong(param, "regionId") != null) {
criteria.andRegionIdEqualTo(MapUtils.getLong(param, "regionId"));
}
if (MapUtils.getInteger(param, "oilNo") != null) {
criteria.andOilNoEqualTo(MapUtils.getInteger(param, "oilNo"));
}
if (MapUtils.getInteger(param, "oilType") != null) {
criteria.andOilTypeEqualTo(MapUtils.getInteger(param, "oilType"));
}
return gasOilPriceOfficialMapper.selectByExample(example);
}
@Override @Override
public void refreshPriceOfficial() { public void refreshPriceOfficial() {
Map<String, String> heardParam = new HashMap<>(); Map<String, String> heardParam = new HashMap<>();
@ -102,4 +130,21 @@ public class HighGasOilPriceOfficialServiceImpl implements HighGasOilPriceOffici
} }
} }
@Override
public void refreshGasPriceOfficial(Long regionId, Integer oilNo) {
Map<String, Object> param = new HashMap<>();
param.put("regionId", regionId);
param.put("oilNo", oilNo);
List<HighGasOilPriceOfficial> priceList = getPriceList(param);
for (HighGasOilPriceOfficial priceOfficial : priceList) {
// 查询区域下的油品
List<HighGasOilPrice> list = highGasOilPriceService.getPriceListByRegionAndOilNo(priceOfficial.getRegionId(), priceOfficial.getOilNo());
for (HighGasOilPrice gasOilPrice : list) {
gasOilPrice.setPriceOfficial(priceOfficial.getPriceOfficial());
highGasOilPriceService.editGasOilPrice(gasOilPrice);
}
}
}
} }

@ -50,6 +50,11 @@ public class HighGasOilPriceServiceImpl implements HighGasOilPriceService {
return highGasOilPriceMapper.selectByExample(example); return highGasOilPriceMapper.selectByExample(example);
} }
@Override
public List<HighGasOilPrice> getPriceListByRegionAndOilNo(Long regionId, Integer oilNo) {
return highGasOilPriceMapper.selectPriceListByRegionAndOilNo(regionId,oilNo);
}
@Override @Override
public List<Map<String,Object>> getStoreListByOilNo(String storeName,Long regionId, String oilNoName) { public List<Map<String,Object>> getStoreListByOilNo(String storeName,Long regionId, String oilNoName) {
return highGasOilPriceMapper.selectStoreListByOilNo(storeName,regionId,oilNoName); return highGasOilPriceMapper.selectStoreListByOilNo(storeName,regionId,oilNoName);

@ -0,0 +1,171 @@
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.dao.HighGasOilPriceTaskMapper;
import com.hai.entity.HighGasOilPrice;
import com.hai.entity.HighGasOilPriceOfficial;
import com.hai.entity.HighGasOilPriceTask;
import com.hai.entity.HighGasOilPriceTaskExample;
import com.hai.enum_type.GasTaskExecutionTypeEnum;
import com.hai.enum_type.GasTaskPriceTypeEnum;
import com.hai.enum_type.GasTaskStatusEnum;
import com.hai.service.HighGasOilPriceOfficialService;
import com.hai.service.HighGasOilPriceService;
import com.hai.service.HighGasOilPriceTaskService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("gasOilPriceTaskService")
public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskService {
@Resource
private HighGasOilPriceTaskMapper gasOilPriceTaskMapper;
@Resource
private HighGasOilPriceService gasOilPriceService;
@Resource
private HighGasOilPriceOfficialService gasOilPriceOfficialService;
@Override
public void editData(HighGasOilPriceTask gasOilPriceTask) {
if (gasOilPriceTask.getId() == null) {
gasOilPriceTask.setStatus(GasTaskStatusEnum.status1.getStatus());
gasOilPriceTask.setCreateTime(new Date());
gasOilPriceTask.setUpdateTime(new Date());
gasOilPriceTaskMapper.insert(gasOilPriceTask);
} else {
gasOilPriceTaskMapper.updateByPrimaryKey(gasOilPriceTask);
}
}
@Override
public void addTask(HighGasOilPriceTask gasOilPriceTask) {
editData(gasOilPriceTask);
// 立刻执行
if (gasOilPriceTask.getExecutionType().equals(GasTaskExecutionTypeEnum.type1.getStatus())) {
businessHandle(gasOilPriceTask);
}
}
@Override
public void businessHandle(HighGasOilPriceTask gasOilPriceTask) {
// 立刻执行
if (gasOilPriceTask.getExecutionType().equals(GasTaskExecutionTypeEnum.type1.getStatus())) {
gasOilPriceTask.setStartTime(new Date());
gasOilPriceTask.setStatus(GasTaskStatusEnum.status2.getStatus());
editData(gasOilPriceTask);
// 国标价
if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type1.getStatus())) {
// 查询国标价油品价格
HighGasOilPriceOfficial price = gasOilPriceOfficialService.getPrice(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo());
if (price == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油品价格");
}
gasOilPriceOfficialService.editPrice(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo(), gasOilPriceTask.getPrice());
new Thread(() -> {
gasOilPriceOfficialService.refreshGasPriceOfficial(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo());
}).start();
}
// 油站价
if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type2.getStatus())) {
// 查询油品价格
HighGasOilPrice price = gasOilPriceService.getGasOilPriceByStoreAndOilNo(gasOilPriceTask.getMerStoreId(), gasOilPriceTask.getOilNo());
if (price == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油品价格");
}
price.setPriceGun(gasOilPriceTask.getPrice());
price.setPriceVip(gasOilPriceTask.getPrice().subtract(price.getPreferentialMargin()));
gasOilPriceService.editGasOilPrice(price);
}
// 优惠幅度
if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())) {
// 查询油品价格
HighGasOilPrice price = gasOilPriceService.getGasOilPriceByStoreAndOilNo(gasOilPriceTask.getMerStoreId(), gasOilPriceTask.getOilNo());
if (price == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油品价格");
}
price.setPreferentialMargin(gasOilPriceTask.getPrice());
price.setPriceVip(price.getPriceGun().subtract(price.getPreferentialMargin()));
gasOilPriceService.editGasOilPrice(price);
}
}
}
@Override
public HighGasOilPriceTask getDetailById(Long taskId) {
return gasOilPriceTaskMapper.selectByPrimaryKey(taskId);
}
@Override
public void delTask(Long taskId) {
// 查询价格任务
HighGasOilPriceTask detail = getDetailById(taskId);
if (detail == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "未找到任务");
}
detail.setStatus(GasTaskStatusEnum.status0.getStatus());
editData(detail);
}
@Override
public List<HighGasOilPriceTask> getTaskList(Map<String, Object> param) {
HighGasOilPriceTaskExample example = new HighGasOilPriceTaskExample();
HighGasOilPriceTaskExample.Criteria criteria = example.createCriteria()
.andStatusNotEqualTo(GasTaskStatusEnum.status0.getStatus());
if (MapUtils.getLong(param, "regionId") != null) {
criteria.andRegionIdEqualTo(MapUtils.getLong(param, "regionId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "regionName"))) {
criteria.andRegionNameLike("%" + MapUtils.getString(param, "regionName") + "%");
}
if (MapUtils.getLong(param, "merStoreId") != null) {
criteria.andMerStoreIdEqualTo(MapUtils.getLong(param, "merStoreId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "merStoreName"))) {
criteria.andMerStoreNameLike("%" + MapUtils.getString(param, "merStoreName") + "%");
}
if (MapUtils.getInteger(param, "oilType") != null) {
criteria.andOilTypeEqualTo(MapUtils.getInteger(param, "oilType"));
}
if (MapUtils.getInteger(param, "oilNo") != null) {
criteria.andOilNoEqualTo(MapUtils.getInteger(param, "oilNo"));
}
if (MapUtils.getInteger(param, "priceType") != null) {
criteria.andPriceTypeEqualTo(MapUtils.getInteger(param, "priceType"));
}
if (MapUtils.getInteger(param, "executionType") != null) {
criteria.andExecutionTypeEqualTo(MapUtils.getInteger(param, "executionType"));
}
if (MapUtils.getInteger(param, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status"));
}
example.setOrderByClause("create_time desc");
return gasOilPriceTaskMapper.selectByExample(example);
}
}
Loading…
Cancel
Save