浏览代码

1.问题修改

yuanliang 1 年之前
父节点
当前提交
6f5faff3c9

+ 25 - 13
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/TenantActivationCodeController.java

@@ -1,6 +1,7 @@
 package com.yonge.cooleshow.admin.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.microsvc.toolkit.common.response.paging.PageInfo;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import com.yonge.cooleshow.biz.dal.entity.TenantActivationCode;
 import com.yonge.cooleshow.biz.dal.entity.TenantAlbumPurchase;
@@ -13,7 +14,6 @@ import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.tenant.vo.TenantActivationCodeVo;
 import com.yonge.toolset.base.exception.BizException;
-import com.yonge.toolset.base.page.PageInfo;
 import com.yonge.toolset.mybatis.support.PageUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -28,6 +28,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
 
 @Slf4j
 @Validated
@@ -51,23 +56,30 @@ public class TenantActivationCodeController extends BaseController {
     public HttpResponseResult<PageInfo<TenantActivationCodeWrapper.TenantActivationCode>> page(
             @RequestBody TenantActivationCodeWrapper.TenantActivationCodeQuery query) {
 
-        if (StringUtils.isBlank(query.getOrderNo())) {
-            throw new BizException("订单号不能为空");
-        }
-        // 查询订单购买的专辑
-        TenantAlbumPurchase albumPurchase = tenantAlbumPurchaseService.getByOrderNo(query.getOrderNo());
-        if (albumPurchase == null) {
-            return succeed(new PageInfo<>());
+        String activationTime = query.getActivationTime();
+        if (StringUtils.isNotEmpty(activationTime)) {
+            Date parse = new SimpleDateFormat("yyyy-MM").parse(activationTime, new ParsePosition(0));
+            query.setActivationStartTime(parse);
+            Calendar instance = Calendar.getInstance();
+            instance.setTime(parse);
+            instance.add(Calendar.MONTH, 1);
+            instance.add(Calendar.DATE, -1);
+            instance.set(Calendar.HOUR_OF_DAY, 23);
+            instance.set(Calendar.MINUTE, 59);
+            instance.set(Calendar.MILLISECOND, 59);
+            query.setActivationEndTime(instance.getTime());
         }
-        query.setActivationStatus(true);
-        query.setTenantAlbumPurchaseId(albumPurchase.getId());
-        // 查询数据
         IPage<TenantActivationCodeWrapper.TenantActivationCode> pages =
                 tenantActivationCodeService.selectPage(QueryInfo.getPage(query), query);
-        PageInfo<TenantActivationCodeWrapper.TenantActivationCode> pageInfo = PageUtil.pageInfo(pages);
+        com.microsvc.toolkit.common.response.paging.PageInfo<TenantActivationCodeWrapper.TenantActivationCode> pageInfo = QueryInfo.pageInfo(pages,
+                pages.getRecords());
 
         if (query.getTenantAlbumPurchaseId() != null) {
-            pageInfo.setStatInfo(albumPurchase);
+            TenantActivationCodeWrapper.TenantActivationCode extra =
+                    new TenantActivationCodeWrapper.TenantActivationCode();
+            TenantAlbumPurchase purchase = tenantAlbumPurchaseService.getById(query.getTenantAlbumPurchaseId());
+            extra.setActiveQuantity(purchase.getActiveQuantity());
+            pageInfo.setExtra(extra);
         }
 
         return succeed(pageInfo);

+ 2 - 2
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/TenantGroupController.java

@@ -92,7 +92,7 @@ public class TenantGroupController {
 
     @ApiOperation(value = "新增", notes = "机构小组表- 传入 TenantGroupWrapper.TenantGroup")
     @PostMapping("/save")
-    @PreAuthorize("@pcs.hasPermissions('tenantGroup/add')")
+    @PreAuthorize("@pcs.hasPermissions('tenantGroup/save')")
     public R<JSONObject> add(@Validated @RequestBody TenantGroupVo.TenantGroup tenantGroup) {
         Long tenantId = tenantGroup.getTenantId();
         if (tenantId == null) {
@@ -119,7 +119,7 @@ public class TenantGroupController {
 
     @ApiOperation(value = "删除", notes = "机构小组表- 传入id")
     @PostMapping("/remove")
-    @PreAuthorize("@pcs.hasPermissions('tenantGroup/detail')")
+    @PreAuthorize("@pcs.hasPermissions('tenantGroup/remove')")
     public R<Boolean> remove(@RequestParam Long id) {
 
         return R.from(tenantGroupService.delete(id));

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/StudentServiceImpl.java

@@ -708,6 +708,11 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
                     .set(StringUtils.isNotEmpty(studentInfo.getAvatar()), Student::getAvatar, studentInfo.getAvatar())
                     .eq(Student::getUserId, studentInfo.getId())
                     .update();
+
+            userTenantBindRecordMapper.update(null, Wrappers.<UserTenantBindRecord>lambdaUpdate()
+                    .eq(UserTenantBindRecord::getUserId, studentInfo.getId())
+                    .eq(UserTenantBindRecord::getUserType, "STUDENT")
+                    .set(UserTenantBindRecord::getUserId, sysUser.getId()));
         } else {
             Student newStudent = new Student();
             newStudent.setUserId(studentInfo.getId());

+ 3 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserTenantBindRecordMapper.xml

@@ -20,8 +20,9 @@
         ,su.username_ userName
         ,su.phone_ phone
         ,su.gender_ gender
-        ,su.lock_flag_ lockFlag
+<!--        ,su.lock_flag_ lockFlag-->
         <if test="param.userType == 'TEACHER'">
+            ,tc.lock_flag_ lockFlag
             ,tc.settlement_from_ settlementFrom
             ,group_concat(tg.name_) tenantGroupName
             ,group_concat(tg.id_) tenantGroupId
@@ -30,6 +31,7 @@
             ,tg.name_ tenantGroupName
             ,tg.id_ tenantGroupId
             ,st.subject_id_ subjectId
+            ,st.lock_flag_ lockFlag
         </if>
         FROM user_tenant_bind_record t
         LEFT JOIN sys_user su ON t.user_id_ = su.id_