Browse Source

【思拓微】【OA对接】

wub 11 months ago
parent
commit
08a6f3b8ab
32 changed files with 1112 additions and 1217 deletions
  1. 2 2
      src/main/java/com/uas/eis/UasEisApplication.java
  2. 126 12
      src/main/java/com/uas/eis/beans/result/Result.java
  3. 53 0
      src/main/java/com/uas/eis/controller/LoginWorldController.java
  4. 14 424
      src/main/java/com/uas/eis/controller/STKController.java
  5. 39 0
      src/main/java/com/uas/eis/convertor/BomConvertor.java
  6. 36 0
      src/main/java/com/uas/eis/convertor/BomDetailConvertor.java
  7. 68 0
      src/main/java/com/uas/eis/convertor/ProductConvertor.java
  8. 9 1
      src/main/java/com/uas/eis/core/WebAppConfig.java
  9. 86 0
      src/main/java/com/uas/eis/core/support/InterceptorConfig.java
  10. 22 0
      src/main/java/com/uas/eis/exception/BaseExceptionCode.java
  11. 41 0
      src/main/java/com/uas/eis/sdk/dto/BomDTO.java
  12. 31 0
      src/main/java/com/uas/eis/sdk/dto/BomDetailDTO.java
  13. 14 0
      src/main/java/com/uas/eis/sdk/dto/BomReq.java
  14. 57 0
      src/main/java/com/uas/eis/sdk/dto/ProductDTO.java
  15. 25 0
      src/main/java/com/uas/eis/sdk/dto/ProductPageDTO.java
  16. 14 0
      src/main/java/com/uas/eis/sdk/dto/ProductReq.java
  17. 16 0
      src/main/java/com/uas/eis/sdk/dto/UserReq.java
  18. 20 0
      src/main/java/com/uas/eis/sdk/resp/BomDetailResp.java
  19. 11 0
      src/main/java/com/uas/eis/sdk/resp/BomReadResp.java
  20. 30 0
      src/main/java/com/uas/eis/sdk/resp/BomResp.java
  21. 46 0
      src/main/java/com/uas/eis/sdk/resp/ProdcutResp.java
  22. 39 391
      src/main/java/com/uas/eis/service/Impl/STKServiceImpl.java
  23. 67 0
      src/main/java/com/uas/eis/service/Impl/UserServiceImpl.java
  24. 5 64
      src/main/java/com/uas/eis/service/STKService.java
  25. 15 0
      src/main/java/com/uas/eis/service/UserService.java
  26. 0 303
      src/main/java/com/uas/eis/task/STKTask.java
  27. 207 0
      src/main/java/com/uas/eis/utils/BeanMapper.java
  28. 10 11
      src/main/java/com/uas/eis/utils/HttpTookit.java
  29. 3 3
      src/main/java/com/uas/eis/utils/OpenAPIUtils.java
  30. 1 1
      src/main/resources/api_sign_key_mapping.properties
  31. 2 2
      src/main/resources/application-dev.yml
  32. 3 3
      src/main/resources/application-prod.yml

+ 2 - 2
src/main/java/com/uas/eis/UasEisApplication.java

