wujiefeng hai 1 ano
pai
achega
0817e751dd
Modificáronse 16 ficheiros con 523 adicións e 46 borrados
  1. 37 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/dictionary/AddDictionaryItemParam.java
  2. 39 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/dictionary/AddDictionaryParam.java
  3. 31 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/dictionary/UpdateDictionaryParam.java
  4. 17 0
      FullCardClient/src/main/java/com/zhongshu/card/client/type/DictionaryType.java
  5. 59 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/dictionary/DictionaryController.java
  6. 44 44
      FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/pay/PayTestController.java
  7. 13 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/DictionaryDao.java
  8. 12 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/DictionaryItemDao.java
  9. 4 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/extend/DictionaryDaoExtend.java
  10. 4 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/extend/DictionaryItemDaoEetend.java
  11. 6 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/impl/DictionaryDaoImpl.java
  12. 6 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/impl/DictionaryItemDaoImpl.java
  13. 48 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/dictionary/Dictionary.java
  14. 50 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/dictionary/DictionaryItem.java
  15. 151 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/dictionary/DictionaryService.java
  16. 2 2
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/pay/ChinaumsSenselessPayService.java

+ 37 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/dictionary/AddDictionaryItemParam.java

@@ -0,0 +1,37 @@
+package com.zhongshu.card.client.model.dictionary;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class AddDictionaryItemParam {
+
+    @Schema(name = "id", description = "项id", example = "665fc0ef9083d203896d3549")
+    private String id;
+
+    @Schema(name = "dictionaryId", description = "字典id", example = "665fc0ef9083d203896d3549")
+    @NotNull(message = "字典id不能为null")
+    @NotEmpty(message = "字典id不能为空")
+    private String dictionaryId;
+
+    @Schema(name = "parentId", description = "父级项id", example = "665fc0ef9083d203896d3549")
+    private String parentId;
+
+    @Schema(name = "key", description = "项编码", example = "20251001001")
+    @NotNull(message = "项编码不能为null")
+    @NotEmpty(message = "项编码不能为空")
+    private String key;
+
+    @Schema(name = "name", description = "项名称", example = "15信息1班")
+    private String name;
+
+    @Schema(name = "sort", description = "排序", example = "1")
+    private Integer sort = 1;
+
+}

+ 39 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/dictionary/AddDictionaryParam.java

@@ -0,0 +1,39 @@
+package com.zhongshu.card.client.model.dictionary;
+
+import com.zhongshu.card.client.type.DictionaryType;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class AddDictionaryParam {
+
+    @Schema(name = "oid", description = "项目oid", example = "665fc0ef9083d203896d3549")
+    @NotNull(message = "项目oid不能为null")
+    @NotEmpty(message = "项目oid不能为空")
+    private String projectId;
+
+    @Schema(name = "key", description = "常量", example = "class")
+    @NotNull(message = "类型key不能为null")
+    @NotEmpty(message = "类型key不能为空")
+    private String key;
+
+    @Schema(name = "name", description = "名称", example = "班级")
+    @NotNull(message = "name不能为null")
+    @NotEmpty(message = "name不能为空")
+    private String name;
+
+    @Schema(name = "description", description = "描述", example = "班级名称")
+    private String description;
+
+//    @Schema(name = "type", description = "类型", example = "Customize")
+//    private DictionaryType type;
+
+    @Schema(name = "是否禁用", description = "状态", example = "false")
+    private boolean disabled;
+}

+ 31 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/dictionary/UpdateDictionaryParam.java

@@ -0,0 +1,31 @@
+package com.zhongshu.card.client.model.dictionary;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class UpdateDictionaryParam {
+
+    @Schema(name = "id", description = "数据id", example = "123456")
+    @NotEmpty(message = "id不能为空")
+    @NotNull(message = "id不能为null")
+    private String id;
+
+    @Schema(name = "key", description = "常量", example = "sys_user_sex")
+    private String key;
+
+    @Schema(name = "name", description = "名称", example = "性别")
+    private String name;
+
+    @Schema(name = "description", description = "描述", example = "人员性别")
+    private String description;
+
+    @Schema(name = "是否禁用", description = "状态", example = "false")
+    private boolean disabled;
+}

+ 17 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/type/DictionaryType.java

@@ -0,0 +1,17 @@
+package com.zhongshu.card.client.type;
+
+import lombok.Getter;
+
+public enum DictionaryType {
+
+    Standard("标准类型"),
+    Customize("自定义类型"),
+    ;
+
+    @Getter
+    private String remark;
+
+    DictionaryType(String remark) {
+        this.remark = remark;
+    }
+}

+ 59 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/dictionary/DictionaryController.java

@@ -0,0 +1,59 @@
+package com.zhongshu.card.server.core.controller.dictionary;
+
+import com.github.microservice.net.ResultContent;
+import com.zhongshu.card.client.model.dictionary.AddDictionaryItemParam;
+import com.zhongshu.card.client.model.dictionary.AddDictionaryParam;
+import com.zhongshu.card.client.model.dictionary.UpdateDictionaryParam;
+import com.zhongshu.card.client.model.pay.RechargeParam;
+import com.zhongshu.card.server.core.service.dictionary.DictionaryService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+@RestController
+@RequestMapping("dictionary")
+@Tag(name = "标签字典", description = "标签字典")
+public class DictionaryController {
+
+    @Autowired
+    private DictionaryService dictionaryService;
+
+    @Operation(summary = "添加字典", description = "添加字典")
+    @RequestMapping(value = "addDictionary", method = RequestMethod.POST)
+    public Object addDictionary(@Valid @RequestBody AddDictionaryParam param){
+        return dictionaryService.addDictionary(param);
+    }
+
+    @Operation(summary = "修改字典", description = "修改字典")
+    @RequestMapping(value = "updateDictionary", method = RequestMethod.POST)
+    public ResultContent updateDictionary(@Valid @RequestBody UpdateDictionaryParam param){
+        return dictionaryService.updateDictionary(param);
+    }
+
+    @Operation(summary = "删除字典", description = "修改字典")
+    @RequestMapping(value = "deleteDictionary", method = RequestMethod.GET)
+    public ResultContent deleteDictionary(@RequestParam("id") String id){
+        return dictionaryService.deleteDictionary(id);
+    }
+
+    @Operation(summary = "添加项", description = "添加项")
+    @RequestMapping(value = "addItem", method = RequestMethod.POST)
+    public ResultContent addItem(@RequestBody AddDictionaryItemParam param){
+        return dictionaryService.addItem(param);
+    }
+
+    @Operation(summary = "修改项", description = "修改项")
+    @RequestMapping(value = "updateItem", method = RequestMethod.POST)
+    public ResultContent updateItem(@RequestBody AddDictionaryItemParam param){
+        return dictionaryService.updateItem(param);
+    }
+
+    @Operation(summary = "删除字典", description = "修改字典")
+    @RequestMapping(value = "deleteItem", method = RequestMethod.GET)
+    public ResultContent deleteItem(@RequestParam("id") String id){
+        return dictionaryService.deleteItem(id);
+    }
+}

+ 44 - 44
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/pay/PayTestController.java

@@ -1,44 +1,44 @@
-package com.zhongshu.card.server.core.controller.pay;
-
-import com.github.microservice.pay.client.service.ledger.TransactionLogService;
-import com.github.microservice.pay.client.service.product.SenselessPayService;
-import com.github.microservice.types.payment.PaymentType;
-import com.zhongshu.card.server.core.service.pay.ChinaumsSenselessPayService;
-import com.zhongshu.card.server.core.service.pay.SettleService;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.stream.binder.kafka.properties.KafkaBinderConfigurationProperties;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("payTest")
-@Tag(name = "资金测试", description = "机构资金-提现")
-public class PayTestController {
-
-    @Autowired
-    SettleService settleService;
-
-    @Autowired
-    ChinaumsSenselessPayService chinaumsSenselessPayService;
-
-    @Autowired
-    TransactionLogService transactionLogService;
-
-    @PostMapping("settle")
-    public Object settle(){
-        return settleService.settle("665fc0ef9083d203896d3549", "67061bea18e3af0f903b067a", 1732997367300L, "remark", PaymentType.UnionFrictionlessPay);
-    }
-
-        @PostMapping("queryRefund")
-    public Object queryRefund(){
-        return chinaumsSenselessPayService.refundQuery("665fc0ef9083d203896d3549","665fc0389083d203896d3541", "67061bea18e3af0f903b067a", "RE202411191422450130001", false);
-    }
-
-    @PostMapping("groupClean")
-    public Object groupClean(@RequestBody List<String> generalLedgerId){
-        return transactionLogService.groupClean(generalLedgerId);
-    }
-}
+//package com.zhongshu.card.server.core.controller.pay;
+//
+//import com.github.microservice.pay.client.service.ledger.TransactionLogService;
+//import com.github.microservice.pay.client.service.product.SenselessPayService;
+//import com.github.microservice.types.payment.PaymentType;
+//import com.zhongshu.card.server.core.service.pay.ChinaumsSenselessPayService;
+//import com.zhongshu.card.server.core.service.pay.SettleService;
+//import io.swagger.v3.oas.annotations.Parameter;
+//import io.swagger.v3.oas.annotations.tags.Tag;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.cloud.stream.binder.kafka.properties.KafkaBinderConfigurationProperties;
+//import org.springframework.web.bind.annotation.*;
+//
+//import java.util.List;
+//
+//@RestController
+//@RequestMapping("payTest")
+//@Tag(name = "资金测试", description = "机构资金-提现")
+//public class PayTestController {
+//
+//    @Autowired
+//    SettleService settleService;
+//
+//    @Autowired
+//    ChinaumsSenselessPayService chinaumsSenselessPayService;
+//
+//    @Autowired
+//    TransactionLogService transactionLogService;
+//
+//    @PostMapping("settle")
+//    public Object settle(){
+//        return settleService.settle("665fc0ef9083d203896d3549", "67061bea18e3af0f903b067a", 1732997367300L, "remark", PaymentType.UnionFrictionlessPay);
+//    }
+//
+//        @PostMapping("queryRefund")
+//    public Object queryRefund(){
+//        return chinaumsSenselessPayService.refundQuery("665fc0ef9083d203896d3549","665fc0389083d203896d3541", "67061bea18e3af0f903b067a", "RE202411191422450130001", false);
+//    }
+//
+//    @PostMapping("groupClean")
+//    public Object groupClean(@RequestBody List<String> generalLedgerId){
+//        return transactionLogService.groupClean(generalLedgerId);
+//    }
+//}

+ 13 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/DictionaryDao.java

@@ -0,0 +1,13 @@
+package com.zhongshu.card.server.core.dao.dictionary;
+
+import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
+import com.zhongshu.card.server.core.dao.dictionary.extend.DictionaryDaoExtend;
+import com.zhongshu.card.server.core.domain.dictionary.Dictionary;
+
+public interface DictionaryDao extends MongoDao<Dictionary>, DictionaryDaoExtend {
+
+    Dictionary findTopById(String id);
+
+    Dictionary findTopByProjectIdAndKey(String projectId, String key);
+
+}

+ 12 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/DictionaryItemDao.java

@@ -0,0 +1,12 @@
+package com.zhongshu.card.server.core.dao.dictionary;
+
+import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
+import com.zhongshu.card.server.core.dao.dictionary.extend.DictionaryDaoExtend;
+import com.zhongshu.card.server.core.domain.dictionary.DictionaryItem;
+
+public interface DictionaryItemDao extends MongoDao<DictionaryItem>, DictionaryDaoExtend {
+
+    DictionaryItem findTopById(String id);
+
+    DictionaryItem findTopByDictionary_IdAndKey(String dictionaryId, String key);
+}

+ 4 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/extend/DictionaryDaoExtend.java

@@ -0,0 +1,4 @@
+package com.zhongshu.card.server.core.dao.dictionary.extend;
+
+public interface DictionaryDaoExtend {
+}

+ 4 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/extend/DictionaryItemDaoEetend.java

@@ -0,0 +1,4 @@
+package com.zhongshu.card.server.core.dao.dictionary.extend;
+
+public interface DictionaryItemDaoEetend {
+}

+ 6 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/impl/DictionaryDaoImpl.java

@@ -0,0 +1,6 @@
+package com.zhongshu.card.server.core.dao.dictionary.impl;
+
+import com.zhongshu.card.server.core.dao.dictionary.extend.DictionaryDaoExtend;
+
+public class DictionaryDaoImpl implements DictionaryDaoExtend {
+}

+ 6 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/dictionary/impl/DictionaryItemDaoImpl.java

@@ -0,0 +1,6 @@
+package com.zhongshu.card.server.core.dao.dictionary.impl;
+
+import com.zhongshu.card.server.core.dao.dictionary.extend.DictionaryItemDaoEetend;
+
+public class DictionaryItemDaoImpl implements DictionaryItemDaoEetend {
+}

+ 48 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/dictionary/Dictionary.java

