Commit d9acd7d3 authored by limei's avatar limei

修改表单接口

parent 85c55866
...@@ -22,6 +22,6 @@ public interface CheckModelMapper extends BaseMapper<CheckModel> { ...@@ -22,6 +22,6 @@ public interface CheckModelMapper extends BaseMapper<CheckModel> {
String saveModel(JSONObject jsonObject); String saveModel(JSONObject jsonObject);
String modifyModel(CheckModel checkModel); Boolean modifyModel(JSONObject jsonObject);
} }
...@@ -65,7 +65,7 @@ public interface CheckModelService extends IService<CheckModel> { ...@@ -65,7 +65,7 @@ public interface CheckModelService extends IService<CheckModel> {
String saveModel(JSONObject jsonObject); String saveModel(JSONObject jsonObject);
String modifyModel(CheckModel checkModel); Boolean modifyModel(JSONObject jsonObject);
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<update id="modifyModel"> <update id="modifyModel">
update tdc_model SET model_name=#{modelName},amos_org_code=#{amosOrgCode},idx_table_name=#{idxTableName}, update tdc_model set model_name=#{model_name},amos_org_code=#{amos_org_code},idx_table_name=#{idx_table_name},
model_rule=#{modelRule},model_file=#{modelFile},model_picture_url=#{modelPictureUrl} where sequence_nbr=#{sequenceNbr} model_rule=#{modelRule} where sequence_nbr=#{sequenceNbr}
</update> </update>
</mapper> </mapper>
...@@ -128,8 +128,9 @@ public class CheckModelController extends BaseController { ...@@ -128,8 +128,9 @@ public class CheckModelController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/modifyModel") @PostMapping(value = "/modifyModel")
@ApiOperation(httpMethod = "POST", value = "根据sequenceNbr修改模型校验表单", notes = "根据sequenceNbr修改模型校验表单") @ApiOperation(httpMethod = "POST", value = "根据sequenceNbr修改模型校验表单", notes = "根据sequenceNbr修改模型校验表单")
public ResponseModel<String> modifyModel(@RequestBody CheckModel checkModel) { public ResponseModel<Boolean> modifyModel(@RequestBody JSONObject jsonObject) {
return ResponseHelper.buildResponse(checkModelService.modifyModel(checkModel)); // checkModelService.updateById(checkModel);
return ResponseHelper.buildResponse(checkModelService.modifyModel(jsonObject));
} }
} }
...@@ -254,17 +254,19 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im ...@@ -254,17 +254,19 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
// String amosOrgCode = text.substring(0,text.indexOf("$")); // String amosOrgCode = text.substring(0,text.indexOf("$"));
// 截取$之后的所有字符串 // 截取$之后的所有字符串
// String amosOrgName = text.substring(text.indexOf("$")+1); // String amosOrgName = text.substring(text.indexOf("$")+1);
String url = jsonObject.getString("url"); String url = jsonObject.getString("idx_table_name");
// 截取$之前的所有字符串 // 截取$之前的所有字符串
String tableId = url.substring(0,url.indexOf("$")); String tableId = url.substring(0,url.indexOf("$"));
// 截取$之后的所有字符串 // 截取$之后的所有字符串
String idxTableName = url.substring(url.indexOf("$")+1); String idxTableName = url.substring(url.indexOf("$")+1);
JSONArray modelPictureUrl = jsonObject.getJSONArray("model_picture_url"); JSONArray modelPictureUrl = jsonObject.getJSONArray("model_picture_url");
String pictureUrl = ""; String pictureUrl = "";
for (Object o : modelPictureUrl) { if(!ValidationUtil.isEmpty(modelPictureUrl)){
JSONObject jo = JSON.parseObject(JSON.toJSONString(o)); for (Object o : modelPictureUrl) {
pictureUrl = jo.getString("url"); JSONObject jo = JSON.parseObject(JSON.toJSONString(o));
break; pictureUrl = jo.getString("url");
break;
}
} }
String modelRule = jsonObject.getString("model_rule"); String modelRule = jsonObject.getString("model_rule");
if(!ValidationUtil.isEmpty(modelRule)){ if(!ValidationUtil.isEmpty(modelRule)){
...@@ -299,16 +301,54 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im ...@@ -299,16 +301,54 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
} }
checkModelService.saveBatch(checkModelList); checkModelService.saveBatch(checkModelList);
// .saveBatch(checkModelList);
return null; return null;
} }
@Override @Override
public String modifyModel(CheckModel checkModel){ public Boolean modifyModel(JSONObject jsonObject){
String modelName = jsonObject.getString("model_name");
String url = jsonObject.getString("idx_table_name");
String tableId = url.substring(0,url.indexOf("$"));
// 截取$之后的所有字符串
String idxTableName = url.substring(url.indexOf("$")+1);
String modelPictureUrl = jsonObject.getString("model_picture_url");
String modelRule = jsonObject.getString("model_rule");
return checkModelMapper.modifyModel(checkModel); if(!ValidationUtil.isEmpty(modelRule)){
modelRule = modelRule.substring(modelRule.indexOf("/"),modelRule.indexOf("."));
}
String modelFile = jsonObject.getString("model_file");
String amosOrgCode = jsonObject.getString("amos_org_code");
CheckModel checkModel = this.getById(jsonObject.getString("sequenceNbr"));
checkModel.setAmosOrgCode(amosOrgCode);
checkModel.setModelName(modelName);
checkModel.setIdxTableName(idxTableName);
checkModel.setModelPictureUrl(modelPictureUrl);
checkModel.setModelRule(modelRule);
checkModel.setModelFile(modelFile);
checkModel.setTableId(tableId);
checkModel.setAmosOrgName(ModelNameEnum.map.get(amosOrgCode));
checkModel.setProjectId(ModeNameProjectIdEnum.map.get(ModelNameEnum.map.get(amosOrgCode)));
checkModelService.updateById(checkModel);
return null;
// checkModelMapper.modifyModel(jsonObject);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment