Browse Source

配合前端修改问题

feature/v.2.0.0
caoyizhong 3 years ago
parent
commit
35748caf63
  1. 21
      air/src/main/java/com/air/applets/convert/LandLonLatConvert.java
  2. 32
      air/src/main/java/com/air/applets/service/impl/AppletsMapServiceImpl.java
  3. 4
      air/src/main/java/com/air/housing/service/impl/HousingEstatesServiceImpl.java
  4. 2
      air/src/main/java/com/air/housing/vo/HousingEstatesName.java
  5. 6
      air/src/main/java/com/air/land/mapper/LandListedMapper.java
  6. 30
      air/src/main/java/com/air/utils/GeomUtils.java
  7. 3
      air/src/main/resources/mapper/BlocksMapper.xml
  8. 3
      air/src/main/resources/mapper/LandListedMapper.xml

21
air/src/main/java/com/air/applets/convert/LandLonLatConvert.java

@ -9,6 +9,7 @@ import com.air.applets.entity.CityAreaLonLatBase;
import com.air.entity.PolygonGeom;
import com.air.land.entity.LandListedLonLat;
import com.air.utils.GeomUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
@ -59,17 +60,19 @@ public class LandLonLatConvert {
landProperties.setLandId(e.getLandListedId());
feature.setProperties(landProperties);
feature.setId(id);
if(StringUtils.isNotBlank(e.getLandLonLat())){
CoordinatePoint coordinatePoint = GeomUtils.lonLatConvertPoint(e.getLandLonLat());
feature.setCoordinates(coordinatePoint.getCoordinates());
landLonLatDto.setFeature(feature);
landLonLatDto.setCenterPoint(coordinatePoint.getCenPoint());
CoordinatePoint coordinatePoint = GeomUtils.lonLatConvertPoint(e.getLandLonLat());
feature.setCoordinates(coordinatePoint.getCoordinates());
landLonLatDto.setFeature(feature);
landLonLatDto.setCenterPoint(coordinatePoint.getCenPoint());
PolygonGeom polygonGeom = GeomUtils.computeGemo(coordinatePoint.getPolygonPoints(), e.getLineColor(), Integer.valueOf(e.getLineOpaqueness()),
Integer.valueOf(e.getLineWidth()), e.getFillColor(), Integer.valueOf(e.getFillOpaqueness()));
polygonGeom.setId(id);
landLonLatDto.setPolygon(polygonGeom);
landLonLatDtos.add(landLonLatDto);
}
PolygonGeom polygonGeom = GeomUtils.computeGemo(coordinatePoint.getPolygonPoints(), e.getLineColor(), Integer.valueOf(e.getLineOpaqueness()),
Integer.valueOf(e.getLineWidth()), e.getFillColor(), Integer.valueOf(e.getFillOpaqueness()));
polygonGeom.setId(id);
landLonLatDto.setPolygon(polygonGeom);
landLonLatDtos.add(landLonLatDto);
});
return landLonLatDtos;
}

32
air/src/main/java/com/air/applets/service/impl/AppletsMapServiceImpl.java

