12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- package com.huimv.manage.controller;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import com.huimv.manage.service.IApplyService;
- import com.huimv.manage.util.Result;
- import com.huimv.manage.util.ResultCode;
- import com.huimv.manage.webservice.Soap;
- import com.huimv.manage.webservice.task.NewProduceMission;
- 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.CrossOrigin;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import java.io.UnsupportedEncodingException;
- /**
- * @Project : huimv.shiwan
- * @Package : com.huimv.biosafety.uface.controller
- * @Description : TODO
- * @Version : 1.0
- * @Author : ZhuoNing
- * @Create : 2020-12-25
- **/
- @CrossOrigin
- @RestController
- @Slf4j
- @RequestMapping(value = "/apply")
- public class ApplyController {
- @Value("${webservice.url}")
- private String webServiceUrl;
- @Value("${webservice.producerId}")
- private String producerId;
- @Autowired
- private IApplyService applyService;
- @Autowired
- private Soap soap;
- @Autowired
- private NewProduceMission newProduceMission;
- /**
- * @Method : listTask
- * @Description :
- * @Params : []
- * @Return : java.lang.String
- *
- * @Author : ZhuoNing
- * @Date : 2021/10/27
- * @Time : 20:28
- */
- @RequestMapping(value = "/listApply",method = RequestMethod.GET)
- public Result listApply(){
- return applyService.listApply();
- }
- /**
- * @Method : getNewTask
- * @Description :
- * @Params : []
- * @Return : java.lang.String
- *
- * @Author : ZhuoNing
- * @Date : 2021/10/27
- * @Time : 20:29
- */
- @RequestMapping(value = "/getNewApply",method = RequestMethod.GET)
- public Result getNewTask() throws UnsupportedEncodingException {
- log.info("producerId>>"+producerId);
- log.info("webServiceUrl>>"+webServiceUrl);
- //
- JSONArray applyJa = newProduceMission.parseApplyXML(soap.callSoap(newProduceMission.getNewMissionText(producerId),webServiceUrl));
- //
- // JSONArray applyJa = newProduceMission.parseApplyXML(newProduceMission.getNewMessionResult());
- if(applyJa.size() > 0){
- // System.out.println("获取任务号:"+applyJa.size());
- // for(int a=0;a<applyJa.size();a++){
- // JSONObject applyJo = applyJa.getJSONObject(a);
- // System.out.println(applyJo);
- // }
- // 保存新任务(号)
- return applyService.saveNewMission(applyJa);
- }else{
- return new Result(ResultCode.SUCCESS,"目前暂无新任务.");
- }
- }
- }
|