WIN-B904R0U0NNS\Administrator il y a 2 ans
Parent
commit
8869b8787c

+ 1 - 0
.gitignore

@@ -10,3 +10,4 @@ jeecg-module-system/jeecg-system-start/jeecg-system-start.iml
 jeecg-module-system/jeecg-system-start/target/
 jeecg-boot-parent.iml
 *.iml
+jeecg-module-system/jeecg-system-api/jeecg-system-cloud-api/target/

+ 234 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusHotelController.java

@@ -1,4 +1,236 @@
 package org.jeecg.modules.business.controller;
 
-public class BusHotelController {
-}
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.util.JwtUtil;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.oConvertUtils;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecg.modules.base.service.BaseCommonService;
+import org.jeecg.modules.business.entity.BusHotel;
+import org.jeecg.modules.business.service.IBusHotelService;
+import org.jeecg.modules.business.util.MapUtil;
+import org.jeecg.modules.system.entity.SysTenant;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysTenantService;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+
+ /**
+ * @Description: bus_hotel
+ * @Author: jeecg-boot
+ * @Date:   2023-02-14
+ * @Version: V1.0
+ */
+@Api(tags="bus_hotel")
+@RestController
+@RequestMapping("/business/busHotel")
+@Slf4j
+public class BusHotelController extends JeecgController<BusHotel, IBusHotelService> {
+	@Autowired
+	private IBusHotelService busHotelService;
+
+	 @Autowired
+	 private ISysTenantService sysTenantService;
+
+	/**
+	 * 分页列表查询
+	 *
+	 * @param busHotel
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "bus_hotel-分页列表查询")
+	@ApiOperation(value="bus_hotel-分页列表查询", notes="bus_hotel-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BusHotel>> queryPageList(BusHotel busHotel,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<BusHotel> queryWrapper = QueryGenerator.initQueryWrapper(busHotel, req.getParameterMap());
+		Page<BusHotel> page = new Page<BusHotel>(pageNo, pageSize);
+		IPage<BusHotel> pageList = busHotelService.page(page, queryWrapper);
+//		pageList.getRecords().forEach(item->{
+//			item.tenantName(useDepNames.get(item.getId()));
+//		});
+
+		pageList.getRecords().forEach(item->{
+			SysTenant sysTenant = sysTenantService.getById(item.getTenantId());
+			if (sysTenant != null) {
+				item.setTenantName(sysTenant.getName());
+			}
+		});
+
+
+		return Result.OK(pageList);
+	}
+
+	/**
+	 *   添加
+	 *
+	 * @param busHotel
+	 * @return
+	 */
+	@AutoLog(value = "bus_hotel-添加")
+	@ApiOperation(value="bus_hotel-添加", notes="bus_hotel-添加")
+	//@RequiresPermissions("business:bus_hotel_info:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody BusHotel busHotel) {
+		busHotel.setStatus(1);
+		busHotel.setDelFlag(CommonConstant.DEL_FLAG_0);
+		busHotel.setCheckStatus(0);
+		busHotelService.save(busHotel);
+		return Result.OK("添加成功!");
+	}
+
+	/**
+	 *  编辑
+	 *
+	 * @param busHotel
+	 * @return
+	 */
+	@AutoLog(value = "bus_hotel-编辑")
+	@ApiOperation(value="bus_hotel-编辑", notes="bus_hotel-编辑")
+	//@RequiresPermissions("business:bus_hotel_info:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody BusHotel busHotel) {
+		busHotelService.updateById(busHotel);
+		return Result.OK("编辑成功!");
+	}
+
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "bus_hotel-通过id删除")
+	@ApiOperation(value="bus_hotel-通过id删除", notes="bus_hotel-通过id删除")
+	//@RequiresPermissions("business:bus_hotel_info:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		busHotelService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "bus_hotel-批量删除")
+	@ApiOperation(value="bus_hotel-批量删除", notes="bus_hotel-批量删除")
+	//@RequiresPermissions("business:bus_hotel_info:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.busHotelService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "bus_hotel-通过id查询")
+	@ApiOperation(value="bus_hotel-通过id查询", notes="bus_hotel-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BusHotel> queryById(@RequestParam(name="id",required=true) String id) {
+		BusHotel busHotel = busHotelService.getById(id);
+		if(busHotel==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(busHotel);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param busHotel
+    */
+    //@RequiresPermissions("business:bus_hotel_info:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, BusHotel busHotel) {
+        return super.exportXls(request, busHotel, BusHotel.class, "bus_hotel");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    //@RequiresPermissions("business:bus_hotel_info:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, BusHotel.class);
+    }
+
+	 /**
+	  * 信息审核
+	  */
+	 @RequestMapping(value = "/hotelCheck", method = {RequestMethod.PUT,RequestMethod.POST})
+	 public Result<?> hotelCheck(@RequestBody BusHotel busHotel, HttpServletRequest request) {
+		 BusHotel checkHotel = new BusHotel();
+		 checkHotel.setId(busHotel.getId());
+		 checkHotel.setCheckRemarks(busHotel.getCheckRemarks());
+		 checkHotel.setCheckStatus(busHotel.getCheckStatus());
+		 checkHotel.setCheckBy(JwtUtil.getUserNameByToken(request));
+		 checkHotel.setCheckTime(new Date());
+		 busHotelService.hotelCheck(checkHotel);
+		 return Result.OK("审核成功!");
+	 }
+
+	 /**
+	  * 通过地址获取经纬度信息
+	  *
+	  * @param address
+	  * @return
+	  */
+	 @RequestMapping(value = "/getLonAndLat", method = RequestMethod.GET)
+	 public Result<?> getLonAndLat(String address) {
+		 Map<String, String> lonAndLat = MapUtil.getLonAndLat(address, "e5f8153683e606345c7c96cd3e16172f");
+		 System.out.println("转换后经纬度为:" + lonAndLat);
+		 return Result.OK(lonAndLat);
+	 }
+
+ }