@@ -16,8 +16,8 @@ import com.uas.eis.core.support.TokenPropertiesListener;
 public class UasEisApplication {
 	public static void main(String[] args) {
 		SpringApplication application = new SpringApplication(UasEisApplication.class);
-		//application.addListeners(new TokenPropertiesListener("token.properties"));
-		application.addListeners(new TokenPropertiesListener("api_sign_key_mapping.properties"));
+		application.addListeners(new TokenPropertiesListener("token.properties"));
+		//application.addListeners(new TokenPropertiesListener("api_sign_key_mapping.properties"));
 		application.run(args);
 	}
 	

+ 126 - 12
src/main/java/com/uas/eis/beans/result/Result.java

@@ -1,31 +1,56 @@
 package com.uas.eis.beans.result;
 
+import com.uas.eis.exception.BaseException;
+import com.uas.eis.exception.BaseExceptionCode;
+
 import java.io.Serializable;
 
+/**
+ * 结果
+ *
+ * @author
+ * @date 2018/9/29
+ */
 public class Result<T> implements Serializable {
+    /**
+     * 是否成功
+     */
+    private boolean success;
+    /**
+     * 错误码
+     */
+    private int code;
+    /**
+     * 错误消息
+     */
+    private String message;
+    /**
+     * 结果
+     */
+    private T data;
 
-    private static final long serialVersionUID = 5753982789557686887L;
-
-    private Integer code = 0;
-
-    private String msg = "成功";
+    public boolean isSuccess() {
+        return success;
+    }
 
-    private T data;
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
 
-    public Integer getCode() {
+    public int getCode() {
         return code;
     }
 
-    public void setCode(Integer code) {
+    public void setCode(int code) {
         this.code = code;
     }
 
-    public String getMsg() {
-        return msg;
+    public String getMessage() {
+        return message;
     }
 
-    public void setMsg(String msg) {
-        this.msg = msg;
+    public void setMessage(String message) {
+        this.message = message;
     }
 
     public T getData() {
@@ -36,4 +61,93 @@ public class Result<T> implements Serializable {
         this.data = data;
     }
 
+    public static Result success() {
+        Result result = new Result();
+        result.setSuccess(true);
+        return result;
+    }
+
+    public static <T> Result<T> success(T data) {
+        Result<T> result = success();
+        result.setData(data);
+        return result;
+    }
+
+    public static Result error() {
+        Result result = new Result();
+        result.setSuccess(false);
+        return result;
+    }
+
+    public static <T> Result<T> error(T data) {
+        Result<T> result = error();
+        result.setData(data);
+        return result;
+    }
+
+    public static Result error(String message) {
+        Result result = error();
+        result.setMessage(message);
+        return result;
+    }
+
+    public static Result error(Result from) {
+        Result result = error();
+        result.setCode(from.getCode());
+        result.setMessage(from.getMessage());
+        return result;
+    }
+
+    public static Result error(int code, String message) {
+        Result result = error();
+        result.setCode(code);
+        result.setMessage(message);
+        return result;
+    }
+
+    public static Result error(int code, String message, Object... args) {
+        Result result = error();
+        result.setCode(code);
+        result.setMessage(String.format(message, args));
+        return result;
+    }
+
+    public static Result throwable(Throwable e) {
+        Result result = error();
+        if (e instanceof BaseException) {
+            return error((BaseException) e);
+        }
+        result.setCode(500);
+        result.setMessage(e.getMessage());
+        return result;
+    }
+
+    public static Result error(BaseException e) {
+        Result result = error();
+        result.setCode(e.getCode());
+        result.setMessage(e.getMessage());
+        return result;
+    }
+
+    public static Result error(BaseException e, Object data) {
+        Result result = error();
+        result.setCode(e.getCode());
+        result.setMessage(e.getMessage());
+        result.setData(data);
+        return result;
+    }
+
+    public static Result error(BaseExceptionCode e) {
+        Result result = error();
+        result.setCode(e.getCode());
+        result.setMessage(e.getMessage());
+        return result;
+    }
+
+    public static Result error(BaseExceptionCode e, Object... args) {
+        Result result = error();
+        result.setCode(e.getCode());
+        result.setMessage(String.format(e.getMessage(), args));
+        return result;
+    }
 }

+ 53 - 0
src/main/java/com/uas/eis/controller/LoginWorldController.java

@@ -0,0 +1,53 @@
+package com.uas.eis.controller;
+
+import com.uas.eis.beans.result.Result;
+import com.uas.eis.core.support.TokenHandler;
+import com.uas.eis.core.support.TokenProperties;
+import com.uas.eis.sdk.dto.UserReq;
+import com.uas.eis.service.UserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+public class LoginWorldController {
+
+    @Autowired
+    private UserService userService;
+    private static Map<String,String> tokenConfig = TokenProperties.getAllProperty();
+    private static String base64Security = tokenConfig.get("SECURITY_KEY");
+
+
+    @RequestMapping("/login")
+    public Result login(@RequestBody UserReq userReq){
+        Map<String, String> map = new HashMap();
+        String username = userReq.getUsername();
+        String password = userReq.getPassword();
+
+        String token = "";
+        if(username.equalsIgnoreCase("admin") && password.equalsIgnoreCase("123456")){
+            // 根据用户名和密码生成Token
+            Map<String, Object> userInfo = new HashMap<>();
+            userInfo.put("username", username);
+            userInfo.put("password", password);
+            token = TokenHandler.createToken(username,password);
+        }else{
+            return Result.error("用户名和密码不正确");
+        }
+        map.put("code", "200");
+        // 返回json数据
+        map.put("token", token);
+        map.put("msg", "请求成功");
+        map.put("expiresIn", tokenConfig.get("KEEP"));
+//        AppTokenResult appTokenResult = new AppTokenResult();
+//        appTokenResult.setAppAccessToken(token);
+//        appTokenResult.setExpiresIn(Long.parseLong(tokenConfig.get("KEEP")));
+//        appTokenResult.setErrorCode(200);
+//        appTokenResult.setErrorMessage(null);
+        return Result.success(map);
+    }
+}

+ 14 - 424
src/main/java/com/uas/eis/controller/STKController.java

@@ -1,40 +1,20 @@
 package com.uas.eis.controller;
 
-import cn.hutool.http.HttpRequest;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.uas.eis.dto.stksto.QueryAccountantProjectDto;
-import com.uas.eis.dto.stksto.QueryCashFlowItemsDto;
-import com.uas.eis.dto.stksto.QueryTravellingMerchantDto;
-import com.uas.eis.dto.stksto.StkCommonDto;
-import com.uas.eis.sdk.dto.*;
-import com.uas.eis.sdk.entity.ApiResult;
-import com.uas.eis.sdk.resp.ApiResponse;
-import com.uas.eis.service.RequestSTKService;
+import com.uas.eis.beans.result.Result;
+import com.uas.eis.sdk.dto.BomReq;
+import com.uas.eis.sdk.dto.ProductReq;
 import com.uas.eis.service.STKService;
-import com.uas.eis.utils.HuToolUtils;
-import com.uas.eis.utils.MD5Util;
-import com.uas.eis.utils.STKSignUtil;
-import com.uas.eis.vo.stkVo.AccountantProjectVo;
-import com.uas.eis.vo.stkVo.CashFlowItemsVo;
-import com.uas.eis.vo.stkVo.HttpResultResponse;
-import com.uas.eis.vo.stkVo.TravellingMerchantVo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.TemporalAdjusters;
-import java.util.*;
 
 
 /**
- * @author zhuxl
+ * @author
  * @date 2024-10-12
  */
 @Slf4j
@@ -43,406 +23,16 @@ public class STKController {
     @Autowired
     private STKService stkService;
 
-    @Autowired
-    private RequestSTKService requestSTKService;
-
-    /**
-     * 获取科目余额表-总条数
-     */
-    @PostMapping("/api/getAssistBalanceCount")
-    public ApiResult<String> getAssistBalanceCount(HttpServletRequest request, @RequestBody AssistBalanceDTO dto){
-        return stkService.getAssistBalanceCount(request, dto);
-    }
-
-    /**
-     * 获取科目余额表
-     */
-    @RequestMapping(value="/api/getAssistBalance",method=RequestMethod.POST)
-    @ResponseBody
-    public ApiResult<String> getAssistBalance(HttpServletRequest request, @RequestBody AssistBalanceDTO dto){
-        return stkService.getAssistBalance(request, dto);
-    }
-
-
-
-
-    /**
-     * 现金流量表-总条数
-     */
-    @RequestMapping(value="/api/getCashFlowCount",method=RequestMethod.POST)
-    @ResponseBody
-    public ApiResult<String> getCashFlowCount(HttpServletRequest request, @RequestBody AssistBalanceDTO dto){
-        return stkService.getCashFlowCount(request, dto);
-    }
-
-    /**
-     * 现金流量表
-     */
-    @RequestMapping(value="/api/getCashFlow",method=RequestMethod.POST)
-    @ResponseBody
-    public ApiResult<String> getCashFlow(HttpServletRequest request, @RequestBody AssistBalanceDTO dto){
-        return stkService.getCashFlow(request, dto);
-    }
-
-
-
-
     /**
-     * 新增修改客商信息
+     *
      */
-    @PostMapping(value="/erp/updateCustVend")
-    public ApiResult<String> updateCustVend(@RequestBody UpdateCustVendDTO dto){
-        return stkService.updateCustVend( dto);
-    }
-
-    /***
-     * 新增修改客商2
-     * */
-    /*@PostMapping(value="/erp/updateCustVend")
-    public ApiResult updateCustVend(@RequestBody UpdateCustVendDTO dto){
-        Integer page  = 1;
-        Integer size = 500;
-        String result = null;
-        try {
-            HttpResultResponse resultResponse = requestSTKService.updateKSPostParam(page,size,dto);
-            log.info("修改客商返回信息:{}",JSONObject.toJSONString(resultResponse));
-            result = resultResponse.getBody();
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.info("新增修改客商信息异常!");
-        }
-        return new ApiResult();
-    }*/
-
-
-
-    /**
-     * 接口测试
-     * */
-    @PostMapping("/api/getAssistBalanceCountTest")
-    public ApiResult<String> getAssistBalanceCountTest(HttpServletRequest request, @RequestBody AssistBalanceDTO dto){
-        return stkService.getAssistBalanceCountTest(request, dto);
-    }
-
-    /**
-     * 加密生成
-     * */
-    @GetMapping("/erp/md5Test")
-    public Md5TestVo md5Test(){
-        Long timestamp = System.currentTimeMillis();
-        String requestId = UUID.randomUUID().toString();
-        String accessSecret = "SISEMI";
-        String accessKey = "SISEMI";
-        Map<String, Object> params = new HashMap<String, Object>();
-        params.put("AccessKey",accessKey);
-        params.put("RequestId",requestId);
-        params.put("Timestamp",timestamp);
-        Set<String> keysSet = params.keySet();
-        Object[] keys = keysSet.toArray();
-        Arrays.sort(keys);
-        StringBuilder temp = new StringBuilder();
-        boolean first = true;
-        for (Object key : keys) {
-            if (first) {
-                first = false;
-            } else {
-                temp.append("&");
-            }
-            temp.append(key).append("=");
-            Object value = params.get(key);
-            String valueString = "";
-            if (null != value) {
-                valueString = String.valueOf(value);
-            }
-            temp.append(valueString);
-        }
-        temp.append("&").append("AccessSecret").append("=").append(accessSecret);
-        Md5TestVo vo = new Md5TestVo();
-        vo.setAccessKey(accessKey);
-        vo.setRequestId(requestId);
-        vo.setTimestamp(timestamp);
-        vo.setSignature(MD5Util.encrypt32Up(temp.toString()));
-        return vo;
-    }
-
-
-    /**
-     * 模拟客商数据信息
-     * */
-    @PostMapping("/queryTestList")
-    public List<CustvendDTO> queryTestList(@RequestBody QueryTravellingMerchantDto dto){
-        log.info("请求参数:{}", JSONObject.toJSONString(dto));
-        return requestSTKService.queryList();
-    }
-
-    /**
-     * 获取客商信息接口编码
-     * */
-    @Value("${STK.get_travelling_merchant}")
-    private String GET_TRAVELLING_MERCHANT;
-
-
-    @GetMapping("/queryListTest")
-    public TravellingMerchantVo queryListTest(){
-        QueryTravellingMerchantDto dto = new QueryTravellingMerchantDto();
-        dto.setCode(GET_TRAVELLING_MERCHANT);
-        return requestSTKService.selectTravellingMerchantList(dto,"http://192.168.1.104:8186/eis_cw/queryTestList");
-    }
-
-    @GetMapping("apiPost2")
-    public String apiPost() throws Exception {
-
-        //应用id
-        String appid = "bf00be8b_0387_44f4_b073_50c3c2d6";
-
-        //应用key
-        String appkey = "eb1b6053bdda437c98a93d93013d9fae";
-
-        //接口代码 每个接口的接口代码都不同
-        String apiCode = "vhtITAFq";
-
-        //时间戳
-        String timestamp = Long.toString(System.currentTimeMillis());
-
-        //加签方法的重要参数
-        //若该接口需要传入一些参数  如:name、age等等
-        //则直接在这个位置put即可
-        JSONObject request=new JSONObject(4);
-        request.put("code",apiCode);
-        request.put("s_orgcode","5418");//119030009
-        //request.put("start_time","2022-11-02 09:38:23");
-        //request.put("end_time","2025-01-06 22:04:47");
-        //request.put("jslx","合并口径");
-        //request.put("dwmc","担保集团");
-        request.put("page","1");
-        request.put("size","10");
-
-
-        String content = request.toString();
-
-        //加签方法第一个参数
-        StringBuilder signBuilder = new StringBuilder("appid").append("=").append(appid).append("&")
-                .append(content).append("&")
-                .append("timestamp").append("=").append(timestamp).append("&")
-                .append("key").append("=").append(appkey);
-
-
-
-
-        //加签
-        String sign = STKSignUtil.HMACSHA256(signBuilder.toString(),appkey);
-
-        System.out.println("原始:"+signBuilder);
-        System.out.println("签名:"+sign);
-        System.out.println("content:"+content);
-
-        //请求数据 (接口地址根据测试环境与正式环境变更)
-        String body = HttpRequest.post("http://192.168.2.179/api/oapigw/api/oapisvc/api/v2/search")
-                .header("appid",appid)  //请求头
-                .header("timestamp", timestamp)
-                .header("sign", sign)
-                .header("Content-Type", "application/json")
-                .body(content)  //请求参数
-                .timeout(20000)  //超时时间
-                .execute().body();
-
-        //JSONObject jsonObject = JSON.parseObject(body);
-
-        //JSONObject dataObject = jsonObject.getJSONObject("data");
-
-        //JSONArray listArray = dataObject.getJSONArray("list");
-
-        System.out.println("返回结果:"+body);
-
-        //System.out.println("返回结果:"+listArray.size());
-        return (body);  //返回结果
-    }
-
-    //现金流测试
-    @GetMapping("apiPostxjl")
-    public String apiPostxjl() throws Exception {
-        //应用id
-        String appid = "bf00be8b_0387_44f4_b073_50c3c2d6";
-
-        //应用key
-        String appkey = "eb1b6053bdda437c98a93d93013d9fae";
-
-        //接口代码 每个接口的接口代码都不同
-        String apiCode = "89edb885a8cf4412b870233fc89fb381";
-
-        //时间戳
-        String timestamp = Long.toString(System.currentTimeMillis());
-
-        //分页内容 自行调整
-        String page = "1";
-        String pageSize = "500";
-
-        //支持  时间字段_start  时间字段_end  的传值  例:UPDATE_TIME
-        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        LocalDateTime begin = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).with(TemporalAdjusters.firstDayOfYear());
-        LocalDateTime end = LocalDateTime.now();
-
-        //加签方法的重要参数
-        JSONObject request=new JSONObject(4);
-        //request.put("code","MJ3ahZ9f");
-        request.put("page",page);
-        request.put("size",pageSize);
-
-        //传入参数  此处案例仅放置了时间,可自行添加
-        JSONObject param=new JSONObject();
-        //param.put("UPDATE_TIME_start","2024-05-09 14:24:06");
-        //param.put("UPDATE_TIME_end","2024-05-09 15:01:28");
-        //param.put("TASKNO","P2022032200000041");
-        //param.put("TASKCODE","202409");
-
-
-        request.put("param",param);
-
-        String content = request.toString();
-
-        //加签方法第一个参数
-        StringBuilder signBuilder = new StringBuilder("appid").append("=").append(appid).append("&")
-                .append(content).append("&")
-                .append("timestamp").append("=").append(timestamp).append("&")
-                .append("key").append("=").append(appkey);
-
-        //加签
-        String sign = STKSignUtil.HMACSHA256(signBuilder.toString(),appkey);
-
-        System.out.println("原始:"+signBuilder);
-        log.info("STK,原始签名:"+signBuilder.toString());
-        System.out.println("签名:"+sign);
-        log.info("STK,加密签名:"+sign);
-        System.out.println("content:"+content);
-
-
-        //请求数据 (接口地址根据测试环境与正式环境变更)
-        /*String body = HttpRequest.post("https://192.168.2.179/api/oapigw/api/oapisvc/automicApi/"+apiCode)
-                .header("appid",appid)  //请求头
-                .header("timestamp", timestamp)
-                .header("sign", sign)
-                .header("Content-Type", "application/json")
-                .body(content)  //请求参数
-                .timeout(20000)  //超时时间
-                .execute().body();
-                )
-                */
-
-        Map<String,String> header = new HashMap<>();
-        header.put("appid",appid);
-        header.put("timestamp", timestamp);
-        header.put("sign", sign);
-        header.put("Content-Type", "application/json");
-        HttpResultResponse resultResponse = HuToolUtils.post("https://192.168.2.179/api/oapigw/api/oapisvc/automicApi/"+apiCode,request, header);
-
-        log.info("示例返回:{}",JSONObject.toJSONString(resultResponse));
-        // System.out.println("返回结果:"+body);
-        //System.out.println(body);
-        return (resultResponse.getBody());  //返回结果
-    }
-
-
-    //科目测试
-    @GetMapping("apiPostkm")
-    public String apiPostkm() throws Exception {
-        //应用id
-        String appid = "bf00be8b_0387_44f4_b073_50c3c2d6";
-
-        //应用key
-        String appkey = "eb1b6053bdda437c98a93d93013d9fae";
-
-        //接口代码 每个接口的接口代码都不同
-        String apiCode = "11e72229359a4fdeb038dd6713dc9330";
-
-        //时间戳
-        String timestamp = Long.toString(System.currentTimeMillis());
-
-        //分页内容 自行调整
-        String page = "1";
-        String pageSize = "500";
-
-        //支持  时间字段_start  时间字段_end  的传值  例:UPDATE_TIME
-        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        LocalDateTime begin = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).with(TemporalAdjusters.firstDayOfYear());
-        LocalDateTime end = LocalDateTime.now();
-
-        //加签方法的重要参数
-        JSONObject request=new JSONObject(4);
-        //request.put("code","MJ3ahZ9f");
-        request.put("page",page);
-        request.put("size",pageSize);
-
-        //传入参数  此处案例仅放置了时间,可自行添加
-        JSONObject param=new JSONObject();
-        //param.put("UPDATE_TIME_start","2024-05-09 14:24:06");
-        //param.put("UPDATE_TIME_end","2024-05-09 15:01:28");
-        //param.put("TASKNO","P2022032200000041");
-        //param.put("TASKCODE","202409");
-
-
-        request.put("param",param);
-
-        String content = request.toString();
-
-        //加签方法第一个参数
-        StringBuilder signBuilder = new StringBuilder("appid").append("=").append(appid).append("&")
-                .append(content).append("&")
-                .append("timestamp").append("=").append(timestamp).append("&")
-                .append("key").append("=").append(appkey);
-
-        //加签
-        String sign = STKSignUtil.HMACSHA256(signBuilder.toString(),appkey);
-
-        System.out.println("原始:"+signBuilder);
-        System.out.println("签名:"+sign);
-        System.out.println("content:"+content);
-
-
-        //请求数据 (接口地址根据测试环境与正式环境变更)
-        String body = HttpRequest.post("https://192.168.2.179/api/oapigw/api/oapisvc/automicApi/"+apiCode)
-                .header("appid",appid)  //请求头
-                .header("timestamp", timestamp)
-                .header("sign", sign)
-                .header("Content-Type", "application/json")
-                .body(content)  //请求参数
-                .timeout(20000)  //超时时间
-                .execute().body();
-
-        // System.out.println("返回结果:"+body);
-        System.out.println(body);
-        return (body);  //返回结果
-    }
-
-
-
-
-    //现金流测试
-    @GetMapping("apiPostxjl2")
-    public CashFlowItemsVo apiPostxjl2() throws Exception {
-        StkCommonDto dto = new StkCommonDto();
-        int pageXjl = 1;
-        dto.setPage(String.valueOf(pageXjl));
-        dto.setSize("500");
-        QueryCashFlowItemsDto dtoParam = new QueryCashFlowItemsDto();
-        HttpResultResponse cashFlowItemsVo = requestSTKService.buildPostParam(1,500,dtoParam);
-        return JSONObject.parseObject(cashFlowItemsVo.getBody(),CashFlowItemsVo.class);
+    @GetMapping("/api/getProduct")
+    public Result getProduct(HttpServletRequest request, @RequestBody ProductReq productReq){
+        return stkService.getProduct(request, productReq);
     }
 
-
-
-
-    //会计科目测试
-    @GetMapping("apiPostkm2")
-    public AccountantProjectVo apiPostkm2() throws Exception {
-        QueryAccountantProjectDto dto = new QueryAccountantProjectDto();
-        int pageKm = 1;
-        dto.setPage(pageKm);
-        dto.setSize(500);
-        AccountantProjectVo accountantProjectVo = new AccountantProjectVo();
-        accountantProjectVo = requestSTKService.getAccountantProject(dto);
-        return accountantProjectVo;
+    @GetMapping("/api/getBom")
+    public Result getBom(HttpServletRequest request, @RequestBody BomReq bomReq){
+        return stkService.getBom(bomReq);
     }
-
-
-
 }

+ 39 - 0
src/main/java/com/uas/eis/convertor/BomConvertor.java

@@ -0,0 +1,39 @@
+package com.uas.eis.convertor;
+
+import com.uas.eis.sdk.dto.BomDTO;
+import com.uas.eis.sdk.resp.BomResp;
+
+import java.util.List;
+
+public class BomConvertor {
+
+    public static BomResp toBomRespListByBomDTOs(List<BomDTO> bomDTOList) {
+        BomDTO bomDTO = bomDTOList.get(0);
+        return toBomResp(bomDTO);
+    }
+
+    public static BomResp toBomResp(BomDTO bomDTO) {
+        BomResp bomResp = new BomResp();
+        bomResp.setBo_id(bomDTO.getBo_id());
+        bomResp.setBo_version(bomDTO.getBo_version());
+        bomResp.setBo_status(bomDTO.getBo_status());
+        bomResp.setBo_level(bomDTO.getBo_level());
+        bomResp.setBo_mothercode(bomDTO.getBo_mothercode());
+        bomResp.setBo_remark(bomDTO.getBo_remark());
+        bomResp.setBo_wcname(bomDTO.getBo_wcname());
+        bomResp.setBo_ispast(bomDTO.getBo_ispast());
+        bomResp.setBo_cop(bomDTO.getBo_cop());
+        bomResp.setBo_recorder(bomDTO.getBo_recorder());
+        bomResp.setBo_date(bomDTO.getBo_date());
+        bomResp.setBo_auditman(bomDTO.getBo_auditman());
+        bomResp.setBo_auditdate(bomDTO.getBo_auditdate());
+        bomResp.setBo_isextend(bomDTO.getBo_isextend());
+        bomResp.setBo_refbomid(bomDTO.getBo_refbomid());
+        bomResp.setBo_refcode(bomDTO.getBo_refcode());
+        bomResp.setBo_refname(bomDTO.getBo_refname());
+        bomResp.setBo_refspec(bomDTO.getBo_refspec());
+        bomResp.setBo_style(bomDTO.getBo_style());
+        bomResp.setBo_flowstyle(bomDTO.getBo_flowstyle());
+        return bomResp;
+    }
+}

+ 36 - 0
src/main/java/com/uas/eis/convertor/BomDetailConvertor.java

@@ -0,0 +1,36 @@
+package com.uas.eis.convertor;
+
+import com.uas.eis.sdk.dto.BomDetailDTO;
+import com.uas.eis.sdk.resp.BomDetailResp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BomDetailConvertor {
+
+    public static List<BomDetailResp> toBomDetailRespListByBomDetailDTOs(List<BomDetailDTO> bomDetailDTOList) {
+        List<BomDetailResp> resps = new ArrayList<>();
+
+        for (BomDetailDTO bomDetailDTO : bomDetailDTOList) {
+            BomDetailResp bomDetailResp = toBomDetailResp(bomDetailDTO);
+            resps.add(bomDetailResp);
+        }
+        return resps;
+    }
+
+    public static BomDetailResp toBomDetailResp(BomDetailDTO bomDetailDTO) {
+        BomDetailResp bomDetailResp = new BomDetailResp();
+        bomDetailResp.setBd_id(bomDetailDTO.getBd_id());
+        bomDetailResp.setBd_bomid(bomDetailDTO.getBd_bomid());
+        bomDetailResp.setBd_detno(bomDetailDTO.getBd_detno());
+        bomDetailResp.setBd_soncode(bomDetailDTO.getBd_soncode());
+        bomDetailResp.setBd_baseqty(bomDetailDTO.getBd_baseqty());
+        bomDetailResp.setBd_location(bomDetailDTO.getBd_location());
+        bomDetailResp.setBd_remark(bomDetailDTO.getBd_remark());
+        bomDetailResp.setBd_ecncode(bomDetailDTO.getBd_ecncode());
+        bomDetailResp.setBd_ifrep(bomDetailDTO.getBd_ifrep());
+        bomDetailResp.setBd_repcode(bomDetailDTO.getBd_repcode());
+        bomDetailResp.setBd_usestatus(bomDetailDTO.getBd_usestatus());
+        return bomDetailResp;
+    }
+}

+ 68 - 0
src/main/java/com/uas/eis/convertor/ProductConvertor.java

@@ -0,0 +1,68 @@
+package com.uas.eis.convertor;
+
+import com.uas.eis.sdk.dto.ProductDTO;
+import com.uas.eis.sdk.resp.ProdcutResp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProductConvertor {
+
+    public static List<ProdcutResp> toProdcutRespListByProductDTOs(List<ProductDTO> productDTOList) {
+        List<ProdcutResp> resps = new ArrayList<>();
+
+        for (ProductDTO productDTO : productDTOList) {
+            ProdcutResp prodcutResp = toProdcutResp(productDTO);
+            resps.add(prodcutResp);
+        }
+        return resps;
+    }
+
+    public static ProdcutResp toProdcutRespByProductDTOs(List<ProductDTO> productDTOList) {
+        ProductDTO productDTO = productDTOList.get(0);
+        ProdcutResp prodcutResp = toProdcutResp(productDTO);
+        return prodcutResp;
+    }
+
+    public static ProdcutResp toProdcutResp(ProductDTO productDTO) {
+        ProdcutResp prodcutResp = new ProdcutResp();
+        prodcutResp.setStatus(productDTO.getPr_status());
+        prodcutResp.setSerial(productDTO.getPr_serial());
+        prodcutResp.setCode(productDTO.getPr_code());
+        prodcutResp.setDetail(productDTO.getPr_detail());
+        prodcutResp.setSpec(productDTO.getPr_spec());
+        prodcutResp.setSpeccs(productDTO.getPr_speccs());
+        prodcutResp.setRemark_warehouse(productDTO.getPr_remark_warehouse());
+        prodcutResp.setRemark_sale(productDTO.getPr_remark_sale());
+        prodcutResp.setUnit(productDTO.getPr_unit());
+        prodcutResp.setKind(productDTO.getPr_kind());
+        prodcutResp.setManutype(productDTO.getPr_manutype());
+        prodcutResp.setDhzc(productDTO.getPr_dhzc());
+        prodcutResp.setSupplytype(productDTO.getPr_supplytype());
+        prodcutResp.setMaterial(productDTO.getPr_material());
+        prodcutResp.setLevel(productDTO.getPr_level());
+        prodcutResp.setAcceptmethod(productDTO.getPr_acceptmethod());
+        prodcutResp.setWhcode(productDTO.getPr_whcode());
+        prodcutResp.setIfbarcodecheck(productDTO.getPr_ifbarcodecheck());
+        prodcutResp.setPlanner(productDTO.getPr_planner());
+        prodcutResp.setBuyername(productDTO.getPr_buyername());
+        prodcutResp.setCop(productDTO.getPr_cop());
+        prodcutResp.setRecordman(productDTO.getPr_recordman());
+        prodcutResp.setDocdate(productDTO.getPr_docdate());
+        prodcutResp.setSourcecode(productDTO.getPr_sourcecode());
+        prodcutResp.setCheckstatus(productDTO.getPr_checkstatus());
+        prodcutResp.setId(productDTO.getPr_id());
+        prodcutResp.setUuid(productDTO.getPr_uuid());
+        prodcutResp.setSendstatus(productDTO.getPr_sendstatus());
+        prodcutResp.setStockcatecode(productDTO.getPr_stockcatecode());
+        prodcutResp.setSmtpoint(productDTO.getPr_smtpoint());
+        prodcutResp.setSafetystock(productDTO.getPr_safetystock());
+        prodcutResp.setZxbzs(productDTO.getPr_zxbzs());
+        prodcutResp.setZxdhl(productDTO.getPr_zxdhl());
+        prodcutResp.setPurcmergedays(productDTO.getPr_purcmergedays());
+        prodcutResp.setStockcatename(productDTO.getPr_stockcatename());
+        prodcutResp.setTracekind(productDTO.getPr_tracekind());
+        prodcutResp.setBrand(productDTO.getPr_brand());
+        return prodcutResp;
+    }
+}

+ 9 - 1
src/main/java/com/uas/eis/core/WebAppConfig.java

@@ -3,6 +3,7 @@ package com.uas.eis.core;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.uas.eis.core.support.ApiSignLoginInterceptor;
 import com.uas.eis.core.support.DataSourceInterceptor;
+import com.uas.eis.core.support.InterceptorConfig;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.converter.HttpMessageConverter;
@@ -24,9 +25,16 @@ public class WebAppConfig extends WebMvcConfigurationSupport{
 		return new ApiSignLoginInterceptor();
 	}
 
+	@Bean
+	public InterceptorConfig interceptorConfig(){
+		return new InterceptorConfig();
+	}
+
 	@Override
 	public void addInterceptors(InterceptorRegistry registry){
-		registry.addInterceptor(apiSignLoginInterceptor()).addPathPatterns("/api/**","/mes/**")
+//		registry.addInterceptor(apiSignLoginInterceptor()).addPathPatterns("/api/**","/mes/**")
+//				.excludePathPatterns("/login", "/erp/**");
+		registry.addInterceptor(interceptorConfig()).addPathPatterns("/api/**","/mes/**")
 				.excludePathPatterns("/login", "/erp/**");
 		registry.addInterceptor(new DataSourceInterceptor()).addPathPatterns("/*/**");
 	}

+ 86 - 0
src/main/java/com/uas/eis/core/support/InterceptorConfig.java

@@ -0,0 +1,86 @@
+package com.uas.eis.core.support;
+
+import com.uas.eis.service.UserService;
+import com.uas.eis.utils.BaseUtil;
+import io.jsonwebtoken.Claims;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+
+public class InterceptorConfig implements HandlerInterceptor {
+
+	@Autowired
+	private UserService userService;
+
+	private final static String header = "Authorization";
+
+	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+		//token认证
+		//String token = (String) request.getSession().getAttribute("token");
+		String token = request.getHeader(header);
+		boolean flag = false;
+		String message = new String("程序错误");
+		if(token != null && !token.trim().isEmpty()) { // 验证是否包含token
+			Claims claims = TokenHandler.parseToken(token);
+			if(claims != null && checkToken(claims)) { // 验证token信息是否合法
+				String username = (String) claims.get("username");
+				String password = (String) claims.get("password");
+				if(checkUser(username, password)) { // 验证用户是否合法
+					flag = true;
+//					String actionUrl = request.getRequestURI();
+//					if(checkActionAccess(username, actionUrl)) { // 验证请求权限
+//						flag = true;
+//					}else {
+//						message = "访问权限受限";
+//					}
+				}else {
+					message = "请求用户无效";
+				}
+			}else {
+				message = "Token未通过验证或已过期";
+			}
+		}else {
+			message = "未授权的请求";
+		}
+		if(!flag) {
+			BaseUtil.showError(message);
+		}
+		return flag;
+	}
+
+	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
+			ModelAndView modelAndView) throws Exception {
+	}
+
+	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,
+			Exception ex) throws Exception {
+	}
+
+	private boolean checkToken(Claims claims) {
+		Date now = new Date();
+		Date start = claims.getNotBefore();
+		Date end = claims.getExpiration();
+
+		boolean flag = false;
+		if (now.after(start) && now.before(end)) {
+			flag = true;
+		}
+		return flag;
+	}
+
+	private boolean checkUser(String username, String password) {
+		boolean enable = false;
+		if(username != null && password != null) {
+			enable = userService.checkUser(username, password);
+		}
+		return enable;
+	}
+
+	private boolean checkActionAccess(String username, String action) {
+		return userService.checkAction(username, action);
+	}
+}

+ 22 - 0
src/main/java/com/uas/eis/exception/BaseExceptionCode.java

@@ -0,0 +1,22 @@
+package com.uas.eis.exception;
+
+
+/**
+ * @author yingp
+ * @date 2018/9/30
+ */
+public interface BaseExceptionCode {
+    /**
+     * 异常编码
+     *
+     * @return
+     */
+    int getCode();
+
+    /**
+     * 异常信息
+     *
+     * @return
+     */
+    String getMessage();
+}

+ 41 - 0
src/main/java/com/uas/eis/sdk/dto/BomDTO.java

@@ -0,0 +1,41 @@
+package com.uas.eis.sdk.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+ * dto说明
+ * */
+
+@Data
+@NoArgsConstructor
+public class BomDTO {
+
+    /**
+     *主键ID
+     * */
+    private BigDecimal bo_id;
+    private String bo_version;
+    private String bo_status;
+    private String bo_level;
+    private String bo_mothercode;
+    private String bo_remark;
+    private String bo_wcname;
+    private BigDecimal bo_ispast;
+    private String bo_cop;
+    private String bo_recorder;
+    private Date bo_date;
+    private String bo_auditman;
+    private Date bo_auditdate;
+    private BigDecimal bo_isextend;
+    private BigDecimal bo_refbomid;
+    private String bo_refcode;
+    private String bo_refname;
+    private String bo_refspec;
+    private String bo_style;
+    private String bo_flowstyle;
+}

+ 31 - 0
src/main/java/com/uas/eis/sdk/dto/BomDetailDTO.java

@@ -0,0 +1,31 @@
+package com.uas.eis.sdk.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+
+/**
+ * dto说明
+ * */
+
+@Data
+@NoArgsConstructor
+public class BomDetailDTO {
+
+    /**
+     *主键ID
+     * */
+    private BigDecimal bd_id;
+    private BigDecimal bd_bomid;
+    private BigDecimal bd_detno;
+    private String bd_soncode;
+    private BigDecimal bd_baseqty;
+    private String bd_location;
+    private String bd_remark;
+    private String bd_ecncode;
+    private BigDecimal bd_ifrep;
+    private String bd_repcode;
+    private String bd_usestatus;
+}

+ 14 - 0
src/main/java/com/uas/eis/sdk/dto/BomReq.java

@@ -0,0 +1,14 @@
+package com.uas.eis.sdk.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class BomReq extends ProductPageDTO{
+
+    /**
+     * 期间
+     * */
+    private String bomId;
+}

+ 57 - 0
src/main/java/com/uas/eis/sdk/dto/ProductDTO.java

@@ -0,0 +1,57 @@
+package com.uas.eis.sdk.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+
+/**
+ * dto说明
+ * */
+
+@Data
+@NoArgsConstructor
+public class ProductDTO {
+
+    /**
+     *主键ID
+     * */
+    private String pr_status;
+    private String pr_serial;
+    private String pr_code;
+    private String pr_detail;
+    private String pr_spec;
+    private String pr_speccs;
+    private String pr_remark_warehouse;
+    private String pr_remark_sale;
+    private String pr_unit;
+    private String pr_kind;
+    private String pr_manutype;
+    private String pr_dhzc;
+    private String pr_supplytype;
+    private String pr_material;
+    private String pr_level;
+    private String pr_acceptmethod;
+    private String pr_whcode;
+    private Integer pr_ifbarcodecheck;
+    private String pr_planner;
+    private String pr_buyername;
+    private String pr_cop;
+    private String pr_recordman;
+    private Date pr_docdate;
+    private String pr_sourcecode;
+    private String pr_checkstatus;
+    private Integer pr_id;
+    private String pr_uuid;
+    private String pr_sendstatus;
+    private String pr_stockcatecode;
+    private Integer pr_smtpoint;
+    private Integer pr_safetystock;
+    private Integer pr_zxbzs;
+    private Integer pr_zxdhl;
+    private Integer pr_purcmergedays;
+    private String pr_stockcatename;
+    private String pr_tracekind;
+    private String pr_brand;
+}

+ 25 - 0
src/main/java/com/uas/eis/sdk/dto/ProductPageDTO.java

@@ -0,0 +1,25 @@
+package com.uas.eis.sdk.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+/**
+ * dto说明
+ * */
+
+@Data
+@NoArgsConstructor
+public class ProductPageDTO {
+
+    /**
+     *页码
+     * */
+    private Integer pageNum;
+
+    /**
+     * 每页条数
+     * */
+    private Integer pageSize;
+
+}

+ 14 - 0
src/main/java/com/uas/eis/sdk/dto/ProductReq.java

@@ -0,0 +1,14 @@
+package com.uas.eis.sdk.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class ProductReq extends ProductPageDTO{
+
+    /**
+     * 期间
+     * */
+    private String code;
+}

+ 16 - 0
src/main/java/com/uas/eis/sdk/dto/UserReq.java

@@ -0,0 +1,16 @@
+package com.uas.eis.sdk.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class UserReq{
+
+    /**
+     * 期间
+     * */
+    private String username;
+
+    private String password;
+}

+ 20 - 0
src/main/java/com/uas/eis/sdk/resp/BomDetailResp.java

@@ -0,0 +1,20 @@
+package com.uas.eis.sdk.resp;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class BomDetailResp {
+    private BigDecimal bd_id;
+    private BigDecimal bd_bomid;
+    private BigDecimal bd_detno;
+    private String bd_soncode;
+    private BigDecimal bd_baseqty;
+    private String bd_location;
+    private String bd_remark;
+    private String bd_ecncode;
+    private BigDecimal bd_ifrep;
+    private String bd_repcode;
+    private String bd_usestatus;
+}

+ 11 - 0
src/main/java/com/uas/eis/sdk/resp/BomReadResp.java

@@ -0,0 +1,11 @@
+package com.uas.eis.sdk.resp;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class BomReadResp {
+    private BomResp main;
+    private List<BomDetailResp> detail;
+}

+ 30 - 0
src/main/java/com/uas/eis/sdk/resp/BomResp.java

@@ -0,0 +1,30 @@
+package com.uas.eis.sdk.resp;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+public class BomResp {
+    private BigDecimal bo_id;
+    private String bo_version;
+    private String bo_status;
+    private String bo_level;
+    private String bo_mothercode;
+    private String bo_remark;
+    private String bo_wcname;
+    private BigDecimal bo_ispast;
+    private String bo_cop;
+    private String bo_recorder;
+    private Date bo_date;
+    private String bo_auditman;
+    private Date bo_auditdate;
+    private BigDecimal bo_isextend;
+    private BigDecimal bo_refbomid;
+    private String bo_refcode;
+    private String bo_refname;
+    private String bo_refspec;
+    private String bo_style;
+    private String bo_flowstyle;
+}

+ 46 - 0
src/main/java/com/uas/eis/sdk/resp/ProdcutResp.java

@@ -0,0 +1,46 @@
+package com.uas.eis.sdk.resp;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ProdcutResp {
+    private String status;
+    private String serial;
+    private String code;
+    private String detail;
+    private String spec;
+    private String speccs;
+    private String remark_warehouse;
+    private String remark_sale;
+    private String unit;
+    private String kind;
+    private String manutype;
+    private String dhzc;
+    private String supplytype;
+    private String material;
+    private String level;
+    private String acceptmethod;
+    private String whcode;
+    private Integer ifbarcodecheck;
+    private String planner;
+    private String buyername;
+    private String cop;
+    private String recordman;
+    private Date docdate;
+    private String sourcecode;
+    private String checkstatus;
+    private Integer id;
+    private String uuid;
+    private String sendstatus;
+    private String stockcatecode;
+    private Integer smtpoint;
+    private Integer safetystock;
+    private Integer zxbzs;
+    private Integer zxdhl;
+    private Integer purcmergedays;
+    private String stockcatename;
+    private String tracekind;
+    private String brand;
+}

+ 39 - 391
src/main/java/com/uas/eis/service/Impl/STKServiceImpl.java

@@ -1,33 +1,31 @@
 package com.uas.eis.service.Impl;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.uas.eis.core.config.SpObserver;
+import com.uas.eis.beans.result.Result;
+import com.uas.eis.convertor.BomConvertor;
+import com.uas.eis.convertor.BomDetailConvertor;
+import com.uas.eis.convertor.ProductConvertor;
 import com.uas.eis.dao.BaseDao;
-import com.uas.eis.dao.SqlRowList;
 import com.uas.eis.sdk.dto.*;
-import com.uas.eis.sdk.entity.ApiResult;
-import com.uas.eis.sdk.resp.ApiResponse;
+import com.uas.eis.sdk.resp.BomDetailResp;
+import com.uas.eis.sdk.resp.BomReadResp;
+import com.uas.eis.sdk.resp.BomResp;
+import com.uas.eis.sdk.resp.ProdcutResp;
 import com.uas.eis.service.RequestSTKService;
 import com.uas.eis.service.STKService;
-import com.uas.eis.utils.*;
-import com.uas.eis.vo.stkVo.*;
+import com.uas.eis.utils.PSHttpUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
-import java.util.*;
+import java.util.List;
 
 /**
- * @author zhuxl
+ * @author
  * @date 2024-10-12
  */
 @Service
@@ -40,397 +38,47 @@ public class STKServiceImpl implements STKService {
     private RequestSTKService requestSTKService;
 
     @Override
-    public ApiResult<String> getAssistBalanceCount(HttpServletRequest request, AssistBalanceDTO dto) {
-        String yearmonth = dto.getYearMonth();
-        boolean bool = baseDao.checkIf("PeriodsDetail", "pd_code='MONTH-A' and pd_status=99 and pd_detno='"+yearmonth+"'");
-        if (bool) {
-            int batch_no = baseDao.getSeqId("STK_ASSISTBALANCE2_SEQ");
-            String res = baseDao.callProcedure("SP_INSER_ASSISTBALANCE",
-                    new Object[] {batch_no,yearmonth});
-            if (res != null && !res.trim().equals("")) {
-                return ApiResponse.successRsp("1",res,request.getHeader("RequestId"),null);
-            }else{
-                int count = baseDao.getCount("select count(1)  from STK_ASSISTBALANCE where FPERIODNAME='" + yearmonth + "'");
-                BalanceCountDTO balanceCountDTO = new BalanceCountDTO();
-                balanceCountDTO.setYearMonth(yearmonth);
-                balanceCountDTO.setBatch_no(batch_no);
-                balanceCountDTO.setCount(count);
-                String s = JSON.toJSONString(balanceCountDTO, SerializerFeature.WriteMapNullValue);
-                return ApiResponse.successRsp("1",null,request.getHeader("RequestId"),s);
-            }
-        }else{
-            return ApiResponse.successRsp("2001","当前期间未结账!",request.getHeader("RequestId"),null);
-        }
-    }
-
-    @Override
-    public ApiResult<String> getAssistBalance(HttpServletRequest request, AssistBalanceDTO dto) {
-        String yearmonth = dto.getYearMonth();
-        String batch_no = dto.getBatch_no();
-        int pageNum = Integer.valueOf(dto.getPageNum());
-        int pageSize = Integer.valueOf(dto.getPageSize());
-        int start = ((pageNum - 1) * pageSize + 1);
-        int end = pageNum * pageSize;
-        boolean bool = baseDao.checkIf("PeriodsDetail", "pd_code='MONTH-A' and pd_status=99 and pd_detno='"+yearmonth+"'");
-        if (bool) {
-            List<BalanceDTO> balanceDTO = baseDao.query("SELECT fid,fssno,fsoid,forgunitno,forgunitname,fperiodname,fcurrencyname,forginalcname,faccountno,faccountname," +
-                    "     fassistgrptype,fassistgrpno1,fassistgrpname1," +
-                    "     fassistgrpno2,fassistgrpname2," +
-                    "     fbeginbalancefor,fbeginbalancelocal," +
-                    "     fcreditfor,fcreditlocal,fdebitfor,fdebitlocal," +
-                    "     fendbalancefor,fendbalancelocal," +
-                    "     fyearpnlfor,fyearpnllocal," +
-                    "     fyeardebitfor,fyeardebitlocal,fyearcreditfor,fyearcreditlocal," +
-                    "     faccoccurfor,faccoccurlocal," +
-                    "     to_char(fmodifytime,'yyyy-mm-dd hh24:mi:ss') fmodifytime,to_char(flockintime,'yyyy-mm-dd hh24:mi:ss') flockintime," +
-                    "     fdisablelabel,fdatamode,fbilltype,batch_no from stk_assistbalance " +
-                    "WHERE batch_no ="+batch_no+" and FPERIODNAME = '"+yearmonth +"' and QUERYDETNO >= " +start+ " and QUERYDETNO <= " + end, BalanceDTO.class);
-
-            //String s = JSON.toJSONString(rs.getResultList(), SerializerFeature.WriteMapNullValue);
-            String s = JSON.toJSONString(balanceDTO, SerializerFeature.WriteMapNullValue);
-            return ApiResponse.successRsp("1",null,request.getHeader("RequestId"),s);
-        }else{
-            return ApiResponse.successRsp("2001","当前期间未结账!",request.getHeader("RequestId"),null);
-        }
-    }
-
-    @Override
-    public ApiResult<String> getCashFlowCount(HttpServletRequest request, AssistBalanceDTO dto) {
-        String yearmonth = dto.getYearMonth();
-        boolean bool = baseDao.checkIf("PeriodsDetail", "pd_code='MONTH-A' and pd_status=99 and pd_detno='"+yearmonth+"'");
-        if (bool) {
-            int batch_no = baseDao.getSeqId("STK_CASHFLOW2_SEQ");
-            String res = baseDao.callProcedure("SP_INSER_CASHFLOW",
-                    new Object[] {batch_no,yearmonth});
-            if (res != null && !res.trim().equals("")) {
-                return ApiResponse.successRsp("2001",res,request.getHeader("RequestId"),null);
-            }else{
-                int count = baseDao.getCount("select count(1)  from STK_CASHFLOW where FPERIODNAME='" + yearmonth + "'");
-                BalanceCountDTO balanceCountDTO = new BalanceCountDTO();
-                balanceCountDTO.setYearMonth(yearmonth);
-                balanceCountDTO.setBatch_no(batch_no);
-                balanceCountDTO.setCount(count);
-                String s = JSON.toJSONString(balanceCountDTO, SerializerFeature.WriteMapNullValue);
-                return ApiResponse.successRsp("1",null,request.getHeader("RequestId"),s);
-            }
-        }else{
-            return ApiResponse.successRsp("2001","当前期间未结账!",request.getHeader("RequestId"),null);
-        }
-    }
-
-    @Override
-    public ApiResult<String> getCashFlow(HttpServletRequest request, AssistBalanceDTO dto) {
-        String yearmonth = dto.getYearMonth();
-        String batch_no = dto.getBatch_no();
-        int pageNum = Integer.valueOf(dto.getPageNum());
-        int pageSize = Integer.valueOf(dto.getPageSize());
-        int start = ((pageNum - 1) * pageSize + 1);
-        int end = pageNum * pageSize;
-        boolean bool = baseDao.checkIf("PeriodsDetail", "pd_code='MONTH-A' and pd_status=99 and pd_detno='"+yearmonth+"'");
-        if (bool) {
-            List<CashFlowDTO> cashFlowDTO = baseDao.query("SELECT fid,fssno,fsoid,forgunitno,forgunitname,fperiodname,fcurrencyname,forginalcname,faccountno,faccountname," +
-                    "     fassistgrptype,fassistgrpno1,fassistgrpname1," +
-                    "     fassistgrpno2,fassistgrpname2," +
-                    "     fytdamt,fytdlocalamt," +
-                    "     fmodifytime,flockintime,fdisablelabel,fdatamode,batch_no from STK_CASHFLOW " +
-                    "WHERE batch_no ="+batch_no+" and FPERIODNAME = '"+yearmonth +"' and QUERYDETNO >= " +start+ " and QUERYDETNO <= " + end, CashFlowDTO.class);
-
-            //String s = JSON.toJSONString(rs.getResultList(), SerializerFeature.WriteMapNullValue);
-            String s = JSON.toJSONString(cashFlowDTO, SerializerFeature.WriteMapNullValue);
-            return ApiResponse.successRsp("1",null,request.getHeader("RequestId"),s);
-        }else{
-            return ApiResponse.successRsp("2001","当前期间未结账!",request.getHeader("RequestId"),null);
-        }
+    public Result getProduct(HttpServletRequest request, ProductReq req) {
+        String code = req.getCode();
+//        int pageNum = Integer.valueOf(req.getPageNum());
+//        int pageSize = Integer.valueOf(req.getPageSize());
+//        int start = ((pageNum - 1) * pageSize + 1);
+//        int end = pageNum * pageSize;
+        List<ProductDTO> productDTOS = baseDao.query("select * from ( SELECT pr_status,pr_serial,pr_code,pr_detail,pr_spec,pr_speccs,pr_remark_warehouse,pr_remark_sale,pr_unit,pr_kind,pr_manutype,pr_dhzc,pr_supplytype,pr_material,pr_level,pr_acceptmethod,pr_whcode,pr_ifbarcodecheck,pr_planner,pr_buyername,pr_cop,pr_recordman,pr_docdate,pr_sourcecode,pr_checkstatus,pr_id,pr_uuid,pr_sendstatus,pr_stockcatecode,pr_smtpoint,pr_safetystock,pr_zxbzs,pr_zxdhl,pr_purcmergedays,pr_stockcatename,pr_tracekind,pr_brand " +
+                " from Product WHERE pr_code in ('"+code+"') order by pr_id desc)" , ProductDTO.class);
+        if (productDTOS.size() == 0 ){
+            return Result.error("物料资料不存在");
+        }
+        ProdcutResp prodcutResp = ProductConvertor.toProdcutRespByProductDTOs(productDTOS);
+        return Result.success(prodcutResp);
     }
 
-
-
     @Override
-    public ApiResult<String> updateCustVend(UpdateCustVendDTO dto) {
-        int vid = dto.getVid();
-        String vtype = dto.getVtype();
-        //查询出的新增,变更数据
-        List<SaveOrChangeCustomerDetailDto> sourceDataList = new ArrayList<>();
-        if ("客户".equals(vtype)) {
-            SqlRowList cust = baseDao
-                    .queryForRowSet("select * from Customer left join STK_CUSTVEND on cu_businesscode = uid2 where cu_id="
-                            + vid + "");
-            while (cust.next()) {
-                SaveOrChangeCustomerDetailDto sourcedao = new SaveOrChangeCustomerDetailDto();
-                sourcedao.setS_CODE(cust.getString("CU_CODE"));
-                sourcedao.setNAME(cust.getString("CU_NAME"));
-                sourcedao.setUID_TYPE(cust.getString("UID_TYPE"));
-                sourcedao.setUID(cust.getString("CU_BUSINESSCODE"));
-                sourcedao.setCUSTOMER_TYPE(cust.getString("CUSTOMER_TYPE"));
-                sourcedao.setIS_VALID(cust.getString("IS_VALID"));
-                sourcedao.setCREATED_ORG(cust.getString("CREATED_ORG"));
-                sourcedao.setCREATED_SYSTEM(cust.getString("CREATED_SYSTEM"));
-                sourcedao.setISTEMPORARY(cust.getString("ISTEMPORARY"));
-                sourceDataList.add(sourcedao);
-            }
+    public Result getBom(BomReq bomReq) {
+        String bomId = bomReq.getBomId();
+        List<BomDTO> bomDTOList = baseDao.query("select * from ( SELECT bo_id,bo_version,bo_status,bo_level,bo_mothercode,bo_remark,bo_wcname,bo_ispast,bo_cop,bo_recorder,bo_date,bo_auditman,bo_auditdate,bo_isextend,bo_refbomid,bo_refcode,bo_refname,bo_refspec,bo_style,bo_flowstyle " +
+                " from Bom WHERE bo_id in ("+bomId+") order by bo_id desc)" , BomDTO.class);
 
-        }else{
-            SqlRowList vend = baseDao
-                    .queryForRowSet("select * from Vendor left join STK_CUSTVEND on ve_webserver = uid2 where ve_id="
-                            + vid + "");
-            while (vend.next()) {
-                SaveOrChangeCustomerDetailDto sourcedao = new SaveOrChangeCustomerDetailDto();
-                sourcedao.setS_CODE(vend.getString("CU_CODE"));
-                sourcedao.setNAME(vend.getString("CU_NAME"));
-                sourcedao.setUID_TYPE(vend.getString("UID_TYPE"));
-                sourcedao.setUID(vend.getString("VE_WEBSERVER"));
-                sourcedao.setCUSTOMER_TYPE(vend.getString("CUSTOMER_TYPE"));
-                sourcedao.setIS_VALID(vend.getString("IS_VALID"));
-                sourcedao.setCREATED_ORG(vend.getString("CREATED_ORG"));
-                sourcedao.setCREATED_SYSTEM(vend.getString("CREATED_SYSTEM"));
-                sourcedao.setISTEMPORARY(vend.getString("ISTEMPORARY"));
-                sourceDataList.add(sourcedao);
-            }
+        if (bomDTOList.size() == 0 ){
+            return Result.error("BOM资料不存在");
         }
-        //调用深投控api接口
-        SaveOrChangeCustomerVo saveOrChangeCustomerVo = null;
-        try {
-            HttpResultResponse resultResponse = requestSTKService.updateKSPostParam(1,200,sourceDataList);
-            saveOrChangeCustomerVo = JSONObject.parseObject(resultResponse.getBody(),SaveOrChangeCustomerVo.class);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        ApiResult result = new ApiResult();
-        return result.setData(saveOrChangeCustomerVo);
-    }
 
+        BomResp bomResp = BomConvertor.toBomRespListByBomDTOs(bomDTOList);
 
-    @Override
-    public ApiResult<String> getAssistBalanceCountTest(HttpServletRequest request, AssistBalanceDTO dto) {
-        //取yearMonth
-        String yearMonth = dto.getYearMonth();
-        System.out.println("body参数打印:"+dto.getYearMonth());
-        //获取header参数
-        Map<String,String> headerMap = getHeaderParams(request);
-        System.out.println("header参数:【AccessKey:"+headerMap.get("AccessKey")+",Timestamp:"+headerMap.get("Timestamp")
-        +",RequestId:"+headerMap.get("RequestId")+",Signature:"+headerMap.get("Signature")+"】");
-        return null;
-    }
+        BomReadResp bomReadResp = new BomReadResp();
+        bomReadResp.setMain(bomResp);
 
+        List<BomDetailDTO> bomDetailDTOList = baseDao.query("select * from ( SELECT bd_id,bd_bomid,bd_detno,bd_soncode,bd_baseqty,bd_location,bd_remark,bd_ecncode,bd_ifrep,bd_repcode,bd_usestatus " +
+                " from BomDetail WHERE bd_bomid in ("+bomId+") order by bd_detno)" , BomDetailDTO.class);
 
+        if (bomDTOList.size() > 0 ){
 
-    //客商信息
-    @Override
-    public void getCustvend(TravellingMerchantVo travellingMerchantVo , Boolean isdelete) {
-        if(null == travellingMerchantVo.getData() || CollectionUtils.isEmpty(travellingMerchantVo.getData().getList())){
-            return ;
-        }
-        List<CustvendDTO> custvendDTOS = travellingMerchantVo.getData().getList();
-        List<String> sqls = new ArrayList<>();
-        if (isdelete) {
-            sqls.add("delete from STK_CUSTVEND2");
-        }
-        for (int i = 0; i < custvendDTOS.size(); i++) {
-            sqls.add("insert into STK_CUSTVEND2(ID,S_ID,S_CODE,NAME,UID_TYPE,UID2,CUSTOMER_TYPE,IS_VALID,CREATED_ORG,CREATED_SYSTEM,ISTEMPORARY,MDM_CODE,REG_COUNTRY, " +
-                    "REG_PLACE,REG_REP,REG_CAPTIAL,REG_PERIOD,REG_BIZSCOPE," +
-                    "REG_FOUNDEDDATE," +
-                    "REG_URL,REG_ADDRESS," +
-                    "CREAT_TIME," +
-                    "UPDATE_TIME,SERIAL) " +
-                    "values ("+custvendDTOS.get(i).getId()+","+custvendDTOS.get(i).getS_id()+",'"+custvendDTOS.get(i).getS_code()+"','"+custvendDTOS.get(i).getName()+"'" +
-                    ",'"+custvendDTOS.get(i).getUid_type()+"','"+custvendDTOS.get(i).getUid()+"','"+custvendDTOS.get(i).getCustomer_type()+"','"+custvendDTOS.get(i).getIs_valid()+"'" +
-                    ",'"+custvendDTOS.get(i).getCreated_org()+"','"+custvendDTOS.get(i).getCreated_system()+"','"+custvendDTOS.get(i).getIstemporary()+"','"+custvendDTOS.get(i).getMdm_code()+"','"+custvendDTOS.get(i).getReg_country()+"'" +
-                    ",'"+custvendDTOS.get(i).getReg_place()+"','"+custvendDTOS.get(i).getReg_rep()+"','"+custvendDTOS.get(i).getReg_captial()+"','"+custvendDTOS.get(i).getReg_period()+"','"+custvendDTOS.get(i).getReg_bizscope()+"'" +
-                    ",case when '"+custvendDTOS.get(i).getReg_foundeddate()+"' = 'null' then null else to_date(to_char(to_timestamp('"+custvendDTOS.get(i).getReg_foundeddate()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    ",'"+custvendDTOS.get(i).getReg_url()+"','"+custvendDTOS.get(i).getReg_address()+"'" +
-                    ",case when '"+custvendDTOS.get(i).getCreat_time()+"' = 'null' then null else to_date(to_char(to_timestamp('"+custvendDTOS.get(i).getCreat_time()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    ",case when '"+custvendDTOS.get(i).getUpdate_time()+"' = 'null' then null else to_date(to_char(to_timestamp('"+custvendDTOS.get(i).getUpdate_time()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end,'"+custvendDTOS.get(i).getSerial()+"')");
-            sqls.add("update STK_CUSTVEND2 set UID_TYPENAME = case when UID_TYPE = '01' then '统一社会信用代码' when UID_TYPE = '02' then '邓氏编码' " +
-                    "when UID_TYPE = '03' then '身份证号码(大陆)' when UID_TYPE = '04' then '护照号码(包括港澳身份证号码)'  when UID_TYPE = '06' then '身份证护照组合' " +
-                    "when UID_TYPE = '99' then '其他编码' end where id = " + custvendDTOS.get(i).getId());
-            sqls.add("update STK_CUSTVEND2 set CUSTOMER_TYPENAME = case when CUSTOMER_TYPE = 'C0201' then '单位客户' when CUSTOMER_TYPE = 'C0202' then '个人客户' " +
-                    "when CUSTOMER_TYPE = 'S0201' then '单位供应商' when CUSTOMER_TYPE = 'S0202' then '个人供应商' end where id = " + custvendDTOS.get(i).getId());
-            sqls.add("update STK_CUSTVEND2 set IS_VALIDNAME = case when IS_VALID = '1' then '有效' else '无效' end, " +
-                    "ISTEMPORARYNAME = case when ISTEMPORARY = '1' then '是' else '否' end where id = " + custvendDTOS.get(i).getId());
-        }
-        baseDao.execute(sqls);
-    }
+            List<BomDetailResp> bomDetailResps = BomDetailConvertor.toBomDetailRespListByBomDetailDTOs(bomDetailDTOList);
 
-    //客商信息(当天)
-    @Override
-    public void getCustvendDay(TravellingMerchantVo travellingMerchantVo , Boolean isdelete) {
-        if(null == travellingMerchantVo.getData() || CollectionUtils.isEmpty(travellingMerchantVo.getData().getList())){
-            return ;
+            bomReadResp.setDetail(bomDetailResps);
         }
-        List<CustvendDTO> custvendDTOS = travellingMerchantVo.getData().getList();
-        List<String> sqls = new ArrayList<>();
-        for (int i = 0; i < custvendDTOS.size(); i++) {
-            sqls.add("delete from STK_CUSTVEND2 where id = " + custvendDTOS.get(i).getId());
-            sqls.add("insert into STK_CUSTVEND2(ID,S_ID,S_CODE,NAME,UID_TYPE,UID2,CUSTOMER_TYPE,IS_VALID,CREATED_ORG,CREATED_SYSTEM,ISTEMPORARY,MDM_CODE,REG_COUNTRY, " +
-                    "REG_PLACE,REG_REP,REG_CAPTIAL,REG_PERIOD,REG_BIZSCOPE," +
-                    "REG_FOUNDEDDATE," +
-                    "REG_URL,REG_ADDRESS," +
-                    "CREAT_TIME," +
-                    "UPDATE_TIME,SERIAL) " +
-                    "values ("+custvendDTOS.get(i).getId()+","+custvendDTOS.get(i).getS_id()+",'"+custvendDTOS.get(i).getS_code()+"','"+custvendDTOS.get(i).getName()+"'" +
-                    ",'"+custvendDTOS.get(i).getUid_type()+"','"+custvendDTOS.get(i).getUid()+"','"+custvendDTOS.get(i).getCustomer_type()+"','"+custvendDTOS.get(i).getIs_valid()+"'" +
-                    ",'"+custvendDTOS.get(i).getCreated_org()+"','"+custvendDTOS.get(i).getCreated_system()+"','"+custvendDTOS.get(i).getIstemporary()+"','"+custvendDTOS.get(i).getMdm_code()+"','"+custvendDTOS.get(i).getReg_country()+"'" +
-                    ",'"+custvendDTOS.get(i).getReg_place()+"','"+custvendDTOS.get(i).getReg_rep()+"','"+custvendDTOS.get(i).getReg_captial()+"','"+custvendDTOS.get(i).getReg_period()+"','"+custvendDTOS.get(i).getReg_bizscope()+"'" +
-                    ",case when '"+custvendDTOS.get(i).getReg_foundeddate()+"' = 'null' then null else to_date(to_char(to_timestamp('"+custvendDTOS.get(i).getReg_foundeddate()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    ",'"+custvendDTOS.get(i).getReg_url()+"','"+custvendDTOS.get(i).getReg_address()+"'" +
-                    ",case when '"+custvendDTOS.get(i).getCreat_time()+"' = 'null' then null else to_date(to_char(to_timestamp('"+custvendDTOS.get(i).getCreat_time()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    ",case when '"+custvendDTOS.get(i).getUpdate_time()+"' = 'null' then null else to_date(to_char(to_timestamp('"+custvendDTOS.get(i).getUpdate_time()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end,'"+custvendDTOS.get(i).getSerial()+"')");
-            sqls.add("update STK_CUSTVEND2 set UID_TYPENAME = case when UID_TYPE = '01' then '统一社会信用代码' when UID_TYPE = '02' then '邓氏编码' " +
-                    "when UID_TYPE = '03' then '身份证号码(大陆)' when UID_TYPE = '04' then '护照号码(包括港澳身份证号码)'  when UID_TYPE = '06' then '身份证护照组合' " +
-                    "when UID_TYPE = '99' then '其他编码' end where id = " + custvendDTOS.get(i).getId());
-            sqls.add("update STK_CUSTVEND2 set CUSTOMER_TYPENAME = case when CUSTOMER_TYPE = 'C0201' then '单位客户' when CUSTOMER_TYPE = 'C0202' then '个人客户' " +
-                    "when CUSTOMER_TYPE = 'S0201' then '单位供应商' when CUSTOMER_TYPE = 'S0202' then '个人供应商' end where id = " + custvendDTOS.get(i).getId());
-            sqls.add("update STK_CUSTVEND2 set IS_VALIDNAME = case when IS_VALID = '1' then '有效' else '无效' end, " +
-                    "ISTEMPORARYNAME = case when ISTEMPORARY = '1' then '是' else '否' end where id = " + custvendDTOS.get(i).getId());
-        }
-        baseDao.execute(sqls);
-    }
-
 
-
-    //获取现金流
-    @Override
-    public void getCashFlowItems(CashFlowItemsVo cashFlowItemsVo , Boolean isdelete) {
-        if(null == cashFlowItemsVo.getData()){
-            return ;
-        }
-        List<CashFlowItemsDataVo> cashFlowItemsDataVo = cashFlowItemsVo.getData().getList();
-        List<String> sqls = new ArrayList<>();
-        if (isdelete) {
-            sqls.add("delete from STK_CASHFLOWDJ");
-        }
-        for (int i = 0; i < cashFlowItemsDataVo.size(); i++) {
-            sqls.add("delete from STK_CASHFLOWDJ where id = " + cashFlowItemsDataVo.get(i).getID());
-            sqls.add("insert into STK_CASHFLOWDJ(ID,NUMBER2,CODE,NAME,LONGNUMBER,LEVEL2,FULLNAME,ISLEAF,CTRLSTRATEGY,SOURCEDATA,BITINDEX,SRCINDEX," +
-                    "TYPE,DIRECTION,ISDEALACTIVITY,ISEXCHANGERATE,ISPREFIT,NOTICE,CHECKITEMHELP,ISASSIST,ISSCHEDULEITEM,MODIFIER_NUMBER," +
-                    "MODIFIER_NAME,CREATEORG_NUMBER,ORG_NUMBER,ORG_NAME,USEORG_NUMBER,USEORG_NAME,STATUS,ENABLE," +
-                    "CREATE_TIME," +
-                    "UPDATE_IME," +
-                    "SOURCE,ASSISTENTRY) " +
-                    "values ("+cashFlowItemsDataVo.get(i).getID()+",'"+cashFlowItemsDataVo.get(i).getNUMBER()+"','"+cashFlowItemsDataVo.get(i).getCODE()+"','"+cashFlowItemsDataVo.get(i).getNAME()+"'" +
-                    ",'"+cashFlowItemsDataVo.get(i).getLONGNUMBER()+"','"+cashFlowItemsDataVo.get(i).getLEVEL()+"','"+cashFlowItemsDataVo.get(i).getFULLNAME()+"','"+cashFlowItemsDataVo.get(i).getISLEAF()+"'" +
-                    ",'"+cashFlowItemsDataVo.get(i).getCTRLSTRATEGY()+"','"+cashFlowItemsDataVo.get(i).getSOURCEDATA()+"','"+cashFlowItemsDataVo.get(i).getBITINDEX()+"','"+cashFlowItemsDataVo.get(i).getSRCINDEX()+"'" +
-                    ",'"+cashFlowItemsDataVo.get(i).getTYPE()+"','"+cashFlowItemsDataVo.get(i).getDIRECTION()+"','"+cashFlowItemsDataVo.get(i).getISDEALACTIVITY()+"','"+cashFlowItemsDataVo.get(i).getISEXCHANGERATE()+"','"+cashFlowItemsDataVo.get(i).getISPREFIT()+"','"+cashFlowItemsDataVo.get(i).getNOTICE()+"'" +
-                    ",'"+cashFlowItemsDataVo.get(i).getCHECKITEMHELP()+"','"+cashFlowItemsDataVo.get(i).getISASSIST()+"','"+cashFlowItemsDataVo.get(i).getISSCHEDULEITEM()+"','"+cashFlowItemsDataVo.get(i).getMODIFIER_NUMBER()+"'" +
-                    ",'"+cashFlowItemsDataVo.get(i).getMODIFIER_NAME()+"','"+cashFlowItemsDataVo.get(i).getCREATEORG_NUMBER()+"','"+cashFlowItemsDataVo.get(i).getORG_NUMBER()+"','"+cashFlowItemsDataVo.get(i).getORG_NAME()+"'" +
-                    ",'"+cashFlowItemsDataVo.get(i).getUSEORG_NUMBER()+"','"+cashFlowItemsDataVo.get(i).getUSEORG_NAME()+"','"+cashFlowItemsDataVo.get(i).getSTATUS()+"','"+cashFlowItemsDataVo.get(i).getENABLE()+"'" +
-                    ",case when '"+cashFlowItemsDataVo.get(i).getCREATE_TIME()+"' = 'null' then null else to_date(to_char(to_timestamp('"+cashFlowItemsDataVo.get(i).getCREATE_TIME()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    ",case when '"+cashFlowItemsDataVo.get(i).getUPDATE_IME()+"' = 'null' then null else to_date(to_char(to_timestamp('"+cashFlowItemsDataVo.get(i).getUPDATE_IME()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    //",'"+cashFlowItemsDataVo.get(i).getSOURCE()+"','"+cashFlowItemsDataVo.get(i).getASSISTENTRY()+"')");
-                    ",'"+cashFlowItemsDataVo.get(i).getSOURCE()+"','')");
-        }
-        baseDao.execute(sqls);
-    }
-
-
-    //获取会计科目
-    @Override
-    public void getAccountantProject(AccountantProjectVo accountantProjectVo , Boolean isdelete) {
-        if(null == accountantProjectVo.getData()){
-            return ;
-        }
-        List<AccountantProjectDataVo> accountantProjectDataVo = accountantProjectVo.getData().getList();
-        List<String> sqls = new ArrayList<>();
-        if (isdelete) {
-            sqls.add("delete from STK_CATEGORYDJ");
-        }
-        for (int i = 0; i < accountantProjectDataVo.size(); i++) {
-            sqls.add("delete from STK_CATEGORYDJ where id = " + accountantProjectDataVo.get(i).getID());
-            sqls.add("insert into STK_CATEGORYDJ(ID,S_ID,S_NUMBER,CODE,NAME,PARENTID,S_PARENTNUM,PARENTCODE,PARENTNAME,LONGNUMBER,LONGNAME,LEVEL2,ISLEAF,ACCOUNTTABLENUMBER,ACCOUNTTABLENAME,ACCOUNTTYPENUMBER,ACCOUNTTYPENAME," +
-                    "PLTYPE,DC,ACCRUALDIRECTION,ISCASH,ISBANK,ISCASHEQUIVALENT,ACNOTICE,ISCHANGECURRENCY,BW,ISQTY,ISASSIST,NOCURRENCYRADIO,DESCURRENCYRADIO,ALLCURRENCYRADIO,ACCTCURRENCY,HELPCODE,ISALLOWCA,ORGCONTROLLEVEL,ISMANUAL,ACCHECK,ISJOURNAL," +
-                    "STARTDATE," +
-                    "ENDDATE," +
-                    "MREUTYPENUMBER,MREUTYPENAME,MEASUREUNITCNUM,MEASUREUNITNAME,CREATEORGCODE,CREATEORGNAME,ORG_NUMBER,ORG_NAME,USEORG_NUMBER,USEORG_NAME,CTRLSTRATEGY,STATUS,ENABLE," +
-                    "CREATE_TIME," +
-                    "UPDATE_TIME," +
-                    "DISABLEDATE," +
-                    "SOURCE,ENTRYCHECKITEM,ENTRYCURRENCY) " +
-                    "values ("+accountantProjectDataVo.get(i).getID()+",'"+accountantProjectDataVo.get(i).getS_ID()+"','"+accountantProjectDataVo.get(i).getS_NUMBER()+"','"+accountantProjectDataVo.get(i).getCODE()+"','"+accountantProjectDataVo.get(i).getNAME()+"'" +
-                    ",'"+accountantProjectDataVo.get(i).getPARENTID()+"','"+accountantProjectDataVo.get(i).getS_PARENTNUM()+"','"+accountantProjectDataVo.get(i).getPARENTCODE()+"','"+accountantProjectDataVo.get(i).getPARENTNAME()+"'" +
-                    ",'"+accountantProjectDataVo.get(i).getLONGNUMBER()+"','"+accountantProjectDataVo.get(i).getLONGNAME()+"','"+accountantProjectDataVo.get(i).getLEVEL()+"','"+accountantProjectDataVo.get(i).getISLEAF()+"'" +
-                    ",'"+accountantProjectDataVo.get(i).getACCOUNTTABLENUMBER()+"','"+accountantProjectDataVo.get(i).getACCOUNTTABLENAME()+"','"+accountantProjectDataVo.get(i).getACCOUNTTYPENUMBER()+"','"+accountantProjectDataVo.get(i).getACCOUNTTYPENAME()+"'" +
-                    ",'"+accountantProjectDataVo.get(i).getPLTYPE()+"','"+accountantProjectDataVo.get(i).getDC()+"','"+accountantProjectDataVo.get(i).getACCRUALDIRECTION()+"','"+accountantProjectDataVo.get(i).getISCASH()+"','"+accountantProjectDataVo.get(i).getISBANK()+"'" +
-                    ",'"+accountantProjectDataVo.get(i).getISCASHEQUIVALENT()+"','"+accountantProjectDataVo.get(i).getACNOTICE()+"','"+accountantProjectDataVo.get(i).getISCHANGECURRENCY()+"','"+accountantProjectDataVo.get(i).getBW()+"','"+accountantProjectDataVo.get(i).getISQTY()+"'" +
-                    ",'"+accountantProjectDataVo.get(i).getISASSIST()+"','"+accountantProjectDataVo.get(i).getNOCURRENCYRADIO()+"','"+accountantProjectDataVo.get(i).getDESCURRENCYRADIO()+"','"+accountantProjectDataVo.get(i).getALLCURRENCYRADIO()+"','"+accountantProjectDataVo.get(i).getACCTCURRENCY()+"','"+accountantProjectDataVo.get(i).getHELPCODE()+"'" +
-                    ",'"+accountantProjectDataVo.get(i).getISALLOWCA()+"','"+accountantProjectDataVo.get(i).getORGCONTROLLEVEL()+"','"+accountantProjectDataVo.get(i).getISMANUAL()+"','"+accountantProjectDataVo.get(i).getACCHECK()+"','"+accountantProjectDataVo.get(i).getISJOURNAL()+"'" +
-                    ",case when '"+accountantProjectDataVo.get(i).getSTARTDATE()+"' = 'null' then null else to_date(to_char(to_timestamp('"+accountantProjectDataVo.get(i).getSTARTDATE()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    ",case when '"+accountantProjectDataVo.get(i).getENDDATE()+"' = 'null' then null else to_date(to_char(to_timestamp('"+accountantProjectDataVo.get(i).getENDDATE()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    ",'"+accountantProjectDataVo.get(i).getMREUTYPENUMBER()+"','"+accountantProjectDataVo.get(i).getMREUTYPENAME()+"','"+accountantProjectDataVo.get(i).getMEASUREUNITCNUM()+"','"+accountantProjectDataVo.get(i).getMEASUREUNITNAME()+"','"+accountantProjectDataVo.get(i).getCREATEORGCODE()+"'" +
-                    ",'"+accountantProjectDataVo.get(i).getCREATEORGNAME()+"','"+accountantProjectDataVo.get(i).getORG_NUMBER()+"','"+accountantProjectDataVo.get(i).getORG_NAME()+"','"+accountantProjectDataVo.get(i).getUSEORG_NUMBER()+"','"+accountantProjectDataVo.get(i).getUSEORG_NAME()+"'" +
-                    ",'"+accountantProjectDataVo.get(i).getCTRLSTRATEGY()+"','"+accountantProjectDataVo.get(i).getSTATUS()+"','"+accountantProjectDataVo.get(i).getENABLE()+"'" +
-                    ",case when '"+accountantProjectDataVo.get(i).getCREATE_TIME()+"' = 'null' then null else to_date(to_char(to_timestamp('"+accountantProjectDataVo.get(i).getCREATE_TIME()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    ",case when '"+accountantProjectDataVo.get(i).getUPDATE_TIME()+"' = 'null' then null else to_date(to_char(to_timestamp('"+accountantProjectDataVo.get(i).getUPDATE_TIME()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    ",case when '"+accountantProjectDataVo.get(i).getDISABLEDATE()+"' = 'null' then null else to_date(to_char(to_timestamp('"+accountantProjectDataVo.get(i).getDISABLEDATE()+"','yyyy-mm-dd hh24:mi:ssxff'),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') end" +
-                    //",'"+accountantProjectDataVo.get(i).getSOURCE()+"','"+accountantProjectDataVo.get(i).getENTRYCHECKITEM()+"','"+accountantProjectDataVo.get(i).getENTRYCURRENCY()+"')");
-                    ",'"+accountantProjectDataVo.get(i).getSOURCE()+"','','"+accountantProjectDataVo.get(i).getENTRYCURRENCY()+"')");
-        }
-        baseDao.execute(sqls);
-    }
-
-    /**
-     * 获取客商数据前,先删除客商信息(暂时)
-     * */
-    @Override
-    public void delete(){
-        baseDao.execute("delete from STK_CUSTVEND2");
-    }
-
-
-    private Map<String, JSONArray> getData(HttpServletRequest request){
-        Map<String, JSONArray> map = new HashMap<>();
-        try {
-            String data = PSHttpUtils.readRaw(request.getInputStream());
-            JSONObject jsonObject = JSON.parseObject(data);
-            Object data1 = jsonObject.get("Data");
-            JSONObject jsonObject1 = JSON.parseObject(StringUtil.nvl(data1,""));
-            Object page1 = jsonObject1.get("Page1");
-            Object page2 = jsonObject1.get("Page2");
-            JSONArray jsonArray = JSON.parseArray(StringUtil.nvl(page1, ""));
-            map.put("main",jsonArray);
-            JSONArray jsonArray1 = JSON.parseArray(StringUtil.nvl(page2, ""));
-            map.put("detail",jsonArray1);
-        } catch (IOException e) {
-            logger.info("参数解析异常信息:"+e.getMessage());
-            e.printStackTrace();
-        }
-        return map;
-    }
-
-
-    /**
-     * 获取header参数
-     * */
-    public Map<String,String> getHeaderParams(HttpServletRequest request){
-        String accessKey = request.getHeader("AccessKey");
-        String timestamp = request.getHeader("Timestamp");
-        String requestId = request.getHeader("RequestId");
-        String signature = request.getHeader("Signature");
-        Map<String,String> headerMap = new HashMap<>();
-        if(!StringUtils.isEmpty(accessKey)){
-            headerMap.put("AccessKey",accessKey);
-        }
-        if(!StringUtils.isEmpty(timestamp)){
-            headerMap.put("Timestamp",timestamp);
-        }
-        if(!StringUtils.isEmpty(requestId)){
-            headerMap.put("RequestId",requestId);
-        }
-        if(!StringUtils.isEmpty(signature)){
-            headerMap.put("Signature",signature);
-        }
-        return headerMap;
-    }
-
-    private JSONObject getJsonData(HttpServletRequest request){
-        JSONObject jsonObject=null;
-        try {
-            String data = PSHttpUtils.readRaw(request.getInputStream());
-            jsonObject = JSON.parseObject(data);
-        } catch (IOException e) {
-            logger.info("参数解析异常信息:"+e.getMessage());
-            e.printStackTrace();
-        }
-        return jsonObject;
+        return Result.success(bomReadResp);
     }
 
 }

+ 67 - 0
src/main/java/com/uas/eis/service/Impl/UserServiceImpl.java

@@ -0,0 +1,67 @@
+package com.uas.eis.service.Impl;
+
+import com.uas.eis.core.support.TokenHandler;
+import com.uas.eis.dao.BaseDao;
+import com.uas.eis.service.UserService;
+import net.sf.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class UserServiceImpl implements UserService {
+
+    @Autowired
+    private BaseDao baseDao;
+
+    @Override
+    @Cacheable(value="loginCache")
+    public String login(String username, String password) {
+        if(checkUser(username, password)) {
+            return TokenHandler.createToken(username, password);
+        }else {
+            return null;
+        }
+    }
+
+    @Override
+    @Cacheable(value="userCache")
+    public Map<String, Object> getUser(String username){
+        //SpObserver.putSp("UAS_TEST");
+        System.out.println("uuuu...........");
+        return baseDao.getJdbcTemplate().queryForMap("select em_auditman from employee where em_name = ?",username);
+    }
+
+    @Override
+    public boolean checkUser(String username, String password) {
+        System.out.println("query user enable cache.....");
+        return baseDao.checkIf("EIS_USER", "eu_enable=-1 and " + "eu_name='" + username + "' and eu_password='" + password + "'");
+    }
+
+    @Override
+    @Cacheable(value="userActionEnableCache")
+    public boolean checkAction(String username, String action) {
+        System.out.println("query user action enable.....");
+        boolean flag = false;
+        String roles = baseDao.queryForObject("select eu_role from eis_user where eu_name='" + username + "'", String.class);
+        String[] fields = {"er_reg","er_action"};
+        if(roles == null) {
+            return false;
+        }
+        List<JSONObject> res = baseDao.getFieldsJSONDatasByCondition("EIS_ROLE", fields, "er_id in (" + roles + ")");
+        for(int o = 0; o< res.size(); o++) {
+            JSONObject data = res.get(o);
+            String reg = data.containsKey("er_reg")?data.getString("er_reg"):"";
+            String act = data.containsKey("er_action")?data.getString("er_action"):"";
+            if(action.matches(reg) || act.indexOf(action) != -1) {
+                flag = true;
+                break;
+            }
+        }
+        return flag;
+    }
+
+}

+ 5 - 64
src/main/java/com/uas/eis/service/STKService.java

@@ -1,78 +1,19 @@
 package com.uas.eis.service;
 
 
-
-import com.alibaba.fastjson.JSONObject;
-import com.uas.eis.sdk.dto.AssistBalanceDTO;
-import com.uas.eis.sdk.dto.CustvendDTO;
-import com.uas.eis.sdk.dto.UpdateCustVendDTO;
-import com.uas.eis.sdk.entity.ApiResult;
-import com.uas.eis.vo.stkVo.AccountantProjectVo;
-import com.uas.eis.vo.stkVo.CashFlowItemsVo;
-import com.uas.eis.vo.stkVo.TravellingMerchantVo;
+import com.uas.eis.beans.result.Result;
+import com.uas.eis.sdk.dto.BomReq;
+import com.uas.eis.sdk.dto.ProductReq;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Map;
 
 /**
  * @author zhuxl
  * @date 2024-10-12
  */
 public interface STKService {
-    /**
-     * 获取科目余额表-总条数
-     */
-    ApiResult<String> getAssistBalanceCount(HttpServletRequest request, AssistBalanceDTO dto);
-
-
-    /**
-     * 获取科目余额表
-     */
-    ApiResult<String> getAssistBalance(HttpServletRequest request, AssistBalanceDTO dto);
-
-
-    /**
-     * 现金流量表-总条数
-     */
-    ApiResult<String> getCashFlowCount(HttpServletRequest request, AssistBalanceDTO dto);
-
-
-    /**
-     * 现金流量表
-     */
-    ApiResult<String> getCashFlow(HttpServletRequest request, AssistBalanceDTO dto);
-
-
-    /**
-     * 客户供应商修改
-     */
-    ApiResult<String> updateCustVend( UpdateCustVendDTO dto);
-
-    /**
-     * 接口测试
-     * */
-    ApiResult<String> getAssistBalanceCountTest(HttpServletRequest request, AssistBalanceDTO dto);
-
-    /**
-     * 获取客商信息
-     * */
-    void getCustvend(TravellingMerchantVo travellingMerchantVo , Boolean isdelete);
-
-    /**
-     * 获取客商信息(当天)
-     * */
-    void getCustvendDay(TravellingMerchantVo travellingMerchantVo , Boolean isdelete);
-
-    /**
-     * 获取现金流
-     * */
-    void getCashFlowItems(CashFlowItemsVo cashFlowItemsVo , Boolean isdelete);
 
-    /**
-     * 获取会计科目
-     * */
-    void getAccountantProject(AccountantProjectVo accountantProjectVo , Boolean isdelete);
+    Result getProduct(HttpServletRequest request, ProductReq productReq);
 
-    void delete();
+    Result getBom(BomReq bomReq);
 }

+ 15 - 0
src/main/java/com/uas/eis/service/UserService.java

@@ -0,0 +1,15 @@
+package com.uas.eis.service;
+
+import java.util.Map;
+
+public interface UserService {
+
+    public abstract String login(String username, String password);
+
+    public abstract Map<String, Object> getUser(String username);
+
+    public abstract boolean checkUser(String username, String password);
+
+    public abstract boolean checkAction(String username, String action);
+
+}

+ 0 - 303
src/main/java/com/uas/eis/task/STKTask.java

@@ -1,303 +0,0 @@
-package com.uas.eis.task;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.uas.eis.dto.stksto.QueryAccountantProjectDto;
-import com.uas.eis.dto.stksto.QueryCashFlowItemsDto;
-import com.uas.eis.dto.stksto.QueryTravellingMerchantDto;
-import com.uas.eis.dto.stksto.StkCommonDto;
-import com.uas.eis.sdk.dto.CustvendDTO;
-import com.uas.eis.service.RequestSTKService;
-import com.uas.eis.service.STKService;
-import com.uas.eis.vo.stkVo.AccountantProjectVo;
-import com.uas.eis.vo.stkVo.CashFlowItemsVo;
-import com.uas.eis.vo.stkVo.HttpResultResponse;
-import com.uas.eis.vo.stkVo.TravellingMerchantVo;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-@Slf4j
-@Component
-public class STKTask {
-
-    /**
-     * 复杂查询接口请求地址
-     * */
-    @Value("${STK.complexity_query_url}")
-    private String COMPLEXITY_QUERY_URL;
-
-    /**
-     * 获取客商信息接口编码
-     * */
-    @Value("${STK.get_travelling_merchant}")
-    private String GET_TRAVELLING_MERCHANT;
-
-    /**
-     * 获取客商状态反馈信息
-     * */
-    @Value("${STK.get_travelling_merchant_status}")
-    private String GET_TRAVELLING_MERCHANT_STATUS;
-
-    @Autowired
-    RequestSTKService requestSTKService;
-
-    @Autowired
-    private STKService stkService;
-
-    /*@Scheduled(cron = "0 55 22 * * ?")
-    public void getSellerOrders(){
-        log.info("开始获取深投控客商状态信息=========start=============");
-        Date date = new Date();
-
-        QueryTravellingMerchantDto dto = new QueryTravellingMerchantDto();
-        dto.setCode(GET_TRAVELLING_MERCHANT);
-        dto.setPage(1);
-        dto.setSize(500);
-
-        TravellingMerchantVo travellingMerchantVo = new TravellingMerchantVo();
-        Boolean exception = false;
-        try{
-            travellingMerchantVo =  requestSTKService.selectTravellingMerchantList(dto,COMPLEXITY_QUERY_URL);
-        }catch (Exception e){
-            log.info("获取客商信息数据异常:{}",e.getMessage());
-            exception = true;
-        }
-        log.info("定时任务获取深投控客商信息数据结果:{}", JSONObject.toJSONString(travellingMerchantVo));
-        //第一次删除STK_CUSTVEND的数据
-        stkService.getCustvend(travellingMerchantVo, true);
-        if (travellingMerchantVo.getData().getHasNextPage()){
-            Boolean isBreak = true;
-            while(isBreak) {
-                if(!exception){
-                    dto.setPage(travellingMerchantVo.getData().getNextPage());
-                }
-                log.info("while循环获取客商数据,查询参数:{}",JSONObject.toJSONString(dto));
-                try{
-                    travellingMerchantVo = requestSTKService.selectTravellingMerchantList(dto, COMPLEXITY_QUERY_URL);
-                }catch (Exception e){
-                    log.info("获取客商信息数据异常:{}",e.getMessage());
-                    exception = true;
-                }
-                stkService.getCustvend(travellingMerchantVo, false);
-                if (!travellingMerchantVo.getData().getHasNextPage() || dto.getSize() > travellingMerchantVo.getData().getEndRow()){
-                    isBreak = false;
-                }
-            }
-        }
-        log.info("定时任务获取深投控客商信息数据结果2:{}", JSONObject.toJSONString(travellingMerchantVo));
-
-        log.info("开始获取深投控客商状态信息,结束:"+((System.currentTimeMillis()-date.getTime())/1000));
-    }*/
-
-    //客商获取
-    //@Scheduled(cron = "0 56 23 * * ?")
-    public void queryCustVendQuartz(){
-        log.info("开始获取深投控客商状态信息=========start=============");
-        Date date = new Date();
-
-        QueryTravellingMerchantDto dto = new QueryTravellingMerchantDto();
-        dto.setCode(GET_TRAVELLING_MERCHANT);
-        dto.setPage(1);
-        dto.setSize(500);
-
-        //第一次删除STK_CUSTVEND的数据
-        stkService.delete();
-        //是否跳出循环
-        Boolean isBreak = true;
-        //是否发生异常
-        Boolean exception = false;
-        //异常跳过次数
-        Integer num = 0;
-        while(isBreak) {
-            if(num >=5){
-                break;
-            }
-            log.info("while循环获取客商数据,查询参数:{}",JSONObject.toJSONString(dto));
-            TravellingMerchantVo travellingMerchantVo = new TravellingMerchantVo();
-            try{
-                travellingMerchantVo = requestSTKService.selectTravellingMerchantList(dto, COMPLEXITY_QUERY_URL);
-                if(travellingMerchantVo.getCode() != 200){
-                    num = num +1;
-                    continue;
-                }
-                //获取到客商数据,数据入库
-                stkService.getCustvend(travellingMerchantVo, false);
-                exception = false;
-            }catch (Exception e){
-                log.info("获取客商信息数据异常:{}",e.getMessage());
-                exception = true;
-                num = num +1;
-            }
-            //判断没发生异常,且是最后一页条件判断==》没有下页编码,或者返回的数据量小于每次查询的每页数量
-            if (!exception && null != travellingMerchantVo && null != travellingMerchantVo.getData() && dto.getSize() > travellingMerchantVo.getData().getEndRow()){
-                isBreak = false;
-            }
-            if(!exception){
-                dto.setPage(travellingMerchantVo.getData().getNextPage());
-            }
-            log.info("定时任务获取深投控客商信息数据结果2:{}", JSONObject.toJSONString(travellingMerchantVo));
-        }
-        log.info("开始获取深投控客商状态信息,结束:"+((System.currentTimeMillis()-date.getTime())/1000));
-    }
-
-    //客商获取(当天)
-    //@Scheduled(cron = "0 41 18 * * ?")
-    public void queryCustVendDayQuartz(){
-        log.info("开始获取深投控客商状态信息=========start=============");
-        Date date = new Date();
-
-        Calendar start=Calendar.getInstance();
-
-        int month=start.get(Calendar.MONTH) + 1;
-        log.info("开始时间:"+start.get(Calendar.YEAR)+"-"+month+"-"+start.get(Calendar.DAY_OF_MONTH)+" 00:00:00");
-        log.info("结束时间:"+start.get(Calendar.YEAR)+"-"+month+"-"+start.get(Calendar.DAY_OF_MONTH)+" 23:59:59");
-        QueryTravellingMerchantDto dto = new QueryTravellingMerchantDto();
-        dto.setCode(GET_TRAVELLING_MERCHANT);
-        dto.setPage(1);
-        dto.setSize(500);
-        dto.setStart_time(start.get(Calendar.YEAR)+"-"+month+"-"+start.get(Calendar.DAY_OF_MONTH)+" 00:00:00");
-        dto.setEnd_time(start.get(Calendar.YEAR)+"-"+month+"-"+start.get(Calendar.DAY_OF_MONTH)+" 23:59:59");
-
-        //是否跳出循环
-        Boolean isBreak = true;
-        //是否发生异常
-        Boolean exception = false;
-        //异常跳过次数
-        Integer num = 0;
-        while(isBreak) {
-            if(num >=5){
-                break;
-            }
-            log.info("while循环获取客商数据,查询参数:{}",JSONObject.toJSONString(dto));
-            TravellingMerchantVo travellingMerchantVo = new TravellingMerchantVo();
-            try{
-                travellingMerchantVo = requestSTKService.selectTravellingMerchantList(dto, COMPLEXITY_QUERY_URL);
-                if(travellingMerchantVo.getCode() != 200){
-                    num = num +1;
-                    continue;
-                }
-                //获取到客商数据,数据入库
-                stkService.getCustvendDay(travellingMerchantVo, false);
-                exception = false;
-            }catch (Exception e){
-                log.info("获取客商信息数据异常:{}",e.getMessage());
-                exception = true;
-                num = num +1;
-            }
-            //判断没发生异常,且是最后一页条件判断==》没有下页编码,或者返回的数据量小于每次查询的每页数量
-            if (!exception && null != travellingMerchantVo && null != travellingMerchantVo.getData() && dto.getSize() > travellingMerchantVo.getData().getEndRow()){
-                isBreak = false;
-            }
-            if(!exception){
-                dto.setPage(travellingMerchantVo.getData().getNextPage());
-            }
-            log.info("定时任务获取深投控客商信息数据结果2:{}", JSONObject.toJSONString(travellingMerchantVo));
-        }
-        log.info("开始获取深投控客商状态信息,结束:"+((System.currentTimeMillis()-date.getTime())/1000));
-    }
-
-
-    //现金流项目
-    //@Scheduled(cron = "0 35 23 * * ?")
-    public void queryCashFlowItems(){
-        //StkCommonDto dto = new StkCommonDto();
-        QueryCashFlowItemsDto dtoParam = new QueryCashFlowItemsDto();
-        /*dto.setPage(String.valueOf(pageXjl));
-        dto.setSize("500");
-        dto.setParam(dtoParam);*/
-        Integer page = 1;
-        Integer size = 100;
-        //是否跳出循环
-        Boolean isBreak = true;
-        //是否发生异常
-        Boolean exception = false;
-        //异常跳过次数
-        Integer num = 0;
-        while(isBreak) {
-            if (num >= 5) {
-                break;
-            }
-            CashFlowItemsVo cashFlowItemsVo = new CashFlowItemsVo();
-            try {
-                HttpResultResponse resultResponse = requestSTKService.buildPostParam(page,size,dtoParam);
-                cashFlowItemsVo = JSONObject.parseObject(resultResponse.getBody(),CashFlowItemsVo.class);
-                if (cashFlowItemsVo.getCode() != 200) {
-                    num = num + 1;
-                    continue;
-                }
-                //获取到现金流项目,数据入库
-                stkService.getCashFlowItems(cashFlowItemsVo, true);
-                exception = false;
-            }catch (Exception e){
-                log.info("获取现金流异常:{}",e.getMessage());
-                exception = true;
-                num = num +1;
-            }
-            //判断没发生异常,且是最后一页条件判断==》没有下页编码,或者当前页数等于返回页数
-            if (!exception && null != cashFlowItemsVo && page >= cashFlowItemsVo.getPages()){
-                isBreak = false;
-            }
-
-            if(!exception){
-                page = page +1;
-            }
-        }
-    }
-
-
-    //获取会计科目
-    //@Scheduled(cron = "0 05 01 * * ?")
-    public void queryAccountantProject() {
-        QueryAccountantProjectDto dto = new QueryAccountantProjectDto();
-        Integer page = 1;
-        Integer size = 500;
-        //是否跳出循环
-        Boolean isBreak = true;
-        //是否发生异常
-        Boolean exception = false;
-        //异常跳过次数
-        Integer num = 0;
-        while (isBreak) {
-            if (num >= 5) {
-                break;
-            }
-            log.info("while循环会计科目,查询参数:{}", JSONObject.toJSONString(dto));
-            HttpResultResponse resultResponse = new HttpResultResponse();
-            AccountantProjectVo accountantProjectVo = null;
-            try {
-                resultResponse = requestSTKService.buildKMPostParam(page, size ,dto);
-                accountantProjectVo = JSONObject.parseObject(resultResponse.getBody(),AccountantProjectVo.class);
-                if (accountantProjectVo.getCode() != 200) {
-                    num = num + 1;
-                    continue;
-                }
-                //获取到现金流项目,数据入库
-                stkService.getAccountantProject(accountantProjectVo, true);
-                exception = false;
-            } catch (Exception e) {
-                log.info("获取现金流异常:{}", e.getMessage());
-                exception = true;
-                num = num + 1;
-            }
-            //判断没发生异常,且是最后一页条件判断==》没有下页编码,或者当前页数等于返回页数
-            if (!exception && null != accountantProjectVo && null != accountantProjectVo.getData() && page >= accountantProjectVo.getPages()) {
-                isBreak = false;
-            }
-
-            if (!exception) {
-                page = page + 1;
-            }
-        }
-    }
-
-
-}

+ 207 - 0
src/main/java/com/uas/eis/utils/BeanMapper.java

@@ -0,0 +1,207 @@
+package com.uas.eis.utils;
+
+import com.alibaba.fastjson.JSON;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Function;
+
+/**
+ * @author yingp
+ * @date 2018/10/1
+ */
+public class BeanMapper {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(BeanMapper.class);
+
+    /**
+     * 对象属性复制
+     *
+     * @param source
+     * @param targetCls
+     * @param <T>
+     * @return
+     */
+    public static <T> T map(Object source, Class<T> targetCls) {
+        if (null == source) {
+            return null;
+        }
+        try {
+            Object target = targetCls.newInstance();
+            // TODO 考虑dozer工具
+            BeanUtils.copyProperties(source, target);
+            return (T) target;
+        } catch (Exception e) {
+            LOGGER.error("bean convert error, source " + JSON.toJSONString(source) + ", target class " + targetCls,
+                    e);
+            return null;
+        }
+    }
+
+    /**
+     * 对象转map
+     *
+     * @param source
+     * @return
+     */
+//    public static Map map(Object source) {
+//        if (null == source) {
+//            return null;
+//        }
+//        try {
+//            return JsonUtils.fromJsonString(JsonUtils.toJsonString(source), Map.class);
+//        } catch (Exception e) {
+//            LOGGER.error("bean convert error, source " + JsonUtils.toJsonString(source), e);
+//            return null;
+//        }
+//    }
+
+    /**
+     * 集合对象属性复制
+     *
+     * @param source
+     * @param targetCls
+     * @param <T>
+     * @return
+     */
+    public static <T> List<T> mapList(Collection source, Class<T> targetCls) {
+        if (!CollectionUtils.isEmpty(source)) {
+            List<T> targets = new ArrayList<>(source.size());
+            source.forEach(s -> {
+                targets.add(map(s, targetCls));
+            });
+            return targets;
+        }
+        return source == null ? null : Collections.emptyList();
+    }
+
+    /**
+     * 集合对象转mapList
+     *
+     * @param source
+     * @return
+     */
+//    public static List<Map> mapList(Collection source) {
+//        if (!CollectionUtils.isEmpty(source)) {
+//            List<Map> targets = new ArrayList<>(source.size());
+//            source.forEach(s -> {
+//                targets.add(map(s));
+//            });
+//            return targets;
+//        }
+//        return source == null ? null : Collections.emptyList();
+//    }
+
+    /**
+     * 集合对象属性复制
+     *
+     * @param source
+     * @param converter
+     * @param <T>
+     * @return
+     */
+    public static <T, V> List<T> mapList(Collection<? extends V> source, Function<V, T> converter) {
+        if (!CollectionUtils.isEmpty(source)) {
+            List<T> targets = new ArrayList<>(source.size());
+            source.forEach(s -> {
+                targets.add(converter.apply(s));
+            });
+            return targets;
+        }
+        return source == null ? null : Collections.emptyList();
+    }
+
+    /**
+     * 分页对象转换
+     *
+     * @param page
+     * @param targetCls
+     * @param <T>
+     * @return
+     */
+//    public static <T> PageInfo<T> mapPage(Page page, Class<T> targetCls) {
+//        PageInfo<T> pageInfo = new PageInfo<>();
+//        if (!CollectionUtils.isEmpty(page)) {
+//            pageInfo.setList(mapList(page, targetCls));
+//            pageInfo.setTotal(page.getTotal());
+//            pageInfo.setPages(page.getPages());
+//        } else {
+//            pageInfo.setList(Collections.EMPTY_LIST);
+//        }
+//        return pageInfo;
+//    }
+//
+//    /**
+//     * 分页对象转换
+//     *
+//     * @param page
+//     * @return
+//     */
+//    public static PageInfo<Map> mapPage(Page page) {
+//        PageInfo<Map> pageInfo = new PageInfo<>();
+//        if (!CollectionUtils.isEmpty(page)) {
+//            pageInfo.setList(mapList(page));
+//            pageInfo.setTotal(page.getTotal());
+//            pageInfo.setPages(page.getPages());
+//        } else {
+//            pageInfo.setList(Collections.EMPTY_LIST);
+//        }
+//        return pageInfo;
+//    }
+//
+//    /**
+//     * 分页对象转换
+//     *
+//     * @param oldPageInfo
+//     * @param targetCls
+//     * @param <T>
+//     * @return
+//     */
+//    public static <T> PageInfo<T> mapPage(PageInfo oldPageInfo, Class<T> targetCls) {
+//        PageInfo<T> pageInfo = new PageInfo<>();
+//        if (!CollectionUtils.isEmpty(oldPageInfo.getList())) {
+//            pageInfo.setList(mapList(oldPageInfo.getList(), targetCls));
+//            pageInfo.setTotal(oldPageInfo.getTotal());
+//            pageInfo.setPages(oldPageInfo.getPages());
+//        }
+//        return pageInfo;
+//    }
+//
+//    /**
+//     * 分页对象转换
+//     *
+//     * @param oldPageInfo
+//     * @return
+//     */
+//    public static PageInfo<Map> mapPage(PageInfo oldPageInfo) {
+//        PageInfo<Map> pageInfo = new PageInfo<>();
+//        if (!CollectionUtils.isEmpty(oldPageInfo.getList())) {
+//            pageInfo.setList(mapList(oldPageInfo.getList()));
+//            pageInfo.setTotal(oldPageInfo.getTotal());
+//            pageInfo.setPages(oldPageInfo.getPages());
+//        }
+//        return pageInfo;
+//    }
+//
+//    /**
+//     * 分页对象转换
+//     *
+//     * @param oldPageInfo
+//     * @return
+//     */
+//    public static <T, V> PageInfo<T> mapPage(PageInfo<V> oldPageInfo, Function<V, T> converter) {
+//        PageInfo<T> pageInfo = new PageInfo<>();
+//        if (!CollectionUtils.isEmpty(oldPageInfo.getList())) {
+//            pageInfo.setList(mapList(oldPageInfo.getList(), converter));
+//            pageInfo.setTotal(oldPageInfo.getTotal());
+//            pageInfo.setPages(oldPageInfo.getPages());
+//        }
+//        return pageInfo;
+//    }
+}

+ 10 - 11
src/main/java/com/uas/eis/utils/HttpTookit.java

@@ -1,12 +1,5 @@
 package com.uas.eis.utils;
 
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.net.ssl.SSLContext;
-
 import com.google.gson.Gson;
 import com.uas.eis.beans.HttpResponseMessageVO;
 import com.uas.eis.beans.req.Req;
@@ -29,6 +22,12 @@ import org.apache.http.util.EntityUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.net.ssl.SSLContext;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.HashMap;
+import java.util.Map;
+
 
 /**
  * https 请求工具类
@@ -130,7 +129,7 @@ public class HttpTookit {
         Result<String> result = new Result<String>();
         if (StringUtils.isEmpty(url)) {
             result.setCode(Constants.interfaceException.ILLEGAL_ARGUMENT.code);
-            result.setMsg(Constants.interfaceException.ILLEGAL_ARGUMENT.msg + ":" + url);
+            result.setMessage(Constants.interfaceException.ILLEGAL_ARGUMENT.msg + ":" + url);
             return result;
         }
         CloseableHttpResponse response = null;
@@ -149,13 +148,13 @@ public class HttpTookit {
                 result.setData(EntityUtils.toString(entity, CHARSET));
             } else {
                 result.setCode(Constants.interfaceException.INTERFACE_EXCEPTION.code);
-                result.setMsg(Constants.interfaceException.INTERFACE_EXCEPTION.msg + ":" + url + ",HTTP Status Code:"
+                result.setMessage(Constants.interfaceException.INTERFACE_EXCEPTION.msg + ":" + url + ",HTTP Status Code:"
                         + statusCode);
             }
         } catch (Exception e) {
             LOG.error("sendPostByJson error, details:", e);
             result.setCode(Constants.interfaceException.INTERFACE_EXCEPTION.code);
-            result.setMsg("发送请求异常,请检查url、参数的合法性!异常错误:" + e.getMessage());
+            result.setMessage("发送请求异常,请检查url、参数的合法性!异常错误:" + e.getMessage());
         }finally{
             try{
                 if(entity != null){
@@ -184,7 +183,7 @@ public class HttpTookit {
         try {
             t = clazz.newInstance();
             t.setErrorCode(result.getCode());
-            t.setErrorMessage(result.getMsg());
+            t.setErrorMessage(result.getMessage());
         } catch (Exception e) {
             LOG.error("sendPostByJson error, details:", e);
         }

+ 3 - 3
src/main/java/com/uas/eis/utils/OpenAPIUtils.java

@@ -246,7 +246,7 @@ public class OpenAPIUtils {
         try {
             t = clazz.newInstance();
             t.setErrorCode(result.getCode());
-            t.setErrorMessage(result.getMsg());
+            t.setErrorMessage(result.getMessage());
         } catch (Exception e) {
             LOG.error("doPost error, details:", e);
         }
@@ -265,12 +265,12 @@ public class OpenAPIUtils {
                 result.setData(resp.getContent());
             } else {
                 result.setCode(Constants.interfaceException.INTERFACE_EXCEPTION.code);
-                result.setMsg(Constants.interfaceException.INTERFACE_EXCEPTION.msg.concat(",HTTP Status Code:").concat(
+                result.setMessage(Constants.interfaceException.INTERFACE_EXCEPTION.msg.concat(",HTTP Status Code:").concat(
                         resp.getHttpCode()));
             }
         } catch (BaseException e) {
             LOG.error("doPost error, details:", e);
-            result.setMsg(e.getMessage());
+            result.setMessage(e.getMessage());
             result.setCode(e.getCode());
         }
 

+ 1 - 1
src/main/resources/api_sign_key_mapping.properties

@@ -6,4 +6,4 @@ syncProduct=updateItemByErp
 syncMakeBase=updateProdByErp
 syncMakeBaseDetail=updateProdBomByErp
 syncUpdateReceiveByErp=updateReceiveByErp
-SISEMI=SISEMI
+STW_TEST=STW_TEST

+ 2 - 2
src/main/resources/application-dev.yml

@@ -2,9 +2,9 @@ spring:
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
         driverClassName: oracle.jdbc.OracleDriver
-        username: SZSI_P
+        username: STW_TEST
         password: select!#%*(
-        url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
+        url: jdbc:oracle:thin:@10.1.81.208:11559:orcl
         initialSize: 1
         maxActive: 3
         maxWait: 30000

+ 3 - 3
src/main/resources/application-prod.yml

@@ -2,9 +2,9 @@ spring:
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
         driverClassName: oracle.jdbc.OracleDriver
-        username: SZSI_P
+        username: STW_TEST
         password: select!#%*(
-        url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
+        url: jdbc:oracle:thin:@10.1.81.208:11559:orcl
         initialSize: 1
         maxActive: 3
         maxWait: 30000
@@ -22,7 +22,7 @@ server:
     tomcat:
         uri_encoding: UTF-8
     context-path:
-        /eis_cw
+        /eis
     port: 8186
 
 action: