Bläddra i källkod

1018需要变更

wanghongzhi 1 år sedan
förälder
incheckning
998e7319c9

+ 23 - 0
easydo-chengfa/src/main/java/easydo/technology/controller/PurchaseAnswerSignController.java

@@ -153,6 +153,29 @@ public class PurchaseAnswerSignController {
         }
     }
 
+    @WebLog
+    @RequestMapping(value = "/updateFile")
+    public Object updateFile(@RequestBody PurchaseAnswerSign model) throws Exception {
+        if (!ChengfaEnum.PURCHASE_PALN_STATUS_APPROVE.getValue().equals(model.getStatus())) {
+            throw new BizException("此招标答疑不在审批中,请勿变更");
+        }
+        Connection connection = null;
+        try {
+            connection = dataSource.getConnection();
+            connection.setAutoCommit(false);
+
+            jdbcClient.jdbcUpdateById(model, connection);
+
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw e;
+        } finally {
+            jdbcClient.finallyExecute(connection);
+        }
+    }
+
     @WebLog
     @RequestMapping(value = "/getById")
     public Object getById(@RequestBody PurchaseAnswerSign model) throws Exception {

+ 162 - 10
easydo-chengfa/src/main/java/easydo/technology/controller/PurchaseApplyController.java

@@ -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);
+//    }
 }

+ 23 - 0
easydo-chengfa/src/main/java/easydo/technology/controller/PurchaseBidSignController.java

@@ -152,6 +152,29 @@ public class PurchaseBidSignController {
         }
     }
 
+    @WebLog
+    @RequestMapping(value = "/updateFile")
+    public Object updateFile(@RequestBody PurchaseBidSign model) throws Exception {
+        if (!ChengfaEnum.PURCHASE_PALN_STATUS_APPROVE.getValue().equals(model.getStatus())) {
+            throw new BizException("此招标会签不在审批中,请勿变更");
+        }
+        Connection connection = null;
+        try {
+            connection = dataSource.getConnection();
+            connection.setAutoCommit(false);
+
+            jdbcClient.jdbcUpdateById(model, connection);
+
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw e;
+        } finally {
+            jdbcClient.finallyExecute(connection);
+        }
+    }
+
     @WebLog
     @RequestMapping(value = "/getById")
     public Object getById(@RequestBody PurchaseBidSign model) throws Exception {

+ 55 - 3
easydo-chengfa/src/main/java/easydo/technology/controller/PurchaseController.java

@@ -116,9 +116,7 @@ public class PurchaseController {
                 List<PurchaseContract> list = jdbcClient.getJdbcList(paramMap, PurchaseContract.class, connection);
                 List<String> purchaseIds = list.stream().map(PurchaseContract::getPurchaseId)
                         .collect(Collectors.toList());
-                purchaseIdList = purchaseIdList.stream()
-                        .filter(purchaseIds::contains)
-                        .collect(Collectors.toList());
+                purchaseIdList = purchaseIdList.stream().filter(purchaseIds::contains).collect(Collectors.toList());
             }
 
             paramMap.clear();
@@ -256,6 +254,60 @@ public class PurchaseController {
         }
     }
 
