Joburgess 5 年之前
父節點
當前提交
cb03db429c

+ 36 - 16
edu-task/src/main/resources/application.yml

@@ -19,6 +19,7 @@ eureka:
       defaultZone: http://admin:admin123@localhost:8761/eureka/eureka/
     instance:
       lease-renewal-interval-in-seconds: 5
+      prefer-ip-address: true
 
 spring:
   application:
@@ -26,13 +27,9 @@ spring:
 
   datasource:
     name: test
-<<<<<<< HEAD
-    url: jdbc:mysql://47.99.212.176:3306/edu_saas?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
-=======
-    url: jdbc:mysql://47.99.212.176:3306/edu_saas_test?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
->>>>>>> 2368f0a6633c01029a816f0bdab8aa66d0d5b95e
-    username: edu_saas
-    password: edu_saas
+    url: jdbc:mysql://47.114.1.200:3306/mec_dev?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
+    username: mec_dev
+    password: dayaDataOnline@2019
     # 使用druid数据源
     type: com.alibaba.druid.pool.DruidDataSource
     driver-class-name: com.mysql.cj.jdbc.Driver
@@ -51,10 +48,10 @@ spring:
     maxOpenPreparedStatements: 20
 
   redis:
-    host: 47.99.212.176
+    host: 47.114.1.200
     port: 6379
-    password:
-    database: 1
+    password: dyym
+    database: 0
     #连接超时时间(毫秒)
     timeout: 10000
     pool:
@@ -68,26 +65,49 @@ spring:
       min-idle: 0
 
 mybatis:
-  mapperLocations: classpath:config/config/*.xml
+  mapperLocations: classpath:config/mybatis/*.xml
 
 task:
   configLocation: classpath:config/properties/quartz.properties
   autoStartup: true
   startupDelay: 30
 
+logging:
+  config: classpath:logback-spring.xml
+  path: d:/var/logs
 
 security:
   oauth2:
     client:
-      client-id: student
-      client-secret: student
+      client-id: app
+      client-secret: app
     resource:
       token-info-uri: http://localhost:8001/oauth/check_token
 
-swagger:
-  base-package: com.keao.edu.task.controller
-
 
 ribbon:
   ReadTimeout: 60000
   ConnectTimeout: 60000
+
+message:
+  debugMode: true
+
+eseal:
+  tsign:
+    projectid: 4438776254
+    projectSecret: a94cf63d6361084d232f345d71321691
+    apisUrl: http://smlitsm.tsign.cn:8080/tgmonitor/rest/app!getAPIInfo2
+
+
+push:
+  jiguang:
+    reqURL: https://api.jpush.cn/v3/push
+    appKey:
+      student: 0e7422e1d6e73637e678716a
+      teacher: 7e0282ca92c12c8c45a93bb3
+      system: a003c997b1add94aa8d6caf9
+    masterSecret:
+      student: c2361016604eab56ab2db2ac
+      teacher: d47430e2f4755ef5dc050ac5
+      system: c281fe6a21acf2e8a9f9d628
+    apns_production: false

+ 9 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExaminationBasicController.java

@@ -49,10 +49,18 @@ public class ExaminationBasicController extends BaseController {
     public HttpResponseResult<ExaminationBasic> addExaminationBasic(@RequestBody ExaminationBasic examinationBasic){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         Employee employee = employeeService.get(sysUser.getId());
-
+        examinationBasic.setCreatorId(sysUser.getId());
+        examinationBasic.setOrganId(employee.getOrganId());
         return succeed(examinationBasicService.addExaminationBasic(examinationBasic));
     }
 
+    @ApiOperation("更新考级项目")
+    @PostMapping(value = "/update")
+    public HttpResponseResult update(@RequestBody ExaminationBasic examinationBasic){
+        examinationBasicService.update(examinationBasic);
+        return succeed();
+    }
+
     @ApiOperation("关闭考级项目")
     @PostMapping(value = "/closeExam")
     public HttpResponseResult closeExam(Integer examId, String reason){

+ 22 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/ExaminationBasicDto.java

@@ -11,12 +11,34 @@ import java.math.BigDecimal;
  */
 public class ExaminationBasicDto extends ExaminationBasic {
 
+    @ApiModelProperty(value = "创建人名称")
+    private String creatorName;
+
+    @ApiModelProperty(value = "合作单位数量")
+    private Integer organNum;
+
     @ApiModelProperty(value = "总报名人数")
     private Integer totalRegistrationStudentNum;
 
     @ApiModelProperty(value = "总缴费金额")
     private BigDecimal totalPaymentAmount;
 
+    public String getCreatorName() {
+        return creatorName;
+    }
+
+    public void setCreatorName(String creatorName) {
+        this.creatorName = creatorName;
+    }
+
+    public Integer getOrganNum() {
+        return organNum;
+    }
+
+    public void setOrganNum(Integer organNum) {
+        this.organNum = organNum;
+    }
+
     public Integer getTotalRegistrationStudentNum() {
         return totalRegistrationStudentNum;
     }

+ 12 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExaminationBasic.java

@@ -48,6 +48,9 @@ public class ExaminationBasic {
 	@ApiModelProperty(value = "背景图")
 	private String posterBackgroundImg;
 
+	@ApiModelProperty(value = "合作单位编号")
+	private Integer organId;
+
 	@ApiModelProperty(value = "备注")
 	private String memo;
 
@@ -173,7 +176,15 @@ public class ExaminationBasic {
 	public String getPosterBackgroundImg(){
 		return this.posterBackgroundImg;
 	}
-			
+
+	public Integer getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(Integer organId) {
+		this.organId = organId;
+	}
+
 	public void setCreateTime(java.util.Date createTime){
 		this.createTime = createTime;
 	}

+ 16 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java

@@ -61,6 +61,8 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 	@Autowired
 	private SysConfigService sysConfigService;
 
+	public static final Set<ExamStatusEnum> EDIT_ABLE_EXAM_STATUS=new HashSet<>(Arrays.asList(ExamStatusEnum.SETTING,ExamStatusEnum.NOT_START,ExamStatusEnum.APPLYING));
+
 	@Override
 	public BaseDAO<Long, ExamOrganizationRelation> getDAO() {
 		return examOrganizationRelationDao;
@@ -97,6 +99,7 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public void addExamOrganizations(Integer examId, String orgainIdsStr) {
 		if(Objects.isNull(examId)){
 			throw new BizException("请指定考级项目");
@@ -104,6 +107,14 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 		if(StringUtils.isBlank(orgainIdsStr)){
 			throw new BizException("请指定合作单位");
 		}
+		ExaminationBasic examinationBasic = examinationBasicDao.get(examId.longValue());
+		if(Objects.isNull(examinationBasic)){
+			throw new BizException("考级项目不存在");
+		}
+		if(!EDIT_ABLE_EXAM_STATUS.contains(examinationBasic.getStatus())){
+			throw new BizException("当前状态暂不可添加合作单位");
+		}
+
 		Set<Integer> organIdsWithExam = examOrganizationRelationDao.getOrganIdsWithExam(examId);
 		List<Integer> organIds = Arrays.stream(orgainIdsStr.split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
 		List<Organization> organs = organizationDao.getOrgans(organIds);
@@ -119,10 +130,13 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 			ExamOrganizationRelation og = new ExamOrganizationRelation();
 			og.setTenantId(TenantContextHolder.getTenantId().toString());
 			og.setExaminationBasicId(examId);
-			Organization organization = idOrganMap.get(og.getOrganId());
+			og.setOrganId(organId);
+			Organization organization = idOrganMap.get(organId);
 			if(Objects.isNull(organization)){
-				throw new BizException("合作单位不存在");
+				throw new BizException("合作单位信息错误");
 			}
+			og.setSendUrlFlag(YesOrNoEnum.NO);
+			og.setIsAllowArrangeExam(organization.getIsAllowArrangeExam());
 			og.setSettlementType(organization.getSettlementType());
 			og.setShareProfitAmount(organization.getShareProfitAmount());
 			og.setTotalRegistrationStudentNum(BigDecimal.ZERO.intValue());

+ 9 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExaminationBasicServiceImpl.java

@@ -1,19 +1,19 @@
 package com.keao.edu.user.service.impl;
 
+import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.common.tenant.TenantContextHolder;
+import com.keao.edu.user.api.enums.ExamModeEnum;
 import com.keao.edu.user.dao.*;
 import com.keao.edu.user.dto.ExaminationBasicDto;
 import com.keao.edu.user.entity.*;
-import com.keao.edu.user.api.enums.ExamModeEnum;
 import com.keao.edu.user.enums.ExamStatusEnum;
 import com.keao.edu.user.page.ExaminationQueryInfo;
 import com.keao.edu.user.service.ExaminationBasicService;
 import com.keao.edu.util.collection.MapUtil;
-import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -36,6 +36,8 @@ public class ExaminationBasicServiceImpl extends BaseServiceImpl<Long, Examinati
     private ExamMusicTheoryDao examMusicTheoryDao;
     @Autowired
     private ExamLocationDao examLocationDao;
+    @Autowired
+    private SysUserDao sysUserDao;
 
     @Override
     public BaseDAO<Long, ExaminationBasic> getDAO() {
@@ -154,6 +156,11 @@ public class ExaminationBasicServiceImpl extends BaseServiceImpl<Long, Examinati
             long totalPaymentAmount = examOrganizationRelations.stream().map(ExamOrganizationRelation::getTotalPaymentAmount).count();
             examinationBasic.setTotalRegistrationStudentNum((int) totalRegistrationStudentNum);
             examinationBasic.setTotalPaymentAmount(new BigDecimal(totalPaymentAmount));
+            examinationBasic.setOrganNum(examOrganizationRelations.size());
+        }
+        if(Objects.nonNull(examinationBasic.getCreatorId())){
+            SysUser sysUser = sysUserDao.get(examinationBasic.getCreatorId());
+            examinationBasic.setCreatorName(sysUser.getRealName());
         }
         return examinationBasic;
     }

+ 3 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/ExaminationBasicMapper.xml

@@ -23,6 +23,7 @@
 		<result column="update_time_" property="updateTime" />
 		<result column="tenant_id_" property="tenantId" />
 		<result column="memo_" property="memo" />
+		<result column="organ_id_" property="organId"/>
 		<result column="creator_id_" property="creatorId"/>
 	</resultMap>
 
@@ -45,8 +46,8 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.keao.edu.user.entity.ExaminationBasic" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO examination_basic (id_,name_,exam_mode_,exam_location_id_list_,status_,enroll_start_time_,enroll_end_time_,expect_exam_start_time_,expect_exam_end_time_,poster_title_,poster_profile_,poster_background_img_,creator_id_,create_time_,update_time_,tenant_id_,memo_)
-		VALUES(#{id},#{name},#{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examLocationIdList},#{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{enrollStartTime},#{enrollEndTime},#{expectExamStartTime},#{expectExamEndTime},#{posterTitle},#{posterProfile},#{posterBackgroundImg},#{creatorId},NOW(),NOW(),#{tenantId},#{memo})
+		INSERT INTO examination_basic (id_,name_,exam_mode_,exam_location_id_list_,status_,enroll_start_time_,enroll_end_time_,expect_exam_start_time_,expect_exam_end_time_,poster_title_,poster_profile_,poster_background_img_,creator_id_,create_time_,update_time_,tenant_id_,memo_,organ_id_)
+		VALUES(#{id},#{name},#{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examLocationIdList},#{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{enrollStartTime},#{enrollEndTime},#{expectExamStartTime},#{expectExamEndTime},#{posterTitle},#{posterProfile},#{posterBackgroundImg},#{creatorId},NOW(),NOW(),#{tenantId},#{memo},#{organId})
 	</insert>
 
 	<update id="update" parameterType="com.keao.edu.user.entity.ExamOrganizationRelation">