@@ -0,0 +1,48 @@
+package com.zhongshu.card.server.core.domain.dictionary;
+
+import com.github.microservice.components.data.mongo.mongo.domain.SuperEntity;
+import com.zhongshu.card.client.type.DictionaryType;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.checkerframework.common.aliasing.qual.Unique;
+import org.springframework.data.annotation.Id;
+import org.springframework.data.mongodb.core.index.CompoundIndex;
+import org.springframework.data.mongodb.core.index.CompoundIndexes;
+import org.springframework.data.mongodb.core.index.Indexed;
+import org.springframework.data.mongodb.core.mapping.Document;
+import org.springframework.stereotype.Controller;
+
+@Data
+@Document
+@AllArgsConstructor
+@NoArgsConstructor
+@CompoundIndexes(
+        @CompoundIndex(name = "projectId_key", def = "{'projectId' : 1, 'key' : 1}")
+)
+public class Dictionary extends SuperEntity {
+
+    //项目id
+    @Indexed
+    private String projectId;
+
+    //字典类型
+    @Indexed
+    private String key;
+
+    //名称
+    @Indexed
+    private String name;
+
+    //描述
+    private String description;
+
+    @Indexed
+    private DictionaryType type;
+
+    //启动/禁用
+    @Indexed
+    private boolean disabled;
+
+}

+ 50 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/dictionary/DictionaryItem.java

@@ -0,0 +1,50 @@
+package com.zhongshu.card.server.core.domain.dictionary;
+
+
+import com.github.microservice.components.data.mongo.mongo.domain.SuperEntity;
+import com.zhongshu.card.client.type.DictionaryType;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.data.mongodb.core.index.CompoundIndex;
+import org.springframework.data.mongodb.core.index.CompoundIndexes;
+import org.springframework.data.mongodb.core.index.Indexed;
+import org.springframework.data.mongodb.core.mapping.DBRef;
+import org.springframework.data.mongodb.core.mapping.Document;
+
+@Data
+@Document
+@AllArgsConstructor
+@NoArgsConstructor
+@CompoundIndexes(
+        @CompoundIndex(name = "dictionaryId_key", def = "{'dictionary._id' : 1, 'path' : 1}")
+)
+public class DictionaryItem extends SuperEntity {
+
+    //字典id
+    @DBRef(lazy = true)
+    private Dictionary dictionary;
+
+    //父级id
+    @Indexed
+    private String parentId;
+
+    //唯一值
+    @Indexed
+    private String key;
+
+    //字典项
+    private String name;
+
+    //类型
+    private DictionaryType type;
+
+    //排序
+    @Indexed
+    private Integer sort;
+
+    //禁用状态
+    @Indexed
+    private boolean disable;
+
+}

+ 151 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/dictionary/DictionaryService.java

