commit
7a067d780d
@ -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); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
@ -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; |
||||||
|
} |
||||||
|
} |
@ -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); |
||||||
|
|
||||||
|
} |
@ -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…
Reference in new issue