Просмотр исходного кода

Merge branch '2021-04-21_music_replace' of http://git.dayaedu.com/yonge/mec

zouxuan 4 лет назад
Родитель
Сommit
8ccbb71b65
21 измененных файлов с 1156 добавлено и 2 удалено
  1. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentActivityDao.java
  2. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentDao.java
  3. 53 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementInstrumentActivityStatDto.java
  4. 50 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementInstrumentActivityStatHead.java
  5. 136 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrument.java
  6. 169 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrumentActivity.java
  7. 57 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/ReplacementInstrumentActivityQueryInfo.java
  8. 17 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/ReplacementInstrumentQueryInfo.java
  9. 18 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentActivityService.java
  10. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentService.java
  11. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  12. 95 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java
  13. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentServiceImpl.java
  14. 164 0
      mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentActivityMapper.xml
  15. 97 0
      mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentMapper.xml
  16. 11 0
      mec-common/common-core/src/main/java/com/ym/mec/common/page/PageInfo.java
  17. 94 0
      mec-student/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentActivityController.java
  18. 37 0
      mec-student/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentController.java
  19. 1 1
      mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java
  20. 80 0
      mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentActivityController.java
  21. 17 0
      mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentController.java

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

@@ -0,0 +1,20 @@
+package com.ym.mec.biz.dal.dao;
+
+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;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ReplacementInstrumentActivityDao extends BaseDAO<Integer, ReplacementInstrumentActivity> {
+
+
+    ReplacementInstrumentActivity findByUserId(Integer userId);
+
+    List<ReplacementInstrumentActivityStatDto> queryReplacements(Map<String, Object> params);
+    int countReplacements(Map<String, Object> params);
+
+    ReplacementInstrumentActivityStatHead countReplacementsInfo(Integer cooperationOrganId);
+}

+ 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> {
+
+	
+}

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

@@ -0,0 +1,53 @@
+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 studentName;
+
+    /** 品牌 */
+    private String brand;
+
+    /** 型号 */
+    private String specification;
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    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;
+    }
+}

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

@@ -0,0 +1,50 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/4/19 0019
+ */
+public class ReplacementInstrumentActivityStatHead {
+
+    private String cooperationOrganName;
+
+    private BigDecimal surveyNum;
+
+    private BigDecimal replacementNum;
+
+    private BigDecimal replacementRate = new BigDecimal(0);
+
+    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;
+    }
+}

+ 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);
+	}
+
+}

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

@@ -0,0 +1,169 @@
+package com.ym.mec.biz.dal.entity;
+
+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 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 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);
+	}
+
+}

+ 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;
+    }
+}

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

@@ -0,0 +1,17 @@
+package com.ym.mec.biz.dal.page;
+
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class ReplacementInstrumentQueryInfo extends QueryInfo {
+
+    private Integer subjectId;
+
+    public Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+}

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

@@ -0,0 +1,18 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentActivityQueryInfo;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentQueryInfo;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.common.service.BaseService;
+
+public interface ReplacementInstrumentActivityService extends BaseService<Integer, ReplacementInstrumentActivity> {
+
+    Object add(ReplacementInstrumentActivity replacementInstrumentActivity);
+
+    ReplacementInstrumentActivity findByUserId(Integer userId);
+
+    PageInfo<ReplacementInstrumentActivityStatDto> queryReplacementsStat(ReplacementInstrumentActivityQueryInfo 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>{
+
+}

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

@@ -2416,7 +2416,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 }
             }
             if(queryInfo.getMusicGroupIds() == null || queryInfo.getMusicGroupIds().size() == 0){
-                return null;
+                return new PageInfo<MusicGroup>();
             }
         }
         musicGroupPageInfo = queryPage(queryInfo);

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

@@ -0,0 +1,95 @@
+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.dto.ReplacementInstrumentActivityStatDto;
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatHead;
+import com.ym.mec.biz.dal.entity.CooperationOrgan;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentActivityQueryInfo;
+import com.ym.mec.biz.dal.page.ReplacementInstrumentQueryInfo;
+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.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+import com.ym.mec.biz.service.ReplacementInstrumentActivityService;
+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.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<Integer, ReplacementInstrumentActivity> implements ReplacementInstrumentActivityService {
+	
+	@Autowired
+	private ReplacementInstrumentActivityDao replacementInstrumentActivityDao;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+	@Autowired
+	private CooperationOrganDao cooperationOrganDao;
+
+	@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分部,那么修改用户信息
+		//如果提交过调查问卷,那么覆盖之前的记录
+		ReplacementInstrumentActivity activity = replacementInstrumentActivityDao.findByUserId(sysUser.getId());
+		if(activity != null){
+			//覆盖之前的数据
+			replacementInstrumentActivity.setId(activity.getId());
+			replacementInstrumentActivityDao.update(replacementInstrumentActivity);
+		}else {
+			replacementInstrumentActivityDao.insert(replacementInstrumentActivity);
+		}
+		return replacementInstrumentActivity;
+	}
+
+	@Override
+	public ReplacementInstrumentActivity findByUserId(Integer userId) {
+		return replacementInstrumentActivityDao.findByUserId(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);
+
+		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;
+	}
+}

+ 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;
+	}
+
+}

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

@@ -0,0 +1,164 @@
+<?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="open_flag_" property="openFlag" />
+		<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="studentName" column="student_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_,create_time_,update_time_)
+		VALUES(#{cooperationOrganId},#{userId},#{userName},#{grade},#{classes},#{mobileNo},#{subjectId},#{questionResult},#{instrumentsId},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="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>
+		<if test="instrumentsId != null">
+		instruments_id_ = #{instrumentsId},
+		</if>
+		<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} 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 stu.username_ LIKE CONCAT('%', #{search}, '%'))
+			</if>
+		</where>
+	</sql>
+
+	<select id="queryReplacements" resultMap="ReplacementInstrumentActivityStatDto">
+		SELECT
+			ria.subject_id_,
+			sub.name_ subject_name_,
+			stu.username_ student_name_,
+			ria.mobile_no_,
+			ri.brand_,
+			ri.specification_
+		FROM
+			replacement_instrument_activity ria
+			LEFT JOIN replacement_instrument ri ON ria.instruments_id_ = ri.id_
+			LEFT JOIN sys_user stu ON ria.user_id_ = stu.id_
+			LEFT JOIN `subject` sub ON ria.subject_id_ = sub.id_
+		<include refid="queryReplacementsCondition" />
+		ORDER BY ria.update_time_ 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 sys_user stu ON ria.user_id_ = stu.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
+			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
+		FROM
+			replacement_instrument_activity ria
+		WHERE ria.cooperation_organ_id_ = #{cooperationOrganId}
+	</select>
+</mapper>

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

@@ -0,0 +1,97 @@
+<?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">
+				subject_id_ = #{subjectId}
+			</if>
+		</where>
+	</sql>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(id_) FROM replacement_instrument
+		<include refid="queryPageSql"/>
+	</select>
+</mapper>

+ 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

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

@@ -0,0 +1,94 @@
+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.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.exception.BizException;
+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.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(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));
+    }
+}

+ 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 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.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@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('managerDownload/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

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

@@ -0,0 +1,80 @@
+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.dto.ReplacementInstrumentActivityStatDto;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.page.ManagerDownloadQueryInfo;
+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.List;
+
+@RequestMapping("replacementInstrumentActivity")
+@Api(tags = "收费类型服务")
+@RestController
+public class ReplacementInstrumentActivityController extends BaseController {
+
+    @Autowired
+    private ReplacementInstrumentActivityService replacementInstrumentActivityService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
+
+    @ApiOperation(value = "分页查询列表")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('managerDownload/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) {
+        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.queryReplacementsStat(queryInfo));
+    }
+}

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

@@ -0,0 +1,17 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.service.ReplacementInstrumentService;
+import com.ym.mec.common.controller.BaseController;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RequestMapping("replacementInstrument")
+@Api(tags = "收费类型服务")
+@RestController
+public class ReplacementInstrumentController extends BaseController {
+
+    @Autowired
+    private ReplacementInstrumentService replacementInstrumentService;
+
+}