提交 0376ab51 authored 作者: 李秋林's avatar 李秋林

添加日志

上级 8628ecf9
......@@ -162,6 +162,15 @@
<version>4.4.0</version>
</dependency>
<!-- 腾讯云-短信服务SDK-->
<!-- go to https://search.maven.org/search?q=tencentcloud-sdk-java and get the latest version. -->
<!-- 请到https://search.maven.org/search?q=tencentcloud-sdk-java查询所有版本,最新版本如下 -->
<!-- <dependency>-->
<!-- <groupId>com.tencentcloudapi</groupId>-->
<!-- <artifactId>tencentcloud-sdk-java</artifactId>-->
<!-- <version>3.1.1000</version>-->
<!-- </dependency>-->
</dependencies>
<build>
......
package com.wangxiaolu.promotion.controller.activity.temporary;
import com.alibaba.fastjson.JSONObject;
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.vo.TemporaryActivityDataVo;
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;
......@@ -14,11 +13,9 @@ 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;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Objects;
......@@ -84,10 +81,14 @@ public class TemporaryActivityCoreController {
return tempActivityCoreService.activityDataReportedSave(temActDto);
}
/**
* todo 促销员[今日活动]数据提交审批
* 促销员[今日活动]数据提交审批
* 修改审批状态
*/
@PutMapping("/reported/approve/{reported_id}")
public void activityReportedUpdateApproveStatus(@PathVariable("reported_id") @NotNull Long id) {
tempActivityCoreService.activityReportedUpdateApproveStatus(id);
}
// 上班打卡
......
......@@ -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.tengxunyun;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author : liqiulin
* @date : 2024-04-15 11
* @describe : 对接腾讯云接口
* 如:腾讯云短信
* @date : 2024-05-15 15
* @describe :调用腾讯云短信
*/
@Slf4j
@RestController
@RequestMapping("/tencent")
public class TencentCoreController {
@RequestMapping("/user/tencent/sms")
public class UserSendSms {
@Autowired
TencentCoreService tencentCoreService;
......@@ -31,7 +28,7 @@ public class TencentCoreController {
/**
* 腾讯云短信
*/
@PostMapping("/send/sms/ver_code")
@PostMapping("/send/ver_code")
public void sendSms(@RequestBody Map<String, String> phoneInfo) {
String phone = phoneInfo.get("phone");
if (StringUtils.isEmpty(phone) || !DataUtils.phonePattern(phone)) {
......
......@@ -7,6 +7,7 @@ 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.*;
......@@ -43,6 +44,11 @@ public class WeChatUserQueryController {
*/
@PostMapping("/temporary/phone_openid")
public WxTemporaryInfoDto getTemporaryInfoByOpenIdAndPhone(@RequestBody WxTemporaryLoginVo wxTemporaryLoginVo) {
// todo 上线开放
// if (StringUtils.isBlank(wxTemporaryLoginVo.getOpenId()) || StringUtils.isBlank(wxTemporaryLoginVo.getPhone()) ){
// throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
// }
WxTemporaryInfoDto temporaryInfoDto = weChatUserQueryService.getTemporaryInfoByOpenIdAndPhone(wxTemporaryLoginVo.getOpenId(), wxTemporaryLoginVo.getPhone());
if (Objects.isNull(temporaryInfoDto)) {
throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
......
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.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);
}
}
......@@ -92,6 +92,9 @@ public class TemporaryActivityReportedDaoImpl implements TemporaryActivityReport
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);
}
......
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.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.user.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
/**
* @author : liqiulin
......@@ -13,4 +14,9 @@ public interface QinCeEmployeeDao {
* 勤策人员数据同步
*/
void employeeSyncTask(JSONArray responseDatas);
/**
* 根据勤策ID查询人员信息
*/
QinCeEmployeeDto selectOntByQcId(String qcId);
}
......@@ -23,4 +23,6 @@ public interface TemporaryInfoDao {
* 根据OpenId、phone查询人员是否存在(非保密信息)
*/
WxTemporaryInfoDto getUnimportantData(String openId,String phone);
WxTemporaryInfoDto selectOneById(Integer id);
}
......@@ -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;
}
}
......@@ -48,6 +48,12 @@ public class TemporaryInfoDaoImpl implements TemporaryInfoDao {
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())){
......
......@@ -43,35 +43,30 @@ public class TemporaryInfoDO implements Serializable {
private String openId;
/**
* 头像url
* 此促销员的任务人-勤策id
*/
private String avatarUrl;
String chargerQcId;
/**
* 头像云存储id
* 此促销员的任务人姓名
*/
private String avatarUrlFieldId;
String chargerName;
/**
* 身份证正面url
* 头像url
*/
private String idenFrontPhotoUrl;
private String avatarUrl;
/**
* 身份证正面云存储id
* 身份证正面url
*/
private String idenFrontPhotoFieldId;
private String idenFrontPhotoUrl;
/**
* 身份证反面url
*/
private String idenReversePhotoUrl;
/**
* 身份证反面云存储id
*/
private String idenReversePhotoFieldId;
/**
* 创建时间
*/
......
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.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;
}
......@@ -33,12 +33,6 @@ public class WxTemporaryInfoDto {
*/
String avatarUrl;
/**
* 头像云存储文件id
*/
String avatarUrlFieldId;
/**
* 姓名
*/
......@@ -59,21 +53,11 @@ public class WxTemporaryInfoDto {
*/
String idenFrontPhotoUrl;
/**
* 身份证正面照
*/
String idenFrontPhotoFieldId;
/**
* 身份证反面照
*/
String idenReversePhotoUrl;
/**
* 身份证反面照
*/
String idenReversePhotoFieldId;
/**
* 详细地址
*/
......@@ -82,5 +66,14 @@ public class WxTemporaryInfoDto {
/**
* 创建时间
*/
private Date createTime;
Date createTime;
/**
* 此促销员的任务人-勤策id
*/
String chargerQcId;
/**
* 此促销员的任务人姓名
*/
String chargerName;
}
......@@ -30,12 +30,6 @@ public class WxTemporaryEnrollVo {
@NotBlank(message = "请上传头像")
String avatarUrl;
/**
* 头像云存储文件id
*/
String avatarUrlFieldId;
/**
* 姓名
*/
......@@ -60,24 +54,12 @@ public class WxTemporaryEnrollVo {
@NotBlank(message = "请上传身份证正面照")
String idenFrontPhotoUrl;
/**
* 身份证正面照
*/
@NotBlank(message = "请上传身份证正面照")
String idenFrontPhotoFieldId;
/**
* 身份证反面照
*/
@NotBlank(message = "请上传身份证反面照")
String idenReversePhotoUrl;
/**
* 身份证反面照
*/
@NotBlank(message = "请上传身份证反面照")
String idenReversePhotoFieldId;
/**
* 详细地址
*/
......@@ -90,21 +72,9 @@ public class WxTemporaryEnrollVo {
String phoneCode;
// 暂时用不到的参数
/**
* js传过来的临时登录code
*/
// @NotBlank(message = "微信登录凭证错误")
// String jsCode;
/**
* 用户信息的加密文字
*/
// String encryptedData;
/**
* 标识
* 此促销员的任务人-勤策id
*/
// String iv;
String chargerQcId = "8453472204758793216";
}
......@@ -60,6 +60,9 @@ public class ControllerExceptionAdvice {
@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);
}
}
......@@ -25,6 +25,7 @@ public enum RCode implements StatusCode {
API_ERROR(2000, "业务异常"),
API_DATA_ERROR(2001, "业务数据异常"),
DATA_HAVE_ERROR(2002, "数据已存在,不可新增"),
STATUS_UPDATE_ERROR(2003, "当前状态不可修改"),
/**
* user
......@@ -37,6 +38,7 @@ public enum RCode implements StatusCode {
LOGIN_USER_IS_NULL_ERROR(3004, "账号未注册"),
CLOCK_DETAIL_ERROR(3005, "打卡信息错误"),
CLOCK_DETAIL_TIME_ERROR(3006, "不在打卡时间范围内"),
CHARGER_ID_ERROR(3007, "未找到负责人"),
/**
* 腾讯云
......
......@@ -12,8 +12,6 @@ public interface TemporaryActivityCoreService {
/**
* 活动上报保存
*
* @return 生成id
*/
long activityDataReportedSave(TemporaryActivityReportedDto temActDto);
......@@ -27,4 +25,8 @@ public interface TemporaryActivityCoreService {
*/
void clockInTodayActivity(TemporaryClockDto dto, Integer clockType);
/**
* 活动上报数据修改审批状态
*/
void activityReportedUpdateApproveStatus(Long id);
}
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.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
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;
......@@ -43,6 +47,12 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe
@Autowired
private TemporaryActivityPhotoDao tempActivityPhotoDao;
@Autowired
private TemporaryActivityLogDao tempActivityLogDao;
@Autowired
private TemporaryInfoDao temporaryInfoDao;
/**
* 活动上报保存
......@@ -52,27 +62,28 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe
@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查询店铺信息
// 根据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;
}
......@@ -80,16 +91,20 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe
* 活动信息修改
* 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());
......@@ -100,6 +115,37 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe
}
// 根据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 activityReportedUpdateApproveStatus(Long id) {
// 判断此id任务是否存在,并且是否满足提交审批条件
TemporaryActivityReportedDto reportedDto = temporaryActivityReportedDao.findOneById(id);
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);
}
/**
......
......@@ -44,7 +44,8 @@ public class TencentCoreServiceImpl implements TencentCoreService {
log.info("腾讯云短信,发送验证码:{}-{}", phone, phoneVerCode);
redisCache.addToMinute(redisKey, phoneVerCode, overdueLong);
// todo boolean succss = tencentUtils.sendSmsPhoneVerCOde(phone, phoneVerCode);
// todo 上线开放
// boolean succss = tencentUtils.sendSmsPhoneVerCode(phone, phoneVerCode);
boolean succss = true;
if (!succss) {
redisCache.removeKey(redisKey);
......
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
......@@ -20,11 +26,20 @@ 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;
......
......@@ -53,7 +53,7 @@ public class TencentUtils {
*
* @param phone 手机号(1个)
*/
public boolean sendSmsPhoneVerCOde(String phone, String phoneVerCode) {
public boolean sendSmsPhoneVerCode(String phone, String phoneVerCode) {
String signName = signNameA;
String templateId = templateIdA;
......@@ -62,7 +62,7 @@ public class TencentUtils {
SendSmsResponse res = sendSms(templateParamSet, phoneNumberSet, signName, templateId);
SendStatus sendStatus = res.getSendStatusSet()[0];
if (StringUtils.isBlank(sendStatus.getCode()) || !sendStatus.getCode().contains("OK")) {
if (StringUtils.isBlank(sendStatus.getCode()) || !sendStatus.getCode().contains("Ok")) {
return false;
}
return true;
......
......@@ -38,6 +38,7 @@ wx:
token_secret: sXwHPj#U#xmim^ts
tengxunyun:
# 腾讯云个人账号信息
secret_d: AKIDVt353sWyY0GXn0ANa0YyGdwDIBtjQwGS
secret_key: SBqJcrxypSxeGOPF81mLgsANXo3ALhz7
sms:
......@@ -47,9 +48,9 @@ tengxunyun:
ap_beijing: ap-beijing
#应用ID(默认应用)
sdk_app_id_defult: 1400903035
#模板名称-手机验证码
#签名内容
sign_name_a: 北京王小卤
#模板ID-手机验证码
#模板ID
template_id_a: 2127434
#验证码过期时间(分钟)
overdue_long: 5
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wangxiaolu.promotion.domain.activity.mapper.TemporaryActivityLogMapper">
<resultMap id="BaseResultMap" type="com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityLogDO">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="temporaryId" column="temporary_id" jdbcType="INTEGER"/>
<result property="dataDetail" column="data_detail" jdbcType="OTHER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,temporary_id,data_detail,
create_time
</sql>
</mapper>
package com.wangxiaolu.promotion.controller.tengxunyun;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.HashMap;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author : liqiulin
* @date : 2024-04-15 14
* @describe :
*/
@SpringBootTest
@RunWith(SpringRunner.class)
class TencentCoreControllerTest {
@Autowired
TencentCoreController tencentCoreController;
@Test
void sendSms() {
Map<String,String> phoneInfo = new HashMap<>();
phoneInfo.put("phone","15701654502");
tencentCoreController.sendSms(phoneInfo);
}
}
\ No newline at end of file
......@@ -29,12 +29,9 @@ class WeChatUserCoreControllerTest {
.setAvatarUrl("头像Url")
.setName("姓名")
.setPhone("手机号")
.setAvatarUrlFieldId("avatarUrlFieldId")
.setIdenNumber("身份证号")
.setIdenFrontPhotoUrl("身份证正面照")
.setIdenFrontPhotoFieldId("身份证正面照Id")
.setIdenReversePhotoUrl("身份证反面照")
.setIdenReversePhotoFieldId("身份证反面照Id")
.setPhoneCode("手机验证码")
;
System.out.println(JSONObject.toJSONString(vo));
......
package com.wangxiaolu.promotion.utils;
import com.alibaba.fastjson.JSONObject;
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
import com.tencentcloudapi.sms.v20210111.models.SendStatus;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author : liqiulin
* @date : 2024-05-15 15
* @describe :
*/
@SpringBootTest
@RunWith(SpringRunner.class)
class TencentUtilsTest {
@Autowired
TencentUtils tencentUtils;
@Test
void sendSmsPhoneVerCOde() {
// boolean b = tencentUtils.sendSmsPhoneVerCOde("15701654502", "345123");
// System.out.println("短信发送结果:" + b);
}
public static void main(String[] args) {
SendSmsResponse res = JSONObject.parseObject("{\"SendStatusSet\":[{\"SerialNo\":\"9319:154810136917157576005565450\",\"PhoneNumber\":\"+8615701654502\",\"Fee\":1,\"SessionContext\":\"\",\"Code\":\"Ok\",\"Message\":\"send success\",\"IsoCode\":\"CN\"}],\"RequestId\":\"d962f019-1228-4cb3-aa35-6d7b8c7a716b\"}\n",SendSmsResponse.class);
SendStatus sendStatus = res.getSendStatusSet()[0];
if (StringUtils.isBlank(sendStatus.getCode()) || !sendStatus.getCode().contains("Ok")) {
System.out.println(false);
}
System.out.println(true);
}
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论