Преглед изворни кода

增加乐团获取包含打折金额的商品接口

周箭河 пре 4 година
родитељ
комит
6b97d09c51

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SporadicChargeInfoDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
@@ -10,4 +11,19 @@ public interface SporadicChargeInfoDao extends BaseDAO<Integer, SporadicChargeIn
     SporadicChargeInfo findInfoById(@Param("id") Integer id);
 
     SporadicChargeInfo findByOrganIdAndType(@Param("organId") Integer organId, @Param("chargeType") Integer chargeType);
+
+    /**
+     * 根据分部和类型获取活动信息
+     * @param organId
+     * @param chargeType
+     * @return
+     */
+    List<SporadicChargeInfo> getOrganActiveInfo(@Param("organId") Integer organId, @Param("chargeType") Integer chargeType);
+
+    /**
+     * 获取所有的活动分部
+     * @param type
+     * @return
+     */
+    List<Organization> getActiveOrgans(@Param("type") Integer type);
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
@@ -315,4 +316,12 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * @return
      */
     List<BasicUserDto> getUsers(@Param("search") String search);
+
+    /**
+     * 获取2020双十一活动统计
+     *
+     * @return
+     */
+    List<OrderStatisDto> doubleEleven2020Statis(@Param("organs") List<Organization> organs);
+
 }

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -355,4 +355,10 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
     List<StudentRegistration> getMusicGroupStu4Teacher(@Param("musicGroupId") String musicGroupId, @Param("teacherId") Integer teacherId);
 
     StudentRegistration getStudentRegister(@Param("musicGroupId") String musicGroupId, @Param("studentId") Integer studentId);
+
+    /**
+     * 获取分部乐团在读学生数
+     * @return
+     */
+    List<OrderStatisDto> getOrganNormalStudent();
 }

+ 20 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/LuckStatisDto.java

@@ -5,8 +5,10 @@ import java.util.List;
 
 public class LuckStatisDto {
     private List<OrderStatisDto> orderStatisDtoList;
-    private Integer totalNum;
-    private BigDecimal totalMoney;
+    private Integer totalEstimatedNums = 0;
+    private Integer totalNum = 0;
+    private BigDecimal totalMoney = BigDecimal.ZERO;
+    private BigDecimal scale = BigDecimal.ZERO;
 
     public List<OrderStatisDto> getOrderStatisDtoList() {
         return orderStatisDtoList;
@@ -31,4 +33,20 @@ public class LuckStatisDto {
     public void setTotalMoney(BigDecimal totalMoney) {
         this.totalMoney = totalMoney;
     }
+
+    public Integer getTotalEstimatedNums() {
+        return totalEstimatedNums;
+    }
+
+    public void setTotalEstimatedNums(Integer totalEstimatedNums) {
+        this.totalEstimatedNums = totalEstimatedNums;
+    }
+
+    public BigDecimal getScale() {
+        return scale;
+    }
+
+    public void setScale(BigDecimal scale) {
+        this.scale = scale;
+    }
 }

+ 29 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/OrderStatisDto.java

@@ -3,9 +3,20 @@ package com.ym.mec.biz.dal.dto;
 import java.math.BigDecimal;
 
 public class OrderStatisDto {
+    private Integer organId;
     private String organName;
-    private Integer nums;
-    private BigDecimal money;
+    private Integer estimatedNums = 0;
+    private Integer nums = 0;
+    private BigDecimal scale = BigDecimal.ZERO;
+    private BigDecimal money = BigDecimal.ZERO;
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
 
     public String getOrganName() {
         return organName;
@@ -30,4 +41,20 @@ public class OrderStatisDto {
     public void setMoney(BigDecimal money) {
         this.money = money;
     }
+
+    public Integer getEstimatedNums() {
+        return estimatedNums;
+    }
+
+    public void setEstimatedNums(Integer estimatedNums) {
+        this.estimatedNums = estimatedNums;
+    }
+
+    public BigDecimal getScale() {
+        return scale;
+    }
+
+    public void setScale(BigDecimal scale) {
+        this.scale = scale;
+    }
 }

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java

@@ -15,6 +15,7 @@ public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
 	PRACTICE_GROUP_RENEW("PRACTICE_GROUP_RENEW", "网管课续费"),
 	COURSE_GROUP_BUY("COURSE_GROUP_BUY","对外课程购买"),
 	LUCK("LUCK", "福袋活动"),
+	DOUBLE_ELEVEN2020("DOUBLE_ELEVEN2020","2020双十一活动"),
 	TENANT_RECHARGE("TENANT_RECHARGE","租户充值"),
 	GOODS_SELL("GOODS_SELL","商品销售"),
 	OUTORDER("OUTORDER", "外部订单"),

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SporadicChargeTypeEnum.java

@@ -13,7 +13,8 @@ public enum SporadicChargeTypeEnum implements BaseEnum<Integer, SporadicChargeTy
     VIP_BUY(8,"VIP课购买"),
     RECHARGE(9,"账户充值"),
     MUSIC_UPKEEP(10,"乐保服务"),
-    OTHER(11,"其他");
+    OTHER(11,"其他"),
+    DOUBLE_ELEVEN2020(12,"2020双十一活动");
 
     private Integer code;
 

+ 21 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/SporadicChargeInfoService.java

@@ -1,21 +1,27 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.page.SporadicChargeInfoQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface SporadicChargeInfoService extends BaseService<Integer, SporadicChargeInfo> {
 
     /**
      * 零星支付订单
+     *
      * @param order
      */
     Boolean renewForCallback(StudentPaymentOrder order);
 
     /**
      * 分页查询
+     *
      * @param queryInfo
      * @return
      */
@@ -23,15 +29,17 @@ public interface SporadicChargeInfoService extends BaseService<Integer, Sporadic
 
     /**
      * 单查询
+     *
      * @param id
      * @return
      */
     SporadicChargeInfo getDetail(Integer id);
 
-    SporadicChargeInfo findByOrganIdAndType(Integer organId,Integer type);
+    SporadicChargeInfo findByOrganIdAndType(Integer organId, Integer type);
 
     /**
      * 开启/关闭缴费
+     *
      * @param sporadicId
      * @param openFlag
      */
@@ -39,18 +47,28 @@ public interface SporadicChargeInfoService extends BaseService<Integer, Sporadic
 
     /**
      * 删除
+     *
      * @param id
      */
     void del(Integer id);
 
     /**
+     * @param id:
+     * @return com.ym.mec.biz.dal.entity.SporadicChargeInfo
      * @describe 获取详情
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/9/10
      * @time 15:20
-     * @param id:
-     * @return com.ym.mec.biz.dal.entity.SporadicChargeInfo
      */
     SporadicChargeInfo findDetail(Integer id, Integer userId);
+
+    /**
+     * 获取分部活动信息
+     *
+     * @param organId
+     * @param type
+     * @return
+     */
+    List<SporadicChargeInfo> getOrganActiveInfo(Integer organId, Integer type);
 }

+ 7 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SporadicChargeInfoImpl.java

@@ -84,8 +84,8 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
             }
 
             //福袋活动,增加课程余额
-            if (info.getChargeType().getCode() == 6) {
-                sysUserCashAccountService.appendCourseBalance(userId, studentPaymentOrder.getActualAmount(), PlatformCashAccountDetailTypeEnum.SPORADIC, "活动");
+            if (info.getChargeType().getCode() == 6 || info.getChargeType().getCode() == 12) {
+                sysUserCashAccountService.appendCourseBalance(userId, studentPaymentOrder.getActualAmount(), PlatformCashAccountDetailTypeEnum.SPORADIC, "双11活动");
             } else if (info.getChargeType().getCode() == 9) { //零星收费账户充值
                 sysUserCashAccountService.updateBalance(userId, studentPaymentOrder.getActualAmount(), PlatformCashAccountDetailTypeEnum.RECHARGE, "零星收费账户充值", studentPaymentOrder.getTransNo());
             } else if (info.getOrganId().equals(42) && info.getChargeType().equals(SporadicChargeTypeEnum.LEVEL)) {
@@ -242,4 +242,9 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
         }
         return chargeInfo;
     }
+
+    @Override
+    public List<SporadicChargeInfo> getOrganActiveInfo(Integer organId, Integer type) {
+        return sporadicChargeInfoDao.getOrganActiveInfo(organId, type);
+    }
 }

+ 7 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -234,13 +234,18 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         }
         order.setPaymentBusinessChannel(rpMap.get("channelType"));
 
+        callOrderCallBack(order);
+    }
+
+    //调用相应业务回调接口
+    private void callOrderCallBack(StudentPaymentOrder order) throws Exception {
         if (order.getType().equals(OrderTypeEnum.APPLY)) { //报名订单
             studentRegistrationService.updateApplyOrder(order);
         } else if (order.getType().equals(OrderTypeEnum.SMALL_CLASS_TO_BUY)) {
             vipGroupService.orderCallback(order);
         } else if (order.getType().equals(OrderTypeEnum.RENEW)) {
             musicGroupService.renewForCallback(order);
-        } else if (order.getType().equals(OrderTypeEnum.SPORADIC) || order.getType().equals(OrderTypeEnum.LUCK)) {
+        } else if (order.getType().equals(OrderTypeEnum.SPORADIC) || order.getType().equals(OrderTypeEnum.LUCK) || order.getType().equals(OrderTypeEnum.DOUBLE_ELEVEN2020)) {
             sporadicChargeInfoService.renewForCallback(order);
         } else if (order.getType().equals(OrderTypeEnum.PRACTICE_GROUP_BUY) || order.getType().equals(OrderTypeEnum.PRACTICE_GROUP_RENEW)) {
             practiceGroupService.orderCallback(order);
@@ -273,23 +278,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             try {
                 order.setStatus(DealStatusEnum.FAILED);
                 order.setMemo("超时未支付关闭");
-                if (order.getType().equals(OrderTypeEnum.APPLY)) { //报名订单
-                    studentRegistrationService.updateApplyOrder(order);
-                } else if (order.getType().equals(OrderTypeEnum.SMALL_CLASS_TO_BUY)) {
-                    vipGroupService.orderCallback(order);
-                } else if (order.getType().equals(OrderTypeEnum.RENEW)) {
-                    musicGroupService.renewForCallback(order);
-                } else if (order.getType().equals(OrderTypeEnum.SPORADIC) || order.getType().equals(OrderTypeEnum.LUCK)) {
-                    sporadicChargeInfoService.renewForCallback(order);
-                } else if (order.getType().equals(OrderTypeEnum.PRACTICE_GROUP_BUY) || order.getType().equals(OrderTypeEnum.PRACTICE_GROUP_RENEW)) {
-                    practiceGroupService.orderCallback(order);
-                } else if (order.getType().equals(OrderTypeEnum.REPAIR)) {
-                    studentRepairService.orderCallback(order);
-                } else if (order.getType().equals(OrderTypeEnum.GOODS_SELL)) {
-                    studentRepairService.goodsSellOrderCallback(order);
-                } else if (order.getType().equals(OrderTypeEnum.SUBJECT_CHANGE)) {
-                    subjectChangeService.orderCallback(order);
-                }
+                callOrderCallBack(order);
             } catch (Exception e) {
                 e.printStackTrace();
                 continue;

+ 10 - 0
mec-biz/src/main/resources/config/mybatis/SporadicChargeInfo.xml

@@ -132,4 +132,14 @@
 	<select id="findByOrganIdAndType" resultMap="SporadicChargeInfo">
 		SELECT * FROM sporadic_charge_info where organ_id_=#{organId} AND charge_type_=#{chargeType} AND del_flag_=0
 	</select>
+    <select id="getOrganActiveInfo" resultMap="SporadicChargeInfo">
+		SELECT * FROM sporadic_charge_info where organ_id_=#{organId} AND charge_type_=#{chargeType} AND del_flag_=0
+	</select>
+
+    <select id="getActiveOrgans" resultMap="com.ym.mec.biz.dal.dao.OrganizationDao.Organization">
+		SELECT o.* FROM sporadic_charge_info sci
+		LEFT JOIN organization o ON o.id_ =sci.organ_id_
+		WHERE sci.charge_type_ = #{type} AND sci.del_flag_=0
+		GROUP BY o.id_
+	</select>
 </mapper>

+ 16 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -557,8 +557,11 @@
     </sql>
 
     <resultMap id="luckStatis" type="com.ym.mec.biz.dal.dto.OrderStatisDto">
+        <result property="organId" column="organId"/>
         <result property="organName" column="organName"/>
+        <result property="estimatedNums" column="estimatedNums"/>
         <result property="nums" column="nums"/>
+        <result property="scale" column="scale"/>
         <result property="money" column="money"/>
     </resultMap>
     <select id="getLuckStatis" resultMap="luckStatis">
@@ -720,4 +723,17 @@
         WHERE id_ = #{id} FOR
         UPDATE
     </select>
+
+    <select id="doubleEleven2020Statis" resultMap="luckStatis">
+        SELECT o.id_ organId, o.name_ organName, SUM(spo.actual_amount_) money, COUNT(DISTINCT spo.user_id_) nums
+        FROM student_payment_order spo
+        LEFT JOIN organization o ON o.id_ = spo.organ_id_
+        WHERE spo.type_ = 'DOUBLE_ELEVEN2020'
+        AND spo.status_ = 'SUCCESS'
+        AND spo.organ_id_ IN
+        <foreach collection="organs" item="organ" open="(" close=")" separator=",">
+            #{organ.id}
+        </foreach>
+        GROUP BY spo.organ_id_
+    </select>
 </mapper>

+ 9 - 0
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -651,4 +651,13 @@
         SELECT * FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND user_id_ = #{studentId}
         ORDER BY id_ DESC LIMIT 1
     </select>
+
+    <!-- 获取分部乐团在读人数 -->
+    <select id="getOrganNormalStudent" resultMap="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.luckStatis">
+        SELECT mg.organ_id_ organId, COUNT(DISTINCT sr.user_id_) estimatedNums
+        FROM student_registration sr
+                 LEFT JOIN music_group mg ON sr.music_group_id_ = mg.id_
+        WHERE sr.music_group_status_ = 'NORMAL'
+        GROUP BY mg.organ_id_
+    </select>
 </mapper>

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -34,7 +34,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 				.antMatchers("/task/**")
 				.hasIpAddress("0.0.0.0/0")
 				.antMatchers("/v2/api-docs", "/classGroup/highClassGroups", "/code/*", "/api/*", "/appVersionInfo/queryByPlatform", "/eduDegree/*",
-						"/uploadFile", "/eduContracts/queryProduceContract").permitAll().anyRequest().authenticated().and().httpBasic();
+						"/uploadFile", "/eduContracts/queryProduceContract","/activity/doubleEleven2020Statis").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 3 - 21
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -902,27 +902,9 @@ public class ExportController extends BaseController {
                 row.setMusicalFee(BigDecimal.ZERO);
                 row.setTeachingFee(BigDecimal.ZERO);
                 if (row.getChargeType() != null) {
-
-                    if (row.getChargeType().equals(1)) {
-                        row.setSporadicType("考级");
-                    } else if (row.getChargeType().equals(2)) {
-                        row.setSporadicType("声部更改");
-                    } else if (row.getChargeType().equals(3)) {
-                        row.setSporadicType("乐器更换");
-                    } else if (row.getChargeType().equals(4)) {
-                        row.setSporadicType("配件销售");
-                    } else if (row.getChargeType().equals(5)) {
-                        row.setSporadicType("维修费");
-                    } else if (row.getChargeType().equals(6)) {
-                        row.setSporadicType("福袋活动");
-                    } else if (row.getChargeType().equals(7)) {
-                        row.setSporadicType("上门费");
-                    } else if (row.getChargeType().equals(9)) {
-                        row.setSporadicType("账户充值");
-                    } else if (row.getChargeType().equals(10)) {
-                        row.setSporadicType("乐保服务");
-                    } else if (row.getChargeType().equals(11)) {
-                        row.setSporadicType("其他");
+                    for (SporadicChargeTypeEnum chargeType : SporadicChargeTypeEnum.values()) {
+                        if (!chargeType.getCode().equals(row.getChargeType())) continue;
+                        row.setSporadicType(chargeType.getMsg());
                     }
                 }
                 School userSchool = musicGroupDao.findUserSchool(row.getUserId());

+ 6 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SporadicChargeInfoController.java

@@ -94,6 +94,12 @@ public class SporadicChargeInfoController extends BaseController {
 				return failed("分部活动已存在,请勿重复创建");
 			}
 		}
+		if (sporadicChargeInfo.getChargeType().equals(SporadicChargeTypeEnum.DOUBLE_ELEVEN2020)) {
+			List<SporadicChargeInfo> organActiveInfo = sporadicChargeInfoService.getOrganActiveInfo(sporadicChargeInfo.getOrganId(), sporadicChargeInfo.getChargeType().getCode());
+			if (organActiveInfo.size() >= 2) {
+				return failed("分部活动已存在,请勿重复创建");
+			}
+		}
 		return succeed(sporadicChargeInfoService.insert(sporadicChargeInfo));
 	}