zouxuan 3 anos atrás
pai
commit
36ec1e6fb8

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/QuestionnaireTopic.java

@@ -35,6 +35,16 @@ public class QuestionnaireTopic {
 	//问卷题目
 	private List<QuestionnaireQuestion> questionnaireQuestionList;
 
+	private Integer tenantId;
+
+	public Integer getTenantId() {
+		return tenantId;
+	}
+
+	public void setTenantId(Integer tenantId) {
+		this.tenantId = tenantId;
+	}
+
 	public int getAgainCommitFlag() {
 		return againCommitFlag;
 	}

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

@@ -18,7 +18,7 @@ public interface MusicGroupQuestionnaireService extends BaseService<Integer, Mus
      * 获取问卷题目详情
      * @return
      */
-    QuestionnaireTopic getQuestionDetail();
+    QuestionnaireTopic getQuestionDetail(Integer tenantId);
 
     /**
      * 修改乐团满意度调查

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -16,6 +16,8 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String OLD_MUSIC_PAYMENT_STUDENT_NUM = "old_music_payment_student_num";
     //乐团问卷调查编号
     String MUSIC_GROUP_TOPIC_ID = "music_group_topic_id";
+    //自动确认收货时间
+    String AUTO_AFFIRM_RECEIVE_TIME = "music_group_topic_id";
 
     public static final String BASE_API_URL = "base_api_url";
 

+ 9 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupQuestionnaireServiceImpl.java

@@ -1,21 +1,21 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.MusicGroupQuestionnaireDao;
 import com.ym.mec.biz.dal.dao.QuestionnaireUserResultDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dao.SysTenantConfigDao;
 import com.ym.mec.biz.dal.dto.QuestionnaireResultDto;
+import com.ym.mec.biz.dal.entity.MusicGroupQuestionnaire;
 import com.ym.mec.biz.dal.entity.QuestionnaireTopic;
 import com.ym.mec.biz.dal.entity.QuestionnaireUserResult;
 import com.ym.mec.biz.dal.enums.QuestionnaireActiveTypeEnum;
+import com.ym.mec.biz.service.MusicGroupQuestionnaireService;
 import com.ym.mec.biz.service.QuestionnaireTopicService;
 import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.biz.dal.entity.MusicGroupQuestionnaire;
-import com.ym.mec.biz.service.MusicGroupQuestionnaireService;
-import com.ym.mec.biz.dal.dao.MusicGroupQuestionnaireDao;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -29,7 +29,7 @@ public class MusicGroupQuestionnaireServiceImpl extends BaseServiceImpl<Integer,
 	@Autowired
 	private MusicGroupQuestionnaireDao musicGroupQuestionnaireDao;
 	@Autowired
-	private SysConfigDao sysConfigDao;
+	private SysTenantConfigDao sysTenantConfigDao;
 	@Autowired
 	private QuestionnaireTopicService questionnaireTopicService;
 	@Autowired
@@ -57,10 +57,10 @@ public class MusicGroupQuestionnaireServiceImpl extends BaseServiceImpl<Integer,
 	}
 
 	@Override
-	public QuestionnaireTopic getQuestionDetail() {
-		String topicId = sysConfigDao.findConfigValue(SysConfigService.MUSIC_GROUP_TOPIC_ID);
+	public QuestionnaireTopic getQuestionDetail(Integer tenantId) {
+		String topicId = sysTenantConfigDao.getConfigValue(SysConfigService.MUSIC_GROUP_TOPIC_ID,tenantId);
 		if(StringUtils.isEmpty(topicId)){
-			topicId = "1";
+			throw new BizException("操作失败:请选择问卷调查模板");
 		}
 		return questionnaireTopicService.getDetail(Integer.parseInt(topicId));
 	}

+ 27 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java

@@ -7,12 +7,10 @@ import com.ym.mec.biz.dal.dto.GoodsSellDto;
 import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
 import com.ym.mec.biz.dal.dto.SysCouponCodeDto;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.StudentGoodsSell;
-import com.ym.mec.biz.dal.entity.StudentInstrument;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.biz.service.StudentGoodsSellService;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -35,6 +33,10 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
     @Autowired
     private SysConfigDao sysConfigDao;
     @Autowired
+    private SysTenantConfigDao sysTenantConfigDao;
+    @Autowired
+    private TenantInfoDao tenantInfoDao;
+    @Autowired
     private GoodsDao goodsDao;
     @Autowired
     private StudentInstrumentDao studentInstrumentDao;
@@ -76,15 +78,29 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
     @Transactional(rollbackFor = Exception.class)
     public void affirmReceive(String orderNo) {
         String str = "MANUAL_RECEIVE";
-        //如果订单编号为空,那么自动确认
-        if (StringUtils.isEmpty(orderNo)) {
-            String autoAffirmReceiveTime = sysConfigDao.findConfigValue("auto_affirm_receive_time");
-            //获取到期的订单编号
-            orderNo = studentGoodsSellDao.queryNoAffirmOrderNo(autoAffirmReceiveTime);
-            str = "AUTO_RECEIVE";
-        }
         if (StringUtils.isNotEmpty(orderNo)) {
             studentGoodsSellDao.autoAffirmReceive(orderNo, str);
+            return;
+        }
+        //如果订单编号为空,那么自动确认
+        StringBuffer sb = new StringBuffer();
+        str = "AUTO_RECEIVE";
+        Map<String,Object> param = new HashMap<>(1);
+        param.put("state",1);
+        List<TenantInfo> tenantInfos = tenantInfoDao.queryList(param);
+        if(tenantInfos != null && tenantInfos.size() > 0){
+            for (int i = 0; i < tenantInfos.size(); i++) {
+                TenantInfo tenantInfo = tenantInfos.get(i);
+                String autoAffirmReceiveTime = sysTenantConfigDao.getConfigValue(SysConfigService.AUTO_AFFIRM_RECEIVE_TIME,tenantInfo.getId());
+                //获取到期的订单编号
+                String s = studentGoodsSellDao.queryNoAffirmOrderNo(autoAffirmReceiveTime);
+                if(StringUtils.isNotEmpty(s)){
+                    sb.append(s).append(",");
+                }
+            }
+            if (sb.length() > 0) {
+                studentGoodsSellDao.autoAffirmReceive(sb.substring(0,sb.length() - 1), str);
+            }
         }
     }
 

+ 9 - 2
mec-biz/src/main/resources/config/mybatis/QuestionnaireTopicMapper.xml

@@ -12,6 +12,7 @@
 		<result column="status_" property="status"/>
 		<result column="creator_id_" property="creatorId" />
 		<result column="again_commit_flag_" property="againCommitFlag" />
+		<result column="tenant_id_" property="tenantId" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 	</resultMap>
@@ -28,13 +29,16 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.QuestionnaireTopic" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO questionnaire_topic (title_,status_,creator_id_,create_time_,update_time_,again_commit_flag_)
-		VALUES(#{title},#{status},#{creatorId},NOW(),NOW(),#{againCommitFlag})
+		INSERT INTO questionnaire_topic (title_,status_,creator_id_,create_time_,update_time_,again_commit_flag_,tenant_id_)
+		VALUES(#{title},#{status},#{creatorId},NOW(),NOW(),#{againCommitFlag},#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.QuestionnaireTopic">
 		UPDATE questionnaire_topic <set>
+		<if test="tenantId != null">
+			tenant_id_ = #{tenantId},
+		</if>
 		<if test="againCommitFlag != null">
 			again_commit_flag_ = #{againCommitFlag},
 		</if>
@@ -63,6 +67,9 @@
 			<if test="status != null">
 				AND status_ = #{status}
 			</if>
+			<if test="tenantId != null">
+				AND tenant_id_ = #{tenantId}
+			</if>
 		</where>
 	</sql>
 	<!-- 分页查询 -->

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

@@ -153,7 +153,10 @@
     <select id="queryNoAffirmOrderNo" resultType="java.lang.String">
 		SELECT GROUP_CONCAT(DISTINCT so.order_no_) FROM sell_order so
 		LEFT JOIN student_payment_order spo ON spo.order_no_ = so.order_no_
-		WHERE spo.status_ = 'SUCCESS' AND TIMESTAMPDIFF(HOUR,spo.pay_time_,NOW()) >= #{autoAffirmReceiveTime}
+		WHERE spo.status_ = 'SUCCESS'
+		<if test="autoAffirmReceiveTime != null and autoAffirmReceiveTime != ''">
+			AND TIMESTAMPDIFF(HOUR,spo.pay_time_,NOW()) >= #{autoAffirmReceiveTime}
+		</if>
 	</select>
 	<resultMap type="com.ym.mec.biz.dal.dto.StudentPaymentOrderDto" id="StudentPaymentOrderDto" extends="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentPaymentOrder">
 		<result column="goods_image_" property="image" />

+ 8 - 1
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupQuestionnaireController.java

@@ -42,7 +42,14 @@ public class MusicGroupQuestionnaireController extends BaseController {
     @GetMapping("/getQuestionDetail")
     @PreAuthorize("@pcs.hasPermissions('musicGroupQuestionnaire/getQuestionDetail')")
     public Object getDetail() {
-        return succeed(musicGroupQuestionnaireService.getQuestionDetail());
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if(sysUser.getTenantId() == null){
+            return failed("机构信息异常,请联系管理员");
+        }
+        return succeed(musicGroupQuestionnaireService.getQuestionDetail(sysUser.getTenantId()));
     }
 
     @ApiOperation(value = "删除")

+ 12 - 0
mec-web/src/main/java/com/ym/mec/web/controller/QuestionnaireTopicController.java

@@ -1,5 +1,7 @@
 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.entity.QuestionnaireTopic;
 import com.ym.mec.biz.dal.page.QuestionnaireTopicQueryInfo;
 import com.ym.mec.biz.service.QuestionnaireTopicService;
@@ -18,12 +20,22 @@ public class QuestionnaireTopicController extends BaseController {
 
     @Autowired
     private QuestionnaireTopicService questionnaireTopicService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "新增")
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('questionnaireTopic/add')")
     @AuditLogAnnotation(operateName = "新增")
     public Object add(@RequestBody QuestionnaireTopic questionnaireTopic) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if(sysUser.getTenantId() == null){
+            return failed("机构信息异常,请联系管理员");
+        }
+        questionnaireTopic.setTenantId(sysUser.getTenantId());
         questionnaireTopicService.add(questionnaireTopic);
         return succeed();
     }

+ 0 - 3
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -137,7 +137,6 @@ public class TaskController extends BaseController {
 	@GetMapping(value = "/syncImHistoryMessageTask")
 	// 同步即时通讯聊天记录
 	public void syncImHistoryMessageTask(String date) throws Exception {
-//		date = "2021060710";
 		if(date == null){
 			date = DateUtil.format(DateUtil.addHours(new Date(),-2), DateUtil.YEAR_MONTH_DAY_HOUR);
 		}
@@ -153,10 +152,8 @@ public class TaskController extends BaseController {
 				return;
 			}
 			File file = new File(FileUtils.getTempDirectoryPath() + url.substring(url.lastIndexOf("/")));
-//			File file = new File("/Users/chenxiaoyu/Documents/" + url.substring(url.lastIndexOf("/")));
 			URL url1 = new URL(url);
 			FileUtils.copyURLToFile(url1,file);
-			UploadReturnBean uploadReturnBean = uploadFileService.uploadImHistoryMsgFile(file);
 			historyMessageService.saveImHistoryMessage(new File(file.getAbsolutePath()));
 		}
 	}

+ 8 - 1
mec-web/src/main/java/com/ym/mec/web/controller/education/EduMusicGroupQuestionnaireController.java

@@ -41,7 +41,14 @@ public class EduMusicGroupQuestionnaireController extends BaseController {
     @ApiOperation(value = "获取题目详情详情")
     @GetMapping("/getQuestionDetail")
     public Object getDetail() {
-        return succeed(musicGroupQuestionnaireService.getQuestionDetail());
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if(sysUser.getTenantId() == null){
+            return failed("机构信息异常,请联系管理员");
+        }
+        return succeed(musicGroupQuestionnaireService.getQuestionDetail(sysUser.getTenantId()));
     }
 
     @ApiOperation(value = "删除")