jiazx0107@163.com
2023-12-24 8efb5a8cd2c8a6b40e58f4f3fb851d54cf415af9
src/main/java/com/fzzy/web/TestController.java
@@ -1,13 +1,14 @@
package com.fzzy.web;
import com.alibaba.fastjson2.JSONObject;
import com.bstek.dorado.util.DateUtils;
import com.fzzy.api.data.ApiParam;
import com.fzzy.async.fzzy30.Fzzy30SyncService12;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
/**
 * @author vince.xu
@@ -22,23 +23,89 @@
public class TestController {
    @Autowired
    private Fzzy30SyncService12 fzzySyncService12;
    /**
     *
     */
    @RequestMapping(value = "test", method = RequestMethod.GET)
    public String  test(@RequestParam(name = "kqdm")String kqdm, @RequestParam(name = "deptId")String deptId, @RequestParam(name = "start")String start,@RequestParam(name = "end") String end) {
    public String test(@RequestParam(name = "kqdm") String kqdm, @RequestParam(name = "deptId") String deptId, @RequestParam(name = "start") String start, @RequestParam(name = "end") String end) {
        try {
            ApiParam apiParam = new ApiParam();
            apiParam.setKqdm(kqdm);
            apiParam.setDeptId(deptId);
            apiParam.setStart(DateUtils.parse("yyyy-MM-dd HH:mm:ss",start));
            apiParam.setEnd(DateUtils.parse("yyyy-MM-dd HH:mm:ss",end));
            apiParam.setStart(DateUtils.parse("yyyy-MM-dd HH:mm:ss", start));
            apiParam.setEnd(DateUtils.parse("yyyy-MM-dd HH:mm:ss", end));
            fzzySyncService12.syncData(apiParam);
        } catch (Exception e) {
            log.error(e.getMessage(),e);
            log.error(e.getMessage(), e);
            e.printStackTrace();
        }
        return "";
    }
    /**
     * 测试读取身份证
     *
     * @return
     */
    @RequestMapping("/test/IDCARD")
    public @ResponseBody
    JSONObject testIdCard(@RequestParam(value = "callback", required = false) String callback,
                          @RequestParam(value = "waitTime", required = false) int waitTime) {
        log.debug("============testIdCard==========={}", callback);
        JSONObject json = new JSONObject();
        json.put("cnName", "风正致远");
        json.put("idNum", "100000000000000001");
        json.put("address", "郑州市高新区国家大学科技园1号楼502");
        //   return "fnCallback" + "(" + json.toJSONString() + ")";
        return json;
    }
    /**
     * 测试读取身份证
     * JSONP测试
     *
     * @return
     */
    @RequestMapping("/test/IDCARD2")
    public @ResponseBody
    String testIdCard2(@RequestParam(value = "callback") String callback) {
        log.debug("============testIdCard==========={}", callback);
        JSONObject json = new JSONObject();
        JSONObject result = new JSONObject();
        result.put("idCardName", "TEST");
        result.put("idCardNo", "100000000000000001");
        result.put("idCardAddress", "郑州市高新区国家大学科技园1号楼502");
        json.put("properties", result);
        json.put("message", "成功");
        json.put("status", 0);
        json.put("code", 200);
        json.put("timestamp", System.currentTimeMillis());
        return callback + "(" + json + ")";
    }
    @RequestMapping("/test/http")
    public ModelAndView testHttp() {
        ModelAndView view = new ModelAndView();
        view.setViewName("test/demo");
        return view;
    }
}