package com.malk.eastar.controller; import com.alibaba.fastjson.JSONObject; import com.malk.eastar.service.YidaService; import com.malk.server.common.McException; import com.malk.server.common.McR; import com.malk.utils.UtilMap; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Map; /** * 专用于宜搭复杂逻辑处理的接口服务 * add by Jason 20260317 */ @Slf4j @RestController @RequestMapping("/yida") public class EastarYidaController { @Autowired private YidaService yidaService; /** * 供宜搭应用检查当前接口服务是否可用 * @param data * @return */ @PostMapping("/test") McR heartbeatTest(@RequestBody JSONObject data) { log.info("心跳测试, {}", data); McException.assertParamException_Null(data, "param"); String param = UtilMap.getString(data, "param"); Map result = yidaService.heartbeatTest(param); if(result.get("error") == null){ return McR.success(result); }else{ return McR.error("400",result.get("error").toString()); } } /** * 【立项/项目台账】→【配件任务表】数据流转 */ @PostMapping("/addtask") McR createPartsTask(@RequestBody JSONObject data) { log.info("【立项/项目台账】→【配件任务表】数据流转, {}", data); McException.assertParamException_Null(data, "formInstId"); String formInstId = UtilMap.getString(data, "formInstId"); Map result=yidaService.createPartsTask(formInstId); if(result.get("error") == null){ return McR.success(result); }else{ return McR.error("400",result.get("error").toString()); } } }