@ -88,8 +88,40 @@ public class AppletsMapServiceImpl implements AppletsMapService {
@Override
public List<LandLonLatDto> getLandList(String start , String end,String city) {
List<LandListedLonLat> list = mapMapper.getLandList(start, end, DateUtil.formatDate(new Date()), city);
list.forEach(rest ->{
rest.setLineColor(hex2RGB(rest.getLineColor(), Integer.valueOf( rest.getLineOpaqueness()) ));
rest.setFillColor(hex2RGB(rest.getFillColor(),Integer.valueOf( rest.getFillOpaqueness()) ));
});
return LandLonLatConvert.getLandLonLatDto(list,1);
}
/**
* 16进制颜色字符串转换成rgb
* @param hexStr
* @return rgb
*/
public String hex2RGB(String hexStr,Integer lineOpaqueness){
if(hexStr != null && !"".equals(hexStr) && hexStr.length() == 7){
int[] rgb = new int[3];
rgb[0] = Integer.valueOf(hexStr.substring( 1, 3 ), 16);
rgb[1] = Integer.valueOf(hexStr.substring( 3, 5 ), 16);
rgb[2] = Integer.valueOf(hexStr.substring( 5, 7 ), 16);
String s = Integer.toHexString(lineOpaqueness);
StringBuilder sb = new StringBuilder();
sb.append("rgba(");
//遍历int数组,并将int数组中的元素转换成字符串储存到字符缓冲区中去
for(int i=0;i < rgb.length;i++)
{
if(i!=rgb.length-1)
sb.append(rgb[i]+" ,");
else
sb.append(rgb[i]+","+s+" )");
}
return sb.toString();
}
return null;
}// 自定义一个字符缓冲区,
@Override
public boolean setGeom(String type) {

4
air/src/main/java/com/air/housing/service/impl/HousingEstatesServiceImpl.java

@ -62,6 +62,10 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
@Override
public IPage<HousingEstatesName> getHousingEstatesNamePage(IPage<HousingEstatesName> page, String name) {
//查询地块表
List<LandListed> landListeds = landListedMapper.selectBuildingName();
log.info("查询地块表===={}==",landListeds);
return housingEstatesMapper.getHousingEstatesNamePage(page, name);
}

2
air/src/main/java/com/air/housing/vo/HousingEstatesName.java

@ -12,7 +12,7 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode
public class HousingEstatesName {
@ApiModelProperty(value = "楼盘id")
private Long housingEstateId;
private String housingEstateId;
@ApiModelProperty(value = "楼盘名称")
private String name;
}

6
air/src/main/java/com/air/land/mapper/LandListedMapper.java

@ -76,4 +76,10 @@ public interface LandListedMapper extends BaseMapper<LandListed> {
@Select("select nextval('land_list_id')")
Integer selectId();
/**
* 查询已挂牌地库楼盘
*/
List<LandListed> selectBuildingName();
}

30
air/src/main/java/com/air/utils/GeomUtils.java

@ -28,6 +28,16 @@ import java.util.stream.Collectors;
@Slf4j
public class GeomUtils {
/**
*
* @param polygonPoints 坐标点位
* @param lineColor 线条颜色
* @param lineOpaqueness 线条不透明度
* @param lineWidth 线条宽度
* @param fillColor 填充颜色
* @param fillOpaqueness 填充不透明度
* @return
*/
public static PolygonGeom computeGemo(List<PolygonPoint> polygonPoints,String lineColor,Integer lineOpaqueness,Integer lineWidth,
String fillColor,Integer fillOpaqueness){
PolygonGeom polygonGeom = new PolygonGeom();
@ -36,11 +46,16 @@ public class GeomUtils {
String strokeColor;
String fillColor1;
if ("wechat_applet".equals(s)){
strokeColor = computeColorWechat(lineColor, lineOpaqueness);
fillColor1 = computeColorWechat(fillColor, fillOpaqueness);
//
// strokeColor = computeColorWechat(lineColor, lineOpaqueness);
// fillColor1 = computeColorWechat(fillColor, fillOpaqueness);
strokeColor =lineColor;
fillColor1 = fillColor;
}else {
strokeColor = computeColor(lineColor, lineOpaqueness);
fillColor1 = computeColor(fillColor, fillOpaqueness);
// strokeColor = computeColor(lineColor, lineOpaqueness);
// fillColor1 = computeColor(fillColor, fillOpaqueness);
strokeColor = lineColor;
fillColor1 = fillColor;
}
polygonGeom.setStrokeColor(strokeColor);
polygonGeom.setFillColor(fillColor1);
@ -222,6 +237,13 @@ public class GeomUtils {
return colorBuffer.toString();
}
// public static String computeColorWechat(String color,Integer opaqueness){
// if (StrUtil.isEmpty(color) || opaqueness == null){
// return null;
// }
// String hex = Integer.toHexString(opaqueness);
// return color+hex;
// }
public static String computeColorWechat(String color,Integer opaqueness){
if (StrUtil.isEmpty(color) || opaqueness == null){
return null;

3
air/src/main/resources/mapper/BlocksMapper.xml

@ -13,7 +13,8 @@
f.large_format,
f.`format`,
b.status_cd,
b.remark
b.remark,
from blocks b join `format` f ON b.format_id = f.format_id
where b.housing_estate_id = #{Blocks.housingEstateId}
and f.status_cd=1000 and b.status_cd = 1000

3
air/src/main/resources/mapper/LandListedMapper.xml

@ -170,6 +170,9 @@
</if>
GROUP BY DATE_FORMAT(ll.auction_date,'%Y-%m-%d')
</select>
<select id="selectBuildingName" resultType="com.air.land.entity.LandListed">
</select>
</mapper>

Loading…
Cancel
Save