Browse Source

激活码导出

liujc 1 year ago
parent
commit
8de02b0ee2

+ 6 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantActivationCodeMapper.xml

@@ -24,6 +24,9 @@
         FROM tenant_activation_code t
         LEFT JOIN tenant_album_purchase ta on t.tenant_album_purchase_id_ = ta.id_
         LEFT JOIN sys_user su on t.activation_user_id_ = su.id_
+        <if test="param.orderNo != null and param.orderNo != ''">
+            left join tenant_album_purchase t4 on t4.id_ = t.tenant_album_purchase_id_
+        </if>
         <where>
             <if test="param.keyword != null and param.keyword.trim() != ''">
                 AND (
@@ -49,6 +52,9 @@
             <if test="param.activationEndTime != null">
                 AND #{param.activationEndTime} >= t.activation_time_
             </if>
+            <if test="param.orderNo != null and param.orderNo != ''">
+                and ${param.orderNo} = t4.order_no_
+            </if>
         </where>
         order by t.activation_status_ asc, t.id_ desc
     </select>

+ 37 - 0
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/TenantActivationCodeController.java

@@ -171,6 +171,43 @@ public class TenantActivationCodeController extends BaseController {
         }
     }
 
+
+    @GetMapping("/exportOrderCode")
+    @ApiOperation(value = "导出订单激活码模板")
+    public void exportOrderCode(HttpServletResponse response,String orderNo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("请登录");
+        }
+        Long tenantId = sysUser.getTenantId();
+
+        TenantActivationCodeWrapper.TenantActivationCodeQuery query =
+                new TenantActivationCodeWrapper.TenantActivationCodeQuery();
+        query.setTenantId(tenantId);
+        query.setActivationStatus(false);
+        query.setOrderNo(orderNo);
+        query.setPage(1);
+        query.setRows(9999);
+        IPage<TenantActivationCodeWrapper.TenantActivationCode> queryInfo =
+                tenantActivationCodeService.selectPage(QueryInfo.getPage(query), query);
+        List<TenantActivationCodeWrapper.TenantActivationCode> rows = queryInfo.getRecords();
+        if (rows.isEmpty()) {
+            throw new BizException("没有可导出数据");
+        }
+
+        try (OutputStream outputStream = response.getOutputStream()) {
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"激活码"}, new String[]{
+                    "activationCode"}, rows);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attac:wq" +
+                    "hment;filename=active_code-" + DateUtil.getDate(new Date()) + ".xls");
+            workbook.write(outputStream);
+            outputStream.flush();
+        } catch (Exception e) {
+            log.error("导出激活码异常", e);
+        }
+    }
+
     @PostMapping("/importActiveCode")
     @ApiOperation(value = "导入", notes = "传入file")
     public HttpResponseResult<List<ErrMsg>> importActiveCode(

+ 18 - 0
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/UserOrderController.java

@@ -15,6 +15,7 @@ import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.TenantStaffService;
 import com.yonge.cooleshow.biz.dal.service.UserOrderService;
 import com.yonge.cooleshow.biz.dal.service.UserPaymentCoreService;
+import com.yonge.cooleshow.biz.dal.vo.UserOrderVo;
 import com.yonge.cooleshow.biz.dal.wrapper.UserPaymentOrderWrapper;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.enums.CacheNameEnum;
@@ -202,6 +203,23 @@ public class UserOrderController {
         return succeed(userPaymentCoreService.orderPayType(payTypeReq));
     }
 
+    /**
+     * 查询单条
+     */
+    @GetMapping("/detailByOrderNo/{orderNo}")
+    @ApiOperation(value = "通过订单号查询详情", notes = "传入orderNo")
+    public HttpResponseResult<UserOrderVo> detailByOrderNo(@PathVariable("orderNo") String orderNo) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        UserOrder param = new UserOrder();
+        param.setUserId(user.getId());
+        param.setOrderNo(orderNo);
+        UserOrderVo detail = userOrderService.detailApp(param);
+        return succeed(detail);
+    }
+
 
 
 }

+ 2 - 2
toolset/toolset-base/src/main/java/com/yonge/toolset/base/util/StringUtil.java

@@ -365,9 +365,9 @@ public class StringUtil {
 
         String s ="00000000" + DeciamlToThirtySix(iSrc);
         // 获取string 后7位
-//        return s.substring(s.length()-7);
+        return s.substring(s.length()-7);
 
-        return s;
+//        return s;
 
     }