|
|
@@ -5,16 +5,12 @@ import easydo.technology.components.JdbcClient;
|
|
|
import easydo.technology.components.ZeroSpringFolderComponent;
|
|
|
import easydo.technology.enums.ChengfaEnum;
|
|
|
import easydo.technology.exception.BizException;
|
|
|
-import easydo.technology.model.BusApprove;
|
|
|
-import easydo.technology.model.Purchase;
|
|
|
-import easydo.technology.model.PurchaseAnswerSign;
|
|
|
-import easydo.technology.model.PurchaseBidNotice;
|
|
|
-import easydo.technology.model.PurchaseBidSign;
|
|
|
-import easydo.technology.model.PurchaseMatter;
|
|
|
+import easydo.technology.model.*;
|
|
|
import easydo.technology.model.vo.GLDApproveVo;
|
|
|
import easydo.technology.service.FlowNoService;
|
|
|
import easydo.technology.service.GLDApproveService;
|
|
|
import easydo.technology.utils.StringUtil;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
@@ -48,10 +44,11 @@ public class PurchaseApplyController {
|
|
|
connection = dataSource.getConnection();
|
|
|
|
|
|
Map<String, Object> page = jdbcClient.getJdbcPage(map, Purchase.class, connection);
|
|
|
- // List<Purchase> list = (List<Purchase>) page.get("records");
|
|
|
- // for (Purchase model : list) {
|
|
|
- // ZeroSpringFolderComponent.build(dataSource).fetch(model);
|
|
|
- // }
|
|
|
+// List<Purchase> list = (List<Purchase>) page.get("records");
|
|
|
+// for (Purchase model : list) {
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
return new ResponseEntity<>(page, HttpStatus.OK);
|
|
|
} catch (Exception e) {
|
|
|
@@ -89,7 +86,16 @@ public class PurchaseApplyController {
|
|
|
connection.setAutoCommit(false);
|
|
|
|
|
|
model.setPurchaseNo(flownoService.getFlowNo(ChengfaEnum.FLOWNO_TYPE_PURCHASE.getValue(), connection));
|
|
|
+ String dx = StringUtil.digitUppercase(model.getBudgetAmount().doubleValue());
|
|
|
+ model.setBudgetAmountDx(dx);
|
|
|
jdbcClient.jdbcInsert(model, connection);
|
|
|
+
|
|
|
+ if (model.getIsLawyer()) {
|
|
|
+ PurchaseLaw law = model.getPurchaseLaw();
|
|
|
+ law.setPurchaseId(model.getId());
|
|
|
+ jdbcClient.jdbcInsert(law, connection);
|
|
|
+ }
|
|
|
+
|
|
|
connection.commit();
|
|
|
return new ResponseEntity<>(model, HttpStatus.OK);
|
|
|
} catch (Exception e) {
|
|
|
@@ -110,10 +116,32 @@ public class PurchaseApplyController {
|
|
|
|
|
|
if (StringUtil.isEmpty(model.getId())) {
|
|
|
model.setPurchaseNo(flownoService.getFlowNo(ChengfaEnum.FLOWNO_TYPE_PURCHASE.getValue(), connection));
|
|
|
+ String dx = StringUtil.digitUppercase(model.getBudgetAmount().doubleValue());
|
|
|
+ model.setBudgetAmountDx(dx);
|
|
|
jdbcClient.jdbcInsert(model, connection);
|
|
|
+ if (model.getIsLawyer()) {
|
|
|
+ PurchaseLaw law = model.getPurchaseLaw();
|
|
|
+ law.setPurchaseId(model.getId());
|
|
|
+ jdbcClient.jdbcInsert(law, connection);
|
|
|
+ }
|
|
|
} else {
|
|
|
checkData(model, connection);
|
|
|
+ String dx = StringUtil.digitUppercase(model.getBudgetAmount().doubleValue());
|
|
|
+ model.setBudgetAmountDx(dx);
|
|
|
jdbcClient.jdbcUpdateById(model, connection);
|
|
|
+ if (model.getIsLawyer()) {
|
|
|
+ PurchaseLaw law = model.getPurchaseLaw();
|
|
|
+ PurchaseLaw existLaw = new PurchaseLaw();
|
|
|
+ existLaw.setPurchaseId(model.getId());
|
|
|
+ existLaw = jdbcClient.getJdbcModel(existLaw, connection);
|
|
|
+ if (StringUtil.isEmpty(existLaw.getId())) {
|
|
|
+ law.setPurchaseId(model.getId());
|
|
|
+ jdbcClient.jdbcInsert(law, connection);
|
|
|
+ } else {
|
|
|
+ law.setId(existLaw.getId());
|
|
|
+ jdbcClient.jdbcUpdateById(law, connection);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
GLDApproveVo vo = new GLDApproveVo();
|
|
|
@@ -165,8 +193,24 @@ public class PurchaseApplyController {
|
|
|
|
|
|
model.setStep(ChengfaEnum.PURCHASE_STEP_PURCHASE_APPLY.getValue());
|
|
|
model.setStatus(ChengfaEnum.PURCHASE_STATUS_APPROVE.getValue());
|
|
|
+ String dx = StringUtil.digitUppercase(model.getBudgetAmount().doubleValue());
|
|
|
+ model.setBudgetAmountDx(dx);
|
|
|
jdbcClient.jdbcUpdateById(model, connection);
|
|
|
|
|
|
+ if (model.getIsLawyer()) {
|
|
|
+ PurchaseLaw law = model.getPurchaseLaw();
|
|
|
+ PurchaseLaw existLaw = new PurchaseLaw();
|
|
|
+ existLaw.setPurchaseId(model.getId());
|
|
|
+ existLaw = jdbcClient.getJdbcModel(existLaw, connection);
|
|
|
+ if (StringUtil.isEmpty(existLaw.getId())) {
|
|
|
+ law.setPurchaseId(model.getId());
|
|
|
+ jdbcClient.jdbcInsert(law, connection);
|
|
|
+ } else {
|
|
|
+ law.setId(existLaw.getId());
|
|
|
+ jdbcClient.jdbcUpdateById(law, connection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
connection.commit();
|
|
|
return new ResponseEntity<>(model, HttpStatus.OK);
|
|
|
} catch (Exception e) {
|
|
|
@@ -181,6 +225,45 @@ public class PurchaseApplyController {
|
|
|
@RequestMapping(value = "/update")
|
|
|
public Object update(@RequestBody Purchase model) throws Exception {
|
|
|
|
|
|
+ Connection connection = null;
|
|
|
+ try {
|
|
|
+ connection = dataSource.getConnection();
|
|
|
+ connection.setAutoCommit(false);
|
|
|
+ checkData(model, connection);
|
|
|
+
|
|
|
+ String dx = StringUtil.digitUppercase(model.getBudgetAmount().doubleValue());
|
|
|
+ model.setBudgetAmountDx(dx);
|
|
|
+ jdbcClient.jdbcUpdateById(model, connection);
|
|
|
+
|
|
|
+ if (model.getIsLawyer()) {
|
|
|
+ PurchaseLaw law = model.getPurchaseLaw();
|
|
|
+ PurchaseLaw existLaw = new PurchaseLaw();
|
|
|
+ existLaw.setPurchaseId(model.getId());
|
|
|
+ existLaw = jdbcClient.getJdbcModel(existLaw, connection);
|
|
|
+ if (StringUtil.isEmpty(existLaw.getId())) {
|
|
|
+ law.setPurchaseId(model.getId());
|
|
|
+ jdbcClient.jdbcInsert(law, connection);
|
|
|
+ } else {
|
|
|
+ law.setId(existLaw.getId());
|
|
|
+ jdbcClient.jdbcUpdateById(law, connection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ connection.commit();
|
|
|
+ return new ResponseEntity<>(model, HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ connection.rollback();
|
|
|
+ throw e;
|
|
|
+ } finally {
|
|
|
+ jdbcClient.finallyExecute(connection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @WebLog
|
|
|
+ @RequestMapping(value = "/updateFile")
|
|
|
+ public Object updateFile(@RequestBody Purchase model) throws Exception {
|
|
|
+ if (!ChengfaEnum.PURCHASE_PALN_STATUS_APPROVE.getValue().equals(model.getStatus())) {
|
|
|
+ throw new BizException("此采购申请不在审批中,请勿变更");
|
|
|
+ }
|
|
|
Connection connection = null;
|
|
|
try {
|
|
|
connection = dataSource.getConnection();
|
|
|
@@ -188,6 +271,53 @@ public class PurchaseApplyController {
|
|
|
checkData(model, connection);
|
|
|
|
|
|
jdbcClient.jdbcUpdateById(model, connection);
|
|
|
+
|
|
|
+ if (model.getIsLawyer()) {
|
|
|
+ PurchaseLaw law = model.getPurchaseLaw();
|
|
|
+ PurchaseLaw existLaw = new PurchaseLaw();
|
|
|
+ existLaw.setPurchaseId(model.getId());
|
|
|
+ existLaw = jdbcClient.getJdbcModel(existLaw, connection);
|
|
|
+ if (StringUtil.isEmpty(existLaw.getId())) {
|
|
|
+ law.setPurchaseId(model.getId());
|
|
|
+ jdbcClient.jdbcInsert(law, connection);
|
|
|
+ } else {
|
|
|
+ law.setId(existLaw.getId());
|
|
|
+ jdbcClient.jdbcUpdateById(law, connection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ connection.commit();
|
|
|
+ return new ResponseEntity<>(model, HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ connection.rollback();
|
|
|
+ throw e;
|
|
|
+ } finally {
|
|
|
+ jdbcClient.finallyExecute(connection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @WebLog
|
|
|
+ @RequestMapping(value = "/updatePurchase")
|
|
|
+ public Object updatePurchase(@RequestBody Purchase model) throws Exception {
|
|
|
+ Connection connection = null;
|
|
|
+ try {
|
|
|
+ connection = dataSource.getConnection();
|
|
|
+ connection.setAutoCommit(false);
|
|
|
+
|
|
|
+ jdbcClient.jdbcUpdateById(model, connection);
|
|
|
+
|
|
|
+// if (model.getIsLawyer()) {
|
|
|
+// PurchaseLaw law = model.getPurchaseLaw();
|
|
|
+// PurchaseLaw existLaw = new PurchaseLaw();
|
|
|
+// existLaw.setPurchaseId(model.getId());
|
|
|
+// existLaw = jdbcClient.getJdbcModel(existLaw, connection);
|
|
|
+// if (StringUtil.isEmpty(existLaw.getId())) {
|
|
|
+// law.setPurchaseId(model.getId());
|
|
|
+// jdbcClient.jdbcInsert(law, connection);
|
|
|
+// } else {
|
|
|
+// law.setId(existLaw.getId());
|
|
|
+// jdbcClient.jdbcUpdateById(law, connection);
|
|
|
+// }
|
|
|
+// }
|
|
|
connection.commit();
|
|
|
return new ResponseEntity<>(model, HttpStatus.OK);
|
|
|
} catch (Exception e) {
|
|
|
@@ -247,6 +377,14 @@ public class PurchaseApplyController {
|
|
|
bidNotice.setPurchaseId(model.getId());
|
|
|
bidNotice = jdbcClient.getJdbcModel(bidNotice, connection);
|
|
|
|
|
|
+ PurchaseLaw existLaw = new PurchaseLaw();
|
|
|
+ existLaw.setPurchaseId(model.getId());
|
|
|
+ existLaw = jdbcClient.getJdbcModel(existLaw, connection);
|
|
|
+ if (StringUtil.isNotEmpty(existLaw.getId())) {
|
|
|
+ ZeroSpringFolderComponent.build(dataSource).fetch(existLaw);
|
|
|
+ model.setPurchaseLaw(existLaw);
|
|
|
+ }
|
|
|
+
|
|
|
result.put("purchase", model);
|
|
|
result.put("matter", matter);
|
|
|
result.put("bidSign", bidSign);
|
|
|
@@ -276,6 +414,13 @@ public class PurchaseApplyController {
|
|
|
}
|
|
|
|
|
|
jdbcClient.jdbcRemoveById(model, connection);
|
|
|
+
|
|
|
+ PurchaseLaw existLaw = new PurchaseLaw();
|
|
|
+ existLaw.setPurchaseId(model.getId());
|
|
|
+ existLaw = jdbcClient.getJdbcModel(existLaw, connection);
|
|
|
+ if (StringUtil.isNotEmpty(existLaw.getId())) {
|
|
|
+ jdbcClient.jdbcRemoveById(existLaw, connection);
|
|
|
+ }
|
|
|
connection.commit();
|
|
|
return new ResponseEntity<>(model, HttpStatus.OK);
|
|
|
} catch (Exception e) {
|
|
|
@@ -285,4 +430,11 @@ public class PurchaseApplyController {
|
|
|
jdbcClient.finallyExecute(connection);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// @WebLog
|
|
|
+// @RequestMapping(value = "/convertDx")
|
|
|
+// public Object convertDx(@RequestBody Purchase model) throws Exception {
|
|
|
+// String dx = StringUtil.digitUppercase(model.getBudgetAmount().doubleValue());
|
|
|
+// return new ResponseEntity<>(dx, HttpStatus.OK);
|
|
|
+// }
|
|
|
}
|