+ 254 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusHotel.java

@@ -0,0 +1,254 @@
+package org.jeecg.modules.business.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: bus_hotel
+ * @Author: jeecg-boot
+ * @Date:   2023-02-14
+ * @Version: V1.0
+ */
+@Data
+@TableName("bus_hotel_info")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="bus_hotel_info对象", description="bus_hotel")
+public class BusHotel implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**主键*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键")
+    private String id;
+	/**关联租户*/
+	@Excel(name = "关联租户", width = 15)
+    @ApiModelProperty(value = "关联租户")
+    private String tenantId;
+
+    /**租户名称*/
+    private transient String tenantName;
+
+	/**酒店名称*/
+	@Excel(name = "酒店名称", width = 15)
+    @ApiModelProperty(value = "酒店名称")
+    private String name;
+	/**联系人*/
+	@Excel(name = "联系人", width = 15)
+    @ApiModelProperty(value = "联系人")
+    private String linkName;
+	/**联系电话*/
+	@Excel(name = "联系电话", width = 15)
+    @ApiModelProperty(value = "联系电话")
+    private String linkTel;
+	/**酒店电话*/
+	@Excel(name = "酒店电话", width = 15)
+    @ApiModelProperty(value = "酒店电话")
+    private String tel;
+	/**酒店地址*/
+	@Excel(name = "酒店地址", width = 15)
+    @ApiModelProperty(value = "酒店地址")
+    private String address;
+	/**星级*/
+	@Excel(name = "星级", width = 15)
+    @ApiModelProperty(value = "星级")
+    private Integer star;
+	/**经度*/
+	@Excel(name = "经度", width = 15)
+    @ApiModelProperty(value = "经度")
+    private BigDecimal lng;
+	/**纬度*/
+	@Excel(name = "纬度", width = 15)
+    @ApiModelProperty(value = "纬度")
+    private BigDecimal lat;
+	/**客房总数*/
+	@Excel(name = "客房总数", width = 15)
+    @ApiModelProperty(value = "客房总数")
+    private Integer roomCount;
+	/**开业时间*/
+	@Excel(name = "开业时间", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "开业时间")
+    private Date openTime;
+	/**装修时间*/
+	@Excel(name = "装修时间", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "装修时间")
+    private Date renovationTime;
+	/**酒店主题*/
+	@Excel(name = "酒店主题", width = 15)
+    @ApiModelProperty(value = "酒店主题")
+    private String topic;
+	/**酒店政策*/
+	@Excel(name = "酒店政策", width = 15)
+    @ApiModelProperty(value = "酒店政策")
+    private String policy;
+	/**酒店介绍*/
+	@Excel(name = "酒店介绍", width = 15)
+    @ApiModelProperty(value = "酒店介绍")
+    private String introduction;
+	/**预订提醒*/
+	@Excel(name = "预订提醒", width = 15)
+    @ApiModelProperty(value = "预订提醒")
+    private String reserveRemind;
+	/**交通和周边*/
+	@Excel(name = "交通和周边", width = 15)
+    @ApiModelProperty(value = "交通和周边")
+    private String traffic;
+	/**门头照*/
+	@Excel(name = "门头照", width = 15)
+    @ApiModelProperty(value = "门头照")
+    private String ewmLogo;
+	/**酒店图片*/
+	@Excel(name = "酒店图片", width = 15)
+    @ApiModelProperty(value = "酒店图片")
+    private String imgs;
+	/**营业执照*/
+	@Excel(name = "营业执照", width = 15)
+    @ApiModelProperty(value = "营业执照")
+    private String yyImg;
+	/**特种行业许可证*/
+	@Excel(name = "特种行业许可证", width = 15)
+    @ApiModelProperty(value = "特种行业许可证")
+    private String tzhyImg;
+	/**企业法人*/
+	@Excel(name = "企业法人", width = 15)
+    @ApiModelProperty(value = "企业法人")
+    private String legalPerson;
+	/**经营场所*/
+	@Excel(name = "经营场所", width = 15)
+    @ApiModelProperty(value = "经营场所")
+    private String registeredAddress;
+	/**注册号*/
+	@Excel(name = "注册号", width = 15)
+    @ApiModelProperty(value = "注册号")
+    private String unifiedCode;
+	/**有效期*/
+	@Excel(name = "有效期", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "有效期")
+    private Date businessTerm;
+	/**身份证正面照*/
+	@Excel(name = "身份证正面照", width = 15)
+    @ApiModelProperty(value = "身份证正面照")
+    private String sfzImg1;
+	/**身份证反面照*/
+	@Excel(name = "身份证反面照", width = 15)
+    @ApiModelProperty(value = "身份证反面照")
+    private String sfzImg2;
+	/**身份证手持照*/
+	@Excel(name = "身份证手持照", width = 15)
+    @ApiModelProperty(value = "身份证手持照")
+    private String sfzImg3;
+	/**身份证姓名*/
+	@Excel(name = "身份证姓名", width = 15)
+    @ApiModelProperty(value = "身份证姓名")
+    private String sfzName;
+	/**身份证号*/
+	@Excel(name = "身份证号", width = 15)
+    @ApiModelProperty(value = "身份证号")
+    private String idCard;
+	/**服务商*/
+	@Excel(name = "服务商", width = 15)
+    @ApiModelProperty(value = "服务商")
+    private String sellerName;
+	/**邀请码*/
+	@Excel(name = "邀请码", width = 15)
+    @ApiModelProperty(value = "邀请码")
+    private String invitationCode;
+	/**总店*/
+	@Excel(name = "总店", width = 15)
+    @ApiModelProperty(value = "总店")
+    private String superiorSellerId;
+	/**银联支付*/
+	@Excel(name = "银联支付", width = 15)
+    @ApiModelProperty(value = "银联支付")
+    private Boolean unionpay;
+	/**到店支付*/
+	@Excel(name = "到店支付", width = 15)
+    @ApiModelProperty(value = "到店支付")
+    private Boolean ddOpen;
+	/**微信支付*/
+	@Excel(name = "微信支付", width = 15)
+    @ApiModelProperty(value = "微信支付")
+    private Boolean wxOpen;
+	/**余额支付*/
+	@Excel(name = "余额支付", width = 15)
+    @ApiModelProperty(value = "余额支付")
+    private Boolean yeOpen;
+
+    /**
+     * 状态(1启用,0不启用)
+     */
+    @Excel(name = "状态", width = 15,dicCode="hotel_status")
+    @Dict(dicCode = "hotel_status")
+    private Integer status;
+    /**备注信息*/
+    @Excel(name = "备注信息", width = 15)
+    @ApiModelProperty(value = "备注信息")
+    private String remarks;
+    /**
+     * 审核状态(0-待审核,1-审核通过,2-审核未通过)
+     */
+    @Excel(name = "状态", width = 15,dicCode="check_status")
+    @Dict(dicCode = "check_status")
+    private Integer checkStatus;
+    /**审核备注信息*/
+    @Excel(name = "审核备注信息", width = 15)
+    @ApiModelProperty(value = "审核备注信息")
+    private String checkRemarks;
+
+    /**
+     * 删除状态(0,正常,1已删除)
+     */
+    @Excel(name = "删除状态", width = 15,dicCode="del_flag")
+    @TableLogic
+    private Integer delFlag;
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新人
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 审核人
+     */
+    private String checkBy;
+
+    /**
+     * 审核时间
+     */
+    private Date checkTime;
+}

