diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStoreActiveDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStoreActiveDto.java new file mode 100644 index 0000000..df9c777 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStoreActiveDto.java @@ -0,0 +1,44 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-04-12 11:41 + */ +@Data +@Accessors(chain = true) +public class CloudStoreActiveDto { + + /** + * 云品牌id + */ + @SerializedName("brandId") + private String brandCloudId; + + /** + * 品牌名 + */ + private String brandName; + + /** + * 云校区id + */ + @SerializedName("storeId") + private String storeCloudId; + + /** + * 校区名 + */ + private String storeName; + + /** + * 活跃数 + */ + @SerializedName("logNum") + private Integer activeNum; +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStoreHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStoreHandler.java index 3f415ab..5cf5c8a 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStoreHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStoreHandler.java @@ -2,6 +2,7 @@ package com.cpop.api.cloudDb.handler; import com.alibaba.fastjson.JSONObject; import com.cpop.api.cloudDb.core.constant.CloudDbUrl; +import com.cpop.api.cloudDb.core.dto.CloudStoreActiveDto; import com.cpop.api.cloudDb.core.dto.CloudStoreDto; import com.cpop.common.utils.StringUtils; import com.cpop.core.base.exception.UtilException; @@ -9,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; +import java.util.List; + /** * 云校区工具类 * @author DB @@ -54,4 +57,27 @@ public class CloudStoreHandler { } } } + + /** + * 获取校区活跃数据 + * + * @param date 查询日期 + * @return List + * @author DB + * @since 2024/4/12 + */ + public List getStoreActiveData(String date) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "storeLogNum"); + jsonBody.put("logDate", date); + JSONObject jsonObject = restTemplate.postForObject(CloudDbUrl.COMMON_USE_URL, jsonBody, JSONObject.class); + if (jsonObject != null) { + if (!jsonObject.getBoolean("success")) { + throw new UtilException(jsonObject.getString("error")); + } + return jsonObject.getJSONArray("data").toJavaList(CloudStoreActiveDto.class); + } else { + throw new UtilException("获取云校区活跃数据失败"); + } + } } diff --git a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java index 8276257..cfc90dd 100644 --- a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java +++ b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java @@ -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_"; /** * 主入口 diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/StoreActive.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/StoreActive.java new file mode 100644 index 0000000..b72ba15 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/StoreActive.java @@ -0,0 +1,68 @@ +package com.cpop.jambox.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.sql.Date; +import java.time.LocalDate; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 校区活跃数表 实体类。 + * + * @author DB + * @since 2024-04-12 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_j_store_active", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class StoreActive extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 品牌名 + */ + private String brandName; + + /** + * 品牌云id + */ + private String brandCloudId; + + /** + * 校区名 + */ + private String storeName; + + /** + * 校区云id + */ + private String storeCloudId; + + /** + * 日期 + */ + private LocalDate activeDate; + + /** + * 活跃数 + */ + private Integer activeNum; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/StoreActiveMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/StoreActiveMapper.java new file mode 100644 index 0000000..f8c09e1 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/StoreActiveMapper.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.jambox.business.entity.StoreActive; + +/** + * 校区活跃数表 映射层。 + * + * @author DB + * @since 2024-04-12 + */ +public interface StoreActiveMapper extends BaseMapper { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/StoreActiveService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/StoreActiveService.java new file mode 100644 index 0000000..b3f6a1b --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/StoreActiveService.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.jambox.business.entity.StoreActive; + +/** + * 校区活跃数表 服务层。 + * + * @author DB + * @since 2024-04-12 + */ +public interface StoreActiveService extends IService { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/StoreActiveServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/StoreActiveServiceImpl.java new file mode 100644 index 0000000..53885a0 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/StoreActiveServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.jambox.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.jambox.business.entity.StoreActive; +import com.cpop.jambox.business.mapper.StoreActiveMapper; +import com.cpop.jambox.business.service.StoreActiveService; +import org.springframework.stereotype.Service; + +/** + * 校区活跃数表 服务层实现。 + * + * @author DB + * @since 2024-04-12 + */ +@Service("storeActiveService") +public class StoreActiveServiceImpl extends ServiceImpl implements StoreActiveService { + +} diff --git a/Cpop-Jambox/src/main/resources/mapper/StoreActiveMapper.xml b/Cpop-Jambox/src/main/resources/mapper/StoreActiveMapper.xml new file mode 100644 index 0000000..de7f662 --- /dev/null +++ b/Cpop-Jambox/src/main/resources/mapper/StoreActiveMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml index 22a514f..8db2430 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml @@ -4,7 +4,7 @@ cpop: profile: E:/Cpop/uploadPath jwt: #白名单 - whiteList: /websocket/*,/login,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/sysCommon/miniSyncBrandAndStore,/easyLearn/callback/*/*,/easyLearn/*,/mini/cardTemplate/*,/website/**,/backstage/wxCp/*,/callback/wxCp/*/registerCode,/callback/easyLearn/**,/cloudCallback/* + whiteList: /websocket/*,/login,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/sysCommon/miniSyncBrandAndStore,/easyLearn/callback/*/*,/easyLearn/*,/mini/cardTemplate/*,/website/**,/backstage/wxCp/*,/callback/wxCp/*/registerCode,/callback/easyLearn/**,/cloudCallback/*,/mini/summit/* gateway: rsa-keypair: # 公钥文件 diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml index 2f33f31..e4c9990 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml @@ -4,7 +4,7 @@ cpop: profile: /root/cpop-union/cpop-oam/upload jwt: #白名单 - whiteList: /websocket/*,/login,/backstage/wxOpen/**,/sysCommon/miniSyncBrandAndStore,/easyLearn/callback/*/*,/easyLearn/*,/mini/cardTemplate/*,/website/**,/backstage/wxCp/*,/callback/wxCp/*/registerCode,/callback/easyLearn/**,/mini/sysCommon/miniSyncBrandAndStore + whiteList: /websocket/*,/login,/backstage/wxOpen/**,/sysCommon/miniSyncBrandAndStore,/easyLearn/callback/*/*,/easyLearn/*,/mini/cardTemplate/*,/website/**,/backstage/wxCp/*,/callback/wxCp/*/registerCode,/callback/easyLearn/**,/mini/sysCommon/miniSyncBrandAndStore,/mini/summit/* #拦截 gateway: rsa-keypair: diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml index 8d0feae..91e190c 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml @@ -4,7 +4,7 @@ cpop: profile: /root/cpop-union/cpop-mall/upload jwt: #白名单 - whiteList: /websocket/*,/login,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/sysCommon/miniSyncBrandAndStore,/easyLearn/callback/*/*,/easyLearn/*,/mini/cardTemplate/*,/website/**,/backstage/wxCp/*,/callback/wxCp/*/registerCode,/callback/easyLearn/** + whiteList: /websocket/*,/login,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/sysCommon/miniSyncBrandAndStore,/easyLearn/callback/*/*,/easyLearn/*,/mini/cardTemplate/*,/website/**,/backstage/wxCp/*,/callback/wxCp/*/registerCode,/callback/easyLearn/**,/mini/summit/* #拦截 gateway: rsa-keypair: diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopDataSyncTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopDataSyncTests.java index bcc7e22..b3b3f3a 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopDataSyncTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopDataSyncTests.java @@ -1,16 +1,13 @@ package com.cpop.oam.web; import com.alibaba.fastjson.JSONArray; +import com.cpop.api.cloudDb.core.dto.CloudStoreActiveDto; +import com.cpop.api.cloudDb.handler.CloudStoreHandler; import com.cpop.common.utils.StringUtils; +import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.jambox.business.entity.BrandExtend; -import com.cpop.jambox.business.entity.CardTemplate; -import com.cpop.jambox.business.entity.CardTemplateExtend; -import com.cpop.jambox.business.entity.StoreExtend; -import com.cpop.jambox.business.service.BrandExtendService; -import com.cpop.jambox.business.service.CardTemplateExtendService; -import com.cpop.jambox.business.service.CardTemplateService; -import com.cpop.jambox.business.service.StoreExtendService; +import com.cpop.jambox.business.entity.*; +import com.cpop.jambox.business.service.*; import com.cpop.oam.business.entity.Clue; import com.cpop.oam.business.entity.Task; import com.cpop.oam.business.entity.TaskWorkOrder; @@ -35,6 +32,7 @@ import com.mybatisflex.core.update.UpdateChain; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; +import org.springframework.transaction.annotation.Transactional; import java.time.Duration; import java.time.LocalDate; @@ -390,4 +388,25 @@ public class CpopDataSyncTests { SpringUtils.getBean(ClueService.class).saveBatch(clues); } + /** + * 导入校区活跃数 + * @author DB + * @since 2024/4/12 + */ + @Test + @Transactional(rollbackFor = Exception.class) + public void importStoreActiveData(){ + LocalDate localDate = LocalDate.of(2024, 4, 4); + for (int i = 0; i < 8; i++) { + LocalDate date = localDate.plusDays(i); + List storeActiveData = SpringUtils.getBean(CloudStoreHandler.class).getStoreActiveData(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + List storeActives = BeanUtils.mapToList(storeActiveData, StoreActive.class); + if (!storeActives.isEmpty()) { + storeActives.forEach(item -> { + item.setActiveDate(date); + }); + SpringUtils.getBean(StoreActiveService.class).saveBatch(storeActives); + } + } + } } diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnDataAnalyseTest.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnDataAnalyseTest.java index aefd162..96c378e 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnDataAnalyseTest.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnDataAnalyseTest.java @@ -51,8 +51,8 @@ public class CpopEasyLearnDataAnalyseTest{ .select("out_order_no") .select("create_time") .from("j_wx_pay_profit_sharing") - .where("create_time >= ?", "2024-03-24 00:00:00") - //.between("create_time", "2023-10-23 00:00:00","2023-11-13 22:00:00") + .where("create_time >= ?", "2024-04-08 19:00:00") + //.between("create_time", "2023-04-23 00:00:00","2023-11-13 22:00:00") .list(); List insertList = new ArrayList<>(); list.forEach(item->{ diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/SummitApplyBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/SummitApplyBo.java new file mode 100644 index 0000000..a1b2f15 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/SummitApplyBo.java @@ -0,0 +1,106 @@ +package com.cpop.oam.business.bo; + +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.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-04-10 14:41 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "峰会报名请求参数") +public class SummitApplyBo { + + /** + * 微信openId + */ + @NotBlank(message = "微信openId不能为空") + @ApiModelProperty(value = "微信openId",required = true) + private String openId; + + /** + * 机构名称 + */ + @NotBlank(message = "机构名称不能为空") + @ApiModelProperty(value = "机构名称",required = true) + private String storeName; + + /** + * 牌匾号 + */ + @NotBlank(message = "牌匾号不能为空") + @ApiModelProperty(value = "牌匾号",required = true) + private String boardName; + + /** + * 是否是会员 + */ + @ApiModelProperty(value = "是否是会员") + private String isMember = "是"; + + /** + * 参会人数 + */ + @NotNull(message = "参会人数不能为空") + @ApiModelProperty(value = "参会人数") + private Integer joinNum; + + /** + * 参会人员 + */ + @NotEmpty(message = "参会人员不能为空") + @ApiModelProperty(value = "参会人员",required = true) + private List users; + + /** + * 房间数 + */ + @ApiModelProperty(value = "房间数") + private Integer roomNum; + + /** + * 需要房间 + */ + @ApiModelProperty(value = "需要房间") + private String needRoom = "是"; + + /** + * 参加晚宴 + */ + @ApiModelProperty(value = "参加晚宴") + private String joinParty = "是"; + + /** + * 参加交流会 + */ + @ApiModelProperty(value = "参加交流会") + private String joinMeeting = "是"; + + @Data + @ApiModel("参会人员信息") + public static class JoinUser { + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空") + @ApiModelProperty(value = "姓名",required = true) + private String name; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空") + @ApiModelProperty(value = "手机号",required = true) + private String phone; + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/mini/MiniSummitController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/mini/MiniSummitController.java new file mode 100644 index 0000000..f83f650 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/mini/MiniSummitController.java @@ -0,0 +1,157 @@ +package com.cpop.oam.business.controller.mini; + +import cn.binarywang.wx.miniapp.api.WxMaQrcodeService; +import cn.binarywang.wx.miniapp.api.WxMaService; +import com.alibaba.excel.EasyExcel; +import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; +import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.R; +import com.cpop.core.base.exception.ServiceException; +import com.cpop.core.handler.TencentCosHandler; +import com.cpop.core.utils.SpringUtils; +import com.cpop.core.utils.file.FileUtils; +import com.cpop.oam.business.bo.SummitApplyBo; +import com.cpop.oam.business.dto.SummitApplyDto; +import com.cpop.oam.business.entity.SummitApply; +import com.cpop.oam.business.entity.SummitApplyUser; +import com.cpop.oam.business.service.SummitApplyService; +import com.cpop.oam.business.service.SummitApplyUserService; +import com.cpop.oam.framework.constant.WebHookKeyConstant; +import com.mybatisflex.core.query.QueryWrapper; +import com.qcloud.cos.model.UploadResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxErrorException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.*; +import java.util.stream.Collectors; + +import static com.cpop.oam.business.entity.table.SummitApplyTableDef.SUMMIT_APPLY; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-04-10 14:33 + */ +@RestController +@Api(tags = "小程序峰会接口") +@RequestMapping("/mini/summit") +@Slf4j +public class MiniSummitController { + + @Autowired + private SummitApplyService summitApplyService; + + @Autowired + private SummitApplyUserService summitApplyUserService; + + /** + * 获取峰会二维码 + * @author DB + * @since 2023/12/07 + */ + @ApiOperation("获取峰会二维码") + @GetMapping("/getSummitQrCode") + @Deprecated + public R getSummitQrCode() throws WxErrorException, IOException { + WxMaQrcodeService qrcodeService = SpringUtils.getBean(WxMaService.class).getQrcodeService(); + //"release" + File qrCode = qrcodeService.createWxaCodeUnlimit("100", "pages/pay/pay", false, "trial", 430, + true, null, false); + MultipartFile multipartFile = FileUtils.getInstance().getMultipartFile(qrCode); + TencentCosHandler tencentCosHandler = SpringUtils.getBean(TencentCosHandler.class); + UploadResult uploadResult = tencentCosHandler.cdnUpload(multipartFile); + return R.ok("https://" + uploadResult.getBucketName() + tencentCosHandler.getCdnUrl() + uploadResult.getKey()); + } + + /** + * 是否已报名 + * @author DB + * @since 2024/4/10 + * @param openId openId + * @return R + */ + @ApiOperation("是否已报名") + @GetMapping("/haveSummitApply") + public R haveSummitApply(@RequestParam @ApiParam("openId") String openId) { + long count = summitApplyService.count(QueryWrapper.create().where(SUMMIT_APPLY.OPEN_ID.eq(openId))); + return R.ok(count > 0); + } + + /** + * 峰会报名 + * @author DB + * @since 2024/4/10 + * @param bo 请求参数 + * @return R + */ + @ApiOperation("峰会报名") + @PostMapping("/summitApply") + @Transactional(rollbackFor = Exception.class) + public R summitApply(@RequestBody @Validated SummitApplyBo bo) { + long count = summitApplyService.count(QueryWrapper.create().where(SUMMIT_APPLY.OPEN_ID.eq(bo.getOpenId()))); + if (count > 0) { + throw new ServiceException("您已报名,请勿重复提交!"); + } + SummitApply summitApply = BeanUtils.mapToClass(bo, SummitApply.class); + summitApplyService.save(summitApply); + List summitApplyUsers = BeanUtils.mapToList(bo.getUsers(), SummitApplyUser.class); + summitApplyUsers.forEach(item->{ + item.setSummitApplyId(summitApply.getId()); + }); + summitApplyUserService.saveBatch(summitApplyUsers); + // 企微通知值班人员 + List phoneList = new ArrayList(); + try { + SpringUtils.getBean(WebHookSendHandler.class) + .webHookSendText(WebHookKeyConstant.MARKET_BOT, + phoneList, + "==========2024峰会报名==========\n" + + "机构" + bo.getStoreName() + "报名成功", + true); + } catch (IOException e) { + throw new ServiceException("发送消息通知失败!"); + } + return R.ok(); + } + + /** + * 导出峰会申请 + * @author DB + * @since 2024/4/10 + * @param response 响应流 + */ + @ApiOperation(value = "导出峰会申请", notes = "export", produces = "application/octet-stream") + @GetMapping("/exportSummitApply") + public void exportSummitApply(HttpServletResponse response) throws IOException { + // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + // 这里URLEncoder.encode可以防止中文乱码 当然和easyExcel没有关系 + String fileName = URLEncoder.encode("峰会报名数据", "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-disposition", "attachment;filename*=" + fileName + ".xlsx"); + //获取峰会数据 + Map summitApplyMap = summitApplyService.list().stream().collect(Collectors.toMap(SummitApply::getId, item -> item)); + List summitApplyDtos = summitApplyUserService.listAs(QueryWrapper.create(), SummitApplyDto.class); + Map> summitApplyDtoMap = summitApplyDtos.stream().collect(Collectors.groupingBy(SummitApplyDto::getSummitApplyId)); + summitApplyDtoMap.forEach((key, value) -> { + SummitApply summitApply = summitApplyMap.get(key); + value.forEach(item -> { + BeanUtils.copyBeanProp(item, summitApply); + }); + }); + EasyExcel.write(response.getOutputStream(), SummitApplyDto.class).sheet("报名信息").doWrite(summitApplyDtos); + } + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/SummitApplyDto.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/SummitApplyDto.java new file mode 100644 index 0000000..882fd41 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/SummitApplyDto.java @@ -0,0 +1,81 @@ +package com.cpop.oam.business.dto; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ContentLoopMerge; +import lombok.Data; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-04-10 15:08 + */ +@Data +public class SummitApplyDto { + + /** + * 机构名称 + */ + @ExcelProperty("机构名称") + private String storeName; + + /** + * 牌匾号 + */ + @ExcelProperty("牌匾号") + private String boardName; + + /** + * 是否是会员 + */ + @ExcelProperty("是否是会员") + private String isMember; + + /** + * 参会人数 + */ + @ExcelProperty("参会人数") + private Integer joinNum; + + /** + * 姓名 + */ + @ExcelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @ExcelProperty("手机号") + private String phone; + + /** + * 房间数 + */ + @ExcelProperty("房间数") + private Integer roomNum; + + /** + * 需要房间 + */ + @ExcelProperty("需要房间") + private String needRoom; + + /** + * 参加晚宴 + */ + @ExcelProperty("参加晚宴") + private String joinParty; + + /** + * 参加交流会 + */ + @ExcelProperty("参加交流会") + private String joinMeeting; + + /** + * 申请字段 + */ + @ExcelIgnore + private String summitApplyId; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SummitApply.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SummitApply.java new file mode 100644 index 0000000..7c0ed40 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SummitApply.java @@ -0,0 +1,93 @@ +package com.cpop.oam.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 峰会报名表 实体类。 + * + * @author DB + * @since 2024-04-10 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_summit_apply", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class SummitApply extends BaseEntity implements Serializable { + + /** + * 报名id + */ + @Id + private String id; + + /** + * openId + */ + @Id + private String openId; + + /** + * 机构名称 + */ + private String storeName; + + /** + * 牌匾号 + */ + private String boardName; + + /** + * 是否是会员 + */ + private String isMember; + + /** + * 参会人数 + */ + private Integer joinNum; + + /** + * 房间数 + */ + private Integer roomNum; + + /** + * 需要房间 + */ + private String needRoom; + + /** + * 参加晚宴 + */ + private String joinParty; + + /** + * 参加交流会 + */ + private String joinMeeting; + + + + + + /** + * 逻辑删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SummitApplyUser.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SummitApplyUser.java new file mode 100644 index 0000000..142ef0e --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SummitApplyUser.java @@ -0,0 +1,60 @@ +package com.cpop.oam.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 峰会参加人员 实体类。 + * + * @author DB + * @since 2024-04-10 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_summit_apply_user", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class SummitApplyUser extends BaseEntity implements Serializable { + + @Id + private String id; + + /** + * 峰会报名id + */ + @Id + private String summitApplyId; + + /** + * 姓名 + */ + private String name; + + /** + * 手机号 + */ + private String phone; + + + + + + /** + * 逻辑删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/SummitApplyMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/SummitApplyMapper.java new file mode 100644 index 0000000..0575844 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/SummitApplyMapper.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.oam.business.entity.SummitApply; + +/** + * 峰会报名表 映射层。 + * + * @author DB + * @since 2024-04-10 + */ +public interface SummitApplyMapper extends BaseMapper { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/SummitApplyUserMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/SummitApplyUserMapper.java new file mode 100644 index 0000000..a82ebf4 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/SummitApplyUserMapper.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.oam.business.entity.SummitApplyUser; + +/** + * 峰会参加人员 映射层。 + * + * @author DB + * @since 2024-04-10 + */ +public interface SummitApplyUserMapper extends BaseMapper { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/SummitApplyService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/SummitApplyService.java new file mode 100644 index 0000000..fc668a6 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/SummitApplyService.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.oam.business.entity.SummitApply; + +/** + * 峰会报名表 服务层。 + * + * @author DB + * @since 2024-04-10 + */ +public interface SummitApplyService extends IService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/SummitApplyUserService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/SummitApplyUserService.java new file mode 100644 index 0000000..d767c1c --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/SummitApplyUserService.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.oam.business.entity.SummitApplyUser; + +/** + * 峰会参加人员 服务层。 + * + * @author DB + * @since 2024-04-10 + */ +public interface SummitApplyUserService extends IService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java index e31ffc8..370e850 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java @@ -13,7 +13,6 @@ import com.cpop.oam.business.bo.ClueFollowUpBo; import com.cpop.oam.business.bo.CluePutOffBo; import com.cpop.oam.business.bo.ClueUpdateBo; import com.cpop.oam.business.entity.*; -import com.cpop.oam.business.mapper.CluePutOffMapper; import com.cpop.oam.business.service.*; import com.cpop.oam.business.vo.*; import com.cpop.oam.framework.constant.OamRedisConstant; @@ -465,11 +464,13 @@ public class ClueServiceImpl extends ServiceImpl implements Cl .select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID,CLUE.LAST_RECEIPT_TIME,CLUE.LAST_RECEIPT_STAFF_ID) .select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE) .select(BRAND.BRAND_NAME) + .select(STORE_SIGN.EXPIRE_DATE,STORE_SIGN.CREATE_TIME.as(CluePageVo::getStoreSignTime)) // 跟进间隔 .select(dateDiff(now(), CLUE.LAST_FOLLOW_UP_TIME).as(CluePageVo::getFollowUpInterval)) .from(CLUE) .leftJoin(STORE).on(STORE.ID.eq(CLUE.STORE_ID)) .leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID)) + .leftJoin(STORE_SIGN).on(STORE_SIGN.STORE_ID.eq(STORE.ID)) //地区 .and(CLUE.CITY.in(cityList)) .and(CLUE.CITY.eq(city)) @@ -527,7 +528,7 @@ public class ClueServiceImpl extends ServiceImpl implements Cl public Page getPublicCluePage(String city, String brandId, String storeId, String chargeOrPhone) { PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); QueryWrapper queryWrapper = QueryWrapper.create(); - int year = LocalDate.now().getYear(); + /*int year = LocalDate.now().getYear(); List cityList = SpringUtils.getBean(SignAreaService.class).queryChain() .select(distinct(SIGN_AREA.CITY)) .leftJoin(SIGN_GOAL).on(SIGN_GOAL.ID.eq(SIGN_AREA.SIGN_GOAL_ID)) @@ -538,18 +539,20 @@ public class ClueServiceImpl extends ServiceImpl implements Cl } if (!StringUtils.equals("其他", city)) { queryWrapper.and(CLUE.CITY.eq(city)); - } + }*/ return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()), queryWrapper .select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID,CLUE.LAST_RECEIPT_TIME,CLUE.LAST_RECEIPT_STAFF_ID) .select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE) .select(BRAND.BRAND_NAME) + .select(STORE_SIGN.EXPIRE_DATE,STORE_SIGN.CREATE_TIME.as(CluePageVo::getStoreSignTime)) // 跟进间隔 .select(dateDiff(now(), CLUE.LAST_FOLLOW_UP_TIME).as(CluePageVo::getFollowUpInterval)) .from(CLUE) .leftJoin(STORE).on(STORE.ID.eq(CLUE.STORE_ID)) .leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID)) + .leftJoin(STORE_SIGN).on(STORE_SIGN.STORE_ID.eq(STORE.ID)) //地区 - .and(CLUE.CITY.notIn(cityList)) + //.and(CLUE.CITY.notIn(cityList)) //品牌 .and(BRAND.ID.eq(brandId)) //校区 diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SummitApplyServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SummitApplyServiceImpl.java new file mode 100644 index 0000000..fa0287a --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SummitApplyServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.oam.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.oam.business.entity.SummitApply; +import com.cpop.oam.business.mapper.SummitApplyMapper; +import com.cpop.oam.business.service.SummitApplyService; +import org.springframework.stereotype.Service; + +/** + * 峰会报名表 服务层实现。 + * + * @author DB + * @since 2024-04-10 + */ +@Service("summitApplyService") +public class SummitApplyServiceImpl extends ServiceImpl implements SummitApplyService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SummitApplyUserServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SummitApplyUserServiceImpl.java new file mode 100644 index 0000000..0b53c06 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SummitApplyUserServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.oam.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.oam.business.entity.SummitApplyUser; +import com.cpop.oam.business.mapper.SummitApplyUserMapper; +import com.cpop.oam.business.service.SummitApplyUserService; +import org.springframework.stereotype.Service; + +/** + * 峰会参加人员 服务层实现。 + * + * @author DB + * @since 2024-04-10 + */ +@Service("summitApplyUserService") +public class SummitApplyUserServiceImpl extends ServiceImpl implements SummitApplyUserService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java index 5f5a2af..2e1110c 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java @@ -1,5 +1,7 @@ package com.cpop.oam.framework.tasks; +import com.cpop.api.cloudDb.core.dto.CloudStoreActiveDto; +import com.cpop.api.cloudDb.handler.CloudStoreHandler; import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; @@ -8,6 +10,8 @@ import com.cpop.core.base.table.SysConfig; import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; import com.cpop.core.utils.SpringUtils; +import com.cpop.jambox.business.entity.StoreActive; +import com.cpop.jambox.business.service.StoreActiveService; import com.cpop.oam.business.entity.Clue; import com.cpop.oam.business.entity.ClueRecord; import com.cpop.oam.business.entity.DataImport; @@ -32,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional; import java.io.IOException; import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; @@ -259,4 +264,23 @@ public class OamScheduledTasks { }); } } + + /** + * 每天晚上1点40或前天校区活跃数 + * @author DB + * @since 2024/4/12 + */ + @Scheduled(cron = "0 40 1 * * *") + public void getStoreActivityData(){ + LocalDate date = LocalDate.now().minusDays(1); + List storeActiveData = SpringUtils.getBean(CloudStoreHandler.class).getStoreActiveData(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + List storeActives = BeanUtils.mapToList(storeActiveData, StoreActive.class); + if (!storeActives.isEmpty()){ + storeActives.forEach(item->{ + item.setActiveDate(date); + }); + SpringUtils.getBean(StoreActiveService.class).saveBatch(storeActives); + } + + } } diff --git a/Cpop-Oam/src/main/resources/mapper/SummitApplyMapper.xml b/Cpop-Oam/src/main/resources/mapper/SummitApplyMapper.xml new file mode 100644 index 0000000..5269d3d --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/SummitApplyMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Oam/src/main/resources/mapper/SummitApplyUserMapper.xml b/Cpop-Oam/src/main/resources/mapper/SummitApplyUserMapper.xml new file mode 100644 index 0000000..f5574b7 --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/SummitApplyUserMapper.xml @@ -0,0 +1,7 @@ + + + + +