Commit 57feeaee by yuanchao

1208问题整改

parent 44e10559
...@@ -123,6 +123,11 @@ public class WaterGoodsController extends BaseController ...@@ -123,6 +123,11 @@ public class WaterGoodsController extends BaseController
return getDataTable(waterGoodsVos); return getDataTable(waterGoodsVos);
} }
@GetMapping("/zyImgList")
public List imgList(){
return waterGoodsService.selectWaterGoodsList1();
}
/** /**
* 查询首页商品列表(订水端小程序) * 查询首页商品列表(订水端小程序)
*/ */
......
...@@ -29,10 +29,10 @@ public class WaterGoodsCart { ...@@ -29,10 +29,10 @@ public class WaterGoodsCart {
private String goodsTypeName; private String goodsTypeName;
/** 商品规格id */ /** 商品规格id */
private Long goodsSpeId; private String goodsSpeId;
/** 商品规格值id */ /** 商品规格值id */
private Long goodsSpeValId; private String goodsSpeValId;
/** 商品规格详情 */ /** 商品规格详情 */
private String goodsSpeVal; private String goodsSpeVal;
......
...@@ -40,12 +40,17 @@ public class WaterStation ...@@ -40,12 +40,17 @@ public class WaterStation
/** 经度 */ /** 经度 */
@Excel(name = "经度") @Excel(name = "经度")
private BigDecimal stationLon; private double stationLon;
/** 纬度 */ /** 纬度 */
@Excel(name = "纬度") @Excel(name = "纬度")
private BigDecimal stationLat; private double stationLat;
/**高德转腾讯经度**/
private double stationLonTen;
/**高德转腾讯纬度**/
private double stationLatTen;
/** 省份 */ /** 省份 */
@Excel(name = "省份") @Excel(name = "省份")
private String province; private String province;
...@@ -60,7 +65,7 @@ public class WaterStation ...@@ -60,7 +65,7 @@ public class WaterStation
/** 是否打烊(1营业0打烊) */ /** 是否打烊(1营业0打烊) */
@Excel(name = "是否打烊(1营业0打烊)") @Excel(name = "是否打烊(1营业0打烊)")
private Long isOpen; private String isOpen;
/** 创建人 */ /** 创建人 */
@Excel(name = "创建人") @Excel(name = "创建人")
......
...@@ -31,6 +31,7 @@ public interface WaterGoodsMapper ...@@ -31,6 +31,7 @@ public interface WaterGoodsMapper
*/ */
public List<WaterGoods> selectWaterGoodsList(WaterGoods waterGoods); public List<WaterGoods> selectWaterGoodsList(WaterGoods waterGoods);
List<WaterGoods> selectWaterGoodsList1();
/** /**
* 新增商品 * 新增商品
* *
......
...@@ -28,7 +28,7 @@ public interface WaterGoodsSpeMapper ...@@ -28,7 +28,7 @@ public interface WaterGoodsSpeMapper
* @param id 商品关联规格值主键 * @param id 商品关联规格值主键
* @return 商品关联规格值 * @return 商品关联规格值
*/ */
public WaterGoodsSpeVal selectWaterGoodsSpeValById(Long id); public WaterGoodsSpeVal selectWaterGoodsSpeValById(String id);
/** /**
* 查询商品关联规格列表 * 查询商品关联规格列表
......
...@@ -29,6 +29,9 @@ public interface IWaterGoodsService ...@@ -29,6 +29,9 @@ public interface IWaterGoodsService
*/ */
public List<WaterGoods> selectWaterGoodsList(WaterGoods waterGoods); public List<WaterGoods> selectWaterGoodsList(WaterGoods waterGoods);
List<WaterGoods> selectWaterGoodsList1();
/** /**
* 新增商品 * 新增商品
* *
......
...@@ -149,6 +149,16 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService ...@@ -149,6 +149,16 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
} }
/** /**
* 主页轮播图
* @param
* @return
*/
@Override
public List<WaterGoods> selectWaterGoodsList1() {
return waterGoodsMapper.selectWaterGoodsList1();
}
/**
* 新增商品 * 新增商品
* *
* @param waterGoodsVo 商品 * @param waterGoodsVo 商品
......
...@@ -77,6 +77,9 @@ public class WaterStationServiceImpl implements IWaterStationService ...@@ -77,6 +77,9 @@ public class WaterStationServiceImpl implements IWaterStationService
@Transactional @Transactional
public int insertWaterStation(WaterStation waterStation) public int insertWaterStation(WaterStation waterStation)
{ {
WaterStation w = gaodeToTencent(waterStation.getStationLon(),waterStation.getStationLat());
waterStation.setStationLonTen(w.getStationLonTen());
waterStation.setStationLatTen(w.getStationLatTen());
waterStation.setCreateUser("管理员"); waterStation.setCreateUser("管理员");
waterStation.setCreateTime(DateUtils.getNowDate()); waterStation.setCreateTime(DateUtils.getNowDate());
int i = waterStationMapper.insertWaterStation(waterStation); int i = waterStationMapper.insertWaterStation(waterStation);
...@@ -84,6 +87,28 @@ public class WaterStationServiceImpl implements IWaterStationService ...@@ -84,6 +87,28 @@ public class WaterStationServiceImpl implements IWaterStationService
} }
/** /**
* 将高德地图的经纬度坐标转换为腾讯地图的经纬度坐标
*
* @param lng 高德地图经度
* @param lat 高德地图纬度
* @return 腾讯地图经纬度数组,第一个元素为腾讯地图经度,第二个元素为腾讯地图纬度
*/
public static WaterStation gaodeToTencent(double lng, double lat) {
WaterStation w = new WaterStation();
double tx_lng = lng + 0.0065, tx_lat = lat + 0.006;
double x = tx_lng, y = tx_lat;
double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * Math.PI);
double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * Math.PI);
tx_lng = z * Math.cos(theta);
tx_lat = z * Math.sin(theta);
w.setStationLonTen(tx_lng);
w.setStationLatTen(tx_lat);
return w;
}
/**
* 修改站点 * 修改站点
* *
* @param waterStation 站点 * @param waterStation 站点
...@@ -95,6 +120,9 @@ public class WaterStationServiceImpl implements IWaterStationService ...@@ -95,6 +120,9 @@ public class WaterStationServiceImpl implements IWaterStationService
{ {
//删除该站点用户 //删除该站点用户
waterStationMapper.deleteWaterStationUserByStationId(waterStation.getId()); waterStationMapper.deleteWaterStationUserByStationId(waterStation.getId());
WaterStation w = gaodeToTencent(waterStation.getStationLon(),waterStation.getStationLat());
waterStation.setStationLonTen(w.getStationLonTen());
waterStation.setStationLatTen(w.getStationLatTen());
return waterStationMapper.updateWaterStation(waterStation); return waterStationMapper.updateWaterStation(waterStation);
} }
......
...@@ -31,12 +31,14 @@ public class WaterStationVo { ...@@ -31,12 +31,14 @@ public class WaterStationVo {
/** 经度 */ /** 经度 */
@Excel(name = "经度") @Excel(name = "经度")
private BigDecimal stationLon; private double stationLon;
/** 纬度 */ /** 纬度 */
@Excel(name = "纬度") @Excel(name = "纬度")
private BigDecimal stationLat; private double stationLat;
private double stationLonTen;
private double stationLatTen;
/** 省份 */ /** 省份 */
@Excel(name = "省份") @Excel(name = "省份")
private String province; private String province;
...@@ -51,7 +53,7 @@ public class WaterStationVo { ...@@ -51,7 +53,7 @@ public class WaterStationVo {
/** 是否打烊(1营业0打烊) */ /** 是否打烊(1营业0打烊) */
@Excel(name = "是否打烊(1营业0打烊)") @Excel(name = "是否打烊(1营业0打烊)")
private Long isOpen; private String isOpen;
/** 创建人 */ /** 创建人 */
@Excel(name = "创建人") @Excel(name = "创建人")
......
...@@ -38,6 +38,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -38,6 +38,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time DESC order by create_time DESC
</select> </select>
<select id="selectWaterGoodsList1" resultMap="WaterGoodsResult">
select url cover_img from water_goods_img where img_type = 1 and goods_id = (select id from water_goods where title = '主页轮播图')
</select>
<select id="selectWaterGoodsById" parameterType="Long" resultMap="WaterGoodsResult"> <select id="selectWaterGoodsById" parameterType="Long" resultMap="WaterGoodsResult">
<include refid="selectWaterGoodsVo"/> <include refid="selectWaterGoodsVo"/>
where id = #{id} where id = #{id}
......
...@@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectWaterGoodsSpeValById" parameterType="Long" resultType="WaterGoodsSpeVal"> <select id="selectWaterGoodsSpeValById" parameterType="String" resultType="WaterGoodsSpeVal">
select id, spe_id, spe, spe_val, price from water_goods_spe_val select id, spe_id, spe, spe_val, price from water_goods_spe_val
where id = #{id} where id = #{id}
</select> </select>
......
...@@ -11,6 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -11,6 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="stationAddress" column="station_address" /> <result property="stationAddress" column="station_address" />
<result property="stationLon" column="station_lon" /> <result property="stationLon" column="station_lon" />
<result property="stationLat" column="station_lat" /> <result property="stationLat" column="station_lat" />
<result property="stationLonTen" column="station_lon_ten" />
<result property="stationLatTen" column="station_lat_ten" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="province" column="province" /> <result property="province" column="province" />
<result property="city" column="city" /> <result property="city" column="city" />
...@@ -20,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -20,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectWaterStationVo"> <sql id="selectWaterStationVo">
select id, station_name, phone_num, station_address, station_lon, station_lat, create_time, province, city, area, is_open, create_user from water_station select id, station_name, phone_num, station_address, station_lon, station_lon_ten,station_lat,station_lat_ten, create_time, province, city, area, is_open, create_user from water_station
</sql> </sql>
<select id="selectWaterStationList" parameterType="WaterStation" resultMap="WaterStationResult"> <select id="selectWaterStationList" parameterType="WaterStation" resultMap="WaterStationResult">
...@@ -30,8 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -30,8 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if> <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
<if test="phoneNum != null "> and phone_num = #{phoneNum}</if> <if test="phoneNum != null "> and phone_num = #{phoneNum}</if>
<if test="stationAddress != null and stationAddress != ''"> and station_address = #{stationAddress}</if> <if test="stationAddress != null and stationAddress != ''"> and station_address = #{stationAddress}</if>
<if test="stationLon != null "> and station_lon = #{stationLon}</if> <!-- <if test="stationLon != null "> and station_lon = #{stationLon}</if>
<if test="stationLat != null "> and station_lat = #{stationLat}</if> <if test="stationLat != null "> and station_lat = #{stationLat}</if>-->
<if test="province != null and province != ''"> and province = #{province}</if> <if test="province != null and province != ''"> and province = #{province}</if>
<if test="city != null and city != ''"> and city = #{city}</if> <if test="city != null and city != ''"> and city = #{city}</if>
<if test="area != null and area != ''"> and area = #{area}</if> <if test="area != null and area != ''"> and area = #{area}</if>
...@@ -57,7 +59,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -57,7 +59,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phoneNum != null">phone_num,</if> <if test="phoneNum != null">phone_num,</if>
<if test="stationAddress != null">station_address,</if> <if test="stationAddress != null">station_address,</if>
<if test="stationLon != null">station_lon,</if> <if test="stationLon != null">station_lon,</if>
<if test="stationLonTen != null">station_lon_ten,</if>
<if test="stationLat != null">station_lat,</if> <if test="stationLat != null">station_lat,</if>
<if test="stationLatTen != null">station_lat_ten,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="province != null">province,</if> <if test="province != null">province,</if>
<if test="city != null">city,</if> <if test="city != null">city,</if>
...@@ -70,7 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -70,7 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phoneNum != null">#{phoneNum},</if> <if test="phoneNum != null">#{phoneNum},</if>
<if test="stationAddress != null">#{stationAddress},</if> <if test="stationAddress != null">#{stationAddress},</if>
<if test="stationLon != null">#{stationLon},</if> <if test="stationLon != null">#{stationLon},</if>
<if test="stationLonTen != null">#{stationLonTen},</if>
<if test="stationLat != null">#{stationLat},</if> <if test="stationLat != null">#{stationLat},</if>
<if test="stationLatTen != null">#{stationLatTen},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="province != null">#{province},</if> <if test="province != null">#{province},</if>
<if test="city != null">#{city},</if> <if test="city != null">#{city},</if>
...@@ -87,7 +93,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -87,7 +93,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phoneNum != null">phone_num = #{phoneNum},</if> <if test="phoneNum != null">phone_num = #{phoneNum},</if>
<if test="stationAddress != null">station_address = #{stationAddress},</if> <if test="stationAddress != null">station_address = #{stationAddress},</if>
<if test="stationLon != null">station_lon = #{stationLon},</if> <if test="stationLon != null">station_lon = #{stationLon},</if>
<if test="stationLonTen != null">station_lon_ten = #{stationLonTen},</if>
<if test="stationLat != null">station_lat = #{stationLat},</if> <if test="stationLat != null">station_lat = #{stationLat},</if>
<if test="stationLatTen != null">station_lat_ten = #{stationLatTen},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="province != null">province = #{province},</if> <if test="province != null">province = #{province},</if>
<if test="city != null">city = #{city},</if> <if test="city != null">city = #{city},</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment