Browse Source

Merge remote-tracking branch 'origin/saas' into saas

zouxuan 3 năm trước cách đây
mục cha
commit
bcbd7e6f86
22 tập tin đã thay đổi với 456 bổ sung67 xóa
  1. 4 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java
  2. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantApplyDao.java
  3. 134 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantApply.java
  4. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherAddQueryInfo.java
  5. 4 2
      mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java
  6. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/TenantApplyService.java
  7. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java
  8. 4 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java
  9. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantApplyServiceImpl.java
  10. 14 12
      mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml
  11. 7 6
      mec-biz/src/main/resources/config/mybatis/GoodsOrderItemMapper.xml
  12. 7 6
      mec-biz/src/main/resources/config/mybatis/GoodsOrderMapper.xml
  13. 7 6
      mec-biz/src/main/resources/config/mybatis/GoodsOrderPaymentMapper.xml
  14. 10 9
      mec-biz/src/main/resources/config/mybatis/GoodsProcurementMapper.xml
  15. 1 1
      mec-biz/src/main/resources/config/mybatis/SysMusicScoreCategoriesMapper.xml
  16. 95 0
      mec-biz/src/main/resources/config/mybatis/TenantApplyMapper.xml
  17. 2 2
      mec-student/src/main/java/com/ym/mec/student/StudentApplication.java
  18. 20 0
      mec-student/src/main/java/com/ym/mec/student/controller/TenantInfoController.java
  19. 2 2
      mec-teacher/src/main/java/com/ym/mec/teacher/TeacherApplication.java
  20. 28 11
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TenantInfoController.java
  21. 1 1
      mec-web/src/main/java/com/ym/mec/web/WebApplication.java
  22. 71 0
      mec-web/src/main/java/com/ym/mec/web/controller/TenantApplyController.java

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java

@@ -29,7 +29,7 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
      * @param goodsCategoryId
      * @return
      */
-    int findGoodsNumByCategoryId(@Param("goodsCategoryId") Integer goodsCategoryId);
+    int findGoodsNumByCategoryId(@Param("goodsCategoryId") Integer goodsCategoryId, @Param("tenantId") Integer tenantId);
 
     /**
      * 根据ids获取商品信息
@@ -39,7 +39,7 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
      */
     List<Goods> findGoodsByIds(@Param("ids") String ids);
 