+    @WebLog
+    @RequestMapping(value = "/getPage2")
+    public Object getPage2(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = null;
+        try {
+            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) {
+                OaPurchaseInfo purchaseInfo = new OaPurchaseInfo();
+                purchaseInfo.setId(model.getId());
+                purchaseInfo = jdbcClient.getJdbcModelById(purchaseInfo, connection);
+
+                PurchasePlan plan = new PurchasePlan();
+                plan.setId(model.getPlanId());
+                plan = jdbcClient.getJdbcModelById(plan, connection);
+
+                PurchaseMatter matter = new PurchaseMatter();
+                matter.setPurchaseId(model.getId());
+                matter = jdbcClient.getJdbcModel(matter, connection);
+
+                PurchaseAnswerSign answerSign = new PurchaseAnswerSign();
+                answerSign.setPurchaseId(model.getId());
+                answerSign = jdbcClient.getJdbcModel(answerSign, connection);
+
+                PurchaseBidSign bidSign = new PurchaseBidSign();
+                bidSign.setPurchaseId(model.getId());
+                bidSign = jdbcClient.getJdbcModel(bidSign, connection);
+
+                PurchaseBidNotice bidNotice = new PurchaseBidNotice();
+                bidNotice.setPurchaseId(model.getId());
+                bidNotice = jdbcClient.getJdbcModel(bidNotice, connection);
+
+                PurchaseContract contract = new PurchaseContract();
+                contract.setPurchaseId(model.getId());
+                List<PurchaseContract> contractList = jdbcClient.getJdbcList(contract, connection);
+
+                model.setOaStatus(purchaseInfo.getStatus());
+                model.setPlan(plan);
+                model.setMatter(matter);
+                model.setAnswerSign(answerSign);
+                model.setBidSign(bidSign);
+                model.setBidNotice(bidNotice);
+                model.setContractList(contractList);
+            }
+
+            return new ResponseEntity<>(page, HttpStatus.OK);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            jdbcClient.finallyExecute(connection);
+        }
+    }
+
     @WebLog
     @GetMapping("/getDetail")
     public ModelAndView getDetail(@RequestParam String type, @RequestParam(required = false) String businessId,

+ 26 - 0
easydo-chengfa/src/main/java/easydo/technology/controller/PurchasePlanController.java

@@ -3,6 +3,7 @@ package easydo.technology.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 
+import easydo.technology.components.ZeroSpringFolderComponent;
 import easydo.technology.model.vo.GLDApproveVo;
 import easydo.technology.service.FlowNoService;
 import easydo.technology.service.GLDApproveService;
@@ -250,6 +251,30 @@ public class PurchasePlanController {
             connection.setAutoCommit(false);
 
             jdbcClient.jdbcUpdateById(model, 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 PurchasePlan model) throws Exception {
+        if (!ChengfaEnum.PURCHASE_PALN_STATUS_APPROVE.getValue().equals(model.getStatus())) {
+            throw new BizException("此采购计划不在审批中,请勿变更");
+        }
+        Connection connection = null;
+        try {
+            connection = dataSource.getConnection();
+            connection.setAutoCommit(false);
+
+            jdbcClient.jdbcUpdateById(model, connection);
+
             connection.commit();
             return new ResponseEntity<>(model, HttpStatus.OK);
         } catch (Exception e) {
@@ -269,6 +294,7 @@ public class PurchasePlanController {
             connection = dataSource.getConnection();
 
             model = jdbcClient.getJdbcModelById(model, connection);
+            ZeroSpringFolderComponent.build(dataSource).fetch(model);
             result.put("plan", model);
             return new ResponseEntity<>(result, HttpStatus.OK);
         } catch (Exception e) {

+ 8 - 1
easydo-chengfa/src/main/java/easydo/technology/model/Purchase.java

@@ -14,7 +14,10 @@ import java.util.List;
 @Data
 @EqualsAndHashCode(callSuper = true)
 @ZSFContainers({
-        @ZSFContainer(directory = "purchase/apply", maxLimit = 10)
+        @ZSFContainer(directory = "purchase/apply", maxLimit = 10),
+        @ZSFContainer(directory = "purchase/first", maxLimit = 10),
+        @ZSFContainer(directory = "purchase/print", maxLimit = 10),
+        @ZSFContainer(directory = "purchase/final", maxLimit = 10)
 })
 public class Purchase extends ZeroSpringFolder<Purchase> {
     @ZSFLinkField
@@ -45,6 +48,8 @@ public class Purchase extends ZeroSpringFolder<Purchase> {
     private String endTime;
     private Boolean isHaveContract;
     private String specialFeeType;
+    private Boolean isLawyer;
+    private String budgetAmountDx;
 
 
     private String processState;
@@ -68,4 +73,6 @@ public class Purchase extends ZeroSpringFolder<Purchase> {
     private String templateId;
     @NotTableField
     private Integer oaStatus;
+    @NotTableField
+    private PurchaseLaw purchaseLaw;
 }

+ 4 - 1
easydo-chengfa/src/main/java/easydo/technology/model/PurchaseAnswerSign.java

@@ -11,7 +11,10 @@ import lombok.EqualsAndHashCode;
 @Data
 @EqualsAndHashCode(callSuper = true)
 @ZSFContainers({
-        @ZSFContainer(directory = "purchase/answersign")
+        @ZSFContainer(directory = "purchase/answersign", maxLimit = 10),
+        @ZSFContainer(directory = "answersign/first", maxLimit = 10),
+        @ZSFContainer(directory = "answersign/print", maxLimit = 10),
+        @ZSFContainer(directory = "answersign/final", maxLimit = 10)
 })
 public class PurchaseAnswerSign extends ZeroSpringFolder<PurchaseAnswerSign> {
     @ZSFLinkField

+ 1 - 1
easydo-chengfa/src/main/java/easydo/technology/model/PurchaseBidNotice.java

@@ -13,7 +13,7 @@ import lombok.EqualsAndHashCode;
 @Data
 @EqualsAndHashCode(callSuper = true)
 @ZSFContainers({
-        @ZSFContainer(directory = "purchase/bidnotice")
+        @ZSFContainer(directory = "purchase/bidnotice", maxLimit = 10)
 })
 public class PurchaseBidNotice extends ZeroSpringFolder<PurchaseBidNotice> {
     @ZSFLinkField

+ 4 - 1
easydo-chengfa/src/main/java/easydo/technology/model/PurchaseBidSign.java

@@ -11,7 +11,10 @@ import lombok.EqualsAndHashCode;
 @Data
 @EqualsAndHashCode(callSuper = true)
 @ZSFContainers({
-        @ZSFContainer(directory = "purchase/bidsign")
+        @ZSFContainer(directory = "purchase/bidsign", maxLimit = 10),
+        @ZSFContainer(directory = "bidsign/first", maxLimit = 10),
+        @ZSFContainer(directory = "bidsign/print", maxLimit = 10),
+        @ZSFContainer(directory = "bidsign/final", maxLimit = 10)
 })
 public class PurchaseBidSign extends ZeroSpringFolder<PurchaseBidSign> {
     @ZSFLinkField

+ 31 - 0
easydo-chengfa/src/main/java/easydo/technology/model/PurchaseLaw.java

@@ -0,0 +1,31 @@
+package easydo.technology.model;
+
+import easydo.technology.annotations.ZSFContainer;
+import easydo.technology.annotations.ZSFContainers;
+import easydo.technology.annotations.ZSFLinkField;
+import easydo.technology.core.ZeroSpringFolder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ZSFContainers({
+        @ZSFContainer(directory = "purchase/law", maxLimit = 10)
+})
+public class PurchaseLaw extends ZeroSpringFolder<PurchaseLaw> {
+    @ZSFLinkField
+    private String id;
+    private String purchaseId;
+    private String reportCompanyName;
+    private String caseNature;
+    private String ourPosition;
+    private String oppositeName;
+    private String caseCause;
+    private String signFileName;
+    private String signDate;
+    private String matterOverview;
+    private String implementRequire;
+    private String servicePeriod;
+    private String lawFirm;
+
+}

+ 1 - 1
easydo-chengfa/src/main/java/easydo/technology/model/PurchaseMatter.java

@@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode;
 @Data
 @EqualsAndHashCode(callSuper = true)
 @ZSFContainers({
-        @ZSFContainer(directory = "purchase/matter")
+        @ZSFContainer(directory = "purchase/matter", maxLimit = 10)
 })
 public class PurchaseMatter extends ZeroSpringFolder<PurchaseMatter> {
     @ZSFLinkField

+ 13 - 1
easydo-chengfa/src/main/java/easydo/technology/model/PurchasePlan.java

@@ -1,12 +1,24 @@
 package easydo.technology.model;
 
 import easydo.technology.annotation.NotTableField;
+import easydo.technology.annotations.ZSFContainer;
+import easydo.technology.annotations.ZSFContainers;
+import easydo.technology.annotations.ZSFLinkField;
+import easydo.technology.core.ZeroSpringFolder;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.math.BigDecimal;
 
 @Data
-public class PurchasePlan {
+@EqualsAndHashCode(callSuper = true)
+@ZSFContainers({
+        @ZSFContainer(directory = "plan/first", maxLimit = 10),
+        @ZSFContainer(directory = "plan/print", maxLimit = 10),
+        @ZSFContainer(directory = "plan/final", maxLimit = 10)
+})
+public class PurchasePlan extends ZeroSpringFolder<PurchasePlan> {
+    @ZSFLinkField
     private String id;
     private String planName;
     private String type;

+ 1 - 0
easydo-chengfa/src/main/java/easydo/technology/model/SupplierBank.java

@@ -16,4 +16,5 @@ public class SupplierBank {
     private String name;
     private String accountName;
     private String accountCode;
+    private String accountNature;
 }

+ 36 - 0
easydo-common/src/main/java/easydo/technology/utils/StringUtil.java

@@ -368,4 +368,40 @@ public class StringUtil {
         }
         return intArr;
     }
+
+    public static String digitUppercase(double n) {
+        if (n == 0) {
+            return "零元";
+        }
+        String[] fraction = {"角", "分"};
+        String[] digit = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
+        String[][] unit = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}};
+
+        String head = n < 0 ? "负" : "";
+        long money = (long) (n * Math.pow(10, 2 + 1));
+        if (money % 10 > 4) {
+            money = (money / 10) + 1;
+        } else {
+            money = money / 10;
+        }
+        n = Double.parseDouble(String.valueOf(money)) / 100;
+        System.out.println(n);
+        StringBuilder s = new StringBuilder();
+        for (int i = 0; i < fraction.length; i++) {
+            s.append((digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""));
+        }
+        if (s.length() < 1) {
+            s = new StringBuilder("整");
+        }
+        int integerPart = (int) Math.floor(n);
+        for (int i = 0; i < unit[0].length && integerPart > 0; i++) {
+            StringBuilder p = new StringBuilder();
+            for (int j = 0; j < unit[1].length && n > 0; j++) {
+                p.insert(0, digit[integerPart % 10] + unit[1][j]);
+                integerPart = integerPart / 10;
+            }
+            s.insert(0, p.toString().replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i]);
+        }
+        return head + s.toString().replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整");
+    }
 }

+ 2 - 0
easydo-system/src/main/java/easydo/technology/system/domain/Dept.java

@@ -93,6 +93,8 @@ public class Dept extends CommonEntity {
     @NotNull
     private String remark;
 
+    private String deptType;
+
     public void copyFrom(Dept source) {
         BeanUtils.copyProperties(source, this);
     }

+ 14 - 3
easydo-system/src/main/java/easydo/technology/system/security/rest/AuthorizationController.java

@@ -22,6 +22,7 @@ import easydo.technology.annotation.rest.AnonymousGetMapping;
 import easydo.technology.annotation.rest.AnonymousPostMapping;
 import easydo.technology.config.RsaProperties;
 import easydo.technology.exception.BadRequestException;
+import easydo.technology.system.domain.Dept;
 import easydo.technology.system.security.config.bean.LoginCodeEnum;
 import easydo.technology.system.security.config.bean.LoginProperties;
 import easydo.technology.system.security.config.bean.SecurityProperties;
@@ -55,7 +56,7 @@ import java.util.concurrent.TimeUnit;
 /**
  * @author Zheng Jie
  * @date 2018-11-23
- *       授权、根据token获取用户详细信息
+ * 授权、根据token获取用户详细信息
  */
 @RestController
 @RequestMapping("/auth")
@@ -93,8 +94,18 @@ public class AuthorizationController {
         String token = tokenProvider.createToken(authentication);
         final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
         if (StringUtil.isNotEmpty(jwtUserDto.getUser().getDeptId())) {
-            List<String> childrenIdList = deptService.getChildrenIdList(jwtUserDto.getUser().getDeptId());
-            jwtUserDto.getUser().setDeptIdList(childrenIdList);
+//            List<String> childrenIdList = deptService.getChildrenIdList(jwtUserDto.getUser().getDeptId());
+//            jwtUserDto.getUser().setDeptIdList(childrenIdList);
+
+            Dept dept = deptService.getById(jwtUserDto.getUser().getDeptId());
+            while (true) {
+                if ("部门".equals(dept.getDeptType())) {
+                    dept = deptService.getById(dept.getPid());
+                } else {
+                    jwtUserDto.getUser().setDeptId(dept.getId());
+                    break;
+                }
+            }
         }
         // 保存在线信息
         onlineUserService.save(jwtUserDto, token, request);