放心学数据查询

This commit is contained in:
DB 2023-12-15 18:08:09 +08:00
parent b3e956b96c
commit 24578110b0
20 changed files with 2224 additions and 380 deletions

View File

@ -40,17 +40,17 @@ public class CpopGenerator {
/**
* 输出路径
*/
private static final String EXPORT_URL = "/Cpop-Oam";
private static final String EXPORT_URL = "/Cpop-Jambox";
/**
* 模块
*/
private static final String EXPORT_ITEM = "oam";
private static final String EXPORT_ITEM = "jambox";
/**
* 表前缀
*/
private static final String TABLE_PREFIX = "cp_oam_";
private static final String TABLE_PREFIX = "cp_j_";
/**
* 主入口

View File

@ -0,0 +1,50 @@
package com.cpop.jambox.business.bo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author DB
* @version 1.0.0
* @since 2023-12-15 9:26
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "EasyLearnPageBo对象", description = "放心学分页查询参数")
public class EasyLearnPageBo {
/**
* 开始与结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
@ApiModelProperty(value = "开始与结束时间")
private List<LocalDateTime> startAndEnd;
/**
* 顾问
*/
@ApiModelProperty(value = "顾问")
private String staffName;
/**
* 品牌与校区模糊查询
*/
@ApiModelProperty(value = "品牌与校区模糊查询")
private String brandOrStore;
/**
* 订单类型(0先学后付;1月付;2微信支付;3数币支付;4机构会员)
*/
@NotNull(message = "类型不能为空")
@ApiModelProperty(value = "类型(0先学后付;1月付;2微信支付;3数币支付;4机构会员)",required = true)
private Integer orderType;
}

View File