+ 17 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusHotelMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.business.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.business.entity.BusHotel;
+
+/**
+ * @Description: bus_hotel
+ * @Author: jeecg-boot
+ * @Date:   2023-02-14
+ * @Version: V1.0
+ */
+public interface BusHotelMapper extends BaseMapper<BusHotel> {
+
+}

+ 5 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BusHotelMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.demo.business.mapper.BusHotelMapper">
+
+</mapper>

+ 19 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusHotelService.java

@@ -1,4 +1,22 @@
 package org.jeecg.modules.business.service;
 
-public interface IBusHotelService {
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.business.entity.BusHotel;
+import org.jeecg.modules.system.entity.SysUser;
+
+/**
+ * @Description: bus_hotel
+ * @Author: jeecg-boot
+ * @Date:   2023-02-14
+ * @Version: V1.0
+ */
+public interface IBusHotelService extends IService<BusHotel> {
+    /**
+     * 酒店信息审核
+     *
+     * @param busHotel
+     * @return
+     */
+    public Result<?> hotelCheck(BusHotel busHotel);
 }

+ 40 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusHotelServiceImpl.java

@@ -0,0 +1,40 @@
+package org.jeecg.modules.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CacheConstant;
+import org.jeecg.common.system.util.JwtUtil;
+import org.jeecg.common.util.PasswordUtil;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.business.entity.BusHotel;
+import org.jeecg.modules.business.mapper.BusHotelMapper;
+import org.jeecg.modules.business.service.IBusHotelService;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.mapper.SysUserMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import java.util.Date;
+
+/**
+ * @Description: bus_hotel
+ * @Author: jeecg-boot
+ * @Date:   2023-02-14
+ * @Version: V1.0
+ */
+@Service
+public class BusHotelServiceImpl extends ServiceImpl<BusHotelMapper, BusHotel> implements IBusHotelService {
+    @Autowired
+    private BusHotelMapper busHotelMapper;
+
+    @Override
+    public Result<?> hotelCheck(BusHotel busHotel) {
+
+//        this.busHotelMapper.updateById(busHotel);
+        this.busHotelMapper.update(busHotel, new LambdaQueryWrapper<BusHotel>().eq(BusHotel::getId, busHotel.getId()));
+        return Result.ok("信息审核成功!");
+    }
+}

+ 137 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/util/MapUtil.java

@@ -0,0 +1,137 @@
+package org.jeecg.modules.business.util;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MapUtil {
+    public static void main(String[] args) {
+        try {
+            // 1、根据地址获取经纬度
+            Map<String, String> lonAndLat = getLonAndLat("浙江省杭州市滨江区江汉路1515号", "e5f8153683e606345c7c96cd3e16172f");
+            System.out.println("转换后经纬度为:" + lonAndLat);
+
+            // 2、根据经纬度获取地址
+            String formattedAddress = getAMapByLngAndLat("120.204798", "30.201000", "e5f8153683e606345c7c96cd3e16172f");
+            System.out.println("转换后地址为:" + formattedAddress);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 地址转换为经纬度
+     *
+     * @param address 地址
+     * @param key     高德地图应用key
+     * @return 经纬度
+     */
+    public static Map getLonAndLat(String address, String key) {
+        // 返回输入地址address的经纬度信息, 格式是 经度,纬度
+        String queryUrl = "http://restapi.amap.com/v3/geocode/geo?key=" + key + "&address=" + address;
+        // 高德接口返回的是JSON格式的字符串
+        String queryResult = getResponse(queryUrl);
+        Map<String, String> map = new HashMap<String, String>();
+        JSONObject obj = JSONObject.parseObject(queryResult);
+        if (obj.get("status").toString().equals("1")) {
+            JSONObject jobJSON = JSONObject.parseObject(obj.get("geocodes").toString().substring(1, obj.get("geocodes").toString().length() - 1));
+            String location = jobJSON.get("location").toString();
+            System.out.println("经纬度:" + location);
+            String[] lonAndLat = location.split(",");
+            if (lonAndLat != null && lonAndLat.length == 2) {
+                map.put("lng", lonAndLat[0]);
+                map.put("lat", lonAndLat[1]);
+            }
+            System.out.println(map);
+            return map;
+        } else {
+            throw new RuntimeException("地址转换经纬度失败,错误码:" + obj.get("infocode"));
+        }
+    }
+
+    /**
+     * 将经纬度getLng, getLat 通过getAMapByLngAndLat方法转换地址
+     *
+     * @param getLng 经度
+     * @param getLat 纬度
+     * @param key    高德地图应用key
+     * @return 地址名称
+     * @throws Exception
+     */
+    public static String getAMapByLngAndLat(String getLng, String getLat, String key) throws Exception {
+        String url;
+        try {
+            url = "http://restapi.amap.com/v3/geocode/regeo?output=JSON&location=" + getLng + ","
+                    + getLat + "&key=" + key + "&radius=0&extensions=base";
+            String queryResult = getResponse(url); // 高德接品返回的是JSON格式的字符串
+            // 将获取结果转为json数据
+            JSONObject obj = JSONObject.parseObject(queryResult);
+            System.out.println("obj为:" + obj);
+            if (obj.get("status").toString().equals("1")) {
+                // 如果没有返回-1
+                JSONObject regeocode = obj.getJSONObject("regeocode");
+                if (regeocode.size() > 0) {
+                    // 在regeocode中拿到 formatted_address 具体位置
+                    return regeocode.get("formatted_address").toString();
+                } else {
+                    throw new RuntimeException("未找到相匹配的地址!");
+                }
+            } else {
+                throw new RuntimeException("请求错误!");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "-1";
+    }
+
+    /**
+     * 根据两个定位点的经纬度算出两点间的距离
+     *
+     * @param startLonLat 起始经纬度
+     * @param endLonLat   结束经纬度(目标经纬度)
+     * @param key         高德地图应用key
+     * @return 两个定位点之间的距离
+     */
+    private static long getDistance(String startLonLat, String endLonLat, String key) {
+        // 返回起始地startAddr与目的地endAddr之间的距离,单位:米
+        Long result = new Long(0);
+        String queryUrl = "http://restapi.amap.com/v3/distance?key=" + key + "&origins=" + startLonLat + "&destination=" + endLonLat;
+        String queryResult = getResponse(queryUrl);
+        JSONObject obj = JSONObject.parseObject(queryResult);
+        JSONArray ja = obj.getJSONArray("results");
+        JSONObject jobO = JSONObject.parseObject(ja.getString(0));
+        result = Long.parseLong(jobO.get("distance").toString());
+        System.out.println("距离:" + result);
+        return result;
+    }
+
+    /**
+     * 发送请求
+     *
+     * @param serverUrl 请求地址
+     */
+    private static String getResponse(String serverUrl) {
+        // 用JAVA发起http请求,并返回json格式的结果
+        StringBuffer result = new StringBuffer();
+        try {
+            URL url = new URL(serverUrl);
+            URLConnection conn = url.openConnection();
+            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result.append(line);
+            }
+            in.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result.toString();
+    }
+}

+ 31 - 27
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -78,7 +78,11 @@ public class LoginController {
 	@RequestMapping(value = "/login", method = RequestMethod.POST)
 	public Result<JSONObject> login(@RequestHeader(value = "Auth") String auth, @RequestBody SysLoginModel sysLoginModel){
 		Result<JSONObject> result = new Result<JSONObject>();
-		if(auth == null || !auth.equals(TENANT_KEY) || !auth.equals(PLATFORM_KEY)) {
+//		if(auth == null || !auth.equals(TENANT_KEY) || !auth.equals(PLATFORM_KEY)) {
+//			result.error500("未知的请求来源");
+//			return result;
+//		}
+		if(!(auth != null && (auth.equals(TENANT_KEY) || auth.equals(PLATFORM_KEY)))) {
 			result.error500("未知的请求来源");
 			return result;
 		}
@@ -112,7 +116,7 @@ public class LoginController {
 			return result;
 		}
 		//update-end-author:taoyan date:20190828 for:校验验证码
-		
+
 		//1. 校验用户是否有效
 		//update-begin-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为false
 		LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
@@ -144,7 +148,7 @@ public class LoginController {
 			result.error500("用户名或密码错误");
 			return result;
 		}
-				
+
 		//用户登录信息
 		userInfo(sysUser, result);
 		//update-begin--Author:liusq  Date:20210126  for:登录成功,删除redis中的验证码
@@ -183,7 +187,7 @@ public class LoginController {
 			}
 			//update-begin---author:liusq ---date:2022-06-29  for:接口返回值修改,同步修改这里的判断逻辑-----------
 			//update-end---author:scott ---date::2022-06-20  for:vue3前端,支持自定义首页--------------
-			
+
 			obj.put("userInfo",sysUser);
 			obj.put("sysAllDictItems", sysDictService.queryAllDictItems());
 			result.setResult(obj);
@@ -192,7 +196,7 @@ public class LoginController {
 		return result;
 
 	}
-	
+
 	/**
 	 * 退出登录
 	 * @param request
@@ -226,7 +230,7 @@ public class LoginController {
 	    	return Result.error("Token无效!");
 	    }
 	}
-	
+
 	/**
 	 * 获取访问量
 	 * @return
@@ -257,7 +261,7 @@ public class LoginController {
 		result.success("登录成功");
 		return result;
 	}
-	
+
 	/**
 	 * 获取访问量
 	 * @return
@@ -278,8 +282,8 @@ public class LoginController {
 		result.setResult(oConvertUtils.toLowerCasePageList(list));
 		return result;
 	}
-	
-	
+
+
 	/**
 	 * 登陆成功选择用户当前部门
 	 * @param user
@@ -304,7 +308,7 @@ public class LoginController {
 
 	/**
 	 * 短信登录接口
-	 * 
+	 *
 	 * @param jsonObject
 	 * @return
 	 */
@@ -320,12 +324,12 @@ public class LoginController {
 			result.setSuccess(false);
 			return result;
 		}
-		
+
 		//update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
 		String redisKey = CommonConstant.PHONE_REDIS_KEY_PRE+mobile;
 		Object object = redisUtil.get(redisKey);
 		//update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
-		
+
 		if (object != null) {
 			result.setMessage("验证码10分钟内,仍然有效!");
 			result.setSuccess(false);
@@ -359,7 +363,7 @@ public class LoginController {
 					}
 					return result;
 				}
-				
+
 				/**
 				 * smsmode 短信模板方式  0 .登录模板、1.注册模板、2.忘记密码模板
 				 */
@@ -377,12 +381,12 @@ public class LoginController {
 				result.setSuccess(false);
 				return result;
 			}
-			
+
 			//update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
 			//验证码10分钟内有效
 			redisUtil.set(redisKey, captcha, 600);
 			//update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
-			
+
 			//update-begin--Author:scott  Date:20190812 for:issues#391
 			//result.setResult(captcha);
 			//update-end--Author:scott  Date:20190812 for:issues#391
@@ -395,11 +399,11 @@ public class LoginController {
 		}
 		return result;
 	}
-	
+
 
 	/**
 	 * 手机号登录接口
-	 * 
+	 *
 	 * @param jsonObject
 	 * @return
 	 */
@@ -408,14 +412,14 @@ public class LoginController {
 	public Result<JSONObject> phoneLogin(@RequestBody JSONObject jsonObject) {
 		Result<JSONObject> result = new Result<JSONObject>();
 		String phone = jsonObject.getString("mobile");
-		
+
 		//校验用户有效性
 		SysUser sysUser = sysUserService.getUserByPhone(phone);
 		result = sysUserService.checkUserIsEffective(sysUser);
 		if(!result.isSuccess()) {
 			return result;
 		}
-		
+
 		String smscode = jsonObject.getString("captcha");
 
 		//update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
@@ -527,13 +531,13 @@ public class LoginController {
 			String code = RandomUtil.randomString(BASE_CHECK_CODES,4);
 			//存到redis中
 			String lowerCaseCode = code.toLowerCase();
-			
+
 			//update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
 			// 加入密钥作为混淆,避免简单的拼接,被外部利用,用户自定义该密钥即可
 			String origin = lowerCaseCode+key+jeecgBaseConfig.getSignatureSecret();
 			String realKey = Md5Util.md5Encode(origin, "utf-8");
 			//update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
-            
+
 			redisUtil.set(realKey, lowerCaseCode, 60);
 			log.info("获取验证码,Redis key = {},checkCode = {}", realKey, code);
 			//返回前端
@@ -557,7 +561,7 @@ public class LoginController {
 		sysPermissionService.switchVue3Menu();
 		return res;
 	}
-	
+
 	/**
 	 * app登录
 	 * @param sysLoginModel
@@ -569,14 +573,14 @@ public class LoginController {
 		Result<JSONObject> result = new Result<JSONObject>();
 		String username = sysLoginModel.getUsername();
 		String password = sysLoginModel.getPassword();
-		
+
 		//1. 校验用户是否有效
 		SysUser sysUser = sysUserService.getUserByName(username);
 		result = sysUserService.checkUserIsEffective(sysUser);
 		if(!result.isSuccess()) {
 			return result;
 		}
-		
+
 		//2. 校验用户名或密码是否正确
 		String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
 		String syspassword = sysUser.getPassword();
@@ -584,7 +588,7 @@ public class LoginController {
 			result.error500("用户名或密码错误");
 			return result;
 		}
-		
+
 		String orgCode = sysUser.getOrgCode();
 		if(oConvertUtils.isEmpty(orgCode)) {
 			//如果当前用户无选择部门 查看部门关联信息
@@ -603,7 +607,7 @@ public class LoginController {
 		JSONObject obj = new JSONObject();
 		//用户登录信息
 		obj.put("userInfo", sysUser);
-		
+
 		// 生成token
 		String token = JwtUtil.sign(username, syspassword);
 		// 设置超时时间
@@ -693,4 +697,4 @@ public class LoginController {
 		return Result.OK(result);
 	}
 
-}
+}

+ 8 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysTenantService.java

@@ -21,6 +21,14 @@ public interface ISysTenantService extends IService<SysTenant> {
     List<SysTenant> queryEffectiveTenant(Collection<Integer> idList);
 
     /**
+     * 查询有效的租户
+     *
+     * @param status
+     * @return
+     */
+    List<SysTenant> queryTenantsByStatus(Integer status);
+
+    /**
      * 返回某个租户被多少个用户引用了
      *
      * @param id

+ 8 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTenantServiceImpl.java

@@ -52,6 +52,14 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
     }
 
     @Override
+    public List<SysTenant> queryTenantsByStatus(Integer status) {
+        LambdaQueryWrapper<SysTenant> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(SysTenant::getStatus, status);
+        //此处查询忽略时间条件
+        return super.list(queryWrapper);
+    }
+
+    @Override
     public Long countUserLinkTenant(String id) {
         LambdaQueryWrapper<SysUser> userQueryWrapper = new LambdaQueryWrapper<>();
         userQueryWrapper.eq(SysUser::getRelTenantIds, id);