Преглед изворни кода

Merge remote-tracking branch 'origin/master'

Joburgess пре 5 година
родитељ
комит
334a650af6

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysPaymentConfigDao.java

@@ -2,6 +2,8 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
 
 public interface SysPaymentConfigDao extends BaseDAO<Integer, SysPaymentConfig> {
+    SysPaymentConfig findPaymentConfigByOrganId(@Param("organId") Integer organId);
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/School.java

@@ -25,6 +25,10 @@ public class School {
 	private Integer organId;
 
 	/**  */
+	@ApiModelProperty(value = "所属机构名称", required = false)
+	private String organName;
+
+	/**  */
 	@ApiModelProperty(value = "地址", required = false)
 	private String address;
 
@@ -58,6 +62,14 @@ public class School {
 	@ApiModelProperty(value = "备注", required = false)
 	private String remark;
 
+	public String getOrganName() {
+		return organName;
+	}
+
+	public void setOrganName(String organName) {
+		this.organName = organName;
+	}
+
 	public void setId(Integer id) {
 		this.id = id;
 	}

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysPaymentConfig.java

@@ -11,6 +11,12 @@ public class SysPaymentConfig {
     private Integer id;
 
     /**
+     * type
+     */
+    @ApiModelProperty(value = "type(1-比例 2-类型)")
+    private Integer type;
+
+    /**
      * 分部id
      */
     @ApiModelProperty(value = "分部id")
@@ -159,5 +165,13 @@ public class SysPaymentConfig {
     public void setUpdateTime(Date updateTime) {
         this.updateTime = updateTime;
     }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
 }
 

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

@@ -1,6 +1,8 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.entity.School;
+import com.ym.mec.biz.dal.page.SchoolQueryInfo;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
 import java.util.List;
@@ -22,4 +24,6 @@ public interface SchoolService extends BaseService<Integer, School> {
      * @return java.util.List<com.ym.mec.biz.dal.entity.School>
      */
     List<School> findVipSchoolByTeacher(Integer teacherId,String organId,Integer isDefault);
+
+    PageInfo<School> queryPageDetail(SchoolQueryInfo queryInfo);
 }

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

@@ -5,5 +5,6 @@ import com.ym.mec.common.service.BaseService;
 
 public interface SysPaymentConfigService extends BaseService<Integer, SysPaymentConfig> {
 
+    SysPaymentConfig findPaymentConfigByOrganId(Integer organId);
 
 }

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

@@ -568,7 +568,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<CourseListDto> vipCourses = classGroupDao.queryStudentVipCourses(StringUtils.join(musicGroupIds, ","), userId);
         //获取vip课的学生列表
         Set<String> vipIds = vipCourses.stream().map(CourseListDto::getMusicGroupId).collect(Collectors.toSet());
-        Map<String, String> vipStuNames = MapUtil.convertMybatisMap(classGroupDao.findVipStuNames(StringUtils.join(vipIds, ",")));
+        Map<String, String> vipStuNames = MapUtil.convertIntegerMap(classGroupDao.findVipStuNames(StringUtils.join(vipIds, ",")));
         //获取学员的乐团列表详情
         courseListDtos.addAll(classGroupDao.queryStudentMusicGroupCourses(StringUtils.join(musicGroupIds, ","), userId));
         courseListDtos.addAll(vipCourses);

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

@@ -843,13 +843,18 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
     @Override
     public MusicCardDto queryPersonalMusicGroups(Integer userId) {
+        SysUser sysUser = sysUserFeignService.queryUserById(userId);
+        if(sysUser == null){
+            throw new BizException("用户不存在");
+        }
         MusicCardDto musicCardDto = musicGroupDao.queryPersonalMusicGroups(userId);
-        if(musicCardDto != null){
-            musicCardDto.setMusicGroupNum(musicGroupDao.countUserMusicGroups(userId));
-            musicCardDto.setVipClassNum(classGroupStudentMapperDao.countUserGroups(userId, ClassGroupTypeEnum.VIP.getCode()));
-            return musicCardDto;
+        if (musicCardDto == null){
+            musicCardDto = new MusicCardDto();
+            musicCardDto.setUserName(sysUser.getUsername());
         }
-        return new MusicCardDto();
+        musicCardDto.setMusicGroupNum(musicGroupDao.countUserMusicGroups(userId));
+        musicCardDto.setVipClassNum(classGroupStudentMapperDao.countUserGroups(userId, ClassGroupTypeEnum.VIP.getCode()));
+        return musicCardDto;
     }
 
     @Override

+ 3 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -55,10 +55,8 @@ public class PayServiceImpl implements PayService {
         String company = "daya";
         if (userId != null) {
             MusicGroup musicGroup = musicGroupDao.findUserMusicGroup(userId);
-            if(musicGroup != null){
-                if (musicGroup.getOwnershipType().equals(CooperationOrgan.OwnershipType.COOPERATION)) {
-                    company = "yadie";
-                }
+            if (musicGroup != null && musicGroup.getOwnershipType().equals(CooperationOrgan.OwnershipType.COOPERATION)) {
+                company = "yadie";
             }
         }
 
@@ -66,7 +64,7 @@ public class PayServiceImpl implements PayService {
         Map unionPay = new HashMap();
         SysAccount routingAccount = getRoutingAccount(company, amount);
         PaymentChannelTypeEnum paymentChannelType = PaymentChannelTypeEnum.COM;
-        if(routingAccount.getType().equals("PER")){
+        if (routingAccount.getType().equals("PER")) {
             paymentChannelType = PaymentChannelTypeEnum.PER;
         }
         Map payMap = null;

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

@@ -1,20 +1,31 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.OrganizationDao;
 import com.ym.mec.biz.dal.dao.SchoolDao;
 import com.ym.mec.biz.dal.entity.School;
+import com.ym.mec.biz.dal.page.SchoolQueryInfo;
 import com.ym.mec.biz.service.SchoolService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 @Service
 public class SchoolServiceImpl extends BaseServiceImpl<Integer, School>  implements SchoolService {
 	
 	@Autowired
 	private SchoolDao schoolDao;
+	@Autowired
+	private OrganizationDao organizationDao;
 
 	@Override
 	public BaseDAO<Integer, School> getDAO() {
@@ -30,4 +41,16 @@ public class SchoolServiceImpl extends BaseServiceImpl<Integer, School>  impleme
 	public List<School> findVipSchoolByTeacher(Integer teacherId,String organId,Integer isDefault) {
 		return schoolDao.findVipSchoolByUserId(teacherId,organId,isDefault);
 	}
+
+	@Override
+	public PageInfo<School> queryPageDetail(SchoolQueryInfo queryInfo) {
+		PageInfo<School> schoolPageInfo = queryPage(queryInfo);
+		List<School> rows = schoolPageInfo.getRows();
+		Set<Integer> organIds = rows.stream().map(e -> e.getOrganId()).collect(Collectors.toSet());
+		Map<Integer,String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMap(StringUtils.join(organIds,",")));
+		rows.forEach(e->{
+			e.setOrganName(organNames.get(e.getOrganId()));
+		});
+		return schoolPageInfo;
+	}
 }

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

@@ -17,4 +17,9 @@ public class SysPaymentConfigServiceImpl extends BaseServiceImpl<Integer, SysPay
     public BaseDAO<Integer, SysPaymentConfig> getDAO() {
         return sysPaymentConfigDao;
     }
+
+    @Override
+    public SysPaymentConfig findPaymentConfigByOrganId(Integer organId) {
+        return sysPaymentConfigDao.findPaymentConfigByOrganId(organId);
+    }
 }

+ 11 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -1003,8 +1003,17 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		studentPaymentOrderDao.insert(studentPaymentOrder);
 
 		BigDecimal amount=vipGroup.getTotalPrice();
-
-		if(vipGroupBuyParams.isUseBalancePayment() || amount.doubleValue() == 0){
+		if("36".equals(user.getOrganId())){
+			studentPaymentOrder.setPaymentChannel("BALANCE");
+			studentPaymentOrder.setActualAmount(new BigDecimal(0));
+			studentPaymentOrder.setBalancePaymentAmount(amount);
+			studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
+			studentPaymentOrder.setUpdateTime(date);
+			this.orderCallback(studentPaymentOrder);
+			Map<String,Object> result=new HashMap<>();
+			result.put("orderNo",studentPaymentOrder.getOrderNo());
+			return result;
+		}else if(vipGroupBuyParams.isUseBalancePayment() || amount.doubleValue() == 0){
 			SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(user.getId());
 			if(userCashAccount == null){
 				throw new BizException("用户账户找不到");

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

@@ -579,7 +579,7 @@
         LEFT JOIN class_group cg ON cg.id_ = cs.class_group_id_
         LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
         <include refid="queryMusicGroupCourseScheduleSql"/>
-        ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
+        ORDER BY cs.class_date_ ,cs.start_class_time_ ,cg.name_
         <include refid="global.limit"/>
     </select>
 

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

@@ -257,7 +257,7 @@
             AND status_!='QUIT'
     </select>
     <select id="countUserGroups" resultType="int">
-      SELECT COUNT(1)
+      SELECT COUNT(DISTINCT cgsm.music_group_id_)
       FROM class_group_student_mapper cgsm
       LEFT JOIN class_group cg ON cgsm.class_group_id_=cg.id_
       WHERE cgsm.user_id_=#{userId} AND cgsm.group_type_=#{groupType} AND cgsm.status_!='QUIT' AND cg.del_flag_!=1

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/SchoolMapper.xml

@@ -99,6 +99,9 @@
         <if test="organId != null">
             AND FIND_IN_SET(organ_id_,#{organId})
         </if>
+        <if test="search != null">
+            AND (name_ LIKE CONCAT('%',#{search},'%') OR id_ LIKE CONCAT('%',#{search},'%'))
+        </if>
         ORDER BY id_
         <include refid="global.limit"/>
     </select>
@@ -112,6 +115,9 @@
         <if test="organId != null">
             AND FIND_IN_SET(organ_id_,#{organId})
         </if>
+        <if test="search != null">
+            AND (name_ LIKE CONCAT('%',#{search},'%') OR id_ LIKE CONCAT('%',#{search},'%'))
+        </if>
 	</select>
     <select id="queryByOrganId" resultMap="School">
         SELECT * FROM school

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

@@ -5,6 +5,7 @@
         <!--@Table sys_payment_config-->
         <id column="id_" jdbcType="INTEGER" property="id"/>
         <result column="organ_id_" jdbcType="INTEGER" property="organId"/>
+        <result column="type_" jdbcType="INTEGER" property="type"/>
         <result column="organ_name" jdbcType="VARCHAR" property="organName"/>
         <result column="per_scale_" jdbcType="INTEGER" property="perScale"/>
         <result column="com_scale_" jdbcType="INTEGER" property="comScale"/>
@@ -17,7 +18,7 @@
     </resultMap>
     <sql id="Base_Column_List">
         <!--@mbg.generated-->
-        id_, organ_id_, per_scale_, com_scale_, course_fee_, instrument_fee_, accessories_fee_,
+        id_, organ_id_,type_, per_scale_, com_scale_, course_fee_, instrument_fee_, accessories_fee_,
         other_fee_, create_time_, update_time_
     </sql>
     <select id="get" parameterType="java.lang.Integer" resultMap="SysPaymentConfig">
@@ -36,6 +37,9 @@
         <!--@mbg.generated-->
         insert into sys_payment_config
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="type != null">
+                type_,
+            </if>
             <if test="organId != null">
                 organ_id_,
             </if>
@@ -65,6 +69,9 @@
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="type != null">
+                #{type,jdbcType=INTEGER},
+            </if>
             <if test="organId != null">
                 #{organId,jdbcType=INTEGER},
             </if>
@@ -98,6 +105,9 @@
         <!--@mbg.generated-->
         update sys_payment_config
         <set>
+            <if test="type != null">
+                type_ = #{type,jdbcType=INTEGER},
+            </if>
             <if test="organId != null">
                 organ_id_ = #{organId,jdbcType=INTEGER},
             </if>
@@ -147,4 +157,9 @@
         SELECT COUNT(*) FROM sys_payment_config
         <include refid="global.limit"/>
     </select>
+
+    <!-- 按分部编号查配置 -->
+    <select id="findPaymentConfigByOrganId" resultMap="SysPaymentConfig">
+        SELECT * FROM sys_payment_config WHERE organ_id_ = #{organId}
+    </select>
 </mapper>

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

@@ -85,7 +85,7 @@ public class SchoolController extends BaseController {
 				}
 			}
 		}
-        return succeed(schoolService.queryPage(queryInfo));
+        return succeed(schoolService.queryPageDetail(queryInfo));
     }
 
     @ApiOperation(value = "根据机构编号获取学校列表")

+ 17 - 9
mec-web/src/main/java/com/ym/mec/web/controller/SysPaymentConfigController.java

@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,18 +23,25 @@ public class SysPaymentConfigController extends BaseController {
     @ApiOperation(value = "新增支付配置")
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/add')")
-    public Object add(SysPaymentConfig sysPaymentConfig){
+    public HttpResponseResult add(SysPaymentConfig sysPaymentConfig) {
+        if (sysPaymentConfig.getOrganId() == null) {
+            return failed("请选择分部");
+        }
+        SysPaymentConfig paymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(sysPaymentConfig.getOrganId());
+        if (paymentConfig != null) {
+            return failed("此分部配置已经存在");
+        }
         return succeed(sysPaymentConfigService.insert(sysPaymentConfig));
     }
 
     @ApiOperation(value = "删除支付配置")
     @PostMapping("/del/{id}")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/del')")
-    public Object del(@ApiParam(value = "支付配置编号", required = true) @PathVariable("id") Integer id){
-    	SysPaymentConfig sysPaymentConfig = sysPaymentConfigService.get(id);
-    	if(sysPaymentConfig == null){
-    		return failed("参数错误");
-    	}
+    public Object del(@ApiParam(value = "支付配置编号", required = true) @PathVariable("id") Integer id) {
+        SysPaymentConfig sysPaymentConfig = sysPaymentConfigService.get(id);
+        if (sysPaymentConfig == null) {
+            return failed("参数错误");
+        }
         sysPaymentConfigService.delete(id);
         return succeed();
     }
@@ -41,7 +49,7 @@ public class SysPaymentConfigController extends BaseController {
     @ApiOperation(value = "修改支付配置")
     @PostMapping("/update")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/update')")
-    public Object update(SysPaymentConfig sysPaymentConfig){
+    public Object update(SysPaymentConfig sysPaymentConfig) {
         sysPaymentConfig.setUpdateTime(new Date());
         sysPaymentConfigService.update(sysPaymentConfig);
         return succeed();
@@ -50,14 +58,14 @@ public class SysPaymentConfigController extends BaseController {
     @ApiOperation(value = "根据支付配置编号查询支付配置")
     @GetMapping("/get/{id}")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/get')")
-    public Object get(@ApiParam(value = "支付配置编号", required = true) @PathVariable("id") Integer id){
+    public Object get(@ApiParam(value = "支付配置编号", required = true) @PathVariable("id") Integer id) {
         return succeed(sysPaymentConfigService.get(id));
     }
 
     @ApiOperation(value = "分页查询支付配置列表")
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/queryPage')")
-    public Object queryPage(QueryInfo queryInfo){
+    public Object queryPage(QueryInfo queryInfo) {
         return succeed(sysPaymentConfigService.queryPage(queryInfo));
     }
 }