Browse Source

套餐明细修改

lihong 1 year ago
parent
commit
2ad02861be

+ 1 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/DiscountController.java

@@ -375,7 +375,7 @@ public class DiscountController {
      **/
     @PostMapping("/queryTcByTemplateId")
     public R queryTcByTemplateId(@RequestBody Discount discount) {
-        List<Map<String, Object>> data = discountService.queryTcByTemplateId(discount.getTemplateId());
+       Map<String, Object> data = discountService.queryTcByTemplateId(discount.getTemplateId());
         return R.ok().put("data", data);
     }
 

+ 2 - 0
src/main/java/cn/hnthyy/thmz/mapper/thmz/DiscountMapper.java

@@ -227,4 +227,6 @@ public interface DiscountMapper {
             "         join t_template t2 on t1.template_id = t2.id" +
             " where t1.delete_flag = 0  and t1.discount_begin_time <=now() and t1.discount_end_time>=now()")
     List<Discount> queryTcDiscunt();
+    @Select("   select  *  from t_discount where template_id =#{templateId} limit 1")
+    Discount queryTcDiscuntByTemplateId(Long templateId);
 }

+ 9 - 2
src/main/java/cn/hnthyy/thmz/service/impl/thmz/DiscountServiceImpl.java

@@ -436,8 +436,14 @@ public class DiscountServiceImpl implements DiscountService {
      * @return: java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
      */
     @Override
-    public List<Map<String, Object>> queryTcByTemplateId(Long templateId) {
+    public Map<String, Object> queryTcByTemplateId(Long templateId) {
         AssertUtil.isNotBlank(templateId,"模板id不能为空");
+        Map<String, Object> resultMap = new HashMap<>();
+        Discount discount =discountMapper.queryTcDiscuntByTemplateId(templateId);
+        if(discount == null) return resultMap;
+        BigDecimal tcFee = getTcFee(templateId, discount.getDiscountRate());
+        discount.setTcFee(tcFee);
+        resultMap.put("tcInfo", discount);
         List<Map<String, Object>> result = new ArrayList<>();
         Template template = templateService.queryById(templateId);
         if (template != null && StrUtil.isNotBlank(template.getTemplateData())) {
@@ -459,6 +465,7 @@ public class DiscountServiceImpl implements DiscountService {
                 });
             }
         }
-        return result;
+        resultMap.put("items", result);
+        return resultMap;
     }
 }

+ 2 - 2
src/main/java/cn/hnthyy/thmz/service/thmz/DiscountService.java

@@ -115,7 +115,7 @@ public interface DiscountService {
      * @description:根据模板id 查询项目明细
      * @author: lihong
      * @date: 2023/10/24 16:54
- * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
+     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
      **/
-    List<Map<String, Object>> queryTcByTemplateId(Long templateId);
+    Map<String, Object> queryTcByTemplateId(Long templateId);
 }