瀏覽代碼

新增不需要验证token controller

by su 3 年之前
父節點
當前提交
625ee4160c

+ 7 - 1
fcb-project-manager-core/src/main/java/fcb/project/manager/base/service/impl/TmHouseServiceImpl.java

@@ -78,7 +78,7 @@ public class TmHouseServiceImpl extends ServiceImpl<TmHouseDao, TmHouse> impleme
     public IPage<TmHouse> getAuditHouseList(String houseTitle, Integer status, Integer type,
                                             String belongCompany, String estateName, String token,
                                             String startTime, String endTime,
-                                            Long pageNum, Long pageSize, ContextTokenBean tokenMap) {
+                                            Long pageNum, Long pageSize, ContextTokenBean tokenMap, Integer online) {
         LambdaQueryWrapper<TmHouse> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         lambdaQueryWrapper.eq(TmHouse::getIsShow, 1);
         if (StringUtils.isNotBlank(houseTitle)) {
@@ -115,6 +115,12 @@ public class TmHouseServiceImpl extends ServiceImpl<TmHouseDao, TmHouse> impleme
         if (null != type) {
             lambdaQueryWrapper.eq(TmHouse::getType, type);
         }
+
+        //判断上下线
+        if (null != online) {
+            lambdaQueryWrapper.eq(TmHouse::getOnline, online);
+        }
+
         if(StringUtils.isNotBlank(startTime)){
             lambdaQueryWrapper.ge(TmHouse::getSubmitAuditTime, startTime);
         }

+ 1 - 1
fcb-project-manager-core/src/main/java/fcb/project/manager/base/utils/DateUtil.java

@@ -405,7 +405,7 @@ public final class DateUtil {
 
 
 	/**
-	 * 获取20位随机数
+	 * 获取20位
 	 */
 	public static String randonNum() {
 

+ 3 - 1
fcb-project-manager-core/src/main/java/fcb/project/manager/core/controller/HouseManagerController.java

@@ -119,6 +119,7 @@ public class HouseManagerController extends BaseController{
             @ApiImplicitParam(name = "houseTitle", value = "房源名称", paramType = "query", required = false, dataType = "String"),
             @ApiImplicitParam(name = "status", value = "状态: 0 -> 草稿;1->待集团审核;2->已审核;-1->未通过;3->待地区审核", paramType = "query", required = false, dataType = "Integer"),
             @ApiImplicitParam(name = "type", value = "房源类型: 1->新房,2->二手房", paramType = "query", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "online", value = "是否上线:1->上线;-0->下线", paramType = "query", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "belongCompany", value = "所属公司ID", paramType = "query", required = true, dataType = "String"),
             @ApiImplicitParam(name = "estateName", value = "楼盘名称", paramType = "query", required = true, dataType = "String"),
             @ApiImplicitParam(name = "startTime", value = "审核开始时间(00:00:00)", paramType = "query", required = true, dataType = "String"),
@@ -131,6 +132,7 @@ public class HouseManagerController extends BaseController{
                                        @RequestParam(required = false , name = "type") Integer type,
                                        @RequestParam(name = "belongCompany") String belongCompany,
                                        @RequestParam(name = "estateName") String estateName,
+                                            @RequestParam(name = "online") Integer online,
                                             @RequestParam(name = "startTime") String startTime,
                                             @RequestParam(name = "endTime") String endTime,
                                        @RequestParam(name = "pageNum")Long pageNum,
@@ -138,7 +140,7 @@ public class HouseManagerController extends BaseController{
         ContextTokenBean tokenMap = getContextUserInfo();
 
         IPage<TmHouse> resultPage = tmHouseService.getAuditHouseList(houseTitle , status ,
-                type , belongCompany , estateName , getToken() , startTime, endTime,  pageNum , pageSize, tokenMap);
+                type , belongCompany , estateName , getToken() , startTime, endTime,  pageNum , pageSize, tokenMap, online);
         return  Result.success(DataUtils.assembleResult(resultPage.getTotal(), resultPage.getPages(),
                 resultPage.getCurrent(), resultPage.getRecords()));
     }

+ 1 - 1
fcb-project-manager-core/src/main/java/fcb/project/manager/core/controller/TmRedirectController.java

@@ -25,7 +25,7 @@ import java.util.Map;
 @Api(tags = "二手房小区相关接口")
 @RestController
 @Log4j2
-@RequestMapping("fcb/project/redirct")
+@RequestMapping("/fcb/project/redirct")
 public class TmRedirectController extends BaseController{
 
     @Value("${fcb.agentsaas}")

+ 129 - 0
fcb-project-manager-core/src/main/java/fcb/project/manager/core/controller/TmRedirectWebController.java

@@ -0,0 +1,129 @@
+package fcb.project.manager.core.controller;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import fcb.project.manager.base.entity.ContextTokenBean;
+import fcb.project.manager.base.utils.DateUtil;
+import fdage.back.sdk.utils.HttpClientUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Api(tags = "二手房小区相关接口")
+@RestController
+@Log4j2
+@RequestMapping("/fcb/project/redirctweb")
+public class TmRedirectWebController extends BaseController{
+
+    @Value("${fcb.agentsaas}")
+    private String fcbagentsaas;
+
+    @PostMapping("/{name}")
+    @ApiOperation(value = "二手房小区接口转发")
+    public Object addNewHouse(@PathVariable String name, @RequestBody JSONObject object){
+        Instant stepTwoStart = Instant.now();
+        String str = "";
+        try {
+            ContextTokenBean tokenMap = getContextUserInfo();
+            log.info("二手房接口转发 : " + name);
+
+            String timestamp = String.valueOf(new Date().getTime());
+            String apiNumber = name;
+            String nonce = DateUtil.randonNum(5);
+            String secret = "fcb2021";
+
+            if(object.containsKey("companyName")){
+                if(StringUtils.isNotEmpty(tokenMap.getDepartmentName())){
+                    object.put("companyName",tokenMap.getDepartmentName());
+                }else{
+                    object.put("companyName","");
+                }
+            }
+
+            if(object.containsKey("operatorCompanyId")){
+                if(StringUtils.isNotEmpty(tokenMap.getDepartmentId())){
+                    object.put("operatorCompanyId",tokenMap.getDepartmentId());
+                }else{
+                    object.put("operatorCompanyId","");
+                }
+            }
+
+            if(object.containsKey("operatorCompanyName")){
+                if(StringUtils.isNotEmpty(tokenMap.getDepartmentName())){
+                    object.put("operatorCompanyName",tokenMap.getDepartmentName());
+                }else{
+                    object.put("operatorCompanyName","");
+                }
+            }
+
+            String params = object.toJSONString();
+            String[] strary = new String[]{secret,timestamp,nonce,params,apiNumber};
+            Arrays.sort(strary);
+
+            String strs = "";
+            for(int i=0;i<strary.length;i++){
+                strs += strary[i];
+            }
+
+            String signature = DigestUtils.shaHex(strs);
+            log.info("url   : " + fcbagentsaas);
+
+            Map mm = new HashMap();
+            mm.put("apiNumber", apiNumber);
+            mm.put("nonce", nonce);
+            mm.put("secret", secret);
+            mm.put("params", params);
+            mm.put("timestamp", timestamp);
+            mm.put("signature", signature);
+
+            String param = JSON.toJSONString(mm);
+            log.info("====================参数:{}===================" , param);
+
+            str = HttpClientUtil.doPostJson(fcbagentsaas, param);
+
+            if(StringUtils.isNotEmpty(str)){
+                JSONObject responsemsg = JSONObject.parseObject(str);
+
+
+                return responsemsg;
+            }else{
+                JSONObject responsemsg = new JSONObject();
+                responsemsg.put("resultType",99);
+                responsemsg.put("resultMsg","接口请求失败,未获取到数据");
+                responsemsg.put("resultData",str);
+                return responsemsg;
+            }
+        }catch (Exception e){
+
+            e.printStackTrace();
+            JSONObject responsemsg = new JSONObject();
+            responsemsg.put("resultType",99);
+            responsemsg.put("resultMsg","系统繁忙");
+            responsemsg.put("resultData",str);
+            return responsemsg;
+
+        }finally {
+
+            Instant stepTwoEnd = Instant.now();
+            long stepTwoDuration = Duration.between(stepTwoStart , stepTwoEnd).toMillis();
+
+            log.info("====================二手房接口转发完成:{}===================" , stepTwoDuration);
+            log.info("二手房接口转发完成 : " + str);
+
+        }
+    }
+
+
+}