From e51969772797cec95b0c4b337516dd1d52ad5fcb Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 30 Jul 2024 18:14:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BsGasOilPriceController.java | 42 +- .../BsGasOilPriceWeekController.java | 79 ++ .../com/cweb/controller/BsGasController.java | 20 + cweb/src/main/resources/prod2/application.yml | 91 ++ .../main/resources/prod2/config.properties | 1 + cweb/src/main/resources/prod2/logback.xml | 72 + .../hfkj/schedule/GasOilPriceSchedule.java | 34 + .../com/hfkj/dao/BsGasOilPriceMapperExt.java | 10 +- .../com/hfkj/dao/BsGasOilPriceWeekMapper.java | 141 ++ .../hfkj/dao/BsGasOilPriceWeekMapperExt.java | 19 + .../dao/BsGasOilPriceWeekSqlProvider.java | 388 +++++ .../com/hfkj/entity/BsGasOilPriceWeek.java | 297 ++++ .../hfkj/entity/BsGasOilPriceWeekExample.java | 1254 +++++++++++++++++ .../gas/BsGasOilPriceOfficialService.java | 3 +- .../service/gas/BsGasOilPriceService.java | 2 +- .../service/gas/BsGasOilPriceWeekService.java | 56 + .../BsGasOilPriceOfficialServiceImpl.java | 38 +- .../gas/impl/BsGasOilPriceServiceImpl.java | 14 +- .../impl/BsGasOilPriceTaskServiceImpl.java | 3 +- .../impl/BsGasOilPriceWeekServiceImpl.java | 135 ++ .../merchant/impl/BsMerchantServiceImpl.java | 4 - .../hfkj/sysenum/gas/GasOilPriceWeekEnum.java | 40 + .../resources/prod2/commonConfig.properties | 15 + 23 files changed, 2718 insertions(+), 40 deletions(-) create mode 100644 bweb/src/main/java/com/bweb/controller/BsGasOilPriceWeekController.java create mode 100644 cweb/src/main/resources/prod2/application.yml create mode 100644 cweb/src/main/resources/prod2/config.properties create mode 100644 cweb/src/main/resources/prod2/logback.xml create mode 100644 schedule/src/main/java/com/hfkj/schedule/GasOilPriceSchedule.java create mode 100644 service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekMapper.java create mode 100644 service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekMapperExt.java create mode 100644 service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekSqlProvider.java create mode 100644 service/src/main/java/com/hfkj/entity/BsGasOilPriceWeek.java create mode 100644 service/src/main/java/com/hfkj/entity/BsGasOilPriceWeekExample.java create mode 100644 service/src/main/java/com/hfkj/service/gas/BsGasOilPriceWeekService.java create mode 100644 service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceWeekServiceImpl.java create mode 100644 service/src/main/java/com/hfkj/sysenum/gas/GasOilPriceWeekEnum.java create mode 100644 service/src/main/resources/prod2/commonConfig.properties diff --git a/bweb/src/main/java/com/bweb/controller/BsGasOilPriceController.java b/bweb/src/main/java/com/bweb/controller/BsGasOilPriceController.java index e25c53d..47b1b17 100644 --- a/bweb/src/main/java/com/bweb/controller/BsGasOilPriceController.java +++ b/bweb/src/main/java/com/bweb/controller/BsGasOilPriceController.java @@ -11,12 +11,16 @@ import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.entity.*; import com.hfkj.model.ResponseData; import com.hfkj.model.SecUserSessionObject; +import com.hfkj.service.gas.BsGasOilPriceOfficialService; import com.hfkj.service.gas.BsGasOilPriceService; +import com.hfkj.service.gas.BsGasOilPriceWeekService; import com.hfkj.service.merchant.BsMerchantService; import com.hfkj.service.CommonService; import com.hfkj.service.gas.BsGasService; +import com.hfkj.sysenum.MerchantSourceTypeEnum; import com.hfkj.sysenum.gas.GasOilPriceStatusEnum; import com.hfkj.sysenum.SecUserObjectTypeEnum; +import com.hfkj.sysenum.gas.GasOilPriceWeekEnum; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -27,6 +31,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.Calendar; import java.util.HashMap; import java.util.Map; @@ -46,6 +52,10 @@ public class BsGasOilPriceController { private CommonService commonService; @Resource private BsGasService gasService; + @Resource + private BsGasOilPriceWeekService gasOilPriceWeekService; + @Resource + private BsGasOilPriceOfficialService gasOilPriceOfficialService; @RequestMapping(value = "/createOil", method = RequestMethod.POST) @ResponseBody @@ -59,9 +69,7 @@ public class BsGasOilPriceController { if (body == null || body.getMerNo() == null - || StringUtils.isBlank(body.getOilNo()) - || body.getPriceOfficial() == null - || body.getGasStationDrop() == null){ + || StringUtils.isBlank(body.getOilNo())){ log.error("BsGasOilPriceController --> createOil() error!", "参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } @@ -72,6 +80,9 @@ public class BsGasOilPriceController { log.error("BsGasOilPriceController --> createOil() error!", "未知的商户"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户"); } + if (!merchant.getSourceType().equals(MerchantSourceTypeEnum.type1.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "第三方油站不能创建油品"); + } // 是否重复添加商户油品 if (gasOilPriceService.getGasOilPrice(merchant.getId(), body.getOilNo()) != null) { log.error("BsGasOilPriceController --> createOil() error!", "重复添加" + body.getOilNo() + "油品"); @@ -89,6 +100,11 @@ public class BsGasOilPriceController { log.error("BsGasOilPriceController --> createOil() error!", "未知的的油品类型"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的的油品类型"); } + // 查询国标价 + BsGasOilPriceOfficial priceOfficial = gasOilPriceOfficialService.getPrice(merchant.getProvinceCode(), merchant.getOilPriceZoneId(), oilNo.getCodeValue()); + if (priceOfficial == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置当前油站所在区域国标价,请联系运营配置!"); + } BsGasOilPrice oilPrice = new BsGasOilPrice(); oilPrice.setMerId(merchant.getId()); @@ -98,13 +114,29 @@ public class BsGasOilPriceController { oilPrice.setOilNo(oilNo.getCodeValue()); oilPrice.setOilNoName(oilNo.getCodeName()); oilPrice.setPreferentialMargin(new BigDecimal("0")); - oilPrice.setGasStationDrop(body.getGasStationDrop()); - oilPrice.setPriceOfficial(body.getPriceOfficial()); + oilPrice.setPriceOfficial(priceOfficial.getPriceOfficial()); + oilPrice.setGasStationDrop(new BigDecimal("0")); oilPrice.setPriceGun(oilPrice.getPriceOfficial().subtract(body.getGasStationDrop())); oilPrice.setPriceVip(oilPrice.getPriceGun()); oilPrice.setStatus(GasOilPriceStatusEnum.status1.getNumber()); gasOilPriceService.editOilPrice(oilPrice); + // 初始化周期价格 + for (GasOilPriceWeekEnum weekEnum : GasOilPriceWeekEnum.values()) { + BsGasOilPriceWeek priceWeek = new BsGasOilPriceWeek(); + priceWeek.setMerId(oilPrice.getMerId()); + priceWeek.setMerNo(oilPrice.getMerNo()); + priceWeek.setWeeks(weekEnum.getNumber()); + priceWeek.setOilType(oilPrice.getOilType()); + priceWeek.setOilTypeName(oilPrice.getOilTypeName()); + priceWeek.setOilNo(oilPrice.getOilNo()); + priceWeek.setOilNoName(oilPrice.getOilNoName()); + priceWeek.setPriceOfficial(oilPrice.getPriceOfficial()); + priceWeek.setPriceGun(oilPrice.getPriceGun()); + priceWeek.setPriceVip(oilPrice.getPriceVip()); + gasOilPriceWeekService.editData(priceWeek); + } + // 删除缓存 gasService.clean(oilPrice.getMerNo()); return ResponseMsgUtil.success("操作成功"); diff --git a/bweb/src/main/java/com/bweb/controller/BsGasOilPriceWeekController.java b/bweb/src/main/java/com/bweb/controller/BsGasOilPriceWeekController.java new file mode 100644 index 0000000..f785a2a --- /dev/null +++ b/bweb/src/main/java/com/bweb/controller/BsGasOilPriceWeekController.java @@ -0,0 +1,79 @@ +package com.bweb.controller; + +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.entity.BsGasOilPriceWeek; +import com.hfkj.model.ResponseData; +import com.hfkj.service.gas.BsGasOilPriceWeekService; +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; + +/** + * @className: BsGasOilPriceWeekController + * @author: HuRui + * @date: 2024/7/29 + **/ +@Controller +@RequestMapping(value = "/gasOilPriceWeek") +@Api(value = "油品价格配置") +public class BsGasOilPriceWeekController { + + private static Logger log = LoggerFactory.getLogger(BsGasOrderController.class); + @Resource + private BsGasOilPriceWeekService gasOilPriceWeekService; + + @RequestMapping(value = "/updatePrice", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "修改价格") + public ResponseData updatePrice(@RequestBody BsGasOilPriceWeek body) { + try { + if (body.getId() == null + || body.getPriceGun() == null + || body.getPriceVip() == null + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 查询价格 + BsGasOilPriceWeek oilPrice = gasOilPriceWeekService.getOilPrice(body.getId()); + if (oilPrice == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的数据"); + } + oilPrice.setPriceGun(body.getPriceGun()); + oilPrice.setPriceVip(body.getPriceVip()); + gasOilPriceWeekService.updatePrice(oilPrice); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getPriceList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询价格列表") + public ResponseData getPriceList(@RequestParam(name = "merNo", required = true) String merNo, + @RequestParam(name = "oilNo", required = true) String oilNo) { + try { + + Map param = new HashMap<>(); + param.put("merNo", merNo); + param.put("oilNo", oilNo); + + return ResponseMsgUtil.success(gasOilPriceWeekService.getOilPriceList(param)); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/cweb/src/main/java/com/cweb/controller/BsGasController.java b/cweb/src/main/java/com/cweb/controller/BsGasController.java index b02d098..b00c0f6 100644 --- a/cweb/src/main/java/com/cweb/controller/BsGasController.java +++ b/cweb/src/main/java/com/cweb/controller/BsGasController.java @@ -17,6 +17,7 @@ import com.hfkj.model.GasListModel; import com.hfkj.model.GasModel; import com.hfkj.model.ResponseData; import com.hfkj.service.agent.BsAgentPriceService; +import com.hfkj.service.gas.BsGasOilPriceWeekService; import com.hfkj.service.gas.BsGasService; import com.hfkj.sysenum.MerchantSourceTypeEnum; import com.hfkj.sysenum.agent.AgentPriceTypeEnum; @@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; +import java.time.LocalDate; @Controller @RequestMapping(value = "/gas") @@ -44,6 +46,24 @@ public class BsGasController { private NewLinkGasService newLinkGasService; @Resource private CqShellPetroleumGasService cqShellPetroleumGasService; + @Resource + private BsGasOilPriceWeekService gasOilPriceWeekService; + @RequestMapping(value="/updatePriceWeek",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "updatePriceWeek") + public ResponseData updatePriceWeek(@RequestParam(name = "week", required = true) Integer week) { + try { + + // 更新价格 + gasOilPriceWeekService.updatePriceWeek(week); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/refresh",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "refresh") diff --git a/cweb/src/main/resources/prod2/application.yml b/cweb/src/main/resources/prod2/application.yml new file mode 100644 index 0000000..e525c3a --- /dev/null +++ b/cweb/src/main/resources/prod2/application.yml @@ -0,0 +1,91 @@ +server: + port: 9901 + servlet: + context-path: /crest + +#配置是否为debug模式,debug模式下,不开启权限校验 +debug: false + +#datasource数据源设置 +spring: + datasource: + url: jdbc:mysql://192.168.0.63:21100/hai_oil?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + username: oil + password: HUfukeji123456!@# + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.jdbc.Driver + filters: stat + maxActive: 10 + initialSize: 5 + maxWait: 60000 + minIdle: 5 + timeBetweenEvictionRunsMillis: 60000 + minEvictableIdleTimeMillis: 300000 + validationQuery: select 'x' + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + poolPreparedStatements: true + maxOpenPreparedStatements: 20 + redis: + database: 2 + host: 127.0.0.1 + port: 36379 + password: HF123456.Redis + timeout: 1000 + jedis: + pool: + max-active: 20 + max-wait: -1 + max-idle: 10 + min-idle: 0 + #配置日期返回至前台为时间戳 + jackson: + serialization: + write-dates-as-timestamps: true + +rocketmq: + name-server: 1.95.43.71:9876 + producer: + access-key: huifukeji + secret-key: HF123456. + #必须指定group + group: default-group + consumer: + access-key: huifukeji + secret-key: HF123456. + +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + local: + default: + type: linkedhashmap + keyConvertor: fastjson + remote: + default: + type: redis + host: 127.0.0.1 + port: 36379 + password: HF123456.Redis + database: 2 + keyConvertor: fastjson + broadcastChannel: projectA + valueEncoder: java + valueDecoder: java + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + +mybatis: + mapperLocations: + - classpath*:sqlmap*/*.xml + type-aliases-package: + org.springboot.sample.entity + +pagehelper: + helperDialect: mysql + reasonable: true + supportMethodsArguments: true + params: count=countSql diff --git a/cweb/src/main/resources/prod2/config.properties b/cweb/src/main/resources/prod2/config.properties new file mode 100644 index 0000000..9ee346e --- /dev/null +++ b/cweb/src/main/resources/prod2/config.properties @@ -0,0 +1 @@ +fileUrl=/home/project/oil/filesystem diff --git a/cweb/src/main/resources/prod2/logback.xml b/cweb/src/main/resources/prod2/logback.xml new file mode 100644 index 0000000..e509de0 --- /dev/null +++ b/cweb/src/main/resources/prod2/logback.xml @@ -0,0 +1,72 @@ + + + + + %d %p (%file:%line\)- %m%n + UTF-8 + + + + log/base.log + + log/base.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/dao.log + + log/dao.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/error.log + + log/error.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + + + + + + + + + diff --git a/schedule/src/main/java/com/hfkj/schedule/GasOilPriceSchedule.java b/schedule/src/main/java/com/hfkj/schedule/GasOilPriceSchedule.java new file mode 100644 index 0000000..003536c --- /dev/null +++ b/schedule/src/main/java/com/hfkj/schedule/GasOilPriceSchedule.java @@ -0,0 +1,34 @@ +package com.hfkj.schedule; + +import com.hfkj.channel.gas.newlink.NewLinkGasService; +import com.hfkj.channel.gas.shell.CqShellPetroleumGasService; +import com.hfkj.service.gas.BsGasOilPriceWeekService; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.time.LocalDate; + +/** + * 油价任务 + * @className: GasSchedule + * @author: HuRui + * @date: 2024/7/30 + **/ +@Component +public class GasOilPriceSchedule { + + @Resource + private BsGasOilPriceWeekService gasOilPriceWeekService; + + @Scheduled(cron = "3 0 0 * * ?") // 每日凌晨00:00:03 执行一次 + public void newLinkGasSchedule() { + try { + // 更新价格 + gasOilPriceWeekService.updatePriceWeek(LocalDate.now().getDayOfWeek().getValue()); + + } catch (Exception e) { + System.out.println("更新价格失败!!!"); + } + } +} diff --git a/service/src/main/java/com/hfkj/dao/BsGasOilPriceMapperExt.java b/service/src/main/java/com/hfkj/dao/BsGasOilPriceMapperExt.java index 498574d..4dbaaa1 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasOilPriceMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsGasOilPriceMapperExt.java @@ -14,12 +14,15 @@ import java.util.Map; * mapper扩展类 */ public interface BsGasOilPriceMapperExt { - @Select({" select b.* from bs_merchant a, bs_gas_oil_price b " + + @Select({" "}) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), @@ -33,6 +36,7 @@ public interface BsGasOilPriceMapperExt { @Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL), @Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL), @Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL), + @Result(column="price_cost", property="priceCost", jdbcType=JdbcType.DECIMAL), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @@ -40,6 +44,6 @@ public interface BsGasOilPriceMapperExt { @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) }) - List selectPriceListByRegionAndOilNo(@Param("regionId") Long regionId, @Param("oilNo") String oilNo); + List selectPriceListByRegionAndOilNo(@Param("regionId") Long regionId, @Param("oilPriceZoneId") Integer oilPriceZoneId, @Param("oilNo") String oilNo); } diff --git a/service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekMapper.java b/service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekMapper.java new file mode 100644 index 0000000..9e0c254 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekMapper.java @@ -0,0 +1,141 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsGasOilPriceWeek; +import com.hfkj.entity.BsGasOilPriceWeekExample; +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 BsGasOilPriceWeekMapper extends BsGasOilPriceWeekMapperExt { + @SelectProvider(type=BsGasOilPriceWeekSqlProvider.class, method="countByExample") + long countByExample(BsGasOilPriceWeekExample example); + + @DeleteProvider(type=BsGasOilPriceWeekSqlProvider.class, method="deleteByExample") + int deleteByExample(BsGasOilPriceWeekExample example); + + @Delete({ + "delete from bs_gas_oil_price_week", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + + @Insert({ + "insert into bs_gas_oil_price_week (mer_id, mer_no, ", + "weeks, oil_type, ", + "oil_type_name, oil_no, ", + "oil_no_name, price_official, ", + "price_gun, price_vip, ", + "create_time, update_time, ", + "ext_1, ext_2, ext_3)", + "values (#{merId,jdbcType=BIGINT}, #{merNo,jdbcType=VARCHAR}, ", + "#{weeks,jdbcType=INTEGER}, #{oilType,jdbcType=INTEGER}, ", + "#{oilTypeName,jdbcType=VARCHAR}, #{oilNo,jdbcType=VARCHAR}, ", + "#{oilNoName,jdbcType=VARCHAR}, #{priceOfficial,jdbcType=DECIMAL}, ", + "#{priceGun,jdbcType=DECIMAL}, #{priceVip,jdbcType=DECIMAL}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(BsGasOilPriceWeek record); + + @InsertProvider(type=BsGasOilPriceWeekSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(BsGasOilPriceWeek record); + + @SelectProvider(type=BsGasOilPriceWeekSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), + @Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), + @Result(column="weeks", property="weeks", jdbcType=JdbcType.INTEGER), + @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.VARCHAR), + @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), + @Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL), + @Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL), + @Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + }) + List selectByExample(BsGasOilPriceWeekExample example); + + @Select({ + "select", + "id, mer_id, mer_no, weeks, oil_type, oil_type_name, oil_no, oil_no_name, price_official, ", + "price_gun, price_vip, create_time, update_time, ext_1, ext_2, ext_3", + "from bs_gas_oil_price_week", + "where id = #{id,jdbcType=BIGINT}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), + @Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), + @Result(column="weeks", property="weeks", jdbcType=JdbcType.INTEGER), + @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.VARCHAR), + @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), + @Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL), + @Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL), + @Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + }) + BsGasOilPriceWeek selectByPrimaryKey(Long id); + + @UpdateProvider(type=BsGasOilPriceWeekSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") BsGasOilPriceWeek record, @Param("example") BsGasOilPriceWeekExample example); + + @UpdateProvider(type=BsGasOilPriceWeekSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") BsGasOilPriceWeek record, @Param("example") BsGasOilPriceWeekExample example); + + @UpdateProvider(type=BsGasOilPriceWeekSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(BsGasOilPriceWeek record); + + @Update({ + "update bs_gas_oil_price_week", + "set mer_id = #{merId,jdbcType=BIGINT},", + "mer_no = #{merNo,jdbcType=VARCHAR},", + "weeks = #{weeks,jdbcType=INTEGER},", + "oil_type = #{oilType,jdbcType=INTEGER},", + "oil_type_name = #{oilTypeName,jdbcType=VARCHAR},", + "oil_no = #{oilNo,jdbcType=VARCHAR},", + "oil_no_name = #{oilNoName,jdbcType=VARCHAR},", + "price_official = #{priceOfficial,jdbcType=DECIMAL},", + "price_gun = #{priceGun,jdbcType=DECIMAL},", + "price_vip = #{priceVip,jdbcType=DECIMAL},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "update_time = #{updateTime,jdbcType=TIMESTAMP},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKey(BsGasOilPriceWeek record); +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekMapperExt.java b/service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekMapperExt.java new file mode 100644 index 0000000..bcd8054 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekMapperExt.java @@ -0,0 +1,19 @@ +package com.hfkj.dao; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; + +/** + * mapper扩展类 + */ +public interface BsGasOilPriceWeekMapperExt { + + /** + * 更新价格 + * @param week 周期 + */ + @Update(" update (select weeks,mer_id,oil_no,price_official,price_gun,price_vip from bs_gas_oil_price_week where weeks = #{week}) a " + + " LEFT JOIN bs_gas_oil_price b on b.mer_id = a.mer_id and b.oil_no = a.oil_no " + + " set b.price_gun = a.price_gun, b.price_vip = a.price_vip, b.gas_station_drop = (a.price_official - a.price_gun)") + void updatePrice(@Param("week") Integer week); +} diff --git a/service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekSqlProvider.java new file mode 100644 index 0000000..18f58c0 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsGasOilPriceWeekSqlProvider.java @@ -0,0 +1,388 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsGasOilPriceWeek; +import com.hfkj.entity.BsGasOilPriceWeekExample.Criteria; +import com.hfkj.entity.BsGasOilPriceWeekExample.Criterion; +import com.hfkj.entity.BsGasOilPriceWeekExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class BsGasOilPriceWeekSqlProvider { + + public String countByExample(BsGasOilPriceWeekExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("bs_gas_oil_price_week"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(BsGasOilPriceWeekExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("bs_gas_oil_price_week"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(BsGasOilPriceWeek record) { + SQL sql = new SQL(); + sql.INSERT_INTO("bs_gas_oil_price_week"); + + if (record.getMerId() != null) { + sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}"); + } + + if (record.getMerNo() != null) { + sql.VALUES("mer_no", "#{merNo,jdbcType=VARCHAR}"); + } + + if (record.getWeeks() != null) { + sql.VALUES("weeks", "#{weeks,jdbcType=INTEGER}"); + } + + 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=VARCHAR}"); + } + + if (record.getOilNoName() != null) { + sql.VALUES("oil_no_name", "#{oilNoName,jdbcType=VARCHAR}"); + } + + if (record.getPriceOfficial() != null) { + sql.VALUES("price_official", "#{priceOfficial,jdbcType=DECIMAL}"); + } + + if (record.getPriceGun() != null) { + sql.VALUES("price_gun", "#{priceGun,jdbcType=DECIMAL}"); + } + + if (record.getPriceVip() != null) { + sql.VALUES("price_vip", "#{priceVip,jdbcType=DECIMAL}"); + } + + if (record.getCreateTime() != null) { + sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getUpdateTime() != null) { + sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); + } + + return sql.toString(); + } + + public String selectByExample(BsGasOilPriceWeekExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("mer_id"); + sql.SELECT("mer_no"); + sql.SELECT("weeks"); + sql.SELECT("oil_type"); + sql.SELECT("oil_type_name"); + sql.SELECT("oil_no"); + sql.SELECT("oil_no_name"); + sql.SELECT("price_official"); + sql.SELECT("price_gun"); + sql.SELECT("price_vip"); + sql.SELECT("create_time"); + sql.SELECT("update_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.FROM("bs_gas_oil_price_week"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + BsGasOilPriceWeek record = (BsGasOilPriceWeek) parameter.get("record"); + BsGasOilPriceWeekExample example = (BsGasOilPriceWeekExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("bs_gas_oil_price_week"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + } + + if (record.getMerId() != null) { + sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); + } + + if (record.getMerNo() != null) { + sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}"); + } + + if (record.getWeeks() != null) { + sql.SET("weeks = #{record.weeks,jdbcType=INTEGER}"); + } + + 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=VARCHAR}"); + } + + if (record.getOilNoName() != null) { + sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}"); + } + + if (record.getPriceOfficial() != null) { + sql.SET("price_official = #{record.priceOfficial,jdbcType=DECIMAL}"); + } + + if (record.getPriceGun() != null) { + sql.SET("price_gun = #{record.priceGun,jdbcType=DECIMAL}"); + } + + if (record.getPriceVip() != null) { + sql.SET("price_vip = #{record.priceVip,jdbcType=DECIMAL}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getUpdateTime() != null) { + sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExample(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_gas_oil_price_week"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); + sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}"); + sql.SET("weeks = #{record.weeks,jdbcType=INTEGER}"); + sql.SET("oil_type = #{record.oilType,jdbcType=INTEGER}"); + sql.SET("oil_type_name = #{record.oilTypeName,jdbcType=VARCHAR}"); + sql.SET("oil_no = #{record.oilNo,jdbcType=VARCHAR}"); + sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}"); + sql.SET("price_official = #{record.priceOfficial,jdbcType=DECIMAL}"); + sql.SET("price_gun = #{record.priceGun,jdbcType=DECIMAL}"); + sql.SET("price_vip = #{record.priceVip,jdbcType=DECIMAL}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + + BsGasOilPriceWeekExample example = (BsGasOilPriceWeekExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(BsGasOilPriceWeek record) { + SQL sql = new SQL(); + sql.UPDATE("bs_gas_oil_price_week"); + + if (record.getMerId() != null) { + sql.SET("mer_id = #{merId,jdbcType=BIGINT}"); + } + + if (record.getMerNo() != null) { + sql.SET("mer_no = #{merNo,jdbcType=VARCHAR}"); + } + + if (record.getWeeks() != null) { + sql.SET("weeks = #{weeks,jdbcType=INTEGER}"); + } + + 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=VARCHAR}"); + } + + if (record.getOilNoName() != null) { + sql.SET("oil_no_name = #{oilNoName,jdbcType=VARCHAR}"); + } + + if (record.getPriceOfficial() != null) { + sql.SET("price_official = #{priceOfficial,jdbcType=DECIMAL}"); + } + + if (record.getPriceGun() != null) { + sql.SET("price_gun = #{priceGun,jdbcType=DECIMAL}"); + } + + if (record.getPriceVip() != null) { + sql.SET("price_vip = #{priceVip,jdbcType=DECIMAL}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getUpdateTime() != null) { + sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); + } + + sql.WHERE("id = #{id,jdbcType=BIGINT}"); + + return sql.toString(); + } + + protected void applyWhere(SQL sql, BsGasOilPriceWeekExample 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 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 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()); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsGasOilPriceWeek.java b/service/src/main/java/com/hfkj/entity/BsGasOilPriceWeek.java new file mode 100644 index 0000000..17d8b51 --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsGasOilPriceWeek.java @@ -0,0 +1,297 @@ +package com.hfkj.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * bs_gas_oil_price_week + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class BsGasOilPriceWeek implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 商户id + */ + private Long merId; + + /** + * 商户编号 + */ + private String merNo; + + /** + * 星期周期 1:星期一 2:星期二 3:星期三 4:星期四 5:星期五 6:星期六 7:星期天 + */ + private Integer weeks; + + /** + * 油品类型 1:汽油:2:柴油;3:天然气 + */ + private Integer oilType; + + /** + * 燃油类型名 1:汽油:2:柴油;3:天然气 + */ + private String oilTypeName; + + /** + * 油号 + */ + private String oilNo; + + /** + * 油品名称 + */ + private String oilNoName; + + /** + * 官方指导价 + */ + private BigDecimal priceOfficial; + + /** + * 枪价 + */ + private BigDecimal priceGun; + + /** + * 优惠价 + */ + private BigDecimal priceVip; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改时间 + */ + private Date updateTime; + + private String ext1; + + private String ext2; + + private String ext3; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getMerId() { + return merId; + } + + public void setMerId(Long merId) { + this.merId = merId; + } + + public String getMerNo() { + return merNo; + } + + public void setMerNo(String merNo) { + this.merNo = merNo; + } + + public Integer getWeeks() { + return weeks; + } + + public void setWeeks(Integer weeks) { + this.weeks = weeks; + } + + 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 String getOilNo() { + return oilNo; + } + + public void setOilNo(String oilNo) { + this.oilNo = oilNo; + } + + public String getOilNoName() { + return oilNoName; + } + + public void setOilNoName(String oilNoName) { + this.oilNoName = oilNoName; + } + + public BigDecimal getPriceOfficial() { + return priceOfficial; + } + + public void setPriceOfficial(BigDecimal priceOfficial) { + this.priceOfficial = priceOfficial; + } + + public BigDecimal getPriceGun() { + return priceGun; + } + + public void setPriceGun(BigDecimal priceGun) { + this.priceGun = priceGun; + } + + public BigDecimal getPriceVip() { + return priceVip; + } + + public void setPriceVip(BigDecimal priceVip) { + this.priceVip = priceVip; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getExt1() { + return ext1; + } + + public void setExt1(String ext1) { + this.ext1 = ext1; + } + + public String getExt2() { + return ext2; + } + + public void setExt2(String ext2) { + this.ext2 = ext2; + } + + public String getExt3() { + return ext3; + } + + public void setExt3(String ext3) { + this.ext3 = ext3; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + BsGasOilPriceWeek other = (BsGasOilPriceWeek) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId())) + && (this.getMerNo() == null ? other.getMerNo() == null : this.getMerNo().equals(other.getMerNo())) + && (this.getWeeks() == null ? other.getWeeks() == null : this.getWeeks().equals(other.getWeeks())) + && (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.getPriceOfficial() == null ? other.getPriceOfficial() == null : this.getPriceOfficial().equals(other.getPriceOfficial())) + && (this.getPriceGun() == null ? other.getPriceGun() == null : this.getPriceGun().equals(other.getPriceGun())) + && (this.getPriceVip() == null ? other.getPriceVip() == null : this.getPriceVip().equals(other.getPriceVip())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) + && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) + && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) + && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getMerId() == null) ? 0 : getMerId().hashCode()); + result = prime * result + ((getMerNo() == null) ? 0 : getMerNo().hashCode()); + result = prime * result + ((getWeeks() == null) ? 0 : getWeeks().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 + ((getPriceOfficial() == null) ? 0 : getPriceOfficial().hashCode()); + result = prime * result + ((getPriceGun() == null) ? 0 : getPriceGun().hashCode()); + result = prime * result + ((getPriceVip() == null) ? 0 : getPriceVip().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); + result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); + result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", merId=").append(merId); + sb.append(", merNo=").append(merNo); + sb.append(", weeks=").append(weeks); + sb.append(", oilType=").append(oilType); + sb.append(", oilTypeName=").append(oilTypeName); + sb.append(", oilNo=").append(oilNo); + sb.append(", oilNoName=").append(oilNoName); + sb.append(", priceOfficial=").append(priceOfficial); + sb.append(", priceGun=").append(priceGun); + sb.append(", priceVip=").append(priceVip); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", ext1=").append(ext1); + sb.append(", ext2=").append(ext2); + sb.append(", ext3=").append(ext3); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsGasOilPriceWeekExample.java b/service/src/main/java/com/hfkj/entity/BsGasOilPriceWeekExample.java new file mode 100644 index 0000000..1d55daf --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsGasOilPriceWeekExample.java @@ -0,0 +1,1254 @@ +package com.hfkj.entity; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsGasOilPriceWeekExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsGasOilPriceWeekExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andMerIdIsNull() { + addCriterion("mer_id is null"); + return (Criteria) this; + } + + public Criteria andMerIdIsNotNull() { + addCriterion("mer_id is not null"); + return (Criteria) this; + } + + public Criteria andMerIdEqualTo(Long value) { + addCriterion("mer_id =", value, "merId"); + return (Criteria) this; + } + + public Criteria andMerIdNotEqualTo(Long value) { + addCriterion("mer_id <>", value, "merId"); + return (Criteria) this; + } + + public Criteria andMerIdGreaterThan(Long value) { + addCriterion("mer_id >", value, "merId"); + return (Criteria) this; + } + + public Criteria andMerIdGreaterThanOrEqualTo(Long value) { + addCriterion("mer_id >=", value, "merId"); + return (Criteria) this; + } + + public Criteria andMerIdLessThan(Long value) { + addCriterion("mer_id <", value, "merId"); + return (Criteria) this; + } + + public Criteria andMerIdLessThanOrEqualTo(Long value) { + addCriterion("mer_id <=", value, "merId"); + return (Criteria) this; + } + + public Criteria andMerIdIn(List values) { + addCriterion("mer_id in", values, "merId"); + return (Criteria) this; + } + + public Criteria andMerIdNotIn(List values) { + addCriterion("mer_id not in", values, "merId"); + return (Criteria) this; + } + + public Criteria andMerIdBetween(Long value1, Long value2) { + addCriterion("mer_id between", value1, value2, "merId"); + return (Criteria) this; + } + + public Criteria andMerIdNotBetween(Long value1, Long value2) { + addCriterion("mer_id not between", value1, value2, "merId"); + return (Criteria) this; + } + + public Criteria andMerNoIsNull() { + addCriterion("mer_no is null"); + return (Criteria) this; + } + + public Criteria andMerNoIsNotNull() { + addCriterion("mer_no is not null"); + return (Criteria) this; + } + + public Criteria andMerNoEqualTo(String value) { + addCriterion("mer_no =", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotEqualTo(String value) { + addCriterion("mer_no <>", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoGreaterThan(String value) { + addCriterion("mer_no >", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoGreaterThanOrEqualTo(String value) { + addCriterion("mer_no >=", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoLessThan(String value) { + addCriterion("mer_no <", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoLessThanOrEqualTo(String value) { + addCriterion("mer_no <=", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoLike(String value) { + addCriterion("mer_no like", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotLike(String value) { + addCriterion("mer_no not like", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoIn(List values) { + addCriterion("mer_no in", values, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotIn(List values) { + addCriterion("mer_no not in", values, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoBetween(String value1, String value2) { + addCriterion("mer_no between", value1, value2, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotBetween(String value1, String value2) { + addCriterion("mer_no not between", value1, value2, "merNo"); + return (Criteria) this; + } + + public Criteria andWeeksIsNull() { + addCriterion("weeks is null"); + return (Criteria) this; + } + + public Criteria andWeeksIsNotNull() { + addCriterion("weeks is not null"); + return (Criteria) this; + } + + public Criteria andWeeksEqualTo(Integer value) { + addCriterion("weeks =", value, "weeks"); + return (Criteria) this; + } + + public Criteria andWeeksNotEqualTo(Integer value) { + addCriterion("weeks <>", value, "weeks"); + return (Criteria) this; + } + + public Criteria andWeeksGreaterThan(Integer value) { + addCriterion("weeks >", value, "weeks"); + return (Criteria) this; + } + + public Criteria andWeeksGreaterThanOrEqualTo(Integer value) { + addCriterion("weeks >=", value, "weeks"); + return (Criteria) this; + } + + public Criteria andWeeksLessThan(Integer value) { + addCriterion("weeks <", value, "weeks"); + return (Criteria) this; + } + + public Criteria andWeeksLessThanOrEqualTo(Integer value) { + addCriterion("weeks <=", value, "weeks"); + return (Criteria) this; + } + + public Criteria andWeeksIn(List values) { + addCriterion("weeks in", values, "weeks"); + return (Criteria) this; + } + + public Criteria andWeeksNotIn(List values) { + addCriterion("weeks not in", values, "weeks"); + return (Criteria) this; + } + + public Criteria andWeeksBetween(Integer value1, Integer value2) { + addCriterion("weeks between", value1, value2, "weeks"); + return (Criteria) this; + } + + public Criteria andWeeksNotBetween(Integer value1, Integer value2) { + addCriterion("weeks not between", value1, value2, "weeks"); + return (Criteria) this; + } + + public Criteria andOilTypeIsNull() { + addCriterion("oil_type is null"); + return (Criteria) this; + } + + public Criteria andOilTypeIsNotNull() { + addCriterion("oil_type is not null"); + return (Criteria) this; + } + + public Criteria andOilTypeEqualTo(Integer value) { + addCriterion("oil_type =", value, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeNotEqualTo(Integer value) { + addCriterion("oil_type <>", value, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeGreaterThan(Integer value) { + addCriterion("oil_type >", value, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("oil_type >=", value, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeLessThan(Integer value) { + addCriterion("oil_type <", value, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeLessThanOrEqualTo(Integer value) { + addCriterion("oil_type <=", value, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeIn(List values) { + addCriterion("oil_type in", values, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeNotIn(List values) { + addCriterion("oil_type not in", values, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeBetween(Integer value1, Integer value2) { + addCriterion("oil_type between", value1, value2, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeNotBetween(Integer value1, Integer value2) { + addCriterion("oil_type not between", value1, value2, "oilType"); + return (Criteria) this; + } + + public Criteria andOilTypeNameIsNull() { + addCriterion("oil_type_name is null"); + return (Criteria) this; + } + + public Criteria andOilTypeNameIsNotNull() { + addCriterion("oil_type_name is not null"); + return (Criteria) this; + } + + public Criteria andOilTypeNameEqualTo(String value) { + addCriterion("oil_type_name =", value, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameNotEqualTo(String value) { + addCriterion("oil_type_name <>", value, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameGreaterThan(String value) { + addCriterion("oil_type_name >", value, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameGreaterThanOrEqualTo(String value) { + addCriterion("oil_type_name >=", value, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameLessThan(String value) { + addCriterion("oil_type_name <", value, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameLessThanOrEqualTo(String value) { + addCriterion("oil_type_name <=", value, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameLike(String value) { + addCriterion("oil_type_name like", value, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameNotLike(String value) { + addCriterion("oil_type_name not like", value, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameIn(List values) { + addCriterion("oil_type_name in", values, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameNotIn(List values) { + addCriterion("oil_type_name not in", values, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameBetween(String value1, String value2) { + addCriterion("oil_type_name between", value1, value2, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilTypeNameNotBetween(String value1, String value2) { + addCriterion("oil_type_name not between", value1, value2, "oilTypeName"); + return (Criteria) this; + } + + public Criteria andOilNoIsNull() { + addCriterion("oil_no is null"); + return (Criteria) this; + } + + public Criteria andOilNoIsNotNull() { + addCriterion("oil_no is not null"); + return (Criteria) this; + } + + public Criteria andOilNoEqualTo(String value) { + addCriterion("oil_no =", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoNotEqualTo(String value) { + addCriterion("oil_no <>", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoGreaterThan(String value) { + addCriterion("oil_no >", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoGreaterThanOrEqualTo(String value) { + addCriterion("oil_no >=", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoLessThan(String value) { + addCriterion("oil_no <", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoLessThanOrEqualTo(String value) { + addCriterion("oil_no <=", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoLike(String value) { + addCriterion("oil_no like", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoNotLike(String value) { + addCriterion("oil_no not like", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoIn(List values) { + addCriterion("oil_no in", values, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoNotIn(List values) { + addCriterion("oil_no not in", values, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoBetween(String value1, String value2) { + addCriterion("oil_no between", value1, value2, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoNotBetween(String value1, String value2) { + addCriterion("oil_no not between", value1, value2, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoNameIsNull() { + addCriterion("oil_no_name is null"); + return (Criteria) this; + } + + public Criteria andOilNoNameIsNotNull() { + addCriterion("oil_no_name is not null"); + return (Criteria) this; + } + + public Criteria andOilNoNameEqualTo(String value) { + addCriterion("oil_no_name =", value, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameNotEqualTo(String value) { + addCriterion("oil_no_name <>", value, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameGreaterThan(String value) { + addCriterion("oil_no_name >", value, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameGreaterThanOrEqualTo(String value) { + addCriterion("oil_no_name >=", value, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameLessThan(String value) { + addCriterion("oil_no_name <", value, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameLessThanOrEqualTo(String value) { + addCriterion("oil_no_name <=", value, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameLike(String value) { + addCriterion("oil_no_name like", value, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameNotLike(String value) { + addCriterion("oil_no_name not like", value, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameIn(List values) { + addCriterion("oil_no_name in", values, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameNotIn(List values) { + addCriterion("oil_no_name not in", values, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameBetween(String value1, String value2) { + addCriterion("oil_no_name between", value1, value2, "oilNoName"); + return (Criteria) this; + } + + public Criteria andOilNoNameNotBetween(String value1, String value2) { + addCriterion("oil_no_name not between", value1, value2, "oilNoName"); + return (Criteria) this; + } + + public Criteria andPriceOfficialIsNull() { + addCriterion("price_official is null"); + return (Criteria) this; + } + + public Criteria andPriceOfficialIsNotNull() { + addCriterion("price_official is not null"); + return (Criteria) this; + } + + public Criteria andPriceOfficialEqualTo(BigDecimal value) { + addCriterion("price_official =", value, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceOfficialNotEqualTo(BigDecimal value) { + addCriterion("price_official <>", value, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceOfficialGreaterThan(BigDecimal value) { + addCriterion("price_official >", value, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceOfficialGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("price_official >=", value, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceOfficialLessThan(BigDecimal value) { + addCriterion("price_official <", value, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceOfficialLessThanOrEqualTo(BigDecimal value) { + addCriterion("price_official <=", value, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceOfficialIn(List values) { + addCriterion("price_official in", values, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceOfficialNotIn(List values) { + addCriterion("price_official not in", values, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceOfficialBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("price_official between", value1, value2, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceOfficialNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("price_official not between", value1, value2, "priceOfficial"); + return (Criteria) this; + } + + public Criteria andPriceGunIsNull() { + addCriterion("price_gun is null"); + return (Criteria) this; + } + + public Criteria andPriceGunIsNotNull() { + addCriterion("price_gun is not null"); + return (Criteria) this; + } + + public Criteria andPriceGunEqualTo(BigDecimal value) { + addCriterion("price_gun =", value, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceGunNotEqualTo(BigDecimal value) { + addCriterion("price_gun <>", value, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceGunGreaterThan(BigDecimal value) { + addCriterion("price_gun >", value, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceGunGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("price_gun >=", value, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceGunLessThan(BigDecimal value) { + addCriterion("price_gun <", value, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceGunLessThanOrEqualTo(BigDecimal value) { + addCriterion("price_gun <=", value, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceGunIn(List values) { + addCriterion("price_gun in", values, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceGunNotIn(List values) { + addCriterion("price_gun not in", values, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceGunBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("price_gun between", value1, value2, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceGunNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("price_gun not between", value1, value2, "priceGun"); + return (Criteria) this; + } + + public Criteria andPriceVipIsNull() { + addCriterion("price_vip is null"); + return (Criteria) this; + } + + public Criteria andPriceVipIsNotNull() { + addCriterion("price_vip is not null"); + return (Criteria) this; + } + + public Criteria andPriceVipEqualTo(BigDecimal value) { + addCriterion("price_vip =", value, "priceVip"); + return (Criteria) this; + } + + public Criteria andPriceVipNotEqualTo(BigDecimal value) { + addCriterion("price_vip <>", value, "priceVip"); + return (Criteria) this; + } + + public Criteria andPriceVipGreaterThan(BigDecimal value) { + addCriterion("price_vip >", value, "priceVip"); + return (Criteria) this; + } + + public Criteria andPriceVipGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("price_vip >=", value, "priceVip"); + return (Criteria) this; + } + + public Criteria andPriceVipLessThan(BigDecimal value) { + addCriterion("price_vip <", value, "priceVip"); + return (Criteria) this; + } + + public Criteria andPriceVipLessThanOrEqualTo(BigDecimal value) { + addCriterion("price_vip <=", value, "priceVip"); + return (Criteria) this; + } + + public Criteria andPriceVipIn(List values) { + addCriterion("price_vip in", values, "priceVip"); + return (Criteria) this; + } + + public Criteria andPriceVipNotIn(List values) { + addCriterion("price_vip not in", values, "priceVip"); + return (Criteria) this; + } + + public Criteria andPriceVipBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("price_vip between", value1, value2, "priceVip"); + return (Criteria) this; + } + + public Criteria andPriceVipNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("price_vip not between", value1, value2, "priceVip"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andExt1IsNull() { + addCriterion("ext_1 is null"); + return (Criteria) this; + } + + public Criteria andExt1IsNotNull() { + addCriterion("ext_1 is not null"); + return (Criteria) this; + } + + public Criteria andExt1EqualTo(String value) { + addCriterion("ext_1 =", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotEqualTo(String value) { + addCriterion("ext_1 <>", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThan(String value) { + addCriterion("ext_1 >", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThanOrEqualTo(String value) { + addCriterion("ext_1 >=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThan(String value) { + addCriterion("ext_1 <", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThanOrEqualTo(String value) { + addCriterion("ext_1 <=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Like(String value) { + addCriterion("ext_1 like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotLike(String value) { + addCriterion("ext_1 not like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1In(List values) { + addCriterion("ext_1 in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotIn(List values) { + addCriterion("ext_1 not in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Between(String value1, String value2) { + addCriterion("ext_1 between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotBetween(String value1, String value2) { + addCriterion("ext_1 not between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt2IsNull() { + addCriterion("ext_2 is null"); + return (Criteria) this; + } + + public Criteria andExt2IsNotNull() { + addCriterion("ext_2 is not null"); + return (Criteria) this; + } + + public Criteria andExt2EqualTo(String value) { + addCriterion("ext_2 =", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotEqualTo(String value) { + addCriterion("ext_2 <>", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThan(String value) { + addCriterion("ext_2 >", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThanOrEqualTo(String value) { + addCriterion("ext_2 >=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThan(String value) { + addCriterion("ext_2 <", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThanOrEqualTo(String value) { + addCriterion("ext_2 <=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Like(String value) { + addCriterion("ext_2 like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotLike(String value) { + addCriterion("ext_2 not like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2In(List values) { + addCriterion("ext_2 in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotIn(List values) { + addCriterion("ext_2 not in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Between(String value1, String value2) { + addCriterion("ext_2 between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotBetween(String value1, String value2) { + addCriterion("ext_2 not between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt3IsNull() { + addCriterion("ext_3 is null"); + return (Criteria) this; + } + + public Criteria andExt3IsNotNull() { + addCriterion("ext_3 is not null"); + return (Criteria) this; + } + + public Criteria andExt3EqualTo(String value) { + addCriterion("ext_3 =", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotEqualTo(String value) { + addCriterion("ext_3 <>", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThan(String value) { + addCriterion("ext_3 >", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThanOrEqualTo(String value) { + addCriterion("ext_3 >=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThan(String value) { + addCriterion("ext_3 <", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThanOrEqualTo(String value) { + addCriterion("ext_3 <=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Like(String value) { + addCriterion("ext_3 like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotLike(String value) { + addCriterion("ext_3 not like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3In(List values) { + addCriterion("ext_3 in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotIn(List values) { + addCriterion("ext_3 not in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Between(String value1, String value2) { + addCriterion("ext_3 between", value1, value2, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotBetween(String value1, String value2) { + addCriterion("ext_3 not between", value1, value2, "ext3"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceOfficialService.java b/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceOfficialService.java index ec4d54d..38b317e 100644 --- a/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceOfficialService.java +++ b/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceOfficialService.java @@ -44,5 +44,6 @@ public interface BsGasOilPriceOfficialService { * @param regionId 区域 * @param oilNo 油品 */ - void refreshGasPriceOfficial(Long regionId, String oilNo); + void refreshGasPriceOfficial(Long regionId, Integer oilPriceZoneId, String oilNo); + } diff --git a/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceService.java b/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceService.java index c5241df..1ea9ba2 100644 --- a/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceService.java +++ b/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceService.java @@ -73,5 +73,5 @@ public interface BsGasOilPriceService { * @param oilNo * @return */ - List getPriceListByRegionAndOilNo(Long regionId, String oilNo); + List getPriceListByRegionAndOilNo(Long regionId,Integer oilPriceZoneId , String oilNo); } diff --git a/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceWeekService.java b/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceWeekService.java new file mode 100644 index 0000000..a8096fa --- /dev/null +++ b/service/src/main/java/com/hfkj/service/gas/BsGasOilPriceWeekService.java @@ -0,0 +1,56 @@ +package com.hfkj.service.gas; + +import com.hfkj.entity.BsGasOilPriceWeek; +import com.hfkj.sysenum.gas.GasOilNoEnum; + +import java.util.List; +import java.util.Map; + +/** + * @className: BsGasOilPriceWeekService + * @author: HuRui + * @date: 2024/7/29 + **/ +public interface BsGasOilPriceWeekService { + + /** + * 编辑数据 + * @param data + */ + void editData(BsGasOilPriceWeek data); + + /** + * 修改价格 + * @param priceWeek + */ + void updatePrice(BsGasOilPriceWeek priceWeek); + + /** + * 修改价格 + * @param week 周期 + */ + void updatePriceWeek(Integer week); + + /** + * 查询价格 + * @param merNo + * @param oilNo + * @return + */ + BsGasOilPriceWeek getOilPrice(String merNo, GasOilNoEnum oilNo); + + /** + * 查询价格 + * @param priceWeekId + * @return + */ + BsGasOilPriceWeek getOilPrice(Long priceWeekId); + + /** + * 查询油价列表 + * @param param + * @return + */ + List getOilPriceList(Map param); + +} diff --git a/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceOfficialServiceImpl.java b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceOfficialServiceImpl.java index 5b587e9..cace604 100644 --- a/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceOfficialServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceOfficialServiceImpl.java @@ -8,6 +8,8 @@ import com.hfkj.entity.*; import com.hfkj.service.gas.BsGasOilPriceOfficialService; import com.hfkj.service.gas.BsGasOilPriceService; import com.hfkj.service.CommonService; +import com.hfkj.service.gas.BsGasOilPriceWeekService; +import com.hfkj.sysenum.gas.GasOilNoEnum; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -23,10 +25,10 @@ public class BsGasOilPriceOfficialServiceImpl implements BsGasOilPriceOfficialSe @Resource private BsGasOilPriceOfficialMapper gasOilPriceOfficialMapper; - @Resource private BsGasOilPriceService highGasOilPriceService; - + @Resource + private BsGasOilPriceWeekService gasOilPriceWeekService; @Resource private CommonService commonService; @@ -89,6 +91,10 @@ public class BsGasOilPriceOfficialServiceImpl implements BsGasOilPriceOfficialSe criteria.andRegionIdEqualTo(MapUtils.getLong(param, "regionId")); } + if (MapUtils.getLong(param, "oilPriceZoneId") != null) { + criteria.andOilPriceZoneIdEqualTo(MapUtils.getInteger(param, "oilPriceZoneId")); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "oilNo"))) { criteria.andOilNoEqualTo(MapUtils.getString(param, "oilNo")); } @@ -142,22 +148,28 @@ public class BsGasOilPriceOfficialServiceImpl implements BsGasOilPriceOfficialSe } @Override - public void refreshGasPriceOfficial(Long regionId, String oilNo) { - Map param = new HashMap<>(); - param.put("regionId", regionId); - param.put("oilNo", oilNo); - - List priceList = getPriceList(param); - for (BsGasOilPriceOfficial priceOfficial : priceList) { + public void refreshGasPriceOfficial(Long regionId,Integer oilPriceZoneId, String oilNo) { + // 查询国标价 + BsGasOilPriceOfficial price = getPrice(regionId, oilPriceZoneId, oilNo); + if (price != null) { // 查询区域下的油品 - List list = highGasOilPriceService.getPriceListByRegionAndOilNo(priceOfficial.getRegionId(), priceOfficial.getOilNo()); + List list = highGasOilPriceService.getPriceListByRegionAndOilNo(regionId, oilPriceZoneId, oilNo); for (BsGasOilPrice gasOilPrice : list) { - gasOilPrice.setPriceOfficial(priceOfficial.getPriceOfficial()); - gasOilPrice.setPriceGun(priceOfficial.getPriceOfficial().subtract(gasOilPrice.getGasStationDrop())); - gasOilPrice.setPriceVip(gasOilPrice.getPriceGun().subtract(gasOilPrice.getPreferentialMargin())); + gasOilPrice.setPriceOfficial(price.getPriceOfficial()); + gasOilPrice.setGasStationDrop(price.getPriceOfficial().subtract(gasOilPrice.getPriceVip())); highGasOilPriceService.editOilPrice(gasOilPrice); + + Map param = new HashMap<>(); + param.put("merNo", gasOilPrice.getMerNo()); + param.put("oilNo", gasOilPrice.getOilNo()); + List oilPriceList = gasOilPriceWeekService.getOilPriceList(param); + for (BsGasOilPriceWeek week : oilPriceList) { + week.setPriceOfficial(gasOilPrice.getPriceOfficial()); + gasOilPriceWeekService.editData(week); + } } } + } } diff --git a/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceServiceImpl.java b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceServiceImpl.java index 8111c67..9cc430b 100644 --- a/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceServiceImpl.java @@ -33,10 +33,6 @@ public class BsGasOilPriceServiceImpl implements BsGasOilPriceService { private BsGasOilGunNoService gasOilGunNoService; @Resource private BsGasService gasService; - @Resource - private RedisUtil redisUtil; - - private final static String GAS_OIL_PRICE_KEY = "GAS_OIL_PRICE_KEY:"; @Override public void editData(BsGasOilPrice data) { @@ -61,9 +57,6 @@ public class BsGasOilPriceServiceImpl implements BsGasOilPriceService { public void editOilPrice(BsGasOilPrice data) { editData(data); - // 加入缓存 - redisUtil.set(GAS_OIL_PRICE_KEY + data.getId(), data); - // 清除油站缓存 gasService.clean(data.getMerNo()); } @@ -76,9 +69,6 @@ public class BsGasOilPriceServiceImpl implements BsGasOilPriceService { // 删除抢号 gasOilGunNoService.delete(data.getMerNo(), data.getOilNo()); - - // 删除缓存 - redisUtil.del(GAS_OIL_PRICE_KEY + data.getId()); } @Override @@ -127,8 +117,8 @@ public class BsGasOilPriceServiceImpl implements BsGasOilPriceService { } @Override - public List getPriceListByRegionAndOilNo(Long regionId, String oilNo) { - return gasOilPriceMapper.selectPriceListByRegionAndOilNo(regionId,oilNo); + public List getPriceListByRegionAndOilNo(Long regionId,Integer oilPriceZoneId, String oilNo) { + return gasOilPriceMapper.selectPriceListByRegionAndOilNo(regionId, oilPriceZoneId, oilNo); } diff --git a/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceTaskServiceImpl.java b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceTaskServiceImpl.java index dcca1c1..7c017ee 100644 --- a/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceTaskServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceTaskServiceImpl.java @@ -93,7 +93,8 @@ public class BsGasOilPriceTaskServiceImpl implements BsGasOilPriceTaskService { gasOilPriceOfficialService.editPrice(gasOilPriceTask.getRegionId(),gasOilPriceTask.getOilPriceZoneId(), gasOilPriceTask.getOilNo(), gasOilPriceTask.getPrice()); // 更新自建站的国标价 - gasOilPriceOfficialService.refreshGasPriceOfficial(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo()); + gasOilPriceOfficialService.refreshGasPriceOfficial(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilPriceZoneId(), gasOilPriceTask.getOilNo()); + } else if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type2.getStatus())) { // 油站价 // 查询油品价格 diff --git a/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceWeekServiceImpl.java b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceWeekServiceImpl.java new file mode 100644 index 0000000..d62fa53 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceWeekServiceImpl.java @@ -0,0 +1,135 @@ +package com.hfkj.service.gas.impl; + +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.utils.RedisUtil; +import com.hfkj.dao.BsGasOilPriceWeekMapper; +import com.hfkj.entity.BsGasOilPrice; +import com.hfkj.entity.BsGasOilPriceWeek; +import com.hfkj.entity.BsGasOilPriceWeekExample; +import com.hfkj.entity.BsMerchant; +import com.hfkj.service.gas.BsGasOilPriceService; +import com.hfkj.service.gas.BsGasOilPriceWeekService; +import com.hfkj.service.gas.BsGasService; +import com.hfkj.service.merchant.BsMerchantService; +import com.hfkj.sysenum.MerchantSourceTypeEnum; +import com.hfkj.sysenum.gas.GasOilNoEnum; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @className: BsGasOilPriceWeekServiceImpl + * @author: HuRui + * @date: 2024/7/29 + **/ +@Service("gasOilPriceWeekService") +public class BsGasOilPriceWeekServiceImpl implements BsGasOilPriceWeekService { + + @Resource + private BsGasOilPriceWeekMapper gasOilPriceWeekMapper; + @Resource + private BsGasOilPriceService gasOilPriceService; + @Resource + private BsGasService gasService; + @Resource + private BsMerchantService merchantService; + @Resource + private RedisUtil redisUtil; + private final static String CACHE_KEY = "GAS_OIL_PRICE_WEEK:"; + @Override + public void editData(BsGasOilPriceWeek data) { + data.setUpdateTime(new Date()); + if (data.getId() == null) { + data.setCreateTime(new Date()); + gasOilPriceWeekMapper.insert(data); + } else { + gasOilPriceWeekMapper.updateByPrimaryKey(data); + } + redisUtil.set(CACHE_KEY + data.getMerNo() + "_" + data.getOilNo(), data); + } + + @Override + @Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class}) + public void updatePrice(BsGasOilPriceWeek priceWeek) { + editData(priceWeek); + // 当前星期 + int week = LocalDate.now().getDayOfWeek().getValue(); + // 如果是当天 + if (priceWeek.getWeeks().equals(week)) { + // 查询油站油价数据 + BsGasOilPrice oilPrice = gasOilPriceService.getGasOilPrice(priceWeek.getMerId(), priceWeek.getOilNo()); + if (oilPrice == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油品价格数据"); + } + oilPrice.setPriceGun(priceWeek.getPriceGun()); + oilPrice.setPriceVip(priceWeek.getPriceVip()); + gasOilPriceService.editOilPrice(oilPrice); + } + } + + @Override + public void updatePriceWeek(Integer week) { + // 更新价格 + gasOilPriceWeekMapper.updatePrice(week); + + Map param = new HashMap<>(); + param.put("sourceType", MerchantSourceTypeEnum.type1.getNumber()); + List merchantList = merchantService.getMerchantList(param); + for (BsMerchant merchant : merchantList) { + // 清除油站缓存 + gasService.clean(merchant.getMerNo()); + } + } + + @Override + public BsGasOilPriceWeek getOilPrice(String merNo, GasOilNoEnum oilNo) { + String key = CACHE_KEY + merNo + "_" + oilNo; + // 缓存 + Object cache = redisUtil.get(key); + if (cache != null) { + return (BsGasOilPriceWeek) cache; + } + BsGasOilPriceWeekExample example = new BsGasOilPriceWeekExample(); + example.createCriteria().andMerNoEqualTo(merNo).andOilNoEqualTo(oilNo.getCode().toString()); + List list = gasOilPriceWeekMapper.selectByExample(example); + if (!list.isEmpty()) { + BsGasOilPriceWeek oilPriceWeek = list.get(0); + redisUtil.set(key, oilPriceWeek); + return oilPriceWeek; + } + return null; + } + + @Override + public BsGasOilPriceWeek getOilPrice(Long priceWeekId) { + return gasOilPriceWeekMapper.selectByPrimaryKey(priceWeekId); + } + + @Override + public List getOilPriceList(Map param) { + BsGasOilPriceWeekExample example = new BsGasOilPriceWeekExample(); + BsGasOilPriceWeekExample.Criteria criteria = example.createCriteria(); + + if (StringUtils.isNotBlank(MapUtils.getString(param, "merNo"))) { + criteria.andMerNoEqualTo(MapUtils.getString(param, "merNo")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(param, "oilNo"))) { + criteria.andOilNoEqualTo(MapUtils.getString(param, "oilNo")); + } + + example.setOrderByClause("weeks"); + return gasOilPriceWeekMapper.selectByExample(example); + } +} diff --git a/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java b/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java index cfda86e..090ee0d 100644 --- a/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java @@ -186,10 +186,6 @@ public class BsMerchantServiceImpl implements BsMerchantService { criteria.andAreaCodeEqualTo(MapUtils.getLong(param, "areaCode")); } - if (MapUtils.getInteger(param, "sourceType") != null) { - criteria.andSourceTypeEqualTo(MapUtils.getInteger(param, "sourceType")); - } - if (StringUtils.isNotBlank(MapUtils.getString(param, "merNo"))) { criteria.andMerNoLike("%"+MapUtils.getString(param, "merNo")+"%"); } diff --git a/service/src/main/java/com/hfkj/sysenum/gas/GasOilPriceWeekEnum.java b/service/src/main/java/com/hfkj/sysenum/gas/GasOilPriceWeekEnum.java new file mode 100644 index 0000000..b65fb8c --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/gas/GasOilPriceWeekEnum.java @@ -0,0 +1,40 @@ +package com.hfkj.sysenum.gas; + +import lombok.Getter; + +import java.util.Objects; + +/** + * @className: GasOilPriceWeekEnum + * @author: HuRui + * @date: 2024/7/29 + **/ +@Getter +public enum GasOilPriceWeekEnum { + week1(1, "星期一"), + week2(2, "星期二"), + week3(3, "星期三"), + week4(4, "星期四"), + week5(5, "星期五"), + week6(6, "星期六"), + week7(7, "星期天"), + ; + + private Integer number; + + private String name; + + GasOilPriceWeekEnum(int number, String name) { + this.number = number; + this.name = name; + } + + public static GasOilPriceWeekEnum getNameByType(Integer type) { + for (GasOilPriceWeekEnum ele : values()) { + if (Objects.equals(type,ele.getNumber())) { + return ele; + } + } + return null; + } +} diff --git a/service/src/main/resources/prod2/commonConfig.properties b/service/src/main/resources/prod2/commonConfig.properties new file mode 100644 index 0000000..0247b38 --- /dev/null +++ b/service/src/main/resources/prod2/commonConfig.properties @@ -0,0 +1,15 @@ +filesystem=/home/project/oil/filesystem +huiPayPreorderNotifyUrl=https://oil.dctpay.com/crest/notify/huipay +domainName=https://oil.dctpay.com + +wxMaAppId=wx8d49e2f83025229d +wxMaAppSecret=d8d6dcaef77d3b659258a01b5ddba5df + +newLinkReqUrl=https://hcs.czb365.com +newLinkAppKey=305490138943968 +newLinkAppSecret=dbf7dca3de20c2f2a41fd64cfb682be8 + +cqShellReqUrl=http://api.shenmapay.com/gateway.html +cqShellPartnerId=S0302208021401950202 +cqShellPlatMerchantId=S0302206141001919666 +cqShellPlatMerchantKey=pic1yj2l3zby5ywpznrtdz7458ce2soj