提交 8a07f30e authored 作者: 000516's avatar 000516 提交者: Coding

发版v0.1.0 - 小程序基本功能上线

一、发版功能 1. 促销员注册 2. 促销员登录(自动/手动登录) 3. 个人信息查看 4. 每日打卡任务 5. 销量上报、图片上报 6. 任务记录列表查询 7. 任务记录详情 8. 提交审批 9. 当日数据查看 10. 发送手机号-验证码 11. 勤策 - 同步部门、员工、终端 二、TODO 功能 时间段限制关闭:上班卡、午休下班卡、午休上班卡、下班卡
......@@ -31,6 +31,7 @@ build/
!**/src/main/**/build/
!**/src/test/**/build/
/logs/**
/LOG_PATH_IS_UNDEFINED
### VS Code ###
.vscode/
......@@ -122,6 +122,68 @@
<version>1.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.64</version>
</dependency>
<!-- 微信小程序 SDK 依赖 -->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
<version>4.6.0</version>
</dependency>
<!-- 腾讯云服务 -->
<!-- 请到https://search.maven.org/search?q=tencentcloud-sdk-java查询所有版本,最新版本如下 -->
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java-sms</artifactId>
<version>3.1.998</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2021.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba.cloud/spring-cloud-starter-alibaba-nacos-config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>2021.1</version>
</dependency>
<!--解决SpringCloud项目无法读取bootstrap.yaml配置文件-->
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-bootstrap -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>
<build>
......
......@@ -3,8 +3,11 @@ package com.wangxiaolu.promotion;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
@EnableAsync
@EnableConfigurationProperties
@EnableAspectJAutoProxy
@SpringBootApplication
......
package com.wangxiaolu.promotion.common.redis;
import lombok.AllArgsConstructor;
import lombok.Getter;
public interface RedisKeys {
@AllArgsConstructor
@Getter
enum UserKeys {
/**
* 用户接收手机验证码
*/
PHONE_VER_CODE("user:phone_code:phone_"),
/**
* 用户登录信息:token
*/
TEMPORARY_TOKEN("user:login_token:temporary:"),
;
String key;
}
}
package com.wangxiaolu.promotion.common.redis.service;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
@Component
public class RedisCache {
@Autowired
RedisTemplate<String, String> redisTemplate;
/**
* 保存一个值
*/
public void add(String key, String val) {
ValueOperations<String, String> vo = redisTemplate.opsForValue();
vo.set(key, val);
}
/**
* 保存一个值,设置过期时间(分钟)
*/
public void addToMinute(String key, String val, long time) {
ValueOperations<String, String> vo = redisTemplate.opsForValue();
vo.set(key, val, time, TimeUnit.MINUTES);
}
/**
* 保存一个值,并将val json化
*/
public void addToJson(String key, Object val) {
ValueOperations<String, String> vo = redisTemplate.opsForValue();
vo.set(key, valToJson(val));
}
/**
* 保存一个值,并将val json化,设置过期时间(分钟)
*/
public void addToJsonToMinute(String key, Object val, long time) {
ValueOperations<String, String> vo = redisTemplate.opsForValue();
vo.set(key, valToJson(val), time, TimeUnit.MINUTES);
}
/**
* 保存一个值,并将val json化,设置过期时间(天)
*/
public void addToJsonToDays(String key, Object val, long days) {
ValueOperations<String, String> vo = redisTemplate.opsForValue();
vo.set(key, valToJson(val), days, TimeUnit.DAYS);
}
/**
* 获取一个值
*/
public String get(String key) {
ValueOperations<String, String> vo = redisTemplate.opsForValue();
return vo.get(key);
}
/**
* 获取一个值,并将val json化
*/
public JSONObject getToJson(String key) {
ValueOperations<String, String> vo = redisTemplate.opsForValue();
String val = vo.get(key);
return JSONObject.parseObject(val);
}
/**
* 获取一个值,并将val json化
*/
// public JSONObject getUserJsonInfo(String authorization) {
// JSONObject userDetail = getToJson(RedisKeys.UserKeys.TOKEN.getKey() + authorization);
// return userDetail;
// }
public void removeKey(String key) {
redisTemplate.delete(key);
}
private String valToJson(Object o) {
return JSONObject.toJSONString(o);
}
}
package com.wangxiaolu.promotion.config.mysql;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author : liqiulin
* @date : 2024-04-25 13
* @describe :
*/
@Configuration
@EnableTransactionManagement
//@MapperScan( { "com.wangxiaolu.promotion.domain" })
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return mybatisPlusInterceptor;
}
}
package com.wangxiaolu.promotion.config.weixin;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage;
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import cn.binarywang.wx.miniapp.message.WxMaMessageHandler;
import cn.binarywang.wx.miniapp.message.WxMaMessageRouter;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.error.WxRuntimeException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.File;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
@Slf4j
@Configuration
@EnableConfigurationProperties(WxMaProperties.class)
public class WxMaConfiguration {
private final WxMaProperties properties;
@Autowired
public WxMaConfiguration(WxMaProperties properties) {
this.properties = properties;
}
@Bean
public WxMaService wxMaService() {
List<WxMaProperties.Config> configs = this.properties.getConfigs();
if (configs == null) {
throw new WxRuntimeException("微信相关配置错误");
}
WxMaService maService = new WxMaServiceImpl();
maService.setMultiConfigs(
configs.stream()
.map(a -> {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
// WxMaDefaultConfigImpl config = new WxMaRedisConfigImpl(new JedisPool());
// 使用上面的配置时,需要同时引入jedis-lock的依赖,否则会报类无法找到的异常
config.setAppid(a.getAppid());
config.setSecret(a.getSecret());
config.setToken(a.getToken());
config.setAesKey(a.getAesKey());
config.setMsgDataFormat(a.getMsgDataFormat());
return config;
}).collect(Collectors.toMap(WxMaDefaultConfigImpl::getAppid, a -> a, (o, n) -> o)));
return maService;
}
@Bean
public WxMaMessageRouter wxMaMessageRouter(WxMaService wxMaService) {
final WxMaMessageRouter router = new WxMaMessageRouter(wxMaService);
router
.rule().handler(logHandler).next()
.rule().async(false).content("订阅消息").handler(subscribeMsgHandler).end()
.rule().async(false).content("文本").handler(textHandler).end()
.rule().async(false).content("图片").handler(picHandler).end()
.rule().async(false).content("二维码").handler(qrcodeHandler).end();
return router;
}
private final WxMaMessageHandler subscribeMsgHandler = (wxMessage, context, service, sessionManager) -> {
service.getMsgService().sendSubscribeMsg(WxMaSubscribeMessage.builder()
.templateId("此处更换为自己的模板id")
.data(Lists.newArrayList(
new WxMaSubscribeMessage.MsgData("keyword1", "339208499")))
.toUser(wxMessage.getFromUser())
.build());
return null;
};
private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> {
log.info("收到消息:" + wxMessage.toString());
service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson())
.toUser(wxMessage.getFromUser()).build());
return null;
};
private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) -> {
service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息")
.toUser(wxMessage.getFromUser()).build());
return null;
};
private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> {
try {
WxMediaUploadResult uploadResult = service.getMediaService()
.uploadMedia("image", "png",
ClassLoader.getSystemResourceAsStream("tmp.png"));
service.getMsgService().sendKefuMsg(
WxMaKefuMessage
.newImageBuilder()
.mediaId(uploadResult.getMediaId())
.toUser(wxMessage.getFromUser())
.build());
} catch (WxErrorException e) {
e.printStackTrace();
}
return null;
};
private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> {
try {
final File file = service.getQrcodeService().createQrcode("123", 430);
WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file);
service.getMsgService().sendKefuMsg(
WxMaKefuMessage
.newImageBuilder()
.mediaId(uploadResult.getMediaId())
.toUser(wxMessage.getFromUser())
.build());
} catch (WxErrorException e) {
e.printStackTrace();
}
return null;
};
}
package com.wangxiaolu.promotion.config.weixin;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
@Data
@ConfigurationProperties(prefix = "wx.miniapp")
public class WxMaProperties {
private List<Config> configs;
@Data
public static class Config {
/**
* 设置微信小程序的appid
*/
private String appid;
/**
* 设置微信小程序的Secret
*/
private String secret;
/**
* 设置微信小程序消息服务器配置的token
*/
private String token;
/**
* 设置微信小程序消息服务器配置的EncodingAESKey
*/
private String aesKey;
/**
* 消息格式,XML或者JSON
*/
private String msgDataFormat;
}
}
package com.wangxiaolu.promotion.controller.activity.temporary;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityClockQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
/**
* @author : liqiulin
* @date : 2024-04-23 18
* @describe : 打卡信息查询
*/
@Slf4j
@RestController
@RequestMapping("/temporary/clock/query")
public class TemporaryActivityClockQueryController {
@Autowired
TemporaryActivityClockQueryService temporaryActivityClockQueryService;
/**
* 根据促销员id查询今日打卡信息
*/
@GetMapping("/{temporary_id}")
public TemporaryClockDto findTodayTemporaryClockByTemId(@PathVariable("temporary_id") @NotNull Integer temporaryId) {
return temporaryActivityClockQueryService.findTodayTemporaryClockByTemId(temporaryId);
}
/**
* 根据促销员id查询指定日期打卡信息
* @param temporaryId 促销员id
* @param createDate 指定日期,格式:2024-04-25
* @return 打卡信息
*/
@GetMapping("/date")
public TemporaryClockDto findTemporaryClockByTemIdAndDate(Integer temporaryId, String createDate) {
return temporaryActivityClockQueryService.findTemporaryClockByTemIdAndDate(temporaryId, createDate);
}
}
package com.wangxiaolu.promotion.controller.activity.temporary;
import com.wangxiaolu.promotion.enums.activity.ClockType;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryActivityDataVo;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryClockVo;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityCoreService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-17 19
* @describe : 促销员活动上报、修改
*/
@Slf4j
@RestController
@RequestMapping("/activity/temporary/core")
public class TemporaryActivityCoreController {
@Autowired
private TemporaryActivityCoreService tempActivityCoreService;
/**
* 促销员当日打卡信息保存
*/
@PostMapping("/today/clock")
public void clockInTodayActivity(@RequestBody @Validated TemporaryClockVo clockVo) {
Integer clockType = clockVo.getClockType();
boolean isClockIn = ClockType.TEMPORARY_CLOCK_IN.equals(clockType);
// 上班卡必需有店铺id
if (isClockIn && StringUtils.isBlank(clockVo.getStoreQcId())) {
throw new ParamException(RCode.CLOCK_DETAIL_ERROR, null);
}
// 非上班卡必需有打卡记录ID
if (!isClockIn && Objects.isNull((clockVo.getId()))) {
throw new ParamException(RCode.CLOCK_DETAIL_ERROR, null);
}
Date clockTime = new Date();
TemporaryClockDto dto = new TemporaryClockDto(clockVo.getClockType(), clockVo.getId(), clockVo.getTemporaryId(), clockVo.getTemporaryName());
// 上班卡、午休下班卡、午休上班卡、下班卡
if (isClockIn) {
builderClockInData(clockVo, dto, clockTime);
} else if (ClockType.TEMPORARY_NOON_CLOCK_OUT.equals(clockType)) {
builderNoonClockOutData(clockVo, dto, clockTime);
} else if (ClockType.TEMPORARY_NOON_CLOCK_IN.equals(clockType)) {
builderNoonClockInData(clockVo, dto, clockTime);
} else if (ClockType.TEMPORARY_CLOCK_OUT.equals(clockType)) {
builderClockOutData(clockVo, dto, clockTime);
}
tempActivityCoreService.clockInTodayActivity(dto, clockType);
}
/**
* 促销员[今日活动]数据保存
* 返回活动生成id
*/
@PostMapping("/today/reported")
public Long todayActivityDataReported(@RequestBody @Validated TemporaryActivityDataVo activityVo) {
TemporaryActivityReportedDto temActDto = new TemporaryActivityReportedDto();
BeanUtils.copyProperties(activityVo, temActDto);
temActDto.setId(activityVo.getActivityReportedId());
// 有ID则修改,无ID则新建
if (Objects.nonNull(activityVo.getActivityReportedId())) {
tempActivityCoreService.activityDataReportedUpdate(temActDto);
return activityVo.getActivityReportedId();
}
return tempActivityCoreService.activityDataReportedSave(temActDto);
}
/**
* 促销员[今日活动]数据提交审批
* 修改审批状态
*/
@PutMapping("/reported/approve/submit/{id}")
public void activityReportedSubmit(@PathVariable("id") @NotNull Long id) {
tempActivityCoreService.activityReportedSubmit(id);
}
// 上班打卡
private void builderClockInData(TemporaryClockVo clockVo, TemporaryClockDto clockDto, Date dateTime) {
// todo if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_CLOCK_IN_BEGIN_TIME, ClockType.TEMPORARY_CLOCK_IN_END_TIME)) {
// throw new ParamException(RCode.CLOCK_DETAIL_TIME_ERROR, null);
// }
clockDto.setTemporaryId(clockVo.getTemporaryId())
.setTemporaryName(clockVo.getTemporaryName())
.setStoreQcId(clockVo.getStoreQcId())
.setStoreName(clockVo.getStoreName())
.setClockInAddress(clockVo.getClockAddress())
.setClockInCoordinates(clockVo.getClockCoordinates())
.setClockInPhoto(clockVo.getClockPhoto())
.setClockInTime(dateTime);
}
// 午休下班卡
private void builderNoonClockOutData(TemporaryClockVo clockVo, TemporaryClockDto clockDto, Date dateTime) {
// todo if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_NOON_CLOCK_OUT_BEGIN_TIME, ClockType.TEMPORARY_NOON_CLOCK_OUT_END_TIME)) {
// throw new ParamException(RCode.CLOCK_DETAIL_TIME_ERROR, null);
// }
clockDto.setId(clockVo.getId())
.setNoonClockOutAddress(clockVo.getClockAddress())
.setNoonClockOutCoordinates(clockVo.getClockCoordinates())
.setNoonClockOutPhoto(clockVo.getClockPhoto())
.setNoonClockOutTime(dateTime);
}
// 午休上班卡
private void builderNoonClockInData(TemporaryClockVo clockVo, TemporaryClockDto clockDto, Date dateTime) {
// todo if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_NOON_CLOCK_IN_BEGIN_TIME, ClockType.TEMPORARY_NOON_CLOCK_IN_END_TIME)) {
// throw new ParamException(RCode.CLOCK_DETAIL_TIME_ERROR, null);
// }
clockDto.setId(clockVo.getId())
.setNoonClockInAddress(clockVo.getClockAddress())
.setNoonClockInCoordinates(clockVo.getClockCoordinates())
.setNoonClockInPhoto(clockVo.getClockPhoto())
.setNoonClockInTime(dateTime);
}
// 下班卡
private void builderClockOutData(TemporaryClockVo clockVo, TemporaryClockDto clockDto, Date dateTime) {
// todo if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_CLOCK_OUT_BEGIN_TIME, ClockType.TEMPORARY_CLOCK_OUT_END_TIME)) {
// throw new ParamException(RCode.CLOCK_DETAIL_TIME_ERROR, null);
// }
clockDto.setId(clockVo.getId())
.setClockOutAddress(clockVo.getClockAddress())
.setClockOutCoordinates(clockVo.getClockCoordinates())
.setClockOutPhoto(clockVo.getClockPhoto())
.setClockOutTime(dateTime);
}
}
package com.wangxiaolu.promotion.controller.activity.temporary;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-18 13
* @describe : 促销员活动上报数据查询
*/
@Slf4j
@RestController
@RequestMapping("/activity/temporary/query")
public class TemporaryActivityQueryController {
@Autowired
TemporaryActivityQueryService temporaryActivityQueryService;
/**
* 根据促销员id查询所有任务
*
* @return 所有任务(分页查询)
*/
@PostMapping("/all/{id}")
public PageInfo findtemporaryIdActivityDataList(@PathVariable("id") @NotNull Integer temporaryId, @RequestBody PageInfo pageInfo) {
temporaryActivityQueryService.findtemporaryIdActivityDataList(temporaryId, pageInfo);
return pageInfo;
}
/**
* 根据促销员id查询今日任务
*/
@GetMapping("/today/{id}")
public TemporaryActivityReportedDto findTemporaryTodayActivityData(@PathVariable("id") @NotNull Integer temporaryId) {
TemporaryActivityReportedDto dto = temporaryActivityQueryService.findtemporaryIdTodayActivityData(temporaryId);
return dto;
}
/**
* 根据任务id查询
*/
@GetMapping("/{id}")
public TemporaryActivityReportedDto findTemporaryActivityById(@PathVariable("id") @NotNull Long activityId) {
TemporaryActivityReportedDto dto = temporaryActivityQueryService.findTemporaryActivityById(activityId);
return dto;
}
}
......@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
/**
* @author : liqiulin
* @date : 2024-03-28 17
* @describe :用户(销售)登录
* @describe :用户(销售)登录 暂未使用
*/
@RestController
......
package com.wangxiaolu.promotion.controller.user;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import com.wangxiaolu.promotion.pojo.user.vo.ClienteleStoreQueryVo;
import com.wangxiaolu.promotion.service.user.QinCeClienteleDataQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-22 17
* @describe : 【勤策 - 客户数据】查询
*/
@RestController
@RequestMapping("/user/clientele/query")
public class QinCeClienteleDataQueryController {
@Autowired
QinCeClienteleDataQueryService qinCeClienteleDataQueryService;
/**
* 【勤策 - 客户数据 - 终端】数据查询
* 模糊查询门店名称
*/
@PostMapping("/store/list")
public List<QinCeClienteleStoreDto> getStoreList(@RequestBody ClienteleStoreQueryVo storeQueryVo){
return qinCeClienteleDataQueryService.getStoreList(storeQueryVo);
}
}
......@@ -34,5 +34,13 @@ public class QinCeDataTaskController {
qinCeDataTaskService.employeeSyncTask();
}
/**
* 同步[终端数据]
*/
@GetMapping("/shops")
public void shopDetailAllTask(){
qinCeDataTaskService.shopDetailAllTask();
}
}
package com.wangxiaolu.promotion.controller.user;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.user.TencentCoreService;
import com.wangxiaolu.promotion.utils.DataUtils;
import com.wangxiaolu.promotion.utils.TencentUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author : liqiulin
* @date : 2024-05-15 15
* @describe :调用腾讯云短信
*/
@Slf4j
@RestController
@RequestMapping("/user/tencent/sms")
public class UserSendSms {
@Autowired
TencentCoreService tencentCoreService;
/**
* 腾讯云短信
*/
@PostMapping("/send/ver_code")
public void sendSms(@RequestBody Map<String, String> phoneInfo) {
String phone = phoneInfo.get("phone");
if (StringUtils.isEmpty(phone) || !DataUtils.phonePattern(phone)) {
throw new ParamException(RCode.PHONE_PARAM_ERROR, null);
}
tencentCoreService.sendSmsPhoneVerCode(phone);
}
}
package com.wangxiaolu.promotion.controller.wechat;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.pojo.user.vo.WxTemporaryEnrollVo;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.wechat.WeChatUserCoreService;
import com.wangxiaolu.promotion.utils.DataUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author : liqiulin
* @date : 2024-04-03 17
* @describe : 微信用户信息
*/
@Slf4j
@RestController
@RequestMapping("/user/wechat/core")
public class WeChatUserCoreController {
@Autowired
WeChatUserCoreService weChatUserCoreService;
@Autowired
RedisCache redisCache;
/**
* 促销员注册信息
*/
@PostMapping("/temporary/enroll")
public boolean enrollUserInfo(@RequestBody @Validated WxTemporaryEnrollVo wxTemporaryEnrollVo) {
log.info("微信-促销员注册:{}", JSONObject.toJSONString(wxTemporaryEnrollVo));
// 人员信息校验
boolean isIden = DataUtils.idenCardPattern(wxTemporaryEnrollVo.getIdenNumber());
boolean isPhone = DataUtils.phonePattern(wxTemporaryEnrollVo.getPhone());
if (!isIden || !isPhone) {
throw new ParamException(RCode.ENROLL_PARAM_ERROR, null);
}
/**
* 手机号-验证码 校验
*/
String redisKey = RedisKeys.UserKeys.PHONE_VER_CODE.getKey() + wxTemporaryEnrollVo.getPhone();
String phoneCodeOld = redisCache.get(redisKey);
if (StringUtils.isBlank(phoneCodeOld) || !phoneCodeOld.equals(wxTemporaryEnrollVo.getPhoneCode())){
throw new ParamException(RCode.TENCENT_SMS_PHONE_CODE_ERROR, null);
}
redisCache.removeKey(redisKey);
WxTemporaryInfoDto temporaryDto = new WxTemporaryInfoDto();
BeanUtils.copyProperties(wxTemporaryEnrollVo, temporaryDto);
return weChatUserCoreService.saveWxUserInfoTemporary(temporaryDto);
}
}
package com.wangxiaolu.promotion.controller.wechat;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.pojo.user.vo.WxTemporaryLoginVo;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.wechat.WeChatUserQueryService;
import com.wangxiaolu.promotion.utils.DataUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-09 13
* @describe :微信用户信息查询
*/
@Slf4j
@RestController
@RequestMapping("/user/wechat/query")
public class WeChatUserQueryController {
@Autowired
private WeChatUserQueryService weChatUserQueryService;
/**
* 根据OpenId、Phone登录(促销员查询是否存在)
*
* @return 非null则登录成功
*/
@PostMapping("/temporary/login/phone_openid")
public boolean temporaryLoginByPhoneAndOpenId(@RequestBody WxTemporaryLoginVo wxTemporaryLoginVo) {
phontAndOpenIdVerify(wxTemporaryLoginVo);
if (!DataUtils.phonePattern(wxTemporaryLoginVo.getPhone())) {
throw new ParamException(RCode.PHONE_PARAM_ERROR, null);
}
return weChatUserQueryService.loginTemporaryByOpenIdAndPhone(wxTemporaryLoginVo.getOpenId(), wxTemporaryLoginVo.getPhone());
}
/**
* 促销员信息查询
*/
@PostMapping("/temporary/phone_openid")
public WxTemporaryInfoDto getTemporaryInfoByOpenIdAndPhone(@RequestBody WxTemporaryLoginVo wxTemporaryLoginVo) {
phontAndOpenIdVerify(wxTemporaryLoginVo);
WxTemporaryInfoDto temporaryInfoDto = weChatUserQueryService.getTemporaryInfoByOpenIdAndPhone(wxTemporaryLoginVo.getOpenId(), wxTemporaryLoginVo.getPhone());
if (Objects.isNull(temporaryInfoDto)) {
throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
}
return temporaryInfoDto;
}
private void phontAndOpenIdVerify(WxTemporaryLoginVo wxTemporaryLoginVo) {
if (StringUtils.isBlank(wxTemporaryLoginVo.getOpenId()) || StringUtils.isBlank(wxTemporaryLoginVo.getPhone())) {
throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
}
}
}
package com.wangxiaolu.promotion.domain.activity.dao;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryClockWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
/**
* @author : liqiulin
* @date : 2024-04-23 17
* @describe :
*/
public interface TemporaryActivityClockDao {
/**
* 保存打卡信息
* @param dto 信息
*/
void save(TemporaryClockDto dto);
/**
* 修改打卡信息
* @param dto 信息
*/
void updateById(TemporaryClockDto dto);
/**
* @param tcw 查询条件
* @return 上述条件只能满足一条记录
*/
TemporaryClockDto selectOne(TemporaryClockWrapper tcw);
}
package com.wangxiaolu.promotion.domain.activity.dao;
import com.wangxiaolu.promotion.enums.activity.LogType;
/**
* @author : liqiulin
* @date : 2024-05-15 13
* @describe :
*/
public interface TemporaryActivityLogDao {
void save(Integer temporaryId, String temporaryName, LogType typeE, Long flowDataId, Object logObj);
}
package com.wangxiaolu.promotion.domain.activity.dao;
import java.util.List;
import java.util.Map;
/**
* @author : liqiulin
* @date : 2024-05-09 11
* @describe :
*/
public interface TemporaryActivityPhotoDao {
/**
* 保存活动上报照片list
*/
void saveReportedList(Integer temporaryId, Long reportedId, Integer photoType, List<String> urls, List<String> changeUrls);
/**
* 保存促销员上下班打卡图片
*/
void saveClockPhoto(Integer temporaryId, Long clockId, Integer photoType, String url);
/**
* 根据促销员id-活动上报id查询图片
*/
Map<Integer, List<String>> findReportedGroup(Integer temporaryId, Long reportedId);
Map<Integer, String> findClockPhotoGroupByClockId(Long clockId);
}
package com.wangxiaolu.promotion.domain.activity.dao;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-18 10
* @describe :
*/
public interface TemporaryActivityReportedDao {
/**
* 新增并返回id
*/
long activityDataSave(TemporaryActivityReportedDto temActDto);
/**
* 分页查询促销员任务列表
*/
void findListByTemporaryId(Integer temporaryId, PageInfo pageInfo);
/**
* 查询当日任务
*/
TemporaryActivityReportedDto findOneByCurrentDate(Integer temporaryId);
/**
* 根据ID查询
*/
TemporaryActivityReportedDto findOneById(Long id);
/**
* 根据ID修改
*/
void updateById(TemporaryActivityReportedDto temActDto);
}
package com.wangxiaolu.promotion.domain.activity.dao.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityClockDao;
import com.wangxiaolu.promotion.domain.activity.mapper.TemporaryActivityClockMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityClockDO;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryClockWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-23 17
* @describe :
*/
@Service
@Slf4j
public class TemporaryActivityClockDaoImpl implements TemporaryActivityClockDao {
@Autowired
TemporaryActivityClockMapper temporaryActivityClockMapper;
@Override
public void save(TemporaryClockDto dto) {
// 避免重复打卡
TemporaryClockWrapper tcw = new TemporaryClockWrapper()
.setTemporaryId(dto.getTemporaryId())
.setCreateDate(DateUtil.today());
LambdaQueryWrapper<TemporaryActivityClockDO> qw = buildWrapper(tcw);
Integer count = temporaryActivityClockMapper.selectCount(qw);
if (count > 0) {
return;
}
TemporaryActivityClockDO clockDo = new TemporaryActivityClockDO();
BeanUtils.copyProperties(dto, clockDo);
clockDo.setCreateDate(DateUtil.today());
temporaryActivityClockMapper.insert(clockDo);
dto.setId(clockDo.getId());
}
@Override
public void updateById(TemporaryClockDto dto) {
TemporaryActivityClockDO clockDo = new TemporaryActivityClockDO();
BeanUtils.copyProperties(dto, clockDo);
temporaryActivityClockMapper.updateById(clockDo);
}
/**
* @param tcw 查询条件
* @return 上述条件只能满足一条记录
*/
@Override
public TemporaryClockDto selectOne(TemporaryClockWrapper tcw) {
LambdaQueryWrapper<TemporaryActivityClockDO> qw = buildWrapper(tcw);
TemporaryActivityClockDO clockDO = temporaryActivityClockMapper.selectOne(qw);
return transitionDto(clockDO);
}
private LambdaQueryWrapper<TemporaryActivityClockDO> buildWrapper(TemporaryClockWrapper tcw) {
LambdaQueryWrapper<TemporaryActivityClockDO> qw = new LambdaQueryWrapper<>();
if (Objects.nonNull(tcw.getId())) {
qw.eq(TemporaryActivityClockDO::getId, tcw.getId());
return qw;
}
if (Objects.nonNull(tcw.getTemporaryId())) {
qw.eq(TemporaryActivityClockDO::getTemporaryId, tcw.getTemporaryId());
}
if (StringUtils.isNotBlank(tcw.getCreateDate())) {
qw.eq(TemporaryActivityClockDO::getCreateDate, tcw.getCreateDate());
}
return qw;
}
private TemporaryClockDto transitionDto(TemporaryActivityClockDO clockDO) {
TemporaryClockDto dto = null;
if (Objects.isNull(clockDO)) {
return dto;
}
dto = new TemporaryClockDto();
BeanUtils.copyProperties(clockDO, dto);
return dto;
}
}
package com.wangxiaolu.promotion.domain.activity.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityLogDao;
import com.wangxiaolu.promotion.domain.activity.mapper.TemporaryActivityLogMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityLogDO;
import com.wangxiaolu.promotion.enums.activity.LogType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author : liqiulin
* @date : 2024-05-15 13
* @describe :
*/
@Service
public class TemporaryActivityLogDaoImpl implements TemporaryActivityLogDao {
@Autowired
TemporaryActivityLogMapper temporaryActivityLogMapper;
@Override
public void save(Integer temporaryId, String temporaryName, LogType typeE, Long flowDataId, Object logObj) {
TemporaryActivityLogDO tDo = new TemporaryActivityLogDO(temporaryId, temporaryName, typeE, flowDataId, JSONObject.toJSONString(logObj));
temporaryActivityLogMapper.insert(tDo);
}
}
package com.wangxiaolu.promotion.domain.activity.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityPhotoDao;
import com.wangxiaolu.promotion.domain.activity.mapper.TemporaryActivityPhotoMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityPhotoDO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author : liqiulin
* @date : 2024-05-09 11
* @describe :
*/
@Slf4j
@Service
public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao {
@Autowired
TemporaryActivityPhotoMapper temporaryActivityPhotoMapper;
@Override
public void saveReportedList(Integer temporaryId, Long reportedId, Integer photoType, List<String> urls, List<String> changeUrls) {
if (CollectionUtils.isEmpty(changeUrls)) {
log.info("活动id[{}]图片无改变值", reportedId);
return;
}
Map<String, String> urlTypeMap = new HashMap<>();
for (String changeUrl : changeUrls) {
String[] uArr = changeUrl.split("/");
String type = uArr[0];
String uId = uArr[uArr.length - 1];
urlTypeMap.put(uId, type);
}
log.info("活动id[{}]图片修改后的list为:{}", reportedId, urlTypeMap);
for (String photoUrl : urls) {
String[] photoArr = photoUrl.split("/");
String photoFiledId = photoArr[photoArr.length - 1];
String type = urlTypeMap.get(photoFiledId);
log.info("图片文件id[{}]类型为{}", photoFiledId, type);
// 现存图片列表中不存在,删除
if (StringUtils.isBlank(type)) {
temporaryActivityPhotoMapper.updateIsDelete(reportedId, photoFiledId);
} else if ("cloud:".equals(type)) {
// 新增数据
TemporaryActivityPhotoDO photoDo = new TemporaryActivityPhotoDO();
photoDo.setTemporaryId(temporaryId).setReportedId(reportedId).setType(photoType).setPhotoUrl(photoUrl).setPhotoFiledId(photoFiledId);
temporaryActivityPhotoMapper.insert(photoDo);
}
}
}
/**
* 保存促销员上下班打卡图片
*/
@Override
public void saveClockPhoto(Integer temporaryId, Long clockId, Integer photoType, String url) {
String[] photoArr = url.split("/");
String photoFiledId = photoArr[photoArr.length - 1];
TemporaryActivityPhotoDO photoDo = new TemporaryActivityPhotoDO();
photoDo.setTemporaryId(temporaryId).setClockId(clockId).setType(photoType).setPhotoUrl(url).setPhotoFiledId(photoFiledId);
temporaryActivityPhotoMapper.insert(photoDo);
log.info("保存促销员打卡图片:{}", photoDo);
}
/**
* 活动上报图片查询
*
* @param temporaryId 促销员id
* @param reportedId 活动id
*/
@Override
public Map<Integer, List<String>> findReportedGroup(Integer temporaryId, Long reportedId) {
LambdaQueryWrapper<TemporaryActivityPhotoDO> wq = new LambdaQueryWrapper<>();
wq.eq(TemporaryActivityPhotoDO::getReportedId, reportedId).eq(TemporaryActivityPhotoDO::getIsDelete, 1);
List<TemporaryActivityPhotoDO> dos = temporaryActivityPhotoMapper.selectList(wq);
if (CollectionUtils.isEmpty(dos)) {
return null;
}
Map<Integer, List<String>> groupPhoto = dos.stream().collect(Collectors.groupingBy(TemporaryActivityPhotoDO::getType, Collectors.mapping(TemporaryActivityPhotoDO::getPhotoUrl, Collectors.toList())));
return groupPhoto;
}
/**
* 根据打卡ID查询图片,根据业务类型进行分组
*
* @param clockId 打卡ID
* @return 分组结果
*/
@Override
public Map<Integer, String> findClockPhotoGroupByClockId(Long clockId) {
LambdaQueryWrapper<TemporaryActivityPhotoDO> wq = new LambdaQueryWrapper<>();
wq.eq(TemporaryActivityPhotoDO::getClockId, clockId).eq(TemporaryActivityPhotoDO::getIsDelete, 1);
List<TemporaryActivityPhotoDO> dos = temporaryActivityPhotoMapper.selectList(wq);
Map<Integer, String> map = dos.stream().collect(Collectors.toMap(TemporaryActivityPhotoDO::getType, TemporaryActivityPhotoDO::getPhotoUrl));
return map;
}
}
package com.wangxiaolu.promotion.domain.activity.dao.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityReportedDao;
import com.wangxiaolu.promotion.domain.activity.mapper.TemporaryActivityReportedMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityReportedDO;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryActivityWrapper;
import com.wangxiaolu.promotion.enums.activity.TemActApproveStatus;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-18 10
* @describe :
*/
@Service
@Slf4j
public class TemporaryActivityReportedDaoImpl implements TemporaryActivityReportedDao {
@Autowired
TemporaryActivityReportedMapper temporaryActivityReportedMapper;
/**
* 保存促销员任务
*/
@Override
public long activityDataSave(TemporaryActivityReportedDto temActDto) {
TemporaryActivityReportedDO tDo = new TemporaryActivityReportedDO();
BeanUtils.copyProperties(temActDto, tDo);
tDo.setApproveStatus(temActDto.getApproveStatus().name());
tDo.setCreateDate(DateUtil.today());
temporaryActivityReportedMapper.insert(tDo);
log.info("促销员今日活动上报数据完成,生成id[{}],数据信息:{}", tDo.getId(), tDo);
return tDo.getId();
}
/**
* 根据促销员id查询所有任务
*/
@Override
public void findListByTemporaryId(Integer temporaryId, PageInfo pageInfo) {
TemporaryActivityWrapper taw = JSONObject.parseObject(JSONObject.toJSONString(pageInfo.getQueryParams()), TemporaryActivityWrapper.class);
taw = Objects.isNull(taw) ? new TemporaryActivityWrapper() : taw;
taw.setTemporaryId(temporaryId);
LambdaQueryWrapper<TemporaryActivityReportedDO> temQw = buildQueryList(taw);
Page<TemporaryActivityReportedDO> page = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize());
Page<TemporaryActivityReportedDO> temDoPage = temporaryActivityReportedMapper.selectPage(page, temQw);
pageInfo.pageCovert(temDoPage);
pageInfo.setRecords(transitionDtos(temDoPage.getRecords()));
}
/**
* 根据促销员id查询今日任务
*/
@Override
public TemporaryActivityReportedDto findOneByCurrentDate(Integer temporaryId) {
TemporaryActivityWrapper taw = new TemporaryActivityWrapper()
.setTemporaryId(temporaryId)
.setCreateDate(DateUtil.today());
LambdaQueryWrapper<TemporaryActivityReportedDO> temQw = buildQueryList(taw);
TemporaryActivityReportedDO temDO = temporaryActivityReportedMapper.selectOne(temQw);
return transitionDto(temDO);
}
@Override
public TemporaryActivityReportedDto findOneById(Long id) {
TemporaryActivityReportedDO temDO = temporaryActivityReportedMapper.selectById(id);
return transitionDto(temDO);
}
@Override
public void updateById(TemporaryActivityReportedDto temActDto) {
TemporaryActivityReportedDO rDo = new TemporaryActivityReportedDO();
BeanUtils.copyProperties(temActDto, rDo);
if (Objects.nonNull(temActDto.getApproveStatus())){
rDo.setApproveStatus(temActDto.getApproveStatus().name());
}
rDo.setModifyTime(new Date());
temporaryActivityReportedMapper.updateById(rDo);
}
private LambdaQueryWrapper<TemporaryActivityReportedDO> buildQueryList(TemporaryActivityWrapper tw) {
LambdaQueryWrapper<TemporaryActivityReportedDO> queryWrapper = new LambdaQueryWrapper<>();
if (Objects.nonNull(tw.getTemporaryId())) {
queryWrapper.eq(TemporaryActivityReportedDO::getTemporaryId, tw.getTemporaryId());
}
if (!StringUtils.isEmpty(tw.getCreateDate())) {
queryWrapper.eq(TemporaryActivityReportedDO::getCreateDate, tw.getCreateDate());
}
if (!StringUtils.isEmpty(tw.getApproveStatus())){
queryWrapper.eq(TemporaryActivityReportedDO::getApproveStatus, tw.getApproveStatus());
}
// 默认创建日期倒序排列
queryWrapper.orderByDesc(TemporaryActivityReportedDO::getCreateDate);
return queryWrapper;
}
/**
* DO to DTO (单个对象)
*
* @param temDos DO对象List
* @return DTO对象
*/
private List<TemporaryActivityReportedDto> transitionDtos(List<TemporaryActivityReportedDO> temDos) {
if (CollectionUtils.isEmpty(temDos)) {
return new ArrayList<>();
}
List<TemporaryActivityReportedDto> dtos = new ArrayList<>(temDos.size() * 2);
for (TemporaryActivityReportedDO temDo : temDos) {
dtos.add(transitionDto(temDo));
}
return dtos;
}
/**
* DO to DTO (单个对象)
*
* @param temDo DO对象
* @return DTO对象
*/
private TemporaryActivityReportedDto transitionDto(TemporaryActivityReportedDO temDo) {
TemporaryActivityReportedDto temporaryDto = null;
if (Objects.isNull(temDo)) {
return temporaryDto;
}
temporaryDto = new TemporaryActivityReportedDto();
BeanUtils.copyProperties(temDo, temporaryDto);
// 审批状态回显
if (Objects.nonNull(temDo.getApproveStatus())) {
temporaryDto.setApproveStatus(TemActApproveStatus.valueOf(temDo.getApproveStatus()));
temporaryDto.setApproveStatusMsg(temporaryDto.getApproveStatus().getMsg());
}
return temporaryDto;
}
}
package com.wangxiaolu.promotion.domain.activity.mapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityClockDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【temporary_activity_clock】的数据库操作Mapper
* @createDate 2024-04-23 17:10:46
* @Entity com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityClockDO
*/
@Mapper
@Repository
public interface TemporaryActivityClockMapper extends BaseMapper<TemporaryActivityClockDO> {
}
package com.wangxiaolu.promotion.domain.activity.mapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityLogDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【temporary_activity_log】的数据库操作Mapper
* @createDate 2024-05-15 13:24:13
* @Entity com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityLogDO
*/
@Mapper
@Repository
public interface TemporaryActivityLogMapper extends BaseMapper<TemporaryActivityLogDO> {
}
package com.wangxiaolu.promotion.domain.activity.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityPhotoDO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【temporary_activity_photo】的数据库操作Mapper
* @createDate 2024-05-09 11:22:33
* @Entity com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityPhoto
*/
@Mapper
@Repository
public interface TemporaryActivityPhotoMapper extends BaseMapper<TemporaryActivityPhotoDO> {
void updateIsDelete(Long reportedId, String photoFiledId);
}
package com.wangxiaolu.promotion.domain.activity.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityReportedDO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【temporary_activity_reported】的数据库操作Mapper
* @createDate 2024-04-18 10:38:42
* @Entity generator.domain.TemporaryActivityReported
*/
@Mapper
@Repository
public interface TemporaryActivityReportedMapper extends BaseMapper<TemporaryActivityReportedDO> {
}
package com.wangxiaolu.promotion.domain.activity.mapper.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName temporary_activity_clock
*/
@TableName(value ="temporary_activity_clock")
@Data
public class TemporaryActivityClockDO implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* temporary_info表id
*/
private Integer temporaryId;
/**
* temporary_info表name
*/
private String temporaryName;
/**
* qince_clientele_store表qc_id
*/
private String storeQcId;
/**
* qince_clientele_store表store_name
*/
private String storeName;
/**
* 上班打卡地址
*/
private String clockInAddress;
/**
* 上班打卡经纬度
*/
private String clockInCoordinates;
/**
* 上班打卡时间
*/
private Date clockInTime;
/**
* 午休下班打卡地址
*/
private String noonClockOutAddress;
/**
* 午休下班打卡经纬度
*/
private String noonClockOutCoordinates;
/**
* 午休下班打卡时间
*/
private Date noonClockOutTime;
/**
* 午休上班打卡地址
*/
private String noonClockInAddress;
/**
* 午休上班打卡经纬度
*/
private String noonClockInCoordinates;
/**
* 午休上班打卡时间
*/
private Date noonClockInTime;
/**
* 下班打卡地址
*/
private String clockOutAddress;
/**
* 下班打卡经纬度
*/
private String clockOutCoordinates;
/**
* 下班打卡时间
*/
private Date clockOutTime;
/**
* 创建日期YYYY-MM-DD
*/
private String createDate;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.wangxiaolu.promotion.domain.activity.mapper.entity;
import cn.hutool.json.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.wangxiaolu.promotion.enums.activity.LogType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @TableName temporary_activity_log
* 【促销员活动类】信息日志
*/
@TableName(value = "temporary_activity_log")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TemporaryActivityLogDO implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* temporary_info表id
*/
private Integer temporaryId;
/**
* 促销员姓名
*/
private String temporaryName;
/**
* 日志所在业务类型
*/
private Integer type;
/**
* 日志所在业务名称
*/
private String typeName;
/**
* 当前日志所属业务数据的id
*/
private Long flowDataId;
/**
* 日志内容
*/
private Object dataDetail;
/**
* 创建时间
*/
private Date createTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
public TemporaryActivityLogDO(Integer temporaryId, String temporaryName, LogType typeE, Long flowDataId, Object dataDetail) {
this.temporaryId = temporaryId;
this.type = typeE.getType();
this.typeName = typeE.getName();
this.dataDetail = dataDetail;
this.temporaryName = temporaryName;
this.flowDataId = flowDataId;
}
}
\ No newline at end of file
package com.wangxiaolu.promotion.domain.activity.mapper.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;
/**
*
* @TableName temporary_activity_photo
*/
@TableName(value ="temporary_activity_photo")
@Data
@Accessors(chain = true)
public class TemporaryActivityPhotoDO implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* temporary_info表id
*/
private Integer temporaryId;
/**
* 活动上报ID,关联表temporary_activity_reported表主键id
*/
private Long reportedId;
/**
* 促销员上班打卡记录ID,关联temporary_activity_clock表主键ID
*/
private Long clockId;
/**
* 图片所属类别:1:推广试吃;2……
*/
private Integer type;
/**
* 图片http地址
*/
private String photoUrl;
/**
* 图片Id
*/
private String photoFiledId;
/**
* 是否删除
* 0:删除;1:可用
*/
private Integer isDelete;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.wangxiaolu.promotion.domain.activity.mapper.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName temporary_activity_reported
*/
@TableName(value ="temporary_activity_reported")
@Data
public class TemporaryActivityReportedDO implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 关联—temporary_info表id
*/
private Integer temporaryId;
/**
* 关联—temporary_info表name
*/
private String temporaryName;
/**
* 关联—活动店铺id
*/
private String storeQcId;
/**
* 关联—活动店铺名称(例:小美超市)
*/
private String storeName;
/**
* 关联—活动店铺地址(例:北京朝阳北路31号1层)
*/
private String storeAddr;
/**
* 关联—审核人员id
*/
private Long approverId;
/**
* 关联—审核人员姓名
*/
private String approveName;
/**
* 审批状态(审批中、审批通过、退回……)
* 关联enum类 TemActApproveStatus
*/
private String approveStatus;
/**
* 最后一次审批时间
*/
private Date approveTime;
private Integer sellXiangA;
private Integer sellXiangB;
private Integer sellXiangC;
private Integer sellXiangD;
private Integer sellDaiA;
private Integer sellDaiB;
private Integer sellDaiC;
private Integer sellDaiD;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建日期
*/
private String createDate;
/**
* 修改时间
*/
private Date modifyTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.wangxiaolu.promotion.domain.activity.wrapperQo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-04-09 18
* @describe :
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class TemporaryActivityWrapper {
/**
* temporaryId
*/
private Integer temporaryId;
/**
* 创建时间YYYY-MM-DD
*/
private String createDate;
/**
* 审批状态(审批中、审批通过、退回……)
* 关联enum类 TemActApproveStatus
*/
private String approveStatus;
}
package com.wangxiaolu.promotion.domain.activity.wrapperQo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-04-23 19
* @describe :
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class TemporaryClockWrapper {
/**
* 主键id
*/
private Long id;
/**
* temporary_info表id
*/
private Integer temporaryId;
/**
* 创建日期YYYY-MM-DD
*/
private String createDate;
}
package com.wangxiaolu.promotion.domain.user.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-22 16
* @describe :
*/
public interface QinCeClienteleStoreDao {
/**
* 勤策人员数据同步
*/
void shopDetailAllTask(JSONArray responseDatas);
List<QinCeClienteleStoreDto> getStoreList(StoreWrapper storeWrapper);
QinCeClienteleStoreDto getOneStore(StoreWrapper storeWrapper);
}
package com.wangxiaolu.promotion.domain.user.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
/**
* @author : liqiulin
......@@ -10,7 +11,12 @@ import com.alibaba.fastjson.JSONArray;
public interface QinCeEmployeeDao {
/**
* 勤人员数据同步
* 勤人员数据同步
*/
void employeeSyncTask(JSONArray responseDatas);
/**
* 根据勤策ID查询人员信息
*/
QinCeEmployeeDto selectOntByQcId(String qcId);
}
package com.wangxiaolu.promotion.domain.user.dao;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :促销员-信息
*/
public interface TemporaryInfoDao {
/**
* 微信-小程序注册的促销员信息
*/
int saveWxTemporaryInfo(WxTemporaryInfoDto temporaryDto);
/**
* 根据OpenId查询人员是否存在(非保密信息)
*/
WxTemporaryInfoDto getUnimportantData(String openId);
/**
* 根据OpenId、phone查询人员是否存在(非保密信息)
*/
WxTemporaryInfoDto getUnimportantData(String openId,String phone);
WxTemporaryInfoDto selectOneById(Integer id);
}
package com.wangxiaolu.promotion.domain.user.dao.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao;
import com.wangxiaolu.promotion.domain.user.mapper.QinCeClienteleStoreMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeClienteleStoreDO;
import com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-22 16
* @describe :
*/
@Slf4j
@Service
public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
@Autowired
QinCeClienteleStoreMapper qinCeClienteleStoreMapper;
/**
* 拉取信息
* @param responseDatas 信息json格式数据
*/
@Override
public void shopDetailAllTask(JSONArray responseDatas) {
LambdaQueryWrapper<QinCeClienteleStoreDO> qw = new LambdaQueryWrapper<>();
for (Object responseData : responseDatas) {
qw.clear();
QinCeClienteleStoreDO qinCeShopDO = JSONObject.parseObject(responseData.toString(), QinCeClienteleStoreDO.class);
qw.eq(QinCeClienteleStoreDO::getQcId, qinCeShopDO.getQcId());
QinCeClienteleStoreDO doExist = qinCeClienteleStoreMapper.selectOne(qw);
if (Objects.isNull(doExist)) {
qinCeClienteleStoreMapper.insert(qinCeShopDO);
} else {
qinCeShopDO.setId(doExist.getId());
qinCeClienteleStoreMapper.updateById(qinCeShopDO);
}
}
}
/**
* 查询门店列表
* @param storeWrapper 查询条件
*/
@Override
public List<QinCeClienteleStoreDto> getStoreList(StoreWrapper storeWrapper) {
LambdaQueryWrapper<QinCeClienteleStoreDO> qw = builderQueryWrapper(storeWrapper);
// 指定字段查询
qw.select(QinCeClienteleStoreDO::getQcId,
QinCeClienteleStoreDO::getStoreName,
QinCeClienteleStoreDO::getStoreAddr);
List<QinCeClienteleStoreDO> qinCeClienteleStoreDOS = qinCeClienteleStoreMapper.selectList(qw);
List<QinCeClienteleStoreDto> storeDtos = transitionDtos(qinCeClienteleStoreDOS);
return storeDtos;
}
@Override
public QinCeClienteleStoreDto getOneStore(StoreWrapper storeWrapper) {
LambdaQueryWrapper<QinCeClienteleStoreDO> qw = builderQueryWrapper(storeWrapper);
// 指定字段查询
qw.select(QinCeClienteleStoreDO::getQcId,
QinCeClienteleStoreDO::getStoreName,
QinCeClienteleStoreDO::getStoreAddr);
QinCeClienteleStoreDO qinCeClienteleStoreDO = qinCeClienteleStoreMapper.selectOne(qw);
return transitionDto(qinCeClienteleStoreDO);
}
private LambdaQueryWrapper<QinCeClienteleStoreDO> builderQueryWrapper(StoreWrapper storeWrapper){
LambdaQueryWrapper<QinCeClienteleStoreDO> qw = new LambdaQueryWrapper<>();
// 默认查询有效数据 >>> 门店删除状态。0:删除,1:正常:store_status = 1
qw.eq(QinCeClienteleStoreDO::getStoreStatus,storeWrapper.getStoreStatus());
// 默认查询有效数据 >>> 门店审批状态。1:待审批,2:审批打回,3:审批通过:store_approval_status = 3
qw.eq(QinCeClienteleStoreDO::getStoreApprovalStatus,storeWrapper.getStoreApprovalStatus());
// 按qcId查询
if (StringUtils.isNotBlank(storeWrapper.getQcId())){
qw.eq(QinCeClienteleStoreDO::getQcId,storeWrapper.getQcId());
return qw;
}
// 按门店名称模糊查询
if (StringUtils.isNotBlank(storeWrapper.getStoreNameVague())){
qw.like(QinCeClienteleStoreDO::getStoreName,storeWrapper.getStoreNameVague());
}
return qw;
}
/**
* DO to DTO (单个对象)
* @param storeDO DO对象
* @return DTO对象
*/
private QinCeClienteleStoreDto transitionDto(QinCeClienteleStoreDO storeDO){
QinCeClienteleStoreDto storedDto = null;
if (!Objects.isNull(storeDO)){
storedDto = new QinCeClienteleStoreDto();
BeanUtils.copyProperties(storeDO, storedDto);
}
return storedDto;
}
private List<QinCeClienteleStoreDto> transitionDtos(List<QinCeClienteleStoreDO> storeDOs) {
if (CollectionUtils.isEmpty(storeDOs)) {
return new ArrayList<>();
}
List<QinCeClienteleStoreDto> dtos = new ArrayList<>(storeDOs.size() * 2);
for (QinCeClienteleStoreDO storeDO : storeDOs) {
QinCeClienteleStoreDto storeDto = transitionDto(storeDO);
dtos.add(storeDto);
}
return dtos;
}
}
......@@ -6,7 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wangxiaolu.promotion.domain.user.dao.QinCeEmployeeDao;
import com.wangxiaolu.promotion.domain.user.mapper.QinceEmployeeMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeEmployeeDO;
import com.wangxiaolu.promotion.domain.user.mapper.entity.TemporaryInfoDO;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -50,4 +54,28 @@ public class QinCeEmployeeDaoImpl implements QinCeEmployeeDao {
}
}
@Override
public QinCeEmployeeDto selectOntByQcId(String qcId) {
LambdaQueryWrapper<QinCeEmployeeDO> qw = new LambdaQueryWrapper<>();
qw.eq(QinCeEmployeeDO::getQcId, qcId);
QinCeEmployeeDO qcEmpDo = qinceEmployeeMapper.selectOne(qw);
return transitionDto(qcEmpDo);
}
/**
* DO to DTO (单个对象)
*
* @param qcEmpDo DO对象
* @return DTO对象
*/
private QinCeEmployeeDto transitionDto(QinCeEmployeeDO qcEmpDo) {
QinCeEmployeeDto qcEmpDto = null;
if (!Objects.isNull(qcEmpDo)) {
qcEmpDto = new QinCeEmployeeDto();
BeanUtils.copyProperties(qcEmpDo, qcEmpDto);
}
return qcEmpDto;
}
}
package com.wangxiaolu.promotion.domain.user.dao.impl;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wangxiaolu.promotion.domain.user.dao.TemporaryInfoDao;
import com.wangxiaolu.promotion.domain.user.mapper.TemporaryInfoMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.TemporaryInfoDO;
import com.wangxiaolu.promotion.domain.user.wrapperQo.TemporaryWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :促销员-信息
*/
@Service
public class TemporaryInfoDaoImpl implements TemporaryInfoDao {
@Autowired
TemporaryInfoMapper temporaryInfoMapper;
/**
* 微信-小程序注册的促销员信息
*/
@Override
public int saveWxTemporaryInfo(WxTemporaryInfoDto temporaryDto){
TemporaryInfoDO entity = new TemporaryInfoDO();
BeanUtils.copyProperties(temporaryDto, entity);
return temporaryInfoMapper.insert(entity);
}
@Override
public WxTemporaryInfoDto getUnimportantData(String openId) {
TemporaryInfoDO temDo = temporaryInfoMapper.getUnimportantData(openId);
return transitionDto(temDo);
}
@Override
public WxTemporaryInfoDto getUnimportantData(String openId, String phone) {
TemporaryWrapper tw = new TemporaryWrapper().setOpenId(openId).setPhone(phone);
LambdaQueryWrapper<TemporaryInfoDO> doqwer = buildQueryList(tw);
TemporaryInfoDO temDo = temporaryInfoMapper.selectOne(doqwer);
return transitionDto(temDo);
}
@Override
public WxTemporaryInfoDto selectOneById(Integer id) {
TemporaryInfoDO temDo = temporaryInfoMapper.selectById(id);
return transitionDto(temDo);
}
private LambdaQueryWrapper<TemporaryInfoDO> buildQueryList(TemporaryWrapper tw){
LambdaQueryWrapper<TemporaryInfoDO> queryWrapper = new LambdaQueryWrapper<>();
if (!StringUtils.isEmpty(tw.getOpenId())){
queryWrapper.eq(TemporaryInfoDO::getOpenId,tw.getOpenId());
}
if (!StringUtils.isEmpty(tw.getPhone())){
queryWrapper.eq(TemporaryInfoDO::getPhone,tw.getPhone());
}
return queryWrapper;
}
/**
* DO to DTO (单个对象)
* @param temDo DO对象
* @return DTO对象
*/
private WxTemporaryInfoDto transitionDto(TemporaryInfoDO temDo){
WxTemporaryInfoDto temporaryDto = null;
if (!Objects.isNull(temDo)){
temporaryDto = new WxTemporaryInfoDto();
BeanUtils.copyProperties(temDo, temporaryDto);
}
return temporaryDto;
}
}
package com.wangxiaolu.promotion.domain.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeClienteleStoreDO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【qc_clientele_shop(勤策-客户管理-终端)】的数据库操作Mapper
* @createDate 2024-04-22 16:42:53
* @Entity com.wangxiaolu.promotion.domain.user.mapper.entity.QcClienteleShop
*/
@Mapper
@Repository
public interface QinCeClienteleStoreMapper extends BaseMapper<QinCeClienteleStoreDO> {
}
package com.wangxiaolu.promotion.domain.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.TemporaryInfoDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【temporary_info】的数据库操作Mapper
* @createDate 2024-04-09 18:34:54
* @Entity com.wangxiaolu.promotion.domain.user.mapper.entity.TemporaryInfo
*/
@Mapper
@Repository
public interface TemporaryInfoMapper extends BaseMapper<TemporaryInfoDO> {
// 根据openId查询非保密数据,保密数据不返回:身份证号、身份证照片等信息
TemporaryInfoDO getUnimportantData(@Param("openId") String openId);
}
......@@ -13,7 +13,7 @@ import java.util.Date;
/**
* @author : liqiulin
* @date : 2024-03-29 15
* @describe : 勤策-组织架构-dto
* @describe : 勤策-组织架构
*/
@TableName(value ="qince_department")
@Data
......
package com.wangxiaolu.promotion.domain.user.mapper.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName temporary_info
*/
@Data
@TableName(value ="temporary_info")
public class TemporaryInfoDO implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 姓名
*/
private String name;
/**
* 手机号
*/
private String phone;
/**
* 身份证号码
*/
private String idenNumber;
/**
* 微信openId
*/
private String openId;
/**
* 此促销员的任务人-勤策id
*/
String chargerQcId;
/**
* 此促销员的任务人姓名
*/
String chargerName;
/**
* 头像url
*/
private String avatarUrl;
/**
* 身份证正面url
*/
private String idenFrontPhotoUrl;
/**
* 身份证反面url
*/
private String idenReversePhotoUrl;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.wangxiaolu.promotion.domain.user.wrapperQo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-04-22 17
* @describe : 门店信息查询对象
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Accessors(chain = true)
public class StoreWrapper {
private String qcId;
/**
* 按名称模糊查询
*/
private String storeNameVague;
/**
* 默认查询有效数据
* 门店删除状态。0:删除,1:正常:store_status = 1
* 门店审批状态。1:待审批,2:审批打回,3:审批通过:store_approval_status = 3
*/
private String storeStatus = "1";
private String storeApprovalStatus = "3";
}
package com.wangxiaolu.promotion.domain.user.wrapperQo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-04-09 18
* @describe :
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class TemporaryWrapper {
/**
* openId
*/
String openId;
/**
* 手机号
*/
String phone;
}
package com.wangxiaolu.promotion.enums.activity;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author : liqiulin
* @date : 2024-05-09 11
* @describe : 活动照片图片类型
*/
@Getter
@AllArgsConstructor
public enum ActivityPhotoType {
/**
* 推广试吃照片
*/
TGSC(1),
/**
* 推广互动照片
*/
TGHD(2),
/**
* 推广成交照片
*/
TGCJ(3),
/**
* 上班打卡图片
*/
CLOCK_IN(4),
/**
* 午休下班打卡图片
*/
NOON_CLOCK_OUT(5),
/**
* 午休上班打卡图片
*/
NOON_CLOCK_IN(6),
/**
* 下班打卡图片
*/
CLOCK_OUT(7),
;
private int type;
}
package com.wangxiaolu.promotion.enums.activity;
/**
* @author : liqiulin
* @date : 2024-04-23 14
* @describe : 打卡类型
*/
public interface ClockType {
/**
* 打卡类型:1、上班卡;2、午休下班卡;3、午休上班卡;4、下班卡
*/
Integer TEMPORARY_CLOCK_IN = 1;
String TEMPORARY_CLOCK_IN_BEGIN_TIME = "09:30:00";
String TEMPORARY_CLOCK_IN_END_TIME = "10:00:00";
Integer TEMPORARY_NOON_CLOCK_OUT = 2;
String TEMPORARY_NOON_CLOCK_OUT_BEGIN_TIME = "13:00:00";
String TEMPORARY_NOON_CLOCK_OUT_END_TIME = "13:30:00";
Integer TEMPORARY_NOON_CLOCK_IN = 3;
String TEMPORARY_NOON_CLOCK_IN_BEGIN_TIME = "14:30:00";
String TEMPORARY_NOON_CLOCK_IN_END_TIME = "15:00:00";
Integer TEMPORARY_CLOCK_OUT = 4;
String TEMPORARY_CLOCK_OUT_BEGIN_TIME = "19:00:00";
String TEMPORARY_CLOCK_OUT_END_TIME = "23:59:00";
}
package com.wangxiaolu.promotion.enums.activity;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author : liqiulin
* @date : 2024-05-15 13
* @describe : 促销员日志类型分类
*/
@Getter
@AllArgsConstructor
public enum LogType {
/**
* 促销员活动日志
*/
t_1(1,"打卡"),
t_2(2,"活动数据保存"),
t_3(3,"活动数据提交审批"),
;
private Integer type;
private String name;
}
package com.wangxiaolu.promotion.enums.activity;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author : liqiulin
* @date : 2024-04-18 11
* @describe :temproary activity approve status
* 促销员活动上报审批状态
*/
@Getter
@AllArgsConstructor
public enum TemActApproveStatus {
/**
* 审批状态
*/
// 保存但未提交审批
SUBMITTED("已保存"),
IN_APPROVAL("审批中"),
APPROVED("审批通过"),
SEND_BACK("退回"),
;
private String msg;
}
package com.wangxiaolu.promotion.exception;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.result.basedata.StatusCode;
import lombok.Getter;
/**
* @author : liqiulin
* @date : 2024-03-28 17
* @describe : response包装R失败
*/
@Getter
public class DataException extends RuntimeException {
private int code;
private String msg;
public DataException(StatusCode statusCode, String message) {
super(message);
this.code = statusCode.getCode();
this.msg = statusCode.getMsg();
}
/**
* 默认异常编码
*/
public DataException(String message) {
super(message);
this.code = RCode.API_ERROR.getCode();
this.msg = RCode.API_ERROR.getMsg();
}
}
package com.wangxiaolu.promotion.exception;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.result.basedata.StatusCode;
import lombok.Getter;
/**
* @author : liqiulin
* @date : 2024-03-28 19
* @describe : 业务流程异常
*/
@Getter
public class FlowException extends RuntimeException{
private int code;
private String msg;
public FlowException(StatusCode statusCode, String message) {
super(message);
this.code = statusCode.getCode();
this.msg = statusCode.getMsg();
}
/**
* 默认异常编码
*/
public FlowException(String message) {
super(message);
this.code = RCode.LOGIN_PARAM_ERROR.getCode();
this.msg = RCode.LOGIN_PARAM_ERROR.getMsg();
}
}
package com.wangxiaolu.promotion.pojo;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wangxiaolu.promotion.exception.APIException;
import com.wangxiaolu.promotion.result.basedata.RCode;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author : liqiulin
* @date : 2024-04-19 13
* @describe : 分页配置,默认每页10条记录
*/
@Data
public class PageInfo<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 当前页数,第1页开始
*/
private int pageNum = 1;
/**
* 每页条数
*/
private int pageSize = 1;
/**
* 总条数
*/
private int totalRecord;
/**
* 总页数
*/
private int totalPage;
private List<T> records;
private Map<String,Object> queryParams;
/**
*
* current:当前页数,必须大于等于 1,默认值为 1。
* size:每页条数,默认值为 10。
* total:总条数,默认值为 0。
* records:当前页数据集合,默认值为空集合。
* searchCount:是否进行 count 查询,默认值为 true,表示会统计总条数。
* pages:总页数,通过计算得出。
* optimizeCountSql:是否优化 count 查询,默认值为 true。
* hitCount:是否对 count 进行 limit 优化,默认值为 false。
* countId:count 查询的列名,默认为 null,表示所有列。
* maxLimit:设置最大的 limit 查询限制,默认值为 -1,表示不限制。
* @param iPage 查询出的分页对象
* @param t 需要转换的对象(用于返回前端,不能直接返回DO)
* @param <P> 分页对象中的类型
*/
public <P> void pageCovert(IPage<P> iPage, Class<T> t) {
this.totalRecord = (int) iPage.getTotal();
this.totalPage = (int) iPage.getPages();
List<P> iPageRecords = iPage.getRecords();
if (CollectionUtils.isEmpty(iPageRecords)) {
this.records = new ArrayList<>();
return;
}
try {
List<T> tList = new ArrayList<>(iPageRecords.size() * 2);
for (P pr : iPageRecords) {
T newT = t.newInstance();
// 把原对象数据拷贝到新的对象
BeanUtil.copyProperties(pr, newT);
tList.add(newT);
}
this.records = tList;
} catch (Exception e) {
throw new APIException(RCode.FAILED, e.getMessage());
}
}
public <P> void pageCovert(IPage<P> iPage) {
this.totalRecord = (int) iPage.getTotal();
this.totalPage = (int) iPage.getPages();
}
}
package com.wangxiaolu.promotion.pojo.activity.temporary.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-03-29 16
* @describe :
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class QinCeEmployeeDto {
/**
* 主键id
*/
private Integer id;
/**
* 勤策的员工唯一标识
* 对应[QinCeEmployeeDTO.id]
*/
private String qcId;
/**
* 来源第三方系统的员工唯一标识
*/
private String empId;
/**
* 员工登录帐号
*/
private String empCode;
/**
* 姓名
*/
private String empName;
/**
* 员工别名
*/
private String aliasName;
/**
* 人员编码
*/
private String employeeCode;
/**
* 员工手机号码
*/
private String empMobile;
/**
* 邮箱
*/
private String empEmail;
/**
* 来源第三方系统隶属部门
*/
private String empOrgId;
/**
* 隶属部门编码
*/
private String empOrgCode;
/**
* 勤策部门唯一标识
* 对应QinCeDepartmentDO.qcId
*/
private String waiqin365OrgId;
/**
* 来源第三方系统,员工上级唯一标识
*/
private String empParentId;
/**
* 员工账号状态。0:销户,1:正常,2:停用
*/
private String empStatus;
/**
* 勤策经销商唯一标识
*/
private String dealerId;
/**
* 经销商中文名称
*/
private String dealerName;
/**
* 勤策职务唯一标识
*/
private String waiqin365PositionId;
/**
* 职务编码
*/
private String empPositionCode;
/**
* 职务名称
*/
private String empPosition;
/**
* 勤策岗位唯一标识
*/
private String waiqin365JobId;
/**
* 岗位编码
*/
private String empJobCode;
/**
* 岗位名称
*/
private String empJob;
}
package com.wangxiaolu.promotion.pojo.activity.temporary.dto;
import com.wangxiaolu.promotion.enums.activity.TemActApproveStatus;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-18 10
* @describe :
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class TemporaryActivityReportedDto {
/**
* temporary_activity_reported主键id
*/
private Long id;
/**
* 关联—temporary_info表id
*/
private Integer temporaryId;
/**
* 关联—temporary_info表name
*/
private String temporaryName;
/**
* 关联—活动店铺id
*/
private String storeQcId;
/**
* 关联—活动店铺名称(例:小美超市)
*/
private String storeName;
/**
* 关联—活动店铺地址(例:北京朝阳北路31号1层)
*/
private String storeAddr;
/**
* 关联—审核人员id
*/
private Long approverId;
/**
* 关联—审核人员姓名
*/
private String approveName;
/**
* 审批状态(审批中、审批通过、退回……)
*/
private TemActApproveStatus approveStatus;
private String approveStatusMsg;
/**
* 最后一次审批时间
*/
private Date approveTime;
/**
* 推广试吃照片
*/
List<String> tgscPhotoUrls;
List<String> tgscChangePhotoUrls;
/**
* 推广互动照片
*/
List<String> tghdPhotoUrls;
List<String> tghdChangePhotoUrls;
/**
* 推广成交照片
*/
List<String> tgcjPhotoUrls;
List<String> tgcjChangePhotoUrls;
private Integer sellXiangA;
private Integer sellXiangB;
private Integer sellXiangC;
private Integer sellXiangD;
private Integer sellDaiA;
private Integer sellDaiB;
private Integer sellDaiC;
private Integer sellDaiD;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建日期
*/
private String createDate;
/**
* 修改时间
*/
private Date modifyTime;
}
package com.wangxiaolu.promotion.pojo.activity.temporary.dto;
import com.wangxiaolu.promotion.enums.activity.ClockType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @author : liqiulin
* @date : 2024-04-23 14
* @describe :促销员打卡数据DTO
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Accessors(chain = true)
public class TemporaryClockDto {
/**
* 打卡记录id
* 上班打卡无记录id
*/
Long id;
/**
* temporaryId
*/
Integer temporaryId;
String temporaryName;
// 店铺勤策id
String storeQcId;
// 店铺名称
String storeName;
// 上班打卡地址
String clockInAddress;
// 上班打卡经纬度
String clockInCoordinates;
// 上班打卡图片
String clockInPhoto;
// 上班打卡时间
Date clockInTime;
// 午休下班打卡地点
String noonClockOutAddress;
// 午休下班打卡经纬度
String noonClockOutCoordinates;
// 午休下班打卡图片
String noonClockOutPhoto;
// 午休下班打卡时间
Date noonClockOutTime;
// 午休上班打卡地点
String noonClockInAddress;
// 午休上班打卡经纬度
String noonClockInCoordinates;
// 午休上班打卡图片
String noonClockInPhoto;
// 午休上班打卡时间
Date noonClockInTime;
// 下班打卡地点
String clockOutAddress;
// 下班打卡经纬度
String clockOutCoordinates;
// 下班打卡图片
String clockOutPhoto;
// 下班打卡时间
Date clockOutTime;
public TemporaryClockDto(Integer clockType, Long id, Integer temporaryId, String temporaryName) {
if (!ClockType.TEMPORARY_CLOCK_IN.equals(clockType)) {
this.id = id;
}
this.temporaryId = temporaryId;
this.temporaryName = temporaryName;
}
}
package com.wangxiaolu.promotion.pojo.activity.temporary.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-17 19
* @describe : 促销员今日活动上报VO
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class TemporaryActivityDataVo {
/**
* 促销员活动上报id
* 关联ID:temporary_activity_reported表id
*/
Long activityReportedId;
/**
* 促销员id
* temporaryInfo表id
*/
@NotNull(message = "促销员账号异常")
private Integer temporaryId;
/**
* 促销员姓名
* temporaryInfo表name
*/
private String temporaryName;
/**
* 活动店铺Id
*/
@NotNull(message = "活动店铺异常")
private String storeQcId;
/**
* 推广试吃照片
*/
private List<String> tgscPhotoUrls;
private List<String> tgscChangePhotoUrls;
/**
* 推广互动照片
*/
private List<String> tghdPhotoUrls;
private List<String> tghdChangePhotoUrls;
/**
* 推广成交照片
*/
private List<String> tgcjPhotoUrls;
private List<String> tgcjChangePhotoUrls;
private Integer ax;
private Integer sellXiangA;
private Integer sellXiangB;
private Integer sellXiangC;
private Integer sellXiangD;
private Integer sellDaiA;
private Integer sellDaiB;
private Integer sellDaiC;
private Integer sellDaiD;
}
\ No newline at end of file
package com.wangxiaolu.promotion.pojo.activity.temporary.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @author : liqiulin
* @date : 2024-04-23 13
* @describe : 促销员打卡数据模型
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Accessors(chain = true)
public class TemporaryClockVo {
/**
* 打卡记录id
*/
Long id;
/**
* 打卡类型:1、上班卡;2、午休下班卡;3、午休上班卡;4、下班卡
*/
@NotNull(message = "无打卡类型")
@Range(max = 4, min = 1, message = "超出状态")
Integer clockType;
/**
* temporaryId
*/
@NotNull(message = "找不到打卡人")
Integer temporaryId;
String temporaryName;
// 店铺勤策id
String storeQcId;
// 店铺名称
String storeName;
// 上班打卡地点
@NotBlank(message = "请选择打卡地址")
String clockAddress;
// 上班打卡经纬度
@NotBlank(message = "请选择打卡地点")
String clockCoordinates;
// 上班打卡图片
@NotBlank(message = "请上传图片")
String clockPhoto;
}
package com.wangxiaolu.promotion.pojo.user.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-04-22 18
* @describe : store-DTO
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Accessors(chain = true)
public class QinCeClienteleStoreDto {
/**
* 勤策的门店唯一ID
*/
private String qcId;
private String storeName;
private String storeAddr;
}
package com.wangxiaolu.promotion.pojo.user.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :微信促销员DTO
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class WxTemporaryInfoDto {
/**
* temporary_info表id
*/
Integer id;
/**
* openId
*/
String openId;
/**
* 头像
*/
String avatarUrl;
/**
* 姓名
*/
String name;
/**
* 手机号
*/
String phone;
/**
* 身份证号
*/
String idenNumber;
/**
* 身份证正面照
*/
String idenFrontPhotoUrl;
/**
* 身份证反面照
*/
String idenReversePhotoUrl;
/**
* 详细地址
*/
String address;
/**
* 创建时间
*/
Date createTime;
/**
* 此促销员的任务人-勤策id
*/
String chargerQcId;
/**
* 此促销员的任务人姓名
*/
String chargerName;
}
package com.wangxiaolu.promotion.pojo.user.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-04-22 17
* @describe : 按条件查询门店信息
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Accessors(chain = true)
public class ClienteleStoreQueryVo {
private String qcId;
/**
* 按名称模糊查询
*/
private String storeNameVague;
/**
* 默认查询有效数据
* 门店删除状态。0:删除,1:正常:store_status = 1
* 门店审批状态。1:待审批,2:审批打回,3:审批通过:store_approval_status = 3
*/
private String storeStatus = "1";
private String storeApprovalStatus = "3";
}
package com.wangxiaolu.promotion.pojo.user.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
/**
* @author : liqiulin
* @date : 2024-04-08 12
* @describe : 微信-促销员注册参数
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class WxTemporaryEnrollVo {
/**
* openId
*/
@NotBlank(message = "微信登录错误")
String openId;
/**
* 头像
*/
@NotBlank(message = "请上传头像")
String avatarUrl;
/**
* 姓名
*/
@NotBlank(message = "姓名不可为空")
String name;
/**
* 手机号
*/
@NotBlank(message = "手机号不可为空")
String phone;
/**
* 身份证号
*/
@NotBlank(message = "身份证号不可为空")
String idenNumber;
/**
* 身份证正面照
*/
@NotBlank(message = "请上传身份证正面照")
String idenFrontPhotoUrl;
/**
* 身份证反面照
*/
@NotBlank(message = "请上传身份证反面照")
String idenReversePhotoUrl;
/**
* 详细地址
*/
String address;
/**
* 手机验证码
*/
@NotBlank(message = "验证码无效")
String phoneCode;
/**
* 此促销员的任务人-勤策id
*/
String chargerQcId = "8453472204758793216";
}
package com.wangxiaolu.promotion.pojo.user.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
/**
* @author : liqiulin
* @date : 2024-04-16 10
* @describe : 促销员登录
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class WxTemporaryLoginVo {
@NotBlank(message = "微信登录错误")
String openId;
@NotBlank(message = "手机号不可为空")
String phone;
}
package com.wangxiaolu.promotion.result.advice;
import com.wangxiaolu.promotion.exception.APIException;
import com.wangxiaolu.promotion.exception.FlowException;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.sql.SQLIntegrityConstraintViolationException;
/**
* @author : liqiulin
* @date : 2024-03-28 19
......@@ -18,19 +23,54 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
public class ControllerExceptionAdvice {
@ExceptionHandler({ParamException.class})
public R ParamExceptionHandler(ParamException e) {
public R paramExceptionHandler(ParamException e) {
return new R(e.getCode(), e.getMsg(), e.getMessage());
}
@ExceptionHandler({FlowException.class})
public R flowExceptionHandler(FlowException e) {
return new R(e.getCode(), e.getMsg(), e.getMessage());
}
@ExceptionHandler({APIException.class})
public R APIExceptionHandler(APIException e) {
public R apiExceptionHandler(APIException e) {
return new R(e.getCode(), e.getMsg(), e.getMessage());
}
@ExceptionHandler({SQLIntegrityConstraintViolationException.class})
public R dbConstraintViolationExceptionHandler(SQLIntegrityConstraintViolationException e) {
RCode errorCode = RCode.USER_PHONE_IDENNUMBER_WXOPENID_UNIQUE_ERROR;
String msg = errorCode.getMsg();
String message = e.getMessage();
if (message.contains("phone_unique")) {
msg = "手机号已注册";
} else if (message.contains("iden_num_unique")) {
msg = "身份证已注册";
} else if (message.contains("open_id_unique")) {
msg = "微信号已注册";
}
return new R(errorCode.getCode(), msg, message);
}
@ExceptionHandler({MethodArgumentNotValidException.class})
public R MethodArgumentNotValidExceptionHandler(MethodArgumentNotValidException e) {
public R methodArgumentNotValidExceptionHandler(MethodArgumentNotValidException e) {
String msg = e.getBindingResult().getFieldError().getDefaultMessage();
return new R(RCode.PARAM_ERROR.getCode(), msg);
}
@ExceptionHandler({DataIntegrityViolationException.class})
public R dataIntegrityViolationExceptionHandler(DataIntegrityViolationException e) {
String msg = e.getMessage();
if (msg.contains("java.sql.SQLIntegrityConstraintViolationException")){
return dbConstraintViolationExceptionHandler(new SQLIntegrityConstraintViolationException(msg));
}
return new R(RCode.API_DATA_ERROR.getCode(), RCode.API_DATA_ERROR.getMsg(), msg);
}
@ExceptionHandler({TooManyResultsException.class})
public R tooManyResultsExceptionHandler(TooManyResultsException e) {
String msg = e.getMessage();
return new R(RCode.DATA_TOO_MANY_ERROR.getCode(), msg);
}
}
......@@ -23,12 +23,32 @@ public enum RCode implements StatusCode {
* 2000+
*/
API_ERROR(2000, "业务异常"),
API_DATA_ERROR(2001, "业务数据异常"),
DATA_HAVE_ERROR(2002, "数据已存在,不可新增"),
STATUS_UPDATE_ERROR(2003, "当前状态不可修改"),
DATA_NOT_HAVE_ERROR(2004, "数据不存在"),
DATA_TOO_MANY_ERROR(2005, "唯一数据存在多条"),
/**
* user模块
* user
* 3000+
*/
LOGIN_PARAM_ERROR(3000, "登录信息错误");
LOGIN_PARAM_ERROR(3000, "登录信息错误"),
ENROLL_PARAM_ERROR(3001, "注册信息错误"),
PHONE_PARAM_ERROR(3002, "手机号异常"),
USER_PHONE_IDENNUMBER_WXOPENID_UNIQUE_ERROR(3003, "个人信息已注册"),
LOGIN_USER_IS_NULL_ERROR(3004, "账号未注册"),
CLOCK_DETAIL_ERROR(3005, "打卡信息错误"),
CLOCK_DETAIL_TIME_ERROR(3006, "不在打卡时间范围内"),
CHARGER_ID_ERROR(3007, "未找到负责人"),
/**
* 腾讯云
* 3500+
*/
TENCENT_SMS_ERROR(3500, "短信发送失败"),
TENCENT_SMS_REPETITION(3501, "短信已发送"),
TENCENT_SMS_PHONE_CODE_ERROR(3502, "验证码错误"),
;
......
package com.wangxiaolu.promotion.service.activity.temporary;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
/**
* @author : liqiulin
* @date : 2024-04-23 19
* @describe :
*/
public interface TemporaryActivityClockQueryService {
TemporaryClockDto findTodayTemporaryClockByTemId(Integer temporaryId);
TemporaryClockDto findTemporaryClockByTemIdAndDate(Integer temporaryId, String createDate);
}
package com.wangxiaolu.promotion.service.activity.temporary;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
/**
* @author : liqiulin
* @date : 2024-04-18 11
* @describe :
*/
public interface TemporaryActivityCoreService {
/**
* 活动上报保存
*/
long activityDataReportedSave(TemporaryActivityReportedDto temActDto);
/**
* 活动上报数据修改
*/
void activityDataReportedUpdate(TemporaryActivityReportedDto temActDto);
/**
* 促销员当日打卡信息保存
*/
void clockInTodayActivity(TemporaryClockDto dto, Integer clockType);
/**
* 活动上报数据修改审批状态
*/
void activityReportedSubmit(Long id);
}
package com.wangxiaolu.promotion.service.activity.temporary;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-18 13
* @describe :
*/
public interface TemporaryActivityQueryService {
/**
* 根据促销员id查询所有任务
*/
void findtemporaryIdActivityDataList(Integer temporaryId, PageInfo pageInfo);
/**
* 根据促销员id查询今日任务
*/
TemporaryActivityReportedDto findtemporaryIdTodayActivityData(Integer temporaryId);
TemporaryActivityReportedDto findTemporaryActivityById(Long activityId);
}
package com.wangxiaolu.promotion.service.activity.temporary.impl;
import cn.hutool.core.date.DateUtil;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityClockDao;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityPhotoDao;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryClockWrapper;
import com.wangxiaolu.promotion.enums.activity.ActivityPhotoType;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityClockQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-23 19
* @describe :
*/
@Slf4j
@Service
public class TemporaryActivityClockQueryServiceImpl implements TemporaryActivityClockQueryService {
@Autowired
TemporaryActivityClockDao temporaryActivityClockDao;
@Autowired
TemporaryActivityPhotoDao temporaryActivityPhotoDao;
@Override
public TemporaryClockDto findTodayTemporaryClockByTemId(Integer temporaryId) {
String today = DateUtil.today();
TemporaryClockWrapper tcw = new TemporaryClockWrapper()
.setTemporaryId(temporaryId)
.setCreateDate(today);
TemporaryClockDto temporaryClockDto = temporaryActivityClockDao.selectOne(tcw);
findClockPhoto(temporaryClockDto);
return temporaryClockDto;
}
/**
* 查询指定日期打卡信息
*/
@Override
public TemporaryClockDto findTemporaryClockByTemIdAndDate(Integer temporaryId, String createDate) {
TemporaryClockWrapper tcw = new TemporaryClockWrapper()
.setTemporaryId(temporaryId)
.setCreateDate(createDate);
TemporaryClockDto temporaryClockDto = temporaryActivityClockDao.selectOne(tcw);
findClockPhoto(temporaryClockDto);
return temporaryClockDto;
}
/**
* 查询打卡图片
*/
private void findClockPhoto(TemporaryClockDto temporaryClockDto) {
if (Objects.isNull(temporaryClockDto)) {
return;
}
Map<Integer, String> photoGroup = temporaryActivityPhotoDao.findClockPhotoGroupByClockId(temporaryClockDto.getId());
temporaryClockDto.setClockInPhoto(photoGroup.get(ActivityPhotoType.CLOCK_IN.getType()));
temporaryClockDto.setNoonClockOutPhoto(photoGroup.get(ActivityPhotoType.NOON_CLOCK_OUT.getType()));
temporaryClockDto.setNoonClockInPhoto(photoGroup.get(ActivityPhotoType.NOON_CLOCK_IN.getType()));
temporaryClockDto.setClockOutPhoto(photoGroup.get(ActivityPhotoType.CLOCK_OUT.getType()));
log.info("查询打卡记录{}的所有图片:{}", temporaryClockDto.getId(), photoGroup);
}
}
package com.wangxiaolu.promotion.service.activity.temporary.impl;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityClockDao;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityLogDao;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityPhotoDao;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityReportedDao;
import com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao;
import com.wangxiaolu.promotion.domain.user.dao.TemporaryInfoDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper;
import com.wangxiaolu.promotion.enums.activity.ActivityPhotoType;
import com.wangxiaolu.promotion.enums.activity.ClockType;
import com.wangxiaolu.promotion.enums.activity.LogType;
import com.wangxiaolu.promotion.enums.activity.TemActApproveStatus;
import com.wangxiaolu.promotion.exception.FlowException;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityCoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-18 11
* @describe :
*/
@Service
@Slf4j
public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreService {
@Autowired
private TemporaryActivityReportedDao temporaryActivityReportedDao;
@Autowired
private TemporaryActivityClockDao temporaryActivityClockDao;
@Autowired
private QinCeClienteleStoreDao qinCeClienteleStoreDao;
@Autowired
private TemporaryActivityPhotoDao tempActivityPhotoDao;
@Autowired
private TemporaryActivityLogDao tempActivityLogDao;
@Autowired
private TemporaryInfoDao temporaryInfoDao;
/**
* 活动上报保存
*
* @return 生成id
*/
@Transactional(rollbackFor = Exception.class)
@Override
public long activityDataReportedSave(TemporaryActivityReportedDto temActDto) {
// 判断是否已存在上报数据
TemporaryActivityReportedDto haveDate = temporaryActivityReportedDao.findOneByCurrentDate(temActDto.getTemporaryId());
if (Objects.nonNull(haveDate)) {
throw new FlowException(RCode.DATA_HAVE_ERROR, null);
}
// 初始化任务状态:已保存
temActDto.setApproveStatus(TemActApproveStatus.SUBMITTED);
// 根据storeQcId查询店铺信息,进行店铺信息补充
QinCeClienteleStoreDto storeDto = qinCeClienteleStoreDao.getOneStore(new StoreWrapper().setQcId(temActDto.getStoreQcId()));
temActDto.setStoreName(storeDto.getStoreName()).setStoreAddr(storeDto.getStoreAddr());
// 保存活动数据 temporary_activity_reported
long reportedId = temporaryActivityReportedDao.activityDataSave(temActDto);
temActDto.setId(reportedId);
// 保存图片
saveActivityPhoto(temActDto);
// 日志保存
tempActivityLogDao.save(temActDto.getTemporaryId(), temActDto.getTemporaryName(), LogType.t_2, temActDto.getId(), temActDto);
return reportedId;
}
/**
* 活动信息修改
* 1、判断活动是否可以修改
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void activityDataReportedUpdate(TemporaryActivityReportedDto temActDto) {
// 图片增量保存
saveActivityPhoto(temActDto);
temporaryActivityReportedDao.updateById(temActDto);
// 日志保存
tempActivityLogDao.save(temActDto.getTemporaryId(), temActDto.getTemporaryName(), LogType.t_2, temActDto.getId(), temActDto);
}
/**
* 促销员当日打卡信息保存
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void clockInTodayActivity(TemporaryClockDto dto, Integer clockType) {
log.info("促销员当日打卡[type-{}]信息保存:{}", clockType, dto.toString());
if (Objects.isNull(dto.getId())) {
temporaryActivityClockDao.save(dto);
} else {
temporaryActivityClockDao.updateById(dto);
}
// 根据ID保存图片
saveClockPhoto(dto, clockType);
// 日志保存
tempActivityLogDao.save(dto.getTemporaryId(), dto.getTemporaryName(), LogType.t_1, dto.getId(), dto);
}
/**
* 修改审批状态
*
* @param id 上报记录id
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void activityReportedSubmit(Long id) {
// 判断此id任务是否存在,并且是否满足提交审批条件
TemporaryActivityReportedDto reportedDto = temporaryActivityReportedDao.findOneById(id);
if (Objects.isNull(reportedDto)){
throw new ParamException(RCode.DATA_NOT_HAVE_ERROR, null);
}
TemActApproveStatus approveStatus = reportedDto.getApproveStatus();
if (!TemActApproveStatus.SUBMITTED.name().equals(approveStatus.name()) && !TemActApproveStatus.SEND_BACK.name().equals(approveStatus.name())) {
throw new FlowException(RCode.STATUS_UPDATE_ERROR, null);
}
// 查询促销员负责人,将人员补充到审批中
WxTemporaryInfoDto wxTemporaryInfoDto = temporaryInfoDao.selectOneById(reportedDto.getTemporaryId());
TemporaryActivityReportedDto updateDto = new TemporaryActivityReportedDto()
.setId(id)
.setApproveName(wxTemporaryInfoDto.getChargerName())
.setApproveStatus(TemActApproveStatus.IN_APPROVAL);
// 修改审批
temporaryActivityReportedDao.updateById(updateDto);
// 日志保存
tempActivityLogDao.save(reportedDto.getTemporaryId(), reportedDto.getTemporaryName(), LogType.t_3, updateDto.getId(), updateDto);
}
/**
* 推广活动照片保存
*
* @param temActDto 活动提交数据
*/
private void saveActivityPhoto(TemporaryActivityReportedDto temActDto) {
Integer temporaryId = temActDto.getTemporaryId();
Long reportedId = temActDto.getId();
// 推广试吃照片
if (!CollectionUtils.isEmpty(temActDto.getTgscPhotoUrls())) {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGSC.getType(), temActDto.getTgscPhotoUrls(), temActDto.getTgscChangePhotoUrls());
}
// 推广互动照片
if (!CollectionUtils.isEmpty(temActDto.getTghdPhotoUrls())) {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGHD.getType(), temActDto.getTghdPhotoUrls(), temActDto.getTghdChangePhotoUrls());
}
// 推广成交照片
if (!CollectionUtils.isEmpty(temActDto.getTgcjPhotoUrls())) {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGCJ.getType(), temActDto.getTgcjPhotoUrls(), temActDto.getTgcjChangePhotoUrls());
}
log.info("促销员今日活动上报-图片保存成功,关联活动上报数据id[{}],数据信息:{}", temActDto.getId(), temActDto);
}
/**
* 促销员上班打卡图片保存
*/
private void saveClockPhoto(TemporaryClockDto dto, Integer clockType) {
// 上班卡、午休下班卡、午休上班卡、下班卡
if (ClockType.TEMPORARY_CLOCK_IN.equals(clockType)) {
tempActivityPhotoDao.saveClockPhoto(dto.getTemporaryId(), dto.getId(), ActivityPhotoType.CLOCK_IN.getType(), dto.getClockInPhoto());
} else if (ClockType.TEMPORARY_NOON_CLOCK_OUT.equals(clockType)) {
tempActivityPhotoDao.saveClockPhoto(dto.getTemporaryId(), dto.getId(), ActivityPhotoType.NOON_CLOCK_OUT.getType(), dto.getNoonClockOutPhoto());
} else if (ClockType.TEMPORARY_NOON_CLOCK_IN.equals(clockType)) {
tempActivityPhotoDao.saveClockPhoto(dto.getTemporaryId(), dto.getId(), ActivityPhotoType.NOON_CLOCK_IN.getType(), dto.getNoonClockInPhoto());
} else if (ClockType.TEMPORARY_CLOCK_OUT.equals(clockType)) {
tempActivityPhotoDao.saveClockPhoto(dto.getTemporaryId(), dto.getId(), ActivityPhotoType.CLOCK_OUT.getType(), dto.getClockOutPhoto());
}
}
}
package com.wangxiaolu.promotion.service.activity.temporary.impl;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityPhotoDao;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityReportedDao;
import com.wangxiaolu.promotion.enums.activity.ActivityPhotoType;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-18 13
* @describe :
*/
@Service
@Slf4j
public class TemporaryActivityQueryServiceImpl implements TemporaryActivityQueryService {
@Autowired
TemporaryActivityReportedDao temporaryActivityReportedDao;
@Autowired
TemporaryActivityPhotoDao temporaryActivityPhotoDao;
/**
* 根据促销员id查询所有任务
*/
@Override
public void findtemporaryIdActivityDataList(Integer temporaryId, PageInfo pageInfo) {
temporaryActivityReportedDao.findListByTemporaryId(temporaryId, pageInfo);
}
/**
* 根据促销员id查询今日任务
*/
@Override
public TemporaryActivityReportedDto findtemporaryIdTodayActivityData(Integer temporaryId) {
TemporaryActivityReportedDto dto = temporaryActivityReportedDao.findOneByCurrentDate(temporaryId);
findActivityReportedPhoto(dto);
return dto;
}
@Override
public TemporaryActivityReportedDto findTemporaryActivityById(Long activityId) {
TemporaryActivityReportedDto dto = temporaryActivityReportedDao.findOneById(activityId);
findActivityReportedPhoto(dto);
return dto;
}
private void findActivityReportedPhoto(TemporaryActivityReportedDto dto) {
if (Objects.isNull(dto)) {
return;
}
Map<Integer, List<String>> reportedGroup = temporaryActivityPhotoDao.findReportedGroup(dto.getTemporaryId(), dto.getId());
if (!CollectionUtils.isEmpty(reportedGroup)) {
dto.setTgscPhotoUrls(reportedGroup.get(ActivityPhotoType.TGSC.getType()));
dto.setTghdPhotoUrls(reportedGroup.get(ActivityPhotoType.TGHD.getType()));
dto.setTgcjPhotoUrls(reportedGroup.get(ActivityPhotoType.TGCJ.getType()));
}
}
}
package com.wangxiaolu.promotion.service.user;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import com.wangxiaolu.promotion.pojo.user.vo.ClienteleStoreQueryVo;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-22 17
* @describe :
*/
public interface QinCeClienteleDataQueryService {
List<QinCeClienteleStoreDto> getStoreList(ClienteleStoreQueryVo storeQueryVo);
}
......@@ -9,4 +9,7 @@ public interface QinCeDataTaskService {
void departmentSyncTask();
void employeeSyncTask();
void shopDetailAllTask();
}
package com.wangxiaolu.promotion.service.user;
/**
* @author : liqiulin
* @date : 2024-04-15 15
* @describe :
*/
public interface TencentCoreService {
/**
* 发送手机号验证码
* @param phone 手机号
*/
void sendSmsPhoneVerCode(String phone);
}
package com.wangxiaolu.promotion.service.user.impl;
import com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import com.wangxiaolu.promotion.pojo.user.vo.ClienteleStoreQueryVo;
import com.wangxiaolu.promotion.service.user.QinCeClienteleDataQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-22 17
* @describe :
*/
@Slf4j
@Service
public class QinCeClienteleDataQueryServiceImpl implements QinCeClienteleDataQueryService {
@Autowired
QinCeClienteleStoreDao qinCeClienteleStoreDao;
@Override
public List<QinCeClienteleStoreDto> getStoreList(ClienteleStoreQueryVo storeQueryVo) {
StoreWrapper sw = new StoreWrapper();
BeanUtils.copyProperties(storeQueryVo,sw);
return qinCeClienteleStoreDao.getStoreList(sw);
}
}
......@@ -2,6 +2,7 @@ package com.wangxiaolu.promotion.service.user.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao;
import com.wangxiaolu.promotion.domain.user.dao.QinCeDepartmentDao;
import com.wangxiaolu.promotion.domain.user.dao.QinCeEmployeeDao;
import com.wangxiaolu.promotion.service.user.QinCeDataTaskService;
......@@ -22,18 +23,20 @@ import java.util.Map;
@Service
public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
@Autowired
QinCeUtils qinCeUtils;
@Autowired
QinCeDepartmentDao qinCeDepartmentDao;
@Autowired
QinCeEmployeeDao qinCeEmployeeDao;
@Autowired
QinCeUtils qinCeUtils;
QinCeClienteleStoreDao qinCeClienteleShopDao;
@Override
public void departmentSyncTask() {
// 查询组织架构参数、创建url
Map<String, Object> params = qinCeUtils.queryOrgParam();
String url = qinCeUtils.builderUrl(QinCeUtils.QUERY_ORGANIZATION,params);
String url = qinCeUtils.builderUrl(QinCeUtils.QUERY_ORGANIZATION, params);
// 发起请求、接收结果
JSONObject resultJson = OkHttp.post(url, params);
......@@ -51,7 +54,7 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
public void employeeSyncTask() {
// 查询组织架构参数、创建url
Map<String, Object> params = qinCeUtils.queryEmployeeParam(false);
String url = qinCeUtils.builderUrl(QinCeUtils.QUERY_EMPLOYEE,params);
String url = qinCeUtils.builderUrl(QinCeUtils.QUERY_EMPLOYEE, params);
// 发起请求、接收结果
JSONObject resultJson = OkHttp.post(url, params);
......@@ -64,4 +67,24 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
qinCeEmployeeDao.employeeSyncTask(responseDatas);
}
/**
* 同步[终端数据]
*/
@Override
public void shopDetailAllTask() {
Map<String, Object> params = qinCeUtils.queryShopParam();
String url = qinCeUtils.builderUrl(QinCeUtils.QUERY_SHORE, params);
// 发起请求、接收结果
JSONObject resultJson = OkHttp.post(url, params);
JSONArray responseDatas = resultJson.getJSONArray("response_data");
if (responseDatas.size() <= 0) {
log.error("勤策-同步人员数据,未查询到数据");
return;
}
log.info("勤策-同步终端数据,查询到数据「{}」条", responseDatas.size());
qinCeClienteleShopDao.shopDetailAllTask(responseDatas);
}
}
package com.wangxiaolu.promotion.service.user.impl;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.user.TencentCoreService;
import com.wangxiaolu.promotion.utils.DataUtils;
import com.wangxiaolu.promotion.utils.TencentUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
* @author : liqiulin
* @date : 2024-04-15 15
* @describe :
*/
@Slf4j
@Service
public class TencentCoreServiceImpl implements TencentCoreService {
@Value("${tengxunyun.sms.overdue_long}")
private long overdueLong;
@Autowired
TencentUtils tencentUtils;
@Autowired
RedisCache redisCache;
@Override
public void sendSmsPhoneVerCode(String phone) {
String redisKey = RedisKeys.UserKeys.PHONE_VER_CODE.getKey() + phone;
// 判断是否已获取
String verCodeOld = redisCache.get(redisKey);
if (StringUtils.isNotBlank(verCodeOld)){
throw new ParamException(RCode.TENCENT_SMS_REPETITION, null);
}
// 生成6位验证码
String phoneVerCode = DataUtils.phoneVerCode();
log.info("腾讯云短信,发送验证码:{}-{}", phone, phoneVerCode);
redisCache.addToMinute(redisKey, phoneVerCode, overdueLong);
boolean succss = tencentUtils.sendSmsPhoneVerCode(phone, phoneVerCode);
// boolean succss = true;
if (!succss) {
redisCache.removeKey(redisKey);
log.info("腾讯云短信发送失败:删除验证码:{}-{}", phone, phoneVerCode);
}
}
}
package com.wangxiaolu.promotion.service.wechat;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :微信信息操作
*/
public interface WeChatUserCoreService {
/**
* 保存促销员用户信息
*/
boolean saveWxUserInfoTemporary(WxTemporaryInfoDto temporaryDto);
}
package com.wangxiaolu.promotion.service.wechat;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
/**
* @author : liqiulin
* @date : 2024-04-09 18
* @describe :微信人员信息查询
*/
public interface WeChatUserQueryService {
boolean loginTemporaryByOpenIdAndPhone(String openId,String phone);
WxTemporaryInfoDto getTemporaryInfoByOpenIdAndPhone(String openId,String phone);
}
package com.wangxiaolu.promotion.service.wechat.impl;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.domain.user.dao.QinCeEmployeeDao;
import com.wangxiaolu.promotion.domain.user.dao.TemporaryInfoDao;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.wechat.WeChatUserCoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :微信用户信息操作
*/
@Slf4j
@Service
public class WeChatUserCoreServiceImpl implements WeChatUserCoreService {
@Autowired
TemporaryInfoDao temporaryInfoDao;
@Autowired
QinCeEmployeeDao qinCeEmployeeDao;
/**
* 保存促销员用户信息
*/
@Override
public boolean saveWxUserInfoTemporary(WxTemporaryInfoDto temporaryDto) {
// 根据chargerQcId查询人员详情
QinCeEmployeeDto qcEmpDto = qinCeEmployeeDao.selectOntByQcId(temporaryDto.getChargerQcId());
if (Objects.isNull(qcEmpDto)){
throw new ParamException(RCode.CHARGER_ID_ERROR,null);
}
temporaryDto.setChargerName(qcEmpDto.getEmpName());
int saveId = temporaryInfoDao.saveWxTemporaryInfo(temporaryDto);
log.info("微信-促销员[{}]:[{}]注册成功:{}", saveId, temporaryDto.getName(), JSONObject.toJSONString(temporaryDto));
return saveId > 0;
}
}
package com.wangxiaolu.promotion.service.wechat.impl;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.domain.user.dao.TemporaryInfoDao;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.wechat.WeChatUserQueryService;
import com.wangxiaolu.promotion.utils.JwtUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-04-09 18
* @describe :微信人员信息查询
*/
@Service
public class WeChatUserQueryServiceImpl implements WeChatUserQueryService {
private static final Logger log = LoggerFactory.getLogger(WeChatUserQueryServiceImpl.class);
@Autowired
TemporaryInfoDao temporaryInfoDao;
@Autowired
RedisCache redisCache;
@Autowired
JwtUtils jwtUtils;
/**
* 根据openId、手机号登录
*/
@Override
public boolean loginTemporaryByOpenIdAndPhone(String openId, String phone) {
WxTemporaryInfoDto temDto = temporaryInfoDao.getUnimportantData(openId, phone);
boolean exist = !Objects.isNull(temDto);
if (exist) {
log.info("微信-促销员{}登录成功(openId、手机号),openId:{},phone:{}", temDto.getName(), openId, phone);
log.info(JSONObject.toJSONString(temDto));
} else {
log.info("微信-促销员登录失败,当前信息未注册(openId、手机号),openId:{},phone:{}", openId, phone);
}
return exist;
}
@Override
public WxTemporaryInfoDto getTemporaryInfoByOpenIdAndPhone(String openId, String phone) {
return temporaryInfoDao.getUnimportantData(openId, phone);
}
}
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论