Przeglądaj źródła

Merge branch 'online1' of http://git.dayaedu.com/yonge/mec into teacher_income

 Conflicts:
	mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java
zouxuan 4 lat temu
rodzic
commit
500fb55aea
47 zmienionych plików z 2300 dodań i 71 usunięć
  1. 2 2
      mec-auth/mec-auth-server/src/main/resources/logback-spring.xml
  2. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexBaseMonthDataDao.java
  3. 34 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentActivityDao.java
  4. 24 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentCooperationDao.java
  5. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentDao.java
  6. 43 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementInstrumentActivityStatDto.java
  7. 70 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementInstrumentActivityStatHead.java
  8. 43 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementPayDto.java
  9. 136 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrument.java
  10. 190 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrumentActivity.java
  11. 185 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrumentCooperation.java
  12. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/GroupType.java
  13. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/IndexDataType.java
  14. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java
  15. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java
  16. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupQueryInfo.java
  17. 57 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/ReplacementInstrumentActivityQueryInfo.java
  18. 44 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/ReplacementInstrumentCooperationQueryInfo.java
  19. 37 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/ReplacementInstrumentQueryInfo.java
  20. 36 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentActivityService.java
  21. 32 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentCooperationService.java
  22. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentService.java
  23. 15 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java
  24. 27 36
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  25. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java
  26. 329 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java
  27. 112 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentCooperationServiceImpl.java
  28. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentServiceImpl.java
  29. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java
  30. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  31. 22 0
      mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml
  32. 1 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml
  33. 1 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  34. 205 0
      mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentActivityMapper.xml
  35. 106 0
      mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentCooperationMapper.xml
  36. 103 0
      mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentMapper.xml
  37. 1 1
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  38. 1 1
      mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml
  39. 11 0
      mec-common/common-core/src/main/java/com/ym/mec/common/page/PageInfo.java
  40. 105 0
      mec-student/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentActivityController.java
  41. 37 0
      mec-student/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentController.java
  42. 1 1
      mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java
  43. 10 10
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java
  44. 83 0
      mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentActivityController.java
  45. 35 0
      mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentController.java
  46. 82 0
      mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentCooperationController.java
  47. 3 3
      mec-web/src/main/resources/logback-spring.xml

+ 2 - 2
mec-auth/mec-auth-server/src/main/resources/logback-spring.xml

@@ -27,8 +27,8 @@
 		</encoder>
 	</appender>
 
-	<logger name="com.ym.mec" level="INFO" />
-	<root level="INFO">
+	<logger name="com.ym.mec" level="WARN" />
+	<root level="WARN">
 		<appender-ref ref="stdout" />
 		<appender-ref ref="file" />
 	</root>

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

@@ -223,6 +223,8 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
 
     List<IndexBaseMonthData> getFinanceActualData(@Param("dayStr") String dayStr);
 
+    List<IndexBaseMonthData> getTotalAmountData(@Param("dayStr") String dayStr);
+
     List<IndexBaseMonthData> getFinancePayDataWithTimely(@Param("startDate") String startDate,
                                                          @Param("endDate") String endDate,
                                                          @Param("organIds") List<Integer> organIds);
@@ -234,4 +236,8 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
     List<IndexBaseMonthData> getFinanceActualDataWithTimely(@Param("startDate") String startDate,
                                                             @Param("endDate") String endDate,
                                                             @Param("organIds") List<Integer> organIds);
+
+    List<IndexBaseMonthData> getTotalAmountDataWithTimely(@Param("startDate") String startDate,
+                                                            @Param("endDate") String endDate,
+                                                            @Param("organIds") List<Integer> organIds);
 }

+ 34 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentActivityDao.java

@@ -0,0 +1,34 @@
+package com.ym.mec.biz.dal.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatHead;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+import com.ym.mec.common.dal.BaseDAO;
+
+public interface ReplacementInstrumentActivityDao extends BaseDAO<Integer, ReplacementInstrumentActivity> {
+
+
+    ReplacementInstrumentActivity findByUserId(@Param("cooperationOrganId") Integer cooperationOrganId, @Param("userId")Integer userId);
+
+    List<ReplacementInstrumentActivityStatDto> queryReplacements(Map<String, Object> params);
+
+    int countReplacements(Map<String, Object> params);
+
+    ReplacementInstrumentActivityStatHead countReplacementsInfo(Integer cooperationOrganId);
+
+    int openPay(@Param("cooperationOrganId") Integer cooperationOrganId);
+
+    ReplacementInstrumentActivity getLock(@Param("id") Integer id);
+
+    /**
+     * 获取开启缴费推送的人
+     * @param cooperationOrganId
+     * @return
+     */
+    List<ReplacementInstrumentActivityStatDto> getPushUsers(@Param("cooperationOrganId") Integer cooperationOrganId);
+}

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentCooperationDao.java

@@ -0,0 +1,24 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+public interface ReplacementInstrumentCooperationDao extends com.ym.mec.common.dal.BaseDAO<Integer, ReplacementInstrumentCooperation> {
+
+    /**
+     * 获取合作单位的活动
+     *
+     * @param cooperationId
+     * @return
+     */
+    ReplacementInstrumentCooperation getByCooperationId(@Param("cooperationId") Integer cooperationId);
+
+    /**
+     * 统计个合作单位的转化率
+     * @return
+     */
+    List<ReplacementInstrumentCooperation> countAllReplacementsInfo();
+}

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

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

+ 43 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementInstrumentActivityStatDto.java

@@ -0,0 +1,43 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.ReplacementInstrument;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/4/18 0018
+ */
+public class ReplacementInstrumentActivityStatDto extends ReplacementInstrumentActivity {
+
+    private String subjectName;
+
+    /** 品牌 */
+    private String brand;
+
+    /** 型号 */
+    private String specification;
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
+}

+ 70 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementInstrumentActivityStatHead.java

@@ -0,0 +1,70 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/4/19 0019
+ */
+public class ReplacementInstrumentActivityStatHead {
+
+    private int openPay;
+
+    private String cooperationOrganName;
+
+    private BigDecimal surveyNum;
+
+    private BigDecimal replacementNum;
+
+    private BigDecimal replacementRate = new BigDecimal(0);
+
+    private BigDecimal paymentRate = new BigDecimal(0);
+
+    public int getOpenPay() {
+        return openPay;
+    }
+
+    public void setOpenPay(int openPay) {
+        this.openPay = openPay;
+    }
+
+    public String getCooperationOrganName() {
+        return cooperationOrganName;
+    }
+
+    public void setCooperationOrganName(String cooperationOrganName) {
+        this.cooperationOrganName = cooperationOrganName;
+    }
+
+    public BigDecimal getSurveyNum() {
+        return surveyNum;
+    }
+
+    public void setSurveyNum(BigDecimal surveyNum) {
+        this.surveyNum = surveyNum;
+    }
+
+    public BigDecimal getReplacementNum() {
+        return replacementNum;
+    }
+
+    public void setReplacementNum(BigDecimal replacementNum) {
+        this.replacementNum = replacementNum;
+    }
+
+    public BigDecimal getReplacementRate() {
+        return replacementRate;
+    }
+
+    public void setReplacementRate(BigDecimal replacementRate) {
+        this.replacementRate = replacementRate;
+    }
+
+    public BigDecimal getPaymentRate() {
+        return paymentRate;
+    }
+
+    public void setPaymentRate(BigDecimal paymentRate) {
+        this.paymentRate = paymentRate;
+    }
+}

+ 43 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementPayDto.java

@@ -0,0 +1,43 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+public class ReplacementPayDto {
+    @ApiModelProperty(value = "调查id", required = true)
+    private Integer id;
+
+    @ApiModelProperty(value = "支付金额", required = true)
+    private BigDecimal amount;
+
+    @ApiModelProperty(value = "是否使用余额", required = true)
+    private Boolean isUseBalance = false;
+
+    @ApiModelProperty(value = "重新支付", required = true)
+    private Boolean isRePay = false;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Boolean getUseBalance() {
+        return isUseBalance;
+    }
+
+    public void setUseBalance(Boolean useBalance) {
+        isUseBalance = useBalance;
+    }
+}

+ 136 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrument.java

@@ -0,0 +1,136 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(replacement_instrument):
+ */
+public class ReplacementInstrument {
+
+	/**  */
+	private Integer id;
+	
+	/**  */
+	private Integer subjectId;
+	
+	/** 品牌 */
+	private String brand;
+	
+	/** 型号 */
+	private String specification;
+	
+	/** 配置 */
+	private String param;
+	
+	/** 市场价 */
+	private java.math.BigDecimal marketPrice;
+	
+	/** 优惠价 */
+	private java.math.BigDecimal discountPrice;
+	
+	/** 折旧价 */
+	private java.math.BigDecimal depreciationPrice;
+	
+	/** 销售价 */
+	private java.math.BigDecimal salePrice;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setSubjectId(Integer subjectId){
+		this.subjectId = subjectId;
+	}
+	
+	public Integer getSubjectId(){
+		return this.subjectId;
+	}
+			
+	public void setBrand(String brand){
+		this.brand = brand;
+	}
+	
+	public String getBrand(){
+		return this.brand;
+	}
+			
+	public void setSpecification(String specification){
+		this.specification = specification;
+	}
+	
+	public String getSpecification(){
+		return this.specification;
+	}
+			
+	public void setParam(String param){
+		this.param = param;
+	}
+	
+	public String getParam(){
+		return this.param;
+	}
+			
+	public void setMarketPrice(java.math.BigDecimal marketPrice){
+		this.marketPrice = marketPrice;
+	}
+	
+	public java.math.BigDecimal getMarketPrice(){
+		return this.marketPrice;
+	}
+			
+	public void setDiscountPrice(java.math.BigDecimal discountPrice){
+		this.discountPrice = discountPrice;
+	}
+	
+	public java.math.BigDecimal getDiscountPrice(){
+		return this.discountPrice;
+	}
+			
+	public void setDepreciationPrice(java.math.BigDecimal depreciationPrice){
+		this.depreciationPrice = depreciationPrice;
+	}
+	
+	public java.math.BigDecimal getDepreciationPrice(){
+		return this.depreciationPrice;
+	}
+			
+	public void setSalePrice(java.math.BigDecimal salePrice){
+		this.salePrice = salePrice;
+	}
+	
+	public java.math.BigDecimal getSalePrice(){
+		return this.salePrice;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 190 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrumentActivity.java

@@ -0,0 +1,190 @@
+package com.ym.mec.biz.dal.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(replacement_instrument_activity):
+ */
+public class ReplacementInstrumentActivity {
+
+	/**  */
+	private Integer id;
+	
+	/** 合作单位 */
+	private Integer cooperationOrganId;
+
+	/** 合作单位 */
+	private String cooperationOrganName;
+	
+	/**  */
+	private Integer userId;
+
+	/**  */
+	private Integer openFlag;
+	
+	/**  */
+	private String userName;
+	
+	/**  */
+	private String grade;
+	
+	/**  */
+	private String classes;
+	
+	/**  */
+	private String mobileNo;
+	
+	/**  */
+	private Integer subjectId;
+	
+	/** 问卷结果,一题占1位,按顺序,例如110;1-是,0-否 */
+	private String questionResult;
+	
+	/** 乐器编号 */
+	private Integer instrumentsId;
+	
+	private String otherSuggestion;
+
+	@ApiModelProperty(value = "缴费状态 0-未缴费 1-缴费中 2-已缴费")
+	private Integer payStatus = 0;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+
+	public Integer getOpenFlag() {
+		return openFlag;
+	}
+
+	public void setOpenFlag(Integer openFlag) {
+		this.openFlag = openFlag;
+	}
+
+	public String getCooperationOrganName() {
+		return cooperationOrganName;
+	}
+
+	public void setCooperationOrganName(String cooperationOrganName) {
+		this.cooperationOrganName = cooperationOrganName;
+	}
+
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setCooperationOrganId(Integer cooperationOrganId){
+		this.cooperationOrganId = cooperationOrganId;
+	}
+	
+	public Integer getCooperationOrganId(){
+		return this.cooperationOrganId;
+	}
+			
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setUserName(String userName){
+		this.userName = userName;
+	}
+	
+	public String getUserName(){
+		return this.userName;
+	}
+			
+	public void setGrade(String grade){
+		this.grade = grade;
+	}
+	
+	public String getGrade(){
+		return this.grade;
+	}
+			
+	public void setClasses(String classes){
+		this.classes = classes;
+	}
+	
+	public String getClasses(){
+		return this.classes;
+	}
+			
+	public void setMobileNo(String mobileNo){
+		this.mobileNo = mobileNo;
+	}
+	
+	public String getMobileNo(){
+		return this.mobileNo;
+	}
+			
+	public void setSubjectId(Integer subjectId){
+		this.subjectId = subjectId;
+	}
+	
+	public Integer getSubjectId(){
+		return this.subjectId;
+	}
+			
+	public void setQuestionResult(String questionResult){
+		this.questionResult = questionResult;
+	}
+	
+	public String getQuestionResult(){
+		return this.questionResult;
+	}
+			
+	public void setInstrumentsId(Integer instrumentsId){
+		this.instrumentsId = instrumentsId;
+	}
+	
+	public Integer getInstrumentsId(){
+		return this.instrumentsId;
+	}
+			
+	public String getOtherSuggestion() {
+		return otherSuggestion;
+	}
+
+	public void setOtherSuggestion(String otherSuggestion) {
+		this.otherSuggestion = otherSuggestion;
+	}
+
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+
+	public Integer getPayStatus() {
+		return payStatus;
+	}
+
+	public void setPayStatus(Integer payStatus) {
+		this.payStatus = payStatus;
+	}
+
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+}

+ 185 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrumentCooperation.java

@@ -0,0 +1,185 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@ApiModel(value = "com-ym-mec-biz-dal-entity-ReplacementInstrumentCooperation")
+public class ReplacementInstrumentCooperation {
+    @ApiModelProperty(value = "")
+    private Integer id;
+
+    /**
+     * 分部id
+     */
+    @ApiModelProperty(value = "分部id")
+    private Integer organId;
+
+    /**
+     * 合作单位id
+     */
+    @ApiModelProperty(value = "合作单位id")
+    private Integer cooperationOrganId;
+
+    /**
+     * 是否开启缴费 0-未开启 1-已开启
+     */
+    @ApiModelProperty(value = "是否开启缴费 0-未开启 1-已开启")
+    private YesOrNoEnum openPay = YesOrNoEnum.NO;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+
+    @ApiModelProperty(value = "分部")
+    private String organName;
+
+    @ApiModelProperty(value = "合作单位")
+    private String cooperationOrganName;
+
+    @ApiModelProperty(value = "调查人数")
+    private Integer activeNum = 0;
+
+    @ApiModelProperty(value = "置换人数")
+    private Integer replaceNum = 0;
+
+    @ApiModelProperty(value = "支付人数")
+    private Integer payNum = 0;
+
+    @ApiModelProperty(value = "置换率")
+    private BigDecimal replaceScale = BigDecimal.ZERO;
+
+    @ApiModelProperty(value = "缴费率")
+    private BigDecimal payScale = BigDecimal.ZERO;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public Integer getCooperationOrganId() {
+        return cooperationOrganId;
+    }
+
+    public void setCooperationOrganId(Integer cooperationOrganId) {
+        this.cooperationOrganId = cooperationOrganId;
+    }
+
+    public YesOrNoEnum getOpenPay() {
+        return openPay;
+    }
+
+    public void setOpenPay(YesOrNoEnum openPay) {
+        this.openPay = openPay;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", organId=").append(organId);
+        sb.append(", cooperationOrganId=").append(cooperationOrganId);
+        sb.append(", openPay=").append(openPay);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
+    public String getCooperationOrganName() {
+        return cooperationOrganName;
+    }
+
+    public void setCooperationOrganName(String cooperationOrganName) {
+        this.cooperationOrganName = cooperationOrganName;
+    }
+
+    public Integer getActiveNum() {
+        return activeNum;
+    }
+
+    public void setActiveNum(Integer activeNum) {
+        this.activeNum = activeNum;
+    }
+
+    public Integer getReplaceNum() {
+        return replaceNum;
+    }
+
+    public void setReplaceNum(Integer replaceNum) {
+        this.replaceNum = replaceNum;
+    }
+
+    public BigDecimal getReplaceScale() {
+        return replaceScale;
+    }
+
+    public void setReplaceScale(BigDecimal replaceScale) {
+        this.replaceScale = replaceScale;
+    }
+
+    public Integer getPayNum() {
+        return payNum;
+    }
+
+    public void setPayNum(Integer payNum) {
+        this.payNum = payNum;
+    }
+
+    public BigDecimal getPayScale() {
+        return payScale;
+    }
+
+    public void setPayScale(BigDecimal payScale) {
+        this.payScale = payScale;
+    }
+}

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

@@ -13,7 +13,8 @@ public enum GroupType implements BaseEnum<String, GroupType> {
 	GOODS_SELL("商品销售"),
 	OUTORDER("外部订单"),
 	SUBJECT_CHANGE("声部更换"),
-	MAINTENANCE("乐保");
+	MAINTENANCE("乐保"),
+	REPLACEMENT("乐器置换");
 
 	private String desc;
 

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

@@ -40,6 +40,7 @@ public enum IndexDataType implements BaseEnum<String, IndexDataType> {
     FINANCE_PAY("FINANCE_PAY","财务支出", false, false),
     FINANCE_BALANCE_AMOUNT("FINANCE_BALANCE_AMOUNT","余额收入", false, false),
     FINANCE_AMOUNT("FINANCE_AMOUNT","现金收入", false, false),
+    TOTAL_AMOUNT("TOTAL_AMOUNT","总收入", false, false),
 
     //业务数据
     HOMEWORK_CREATE_RATE("HOMEWORK_CREATE_RATE","作业布置率", true, true),

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

@@ -169,7 +169,8 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     TEACHER_SERVE_PUSH("TEACHER_SERVE_PUSH", "服务指标未完成提醒"),
     MAINTENANCE_NOTICE_PUSH("MAINTENANCE_NOTICE_PUSH", "乐保到期提醒"),
 
-    TEACHER_INCOME_REMIND("TEACHER_INCOME_REMIND", "今日收入");
+    TEACHER_INCOME_REMIND("TEACHER_INCOME_REMIND", "今日收入"),
+    REPLACEMENT_PAY_PUSH("REPLACEMENT_PAY_PUSH", "乐器置换支付提醒");
 
 
 

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

@@ -22,7 +22,8 @@ public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
 	REPAIR("REPAIR","乐器维修"),
 	SUBJECT_CHANGE("SUBJECT_CHANGE","声部更换"),
 	DEGREE_REGISTRATION("DEGREE_REGISTRATION", "考级报名"),
-	MAINTENANCE("MAINTENANCE","乐保");
+	MAINTENANCE("MAINTENANCE","乐保"),
+	REPLACEMENT("REPLACEMENT","乐器置换");
 
 
 	private String code;

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupQueryInfo.java

@@ -32,6 +32,16 @@ public class MusicGroupQueryInfo extends QueryInfo {
 
     private List<String> musicGroupIds;
 
+    private String searchType;
+
+    public String getSearchType() {
+        return searchType;
+    }
+
+    public void setSearchType(String searchType) {
+        this.searchType = searchType;
+    }
+
     public List<String> getMusicGroupIds() {
         return musicGroupIds;
     }

+ 57 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ReplacementInstrumentActivityQueryInfo.java

@@ -0,0 +1,57 @@
+package com.ym.mec.biz.dal.page;
+
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class ReplacementInstrumentActivityQueryInfo extends QueryInfo {
+
+    private Integer cooperationOrganId;
+
+    private String organId;
+
+    private String subjectId;
+
+    private String brand;
+
+    private String specification;
+
+    public Integer getCooperationOrganId() {
+        return cooperationOrganId;
+    }
+
+    public void setCooperationOrganId(Integer cooperationOrganId) {
+        this.cooperationOrganId = cooperationOrganId;
+    }
+
+    public String getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(String organId) {
+        this.organId = organId;
+    }
+
+    public String getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(String subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
+}

+ 44 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ReplacementInstrumentCooperationQueryInfo.java

@@ -0,0 +1,44 @@
+package com.ym.mec.biz.dal.page;
+
+
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+public class ReplacementInstrumentCooperationQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value="学校名称或编号")
+    private String search;
+
+    @ApiModelProperty(value="分部id")
+    private String organId;
+
+    @ApiModelProperty(value="是否开启缴费 0 -否 1-是")
+    private YesOrNoEnum openPay;
+
+    @Override
+    public String getSearch() {
+        return search;
+    }
+
+    @Override
+    public void setSearch(String search) {
+        this.search = search;
+    }
+
+    public String getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(String organId) {
+        this.organId = organId;
+    }
+
+    public YesOrNoEnum getOpenPay() {
+        return openPay;
+    }
+
+    public void setOpenPay(YesOrNoEnum openPay) {
+        this.openPay = openPay;
+    }
+}

+ 37 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ReplacementInstrumentQueryInfo.java

@@ -0,0 +1,37 @@
+package com.ym.mec.biz.dal.page;
+
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class ReplacementInstrumentQueryInfo extends QueryInfo {
+
+    private Integer subjectId;
+
+    private String brand;
+
+    private String specification;
+
+    public Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
+}

+ 36 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentActivityService.java

@@ -0,0 +1,36 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
+import com.ym.mec.biz.dal.dto.ReplacementPayDto;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentActivityQueryInfo;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.service.BaseService;
+
+import java.util.Map;
+
+public interface ReplacementInstrumentActivityService extends BaseService<Integer, ReplacementInstrumentActivity> {
+
+    Object add(ReplacementInstrumentActivity replacementInstrumentActivity);
+
+    ReplacementInstrumentActivity findByUserId(Integer cooperationOrganId, Integer userId);
+
+    PageInfo<ReplacementInstrumentActivityStatDto> queryReplacementsStat(ReplacementInstrumentActivityQueryInfo queryInfo);
+
+    /**
+     * 乐器置换的支付
+     * @param replacementPayDto
+     * @return
+     * @throws Exception
+     */
+    Map pay(ReplacementPayDto replacementPayDto) throws Exception;
+
+    /**
+     * 支付回调处理
+     * @param studentPaymentOrder
+     * @return
+     */
+    Boolean orderCallback(StudentPaymentOrder studentPaymentOrder);
+
+}

+ 32 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentCooperationService.java

@@ -0,0 +1,32 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentCooperationQueryInfo;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.service.BaseService;
+
+public interface ReplacementInstrumentCooperationService extends BaseService<Integer, ReplacementInstrumentCooperation> {
+
+    /**
+     * 开启缴费
+     * @param id
+     * @return
+     */
+    ReplacementInstrumentCooperation openPay(Integer id);
+
+
+    /**
+     * 获取合作单位的活动
+     * @param cooperationId
+     * @return
+     */
+    ReplacementInstrumentCooperation getByCooperationId(Integer cooperationId);
+
+
+    /**
+     * 获取合作单位乐器置换列表
+     * @param queryInfo
+     * @return
+     */
+    PageInfo<ReplacementInstrumentCooperation> getPageList(ReplacementInstrumentCooperationQueryInfo queryInfo);
+}

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

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

+ 15 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -108,6 +108,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		typeDateMap.put(IndexDataType.FINANCE_PAY,indexBaseMonthDataDao.getFinancePayDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 		typeDateMap.put(IndexDataType.FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getFinanceBalanceDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 		typeDateMap.put(IndexDataType.FINANCE_AMOUNT,indexBaseMonthDataDao.getFinanceActualDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
+		typeDateMap.put(IndexDataType.TOTAL_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 
 
 		for (IndexDataType dataType : IndexDataType.values()) {
@@ -129,6 +130,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			typeDateMap.put(dataType, new ArrayList<>(Arrays.asList(indexBaseMonthData)));
 		}
 
+		BigDecimal totalAmount = BigDecimal.ZERO;
 		for (Map.Entry<IndexDataType, List<IndexBaseMonthData>> typeDateMapEntry : typeDateMap.entrySet()) {
 			Set<String> hasMonths = typeDateMapEntry.getValue().stream().map(d -> DateUtil.dateToString(d.getMonth(), "yyyy-MM-dd")).collect(Collectors.toSet());
 			LocalDate currentMonthDate = startDate;
@@ -166,7 +168,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
 			indexBaseData.setIndexMonthData(typeDateMapEntry.getValue(), currentMonth);
 			if(IndexDataType.FINANCE_PAY.equals(typeDateMapEntry.getKey()) || IndexDataType.FINANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
-				IndexDataType.FINANCE_BALANCE_AMOUNT.equals(typeDateMapEntry.getKey())){
+				IndexDataType.FINANCE_BALANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
+					IndexDataType.TOTAL_AMOUNT.equals(typeDateMapEntry.getKey())){
 				indexBaseData.setPercent(typeDateMapEntry.getValue().stream().map(IndexBaseMonthData::getPercent).reduce(BigDecimal.ZERO, BigDecimal::add));
 			}
 			result.add(indexBaseData);
@@ -223,6 +226,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		saveData(indexBaseMonthDataDao.getFinancePayData(dayStr),dayStr,IndexDataType.FINANCE_PAY);
 		saveData(indexBaseMonthDataDao.getFinanceBalanceData(dayStr),dayStr,IndexDataType.FINANCE_BALANCE_AMOUNT);
 		saveData(indexBaseMonthDataDao.getFinanceActualData(dayStr),dayStr,IndexDataType.FINANCE_AMOUNT);
+		saveData(indexBaseMonthDataDao.getTotalAmountData(dayStr),dayStr,IndexDataType.TOTAL_AMOUNT);
 
 		//业务数据
 		saveData(indexBaseMonthDataDao.getHomeworkData(dayStr, null), monday.toString(), IndexDataType.HOMEWORK_CREATE_RATE);
@@ -428,8 +432,12 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		}
 		//当前用户是否是分部经理
 		List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
+		Integer educationUserId = null;
+		if (!sysUser.getIsSuperAdmin() && userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+			educationUserId = sysUser.getId();
+		}
 		//获取关联的乐团列表
-		List<String> musicGroupIds = musicGroupDao.queryIdsByEduIdAndOrganIds(userRole.contains(3)?sysUser.getId():null,organIds);
+		List<String> musicGroupIds = musicGroupDao.queryIdsByEduIdAndOrganIds(educationUserId,organIds);
 		String configValue1 = sysConfigDao.findConfigValue("push_create_payment_calender");
 		Date date = new Date();
 		String format = DateUtil.format(date, DateUtil.DEFAULT_PATTERN);
@@ -442,8 +450,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			if(calenderIds.size() > 0){
 				List<String> musicGroupIdList = musicGroupPaymentCalenderDao.queryMusicGroupIds(calenderIds);
 				indexErrInfoDto.setResult(musicGroupIdList);
+				indexErrInfoDto.setNum(musicGroupIdList.size());
 			}
-			indexErrInfoDto.setNum(calenderIds.size());
 		}
 		result.add(indexErrInfoDto);
 		return result;
@@ -583,18 +591,12 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		}
 		resultMap.put("attendanceServe",flag4);
 
-//		SysUser sysUser = sysUserFeignService.queryUserInfo();
-//		if (sysUser == null) {
-//			throw new BizException("用户信息获取失败");
-//		}
-		//当前用户是否是分部经理
-//		List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
 		//获取关联的乐团列表
-		List<String> musicGroupIds = musicGroupDao.queryIdsByEduIdAndOrganIds(userRole.contains(3)?sysUser.getId():null,organIdsStr);
-		String configValue1 = sysConfigDao.findConfigValue("push_create_payment_calender");
-		date = new Date();
-		String format = DateUtil.format(date, DateUtil.DEFAULT_PATTERN);
+		List<String> musicGroupIds = musicGroupDao.queryIdsByEduIdAndOrganIds(educationUserId,organIdsStr);
 		if(musicGroupIds.size() > 0){
+			String configValue1 = sysConfigDao.findConfigValue("push_create_payment_calender");
+			date = new Date();
+			String format = DateUtil.format(date, DateUtil.DEFAULT_PATTERN);
 			List<Long> calenderIds = musicGroupPaymentCalenderDao.queryEndIds(configValue1, format,musicGroupIds);
 			if(calenderIds.size() > 0){
 				resultMap.put("remindMatterData",true);

+ 27 - 36
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.service.impl;
 import static com.ym.mec.biz.dal.enums.DealStatusEnum.CLOSE;
 import static com.ym.mec.biz.dal.enums.DealStatusEnum.ING;
 import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
+import static com.ym.mec.biz.dal.enums.IndexErrorType.WAIT_CREATE_PAYMENT_CALENDER;
 import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
 
 import java.io.IOException;
@@ -19,6 +20,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.entity.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -79,37 +81,8 @@ import com.ym.mec.biz.dal.dto.SporadicPayDto;
 import com.ym.mec.biz.dal.dto.SubFeeSettingDto;
 import com.ym.mec.biz.dal.dto.SubjectRegisterDto;
 import com.ym.mec.biz.dal.dto.UpdateExpectedNumDto;
-import com.ym.mec.biz.dal.entity.ApprovalStatus;
-import com.ym.mec.biz.dal.entity.ChargeType;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.CooperationOrgan;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPurchaseList;
-import com.ym.mec.biz.dal.entity.MusicGroupQuit;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
-import com.ym.mec.biz.dal.entity.Organization;
-import com.ym.mec.biz.dal.entity.School;
-import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
-import com.ym.mec.biz.dal.entity.Student;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentPreRegistration;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.Subject;
-import com.ym.mec.biz.dal.entity.SubjectChange;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
@@ -2421,14 +2394,32 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //获取用户权限列表
         List<Integer> roles = employeeDao.queryUserRole(sysUser.getId());
         PageInfo<MusicGroup> musicGroupPageInfo;
-        if (roles != null && roles.size() == 1 && roles.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
-            //只有教务老师权限
-            /*String musicGroupIds = musicGroupDao.queryEducationalMusicGroupId(sysUser.getId());
-            queryInfo.setMusicGroupId(musicGroupIds);*/
-            musicGroupPageInfo = queryPage(queryInfo);
-        } else {
-            musicGroupPageInfo = queryPage(queryInfo);
+        //待创建缴费项目提醒
+        if("WAIT_CREATE_PAYMENT_CALENDER".equals(queryInfo.getSearchType())){
+            Integer educationUserId = null;
+            if (!sysUser.getIsSuperAdmin() && roles.size() == 1 && roles.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+                educationUserId = sysUser.getId();
+            }
+            //获取关联的乐团列表
+            List<String> musicGroupIds = musicGroupDao.queryIdsByEduIdAndOrganIds(educationUserId,queryInfo.getOrganId());
+            String configValue1 = sysConfigDao.findConfigValue("push_create_payment_calender");
+            Date date = new Date();
+            String format = DateUtil.format(date, DateUtil.DEFAULT_PATTERN);
+            if(musicGroupIds.size() > 0){
+                List<Long> calenderIds = musicGroupPaymentCalenderDao.queryEndIds(configValue1, format,musicGroupIds);
+                if(calenderIds.size() > 0){
+                    List<String> queryMusicGroupIds = musicGroupPaymentCalenderDao.queryMusicGroupIds(calenderIds);
+                    if(queryInfo.getMusicGroupIds() != null){
+                        queryMusicGroupIds.addAll(queryInfo.getMusicGroupIds());
+                    }
+                    queryInfo.setMusicGroupIds(queryMusicGroupIds);
+                }
+            }
+            if(queryInfo.getMusicGroupIds() == null || queryInfo.getMusicGroupIds().size() == 0){
+                return new PageInfo<MusicGroup>();
+            }
         }
+        musicGroupPageInfo = queryPage(queryInfo);
         List<MusicGroup> musicGroupList = musicGroupPageInfo.getRows();
 
         if (musicGroupList == null || musicGroupList.size() == 0) {

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java

@@ -91,6 +91,11 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 		Organization organization = organizationDao.get(id);
 		Map<Integer, String> gradeMap = new HashMap<>();
 
+		if(Objects.isNull(organization)){
+			gradeMap.put(GradeTypeEnum.SIX_PLUS.getCode(), GradeTypeEnum.SIX_PLUS.getDesc());
+			return gradeMap;
+		}
+
 		if(organization.getGradeType().equals(GradeTypeEnum.FIVE_PLUS)){
 			FivePlusGradeEnum[] fivePlusGradeEnums = FivePlusGradeEnum.values();
 			for (FivePlusGradeEnum fivePlusGradeEnum : fivePlusGradeEnums) {

+ 329 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java

@@ -0,0 +1,329 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.CooperationOrganDao;
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatHead;
+import com.ym.mec.biz.dal.dto.ReplacementPayDto;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentActivityQueryInfo;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentQueryInfo;
+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.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.common.service.IdGeneratorService;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import com.ym.mec.util.collection.MapUtil;
+import com.ym.mec.util.date.DateUtil;
+
+import org.apache.poi.ss.formula.functions.T;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+@Service
+public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<Integer, ReplacementInstrumentActivity> implements ReplacementInstrumentActivityService {
+
+    @Autowired
+    private ReplacementInstrumentActivityDao replacementInstrumentActivityDao;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private CooperationOrganDao cooperationOrganDao;
+    @Autowired
+    private ReplacementInstrumentDao replacementInstrumentDao;
+    @Autowired
+    private SysUserCashAccountService sysUserCashAccountService;
+    @Autowired
+    private IdGeneratorService idGeneratorService;
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
+    @Autowired
+    private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
+    @Autowired
+    private SysConfigDao sysConfigDao;
+    @Autowired
+    private PayService payService;
+    @Autowired
+    private ContractService contractService;
+    @Autowired
+    private SysUserCashAccountDetailService sysUserCashAccountDetailService;
+    @Autowired
+    private SysMessageService sysMessageService;
+    
+    @Autowired
+    private CooperationOrganService cooperationOrganService;
+
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Override
+    public BaseDAO<Integer, ReplacementInstrumentActivity> getDAO() {
+        return replacementInstrumentActivityDao;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Object add(ReplacementInstrumentActivity replacementInstrumentActivity) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败,请重新登陆");
+        }
+        replacementInstrumentActivity.setUserId(sysUser.getId());
+        //如果用户是43分部,那么修改用户信息
+        if(sysUser.getOrganId() == 43){
+        	CooperationOrgan cooperationOrgan = cooperationOrganService.get(replacementInstrumentActivity.getCooperationOrganId());
+            if (cooperationOrgan != null) {
+            	sysUser.setOrganId(cooperationOrgan.getOrganId());
+            	sysUser.setUpdateTime(new Date());
+            	sysUserFeignService.updateSysUser(sysUser);
+            }
+        }
+        //如果提交过调查问卷,那么覆盖之前的记录
+        ReplacementInstrumentActivity activity = replacementInstrumentActivityDao.findByUserId(replacementInstrumentActivity.getCooperationOrganId(), sysUser.getId());
+        if (activity != null) {
+            //覆盖之前的数据
+            replacementInstrumentActivity.setId(activity.getId());
+            replacementInstrumentActivityDao.update(replacementInstrumentActivity);
+        } else {
+            replacementInstrumentActivityDao.insert(replacementInstrumentActivity);
+        }
+        return replacementInstrumentActivity;
+    }
+
+    @Override
+    public ReplacementInstrumentActivity findByUserId(Integer cooperationOrganId, Integer userId) {
+        return replacementInstrumentActivityDao.findByUserId(cooperationOrganId, userId);
+    }
+
+    @Override
+    public PageInfo<ReplacementInstrumentActivityStatDto> queryReplacementsStat(ReplacementInstrumentActivityQueryInfo queryInfo) {
+        PageInfo<ReplacementInstrumentActivityStatDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<String, Object>();
+        MapUtil.populateMap(params, queryInfo);
+
+        if (Objects.isNull(queryInfo.getCooperationOrganId())) {
+            throw new BizException("请指定合作单位");
+        }
+
+        int count = replacementInstrumentActivityDao.countReplacements(params);
+
+        if (queryInfo.getPage() == 1) {
+            ReplacementInstrumentActivityStatHead head = replacementInstrumentActivityDao.countReplacementsInfo(queryInfo.getCooperationOrganId());
+            CooperationOrgan cooperationOrgan = cooperationOrganDao.get(queryInfo.getCooperationOrganId());
+            head.setCooperationOrganName(cooperationOrgan.getName());
+            pageInfo.setStatInfo(head);
+        }
+
+        pageInfo.setTotal(count);
+        params.put("offset", pageInfo.getOffset());
+        List<ReplacementInstrumentActivityStatDto> dataList = replacementInstrumentActivityDao.queryReplacements(params);
+        if (!CollectionUtils.isEmpty(dataList)) {
+
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
+
+    @Override
+    public Map pay(ReplacementPayDto replacementPayDto) throws Exception {
+        ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityDao.getLock(replacementPayDto.getId());
+        if (replacementInstrumentActivity == null) {
+            throw new BizException("乐器置换不存在,请核查");
+        }
+        if (replacementInstrumentActivity.getInstrumentsId() == null || replacementInstrumentActivity.getInstrumentsId() == 0) {
+            throw new BizException("没有置换的乐器,请核查");
+        }
+        Integer userId = replacementInstrumentActivity.getUserId();
+        ReplacementInstrument replacementInstrument = replacementInstrumentDao.get(replacementInstrumentActivity.getInstrumentsId());
+        BigDecimal orderAmount = replacementInstrument.getSalePrice();
+        BigDecimal amount = replacementPayDto.getAmount(); //扣除余额之前的金额
+        if (amount.compareTo(replacementInstrument.getSalePrice()) != 0) {
+            throw new BizException("商品价格不符");
+        }
+
+        String channelType = "";
+        Date nowDate = new Date();
+
+        BigDecimal balance = BigDecimal.ZERO;
+        if (replacementPayDto.getUseBalance() && amount.compareTo(BigDecimal.ZERO) > 0) {
+            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
+            if (userCashAccount == null) {
+                throw new BizException("用户账户找不到");
+            }
+            if (userCashAccount.getBalance() != null && userCashAccount.getBalance().compareTo(BigDecimal.ZERO) > 0) {
+                balance = amount.compareTo(userCashAccount.getBalance()) >= 0 ? userCashAccount.getBalance() : amount;
+                amount = amount.subtract(balance);
+                sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐保购买");
+            }
+        }
+
+        CooperationOrgan cooperationOrgan = cooperationOrganDao.get(replacementInstrumentActivity.getCooperationOrganId());
+
+        String orderNo = idGeneratorService.generatorId("payment") + "";
+        StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+
+        studentPaymentOrder.setPaymentChannel("BALANCE");
+        studentPaymentOrder.setUserId(userId);
+        studentPaymentOrder.setGroupType(GroupType.REPLACEMENT);
+        studentPaymentOrder.setOrderNo(orderNo);
+        studentPaymentOrder.setType(OrderTypeEnum.REPLACEMENT);
+        studentPaymentOrder.setExpectAmount(orderAmount);
+        studentPaymentOrder.setActualAmount(amount);
+        studentPaymentOrder.setBalancePaymentAmount(balance);
+        studentPaymentOrder.setStatus(DealStatusEnum.ING);
+        studentPaymentOrder.setMusicGroupId(replacementInstrumentActivity.getId().toString());
+        studentPaymentOrder.setRemitFee(BigDecimal.ZERO);
+        studentPaymentOrder.setCourseRemitFee(BigDecimal.ZERO);
+        studentPaymentOrder.setOrganId(cooperationOrgan.getOrganId());
+        studentPaymentOrder.setRoutingOrganId(cooperationOrgan.getOrganId());
+        studentPaymentOrder.setCreateTime(nowDate);
+        studentPaymentOrder.setUpdateTime(nowDate);
+        studentPaymentOrderService.insert(studentPaymentOrder);
+        //修改支付状态
+        replacementInstrumentActivity.setPayStatus(1);
+        replacementInstrumentActivity.setUpdateTime(nowDate);
+        replacementInstrumentActivityDao.update(replacementInstrumentActivity);
+
+        studentPaymentOrder.setVersion(0);
+        if (amount.compareTo(BigDecimal.ZERO) == 0) {
+            studentPaymentRouteOrderService.addRouteOrder(orderNo, cooperationOrgan.getOrganId(), balance);
+            Map<String, String> notifyMap = new HashMap<>();
+            notifyMap.put("tradeState", "1");
+            notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
+            notifyMap.put("channelType", channelType);
+            notifyMap.put("orderNo", "");
+            studentPaymentOrderService.updateOrder(notifyMap);
+            return notifyMap;
+        }
+
+        String orderSubject = "乐器置换";
+        String receiver = "replacement";
+
+        String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
+
+        Map payMap = payService.getPayMap(
+                amount,
+                balance,
+                orderNo,
+                baseApiUrl + "/api-student/studentOrder/notify",
+                baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
+                orderSubject,
+                orderSubject,
+                cooperationOrgan.getOrganId(),
+                receiver
+        );
+
+        studentPaymentOrder.setOrganId(cooperationOrgan.getOrganId());
+        studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
+        studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
+        studentPaymentOrder.setUpdateTime(nowDate);
+        studentPaymentOrderService.update(studentPaymentOrder);
+        return payMap;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean orderCallback(StudentPaymentOrder studentPaymentOrder) {
+        Date nowDate = new Date();
+        //更新订单信息
+        studentPaymentOrder.setUpdateTime(nowDate);
+        int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
+        if (updateCount <= 0) {
+            throw new BizException("订单更新失败");
+        }
+        //更新维修单信息
+        ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityDao.getLock(Integer.parseInt(studentPaymentOrder.getMusicGroupId()));
+        if (replacementInstrumentActivity == null) {
+            throw new BizException("置换信息不存在");
+        }
+
+        Integer userId = studentPaymentOrder.getUserId();
+
+        Map<Integer, String> map = new HashMap<>();
+        map.put(userId, userId.toString());
+
+        //支付成功
+        if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) {
+            replacementInstrumentActivity.setPayStatus(2);
+            replacementInstrumentActivity.setUpdateTime(nowDate);
+            if (this.update(replacementInstrumentActivity) <= 0) {
+                throw new BizException("置换信息更新失败");
+            }
+
+            //插入交易明细
+            BigDecimal amount = studentPaymentOrder.getActualAmount();
+            if (amount.compareTo(BigDecimal.ZERO) > 0) {
+                SysUserCashAccount cashAccount = sysUserCashAccountService.get(userId);
+                //充值
+                SysUserCashAccountDetail rechargeDetail = new SysUserCashAccountDetail();
+                rechargeDetail.setAmount(amount);
+                rechargeDetail.setBalance(cashAccount.getBalance().add(amount));
+                rechargeDetail.setComment("缴费前充值");
+                rechargeDetail.setCreateTime(nowDate);
+                rechargeDetail.setStatus(DealStatusEnum.SUCCESS);
+                rechargeDetail.setTransNo(studentPaymentOrder.getTransNo());
+                rechargeDetail.setType(PlatformCashAccountDetailTypeEnum.RECHARGE);
+                rechargeDetail.setUpdateTime(nowDate);
+                rechargeDetail.setUserId(userId);
+                rechargeDetail.setChannel(studentPaymentOrder.getPaymentChannel());
+                rechargeDetail.setComAmount(studentPaymentOrder.getComAmount());
+                rechargeDetail.setPerAmount(studentPaymentOrder.getPerAmount());
+                sysUserCashAccountDetailService.insert(rechargeDetail);
+
+                //缴费
+                SysUserCashAccountDetail paymentDetail = new SysUserCashAccountDetail();
+                paymentDetail.setAmount(amount.negate());
+                paymentDetail.setBalance(cashAccount.getBalance());
+                paymentDetail.setComment("乐器置换");
+                paymentDetail.setCreateTime(nowDate);
+                paymentDetail.setStatus(DealStatusEnum.SUCCESS);
+                paymentDetail.setTransNo(studentPaymentOrder.getTransNo());
+                paymentDetail.setType(PlatformCashAccountDetailTypeEnum.PAY_FEE);
+                paymentDetail.setUpdateTime(nowDate);
+                paymentDetail.setUserId(userId);
+                rechargeDetail.setChannel(studentPaymentOrder.getPaymentChannel());
+                sysUserCashAccountDetailService.insert(paymentDetail);
+            }
+            try {
+                contractService.transferProduceContract(userId, null);
+            } catch (Exception e) {
+                logger.error("产品协议生成失败", e);
+            }
+            return true;
+        }
+
+        if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
+
+            replacementInstrumentActivity.setPayStatus(0);
+            replacementInstrumentActivity.setUpdateTime(nowDate);
+            if (this.update(replacementInstrumentActivity) <= 0) {
+                throw new BizException("置换信息更新失败");
+            }
+
+            if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
+                sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "乐保购买支付失败");
+            }
+
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, map, null, 0, null, "STUDENT",
+                    studentPaymentOrder.getActualAmount(), "乐器置换");
+            return false;
+        }
+        return false;
+    }
+}

+ 112 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentCooperationServiceImpl.java

@@ -0,0 +1,112 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao;
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentCooperationDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentCooperationQueryInfo;
+import com.ym.mec.biz.service.ReplacementInstrumentCooperationService;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import com.ym.mec.util.date.DateUtil;
+import com.ym.mec.util.http.HttpUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ReplacementInstrumentCooperationServiceImpl extends BaseServiceImpl<Integer, ReplacementInstrumentCooperation> implements ReplacementInstrumentCooperationService {
+
+    @Autowired
+    private ReplacementInstrumentCooperationDao replacementInstrumentCooperationDao;
+    @Autowired
+    private ReplacementInstrumentActivityDao replacementInstrumentActivityDao;
+    @Autowired
+    private SysMessageService sysMessageService;
+    @Autowired
+    private SysConfigDao sysConfigDao;
+
+    @Override
+    public BaseDAO<Integer, ReplacementInstrumentCooperation> getDAO() {
+        return replacementInstrumentCooperationDao;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ReplacementInstrumentCooperation openPay(Integer id) {
+        ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationDao.get(id);
+        if (replacementInstrumentCooperation == null) {
+            throw new BizException("合作单位乐器置换活动不存在");
+        }
+        if (YesOrNoEnum.YES.equals(replacementInstrumentCooperation.getOpenPay())) {
+            throw new BizException("已开启缴费,不能重复开启");
+        }
+        replacementInstrumentCooperation.setOpenPay(YesOrNoEnum.YES);
+        replacementInstrumentCooperationDao.update(replacementInstrumentCooperation);
+
+        //发送推送链接
+        //家长您好!您订购的 {乐器品牌}品牌乐器已经开始接受预定,请点击{链接地址}完成付款,付款后15个工作日以内到货,如有疑问请咨询乐团管理老师。
+        List<ReplacementInstrumentActivityStatDto> pushUsers = replacementInstrumentActivityDao.getPushUsers(replacementInstrumentCooperation.getCooperationOrganId());
+
+        replacementInstrumentActivityDao.openPay(replacementInstrumentCooperation.getCooperationOrganId());
+
+        Map<Integer, String> userMap = new HashMap<>();
+        Map<Integer, String> userPhoneMap = new HashMap<>();
+
+        String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
+        String pushUrl = baseApiUrl + "/#/auditionActive/1?id=";
+        for (ReplacementInstrumentActivityStatDto pushUser : pushUsers) {
+            userMap.clear();
+            userPhoneMap.clear();
+            userMap.put(pushUser.getUserId(), pushUser.getUserId().toString());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.REPLACEMENT_PAY_PUSH,
+                    userMap, null, 0, "5?" + pushUrl + pushUser.getId(), "STUDENT", pushUser.getBrand(), "");
+
+            userPhoneMap.put(pushUser.getUserId(), pushUser.getMobileNo());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.REPLACEMENT_PAY_PUSH,
+                    userPhoneMap, null, 0, null, "STUDENT", pushUser.getBrand(), HttpUtil.getSortUrl(pushUrl + pushUser.getId()));
+        }
+
+        return replacementInstrumentCooperation;
+    }
+
+    @Override
+    public ReplacementInstrumentCooperation getByCooperationId(Integer cooperationId) {
+        return replacementInstrumentCooperationDao.getByCooperationId(cooperationId);
+    }
+
+    @Override
+    public PageInfo<ReplacementInstrumentCooperation> getPageList(ReplacementInstrumentCooperationQueryInfo queryInfo) {
+        PageInfo<ReplacementInstrumentCooperation> pageInfo = queryPage(queryInfo);
+        if (pageInfo.getRows().size() > 0) {
+            List<ReplacementInstrumentCooperation> replacementInstruments = replacementInstrumentCooperationDao.countAllReplacementsInfo();
+            for (ReplacementInstrumentCooperation row : pageInfo.getRows()) {
+                for (ReplacementInstrumentCooperation replacementInstrument : replacementInstruments) {
+                    if (!row.getCooperationOrganId().equals(replacementInstrument.getCooperationOrganId())) continue;
+                    row.setActiveNum(replacementInstrument.getActiveNum());
+                    row.setReplaceNum(replacementInstrument.getReplaceNum());
+                    row.setReplaceScale(new BigDecimal(replacementInstrument.getReplaceNum()).multiply(new BigDecimal(100)).divide(new BigDecimal(replacementInstrument.getActiveNum()), 2, BigDecimal.ROUND_HALF_UP));
+                    row.setPayScale(
+                            replacementInstrument.getReplaceNum() <= 0 ? new BigDecimal("0.00") :
+                                    new BigDecimal(replacementInstrument.getPayNum()).multiply(new BigDecimal(100)).divide(new BigDecimal(replacementInstrument.getReplaceNum()), 2, BigDecimal.ROUND_HALF_UP)
+                    );
+                }
+            }
+
+        }
+        return pageInfo;
+    }
+}

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.ym.mec.biz.dal.entity.ReplacementInstrument;
+import com.ym.mec.biz.service.ReplacementInstrumentService;
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentDao;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ReplacementInstrumentServiceImpl extends BaseServiceImpl<Integer, ReplacementInstrument> implements ReplacementInstrumentService {
+
+	@Autowired
+	private ReplacementInstrumentDao replacementInstrumentDao;
+
+	@Override
+	public BaseDAO<Integer, ReplacementInstrument> getDAO() {
+		return replacementInstrumentDao;
+	}
+
+}

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java

@@ -378,6 +378,12 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
             sellAmount.put("balance", order.getBalancePaymentAmount() == null ? BigDecimal.ZERO : order.getBalancePaymentAmount());
             return sellAmount;
         }
+        //乐器置换
+        if (order.getType().equals(OrderTypeEnum.REPLACEMENT)) {
+            sellAmount.put("actualAmount", order.getActualAmount());
+            sellAmount.put("balance", order.getBalancePaymentAmount() == null ? BigDecimal.ZERO : order.getBalancePaymentAmount());
+            return sellAmount;
+        }
 
         //乐器维修
         if (order.getType().equals(OrderTypeEnum.REPAIR)) {

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

@@ -88,6 +88,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     private GoodsDao goodsDao;
     @Autowired
     private StudentInstrumentService studentInstrumentService;
+    @Autowired
+    private ReplacementInstrumentActivityService replacementInstrumentActivityService;
 
     @Override
     public BaseDAO<Long, StudentPaymentOrder> getDAO() {
@@ -367,6 +369,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             degreeRegistrationService.updateStatus(order);
         }else if (order.getType().equals(OrderTypeEnum.MAINTENANCE)) {
             studentInstrumentService.orderCallback(order);
+        }else if (order.getType().equals(OrderTypeEnum.REPLACEMENT)) {
+            replacementInstrumentActivityService.orderCallback(order);
         }
     }
 

+ 22 - 0
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -927,6 +927,14 @@
 		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') = #{dayStr}
 		GROUP BY spo.organ_id_
 	</select>
+	<select id="getTotalAmountData" resultMap="IndexBaseMonthData">
+		SELECT spo.organ_id_,SUM(spo.actual_amount_ + spo.balance_payment_amount_) total_num_,
+			   SUM(spo.actual_amount_ + spo.balance_payment_amount_) activate_num_,
+			   SUM(spo.actual_amount_ + spo.balance_payment_amount_) percent_,#{dayStr} month_
+		FROM student_payment_order spo
+		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') = #{dayStr}
+		GROUP BY spo.organ_id_
+	</select>
 
 	<select id="getFinancePayDataWithTimely"  resultMap="IndexBaseMonthData">
 		SELECT SUM(fe.amount_) total_num_,SUM(fe.amount_) activate_num_,SUM(fe.amount_) percent_,fe.organ_id_,DATE_FORMAT(fe.create_time_,'%Y-%m-%d') month_
@@ -969,4 +977,18 @@
 		</if>
 		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
 	</select>
+	<select id="getTotalAmountDataWithTimely" resultMap="IndexBaseMonthData">
+		SELECT spo.organ_id_,SUM(spo.actual_amount_ + spo.balance_payment_amount_) total_num_,
+			   SUM(spo.actual_amount_ + spo.balance_payment_amount_) activate_num_,
+			   SUM(spo.actual_amount_ + spo.balance_payment_amount_) percent_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
+		FROM student_payment_order spo
+		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
+		<if test="organIds!=null and organIds.size()>0">
+			AND spo.organ_id_ IN
+			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
+	</select>
 </mapper>

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

@@ -645,6 +645,7 @@
     <select id="queryIdsByEduIdAndOrganIds" resultType="java.lang.String">
         SELECT DISTINCT id_ FROM music_group
         <where>
+            status_ = 'PROGRESS'
             <if test="educationId != null">
                 AND educational_teacher_id_ = #{educationId}
             </if>

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

@@ -570,7 +570,7 @@
         SELECT * FROM music_group_payment_calender WHERE id_ = #{calenderId} AND status_ IN ('NO', 'OPEN', 'OVER', 'PAID');
     </select>
     <select id="queryMusicGroupIds" resultType="java.lang.String">
-        SELECT music_group_id_ FROM music_group_payment_calender
+        SELECT DISTINCT music_group_id_ FROM music_group_payment_calender
         WHERE id_ IN
         <foreach collection="calenderIds" item="calenderId" open="(" close=")" separator=",">
             #{calenderId}

+ 205 - 0
mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentActivityMapper.xml

@@ -0,0 +1,205 @@
+<?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.ReplacementInstrumentActivityDao">
+
+    <resultMap type="com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity" id="ReplacementInstrumentActivity">
+        <result column="id_" property="id"/>
+        <result column="cooperation_organ_id_" property="cooperationOrganId"/>
+        <result column="user_id_" property="userId"/>
+        <result column="user_name_" property="userName"/>
+        <result column="grade_" property="grade"/>
+        <result column="classes_" property="classes"/>
+        <result column="mobile_no_" property="mobileNo"/>
+        <result column="subject_id_" property="subjectId"/>
+        <result column="question_result_" property="questionResult"/>
+        <result column="instruments_id_" property="instrumentsId"/>
+        <result column="other_suggestion_" property="otherSuggestion"/>
+        <result column="open_flag_" property="openFlag"/>
+        <result column="pay_status_" property="payStatus"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+    </resultMap>
+
+    <resultMap id="ReplacementInstrumentActivityStatDto"
+               type="com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto"
+               extends="ReplacementInstrumentActivity">
+        <result property="subjectName" column="subject_name_"/>
+        <result property="brand" column="brand_"/>
+        <result property="specification" column="specification_"/>
+    </resultMap>
+
+    <!-- 根据主键查询一条记录 -->
+    <select id="get" resultMap="ReplacementInstrumentActivity">
+        SELECT *
+        FROM replacement_instrument_activity
+        WHERE id_ = #{id}
+    </select>
+
+    <!-- 全查询 -->
+    <select id="findAll" resultMap="ReplacementInstrumentActivity">
+        SELECT *
+        FROM replacement_instrument_activity
+        ORDER BY id_
+    </select>
+
+    <!-- 向数据库增加一条记录 -->
+    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity" useGeneratedKeys="true"
+            keyColumn="id" keyProperty="id">
+        INSERT INTO replacement_instrument_activity (cooperation_organ_id_, user_id_, user_name_, grade_, classes_,
+                                                     mobile_no_, subject_id_, question_result_, instruments_id_,
+                                                     other_suggestion_, create_time_, update_time_)
+        VALUES (#{cooperationOrganId}, #{userId}, #{userName}, #{grade}, #{classes}, #{mobileNo}, #{subjectId},
+                #{questionResult}, #{instrumentsId}, #{otherSuggestion}, NOW(), NOW())
+    </insert>
+
+    <!-- 根据主键查询一条记录 -->
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity">
+        UPDATE replacement_instrument_activity
+        <set>
+            <if test="subjectId != null">
+                subject_id_ = #{subjectId},
+            </if>
+            <if test="openFlag != null">
+                open_flag_ = #{openFlag},
+            </if>
+            <if test="payStatus != null">
+                pay_status_ = #{payStatus},
+            </if>
+            <if test="userId != null">
+                user_id_ = #{userId},
+            </if>
+            <if test="cooperationOrganId != null">
+                cooperation_organ_id_ = #{cooperationOrganId},
+            </if>
+            <if test="userName != null">
+                user_name_ = #{userName},
+            </if>
+            <if test="questionResult != null">
+                question_result_ = #{questionResult},
+            </if>
+            <if test="updateTime != null">
+                update_time_ = #{updateTime},
+            </if>
+            instruments_id_ = #{instrumentsId},
+            other_suggestion_ = #{otherSuggestion},
+            <if test="mobileNo != null">
+                mobile_no_ = #{mobileNo},
+            </if>
+            <if test="classes != null">
+                classes_ = #{classes},
+            </if>
+            <if test="grade != null">
+                grade_ = #{grade},
+            </if>
+        </set>
+        WHERE id_ = #{id}
+    </update>
+
+    <!-- 根据主键删除一条记录 -->
+    <delete id="delete">
+        DELETE
+        FROM replacement_instrument_activity
+        WHERE id_ = #{id}
+    </delete>
+
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="ReplacementInstrumentActivity" parameterType="map">
+        SELECT * FROM replacement_instrument_activity ORDER BY id_
+        <include refid="global.limit"/>
+    </select>
+
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(*)
+        FROM replacement_instrument_activity
+    </select>
+    <select id="findByUserId" resultMap="ReplacementInstrumentActivity">
+        SELECT *
+        FROM replacement_instrument_activity
+        WHERE user_id_ = #{userId} and cooperation_organ_id_ = #{cooperationOrganId}
+        LIMIT 1
+    </select>
+
+    <sql id="queryReplacementsCondition">
+        <where>
+            <if test="cooperationOrganId!=null">
+                AND ria.cooperation_organ_id_ = #{cooperationOrganId}
+            </if>
+            <if test="subjectId!=null">
+                AND ria.subject_id_ = #{subjectId}
+            </if>
+            <if test="brand!=null and brand!=''">
+                AND ri.brand_ = #{brand}
+            </if>
+            <if test="specification!=null and specification!=''">
+                AND ri.specification_ = #{specification}
+            </if>
+            <if test="search!=null and search!=''">
+                AND (ria.mobile_no_ LIKE CONCAT('%', #{search}, '%') OR ria.user_name_ LIKE CONCAT('%', #{search}, '%'))
+            </if>
+        </where>
+    </sql>
+
+    <select id="queryReplacements" resultMap="ReplacementInstrumentActivityStatDto">
+        SELECT
+        ria.subject_id_,
+        sub.name_ subject_name_,
+        ria.user_name_,
+        ria.mobile_no_,
+        ria.pay_status_,
+        ri.brand_,
+        ri.specification_
+        FROM
+        replacement_instrument_activity ria
+        LEFT JOIN replacement_instrument ri ON ria.instruments_id_ = ri.id_
+        LEFT JOIN `subject` sub ON ria.subject_id_ = sub.id_
+        <include refid="queryReplacementsCondition"/>
+        ORDER BY ria.id_ DESC
+        <include refid="global.limit"></include>
+    </select>
+
+    <select id="countReplacements" resultType="int">
+        SELECT
+        COUNT(ria.id_)
+        FROM
+        replacement_instrument_activity ria
+        LEFT JOIN replacement_instrument ri ON ria.instruments_id_ = ri.id_
+        LEFT JOIN `subject` sub ON ria.subject_id_ = sub.id_
+        <include refid="queryReplacementsCondition"/>
+    </select>
+
+    <select id="countReplacementsInfo"
+            resultType="com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatHead">
+        SELECT ric.open_pay_ openPay,
+               COUNT(DISTINCT ria.user_id_)                                            surveyNum,
+               COUNT(DISTINCT IF(ria.instruments_id_ IS NOT NULL, ria.user_id_, NULL)) replacementNum,
+               TRUNCATE(COUNT(IF(ria.instruments_id_ IS NOT NULL, ria.user_id_, NULL)) / COUNT(DISTINCT ria.user_id_) * 100, 2) replacementRate,
+               TRUNCATE(COUNT(IF(ria.pay_status_ = 2, ria.user_id_, NULL)) / COUNT(DISTINCT IF(ria.instruments_id_ IS NOT NULL, ria.user_id_, NULL)) * 100, 2) paymentRate
+        FROM replacement_instrument_activity ria
+            LEFT JOIN replacement_instrument_cooperation ric ON ria.cooperation_organ_id_=ric.cooperation_organ_id_
+        WHERE ria.cooperation_organ_id_ = #{cooperationOrganId}
+    </select>
+
+    <update id="openPay" parameterType="integer">
+        UPDATE replacement_instrument_activity
+        SET open_flag_ = 1
+        WHERE cooperation_organ_id_ = #{cooperationOrganId}
+          AND open_flag_ = 0 AND instruments_id_ > 0
+    </update>
+
+    <select id="getLock" resultMap="ReplacementInstrumentActivity">
+        SELECT * FROM replacement_instrument_activity WHERE id_ = #{id} FOR UPDATE
+    </select>
+
+    <select id="getPushUsers" resultMap="ReplacementInstrumentActivityStatDto">
+        SELECT ria.*,su.phone_ mobile_no_,ri.brand_ FROM replacement_instrument_activity ria
+        LEFT JOIN sys_user su ON su.id_ = ria.user_id_
+        LEFT JOIN replacement_instrument ri ON ri.id_ = ria.instruments_id_
+        WHERE cooperation_organ_id_ = #{cooperationOrganId}
+        AND open_flag_ = 0 AND instruments_id_ > 0
+    </select>
+</mapper>

+ 106 - 0
mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentCooperationMapper.xml

@@ -0,0 +1,106 @@
+<?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.ReplacementInstrumentCooperationDao">
+    <resultMap id="ReplacementInstrumentCooperation" type="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation">
+        <!--@mbg.generated-->
+        <!--@Table replacement_instrument_cooperation-->
+        <result column="id_" property="id"/>
+        <result column="organ_id_" property="organId"/>
+        <result column="cooperation_organ_id_" property="cooperationOrganId"/>
+        <result column="open_pay_" property="openPay" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="organName" property="organName"/>
+        <result column="cooperationOrganName" property="cooperationOrganName"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+    </resultMap>
+
+    <!-- 根据主键查询一条记录 -->
+    <select id="get" resultMap="ReplacementInstrumentCooperation">
+        SELECT *
+        FROM replacement_instrument_cooperation
+        WHERE id_ = #{id}
+    </select>
+    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation"
+            useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+        <!--@mbg.generated-->
+        insert into replacement_instrument_cooperation (id_, organ_id_, cooperation_organ_id_, open_pay_, create_time_,
+        update_time_
+        )
+        values (#{id}, #{organId}, #{cooperationOrganId},
+        #{openPay,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{createTime}, #{updateTime}
+        )
+    </insert>
+
+    <delete id="delete">
+        <!--@mbg.generated-->
+        delete from replacement_instrument_cooperation WHERE id_ = #{id}
+    </delete>
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation">
+        <!--@mbg.generated-->
+        update replacement_instrument_cooperation
+        <set>
+            <if test="organId != null">
+                organ_id_ = #{organId},
+            </if>
+            <if test="cooperationOrganId != null">
+                cooperation_organ_id_ = #{cooperationOrganId},
+            </if>
+            <if test="openPay != null">
+                open_pay_ = #{openPay,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="createTime != null">
+                create_time_ = #{createTime},
+            </if>
+            <if test="updateTime != null">
+                update_time_ = NOW(),
+            </if>
+        </set>
+        WHERE id_ = #{id}
+    </update>
+
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="ReplacementInstrumentCooperation" parameterType="map">
+        SELECT ric.*,o.name_ organName,co.name_ cooperationOrganName FROM replacement_instrument_cooperation ric
+        LEFT JOIN cooperation_organ co ON co.id_ = ric.cooperation_organ_id_
+        LEFT JOIN organization o ON o.id_ = ric.organ_id_
+        <include refid="queryPageSql"/>
+        ORDER BY ric.id_ DESC
+        <include refid="global.limit"/>
+    </select>
+    <sql id="queryPageSql">
+        <where>
+            <if test="organId != null">
+                AND FIND_IN_SET(ric.organ_id_ , #{organId})
+            </if>
+            <if test="openPay != null">
+                AND ric.open_pay_ = #{openPay,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+            </if>
+            <if test="search != null and search != ''">
+                AND (ric.cooperation_organ_id_ = #{search} OR co.name_ LIKE CONCAT('%',#{search},'%'))
+            </if>
+        </where>
+    </sql>
+
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(*) FROM replacement_instrument_cooperation ric
+        LEFT JOIN cooperation_organ co ON co.id_ = ric.cooperation_organ_id_
+        <include refid="queryPageSql"/>
+    </select>
+
+    <select id="getByCooperationId" resultMap="ReplacementInstrumentCooperation">
+        SELECT *
+        FROM replacement_instrument_cooperation
+        WHERE cooperation_organ_id_ = #{cooperationId}
+    </select>
+
+    <select id="countAllReplacementsInfo" resultType="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation">
+        SELECT cooperation_organ_id_              cooperationOrganId,
+               COUNT(*)                           activeNum,
+               SUM(IF(instruments_id_ > 0, 1, 0)) replaceNum,
+               SUM(IF(pay_status_ = 2, 1, 0)) payNum
+        FROM replacement_instrument_activity
+        GROUP BY cooperation_organ_id_
+    </select>
+
+</mapper>

+ 103 - 0
mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentMapper.xml

@@ -0,0 +1,103 @@
+<?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.ReplacementInstrumentDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.ReplacementInstrument" id="ReplacementInstrument">
+		<result column="id_" property="id" />
+		<result column="subject_id_" property="subjectId" />
+		<result column="brand_" property="brand" />
+		<result column="specification_" property="specification" />
+		<result column="param_" property="param" />
+		<result column="market_price_" property="marketPrice" />
+		<result column="discount_price_" property="discountPrice" />
+		<result column="depreciation_price_" property="depreciationPrice" />
+		<result column="sale_price_" property="salePrice" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="ReplacementInstrument" >
+		SELECT * FROM replacement_instrument WHERE id_ = #{id}
+	</select>
+	
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="ReplacementInstrument">
+		SELECT * FROM replacement_instrument
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrument" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO replacement_instrument (subject_id_,brand_,specification_,param_,market_price_,discount_price_,depreciation_price_,sale_price_,create_time_,update_time_)
+		VALUES(#{subjectId},#{brand},#{specification},#{param},#{marketPrice},#{discountPrice},#{depreciationPrice},#{salePrice},NOW(),NOW())
+	</insert>
+
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrument">
+		UPDATE replacement_instrument <set>
+		<if test="subjectId != null">
+			subject_id_ = #{subjectId},
+		</if>
+		<if test="brand != null">
+			brand_ = #{brand},
+		</if>
+		<if test="specification != null">
+			specification_ = #{specification},
+		</if>
+		<if test="param != null">
+			param_ = #{param},
+		</if>
+		<if test="marketPrice != null">
+			market_price_ = #{marketPrice},
+		</if>
+		<if test="discountPrice != null">
+			discount_price_ = #{discountPrice},
+		</if>
+		<if test="depreciationPrice != null">
+			depreciation_price_ = #{depreciationPrice},
+		</if>
+		<if test="salePrice != null">
+			sale_price_ = #{salePrice},
+		</if>
+		<if test="updateTime != null">
+			update_time_ = #{updateTime},
+		</if>
+	</set> WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM replacement_instrument_activity WHERE id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="ReplacementInstrument" parameterType="map">
+		SELECT * FROM replacement_instrument
+		<include refid="queryPageSql"/>
+		ORDER BY id_
+		<include refid="global.limit"/>
+	</select>
+	<sql id="queryPageSql">
+		<where>
+			<if test="subjectId != null">
+				AND subject_id_ = #{subjectId}
+			</if>
+			<if test="brand != null">
+				AND brand_ = #{brand}
+			</if>
+			<if test="specification != null">
+				AND specification_ = #{specification}
+			</if>
+		</where>
+	</sql>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(id_) FROM replacement_instrument
+		<include refid="queryPageSql"/>
+	</select>
+</mapper>

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

@@ -19,7 +19,7 @@
         <result column="update_time_" property="updateTime"/>
         <result column="care_package_" property="carePackage"/>
         <result column="come_on_package_" property="comeOnPackage"/>
-        <result column="current_grade_num" property="currentGradeNum"/>
+        <result column="current_grade_num_" property="currentGradeNum"/>
         <result column="current_class_" property="currentClass"/>
     </resultMap>
 

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

@@ -519,7 +519,7 @@
     <select id="queryTeacherExceptionAttendance" resultType="java.lang.Integer">
         SELECT DISTINCT ta.teacher_id_ FROM teacher_attendance ta
         LEFT JOIN course_schedule cs ON cs.id_ = ta.course_schedule_id_
-        WHERE cs.class_date_ = #{format}
+        WHERE cs.del_flag_ = 0 AND cs.class_date_ = #{format}
         AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
         AND ta.teacher_id_ = cs.actual_teacher_id_ AND CONCAT(cs.class_date_,' ',cs.end_class_time_) &lt; NOW()
         AND (ta.sign_in_status_ IS NULL OR ta.sign_in_status_ = 0 OR ta.sign_out_status_ IS NULL OR ta.sign_out_status_ = 0)

+ 11 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/page/PageInfo.java

@@ -28,6 +28,9 @@ public class PageInfo<T> implements Serializable {
 	private int total = 0;
 	private int totalPage = 0;
 
+	//统计信息
+	private Object statInfo;
+
 	/**
 	 * 分页信息
 	 */
@@ -54,6 +57,14 @@ public class PageInfo<T> implements Serializable {
 		this.offset = (pageNo - 1) * limit;
 	}
 
+	public Object getStatInfo() {
+		return statInfo;
+	}
+
+	public void setStatInfo(Object statInfo) {
+		this.statInfo = statInfo;
+	}
+
 	/**
 	 * 是否还有上一页
 	 * @return

+ 105 - 0
mec-student/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentActivityController.java

@@ -0,0 +1,105 @@
+package com.ym.mec.student.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dto.ReplacementPayDto;
+import com.ym.mec.biz.dal.entity.CooperationOrgan;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.service.CooperationOrganService;
+import com.ym.mec.biz.service.ReplacementInstrumentActivityService;
+import com.ym.mec.biz.service.StudentService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.exception.BizException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+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.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RequestMapping("replacementInstrumentActivity")
+@Api(tags = "乐器置换调查问卷")
+@RestController
+public class ReplacementInstrumentActivityController extends BaseController {
+
+    @Autowired
+    private ReplacementInstrumentActivityService replacementInstrumentActivityService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private StudentService studentService;
+    @Autowired
+    private CooperationOrganService cooperationOrganService;
+
+    @ApiOperation(value = "新增调查问卷")
+    @PostMapping("/insert")
+    public Object add(ReplacementInstrumentActivity replacementInstrumentActivity) {
+        return succeed(replacementInstrumentActivityService.add(replacementInstrumentActivity));
+    }
+
+    @ApiOperation(value = "获取学员基本信息")
+    @GetMapping("queryUserInfo")
+    public Object queryUserInfo(Integer cooperationOrganId) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityService.findByUserId(cooperationOrganId, user.getId());
+        if (replacementInstrumentActivity == null) {
+            Student student = studentService.get(user.getId());
+            replacementInstrumentActivity = new ReplacementInstrumentActivity();
+            replacementInstrumentActivity.setUserId(user.getId());
+            replacementInstrumentActivity.setClasses(student.getCurrentClass());
+            if (student.getCurrentGradeNum() != null) {
+                replacementInstrumentActivity.setGrade(student.getCurrentGradeNum().toString());
+            }
+            replacementInstrumentActivity.setCooperationOrganId(cooperationOrganId);
+            replacementInstrumentActivity.setUserName(StringUtils.isEmpty(user.getUsername()) ? user.getRealName() : user.getUsername());
+            replacementInstrumentActivity.setMobileNo(user.getPhone());
+            String subjectIdList = student.getSubjectIdList();
+            if (StringUtils.isNotEmpty(subjectIdList)) {
+                replacementInstrumentActivity.setSubjectId(Integer.parseInt(subjectIdList.split(",")[0]));
+            }
+        }
+        CooperationOrgan cooperationOrgan = cooperationOrganService.get(cooperationOrganId);
+        if (cooperationOrgan != null) {
+            replacementInstrumentActivity.setCooperationOrganName(cooperationOrgan.getName());
+        }
+        return succeed(replacementInstrumentActivity);
+    }
+
+    @ApiOperation(value = "修改调查问卷")
+    @PostMapping("/update")
+    public Object update(ReplacementInstrumentActivity replacementInstrumentActivity) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败,请重新登陆");
+        }
+        replacementInstrumentActivityService.update(replacementInstrumentActivity);
+        return succeed();
+    }
+
+    @ApiOperation(value = "获取调查问卷")
+    @GetMapping("/get")
+    public Object get(Integer id) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败,请重新登陆");
+        }
+        return succeed(replacementInstrumentActivityService.get(id));
+    }
+
+    @ApiOperation(value = "置换支付")
+    @PostMapping("/pay")
+    @ApiImplicitParams({@ApiImplicitParam(name = "replacementPayDto", value = "支付参数", required = true, dataType = "ReplacementPayDto")})
+    public HttpResponseResult pay(ReplacementPayDto replacementPayDto) throws Exception {
+        return succeed(replacementInstrumentActivityService.pay(replacementPayDto));
+    }
+}

+ 37 - 0
mec-student/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentController.java

@@ -0,0 +1,37 @@
+package com.ym.mec.student.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentQueryInfo;
+import com.ym.mec.biz.service.ReplacementInstrumentService;
+import com.ym.mec.common.controller.BaseController;
+
+@RequestMapping("replacementInstrument")
+@Api(tags = "乐器置换商品服务")
+@RestController
+public class ReplacementInstrumentController extends BaseController {
+
+    @Autowired
+    private ReplacementInstrumentService replacementInstrumentService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+
+    @ApiOperation(value = "分页查询列表")
+    @GetMapping("/queryPage")
+    public Object queryPage(ReplacementInstrumentQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        return succeed(replacementInstrumentService.queryPage(queryInfo));
+    }
+
+}

+ 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","/activity/doubleEleven2020Statis").permitAll().anyRequest().authenticated().and().httpBasic();
+						"/uploadFile", "/eduContracts/queryProduceContract","/activity/doubleEleven2020Statis", "/replacementInstrumentActivity/queryReplacementsStat").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 10 - 10
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

@@ -113,17 +113,17 @@ public class MusicGroupController extends BaseController {
 		if (sysUser == null) {
 			return failed("用户信息获取失败");
 		}
-			Employee employee = employeeDao.get(sysUser.getId());
-			if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-				queryInfo.setOrganId(employee.getOrganIdList());
-			}else if(StringUtils.isEmpty(employee.getOrganIdList())){
-				return failed("用户所在分部异常");
-			}else {
-				List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-				if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
-					return failed("非法请求");
-				}
+		Employee employee = employeeDao.get(sysUser.getId());
+		if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+			queryInfo.setOrganId(employee.getOrganIdList());
+		}else if(StringUtils.isEmpty(employee.getOrganIdList())){
+			return failed("用户所在分部异常");
+		}else {
+			List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+			if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+				return failed("非法请求");
 			}
+		}
 		return succeed(musicGroupService.queryMusicGroupPage(queryInfo));
 	}
 

+ 83 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentActivityController.java

@@ -0,0 +1,83 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao;
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentActivityQueryInfo;
+import com.ym.mec.biz.service.ReplacementInstrumentActivityService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+@RequestMapping("replacementInstrumentActivity")
+@Api(tags = "收费类型服务")
+@RestController
+public class ReplacementInstrumentActivityController extends BaseController {
+
+    @Autowired
+    private ReplacementInstrumentActivityService replacementInstrumentActivityService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
+    @Autowired
+    private ReplacementInstrumentActivityDao replacementInstrumentActivityDao;
+
+    @ApiOperation(value = "分页查询列表")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('replacementInstrumentActivity/queryPage')")
+    public Object queryPage(ReplacementInstrumentActivityQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            return failed("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                return failed("非法请求");
+            }
+        }
+        return succeed(replacementInstrumentActivityService.queryPage(queryInfo));
+    }
+
+    @ApiOperation(value = "统计信息查询")
+    @GetMapping("/queryReplacementsStat")
+    public HttpResponseResult<PageInfo<ReplacementInstrumentActivityStatDto>> queryReplacementsStat(ReplacementInstrumentActivityQueryInfo queryInfo) {
+        return succeed(replacementInstrumentActivityService.queryReplacementsStat(queryInfo));
+    }
+
+    @ApiOperation(value = "修改")
+    @GetMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('replacementInstrumentActivity/update')")
+    public HttpResponseResult<ReplacementInstrumentActivity> update(ReplacementInstrumentActivity replacementInstrumentActivity) {
+        ReplacementInstrumentActivity oldReplacementInstrumentActivity = replacementInstrumentActivityDao.getLock(replacementInstrumentActivity.getId());
+        if (oldReplacementInstrumentActivity.getInstrumentsId().equals(replacementInstrumentActivity.getInstrumentsId())) {
+            return succeed();
+        }
+        oldReplacementInstrumentActivity.setInstrumentsId(replacementInstrumentActivity.getInstrumentsId());
+        oldReplacementInstrumentActivity.setUpdateTime(new Date());
+        replacementInstrumentActivityService.update(replacementInstrumentActivity);
+        return succeed(replacementInstrumentActivity);
+    }
+}

+ 35 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentController.java

@@ -0,0 +1,35 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentQueryInfo;
+import com.ym.mec.biz.service.ReplacementInstrumentService;
+import com.ym.mec.common.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+@RequestMapping("replacementInstrument")
+@Api(tags = "收费类型服务")
+@RestController
+public class ReplacementInstrumentController extends BaseController {
+
+    @Autowired
+    private ReplacementInstrumentService replacementInstrumentService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+
+    @ApiOperation(value = "分页查询列表")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('replacementInstrument/queryPage')")
+    public Object queryPage(ReplacementInstrumentQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        return succeed(replacementInstrumentService.queryPage(queryInfo));
+    }
+
+}

+ 82 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentCooperationController.java

@@ -0,0 +1,82 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentCooperationQueryInfo;
+import com.ym.mec.biz.service.ReplacementInstrumentCooperationService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+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 java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+@RequestMapping("replacementInstrumentCooperation")
+@Api(tags = "收费类型服务")
+@RestController
+public class ReplacementInstrumentCooperationController extends BaseController {
+
+    @Autowired
+    private ReplacementInstrumentCooperationService replacementInstrumentCooperationService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
+
+    @ApiOperation(value = "分页查询列表")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('replacementInstrumentCooperation/queryPage')")
+    public HttpResponseResult<PageInfo<ReplacementInstrumentCooperation>> queryPage(ReplacementInstrumentCooperationQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            return failed("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                return failed("非法请求");
+            }
+        }
+        return succeed(replacementInstrumentCooperationService.getPageList(queryInfo));
+    }
+
+    @ApiOperation(value = "新增合作单位置换活动")
+    @PostMapping("/add")
+    @PreAuthorize("@pcs.hasPermissions('replacementInstrumentCooperation/add')")
+    public HttpResponseResult<ReplacementInstrumentCooperation> add(ReplacementInstrumentCooperation replacementInstrumentCooperation) {
+        ReplacementInstrumentCooperation hasOld = replacementInstrumentCooperationService.getByCooperationId(replacementInstrumentCooperation.getCooperationOrganId());
+        if (hasOld != null) {
+            return failed("合作单位链接已生成,不能重复生成");
+        }
+        Date nowDate = new Date();
+        replacementInstrumentCooperation.setCreateTime(nowDate);
+        replacementInstrumentCooperation.setUpdateTime(nowDate);
+        replacementInstrumentCooperationService.insert(replacementInstrumentCooperation);
+        return succeed(replacementInstrumentCooperation);
+    }
+
+    @ApiOperation(value = "开启缴费")
+    @PostMapping("/openPay")
+    @PreAuthorize("@pcs.hasPermissions('replacementInstrumentCooperation/openPay')")
+    public HttpResponseResult<ReplacementInstrumentCooperation> openPay(Integer id) {
+        return succeed(replacementInstrumentCooperationService.openPay(id));
+    }
+}

+ 3 - 3
mec-web/src/main/resources/logback-spring.xml

@@ -43,7 +43,7 @@
 		</encoder>
 	</appender>
 
-	<logger name="com.ym.mec" level="INFO" />
+	<logger name="com.ym.mec" level="WARN" />
 
 	<logger name="com.ym.mec.thirdparty" level="INFO"
 			additivity="false">
@@ -52,14 +52,14 @@
 
 	<!--开发环境:打印控制台 -->
 	<springProfile name="dev">
-		<root level="INFO">
+		<root level="WARN">
 			<appender-ref ref="stdout" />
 			<appender-ref ref="file" />
 		</root>
 	</springProfile>
 
 	<springProfile name="test">
-		<root level="INFO">
+		<root level="WARN">
 			<appender-ref ref="stdout" />
 			<appender-ref ref="file" />
 		</root>