@ -0,0 +1,89 @@
package com.cpop.jambox.business.controller;
import com.alibaba.excel.EasyExcel;
import com.cpop.core.base.R;
import com.cpop.jambox.business.bo.EasyLearnPageBo;
import com.cpop.jambox.business.dto.EasyLearnPageDto;
import com.cpop.jambox.business.service.EasyLearnOrderService;
import com.cpop.jambox.business.vo.EasyLearnPageVo;
import com.mybatisflex.core.paginate.Page;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
/**
* 果酱-放心学订单表 控制层
*
* @author DB
* @since 2023-12-14
*/
@RestController
@Api(tags = "果酱-放心学订单表接口")
@RequestMapping("/easyLearn")
public class EasyLearnController {
@Autowired
private EasyLearnOrderService easyLearnOrderService;
/**
* 获取放心学分页
* @author DB
* @since 2023/12/15
* @param bo 查询参数
* @return R<Page<EasyLearnPageVo>>
*/
@ApiOperation("查询放心学分页")
@GetMapping("/getEasyLearnPage")
public R<Page<EasyLearnPageVo>> getEasyLearnPage(@Validated EasyLearnPageBo bo) {
Page<EasyLearnPageVo> page = easyLearnOrderService.getEasyLearnPage(bo);
return R.ok(page);
}
/**
* 导出放心学数据
* @author DB
* @since 2023/12/15
* @param response 响应
* @param bo 请求参数
*/
@GetMapping("/getEasyLearnXml")
@ApiOperation("导出放心学数据")
public void getEasyLearnXml(HttpServletResponse response, @ApiParam("分页查询条件") @Validated EasyLearnPageBo bo) throws IOException {
// 这里注意 有同学反应使用swagger 会导致各种问题请直接用浏览器或者用postman
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyExcel没有关系
String fileFullName = "放心学";
switch (bo.getOrderType()) {
case 0:
fileFullName = fileFullName + " 先学后付-次付 ";
break;
case 1:
fileFullName = fileFullName + " 先学后付-月付 ";
break;
case 2:
fileFullName = fileFullName + " 微信支付 ";
break;
case 3:
fileFullName = fileFullName + " 数字人民币 ";
break;
case 4:
fileFullName = fileFullName + " 机构会员 ";
break;
default:
}
String fileName = URLEncoder.encode(fileFullName + "数据", "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream(), EasyLearnPageDto.class).sheet("记录").doWrite(easyLearnOrderService.getEasyLearnXml(bo));
}
}

View File

@ -1,106 +0,0 @@
package com.cpop.jambox.business.controller;
import com.mybatisflex.core.paginate.Page;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import com.cpop.jambox.business.entity.EasyLearnOrderDetail;
import com.cpop.jambox.business.service.EasyLearnOrderDetailService;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.io.Serializable;
import java.util.List;
/**
* 果酱-放心学订单详情表 控制层
*
* @author DB
* @since 2023-12-14
*/
@RestController
@Api(tags = "果酱-放心学订单详情表接口")
@RequestMapping("/easyLearnOrderDetail")
public class EasyLearnOrderDetailController {
@Autowired
private EasyLearnOrderDetailService easyLearnOrderDetailService;
/**
* 添加果酱-放心学订单详情表
*
* @param easyLearnOrderDetail 果酱-放心学订单详情表
* @return {@code true} 添加成功{@code false} 添加失败
*/
@PostMapping("/save")
@ApiOperation("保存果酱-放心学订单详情表")
public boolean save(@RequestBody @ApiParam("果酱-放心学订单详情表") EasyLearnOrderDetail easyLearnOrderDetail) {
return easyLearnOrderDetailService.save(easyLearnOrderDetail);
}
/**
* 根据主键删除果酱-放心学订单详情表
*
* @param id 主键
* @return {@code true} 删除成功{@code false} 删除失败
*/
@DeleteMapping("/remove/{id}")
@ApiOperation("根据主键果酱-放心学订单详情表")
public boolean remove(@PathVariable @ApiParam("果酱-放心学订单详情表主键") Serializable id) {
return easyLearnOrderDetailService.removeById(id);
}
/**
* 根据主键更新果酱-放心学订单详情表
*
* @param easyLearnOrderDetail 果酱-放心学订单详情表
* @return {@code true} 更新成功{@code false} 更新失败
*/
@PutMapping("/update")
@ApiOperation("根据主键更新果酱-放心学订单详情表")
public boolean update(@RequestBody @ApiParam("果酱-放心学订单详情表主键") EasyLearnOrderDetail easyLearnOrderDetail) {
return easyLearnOrderDetailService.updateById(easyLearnOrderDetail);
}
/**
* 查询所有果酱-放心学订单详情表
*
* @return 所有数据
*/
@GetMapping("/list")
@ApiOperation("查询所有果酱-放心学订单详情表")
public List<EasyLearnOrderDetail> list() {
return easyLearnOrderDetailService.list();
}
/**
* 根据果酱-放心学订单详情表主键获取详细信息
*
* @param id 果酱-放心学订单详情表主键
* @return 果酱-放心学订单详情表详情
*/
@GetMapping("/getInfo/{id}")
@ApiOperation("根据主键获取果酱-放心学订单详情表")
public EasyLearnOrderDetail getInfo(@PathVariable @ApiParam("果酱-放心学订单详情表主键") Serializable id) {
return easyLearnOrderDetailService.getById(id);
}
/**
* 分页查询果酱-放心学订单详情表
*
* @param page 分页对象
* @return 分页对象
*/
@GetMapping("/page")
@ApiOperation("分页查询果酱-放心学订单详情表")
public Page<EasyLearnOrderDetail> page(@ApiParam("分页信息") Page<EasyLearnOrderDetail> page) {
return easyLearnOrderDetailService.page(page);
}
}

View File

@ -1,106 +0,0 @@
package com.cpop.jambox.business.controller;
import com.mybatisflex.core.paginate.Page;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import com.cpop.jambox.business.entity.EasyLearnOrderExtend;
import com.cpop.jambox.business.service.EasyLearnOrderExtendService;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.io.Serializable;
import java.util.List;
/**
* 果酱-放心学-订单拓展 控制层
*
* @author DB
* @since 2023-12-14
*/
@RestController
@Api(tags = "果酱-放心学-订单拓展接口")
@RequestMapping("/easyLearnOrderExtend")
public class EasyLearnOrderExtendController {
@Autowired
private EasyLearnOrderExtendService easyLearnOrderExtendService;
/**
* 添加果酱-放心学-订单拓展
*
* @param easyLearnOrderExtend 果酱-放心学-订单拓展
* @return {@code true} 添加成功{@code false} 添加失败
*/
@PostMapping("/save")
@ApiOperation("保存果酱-放心学-订单拓展")
public boolean save(@RequestBody @ApiParam("果酱-放心学-订单拓展") EasyLearnOrderExtend easyLearnOrderExtend) {
return easyLearnOrderExtendService.save(easyLearnOrderExtend);
}
/**
* 根据主键删除果酱-放心学-订单拓展
*
* @param id 主键
* @return {@code true} 删除成功{@code false} 删除失败
*/
@DeleteMapping("/remove/{id}")
@ApiOperation("根据主键果酱-放心学-订单拓展")
public boolean remove(@PathVariable @ApiParam("果酱-放心学-订单拓展主键") Serializable id) {
return easyLearnOrderExtendService.removeById(id);
}
/**
* 根据主键更新果酱-放心学-订单拓展
*
* @param easyLearnOrderExtend 果酱-放心学-订单拓展
* @return {@code true} 更新成功{@code false} 更新失败
*/
@PutMapping("/update")
@ApiOperation("根据主键更新果酱-放心学-订单拓展")
public boolean update(@RequestBody @ApiParam("果酱-放心学-订单拓展主键") EasyLearnOrderExtend easyLearnOrderExtend) {
return easyLearnOrderExtendService.updateById(easyLearnOrderExtend);
}
/**
* 查询所有果酱-放心学-订单拓展
*
* @return 所有数据
*/
@GetMapping("/list")
@ApiOperation("查询所有果酱-放心学-订单拓展")
public List<EasyLearnOrderExtend> list() {
return easyLearnOrderExtendService.list();
}
/**
* 根据果酱-放心学-订单拓展主键获取详细信息
*
* @param id 果酱-放心学-订单拓展主键
* @return 果酱-放心学-订单拓展详情
*/
@GetMapping("/getInfo/{id}")
@ApiOperation("根据主键获取果酱-放心学-订单拓展")
public EasyLearnOrderExtend getInfo(@PathVariable @ApiParam("果酱-放心学-订单拓展主键") Serializable id) {
return easyLearnOrderExtendService.getById(id);
}
/**
* 分页查询果酱-放心学-订单拓展
*
* @param page 分页对象
* @return 分页对象
*/
@GetMapping("/page")
@ApiOperation("分页查询果酱-放心学-订单拓展")
public Page<EasyLearnOrderExtend> page(@ApiParam("分页信息") Page<EasyLearnOrderExtend> page) {
return easyLearnOrderExtendService.page(page);
}
}

View File

@ -1,106 +0,0 @@
package com.cpop.jambox.business.controller;
import com.mybatisflex.core.paginate.Page;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import com.cpop.jambox.business.entity.EasyLearnOrdre;
import com.cpop.jambox.business.service.EasyLearnOrdreService;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.io.Serializable;
import java.util.List;
/**
* 果酱-放心学订单表 控制层
*
* @author DB
* @since 2023-12-14
*/
@RestController
@Api(tags = "果酱-放心学订单表接口")
@RequestMapping("/easyLearnOrdre")
public class EasyLearnOrdreController {
@Autowired
private EasyLearnOrdreService easyLearnOrdreService;
/**
* 添加果酱-放心学订单表
*
* @param easyLearnOrdre 果酱-放心学订单表
* @return {@code true} 添加成功{@code false} 添加失败
*/
@PostMapping("/save")
@ApiOperation("保存果酱-放心学订单表")
public boolean save(@RequestBody @ApiParam("果酱-放心学订单表") EasyLearnOrdre easyLearnOrdre) {
return easyLearnOrdreService.save(easyLearnOrdre);
}
/**
* 根据主键删除果酱-放心学订单表
*
* @param id 主键
* @return {@code true} 删除成功{@code false} 删除失败
*/
@DeleteMapping("/remove/{id}")
@ApiOperation("根据主键果酱-放心学订单表")
public boolean remove(@PathVariable @ApiParam("果酱-放心学订单表主键") Serializable id) {
return easyLearnOrdreService.removeById(id);
}
/**
* 根据主键更新果酱-放心学订单表
*
* @param easyLearnOrdre 果酱-放心学订单表
* @return {@code true} 更新成功{@code false} 更新失败
*/
@PutMapping("/update")
@ApiOperation("根据主键更新果酱-放心学订单表")
public boolean update(@RequestBody @ApiParam("果酱-放心学订单表主键") EasyLearnOrdre easyLearnOrdre) {
return easyLearnOrdreService.updateById(easyLearnOrdre);
}
/**
* 查询所有果酱-放心学订单表
*
* @return 所有数据
*/
@GetMapping("/list")
@ApiOperation("查询所有果酱-放心学订单表")
public List<EasyLearnOrdre> list() {
return easyLearnOrdreService.list();
}
/**
* 根据果酱-放心学订单表主键获取详细信息
*
* @param id 果酱-放心学订单表主键
* @return 果酱-放心学订单表详情
*/
@GetMapping("/getInfo/{id}")
@ApiOperation("根据主键获取果酱-放心学订单表")
public EasyLearnOrdre getInfo(@PathVariable @ApiParam("果酱-放心学订单表主键") Serializable id) {
return easyLearnOrdreService.getById(id);
}
/**
* 分页查询果酱-放心学订单表
*
* @param page 分页对象
* @return 分页对象
*/
@GetMapping("/page")
@ApiOperation("分页查询果酱-放心学订单表")
public Page<EasyLearnOrdre> page(@ApiParam("分页信息") Page<EasyLearnOrdre> page) {
return easyLearnOrdreService.page(page);
}
}

View File

@ -0,0 +1,71 @@
package com.cpop.jambox.business.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @author DB
* @version 1.0.0
* @since 2023-12-15 16:14
*/
@Data
public class EasyLearnPageDto {
/**
* 品牌名
*/
@ExcelProperty(value = "品牌")
private String brandName;
/**
* 校区名
*/
@ExcelProperty(value = "校区")
private String storeName;
/**
* 客户名
*/
@ExcelProperty(value = "学员姓名")
private String customerName;
/**
* 客户电话
*/
@ExcelProperty(value = "学员电话")
private String customerPhone;
/**
* 课卡名
*/
@ExcelProperty(value = "课卡名")
private String productName;
/**
* 期数
*/
@ExcelProperty(value = "期数")
private Long periodNumber;
/**
* 签约金额
*/
@ExcelProperty(value = "签约金额")
private BigDecimal totalAmount;
/**
* 支付金额
*/
@ExcelProperty(value = "已付金额")
private BigDecimal totalPayAmount;
/**
* 顾问
*/
@ExcelProperty(value = "顾问")
private String staffName;
/**
* 签约时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ExcelProperty(value = "签约时间")
private LocalDateTime createTime;
}

View File

@ -26,8 +26,8 @@ import lombok.experimental.Accessors;
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Table(value = "cp_j_easy_learn_ordre", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
public class EasyLearnOrdre extends BaseEntity implements Serializable {
@Table(value = "cp_j_easy_learn_order", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
public class EasyLearnOrder extends BaseEntity implements Serializable {
/**
* 主键

View File

@ -1,7 +1,7 @@
package com.cpop.jambox.business.mapper;
import com.cpop.jambox.business.entity.EasyLearnOrder;
import com.mybatisflex.core.BaseMapper;
import com.cpop.jambox.business.entity.EasyLearnOrdre;
/**
* 果酱-放心学订单表 映射层
@ -9,6 +9,6 @@ import com.cpop.jambox.business.entity.EasyLearnOrdre;
* @author DB
* @since 2023-12-14
*/
public interface EasyLearnOrdreMapper extends BaseMapper<EasyLearnOrdre> {
public interface EasyLearnOrderMapper extends BaseMapper<EasyLearnOrder> {
}

View File

@ -0,0 +1,38 @@
package com.cpop.jambox.business.service;
import com.cpop.jambox.business.bo.EasyLearnPageBo;
import com.cpop.jambox.business.dto.EasyLearnPageDto;
import com.cpop.jambox.business.entity.EasyLearnOrder;
import com.cpop.jambox.business.vo.EasyLearnPageVo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import java.util.Collection;
import java.util.List;
/**
* 果酱-放心学订单表 服务层
*
* @author DB
* @since 2023-12-14
*/
public interface EasyLearnOrderService extends IService<EasyLearnOrder> {
/**
* 获取放心学分页
* @author DB
* @since 2023/12/15
* @param bo 查询参数
* @return Page<EasyLearnPageVo>
*/
Page<EasyLearnPageVo> getEasyLearnPage(EasyLearnPageBo bo);
/**
* 导出放心学数据
* @author DB
* @since 2023/12/15
* @param bo 请求参数
* @return List<EasyLearnPageDto>
*/
List<EasyLearnPageDto> getEasyLearnXml(EasyLearnPageBo bo);
}

View File

@ -1,14 +0,0 @@
package com.cpop.jambox.business.service;
import com.mybatisflex.core.service.IService;
import com.cpop.jambox.business.entity.EasyLearnOrdre;
/**
* 果酱-放心学订单表 服务层
*
* @author DB
* @since 2023-12-14
*/
public interface EasyLearnOrdreService extends IService<EasyLearnOrdre> {
}

View File

@ -0,0 +1,303 @@
package com.cpop.jambox.business.service.impl;
import com.cpop.common.utils.StringUtils;
import com.cpop.core.base.entity.PageDomain;
import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.jambox.business.bo.EasyLearnPageBo;
import com.cpop.jambox.business.dto.EasyLearnPageDto;
import com.cpop.jambox.business.entity.EasyLearnOrder;
import com.cpop.jambox.business.mapper.EasyLearnOrderMapper;
import com.cpop.jambox.business.service.EasyLearnOrderService;
import com.cpop.jambox.business.vo.EasyLearnPageVo;
import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.datasource.DataSourceKey;
import com.mybatisflex.core.datasource.FlexDataSource;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.DbChain;
import com.mybatisflex.core.row.Row;
import com.mybatisflex.core.row.RowUtil;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.poi.util.StringUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import static com.mybatisflex.core.query.QueryMethods.column;
import static com.mybatisflex.core.query.QueryMethods.distinct;
/**
* 果酱-放心学订单表 服务层实现
*
* @author DB
* @since 2023-12-14
*/
@Service("easyLearnOrderService")
public class EasyLearnOrderServiceImpl extends ServiceImpl<EasyLearnOrderMapper, EasyLearnOrder> implements EasyLearnOrderService {
/**
* 获取放心学分页
* @author DB
* @since 2023/12/15
* @param bo 查询参数
* @return Page<EasyLearnPageVo>
*/
@Override
public Page<EasyLearnPageVo> getEasyLearnPage(EasyLearnPageBo bo) {
//TODO: 后续数据录入后应该查询新版中的数据
return getOldEasyLearnPage(bo);
}
/**
* 导出放心学数据
* @author DB
* @since 2023/12/15
* @param bo 请求参数
* @return List<EasyLearnPageDto>
*/
@Override
public List<EasyLearnPageDto> getEasyLearnXml(EasyLearnPageBo bo) {
//TODO: 后续数据录入后应该查询新版中的数据
return getOldEasyLearnXml(bo);
}
/**
* 获取旧数据
* @author DB
* @since 2023/12/15
* @param bo 请求参数
* @return List<EasyLearnPageDto>
*/
private List<EasyLearnPageDto> getOldEasyLearnXml(EasyLearnPageBo bo) {
//TODO: 暂时不处理顾问
try {
getJamboxProdDataSource();
switch (bo.getOrderType()) {
// 先学后付
case 0:
try {
DataSourceKey.use("jamboxProd");
return RowUtil.toEntityList(Db.selectListByQuery(getLearnNowPayLaterData(false, bo)), EasyLearnPageDto.class);
} finally {
DataSourceKey.clear();
}
case 1:
try {
DataSourceKey.use("jamboxProd");
return RowUtil.toEntityList(Db.selectListByQuery(getLearnNowPayLaterData(true, bo)), EasyLearnPageDto.class);
} finally {
DataSourceKey.clear();
}
case 2:
return new ArrayList<EasyLearnPageDto>();
// 数币分页
case 3:
try {
DataSourceKey.use("jamboxProd");
return RowUtil.toEntityList(Db.selectListByQuery(getEcppData(bo)), EasyLearnPageDto.class);
} finally {
DataSourceKey.clear();
}
case 4:
try {
//使用旧库
DataSourceKey.use("jamboxProd");
return RowUtil.toEntityList(Db.selectListByQuery( getMemberData(bo)), EasyLearnPageDto.class);
} finally {
DataSourceKey.clear();
}
default:
return null;
}
} finally {
removeJamboxProdDataSource();
}
}
/**
* 获取旧数据分页
* @author DB
* @since 2023/12/15
* @param bo 请求参数
* @return Page<EasyLearnPageVo>
*/
private Page<EasyLearnPageVo> getOldEasyLearnPage(EasyLearnPageBo bo) {
//TODO: 暂时不处理顾问
try {
getJamboxProdDataSource();
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
Page<Row> page = Page.of(pageDomain.getPageNum(), pageDomain.getPageSize());
page.setOptimizeCountQuery(false);
switch (bo.getOrderType()) {
// 先学后付
case 0:
try {
DataSourceKey.use("jamboxProd");
return Db.paginate("j_commodity_ticket", page, getLearnNowPayLaterData(false, bo)).map(item -> item.toEntity(EasyLearnPageVo.class));
} finally {
DataSourceKey.clear();
}
case 1:
try {
DataSourceKey.use("jamboxProd");
return Db.paginate("j_commodity_ticket", page, getLearnNowPayLaterData(true, bo)).map(item -> item.toEntity(EasyLearnPageVo.class));
} finally {
DataSourceKey.clear();
}
case 2:
return Page.of(1, 10, 0);
// 数币分页
case 3:
try {
DataSourceKey.use("jamboxProd");
return Db.paginate("j_commodity_ticket", page, getEcppData(bo)).map(item -> item.toEntity(EasyLearnPageVo.class));
} finally {
DataSourceKey.clear();
}
case 4:
try {
//使用旧库
DataSourceKey.use("jamboxProd");
return Db.paginate("j_commodity_ticket", page, getMemberData(bo)).map(item -> item.toEntity(EasyLearnPageVo.class));
} finally {
DataSourceKey.clear();
}
default:
return null;
}
} finally {
removeJamboxProdDataSource();
}
}
private QueryWrapper getMemberData(EasyLearnPageBo bo) {
QueryWrapper queryWrapper = QueryWrapper.create();
queryWrapper
//查询品牌校区
.select("tbi.name as brandName")
.select("jmt.ticket_id as id", "jmt.wx_order_id as outOrderNo", "jmt.name as customerName", "jmt.price as totalAmount", "jmt.price as totalPayAmount", "jmt.phone as customerPhone", "jmt.creation_time as createTime")
.from("j_membership_ticket").as("jmt")
//品牌
.leftJoin("t_brand_info").as("tbi").on("tbi.id = jmt.brand_id")
.where("jmt.deleted = 1")
.and("jmt.pay_status = 'PAY'")
.groupBy("jmt.ticket_id")
.orderBy("jmt.creation_time desc");
//开始时间结束时间
if (bo.getStartAndEnd() != null) {
queryWrapper.and("jmt.creation_time between ? and ?", bo.getStartAndEnd().get(0), bo.getStartAndEnd().get(1));
}
//品牌校区模糊查询
if (StringUtils.isNotBlank(bo.getBrandOrStore())){
queryWrapper.and("tbi.name like ?", "%" + bo.getBrandOrStore() + "%");
}
return queryWrapper;
}
/**
* 获取数币数据
* @author DB
* @since 2023/12/15
* @return Page<EasyLearnPageVo>
*/
private QueryWrapper getEcppData(EasyLearnPageBo bo) {
QueryWrapper queryWrapper = QueryWrapper.create();
queryWrapper
//查询品牌校区
.select("tbi.name as brandName", "tmi.mechanism as storeName")
.select("jct.ticket_id as id", "jct.wx_order_id as outOrderNo", "jct.name as customerName", "jct.price as totalAmount", "jct.price as totalPayAmount", "jct.phone as customerPhone", "jct.creation_time as createTime")
.select("tct.name as productName")
.from("j_commodity_ticket").as("jct")
//品牌
.leftJoin("t_brand_info").as("tbi").on("tbi.id = jct.brand_id")
//校区
.leftJoin("t_mechanism_info").as("tmi").on("tmi.store_id = jct.store_id")
//模板
.leftJoin("t_card_template").as("tct").on("tct.template_id = jct.commodity_id")
.where("jct.deleted = 1")
.and("jct.pay_status = 'PAY'")
.and("jct.is_suda = 1")
.groupBy("jct.ticket_id")
.orderBy("jct.creation_time desc");
//开始时间结束时间
if (bo.getStartAndEnd() != null) {
queryWrapper.and("jct.creation_time between ? and ?", bo.getStartAndEnd().get(0), bo.getStartAndEnd().get(1));
}
//品牌校区模糊查询
if (StringUtils.isNotBlank(bo.getBrandOrStore())){
queryWrapper.and("tbi.name like ?", "%" + bo.getBrandOrStore() + "%").or("tmi.mechanism like ?", "%" + bo.getBrandOrStore() + "%");
}
return queryWrapper;
}
/**
* 获取先学后付数据
* @author DB
* @param isMonth 是否是月付
* @since 2023/12/15
* @return Page<EasyLearnPageVo>
*/
private QueryWrapper getLearnNowPayLaterData(Boolean isMonth, EasyLearnPageBo bo) {
QueryWrapper queryWrapper = QueryWrapper.create()
//查询品牌校区
.select("tbi.name as brandName", "tmi.mechanism as storeName")
.select( "jct.ticket_id as id", "jct.wx_order_id as outOrderNo", "jct.name as customerName", "jct.price as totalAmount", "jct.price as totalPayAmount", "jct.phone as customerPhone", "jct.creation_time as createTime")
.select("tct.name as productName")
.from("j_commodity_ticket").as("jct")
//品牌
.leftJoin("t_brand_info").as("tbi").on("tbi.id = jct.brand_id")
//校区
.leftJoin("t_mechanism_info").as("tmi").on("tmi.store_id = jct.store_id")
//模板
.leftJoin("t_card_template").as("tct").on("tct.template_id = jct.commodity_id")
//微信支付
.leftJoin("j_wechat_pay_plan").as("jwpp").on("jwpp.template_id = jct.commodity_id")
.where("jct.deleted = 1")
.and("jct.pay_status = 'PAY'")
.and("jct.ticket_type = 1")
.and("jwpp.is_month = ?", isMonth)
.groupBy("jct.ticket_id")
.orderBy("jct.creation_time desc");
//开始时间结束时间
if (bo.getStartAndEnd() != null) {
queryWrapper.and("jct.creation_time between ? and ?", bo.getStartAndEnd().get(0), bo.getStartAndEnd().get(1));
}
//品牌校区模糊查询
if (StringUtils.isNotBlank(bo.getBrandOrStore())){
queryWrapper.and("tbi.name like ?", "%" + bo.getBrandOrStore() + "%").or("tmi.mechanism like ?", "%" + bo.getBrandOrStore() + "%");
}
return queryWrapper;
}
private static final String URL = "jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_association?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
/**
* 数据库用户名
*/
private static final String USERNAME = "root";
/**
* 数据库密码
*/
private static final String PASSWORD = "Customer0401";
@Deprecated
private void getJamboxProdDataSource() {
FlexDataSource flexDataSource = FlexGlobalConfig.getDefaultConfig().getDataSource();
//新的数据源
HikariDataSource dataSource = new HikariDataSource();
dataSource.setJdbcUrl(URL);
dataSource.setUsername(USERNAME);
dataSource.setPassword(PASSWORD);
flexDataSource.addDataSource("jamboxProd", dataSource);
}
@Deprecated
private void removeJamboxProdDataSource() {
FlexDataSource flexDataSource = FlexGlobalConfig.getDefaultConfig().getDataSource();
flexDataSource.removeDatasource("jamboxProd");
}
}

View File

@ -1,18 +0,0 @@
package com.cpop.jambox.business.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.jambox.business.entity.EasyLearnOrdre;
import com.cpop.jambox.business.mapper.EasyLearnOrdreMapper;
import com.cpop.jambox.business.service.EasyLearnOrdreService;
import org.springframework.stereotype.Service;
/**
* 果酱-放心学订单表 服务层实现
*
* @author DB
* @since 2023-12-14
*/
@Service("easyLearnOrdreService")
public class EasyLearnOrdreServiceImpl extends ServiceImpl<EasyLearnOrdreMapper, EasyLearnOrdre> implements EasyLearnOrdreService {
}

View File

@ -0,0 +1,79 @@
package com.cpop.jambox.business.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
/**
* @author DB
* @version 1.0.0
* @since 2023-12-15 9:32
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "EasyLearnPageVo对象", description = "分页返回对象")
public class EasyLearnPageVo {
/**
* 品牌名
*/
@ApiModelProperty(value = "品牌名")
private String brandName;
/**
* 签约时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
@ApiModelProperty(value = "签约时间")
private LocalDateTime createTime;
/**
* 客户名
*/
@ApiModelProperty(value = "客户名")
private String customerName;
/**
* 客户电话
*/
@ApiModelProperty(value = "客户电话")
private String customerPhone;
/**
* 主键
*/
@ApiModelProperty(value = "主键")
private String id;
/**
* 期数
*/
@ApiModelProperty(value = "期数")
private Long periodNumber;
/**
* 课卡名
*/
@ApiModelProperty(value = "课卡名")
private String productName;
/**
* 顾问
*/
@ApiModelProperty(value = "顾问")
private String staffName;
/**
* 校区名
*/
@ApiModelProperty(value = "校区名")
private String storeName;
/**
* 签约金额
*/
@ApiModelProperty(value = "签约金额")
private BigDecimal totalAmount;
/**
* 支付金额
*/
@ApiModelProperty(value = "支付金额")
private BigDecimal totalPayAmount;
}

View File

@ -2,6 +2,6 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cpop.jambox.business.mapper.EasyLearnOrdreMapper">
<mapper namespace="com.cpop.jambox.business.mapper.EasyLearnOrderMapper">
</mapper>

View File

@ -10,6 +10,7 @@ import com.cpop.system.business.entity.Brand;
import com.cpop.system.business.entity.ProfitSharing;
import com.cpop.system.business.service.BrandService;
import com.cpop.system.business.service.ProfitSharingService;
import com.github.binarywang.wxpay.bean.payscore.WxPartnerPayScoreResult;
import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingFinishRequest;
import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingQueryRequest;
import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingQueryResult;
@ -175,4 +176,11 @@ public class CpopWxPayTests {
wxPayService.getProfitSharingService().profitSharingFinish(profitSharingFinishRequest);
}
@Test
public void getPayPointsUserPlan() throws WxPayException {
wxPayService.getConfig().setServiceId("00003053000000169450961228104460");
String v3 = wxPayService.getV3("https://api.mch.weixin.qq.com/v3/payscore/sign-plan/partner/user-sign-plans/merchant-sign-plan-no/1735294783081091132?sub_mchid=1618925571");
System.out.println(v3);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2,44 +2,35 @@ package com.cpop.oam.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.cpop.common.utils.StringUtils;
import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.enums.SourceType;
import com.cpop.core.utils.SpringUtils;
import com.cpop.jambox.business.entity.BrandExtend;
import com.cpop.jambox.business.entity.EasyLearnOrdre;
import com.cpop.jambox.business.entity.EasyLearnOrder;
import com.cpop.jambox.business.entity.StoreExtend;
import com.cpop.jambox.business.service.BrandExtendService;
import com.cpop.jambox.business.service.EasyLearnOrdreService;
import com.cpop.jambox.business.service.EasyLearnOrderService;
import com.cpop.jambox.business.service.StoreExtendService;
import com.cpop.oam.business.entity.BrandManager;
import com.cpop.oam.business.entity.BrandManagerStore;
import com.cpop.oam.business.service.BrandManagerService;
import com.cpop.oam.business.service.BrandManagerStoreService;
import com.cpop.system.business.entity.*;
import com.cpop.system.business.mapper.StoreMapper;
import com.cpop.system.business.service.*;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.datasource.DataSourceKey;
import com.mybatisflex.core.datasource.FlexDataSource;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.*;
import com.zaxxer.hikari.HikariDataSource;
import lombok.Data;
import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import java.io.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@ -411,8 +402,8 @@ public class CpopImportTests {
item.set("storeId",storeMap.get(item.getString("storeCloudId")));
});
DataSourceKey.use("dev");
List<EasyLearnOrdre> entityList = RowUtil.toEntityList(rowList, EasyLearnOrdre.class);
SpringUtils.getBean(EasyLearnOrdreService.class).saveBatch(entityList);
List<EasyLearnOrder> entityList = RowUtil.toEntityList(rowList, EasyLearnOrder.class);
SpringUtils.getBean(EasyLearnOrderService.class).saveBatch(entityList);
}finally {
DataSourceKey.clear();
}

View File

@ -26,8 +26,7 @@ import static com.cpop.system.business.entity.table.StoreLicenseTableDef.STORE_L
import static com.cpop.system.business.entity.table.StoreRenewTableDef.STORE_RENEW;
import static com.cpop.system.business.entity.table.StoreSignTableDef.STORE_SIGN;
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
import static com.mybatisflex.core.query.QueryMethods.now;
import static com.mybatisflex.core.query.QueryMethods.subDate;
import static com.mybatisflex.core.query.QueryMethods.*;
/**
* 校区-签约表 服务层实现
@ -52,24 +51,27 @@ public class StoreSignServiceImpl extends ServiceImpl<StoreSignMapper, StoreSign
switch (bo.getRenewStatus()){
//待续费
case 0:
queryWrapper.and(subDate(STORE_SIGN.EXPIRE_DATE, now()).le(90)).and(STORE_SIGN.IS_LOSS.eq(false));
queryWrapper.and(subDate(STORE_SIGN.EXPIRE_DATE, number(90)).le(now())).and(STORE_SIGN.IS_LOSS.eq(false));
break;
//已续费
case 1:
if (bo.getRenewStartAndEnd() != null) {
queryWrapper.and(STORE_RENEW.RENEW_DATE.between(bo.getRenewStartAndEnd().get(0), bo.getRenewStartAndEnd().get(1)));
}
return SpringUtils.getBean(StoreRenewService.class).getMapper().paginateAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()),
QueryWrapper.create()
queryWrapper
.select(BRAND.BRAND_NAME)
.select(STORE.CREATE_TIME, STORE.PERSON_CHARGE, STORE.PHONE, STORE.STORE_NAME)
.select(STORE_SIGN.EXPIRE_DATE, STORE_SIGN.ID)
.select(STORE_LICENSE.LICENSE_ADDR, STORE_LICENSE.LICENSE_NAME, STORE_LICENSE.LICENSE_USER_NAME)
.select(STORE_RENEW.RENEW_DATE, STORE_RENEW.RENEW_AMOUNT)
.select("cos.name as renewStaffName")
.from(STORE_RENEW)
.leftJoin(STORE).on(STORE.ID.eq(STORE_RENEW.STORE_ID))
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
.leftJoin(STORE_LICENSE).on(STORE_LICENSE.STORE_ID.eq(STORE.ID))
.leftJoin(STORE_SIGN).on(STORE_SIGN.STORE_ID.eq(STORE.ID))
.leftJoin("cp_oam_staff").as("cos").on("cos.id = `cp_sys_store_renew`.`renew_staff_id`")
.and(STORE_RENEW.RENEW_DATE.between(bo.getRenewStartAndEnd().get(0), bo.getRenewStartAndEnd().get(1)))
.leftJoin("cp_oam_staff").as("cos").on("`cos`.`id` = cp_sys_store_renew.renew_staff_id")
.and(BRAND.BRAND_NAME.like(bo.getBrandOrStore()).or(STORE.STORE_NAME.like(bo.getBrandOrStore())))
.and(STORE_LICENSE.LICENSE_ADDR.like(bo.getAddrOrName()).or(STORE_LICENSE.LICENSE_NAME.like(bo.getAddrOrName()))),
StoreRenewPageVo.class);
@ -89,7 +91,7 @@ public class StoreSignServiceImpl extends ServiceImpl<StoreSignMapper, StoreSign
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
.leftJoin(STORE_LICENSE).on(STORE_LICENSE.STORE_ID.eq(STORE.ID))
.leftJoin(STORE_RENEW).on(STORE_RENEW.STORE_ID.eq(STORE.ID))
.leftJoin("cp_oam_staff").as("cos").on("cos.id = " + STORE_RENEW.RENEW_STAFF_ID)
.leftJoin("cp_oam_staff").as("cos").on("`cos`.`id` = `cp_sys_store_renew`.`renew_staff_id`")
.and(BRAND.BRAND_NAME.like(bo.getBrandOrStore()).or(STORE.STORE_NAME.like(bo.getBrandOrStore())))
.and(STORE_LICENSE.LICENSE_ADDR.like(bo.getAddrOrName()).or(STORE_LICENSE.LICENSE_NAME.like(bo.getAddrOrName()))),
StoreRenewPageVo.class);
@ -104,7 +106,7 @@ public class StoreSignServiceImpl extends ServiceImpl<StoreSignMapper, StoreSign
@Override
public void runOff(StoreRunOffBo bo) {
this.updateChain().set(STORE_SIGN.RUN_OFF_REASON, bo.getRunOffReason())
.set(STORE_SIGN.RUN_OFF_DATE, LocalDate.now())
.set(STORE_SIGN.RUN_OFF_DATE, now())
.where(STORE_SIGN.ID.eq(bo.getId())).update();
}

View File

@ -38,7 +38,7 @@
<commons-IO.version>2.13.0</commons-IO.version>
<joda.time.version>2.12.5</joda.time.version>
<fastjson.version>2.0.38</fastjson.version>
<mybatis-flex.version>1.7.2</mybatis-flex.version>
<mybatis-flex.version>1.7.5</mybatis-flex.version>
<easyexcel.version>3.3.2</easyexcel.version>
<commons-compress.version>1.21</commons-compress.version>
<jjwt.version>0.9.1</jjwt.version>