-    List<Goods> findTypeGoods(@Param("type") String type);
+    List<Goods> findTypeGoods(@Param("type") String type, @Param("tenantId") Integer tenantId);
 
     /**
      * @param goodsList:
@@ -148,7 +148,8 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
     List<MusicGroupGoodsAndDiscountDto> getMusicGroupGoodsAndDiscount(@Param("subjectId") Integer subjectId,
                                                                       @Param("type") String type,
                                                                       @Param("courseViewType") Integer courseViewType,
-                                                                      @Param("organId") Integer organId);
+                                                                      @Param("organId") Integer organId,
+                                                                      @Param("tenantId") Integer tenantId);
 
     /**
      * 是否存在已上架的商品编号

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

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.TenantApply;
+import com.ym.mec.common.dal.BaseDAO;
+
+public interface TenantApplyDao extends BaseDAO<Long, TenantApply> {
+
+	
+}

+ 134 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantApply.java

@@ -0,0 +1,134 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(tenant_apply):
+ */
+public class TenantApply {
+
+	/**  */
+	private Long id;
+	
+	/** 机构名称 */
+	private String name;
+	
+	/** 城市 */
+	private String city;
+	
+	/** 联系人 */
+	private String linkman;
+	
+	/** 手机号码 */
+	private String mobileNo;
+	
+	/** 推荐人姓名 */
+	private String nameOfReferrer;
+	
+	private Integer studentNumLevel;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/** 回访时间 */
+	private java.util.Date callBackTime;
+	
+	/** 回访记录 */
+	private String callBackLog;
+	
+	private String smsCode;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setName(String name){
+		this.name = name;
+	}
+	
+	public String getName(){
+		return this.name;
+	}
+			
+	public void setCity(String city){
+		this.city = city;
+	}
+	
+	public String getCity(){
+		return this.city;
+	}
+			
+	public void setLinkman(String linkman){
+		this.linkman = linkman;
+	}
+	
+	public String getLinkman(){
+		return this.linkman;
+	}
+			
+	public void setMobileNo(String mobileNo){
+		this.mobileNo = mobileNo;
+	}
+	
+	public String getMobileNo(){
+		return this.mobileNo;
+	}
+			
+	public Integer getStudentNumLevel() {
+		return studentNumLevel;
+	}
+
+	public void setStudentNumLevel(Integer studentNumLevel) {
+		this.studentNumLevel = studentNumLevel;
+	}
+
+	public String getNameOfReferrer() {
+		return nameOfReferrer;
+	}
+
+	public void setNameOfReferrer(String nameOfReferrer) {
+		this.nameOfReferrer = nameOfReferrer;
+	}
+
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setCallBackTime(java.util.Date callBackTime){
+		this.callBackTime = callBackTime;
+	}
+	
+	public java.util.Date getCallBackTime(){
+		return this.callBackTime;
+	}
+			
+	public void setCallBackLog(String callBackLog){
+		this.callBackLog = callBackLog;
+	}
+	
+	public String getCallBackLog(){
+		return this.callBackLog;
+	}
+			
+	public String getSmsCode() {
+		return smsCode;
+	}
+
+	public void setSmsCode(String smsCode) {
+		this.smsCode = smsCode;
+	}
+
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherAddQueryInfo.java

@@ -11,7 +11,7 @@ public class CloudTeacherAddQueryInfo extends QueryInfo {
 	@ApiModelProperty(value = "学生编号数组", required = true)
 	private List<Integer> studentIds;
 
-	@ApiModelProperty(value = "类型 1-天, 2-月 3-季, 4-半年, 5-年", required = true)
+	@ApiModelProperty(value = "类型 0-天, 1-月 2-季, 3-半年, 4-年", required = true)
 	private PeriodEnum addType;
 
 	@ApiModelProperty(value = "数量", required = true)

+ 4 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java

@@ -9,8 +9,10 @@ import com.ym.mec.biz.dal.page.GoodsQuery;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
+
 import org.apache.ibatis.annotations.Param;
 import org.springframework.web.multipart.MultipartFile;
+
 import java.util.List;
 
 public interface GoodsService extends BaseService<Integer, Goods> {
@@ -43,7 +45,7 @@ public interface GoodsService extends BaseService<Integer, Goods> {
      * @param goodsCategoryId
      * @return
      */
-    int findGoodsNumByCategoryId(@Param("goodsCategoryId") Integer goodsCategoryId);
+    int findGoodsNumByCategoryId(Integer goodsCategoryId, Integer tenantId);
 
     /**
      * 根据ids获取商品信息
@@ -57,7 +59,7 @@ public interface GoodsService extends BaseService<Integer, Goods> {
      * @param type
      * @return
      */
-    List<Goods> findTypeGoods(String type);
+    List<Goods> findTypeGoods(String type, Integer tenantId);
 
     /**
      * @describe 商品导入

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/TenantApplyService.java

@@ -0,0 +1,8 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.TenantApply;
+import com.ym.mec.common.service.BaseService;
+
+public interface TenantApplyService extends BaseService<Long, TenantApply> {
+
+}

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -181,8 +181,8 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		return goodsDao.findGoodsBySubId(goodsQuery);
 	}
 
-	public int findGoodsNumByCategoryId(Integer goodsCategoryId){
-		return goodsDao.findGoodsNumByCategoryId(goodsCategoryId);
+	public int findGoodsNumByCategoryId(Integer goodsCategoryId, Integer tenantId){
+		return goodsDao.findGoodsNumByCategoryId(goodsCategoryId, tenantId);
 	}
 
 	@Override
@@ -191,8 +191,8 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	}
 
 	@Override
-	public List<Goods> findTypeGoods(String type) {
-		return goodsDao.findTypeGoods(type);
+	public List<Goods> findTypeGoods(String type, Integer tenantId) {
+		return goodsDao.findTypeGoods(type, tenantId);
 	}
 
 	@Override

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -13,11 +13,14 @@ import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
@@ -198,7 +201,7 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
             courseViewType = musicGroup.getCourseViewType().getCode();
             organId = musicGroup.getOrganId();
         }
-        List<MusicGroupGoodsAndDiscountDto> goodsList = goodsDao.getMusicGroupGoodsAndDiscount(subjectId, type, courseViewType,organId);
+        List<MusicGroupGoodsAndDiscountDto> goodsList = goodsDao.getMusicGroupGoodsAndDiscount(subjectId, type, courseViewType,organId, TenantContextHolder.getTenantId());
         if (chargeTypeId == null || (type != null && !"INSTRUMENT".equals(type))) {
             return goodsList;
         }

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantApplyServiceImpl.java

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.biz.dal.dao.TenantApplyDao;
+import com.ym.mec.biz.dal.entity.TenantApply;
+import com.ym.mec.biz.service.TenantApplyService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+
+@Service
+public class TenantApplyServiceImpl extends BaseServiceImpl<Long, TenantApply>  implements TenantApplyService {
+	
+	@Autowired
+	private TenantApplyDao tenantApplyDao;
+
+	@Override
+	public BaseDAO<Long, TenantApply> getDAO() {
+		return tenantApplyDao;
+	}
+	
+}

+ 14 - 12
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -46,6 +46,7 @@
         <result column="course_fee_show_organ_name_" property="courseFeeShowOrganName"/>
         <result column="member_fee_show_organ_id_" property="memberFeeShowOrganId"/>
         <result column="member_fee_show_organ_name_" property="memberFeeShowOrganName"/>
+        <result column="tenant_id_" property="tenantId"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -60,7 +61,7 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="Goods">
-		SELECT * FROM goods ORDER BY id_
+		SELECT * FROM goods where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
     <!-- 向数据库增加一条记录 -->
@@ -70,20 +71,20 @@
         (goods_category_id_,sn_,name_,brand_,specification_,image_,stock_count_,tax_stock_count_,sell_count_,market_price_,
         discount_price_,group_purchase_price_,brief_,desc_,is_new_,is_top_,status_,memo_,publish_time_,
         complement_goods_id_list_,update_time_,create_time_,type_,agree_cost_price_,stock_warning_,stock_type_
-            ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_)
+            ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_,tenant_id_)
         VALUES(#{goodsCategoryId},#{sn},#{name},#{brand},#{specification},#{image},#{stockCount},#{taxStockCount},#{sellCount},#{marketPrice},
         #{discountPrice},#{groupPurchasePrice},#{brief},#{desc},
         #{isNew,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{isTop,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{memo},#{publishTime},#{complementGoodsIdList},now(),now(),#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{agreeCostPrice},
         #{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{studentShowOrganId},#{educationShowOrganId},#{replacementShowOrganId},#{courseFeeShowOrganId},#{memberFeeShowOrganId})
+        #{studentShowOrganId},#{educationShowOrganId},#{replacementShowOrganId},#{courseFeeShowOrganId},#{memberFeeShowOrganId},#{tenantId})
     </insert>
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
         INSERT INTO goods
         (goods_category_id_,name_,brand_,specification_,image_,market_price_,
         discount_price_,group_purchase_price_,brief_,desc_,update_time_,create_time_,type_,agree_cost_price_,sn_,
         stock_count_,tax_stock_count_,stock_warning_,stock_type_
-        ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_)
+        ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_,tenant_id_)
         VALUES
         <foreach collection="list" separator="," item="goods">
             (#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
@@ -92,7 +93,7 @@
             #{goods.stockCount},#{goods.taxStockCount},
             #{goods.stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{goods.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{goods.studentShowOrganId},#{goods.educationShowOrganId},#{goods.replacementShowOrganId},#{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId}
+            #{goods.studentShowOrganId},#{goods.educationShowOrganId},#{goods.replacementShowOrganId},#{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId},#{goods.tenantId}
             )
         </foreach>
     </insert>
@@ -179,7 +180,7 @@
             </if>
                 update_time_ = NOW()
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.Goods">
@@ -275,7 +276,7 @@
                 </if>
                     update_time_ = NOW()
             </set>
-            WHERE id_ = #{goods.id}
+            WHERE id_ = #{goods.id} and tenant_id_ = #{goods.tenantId}
         </foreach>
     </update>
 
@@ -301,6 +302,7 @@
 
     <sql id="queryGoodsPageSql">
         <where>
+        	g.tenant_id_ = #{tenantId}
             <if test="goodsCategoryId != null">
                 AND g.goods_category_id_ = #{goodsCategoryId}
             </if>
@@ -361,7 +363,7 @@
 
     <sql id="queryOrganIdSql">
         <where>
-                AND g.status_ != 0
+                AND g.status_ != 0 and g.tenant_id_ = #{goodsQuery.tenantId}
             <if test="goodsQuery.subjectId != null">
                 AND sgm.subject_id_ = #{goodsQuery.subjectId}
             </if>
@@ -396,13 +398,13 @@
 
     <!-- 根据 -->
     <select id="findGoodsNumByCategoryId" resultType="int">
-        SELECT COUNT(*) FROM goods WHERE goods_category_id_ = #{goodsCategoryId}
+        SELECT COUNT(*) FROM goods WHERE goods_category_id_ = #{goodsCategoryId} and tenant_id_ = #{tenantId}
     </select>
     <select id="findGoodsByIds" resultMap="Goods">
         SELECT * FROM goods WHERE FIND_IN_SET(id_,#{ids})
     </select>
     <select id="findTypeGoods" resultMap="Goods">
-        SELECT * FROM goods WHERE type_ = #{type} AND status_ != 0
+        SELECT * FROM goods WHERE type_ = #{type} AND status_ != 0 and tenant_id_ = #{tenantId}
     </select>
     <select id="getGoodies" resultMap="Goods">
         SELECT * FROM goods WHERE id_ IN
@@ -459,7 +461,7 @@
     <select id="getMusicGroupGoodsAndDiscount" resultMap="MusicGroupGoods">
         SELECT g.* FROM subject_goods_mapper sgm
         LEFT JOIN goods g ON sgm.goods_category_id_ = g.goods_category_id_
-        WHERE sgm.subject_id_ = #{subjectId} AND g.status_ != 0
+        WHERE sgm.subject_id_ = #{subjectId} AND g.status_ != 0 and g.tenant_id_ = #{tenantId}
         <if test="organId != null">
             <if test="courseViewType != null">
                 <if test="courseViewType == 2">
@@ -523,7 +525,7 @@
         <where>
             g.status_ != 0
             AND g.type_ = 'INSTRUMENT'
-            AND gc.del_flag_ = 0
+            AND gc.del_flag_ = 0 and g.tenant_id_ = #{tenantId}
             <if test="organId != null">
                 AND FIND_IN_SET(#{organId},g.replacement_show_organ_id_)
             </if>

+ 7 - 6
mec-biz/src/main/resources/config/mybatis/GoodsOrderItemMapper.xml

@@ -13,6 +13,7 @@
 		<result column="goods_quantity_" property="goodsQuantity" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+        <result column="tenant_id_" property="tenantId"/>
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -23,7 +24,7 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="GoodsOrderItem">
-		SELECT * FROM goods_order_item
+		SELECT * FROM goods_order_item where tenant_id_ = #{tenantId}
 		ORDER BY id_
 	</select>
 
@@ -31,8 +32,8 @@
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.GoodsOrderItem"
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO goods_order_item
-		(id_,goods_order_id_,goods_id_,market_price_,discount_price_,goods_quantity_,create_time_,update_time_)
-		VALUES(#{id},#{goodsOrderId},#{goodsId},#{marketPrice},#{discountPrice},#{goodsQuantity},now(),now())
+		(id_,goods_order_id_,goods_id_,market_price_,discount_price_,goods_quantity_,create_time_,update_time_,tenant_id_)
+		VALUES(#{id},#{goodsOrderId},#{goodsId},#{marketPrice},#{discountPrice},#{goodsQuantity},now(),now(),#{tenantId})
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -64,7 +65,7 @@
 				create_time_ = #{createTime},
 			</if>
 		</set>
-		WHERE id_ = #{id}
+		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<!-- 根据主键删除一条记录 -->
@@ -75,13 +76,13 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="GoodsOrderItem" parameterType="map">
-		SELECT * FROM goods_order_item ORDER BY id_
+		SELECT * FROM goods_order_item where tenant_id_ = #{tenantId} ORDER BY id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM
-		goods_order_item
+		goods_order_item where tenant_id_ = #{tenantId}
 	</select>
 </mapper>

+ 7 - 6
mec-biz/src/main/resources/config/mybatis/GoodsOrderMapper.xml

@@ -18,6 +18,7 @@
 		<result column="express_num_" property="expressNum" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+        <result column="tenant_id_" property="tenantId"/>
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -28,7 +29,7 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="GoodsOrder">
-		SELECT * FROM goods_order ORDER
+		SELECT * FROM goods_order where tenant_id_ = #{tenantId} ORDER
 		BY id_
 	</select>
 
@@ -38,8 +39,8 @@
 		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO goods_order
-		(id_,user_id_,status_,total_amount_,coupon_amount_,goods_quantity_,user_note_,order_no_,order_source_,receiver_id_,express_company_code_,express_num_,create_time_,update_time_)
-		VALUES(#{id},#{userId},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{totalAmount},#{couponAmount},#{goodsQuantity},#{userNote},#{orderNo},#{orderSource},#{receiverId},#{expressCompanyCode},#{expressNum},now(),now())
+		(id_,user_id_,status_,total_amount_,coupon_amount_,goods_quantity_,user_note_,order_no_,order_source_,receiver_id_,express_company_code_,express_num_,create_time_,update_time_,tenant_id_)
+		VALUES(#{id},#{userId},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{totalAmount},#{couponAmount},#{goodsQuantity},#{userNote},#{orderNo},#{orderSource},#{receiverId},#{expressCompanyCode},#{expressNum},now(),now(),#{tenantId})
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -89,7 +90,7 @@
 				express_num_ = #{expressNum},
 			</if>
 		</set>
-		WHERE id_ = #{id}
+		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<!-- 根据主键删除一条记录 -->
@@ -99,13 +100,13 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="GoodsOrder" parameterType="map">
-		SELECT * FROM goods_order ORDER BY id_
+		SELECT * FROM goods_order where tenant_id_ = #{tenantId} ORDER BY id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM
-		goods_order
+		goods_order where tenant_id_ = #{tenantId}
 	</select>
 </mapper>

+ 7 - 6
mec-biz/src/main/resources/config/mybatis/GoodsOrderPaymentMapper.xml

@@ -19,6 +19,7 @@
 		<result column="remark_" property="remark" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+        <result column="tenant_id_" property="tenantId"/>
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -29,7 +30,7 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="GoodsOrderPayment">
-		SELECT * FROM goods_order_payment
+		SELECT * FROM goods_order_payment where tenant_id_ = #{tenantId}
 		ORDER BY id_
 	</select>
 
@@ -37,8 +38,8 @@
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.GoodsOrderPayment"
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO goods_order_payment
-		(id_,user_id_,goods_order_id_,payment_channel_,payment_business_channel_,payment_account_no_,amount_,trans_no_,order_no_,pay_status_,arrival_time_,remark_,create_time_,update_time_)
-		VALUES(#{id},#{userId},#{goodsOrderId},#{paymentChannel},#{paymentBusinessChannel},#{paymentAccountNo},#{amount},#{transNo},#{orderNo},#{payStatus, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{arrivalTime},#{remark},now(),now())
+		(id_,user_id_,goods_order_id_,payment_channel_,payment_business_channel_,payment_account_no_,amount_,trans_no_,order_no_,pay_status_,arrival_time_,remark_,create_time_,update_time_,tenant_id_)
+		VALUES(#{id},#{userId},#{goodsOrderId},#{paymentChannel},#{paymentBusinessChannel},#{paymentAccountNo},#{amount},#{transNo},#{orderNo},#{payStatus, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{arrivalTime},#{remark},now(),now(),#{tenantId})
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -88,7 +89,7 @@
 				trans_no_ = #{transNo},
 			</if>
 		</set>
-		WHERE id_ = #{id}
+		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<!-- 根据主键删除一条记录 -->
@@ -100,13 +101,13 @@
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="GoodsOrderPayment"
 		parameterType="map">
-		SELECT * FROM goods_order_payment ORDER BY id_
+		SELECT * FROM goods_order_payment where tenant_id_ = #{tenantId} ORDER BY id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM
-		goods_order_payment
+		goods_order_payment where tenant_id_ = #{tenantId}
 	</select>
 </mapper>

+ 10 - 9
mec-biz/src/main/resources/config/mybatis/GoodsProcurementMapper.xml

@@ -21,6 +21,7 @@
 		<result column="tax_stock_sold_num_" property="taxStockSoldNum"/>
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+        <result column="tenant_id_" property="tenantId"/>
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -30,20 +31,20 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="GoodsProcurement">
-		SELECT * FROM goods_procurement ORDER BY id_
+		SELECT * FROM goods_procurement where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.GoodsProcurement" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO goods_procurement (goods_id_,goods_category_id_,supply_channel_,discount_price_,agree_cost_price_,stock_count_,tax_stock_count_,operator_id_,batch_no_,create_time_,update_time_)
-		VALUES(#{goodsId},#{goodsCategoryId},#{supplyChannel},#{discountPrice},#{agreeCostPrice},#{stockCount},#{taxStockCount},#{operatorId},#{batchNo},NOW(),NOW())
+		INSERT INTO goods_procurement (goods_id_,goods_category_id_,supply_channel_,discount_price_,agree_cost_price_,stock_count_,tax_stock_count_,operator_id_,batch_no_,create_time_,update_time_,tenant_id_)
+		VALUES(#{goodsId},#{goodsCategoryId},#{supplyChannel},#{discountPrice},#{agreeCostPrice},#{stockCount},#{taxStockCount},#{operatorId},#{batchNo},NOW(),NOW(),#{tenantId})
 	</insert>
 
 	<insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.GoodsProcurement" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO goods_procurement (goods_id_,goods_category_id_,supply_channel_,discount_price_,agree_cost_price_,stock_count_,tax_stock_count_,operator_id_,batch_no_,create_time_,update_time_)
+		INSERT INTO goods_procurement (goods_id_,goods_category_id_,supply_channel_,discount_price_,agree_cost_price_,stock_count_,tax_stock_count_,operator_id_,batch_no_,create_time_,update_time_,tenant_id_)
 		VALUE
 		<foreach collection="goodsProcurements" item="gp" separator=",">
-			(#{gp.goodsId},#{gp.goodsCategoryId},#{gp.supplyChannel},#{gp.discountPrice},#{gp.agreeCostPrice},#{gp.stockCount},#{gp.taxStockCount},#{gp.operatorId},#{gp.batchNo},NOW(),NOW())
+			(#{gp.goodsId},#{gp.goodsCategoryId},#{gp.supplyChannel},#{gp.discountPrice},#{gp.agreeCostPrice},#{gp.stockCount},#{gp.taxStockCount},#{gp.operatorId},#{gp.batchNo},NOW(),NOW(),#{gp.tenantId})
 		</foreach>
 	</insert>
 	
@@ -88,7 +89,7 @@
 				tax_stock_sold_num_ = #{taxStockSoldNum},
 			</if>
 				update_time_ = NOW(),
-		</set> WHERE id_ = #{id}
+		</set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 	
 	<!-- 根据主键删除一条记录 -->
@@ -98,7 +99,7 @@
 
 	<sql id="queryCondition">
 		<where>
-			1=1
+			tenant_id_ = #{tenantId}
 			<if test="goodsId!=null">
 				AND goods_id_ = #{goodsId}
 			</if>
@@ -124,13 +125,13 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="GoodsProcurement" parameterType="map">
-		SELECT * FROM goods_procurement
+		SELECT * FROM goods_procurement where tenant_id_ = #{tenantId}
 		ORDER BY id_ DESC <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM goods_procurement
+		SELECT COUNT(*) FROM goods_procurement where tenant_id_ = #{tenantId}
 	</select>
 
 	<select id="getWithStockSurplusProcurement" resultMap="GoodsProcurement" useCache="false" flushCache="true">

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/SysMusicScoreCategoriesMapper.xml

@@ -163,8 +163,8 @@
 		SELECT count(score.id_) AS musicScoreNum, sm.* FROM sys_music_score_categories sm
 		LEFT JOIN sys_music_score score ON sm.id_ = score.music_score_categories_id_
 		<include refid="queryTree"/>
-		ORDER BY sm.order_
 		group by score.music_score_categories_id_
+# 		ORDER BY sm.order_
 	</select>
 	<select id="findByCategoriesIds" resultType="java.lang.String">
 		SELECT GROUP_CONCAT(id_) FROM sys_music_score_categories

+ 95 - 0
mec-biz/src/main/resources/config/mybatis/TenantApplyMapper.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
+<mapper namespace="com.ym.mec.biz.dal.dao.TenantApplyDao">
+
+	<resultMap type="com.ym.mec.biz.dal.entity.TenantApply" id="TenantApply">
+		<result column="id_" property="id" />
+		<result column="name_" property="name" />
+		<result column="city_" property="city" />
+		<result column="linkman_" property="linkman" />
+		<result column="mobile_no_" property="mobileNo" />
+		<result column="name_of_referrer_" property="nameOfReferrer" />
+		<result column="student_num_level_" property="studentNumLevel" />
+		<result column="create_time_" property="createTime" />
+		<result column="call_back_time_" property="callBackTime" />
+		<result column="call_back_log_" property="callBackLog" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="TenantApply">
+		SELECT * FROM
+		tenant_apply WHERE id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="TenantApply">
+		SELECT * FROM tenant_apply ORDER
+		BY id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.TenantApply"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO tenant_apply
+		(id_,name_,city_,linkman_,mobile_no_,student_num_level_,name_of_referrer_,create_time_,call_back_time_,call_back_log_)
+		VALUES(#{id},#{name},#{city},#{linkman},#{mobileNo},#{studentNumLevel},#{nameOfReferrer},#{createTime},#{callBackTime},#{callBackLog})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.TenantApply">
+		UPDATE tenant_apply
+		<set>
+			<if test="city != null">
+				city_ = #{city},
+			</if>
+			<if test="id != null">
+				id_ = #{id},
+			</if>
+			<if test="linkman != null">
+				linkman_ = #{linkman},
+			</if>
+			<if test="callBackLog != null">
+				call_back_log_ = #{callBackLog},
+			</if>
+			<if test="mobileNo != null">
+				mobile_no_ = #{mobileNo},
+			</if>
+			<if test="studentNumLevel != null">
+				student_num_level_ = #{studentNumLevel},
+			</if>
+			<if test="nameOfReferrer != null">
+				name_of_referrer_ = #{nameOfReferrer},
+			</if>
+			<if test="callBackTime != null">
+				call_back_time_ = #{callBackTime},
+			</if>
+			<if test="name != null">
+				name_ = #{name},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM tenant_apply WHERE id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="TenantApply" parameterType="map">
+		SELECT * FROM tenant_apply ORDER BY id_
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM
+		tenant_apply
+	</select>
+</mapper>

+ 2 - 2
mec-student/src/main/java/com/ym/mec/student/StudentApplication.java

@@ -25,8 +25,8 @@ import com.ym.mec.common.filters.EmojiEncodingFilter;
 @SpringBootApplication
 @EnableDiscoveryClient
 @EnableFeignClients("com.ym.mec")
-@MapperScan("com.ym.mec.biz.dal.dao")
-@ComponentScan(basePackages = {"com.ym.mec", "com.yonge.log"})
+@MapperScan(basePackages = {"com.ym.mec.biz.**.dao", "com.yonge.datasource.dao"})
+@ComponentScan(basePackages = {"com.ym.mec", "com.yonge.log", "com.yonge.datasource"})
 @Configuration
 @EnableSwagger2Doc
 @EnableAsync

+ 20 - 0
mec-student/src/main/java/com/ym/mec/student/controller/TenantInfoController.java

@@ -1,11 +1,18 @@
 package com.ym.mec.student.controller;
 
+import javax.annotation.Resource;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.common.controller.BaseController;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -23,12 +30,25 @@ public class TenantInfoController extends BaseController {
     @Autowired
     private TenantInfoService tenantInfoService;
 
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+
     @ApiOperation("查询单个机构详情")
     @GetMapping(value = "/info/{id}")
     public Object queryTenantInfo(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {
         return succeed(tenantInfoService.queryTenantInfo(id));
     }
 
+    @ApiOperation("查询用户机构信息")
+    @GetMapping(value = "/queryUserTenantInfo")
+    public Object queryUserTenantInfo() {
+    	SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || user.getId() == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(tenantInfoService.queryTenantInfo(user.getTenantId()));
+    }
+
     @ApiOperation("查询单个机构详情")
     @GetMapping(value = "/checkInfo/{id}")
     public Object queryTenantInfoCheck(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {

+ 2 - 2
mec-teacher/src/main/java/com/ym/mec/teacher/TeacherApplication.java

@@ -21,8 +21,8 @@ import com.ym.mec.common.filters.EmojiEncodingFilter;
 @SpringBootApplication
 @EnableDiscoveryClient
 @EnableFeignClients("com.ym.mec")
-@MapperScan("com.ym.mec.biz.dal.dao")
-@ComponentScan(basePackages = { "com.ym.mec", "org.snaker.engine", "com.yonge.log"})
+@MapperScan(basePackages = {"com.ym.mec.biz.**.dao", "com.yonge.datasource.dao"})
+@ComponentScan(basePackages = { "com.ym.mec", "org.snaker.engine", "com.yonge.log", "com.yonge.datasource"})
 @Configuration
 @EnableSwagger2Doc
 @EnableAsync

+ 28 - 11
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TenantInfoController.java

@@ -1,18 +1,22 @@
 package com.ym.mec.teacher.controller;
 
-import com.ym.mec.biz.dal.dto.TenantInfoDto;
-import com.ym.mec.biz.service.TenantInfoService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.thirdparty.yqpay.Msg;
-import com.ym.mec.util.validator.ValidationKit;
-import io.swagger.annotations.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+import javax.annotation.Resource;
+
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import javax.validation.Valid;
-import java.util.Map;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.service.TenantInfoService;
+import com.ym.mec.common.controller.BaseController;
 
 /**
  * @author hgw
@@ -26,12 +30,25 @@ public class TenantInfoController extends BaseController {
     @Autowired
     private TenantInfoService tenantInfoService;
 
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+
     @ApiOperation("查询单个机构详情")
     @GetMapping(value = "/info/{id}")
     public Object queryTenantInfo(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {
         return succeed(tenantInfoService.queryTenantInfo(id));
     }
 
+    @ApiOperation("查询用户机构信息")
+    @GetMapping(value = "/queryUserTenantInfo")
+    public Object queryUserTenantInfo() {
+    	SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || user.getId() == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(tenantInfoService.queryTenantInfo(user.getTenantId()));
+    }
+
     @ApiOperation("查询单个机构详情")
     @GetMapping(value = "/checkInfo/{id}")
     public Object queryTenantInfoCheck(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {

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

@@ -25,7 +25,7 @@ import com.ym.mec.common.filters.EmojiEncodingFilter;
 @EnableDiscoveryClient
 @EnableFeignClients("com.ym.mec")
 @MapperScan(basePackages = {"com.ym.mec.biz.**.dao", "com.yonge.datasource.dao"})
-@ComponentScan(basePackages = {"com.ym.mec", "com.yonge.log"})
+@ComponentScan(basePackages = {"com.ym.mec", "com.yonge.log", "com.yonge.datasource"})
 @Configuration
 @EnableSwagger2Doc
 @EnableAsync

+ 71 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TenantApplyController.java

@@ -0,0 +1,71 @@
+package com.ym.mec.web.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.entity.TenantApply;
+import com.ym.mec.biz.service.TenantApplyService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.common.service.IdGeneratorService;
+
+@RequestMapping("tenantApply")
+@Api(tags = "机构申请服务")
+@RestController
+public class TenantApplyController extends BaseController {
+
+	@Autowired
+	private TenantApplyService tenantApplyService;
+
+	@Autowired
+	private IdGeneratorService smsCodeService;
+
+	@ApiOperation("分页查询")
+	@GetMapping(value = "/list")
+	@PreAuthorize("@pcs.hasPermissions('tenantApply/list')")	
+	public Object getList(QueryInfo queryInfo) {
+		return succeed(tenantApplyService.queryPage(queryInfo));
+	}
+
+	@ApiOperation("单查询")
+	@ApiImplicitParam(name = "id", value = "ID编号", required = true, dataType = "Integer", paramType = "path")
+	@GetMapping(value = "/query")
+	@PreAuthorize("@pcs.hasPermissions('tenantApply/query')")
+	public Object query(Long id) {
+		return succeed(tenantApplyService.get(id));
+	}
+
+	@ApiOperation("新增")
+	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	public Object add(TenantApply tenantApply) {
+		
+		boolean b = smsCodeService.verifyValidCode(tenantApply.getMobileNo(), tenantApply.getSmsCode());
+		if (!b) {
+			return failed("验证码不正确");
+		}
+		
+		tenantApply.setCreateTime(new Date());
+		tenantApplyService.insert(tenantApply);
+		return succeed();
+	}
+
+	@ApiOperation("更新")
+	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('tenantApply/update')")
+	public Object update(TenantApply tenantApply) {
+		tenantApplyService.update(tenantApply);
+		return succeed();
+	}
+
+}