1.根据需求梳理接口参数,新增接口方法
2.在接口实现类中实现
3.在controller层中指定路径调用
4.用postman测试
5.新增接口数据到yapi中与相关人员联调
- 根据需求梳理接口参数,新增接口方法
package com.yonyou.imp.wsr.service.heatfurnacetrack;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotNull;
/**
* @Description 加热炉内跟踪相关接口
* @Author liukl
* @Date 2021/12/17 19:42
* @Version 1.0
*/
public interface IHeatFurnacetrackService {
/**
* @param time: 到达预热区时间
* @param idNo: 物件号
* @param intoFurnaceNo: 入炉序号
* @param org_id: 工厂
* @param work_station_id: 工作站
* @param machine_id: 机台
* @Description:到达预热区接口实现
* @return: 是否成功
**/
@Transactional
void toPreheatingZone(String org_id, String work_station_id, String machine_id, String time, String idNo, String intoFurnaceNo) throws Exception;
/**
* @param time: 退炉时间
* @param org_id: 工厂
* @param work_station_id: 工作站
* @param machine_id: 机台
* @param idNo: 物件号
* @param intoFurnaceNo: 入炉序号
* @param isSoaking: 是否持温
* @param poorQualityCode: 品质不佳
* @param equipmentAbnormal: 设备异常
* @Description:退炉接口
**/
@Transactional
void rejectFurnace(String org_id, String work_station_id, String machine_id, String time, String idNo, String intoFurnaceNo, Boolean isSoaking, String poorQualityCode, String equipmentAbnormal) throws Exception;
}
- 在实现类中实现
@Override
public void rejectFurnace(String org_id, String work_station_id, String machine_id, String time, String idNo, String intoFurnaceNo, String isSoaking, String poorQualityCode, String equipmentAbnormal) throws Exception {
/**
* 0.准备参数
**/
Map<String, Object> data = toPreQuery(idNo, intoFurnaceNo);
HashMap<String, String> param = new HashMap<>();
param.put("soaking", isSoaking);
param.put("poor_quality_code", poorQualityCode);
param.put("equipment_abnormal", equipmentAbnormal);
/**
* 1.更新入炉记录历史档
**/
updateFurnaceSteped(time, data);
/**
* 2.更新入炉记录,插入出炉剔除表,更新工序实绩、投产记录、储区现况档、生产放行记录表(现况&历史)、投料明细表
**/
keepTrackFurnaceService.BatchOutReject((List<BizObject>) data, data.get("org_id").toString(), PROD_OPERATION_CODE, param);
return;
}
- 在controller层中指定路径调用
@PostMapping("/toOutReject")
public void toOutReject(@RequestBody JSONObject parameters, HttpServletResponse response) {
try {
checkParamsForReject(parameters);
heatFurnaceTrackService.rejectFurnace(parameters.get("org_id").toString(), parameters.get("work_station_id").toString(), parameters.get("machine_id").toString(), parameters.get("time").toString(), parameters.get("id_no").toString(), parameters.get("in_furnaces_no").toString(), parameters.get("soaking").toString(), parameters.get("poor_quality_code").toString(), parameters.get("equipment_abnormal").toString());
renderJson(response, ResultMessage.success());
} catch (Exception e) {
renderJson(response, ResultMessage.error(e.getMessage()));
}
}
- 用postman测试
5. 新增接口数据到yapi中与相关人员联调