提交代码

dev-discount
胡锐 3 years ago
parent ae4668ba97
commit 350564ad31
  1. 118
      hai-bweb/src/main/java/com/bweb/controller/HighGasOilPriceTaskController.java
  2. 18
      hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java
  3. 7
      hai-cweb/src/main/java/com/cweb/controller/HighGasController.java
  4. 2
      hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java
  5. 8
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceTaskMapper.java
  6. 8
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceTaskSqlProvider.java
  7. 6
      hai-service/src/main/java/com/hai/entity/HighGasOilPriceTask.java
  8. 20
      hai-service/src/main/java/com/hai/entity/HighGasOilPriceTaskExample.java
  9. 35
      hai-service/src/main/java/com/hai/enum_type/GasTaskExecutionTypeEnum.java
  10. 36
      hai-service/src/main/java/com/hai/enum_type/GasTaskPriceTypeEnum.java
  11. 36
      hai-service/src/main/java/com/hai/enum_type/GasTaskStatusEnum.java
  12. 6
      hai-service/src/main/java/com/hai/service/HighGasOilPriceOfficialService.java
  13. 52
      hai-service/src/main/java/com/hai/service/HighGasOilPriceTaskService.java
  14. 8
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceOfficialServiceImpl.java
  15. 171
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceTaskServiceImpl.java

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

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

@ -156,6 +156,6 @@ public class HighGasSchedule {
gasOilPriceOfficialService.refreshPriceOfficial();
gasOilPriceOfficialService.refreshGasPriceOfficial();
gasOilPriceOfficialService.refreshGasPriceOfficial(null, null);
}
}

@ -49,7 +49,7 @@ public interface HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt
"create_time, update_time, ",
"op_user_id, op_user_name, ",
"ext_1, ext_2, ext_3)",
"values (#{regionId,jdbcType=INTEGER}, #{regionName,jdbcType=VARCHAR}, ",
"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}, ",
@ -70,7 +70,7 @@ public interface HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt
@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.INTEGER),
@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),
@ -105,7 +105,7 @@ public interface HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="region_id", property="regionId", jdbcType=JdbcType.INTEGER),
@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),
@ -140,7 +140,7 @@ public interface HighGasOilPriceTaskMapper extends HighGasOilPriceTaskMapperExt
@Update({
"update high_gas_oil_price_task",
"set region_id = #{regionId,jdbcType=INTEGER},",
"set region_id = #{regionId,jdbcType=BIGINT},",
"region_name = #{regionName,jdbcType=VARCHAR},",
"mer_store_id = #{merStoreId,jdbcType=BIGINT},",
"mer_store_name = #{merStoreName,jdbcType=VARCHAR},",

@ -29,7 +29,7 @@ public class HighGasOilPriceTaskSqlProvider {
sql.INSERT_INTO("high_gas_oil_price_task");
if (record.getRegionId() != null) {
sql.VALUES("region_id", "#{regionId,jdbcType=INTEGER}");
sql.VALUES("region_id", "#{regionId,jdbcType=BIGINT}");
}
if (record.getRegionName() != null) {
@ -165,7 +165,7 @@ public class HighGasOilPriceTaskSqlProvider {
}
if (record.getRegionId() != null) {
sql.SET("region_id = #{record.regionId,jdbcType=INTEGER}");
sql.SET("region_id = #{record.regionId,jdbcType=BIGINT}");
}
if (record.getRegionName() != null) {
@ -257,7 +257,7 @@ public class HighGasOilPriceTaskSqlProvider {
sql.UPDATE("high_gas_oil_price_task");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("region_id = #{record.regionId,jdbcType=INTEGER}");
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}");
@ -289,7 +289,7 @@ public class HighGasOilPriceTaskSqlProvider {
sql.UPDATE("high_gas_oil_price_task");
if (record.getRegionId() != null) {
sql.SET("region_id = #{regionId,jdbcType=INTEGER}");
sql.SET("region_id = #{regionId,jdbcType=BIGINT}");
}
if (record.getRegionName() != null) {

@ -22,7 +22,7 @@ public class HighGasOilPriceTask implements Serializable {
/**
* 区域id
*/
private Integer regionId;
private Long regionId;
/**
* 区域名称
@ -125,11 +125,11 @@ public class HighGasOilPriceTask implements Serializable {
this.id = id;
}
public Integer getRegionId() {
public Long getRegionId() {
return regionId;
}
public void setRegionId(Integer regionId) {
public void setRegionId(Long regionId) {
this.regionId = regionId;
}

@ -196,52 +196,52 @@ public class HighGasOilPriceTaskExample {
return (Criteria) this;
}
public Criteria andRegionIdEqualTo(Integer value) {
public Criteria andRegionIdEqualTo(Long value) {
addCriterion("region_id =", value, "regionId");
return (Criteria) this;
}
public Criteria andRegionIdNotEqualTo(Integer value) {
public Criteria andRegionIdNotEqualTo(Long value) {
addCriterion("region_id <>", value, "regionId");
return (Criteria) this;
}
public Criteria andRegionIdGreaterThan(Integer value) {
public Criteria andRegionIdGreaterThan(Long value) {
addCriterion("region_id >", value, "regionId");
return (Criteria) this;
}
public Criteria andRegionIdGreaterThanOrEqualTo(Integer value) {
public Criteria andRegionIdGreaterThanOrEqualTo(Long value) {
addCriterion("region_id >=", value, "regionId");
return (Criteria) this;
}
public Criteria andRegionIdLessThan(Integer value) {
public Criteria andRegionIdLessThan(Long value) {
addCriterion("region_id <", value, "regionId");
return (Criteria) this;
}
public Criteria andRegionIdLessThanOrEqualTo(Integer value) {
public Criteria andRegionIdLessThanOrEqualTo(Long value) {
addCriterion("region_id <=", value, "regionId");
return (Criteria) this;
}
public Criteria andRegionIdIn(List<Integer> values) {
public Criteria andRegionIdIn(List<Long> values) {
addCriterion("region_id in", values, "regionId");
return (Criteria) this;
}
public Criteria andRegionIdNotIn(List<Integer> values) {
public Criteria andRegionIdNotIn(List<Long> values) {
addCriterion("region_id not in", values, "regionId");
return (Criteria) this;
}
public Criteria andRegionIdBetween(Integer value1, Integer value2) {
public Criteria andRegionIdBetween(Long value1, Long value2) {
addCriterion("region_id between", value1, value2, "regionId");
return (Criteria) this;
}
public Criteria andRegionIdNotBetween(Integer value1, Integer value2) {
public Criteria andRegionIdNotBetween(Long value1, Long value2) {
addCriterion("region_id not between", value1, value2, "regionId");
return (Criteria) this;
}

@ -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;
}
}

@ -40,7 +40,9 @@ public interface HighGasOilPriceOfficialService {
void refreshPriceOfficial();
/**
* 刷新油站的国标价
* 刷新油站的国标价全部
* @param regionId 区域
* @param oilNo 油品
*/
void refreshGasPriceOfficial();
void refreshGasPriceOfficial(Long regionId, Integer oilNo);
}

@ -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);
}

@ -131,8 +131,12 @@ public class HighGasOilPriceOfficialServiceImpl implements HighGasOilPriceOffici
}
@Override
public void refreshGasPriceOfficial() {
List<HighGasOilPriceOfficial> priceList = getPriceList(new HashMap<>());
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());

@ -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