@@ -0,0 +1,151 @@
+package com.zhongshu.card.server.core.service.dictionary;
+
+import com.github.microservice.net.ResultContent;
+import com.zhongshu.card.client.model.dictionary.AddDictionaryItemParam;
+import com.zhongshu.card.client.model.dictionary.AddDictionaryParam;
+import com.zhongshu.card.client.model.dictionary.UpdateDictionaryParam;
+import com.zhongshu.card.client.type.DictionaryType;
+import com.zhongshu.card.server.core.dao.dictionary.DictionaryDao;
+import com.zhongshu.card.server.core.dao.dictionary.DictionaryItemDao;
+import com.zhongshu.card.server.core.domain.dictionary.Dictionary;
+import com.zhongshu.card.server.core.domain.dictionary.DictionaryItem;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DictionaryService {
+
+    @Autowired
+    private DictionaryDao dictionaryDao;
+
+    @Autowired
+    private DictionaryItemDao dictionaryItemDao;
+
+    public ResultContent init(){
+        return null;
+    }
+
+    /**
+     * 添加字典
+     * @param param
+     * @return
+     */
+    public ResultContent addDictionary(AddDictionaryParam param){
+        Dictionary byProjectIdAndKey = dictionaryDao.findTopByProjectIdAndKey(param.getProjectId(), param.getKey());
+        if (byProjectIdAndKey != null){
+            return ResultContent.buildFail("字典编码已存在");
+        }
+        Dictionary dictionary = new Dictionary();
+        BeanUtils.copyProperties(param, dictionary);
+        dictionary.setType(DictionaryType.Customize);
+        dictionaryDao.save(dictionary);
+        return ResultContent.buildSuccess();
+    }
+
+    /**
+     * 编辑字典
+     */
+    public ResultContent updateDictionary(UpdateDictionaryParam param){
+        Dictionary dictionary = dictionaryDao.findTopById(param.getId());
+        if (dictionary == null){
+            return ResultContent.buildFail("数据不存在");
+        }
+
+        DictionaryType type = dictionary.getType();
+        if (DictionaryType.Standard.equals(type)){//如果为标准类型
+            if (StringUtils.isNotBlank(param.getKey())){
+                return ResultContent.buildFail("标准类型字典编码不允许修改");
+            }
+            if (param.isDisabled()){
+                return ResultContent.buildFail("标准类型字典不允许禁用");
+            }
+        }
+
+        Dictionary byProjectIdAndKey = dictionaryDao.findTopByProjectIdAndKey(dictionary.getProjectId(), param.getKey());
+        if (byProjectIdAndKey != null && !byProjectIdAndKey.getId().equals(param.getId())){
+            return ResultContent.buildFail("字典编码已存在");
+        }
+        com.zhongshu.card.server.core.util.BeanUtils.copyPropertiesWithoutNull(param, dictionary);
+        dictionaryDao.save(dictionary);
+        return ResultContent.buildSuccess();
+    }
+
+    /**
+     * 删除字典
+     */
+    public ResultContent deleteDictionary(String id){
+        Dictionary dictionary = dictionaryDao.findTopById(id);
+        if (dictionary == null){
+            return ResultContent.buildFail("数据不存在");
+        }
+        if (DictionaryType.Standard.equals(dictionary.getType())){
+            return ResultContent.buildFail("标准字典不允许删除");
+        }
+        dictionaryDao.deleteById(id);
+        //TODO 删除字典下的字典项
+        return ResultContent.buildSuccess();
+    }
+
+    /**
+     * 添加项
+     */
+    public ResultContent addItem(AddDictionaryItemParam param){
+        Dictionary dictionary = dictionaryDao.findTopById(param.getDictionaryId());
+        if (dictionary == null){
+            return ResultContent.buildFail("字典不存在");
+        }
+
+        DictionaryItem dictionaryItem = new DictionaryItem();
+        BeanUtils.copyProperties(param, dictionaryItem, "id");
+        dictionaryItem.setType(DictionaryType.Customize);
+        dictionaryItem.setDictionary(dictionary);
+        dictionaryItemDao.save(dictionaryItem);
+        return ResultContent.buildSuccess();
+    }
+
+    /**
+     * 编辑项
+     */
+    public ResultContent updateItem(AddDictionaryItemParam param){
+        if (StringUtils.isBlank(param.getId())){
+            return ResultContent.buildFail("id不能为null");
+        }
+        DictionaryItem dictionaryItem = dictionaryItemDao.findTopById(param.getId());
+        if (dictionaryItem == null){
+            return ResultContent.buildFail("数据不存在");
+        }
+
+        if (dictionaryItem.getType().equals(DictionaryType.Standard)){//标准
+            if (StringUtils.isNotBlank(param.getKey())){
+                return ResultContent.buildFail("标准字典的项编码不允许修改");
+            }
+        }
+
+        DictionaryItem updateItem = dictionaryItemDao.findTopByDictionary_IdAndKey(param.getDictionaryId(), param.getKey());
+        if (updateItem != null && !updateItem.getId().equals(param.getId())){
+            return ResultContent.buildFail("项编码已存在");
+        }
+
+        BeanUtils.copyProperties(param, dictionaryItem, "parentId", "dictionaryId");
+        dictionaryItemDao.save(dictionaryItem);
+        return ResultContent.buildSuccess();
+    }
+
+    /**
+     * 删除项
+     */
+    public ResultContent deleteItem(String id){
+        DictionaryItem dictionaryItem = dictionaryItemDao.findTopById(id);
+        if (dictionaryItem == null){
+            return ResultContent.buildFail("数据不存在");
+        }
+        if (DictionaryType.Standard.equals(dictionaryItem.getType())){
+            return ResultContent.buildFail("标准字典的项不允许删除");
+        }
+        dictionaryItemDao.deleteById(id);
+        return ResultContent.buildSuccess();
+    }
+
+}

+ 2 - 2
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/pay/ChinaumsSenselessPayService.java

@@ -46,6 +46,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.StopWatch;
 
 import java.math.BigDecimal;
+import java.math.MathContext;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -418,11 +419,10 @@ public class ChinaumsSenselessPayService extends SuperService {
 
             SatInfo satInfo = new SatInfo();
             satInfo.setMerId(orgConf.getMchId());
-            BigDecimal multiplyTotal = total.multiply(shareOrder.getRatio());
+            BigDecimal multiplyTotal = total.multiply(shareOrder.getRatio(), new MathContext(4));
             satInfo.setRefundAmt(multiplyTotal.toBigInteger().toString());
             satInfo.setRefundOrderId(shareOrderNo);
             satInfo.setOriMerOrderId(shareOrder.getShareOrderNo());
-
             ShareOrder refundShareOrder = new ShareOrder();
             refundShareOrder.setOrderNo(orderNo);
             refundShareOrder.setOid(shareOrder.getOid());