|
@@ -25,12 +25,15 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
+import org.springblade.bank.autodata.entity.ApproveBean;
|
|
|
import org.springblade.bank.autodata.entity.AutoData;
|
|
import org.springblade.bank.autodata.entity.AutoData;
|
|
|
import org.springblade.bank.autodata.service.IAutoDataService;
|
|
import org.springblade.bank.autodata.service.IAutoDataService;
|
|
|
import org.springblade.bank.autodata.vo.AutoDataVO;
|
|
import org.springblade.bank.autodata.vo.AutoDataVO;
|
|
|
import org.springblade.bank.autodata.wrapper.AutoDataWrapper;
|
|
import org.springblade.bank.autodata.wrapper.AutoDataWrapper;
|
|
|
import org.springblade.bank.autostruct.entity.AutoStruct;
|
|
import org.springblade.bank.autostruct.entity.AutoStruct;
|
|
|
import org.springblade.bank.autostruct.service.IAutoStructService;
|
|
import org.springblade.bank.autostruct.service.IAutoStructService;
|
|
|
|
|
+import org.springblade.bank.constant.*;
|
|
|
|
|
+import org.springblade.bank.constant.Process;
|
|
|
import org.springblade.common.cache.UserCache;
|
|
import org.springblade.common.cache.UserCache;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.mp.support.Condition;
|
|
@@ -39,7 +42,9 @@ import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
|
|
+import org.springblade.core.tool.utils.DateUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.modules.system.entity.Dept;
|
|
import org.springblade.modules.system.entity.Dept;
|
|
|
import org.springblade.modules.system.entity.User;
|
|
import org.springblade.modules.system.entity.User;
|
|
|
import org.springblade.modules.system.service.IDeptService;
|
|
import org.springblade.modules.system.service.IDeptService;
|
|
@@ -48,10 +53,7 @@ import org.springframework.util.Assert;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 控制器
|
|
* 控制器
|
|
@@ -153,6 +155,39 @@ public class AutoDataController extends BladeController {
|
|
|
@ApiOperationSupport(order = 4)
|
|
@ApiOperationSupport(order = 4)
|
|
|
@ApiOperation(value = "新增", notes = "传入autoData")
|
|
@ApiOperation(value = "新增", notes = "传入autoData")
|
|
|
public R save(@Valid @RequestBody AutoData autoData) {
|
|
public R save(@Valid @RequestBody AutoData autoData) {
|
|
|
|
|
+ autoData.setProcess(Process.FIRST);
|
|
|
|
|
+ autoData.setProcessStatus(ProcessStatus.TOBEREVIEWED);
|
|
|
|
|
+
|
|
|
|
|
+ Long tableId = autoData.getTableId();
|
|
|
|
|
+ AutoStruct struct = autoStructService.getById(tableId);
|
|
|
|
|
+// if (struct.getApproveType().equals(1) && struct.getSettingType().equals(1)){
|
|
|
|
|
+ if (new Integer(1).equals(struct.getApproveSwitch())){
|
|
|
|
|
+ JSONArray jsonArray = JSONUtil.parseArray(struct.getSetting());
|
|
|
|
|
+ // 串行 & 统一设置
|
|
|
|
|
+ if (new Integer(1).equals(struct.getApproveType()) && new Integer(1).equals(struct.getSettingType())){
|
|
|
|
|
+ // 取出下一個審批人
|
|
|
|
|
+ Map<String, String > tobePerson = (Map<String, String>) jsonArray.get(0);
|
|
|
|
|
+ autoData.setReceiverId(tobePerson.get("id"));
|
|
|
|
|
+ autoData.setReceiverName(tobePerson.get("name"));
|
|
|
|
|
+ autoData.setReceiverNo(tobePerson.get("ehr"));
|
|
|
|
|
+ }
|
|
|
|
|
+ // 并行
|
|
|
|
|
+ if (new Integer(2).equals(struct.getApproveType())){
|
|
|
|
|
+ List<String> idArr = new ArrayList<>();
|
|
|
|
|
+ List<String> nameArr = new ArrayList<>();
|
|
|
|
|
+ List<String> ehrArr = new ArrayList<>();
|
|
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
+ Map<String, String > person = (Map<String, String>) jsonArray.get(i);
|
|
|
|
|
+ idArr.add(person.get("id"));
|
|
|
|
|
+ nameArr.add(person.get("name"));
|
|
|
|
|
+ ehrArr.add(person.get("ehr"));
|
|
|
|
|
+ }
|
|
|
|
|
+ autoData.setReceiverId(StringUtil.join(idArr, ","));
|
|
|
|
|
+ autoData.setReceiverName(StringUtil.join(nameArr, ","));
|
|
|
|
|
+ autoData.setReceiverNo(StringUtil.join(ehrArr, ","));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return R.status(autoDataService.save(autoData));
|
|
return R.status(autoDataService.save(autoData));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -163,6 +198,39 @@ public class AutoDataController extends BladeController {
|
|
|
@ApiOperationSupport(order = 5)
|
|
@ApiOperationSupport(order = 5)
|
|
|
@ApiOperation(value = "修改", notes = "传入autoData")
|
|
@ApiOperation(value = "修改", notes = "传入autoData")
|
|
|
public R update(@Valid @RequestBody AutoData autoData) {
|
|
public R update(@Valid @RequestBody AutoData autoData) {
|
|
|
|
|
+ autoData.setProcess(Process.FIRST);
|
|
|
|
|
+ autoData.setProcessStatus(ProcessStatus.TOBEREVIEWED);
|
|
|
|
|
+
|
|
|
|
|
+ Long tableId = autoData.getTableId();
|
|
|
|
|
+ AutoStruct struct = autoStructService.getById(tableId);
|
|
|
|
|
+ if (new Integer(1).equals(struct.getApproveSwitch())){
|
|
|
|
|
+ JSONArray jsonArray = JSONUtil.parseArray(struct.getSetting());
|
|
|
|
|
+ // 串行 & 统一设置
|
|
|
|
|
+ if (new Integer(1).equals(struct.getApproveType()) && new Integer(1).equals(struct.getSettingType())){
|
|
|
|
|
+ // 取出下一個審批人
|
|
|
|
|
+ Map<String, String > tobePerson = (Map<String, String>) jsonArray.get(0);
|
|
|
|
|
+ autoData.setReceiverId(tobePerson.get("id"));
|
|
|
|
|
+ autoData.setReceiverName(tobePerson.get("name"));
|
|
|
|
|
+ autoData.setReceiverNo(tobePerson.get("ehr"));
|
|
|
|
|
+ }
|
|
|
|
|
+ // 并行
|
|
|
|
|
+ if (new Integer(2).equals(struct.getApproveType())){
|
|
|
|
|
+ List<String> idArr = new ArrayList<>();
|
|
|
|
|
+ List<String> nameArr = new ArrayList<>();
|
|
|
|
|
+ List<String> ehrArr = new ArrayList<>();
|
|
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
+ Map<String, String > person = (Map<String, String>) jsonArray.get(i);
|
|
|
|
|
+ idArr.add(person.get("id"));
|
|
|
|
|
+ nameArr.add(person.get("name"));
|
|
|
|
|
+ ehrArr.add(person.get("ehr"));
|
|
|
|
|
+ }
|
|
|
|
|
+ autoData.setReceiverId(StringUtil.join(idArr, ","));
|
|
|
|
|
+ autoData.setReceiverName(StringUtil.join(nameArr, ","));
|
|
|
|
|
+ autoData.setReceiverNo(StringUtil.join(ehrArr, ","));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
return R.status(autoDataService.updateById(autoData));
|
|
return R.status(autoDataService.updateById(autoData));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -187,93 +255,193 @@ public class AutoDataController extends BladeController {
|
|
|
Long tableId = autoData.getTableId();
|
|
Long tableId = autoData.getTableId();
|
|
|
AutoStruct struct = autoStructService.getById(tableId);
|
|
AutoStruct struct = autoStructService.getById(tableId);
|
|
|
|
|
|
|
|
|
|
+
|
|
|
// 並行-直接把審批人信息追加到已審批人字段
|
|
// 並行-直接把審批人信息追加到已審批人字段
|
|
|
AutoData oldData = autoDataService.getById(autoData.getId());
|
|
AutoData oldData = autoDataService.getById(autoData.getId());
|
|
|
- if (struct.getApproveType().equals(2)){
|
|
|
|
|
- User user = userService.getById(AuthUtil.getUserId());
|
|
|
|
|
- if (oldData.getProcess().equals(1)){
|
|
|
|
|
- autoData.setApproveId(user.getId()+"");
|
|
|
|
|
- autoData.setApproveName(user.getName());
|
|
|
|
|
- autoData.setApproveNo(user.getEhr());
|
|
|
|
|
- }else{
|
|
|
|
|
- autoData.setApproveId(oldData.getApproveId() + "," + user.getId());
|
|
|
|
|
- autoData.setApproveName(oldData.getApproveName() + "," + user.getName());
|
|
|
|
|
- autoData.setApproveNo(oldData.getApproveNo() + "," + user.getEhr());
|
|
|
|
|
|
|
+ if (struct.getApproveType().equals(ApproveType.PARALLEL)){
|
|
|
|
|
+ if (autoData.getApproveHistory() != null){
|
|
|
|
|
+ JSONArray jsonArray = JSONUtil.parseArray(autoData.getApproveHistory());
|
|
|
|
|
+ JSONArray jsonArray1 = JSONUtil.parseArray(struct.getSetting());
|
|
|
|
|
+ if (jsonArray.size() == jsonArray1.size()){
|
|
|
|
|
+ autoData.setProcessStatus(ProcessStatus.PASSED);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ autoData.setProcessStatus(ProcessStatus.TOBEREVIEWED);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}else {
|
|
}else {
|
|
|
// 串行-統一設置-從設置中拿出相應位置的人員,填充到下一個審批人字段,process+1
|
|
// 串行-統一設置-從設置中拿出相應位置的人員,填充到下一個審批人字段,process+1
|
|
|
String settingStr = struct.getSetting();
|
|
String settingStr = struct.getSetting();
|
|
|
- if (struct.getSettingType().equals(1)){
|
|
|
|
|
- JSONArray jsonArray = JSONUtil.parseArray(settingStr);
|
|
|
|
|
- // 取出下一個審批人
|
|
|
|
|
- Map<String, String > tobePerson = (Map<String, String>) jsonArray.get(autoData.getProcess());
|
|
|
|
|
- autoData.setReceiverId(tobePerson.get("id"));
|
|
|
|
|
- autoData.setReceiverName(tobePerson.get("name"));
|
|
|
|
|
- autoData.setReceiverNo(tobePerson.get("ehr"));
|
|
|
|
|
- jsonArray.toJSONString(0);
|
|
|
|
|
- }else{
|
|
|
|
|
- // 串行-逐級設置-把前端傳過來的審批人,保存到待審批人字段,保存,process+1
|
|
|
|
|
- JSONArray jsonArray;
|
|
|
|
|
- if (settingStr == null){
|
|
|
|
|
- jsonArray = new JSONArray(1);
|
|
|
|
|
|
|
+ if (oldData.getProcess() < struct.getNum()){
|
|
|
|
|
+ if (struct.getSettingType().equals(SettingType.UNIFIED)){
|
|
|
|
|
+ JSONArray jsonArray = JSONUtil.parseArray(settingStr);
|
|
|
|
|
+ // 取出下一個審批人
|
|
|
|
|
+ Map<String, String > tobePerson = (Map<String, String>) jsonArray.get(oldData.getProcess());
|
|
|
|
|
+ autoData.setReceiverId(tobePerson.get("id"));
|
|
|
|
|
+ autoData.setReceiverName(tobePerson.get("name"));
|
|
|
|
|
+ autoData.setReceiverNo(tobePerson.get("ehr"));
|
|
|
|
|
+ jsonArray.toJSONString(0);
|
|
|
}else{
|
|
}else{
|
|
|
- jsonArray = JSONUtil.parseArray(settingStr);
|
|
|
|
|
|
|
+ // 串行-逐級設置-把前端傳過來的審批人,保存到待審批人字段,保存,process+1
|
|
|
|
|
+ JSONArray jsonArray;
|
|
|
|
|
+ if (settingStr == null){
|
|
|
|
|
+ jsonArray = new JSONArray(1);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ jsonArray = JSONUtil.parseArray(settingStr);
|
|
|
|
|
+ }
|
|
|
|
|
+ Map<String, String > tobePerson = new HashMap<>();
|
|
|
|
|
+ tobePerson.put("id", autoData.getReceiverId());
|
|
|
|
|
+ tobePerson.put("name", autoData.getReceiverName());
|
|
|
|
|
+ tobePerson.put("ehr", autoData.getReceiverNo());
|
|
|
|
|
+ jsonArray.set(tobePerson);
|
|
|
|
|
+ String newSettingStr = jsonArray.toJSONString(0);
|
|
|
|
|
+ struct.setSetting(newSettingStr);
|
|
|
|
|
+ autoStructService.updateById(struct);
|
|
|
}
|
|
}
|
|
|
- Map<String, String > tobePerson = new HashMap<>();
|
|
|
|
|
- tobePerson.put("id", oldData.getReceiverId());
|
|
|
|
|
- tobePerson.put("name", oldData.getReceiverName());
|
|
|
|
|
- tobePerson.put("ehr", oldData.getReceiverNo());
|
|
|
|
|
- jsonArray.set(tobePerson);
|
|
|
|
|
- String newSettingStr = jsonArray.toJSONString(0);
|
|
|
|
|
- struct.setSetting(newSettingStr);
|
|
|
|
|
- autoStructService.updateById(struct);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
autoData.setProcess(oldData.getProcess()+1);
|
|
autoData.setProcess(oldData.getProcess()+1);
|
|
|
|
|
+ if (oldData.getProcess().equals(struct.getNum())){
|
|
|
|
|
+ autoData.setProcessStatus(ProcessStatus.PASSED);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ autoData.setProcessStatus(ProcessStatus.TOBEREVIEWED);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //審批記錄
|
|
|
|
|
+ User user = userService.getById(AuthUtil.getUserId());
|
|
|
|
|
+ if (StringUtil.isBlank(oldData.getApproveId())){
|
|
|
|
|
+ autoData.setApproveId(user.getId()+"");
|
|
|
|
|
+ autoData.setApproveName(user.getName());
|
|
|
|
|
+ autoData.setApproveNo(user.getEhr());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ autoData.setApproveId(oldData.getApproveId() + "," + user.getId());
|
|
|
|
|
+ autoData.setApproveName(oldData.getApproveName() + "," + user.getName());
|
|
|
|
|
+ autoData.setApproveNo(oldData.getApproveNo() + "," + user.getEhr());
|
|
|
|
|
+ }
|
|
|
|
|
+ ApproveBean approveBean = new ApproveBean();
|
|
|
|
|
+ approveBean.setUserId(user.getId()+"");
|
|
|
|
|
+ approveBean.setUserName(user.getName());
|
|
|
|
|
+ approveBean.setUserEhr(user.getEhr());
|
|
|
|
|
+ approveBean.setApprove(Approve.AGREE);
|
|
|
|
|
+ approveBean.setRemark(autoData.getRemark());
|
|
|
|
|
+ approveBean.setApproveTime(DateUtil.formatDate(DateUtil.now()));
|
|
|
|
|
+
|
|
|
|
|
+ String approveHistory = oldData.getApproveHistory();
|
|
|
|
|
+ if (approveHistory == null){
|
|
|
|
|
+ approveHistory = "[]";
|
|
|
}
|
|
}
|
|
|
|
|
+ JSONArray history = JSONUtil.parseArray(approveHistory);
|
|
|
|
|
+ history.add(approveBean);
|
|
|
|
|
+ autoData.setApproveHistory(history.toJSONString(0));
|
|
|
|
|
|
|
|
return R.status(autoDataService.saveOrUpdate(autoData));
|
|
return R.status(autoDataService.saveOrUpdate(autoData));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 審批駁回
|
|
|
|
|
|
|
+ * 審批駁回-退回
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/approveNo")
|
|
|
|
|
|
|
+ @PostMapping("/approveReject")
|
|
|
@ApiOperationSupport(order = 6)
|
|
@ApiOperationSupport(order = 6)
|
|
|
- @ApiOperation(value = "審批駁回", notes = "传入autoData")
|
|
|
|
|
- public R approveNo(@Valid @RequestBody AutoData autoData) {
|
|
|
|
|
|
|
+ @ApiOperation(value = "審批駁回-退回", notes = "传入autoData")
|
|
|
|
|
+ public R approveReject(@Valid @RequestBody AutoData autoData) {
|
|
|
AutoData oldData = autoDataService.getById(autoData.getId());
|
|
AutoData oldData = autoDataService.getById(autoData.getId());
|
|
|
- Assert.isTrue(!oldData.getProcess().equals(1), "無法駁回!因為已無路可退!");
|
|
|
|
|
|
|
+// Assert.isTrue(!oldData.getProcess().equals(1), "無法駁回!因為已無路可退!");
|
|
|
Long tableId = autoData.getTableId();
|
|
Long tableId = autoData.getTableId();
|
|
|
AutoStruct struct = autoStructService.getById(tableId);
|
|
AutoStruct struct = autoStructService.getById(tableId);
|
|
|
|
|
+ User createUser = userService.getById(oldData.getCreateUser());
|
|
|
|
|
|
|
|
//串行(並行無駁回)
|
|
//串行(並行無駁回)
|
|
|
- if (struct.getApproveType().equals(1)){
|
|
|
|
|
|
|
+ if (struct.getApproveType().equals(ApproveType.SERIAL)){
|
|
|
// 串行-統一設置-從設置中拿出相應位置的人員,填充到下一個審批人字段,process-1
|
|
// 串行-統一設置-從設置中拿出相應位置的人員,填充到下一個審批人字段,process-1
|
|
|
- String settingStr = struct.getSetting();
|
|
|
|
|
- JSONArray jsonArray = JSONUtil.parseArray(settingStr);
|
|
|
|
|
- // 取出上一個審批人
|
|
|
|
|
- Map<String, String > tobePerson = (Map<String, String>) jsonArray.get(oldData.getProcess() - 2);
|
|
|
|
|
- autoData.setReceiverId(tobePerson.get("id"));
|
|
|
|
|
- autoData.setReceiverName(tobePerson.get("name"));
|
|
|
|
|
- autoData.setReceiverNo(tobePerson.get("ehr"));
|
|
|
|
|
- if (struct.getSettingType().equals(2)){
|
|
|
|
|
- // 逐級審批-需刪除前審批人信息
|
|
|
|
|
- Object remove = jsonArray.remove(oldData.getProcess() - 2);
|
|
|
|
|
- if (jsonArray.size() == 0){
|
|
|
|
|
- struct.setSetting(null);
|
|
|
|
|
- }else {
|
|
|
|
|
- String newSettingStr = jsonArray.toJSONString(0);
|
|
|
|
|
- struct.setSetting(newSettingStr);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //如果第一次审批就驳回
|
|
|
|
|
+ autoData.setReceiverId(createUser.getId()+"");
|
|
|
|
|
+ autoData.setReceiverName(createUser.getName());
|
|
|
|
|
+ autoData.setReceiverNo(createUser.getEhr());
|
|
|
|
|
+
|
|
|
|
|
+ if (struct.getSettingType().equals(SettingType.GRADUALLY)){
|
|
|
|
|
+ // 逐級審批-需刪除之前所有審批人设置信息
|
|
|
|
|
+ struct.setSetting(null);
|
|
|
autoStructService.updateById(struct);
|
|
autoStructService.updateById(struct);
|
|
|
}
|
|
}
|
|
|
- autoData.setProcess(oldData.getProcess()-1);
|
|
|
|
|
|
|
+ autoData.setProcess(Process.FIRST);
|
|
|
|
|
+ autoData.setProcessStatus(ProcessStatus.REJECTED);
|
|
|
|
|
+
|
|
|
|
|
+ //審批記錄
|
|
|
|
|
+ User user = userService.getById(AuthUtil.getUserId());
|
|
|
|
|
+ if (StringUtil.isBlank(oldData.getApproveId())){
|
|
|
|
|
+ autoData.setApproveId(user.getId()+"");
|
|
|
|
|
+ autoData.setApproveName(user.getName());
|
|
|
|
|
+ autoData.setApproveNo(user.getEhr());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ autoData.setApproveId(oldData.getApproveId() + "," + user.getId());
|
|
|
|
|
+ autoData.setApproveName(oldData.getApproveName() + "," + user.getName());
|
|
|
|
|
+ autoData.setApproveNo(oldData.getApproveNo() + "," + user.getEhr());
|
|
|
|
|
+ }
|
|
|
|
|
+ ApproveBean approveBean = new ApproveBean();
|
|
|
|
|
+ approveBean.setUserId(user.getId()+"");
|
|
|
|
|
+ approveBean.setUserName(user.getName());
|
|
|
|
|
+ approveBean.setUserEhr(user.getEhr());
|
|
|
|
|
+ approveBean.setApprove(Approve.REJECT);
|
|
|
|
|
+ approveBean.setRemark(autoData.getRemark());
|
|
|
|
|
+ approveBean.setApproveTime(DateUtil.formatDate(DateUtil.now()));
|
|
|
|
|
+
|
|
|
|
|
+ String approveHistory = oldData.getApproveHistory();
|
|
|
|
|
+ if (approveHistory == null){
|
|
|
|
|
+ approveHistory = "[]";
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONArray history = JSONUtil.parseArray(approveHistory);
|
|
|
|
|
+ history.add(approveBean);
|
|
|
|
|
+ autoData.setApproveHistory(history.toJSONString(0));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return R.status(autoDataService.saveOrUpdate(autoData));
|
|
return R.status(autoDataService.saveOrUpdate(autoData));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 審批不通过
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/approveNo")
|
|
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
|
|
+ @ApiOperation(value = "審批不通过", notes = "传入autoData")
|
|
|
|
|
+ public R approveNo(@Valid @RequestBody AutoData autoData) {
|
|
|
|
|
+ Long tableId = autoData.getTableId();
|
|
|
|
|
+ AutoStruct struct = autoStructService.getById(tableId);
|
|
|
|
|
+ User user = userService.getById(AuthUtil.getUserId());
|
|
|
|
|
+
|
|
|
|
|
+ // 並行-直接把審批人信息追加到已審批人字段
|
|
|
|
|
+ AutoData oldData = autoDataService.getById(autoData.getId());
|
|
|
|
|
+ if (struct.getApproveType().equals(ApproveType.PARALLEL)) {
|
|
|
|
|
+ if (StringUtil.isBlank(oldData.getApproveId())){
|
|
|
|
|
+ autoData.setApproveId(user.getId()+"");
|
|
|
|
|
+ autoData.setApproveName(user.getName());
|
|
|
|
|
+ autoData.setApproveNo(user.getEhr());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ autoData.setApproveId(oldData.getApproveId() + "," + user.getId());
|
|
|
|
|
+ autoData.setApproveName(oldData.getApproveName() + "," + user.getName());
|
|
|
|
|
+ autoData.setApproveNo(oldData.getApproveNo() + "," + user.getEhr());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //審批記錄
|
|
|
|
|
+ ApproveBean approveBean = new ApproveBean();
|
|
|
|
|
+ approveBean.setUserId(user.getId()+"");
|
|
|
|
|
+ approveBean.setUserName(user.getName());
|
|
|
|
|
+ approveBean.setUserEhr(user.getEhr());
|
|
|
|
|
+ approveBean.setApprove(Approve.DISAGREE);
|
|
|
|
|
+ approveBean.setRemark(autoData.getRemark());
|
|
|
|
|
+ approveBean.setApproveTime(DateUtil.formatDate(DateUtil.now()));
|
|
|
|
|
+
|
|
|
|
|
+ String approveHistory = oldData.getApproveHistory();
|
|
|
|
|
+ if (approveHistory == null){
|
|
|
|
|
+ approveHistory = "[]";
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONArray history = JSONUtil.parseArray(approveHistory);
|
|
|
|
|
+ history.add(approveBean);
|
|
|
|
|
+ autoData.setApproveHistory(history.toJSONString(0));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return R.status(autoDataService.saveOrUpdate(autoData));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 删除
|
|
* 删除
|