|
@@ -1,6 +1,8 @@
|
|
|
package org.jeecg.modules.weituo.controller;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -9,6 +11,8 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
@@ -177,5 +181,38 @@ public class ItdmWeituoInfoController extends JeecgController<ItdmWeituoInfo, II
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
return super.importExcel(request, response, ItdmWeituoInfo.class);
|
|
|
}
|
|
|
+ @AutoLog(value = "添加或编辑委托信息")
|
|
|
+ @ApiOperation(value = "添加或编辑委托信息", notes = "添加或编辑委托信息")
|
|
|
+ @RequestMapping("/saveOrUpdateWeituo")
|
|
|
+ public Result<String> saveOrUpdateWeituo(@RequestBody ItdmWeituoInfo weituoInfo) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isBlank(weituoInfo.getId())) { // 添加
|
|
|
+ weituoInfo.setCreateTime(new Date());
|
|
|
+ weituoInfo.setShenheStatus("待审核"); // 初始状态为待审核
|
|
|
+ itdmWeituoInfoService.save(weituoInfo); // 调用 service 的保存方法
|
|
|
+ } else { // 编辑
|
|
|
+ ItdmWeituoInfo oldWeituo = itdmWeituoInfoService.getById(weituoInfo.getId());
|
|
|
+ if (oldWeituo == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ // 这里只修改一些需要修改的属性,其他属性不变
|
|
|
+ oldWeituo.setShenheStatus(weituoInfo.getShenheStatus());
|
|
|
+ oldWeituo.setShenheMsg(weituoInfo.getShenheMsg());
|
|
|
+ oldWeituo.setShenheTime((new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
|
|
|
+
|
|
|
+ // 需要根据业务逻辑进行判断
|
|
|
+ if ("审核通过".equals(oldWeituo.getShenheStatus())) {
|
|
|
+ oldWeituo.setUpdateTime(new Date());
|
|
|
+ }
|
|
|
+
|
|
|
+ itdmWeituoInfoService.updateById(oldWeituo); // 调用 service 的更新方法
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.OK("操作成功!");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("添加或编辑委托信息出错!", e);
|
|
|
+ return Result.error("操作失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|