diff --git a/cweb/src/main/java/com/cweb/controller/BsMerController.java b/cweb/src/main/java/com/cweb/controller/BsMerController.java index a480356..75bf429 100644 --- a/cweb/src/main/java/com/cweb/controller/BsMerController.java +++ b/cweb/src/main/java/com/cweb/controller/BsMerController.java @@ -428,6 +428,10 @@ public class BsMerController { || StringUtils.isBlank(storeModel.getDoorHeadImg()) || StringUtils.isBlank(storeModel.getCashRegisterImg()) || StringUtils.isBlank(storeModel.getInternalImg()) + || StringUtils.isBlank(storeModel.getStoreRegion().getAddress()) + || storeModel.getStoreRegion().getAreaCode() == null + || storeModel.getStoreRegion().getLongitude() == null + || storeModel.getStoreRegion().getLatitude() == null ) { log.error("configStore error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -484,14 +488,26 @@ public class BsMerController { storeModel.getStoreIndustry().setChildId(mer.getMerIndustry().getChildId()); storeModel.getStoreIndustry().setChildName(mer.getMerIndustry().getChildName()); - storeModel.setStoreRegion(new BsStoreRegion()); - storeModel.getStoreRegion().setProvinceCode(mer.getMerRegion().getProvinceCode()); + // 区域 + Map regionMap = commonService.getParentInfoByRegionId(storeModel.getStoreRegion().getAreaCode()); + if (regionMap == null) { + log.error("configMerBasis error!","未知的区域"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的区域"); + } + storeModel.getStoreRegion().setProvinceCode(MapUtils.getObject(regionMap, "city").getRegionId()); + storeModel.getStoreRegion().setProvinceName(MapUtils.getObject(regionMap, "city").getRegionName()); + storeModel.getStoreRegion().setCityCode(MapUtils.getObject(regionMap, "region").getRegionId()); + storeModel.getStoreRegion().setCityName(MapUtils.getObject(regionMap, "region").getRegionName()); + storeModel.getStoreRegion().setAreaCode(MapUtils.getObject(regionMap, "street").getRegionId()); + storeModel.getStoreRegion().setAreaName(MapUtils.getObject(regionMap, "street").getRegionName()); + + /* storeModel.getStoreRegion().setProvinceCode(mer.getMerRegion().getProvinceCode()); storeModel.getStoreRegion().setProvinceName(mer.getMerRegion().getProvinceName()); storeModel.getStoreRegion().setCityCode(mer.getMerRegion().getCityCode()); storeModel.getStoreRegion().setCityName(mer.getMerRegion().getCityName()); storeModel.getStoreRegion().setAreaCode(mer.getMerRegion().getAreaCode()); storeModel.getStoreRegion().setAreaName(mer.getMerRegion().getAreaName()); - storeModel.getStoreRegion().setAddress(mer.getMerRegion().getAddress()); + storeModel.getStoreRegion().setAddress(mer.getMerRegion().getAddress());*/ merService.configMerStore(storeModel); diff --git a/cweb/src/main/java/com/cweb/controller/BsStoreController.java b/cweb/src/main/java/com/cweb/controller/BsStoreController.java index b3c008e..58cc3c0 100644 --- a/cweb/src/main/java/com/cweb/controller/BsStoreController.java +++ b/cweb/src/main/java/com/cweb/controller/BsStoreController.java @@ -128,6 +128,8 @@ public class BsStoreController { || storeModel.getStoreRegion() == null || StringUtils.isBlank(storeModel.getStoreRegion().getAddress()) || storeModel.getStoreRegion().getAreaCode() == null + || storeModel.getStoreRegion().getLongitude() == null + || storeModel.getStoreRegion().getLatitude() == null ) { log.error("configStore error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); diff --git a/service/src/main/java/com/hfkj/dao/BsStoreRegionMapper.java b/service/src/main/java/com/hfkj/dao/BsStoreRegionMapper.java index fcc7a04..48ab72d 100644 --- a/service/src/main/java/com/hfkj/dao/BsStoreRegionMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsStoreRegionMapper.java @@ -42,14 +42,16 @@ public interface BsStoreRegionMapper extends BsStoreRegionMapperExt { "insert into bs_store_region (store_id, province_code, ", "province_name, city_code, ", "city_name, area_code, ", - "area_name, address, ", + "area_name, longitude, ", + "latitude, address, ", "`status`, create_time, ", "update_time, ext_1, ", "ext_2, ext_3)", "values (#{storeId,jdbcType=BIGINT}, #{provinceCode,jdbcType=BIGINT}, ", "#{provinceName,jdbcType=VARCHAR}, #{cityCode,jdbcType=BIGINT}, ", "#{cityName,jdbcType=VARCHAR}, #{areaCode,jdbcType=BIGINT}, ", - "#{areaName,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ", + "#{areaName,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR}, ", + "#{latitude,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ", "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" @@ -71,6 +73,8 @@ public interface BsStoreRegionMapper extends BsStoreRegionMapperExt { @Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), @Result(column="area_code", property="areaCode", jdbcType=JdbcType.BIGINT), @Result(column="area_name", property="areaName", jdbcType=JdbcType.VARCHAR), + @Result(column="longitude", property="longitude", jdbcType=JdbcType.VARCHAR), + @Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR), @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @@ -84,7 +88,8 @@ public interface BsStoreRegionMapper extends BsStoreRegionMapperExt { @Select({ "select", "id, store_id, province_code, province_name, city_code, city_name, area_code, ", - "area_name, address, `status`, create_time, update_time, ext_1, ext_2, ext_3", + "area_name, longitude, latitude, address, `status`, create_time, update_time, ", + "ext_1, ext_2, ext_3", "from bs_store_region", "where id = #{id,jdbcType=BIGINT}" }) @@ -97,6 +102,8 @@ public interface BsStoreRegionMapper extends BsStoreRegionMapperExt { @Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), @Result(column="area_code", property="areaCode", jdbcType=JdbcType.BIGINT), @Result(column="area_name", property="areaName", jdbcType=JdbcType.VARCHAR), + @Result(column="longitude", property="longitude", jdbcType=JdbcType.VARCHAR), + @Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR), @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @@ -125,6 +132,8 @@ public interface BsStoreRegionMapper extends BsStoreRegionMapperExt { "city_name = #{cityName,jdbcType=VARCHAR},", "area_code = #{areaCode,jdbcType=BIGINT},", "area_name = #{areaName,jdbcType=VARCHAR},", + "longitude = #{longitude,jdbcType=VARCHAR},", + "latitude = #{latitude,jdbcType=VARCHAR},", "address = #{address,jdbcType=VARCHAR},", "`status` = #{status,jdbcType=INTEGER},", "create_time = #{createTime,jdbcType=TIMESTAMP},", diff --git a/service/src/main/java/com/hfkj/dao/BsStoreRegionSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsStoreRegionSqlProvider.java index 85782d6..af610ba 100644 --- a/service/src/main/java/com/hfkj/dao/BsStoreRegionSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsStoreRegionSqlProvider.java @@ -56,6 +56,14 @@ public class BsStoreRegionSqlProvider { sql.VALUES("area_name", "#{areaName,jdbcType=VARCHAR}"); } + if (record.getLongitude() != null) { + sql.VALUES("longitude", "#{longitude,jdbcType=VARCHAR}"); + } + + if (record.getLatitude() != null) { + sql.VALUES("latitude", "#{latitude,jdbcType=VARCHAR}"); + } + if (record.getAddress() != null) { sql.VALUES("address", "#{address,jdbcType=VARCHAR}"); } @@ -101,6 +109,8 @@ public class BsStoreRegionSqlProvider { sql.SELECT("city_name"); sql.SELECT("area_code"); sql.SELECT("area_name"); + sql.SELECT("longitude"); + sql.SELECT("latitude"); sql.SELECT("address"); sql.SELECT("`status`"); sql.SELECT("create_time"); @@ -157,6 +167,14 @@ public class BsStoreRegionSqlProvider { sql.SET("area_name = #{record.areaName,jdbcType=VARCHAR}"); } + if (record.getLongitude() != null) { + sql.SET("longitude = #{record.longitude,jdbcType=VARCHAR}"); + } + + if (record.getLatitude() != null) { + sql.SET("latitude = #{record.latitude,jdbcType=VARCHAR}"); + } + if (record.getAddress() != null) { sql.SET("address = #{record.address,jdbcType=VARCHAR}"); } @@ -201,6 +219,8 @@ public class BsStoreRegionSqlProvider { sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}"); sql.SET("area_code = #{record.areaCode,jdbcType=BIGINT}"); sql.SET("area_name = #{record.areaName,jdbcType=VARCHAR}"); + sql.SET("longitude = #{record.longitude,jdbcType=VARCHAR}"); + sql.SET("latitude = #{record.latitude,jdbcType=VARCHAR}"); sql.SET("address = #{record.address,jdbcType=VARCHAR}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); @@ -246,6 +266,14 @@ public class BsStoreRegionSqlProvider { sql.SET("area_name = #{areaName,jdbcType=VARCHAR}"); } + if (record.getLongitude() != null) { + sql.SET("longitude = #{longitude,jdbcType=VARCHAR}"); + } + + if (record.getLatitude() != null) { + sql.SET("latitude = #{latitude,jdbcType=VARCHAR}"); + } + if (record.getAddress() != null) { sql.SET("address = #{address,jdbcType=VARCHAR}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsStoreRegion.java b/service/src/main/java/com/hfkj/entity/BsStoreRegion.java index 905d658..b6d7663 100644 --- a/service/src/main/java/com/hfkj/entity/BsStoreRegion.java +++ b/service/src/main/java/com/hfkj/entity/BsStoreRegion.java @@ -53,6 +53,16 @@ public class BsStoreRegion implements Serializable { */ private String areaName; + /** + * 地址经度 + */ + private String longitude; + + /** + * 地址纬度 + */ + private String latitude; + /** * 详细地址 */ @@ -145,6 +155,22 @@ public class BsStoreRegion implements Serializable { this.areaName = areaName; } + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + public String getAddress() { return address; } @@ -221,6 +247,8 @@ public class BsStoreRegion implements Serializable { && (this.getCityName() == null ? other.getCityName() == null : this.getCityName().equals(other.getCityName())) && (this.getAreaCode() == null ? other.getAreaCode() == null : this.getAreaCode().equals(other.getAreaCode())) && (this.getAreaName() == null ? other.getAreaName() == null : this.getAreaName().equals(other.getAreaName())) + && (this.getLongitude() == null ? other.getLongitude() == null : this.getLongitude().equals(other.getLongitude())) + && (this.getLatitude() == null ? other.getLatitude() == null : this.getLatitude().equals(other.getLatitude())) && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) @@ -242,6 +270,8 @@ public class BsStoreRegion implements Serializable { result = prime * result + ((getCityName() == null) ? 0 : getCityName().hashCode()); result = prime * result + ((getAreaCode() == null) ? 0 : getAreaCode().hashCode()); result = prime * result + ((getAreaName() == null) ? 0 : getAreaName().hashCode()); + result = prime * result + ((getLongitude() == null) ? 0 : getLongitude().hashCode()); + result = prime * result + ((getLatitude() == null) ? 0 : getLatitude().hashCode()); result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); @@ -266,6 +296,8 @@ public class BsStoreRegion implements Serializable { sb.append(", cityName=").append(cityName); sb.append(", areaCode=").append(areaCode); sb.append(", areaName=").append(areaName); + sb.append(", longitude=").append(longitude); + sb.append(", latitude=").append(latitude); sb.append(", address=").append(address); sb.append(", status=").append(status); sb.append(", createTime=").append(createTime); diff --git a/service/src/main/java/com/hfkj/entity/BsStoreRegionExample.java b/service/src/main/java/com/hfkj/entity/BsStoreRegionExample.java index db6b3ad..79de78b 100644 --- a/service/src/main/java/com/hfkj/entity/BsStoreRegionExample.java +++ b/service/src/main/java/com/hfkj/entity/BsStoreRegionExample.java @@ -635,6 +635,146 @@ public class BsStoreRegionExample { return (Criteria) this; } + public Criteria andLongitudeIsNull() { + addCriterion("longitude is null"); + return (Criteria) this; + } + + public Criteria andLongitudeIsNotNull() { + addCriterion("longitude is not null"); + return (Criteria) this; + } + + public Criteria andLongitudeEqualTo(String value) { + addCriterion("longitude =", value, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeNotEqualTo(String value) { + addCriterion("longitude <>", value, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeGreaterThan(String value) { + addCriterion("longitude >", value, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeGreaterThanOrEqualTo(String value) { + addCriterion("longitude >=", value, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeLessThan(String value) { + addCriterion("longitude <", value, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeLessThanOrEqualTo(String value) { + addCriterion("longitude <=", value, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeLike(String value) { + addCriterion("longitude like", value, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeNotLike(String value) { + addCriterion("longitude not like", value, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeIn(List values) { + addCriterion("longitude in", values, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeNotIn(List values) { + addCriterion("longitude not in", values, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeBetween(String value1, String value2) { + addCriterion("longitude between", value1, value2, "longitude"); + return (Criteria) this; + } + + public Criteria andLongitudeNotBetween(String value1, String value2) { + addCriterion("longitude not between", value1, value2, "longitude"); + return (Criteria) this; + } + + public Criteria andLatitudeIsNull() { + addCriterion("latitude is null"); + return (Criteria) this; + } + + public Criteria andLatitudeIsNotNull() { + addCriterion("latitude is not null"); + return (Criteria) this; + } + + public Criteria andLatitudeEqualTo(String value) { + addCriterion("latitude =", value, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeNotEqualTo(String value) { + addCriterion("latitude <>", value, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeGreaterThan(String value) { + addCriterion("latitude >", value, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeGreaterThanOrEqualTo(String value) { + addCriterion("latitude >=", value, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeLessThan(String value) { + addCriterion("latitude <", value, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeLessThanOrEqualTo(String value) { + addCriterion("latitude <=", value, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeLike(String value) { + addCriterion("latitude like", value, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeNotLike(String value) { + addCriterion("latitude not like", value, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeIn(List values) { + addCriterion("latitude in", values, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeNotIn(List values) { + addCriterion("latitude not in", values, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeBetween(String value1, String value2) { + addCriterion("latitude between", value1, value2, "latitude"); + return (Criteria) this; + } + + public Criteria andLatitudeNotBetween(String value1, String value2) { + addCriterion("latitude not between", value1, value2, "latitude"); + return (Criteria) this; + } + public Criteria andAddressIsNull() { addCriterion("address is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java index cb1b20b..ff7ea03 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java @@ -210,6 +210,15 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { tradeOrder.setPayTime(new Date()); editOrder(tradeOrder); + Map param = new HashMap<>(); + param.put("storeId", tradeOrder.getStoreId()); + param.put("deviceType", DeviceTypeEnum.type1.getNumber()); + param.put("status", DeviceStatusEnum.status1.getNumber()); + List deviceList = deviceService.getDeviceList(param); + for (BsDevice device : deviceList) { + soundService.sendPayMsg(device.getDeviceNo(), tradeOrder.getTradeAmount()); + } + if (tradeOrder.getStoreDiscountId() != null && StringUtils.isNotBlank(tradeOrder.getUserPhone())) { BsStoreDiscountActivityPartakeUser partakeUser = discountActivityPartakeUserService.getPartakeUser(tradeOrder.getUserPhone(), tradeOrder.getStoreDiscountId()); if (partakeUser != null) { @@ -223,15 +232,6 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { userDiscountService.userDiscountUse(tradeOrder.getUserDiscountId(), tradeOrder.getUserPhone()); } - Map param = new HashMap<>(); - param.put("storeId", tradeOrder.getStoreId()); - param.put("deviceType", DeviceTypeEnum.type1.getNumber()); - param.put("status", DeviceStatusEnum.status1.getNumber()); - List deviceList = deviceService.getDeviceList(param); - for (BsDevice device : deviceList) { - soundService.sendPayMsg(device.getDeviceNo(), tradeOrder.getTradeAmount()); - } - // 创建分账 if (tradeOrder.getProfitSharingStatus().equals(true)) { new Thread(() -> {