提交 0bab8044 authored 作者: 000516's avatar 000516 提交者: Coding

打卡照片更改,选择商品类型可根据69码扫描,同步勤策数据到表

发版功能 1. 前端-打卡照片更改 2. 前端-选择商品类型可根据69码扫描 3. 后端-打卡照片更改且记录更改时间 4. 后端-根据69码查询SKU明细 5. 后端-同步勤策数据到表
package com.wangxiaolu.promotion.controller.activity.temporary;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.enums.activity.ClockType;
......@@ -12,11 +14,10 @@ import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityClockCoreService;
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.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.Date;
import java.util.Objects;
......@@ -34,7 +35,7 @@ public class TemporaryActivityClockCoreController {
@Autowired
private TemporaryActivityClockCoreService tempActivityClockCoreService;
@Autowired
RedisCache redisCache;
private RedisCache redisCache;
/**
* 促销员当日打卡信息保存
......@@ -75,6 +76,31 @@ public class TemporaryActivityClockCoreController {
return R.success();
}
/**
* 打卡照片更换
* @param clockVo 更换照片信息
* @return 是否成功
*/
@PutMapping("/today/clock/update")
public R updateClockPhoto(@RequestBody TemporaryClockVo clockVo) {
if (Objects.isNull(clockVo.getTemporaryId()) ||clockVo.getTemporaryId()<=0){
throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
}
if (StringUtils.isBlank(clockVo.getClockPhoto())){
throw new ParamException(RCode.PHOTO_IS_NULL_ERROR, null);
}
long minuteBetween = DateUtil.between(clockVo.getLastClockTime(), new Date(), DateUnit.MINUTE);
if (minuteBetween > 30){
throw new ParamException(RCode.UPDATE_CLOCK_PHOTO_TIME_LONG_ERROR, null);
}
TemporaryClockDto dto = new TemporaryClockDto(clockVo.getId(),clockVo.getTemporaryId(),clockVo.getClockPhoto(),clockVo.getPhotoType());
tempActivityClockCoreService.updateClockPhoto(dto);
return R.success();
}
/**
* redis打卡-限制重复提交
*/
......
package com.wangxiaolu.promotion.controller.user.qince;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.CascadeVo;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductInfoDto;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductTypeDto;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.user.QinCeProductQueryService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-06-19 17
* @describe :
* @describe : 商品信息查询
*/
@RestController
@RequestMapping("/user/qince/query")
......@@ -24,18 +30,37 @@ public class QinCeProductQueryController {
QinCeProductQueryService qinCeProductQueryService;
@PostMapping("/product/type/list")
public R findProductTypeList(){
public R findProductTypeList() {
List<QinceProductTypeDto> dtos = qinCeProductQueryService.findProductTypeList();
return R.success(dtos);
}
/**
* 级联选择
*
* @return
*/
@PostMapping("/product/cascade")
public R findProductCascade(){
public R findProductCascade() {
List<CascadeVo> dtos = qinCeProductQueryService.findProductCascade();
return R.success(dtos);
}
/**
* 根据69码选择商品
*/
@GetMapping("/product/info")
public R findProductInfo(QinceProductInfoDto params) {
if (StringUtils.isBlank(params.getPrdSpec())) {
throw new ParamException(RCode.BAR_CODE_IS_ERROR, null);
}
QinceProductInfoDto productInfo = qinCeProductQueryService.findProductInfo(params);
if (Objects.isNull(productInfo)) {
throw new ParamException(RCode.BAR_CODE_IS_ERROR, null);
}
return R.success(productInfo);
}
}
......@@ -32,5 +32,4 @@ public interface TemporaryActivityClockDao {
* 员工查询负责的促销员打卡信息(分页查询)
*/
void employeePage(String employeeQcId, PageInfo pageInfo,TemporaryClockWrapper tcw);
}
......@@ -10,5 +10,4 @@ import com.wangxiaolu.promotion.enums.activity.LogType;
public interface TemporaryActivityLogDao {
void save(Integer temporaryId, String temporaryName, LogType typeE, Long flowDataId, Object logObj);
}
package com.wangxiaolu.promotion.domain.activity.dao;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryPhotoWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityPhotoDto;
import java.util.List;
import java.util.Map;
......@@ -25,5 +28,9 @@ public interface TemporaryActivityPhotoDao {
*/
Map<Integer, List<String>> findReportedGroup(Integer temporaryId, Long reportedId);
Map<Integer, String> findClockPhotoGroupByClockId(Long clockId);
Map<Integer, TemporaryActivityPhotoDto> findClockPhotoGroupByClockId(Long clockId);
void updateStatus(TemporaryPhotoWrapper pw, int status);
void saveClockPhotoByUpdate(Integer temporaryId, Long id, Integer photoType, String url);
}
......@@ -71,25 +71,54 @@ public class PromotionStoreDaoImpl implements PromotionStoreDao {
@Override
public void qinceShopDetailAllTask(JSONArray responseDatas) {
// for (Object responseData : responseDatas) {
// JSONObject jo = JSONObject.parseObject(JSONObject.toJSONString(responseData));
// try {
// PromotionStoreDO storeDo = new PromotionStoreDO();
// storeDo.setQcId(jo.getString("id"))
// .setStoreName(jo.getString("store_name"))
// .setProvince(jo.getString("store_mss_province"))
// .setCity(jo.getString("store_mss_city"))
// .setArea(jo.getString("store_mss_area"))
// .setStreet(jo.getString("store_mss_street"))
// .setAddress(jo.getString("store_addr"))
// .setTemporaryId(0)
// .setTemporaryName("系统同步");
// promotionStoreMapper.insert(storeDo);
// } catch (Exception e) {
// log.error("勤策-同步终端store数据异常,异常数据:{}", responseData);
// log.error("勤策-同步终端store数据异常\n{}", e.getMessage());
// }
// }
LambdaQueryWrapper<PromotionStoreDO> qw = new LambdaQueryWrapper<>();
for (Object responseData : responseDatas) {
qw.clear();
try {
JSONObject jo = JSONObject.parseObject(JSONObject.toJSONString(responseData));
PromotionStoreDO storeDo = new PromotionStoreDO();
storeDo.setQcId(jo.getString("id"))
.setStoreName(jo.getString("store_name"))
.setProvince(jo.getString("store_mss_province"))
.setCity(jo.getString("store_mss_city"))
.setArea(jo.getString("store_mss_area"))
.setStreet(jo.getString("store_mss_street"))
.setAddress(jo.getString("store_addr"))
.setTemporaryId(0)
.setTemporaryName("系统同步")
.setStoreManager(jo.getString("store_manager"))
.setStoreManagerWaiqin365Id(jo.getString("store_manager_waiqin365_id"));
if (StringUtils.isBlank(storeDo.getQcId())) {
continue;
}
JSONArray dealersJR = jo.getJSONArray("dealers");
if (!CollectionUtils.isEmpty(dealersJR)) {
JSONObject dealersJ = dealersJR.getJSONObject(0);
storeDo.setDealersName(dealersJ.getString("dealer_name"))
.setWaiqin365DealersId(dealersJ.getString("waiqin365_dealer_id"));
}
// 判断qc_id是否存在;存在则修改,不存在则新增
qw.eq(PromotionStoreDO::getQcId, storeDo.getQcId());
PromotionStoreDO doExist = promotionStoreMapper.selectOne(qw);
if (Objects.isNull(doExist)) {
promotionStoreMapper.insert(storeDo);
} else {
storeDo.setId(doExist.getId());
promotionStoreMapper.updateById(storeDo);
}
} catch (Exception e) {
log.error("勤策-同步终端到促销店铺数据异常,异常数据:{}", responseData);
log.error("勤策-同步终端到促销店铺数据异常\n{}", e.getMessage());
}
}
}
@Override
......
......@@ -4,15 +4,18 @@ 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 com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryPhotoWrapper;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityPhotoDto;
import com.wangxiaolu.promotion.result.basedata.RCode;
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.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -62,21 +65,35 @@ public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao
}
}
/**
* 保存促销员上下班打卡图片
*/
@Override
public void saveClockPhoto(Integer temporaryId, Long clockId, Integer photoType, String url) {
saveClockPhoto(temporaryId, clockId, photoType, url, null);
}
@Override
public void saveClockPhotoByUpdate(Integer temporaryId, Long id, Integer photoType, String url) {
saveClockPhoto(temporaryId, id, photoType, url, true);
}
private void saveClockPhoto(Integer temporaryId, Long clockId, Integer photoType, String url, Boolean isUpdate) {
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);
if (Objects.nonNull(isUpdate) && isUpdate) {
photoDo.setUpdateTime(new Date());
}
temporaryActivityPhotoMapper.insert(photoDo);
log.info("保存促销员打卡图片:{}", photoDo);
}
/**
* 活动上报图片查询
*
......@@ -102,11 +119,68 @@ public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao
* @return 分组结果
*/
@Override
public Map<Integer, String> findClockPhotoGroupByClockId(Long clockId) {
public Map<Integer, TemporaryActivityPhotoDto> 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;
List<TemporaryActivityPhotoDto> photoDtos = transitionDtos(dos);
Map<Integer, TemporaryActivityPhotoDto> dtoMap = photoDtos.stream().collect(Collectors.toMap(TemporaryActivityPhotoDto::getType, pDto -> pDto));
// Map<Integer, String> map = dos.stream().collect(Collectors.toMap(TemporaryActivityPhotoDO::getType, TemporaryActivityPhotoDO::getPhotoUrl));
return dtoMap;
}
@Override
public void updateStatus(TemporaryPhotoWrapper pw, int status) {
LambdaQueryWrapper<TemporaryActivityPhotoDO> qw = builderWrapper(pw);
if (qw.isEmptyOfWhere()) {
throw new ParamException(RCode.CLOCK_DETAIL_ERROR, null);
}
TemporaryActivityPhotoDO photoDO = new TemporaryActivityPhotoDO()
.setIsDelete(status);
temporaryActivityPhotoMapper.update(photoDO, qw);
}
private LambdaQueryWrapper<TemporaryActivityPhotoDO> builderWrapper(TemporaryPhotoWrapper pw) {
LambdaQueryWrapper<TemporaryActivityPhotoDO> wq = new LambdaQueryWrapper<>();
if (!Objects.isNull(pw.getClockId())) {
wq.eq(TemporaryActivityPhotoDO::getClockId, pw.getClockId());
}
if (!Objects.isNull(pw.getType())) {
wq.eq(TemporaryActivityPhotoDO::getType, pw.getType());
}
if (!Objects.isNull(pw.getTemporaryId()) && pw.getTemporaryId() > 0) {
wq.eq(TemporaryActivityPhotoDO::getTemporaryId, pw.getTemporaryId());
}
return wq;
}
/**
* DO to DTO (单个对象)
*
* @param photoDos DO对象List
* @return DTO对象
*/
private List<TemporaryActivityPhotoDto> transitionDtos(List<TemporaryActivityPhotoDO> photoDos) {
if (CollectionUtils.isEmpty(photoDos)) {
return new ArrayList<>();
}
List<TemporaryActivityPhotoDto> dtos = new ArrayList<>(photoDos.size() * 2);
for (TemporaryActivityPhotoDO photoDo : photoDos) {
dtos.add(transitionDto(photoDo));
}
return dtos;
}
private TemporaryActivityPhotoDto transitionDto(TemporaryActivityPhotoDO photoDo) {
TemporaryActivityPhotoDto dto = null;
if (Objects.isNull(photoDo)) {
return dto;
}
dto = new TemporaryActivityPhotoDto();
BeanUtils.copyProperties(photoDo, dto);
return dto;
}
}
......@@ -108,6 +108,26 @@ public class PromotionStoreDO implements Serializable {
*/
private String chargerName;
/**
* 门店经理
*/
private String storeManager;
/**
* 门店经理勤策id
*/
private String storeManagerWaiqin365Id;
/**
* 经销商名称
*/
private String dealersName;
/**
* 经销商勤策id
*/
private String waiqin365DealersId;
/**
* 创建时间
*/
......
......@@ -5,6 +5,8 @@ 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;
import lombok.experimental.Accessors;
......@@ -58,6 +60,11 @@ public class TemporaryActivityPhotoDO implements Serializable {
*/
private Integer isDelete;
/**
* 图片的创建时间,只是用来前端显示,所以用varchar不timestamp
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.wangxiaolu.promotion.domain.activity.wrapperQo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
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 TemporaryPhotoWrapper {
/**
* 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;
/**
* 是否删除
* 0:删除;1:可用
*/
private Integer isDelete;
}
......@@ -14,7 +14,7 @@ import java.util.List;
public interface QinCeClienteleStoreDao {
/**
* 勤策人员数据同步
* 勤策终端数据同步
*/
void shopDetailAllTask(JSONArray responseDatas);
......
......@@ -15,4 +15,5 @@ public interface QinceProductInfoDao {
List<QinceProductInfoDto> selectList();
QinceProductInfoDto selectOne(QinceProductInfoDto params);
}
......@@ -45,6 +45,14 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
try {
QinCeClienteleStoreDO qinCeShopDO = JSONObject.parseObject(responseData.toString(), QinCeClienteleStoreDO.class);
// 添加经销商
List<JSONObject> dealers = qinCeShopDO.getDealers();
if (!CollectionUtils.isEmpty(dealers)){
qinCeShopDO.setDealersName(dealers.get(0).getString("dealer_name"));
qinCeShopDO.setWaiqin365DealersId(dealers.get(0).getString("waiqin365_dealer_id"));
}
qw.eq(QinCeClienteleStoreDO::getQcId, qinCeShopDO.getQcId());
QinCeClienteleStoreDO doExist = qinCeClienteleStoreMapper.selectOne(qw);
......@@ -58,7 +66,6 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
log.error("勤策-同步终端store数据异常,异常数据:{}", responseData);
log.error("勤策-同步终端store数据异常\n{}", e.getMessage());
}
}
......
......@@ -9,6 +9,7 @@ import com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductInfoDO;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductInfoDto;
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;
......@@ -59,14 +60,30 @@ public class QinceProductInfoDaoImpl implements QinceProductInfoDao {
@Override
public List<QinceProductInfoDto> selectList() {
LambdaQueryWrapper<QinceProductInfoDO> qw = new LambdaQueryWrapper<>();
qw.eq(QinceProductInfoDO::getSaleStatus,1).eq(QinceProductInfoDO::getStatus,1).ne(QinceProductInfoDO::getClassName,"")
.select(QinceProductInfoDO::getClassId,QinceProductInfoDO::getClassName,QinceProductInfoDO::getPrdId,QinceProductInfoDO::getPrdName);
LambdaQueryWrapper<QinceProductInfoDO> qw = buildWrapper(new QinceProductInfoDto());
List<QinceProductInfoDO> qinceProductInfoDOS = qinceProductInfoMapper.selectList(qw);
return transitionDtos(qinceProductInfoDOS);
}
@Override
public QinceProductInfoDto selectOne(QinceProductInfoDto params) {
LambdaQueryWrapper<QinceProductInfoDO> qw = buildWrapper(params);
QinceProductInfoDO qinceProductInfoDO = qinceProductInfoMapper.selectOne(qw);
return transitionDto(qinceProductInfoDO);
}
private LambdaQueryWrapper<QinceProductInfoDO> buildWrapper(QinceProductInfoDto params) {
LambdaQueryWrapper<QinceProductInfoDO> qw = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(params.getPrdSpec())) {
qw.eq(QinceProductInfoDO::getPrdSpec, "条码" + params.getPrdSpec());
}
qw.eq(QinceProductInfoDO::getSaleStatus, 1).eq(QinceProductInfoDO::getStatus, 1).ne(QinceProductInfoDO::getClassName, "");
qw.select(QinceProductInfoDO::getClassId, QinceProductInfoDO::getClassName, QinceProductInfoDO::getPrdId, QinceProductInfoDO::getPrdName);
return qw;
}
/**
* DO to DTO (单个对象)
*
......
......@@ -37,7 +37,7 @@ public class QinceProductTypeDaoImpl implements QinceProductTypeDao {
for (Object responseData : responseDatas) {
qw.clear();
// 查询人员是否存在
// 查询商品是否存在
QinceProductTypeDO qcDo = JSONObject.parseObject(JSONObject.toJSONString(responseData), QinceProductTypeDO.class);
qw.eq(QinceProductTypeDO::getPrdWaiqin365Id, qcDo.getPrdWaiqin365Id());
QinceProductTypeDO doExist = qinceProductTypeMapper.selectOne(qw);
......
package com.wangxiaolu.promotion.domain.user.mapper.entity;
import com.alibaba.fastjson.JSONObject;
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 java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
......@@ -503,6 +505,20 @@ public class QinCeClienteleStoreDO implements Serializable {
@JsonProperty("store_approval_status")
private String storeApprovalStatus;
/**
* 经销商名称
*/
private String dealersName;
/**
* 经销商勤策id
*/
private String waiqin365DealersId;
@TableField(exist = false)
@JsonProperty("dealers")
private List<JSONObject> dealers;
/**
* 门店删除状态。0:删除,1:正常
*/
......
package com.wangxiaolu.promotion.pojo.activity.temporary.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName temporary_activity_photo
*/
@Data
@Accessors(chain = true)
public class TemporaryActivityPhotoDto implements Serializable {
/**
* 主键id
*/
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;
/**
* 图片的创建时间,只是用来前端显示,所以用varchar不timestamp
*/
private Date updateTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -47,6 +47,8 @@ public class TemporaryClockDto {
// 上班打卡图片
String clockInPhoto;
Date clockInPhotoUpdateTime;
// 上班打卡时间
Date clockInTime;
......@@ -65,6 +67,8 @@ public class TemporaryClockDto {
// 午休下班打卡图片
String noonClockOutPhoto;
Date noonClockOutPhotoUpdateTime;;
// 午休下班打卡时间
Date noonClockOutTime;
......@@ -77,6 +81,8 @@ public class TemporaryClockDto {
// 午休上班打卡图片
String noonClockInPhoto;
Date noonClockInPhotoUpdateTime;
// 午休上班打卡时间
Date noonClockInTime;
......@@ -89,11 +95,13 @@ public class TemporaryClockDto {
// 下班打卡图片
String clockOutPhoto;
Date clockOutPhotoUpdateTime;
// 下班打卡时间
Date clockOutTime;
// 创建日期YYYY-MM-DD
private String createDate;
String createDate;
/**
* 所属战区-部门
......@@ -111,6 +119,12 @@ public class TemporaryClockDto {
// 活动模式
String activityPattern;
// 临时打卡图片
String brevityClockPhoto;
// 临时打卡类型
Integer brevityClockType;
public TemporaryClockDto(Integer clockType, Long id, Integer temporaryId, String temporaryName, String clockProvince, String clockCity) {
if (!ClockType.TEMPORARY_CLOCK_IN.equals(clockType)) {
this.id = id;
......@@ -120,4 +134,11 @@ public class TemporaryClockDto {
this.clockProvince = clockProvince;
this.clockCity = clockCity;
}
public TemporaryClockDto(Long id, Integer temporaryId, String brevityClockPhoto, Integer brevityClockType) {
this.id = id;
this.temporaryId = temporaryId;
this.brevityClockPhoto = brevityClockPhoto;
this.brevityClockType = brevityClockType;
}
}
package com.wangxiaolu.promotion.pojo.activity.temporary.vo;
import com.wangxiaolu.promotion.enums.activity.ActivityPhotoType;
import com.wangxiaolu.promotion.enums.activity.ClockType;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.result.basedata.RCode;
import lombok.AllArgsConstructor;
......@@ -11,6 +13,7 @@ import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Objects;
/**
......@@ -68,6 +71,11 @@ public class TemporaryClockVo {
// 活动模式
String activityPattern;
/**
* 修改时用到,上次打卡时间
*/
Date lastClockTime;
public void validate(){
if (Objects.isNull(clockType) || !(clockType >= 1 && clockType <= 4)){
......@@ -84,4 +92,16 @@ public class TemporaryClockVo {
}
}
public Integer getPhotoType() {
if (ClockType.TEMPORARY_CLOCK_IN.equals(clockType)) {
return ActivityPhotoType.CLOCK_IN.getType();
} else if (ClockType.TEMPORARY_NOON_CLOCK_OUT.equals(clockType)) {
return ActivityPhotoType.NOON_CLOCK_OUT.getType();
} else if (ClockType.TEMPORARY_NOON_CLOCK_IN.equals(clockType)) {
return ActivityPhotoType.NOON_CLOCK_IN.getType();
} else if (ClockType.TEMPORARY_CLOCK_OUT.equals(clockType)) {
return ActivityPhotoType.CLOCK_OUT.getType();
}
throw new ParamException(RCode.PHOTO_IS_NULL_ERROR, null);
}
}
package com.wangxiaolu.promotion.service.activity.temporary;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryClockVo;
/**
* @author : liqiulin
......@@ -21,4 +22,6 @@ public interface TemporaryActivityClockCoreService {
* @param clockCoordinates 打卡经纬度
*/
void clockStoreCalDistance(String storeQcId, Long id, String clockCoordinates);
void updateClockPhoto(TemporaryClockDto dto);
}
......@@ -4,11 +4,13 @@ import com.alibaba.fastjson.JSONObject;
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.wrapperQo.TemporaryPhotoWrapper;
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.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryClockVo;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityClockCoreService;
import com.wangxiaolu.promotion.utils.OkHttp;
......@@ -77,6 +79,20 @@ public class TemporaryActivityClockCoreServiceImpl implements TemporaryActivityC
// clockStoreCalDistanceByStoreQcId(storeQcId, clockCoordinates);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void updateClockPhoto(TemporaryClockDto dto) {
TemporaryPhotoWrapper pw = new TemporaryPhotoWrapper()
.setType(dto.getBrevityClockType())
.setClockId(dto.getId())
.setTemporaryId(dto.getTemporaryId());
// 根据id、type修改照片删除状态
tempActivityPhotoDao.updateStatus(pw,0);
// 将照片新增到表
tempActivityPhotoDao.saveClockPhotoByUpdate(dto.getTemporaryId(),dto.getId(),dto.getBrevityClockType(),dto.getBrevityClockPhoto());
}
private void clockStoreCalDistanceByStoreQcId(String storeQcId, String clockCoordinates) {
// 查询组织架构参数、创建url
String[] clockCoordinateArr = clockCoordinates.split(",");
......
......@@ -3,8 +3,10 @@ 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.mapper.entity.TemporaryActivityPhotoDO;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryClockWrapper;
import com.wangxiaolu.promotion.enums.activity.ActivityPhotoType;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityPhotoDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityClockQueryService;
import lombok.extern.slf4j.Slf4j;
......@@ -67,11 +69,36 @@ public class TemporaryActivityClockQueryServiceImpl implements TemporaryActivity
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()));
Map<Integer, TemporaryActivityPhotoDto> photoGroup = temporaryActivityPhotoDao.findClockPhotoGroupByClockId(temporaryClockDto.getId());
// 上班打卡
TemporaryActivityPhotoDto clockInPhotoDto = photoGroup.get(ActivityPhotoType.CLOCK_IN.getType());
if (Objects.nonNull(clockInPhotoDto)){
temporaryClockDto.setClockInPhoto(clockInPhotoDto.getPhotoUrl());
temporaryClockDto.setClockInPhotoUpdateTime(clockInPhotoDto.getUpdateTime());
}
// 午休下班卡
TemporaryActivityPhotoDto noonClockOutPhotoDto = photoGroup.get(ActivityPhotoType.NOON_CLOCK_OUT.getType());
if (Objects.nonNull(noonClockOutPhotoDto)){
temporaryClockDto.setNoonClockOutPhoto(noonClockOutPhotoDto.getPhotoUrl());
temporaryClockDto.setNoonClockOutPhotoUpdateTime(noonClockOutPhotoDto.getUpdateTime());
}
// 午休上班卡
TemporaryActivityPhotoDto noonClockInPhotoDto = photoGroup.get(ActivityPhotoType.NOON_CLOCK_IN.getType());
if (Objects.nonNull(noonClockInPhotoDto)){
temporaryClockDto.setNoonClockInPhoto(noonClockInPhotoDto.getPhotoUrl());
temporaryClockDto.setNoonClockInPhotoUpdateTime(noonClockInPhotoDto.getUpdateTime());
}
// 下班卡
TemporaryActivityPhotoDto clockOutPhotoDto = photoGroup.get(ActivityPhotoType.CLOCK_OUT.getType());
if (Objects.nonNull(clockOutPhotoDto)){
temporaryClockDto.setClockOutPhoto(clockOutPhotoDto.getPhotoUrl());
temporaryClockDto.setClockOutPhotoUpdateTime(clockOutPhotoDto.getUpdateTime());
}
log.info("查询打卡记录{}的所有图片:{}", temporaryClockDto.getId(), photoGroup);
}
}
package com.wangxiaolu.promotion.service.user;
import com.wangxiaolu.promotion.pojo.CascadeVo;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductInfoDto;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductTypeDto;
import java.util.List;
......@@ -15,5 +16,6 @@ public interface QinCeProductQueryService {
List<CascadeVo> findProductCascade();
QinceProductInfoDto findProductInfo(QinceProductInfoDto params);
}
......@@ -83,6 +83,7 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
while (nextPage) {
i++;
nextPage = booleanshopDetailPage(i);
nextPage = false;
}
}
......@@ -121,7 +122,7 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
}
log.info("勤策-同步终端store数据,查询到第{}页数据「{}」条", pageNum, responseDatas.size());
// qinCeClienteleShopDao.shopDetailAllTask(responseDatas);
qinCeClienteleShopDao.shopDetailAllTask(responseDatas);
promotionStoreDao.qinceShopDetailAllTask(responseDatas);
return true;
}
......
......@@ -60,4 +60,9 @@ public class QinCeProductQueryServiceImpl implements QinCeProductQueryService {
return cascades;
}
@Override
public QinceProductInfoDto findProductInfo(QinceProductInfoDto params) {
return qinceProductInfoDao.selectOne(params);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论