提交 b64d27c2 authored 作者: 000516's avatar 000516 提交者: Coding

小程序0.1.0功能第二版发布

促销员注册添加所属战区、负责人 促销员手动录入店铺 上报活动数据时,sku销量动态添加、动态展示、在此基础上实现修改、删除功能 促销员手动录入店铺不可重复录入 促销员打卡不可重复打卡 勤策中的终端数据初始化到店铺(promotion_store)表中
......@@ -234,6 +234,12 @@
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
<version>${java-uuid-generator.version}</version>
</dependency>
</dependencies>
<build>
......
......@@ -16,7 +16,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
/**
* @author : liqiulin
* @date : 2024-03-28 17
* @describe : todo 自动封装
* @describe : 自动封装
*/
@RestControllerAdvice
public class ControllerResponseAdvice implements ResponseBodyAdvice<Object> {
......
......@@ -2,7 +2,7 @@ package com.wangxiaolu.promotion.controller.activity.employee;
import com.wangxiaolu.promotion.enums.activity.TemActApproveStatus;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.temporary.employee.vo.ApproveVO;
import com.wangxiaolu.promotion.pojo.activity.employee.vo.ApproveVO;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.employee.EmployeeCoreTemActivityService;
......
......@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.*;
/**
* @author : liqiulin
* @date : 2024-05-29 14
* @describe : 员工查询促销员活动上报信息
* @describe : 员工查询促销员打卡信息
*/
@Slf4j
@RestController
......
package com.wangxiaolu.promotion.controller.activity.temporary;
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.FlowException;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryClockVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.temporary.PromotionStoreCoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-06-18 13
* @describe : 店铺操作
*/
@Slf4j
@RestController
@RequestMapping("/activity/promotion/store/core")
public class PromotionStoreCoreController {
@Autowired
PromotionStoreCoreService promotionStoreCoreService;
@Autowired
RedisCache redisCache;
@PostMapping("/save")
public R saveStore(@RequestHeader("Authorization") String authorization, @RequestBody PromotionStoreDto promotionStoreDto) {
// 是否重复提交
repetitiveSaveStore(authorization);
// 在缓存中查询
JSONObject userJson = redisCache.getToJson(RedisKeys.UserKeys.TEMPORARY_TOKEN.getKey() + authorization);
promotionStoreDto.setTemporaryId(userJson.getInteger("id"));
promotionStoreDto.setTemporaryName(userJson.getString("name"));
promotionStoreDto.setDeptQcId(userJson.getString("deptQcId"));
promotionStoreDto.setDeptQcOrgName(userJson.getString("deptQcOrgName"));
promotionStoreDto.setChargerQcId(userJson.getString("chargerQcId"));
promotionStoreDto.setChargerName(userJson.getString("chargerName"));
promotionStoreCoreService.saveStore(promotionStoreDto);
return R.success();
}
private void repetitiveSaveStore(String authorization) {
String recordKey = RedisKeys.TemporaryKeys.TEMPORARY_SAVE_STORE_REPETITIVE.getKey() + authorization;
String record = redisCache.get(recordKey);
if (Objects.nonNull(record)) {
throw new FlowException(RCode.PROMOTION_STORE_SAVE_ERROR.getCode(), String.format(RCode.PROMOTION_STORE_SAVE_ERROR.getMsg(), "3"));
}
redisCache.addToJsonToMinute(recordKey, authorization, 3);
}
}
package com.wangxiaolu.promotion.controller.activity.temporary;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.PromotionStoreVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.activity.temporary.PromotionStoreQueryService;
import lombok.extern.slf4j.Slf4j;
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-06-18 15
* @describe :
*/
@Slf4j
@RestController
@RequestMapping("/activity/promotion/store/query")
public class PromotionStoreQueryController {
@Autowired
PromotionStoreQueryService promotionStoreQueryService;
/**
* 查询店铺列表:目前不分页
*/
@PostMapping("/list")
public R findStoreList(@RequestBody PromotionStoreVo promotionStoreVo){
List<PromotionStoreDto> storeDtos = promotionStoreQueryService.findStoreList(promotionStoreVo);
return R.success(storeDtos);
}
}
package com.wangxiaolu.promotion.controller.activity.temporary;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.enums.activity.ClockType;
import com.wangxiaolu.promotion.exception.FlowException;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryClockVo;
......@@ -8,9 +11,7 @@ import com.wangxiaolu.promotion.result.basedata.R;
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.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;
......@@ -31,17 +32,19 @@ public class TemporaryActivityClockCoreController {
@Autowired
private TemporaryActivityCoreService tempActivityCoreService;
@Autowired
RedisCache redisCache;
/**
* 促销员当日打卡信息保存
*/
@PostMapping("/today/clock")
public R clockInTodayActivity(@RequestBody @Validated TemporaryClockVo clockVo) {
public R clockInTodayActivity(@RequestBody TemporaryClockVo clockVo) {
clockVo.validate();
Integer clockType = clockVo.getClockType();
boolean isClockIn = ClockType.TEMPORARY_CLOCK_IN.equals(clockType);
// 上班卡必需有店铺id
if (isClockIn && StringUtils.isBlank(clockVo.getStoreQcId())) {
if (isClockIn && (Objects.isNull(clockVo.getStoreId()) || clockVo.getStoreId() <= 0)) {
throw new ParamException(RCode.CLOCK_DETAIL_ERROR, null);
}
// 非上班卡必需有打卡记录ID
......@@ -50,16 +53,13 @@ public class TemporaryActivityClockCoreController {
}
// 根据打卡经纬度判断与打卡店铺的距离,距离超过100米不能打卡
tempActivityCoreService.clockStoreCalDistance(clockVo.getStoreQcId(),clockVo.getId(),clockVo.getClockCoordinates());
/**
* todo redis打卡-限制重复提交
* todo 后续添加,基于redis
*/
// tempActivityCoreService.clockStoreCalDistance(clockVo.getStoreQcId(),clockVo.getId(),clockVo.getClockCoordinates());
// 限制重复提交
repetitiveClock(clockVo);
Date clockTime = new Date();
TemporaryClockDto dto = new TemporaryClockDto(clockVo.getClockType(), clockVo.getId(), clockVo.getTemporaryId(), clockVo.getTemporaryName());
TemporaryClockDto dto = new TemporaryClockDto(clockVo.getClockType(), clockVo.getId(), clockVo.getTemporaryId(), clockVo.getTemporaryName(), clockVo.getClockProvince(), clockVo.getClockCity());
// 上班卡、午休下班卡、午休上班卡、下班卡
if (isClockIn) {
builderClockInData(clockVo, dto, clockTime);
......@@ -74,15 +74,28 @@ public class TemporaryActivityClockCoreController {
return R.success();
}
/**
* redis打卡-限制重复提交
*/
private void repetitiveClock(TemporaryClockVo clockVo) {
String clockRecordKey = RedisKeys.TemporaryKeys.TEMPORARY_CLOCK_RECIRD.getKey() + clockVo.getTemporaryId() + "_" + clockVo.getClockType();
String record = redisCache.get(clockRecordKey);
if (Objects.nonNull(record)) {
throw new FlowException(RCode.USER_REPETITIVE_CLOCK_MINUTE.getCode(), String.format(RCode.USER_REPETITIVE_CLOCK_MINUTE.getMsg(), "2"));
}
redisCache.addToJsonToMinute(clockRecordKey, clockVo.getTemporaryName(), 2);
}
// 上班打卡
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)) {
// 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())
.setStoreId(clockVo.getStoreId())
.setStoreName(clockVo.getStoreName())
.setClockInAddress(clockVo.getClockAddress())
.setClockInCoordinates(clockVo.getClockCoordinates())
......@@ -92,7 +105,7 @@ public class TemporaryActivityClockCoreController {
// 午休下班卡
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)) {
// 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())
......@@ -105,7 +118,7 @@ public class TemporaryActivityClockCoreController {
// 午休上班卡
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)) {
// 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())
......@@ -117,7 +130,7 @@ public class TemporaryActivityClockCoreController {
// 下班卡
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)) {
// 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())
......
......@@ -2,15 +2,14 @@ package com.wangxiaolu.promotion.controller.activity.temporary;
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.vo.TemporaryActivityMarketCellVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityCoreService;
import lombok.extern.slf4j.Slf4j;
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.Objects;
/**
......@@ -31,7 +30,7 @@ public class TemporaryActivityCoreController {
* 返回活动生成id
*/
@PostMapping("/today/reported")
public R todayActivityDataReported(@RequestBody @Validated TemporaryActivityDataVo activityVo) {
public R todayActivityDataReported(@RequestBody TemporaryActivityDataVo activityVo) {
TemporaryActivityReportedDto temActDto = new TemporaryActivityReportedDto();
BeanUtils.copyProperties(activityVo, temActDto);
temActDto.setId(activityVo.getActivityReportedId());
......@@ -44,12 +43,44 @@ public class TemporaryActivityCoreController {
return R.success(tempActivityCoreService.activityDataReportedSave(temActDto));
}
/**
* 促销员[今日活动 - (出售列表中添加)出售单元]数据
* 数据暂存到redis中,当调用保存接口时再添加到数据库中
* 返回保存成功信息
*/
@PostMapping("/today/reported/market_cell")
public R todayActivityMarketCellReported(@RequestBody TemporaryActivityMarketCellVo marketcellVo) {
marketcellVo.saveDataVerify();
tempActivityCoreService.todayActivityMarketCellReported(marketcellVo);
return R.success();
}
/**
* 修改/删除促销员[今日活动 - (出售列表中添加)出售单元]某一条数据
*/
@PutMapping("/today/reported/market_cell/one")
public R todayUpdateMarketCellOne(@RequestBody TemporaryActivityMarketCellVo marketcellVo) {
marketcellVo.updateDataVerify();
tempActivityCoreService.todayUpdateMarketCellOne(marketcellVo);
return R.success();
}
/**
* 删除促销员[今日活动 - (出售列表中添加)出售单元]在缓存中的全部数据
* 当促销员取消保存活动记录时,数据进行删除
*/
@DeleteMapping("/today/reported/market_cell/del")
public R todayDeleteMarketCellReported(Integer temporaryId) {
tempActivityCoreService.todayActivityDeleteMarketCellReported(temporaryId);
return R.success();
}
/**
* 促销员[今日活动]数据提交审批
* 修改审批状态
*/
@PutMapping("/reported/approve/submit/{id}")
public R activityReportedSubmit(@PathVariable("id") @NotNull Long id) {
public R activityReportedSubmit(@PathVariable("id") Long id) {
tempActivityCoreService.activityReportedSubmit(id);
return R.success();
}
......
......@@ -2,6 +2,7 @@ package com.wangxiaolu.promotion.controller.activity.temporary;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryActivityMarketCellVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityQueryService;
import lombok.extern.slf4j.Slf4j;
......@@ -9,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.Objects;
/**
* @author : liqiulin
......@@ -21,7 +23,7 @@ import javax.validation.constraints.NotNull;
public class TemporaryActivityQueryController {
@Autowired
TemporaryActivityQueryService temporaryActivityQueryService;
private TemporaryActivityQueryService temporaryActivityQueryService;
/**
* 根据促销员id查询所有任务
......@@ -51,4 +53,26 @@ public class TemporaryActivityQueryController {
TemporaryActivityReportedDto dto = temporaryActivityQueryService.findTemporaryActivityById(activityId);
return R.success(dto);
}
/**
* 促销员[今日活动 - (出售列表中添加)出售单元]数据
* 数据暂存到redis中,当调用保存接口时再添加到数据库中
* 返回已保存的数据
*/
@GetMapping("/today/reported/market_cell")
public R todayActivityMarketCell(Integer temporaryId) {
return R.success(temporaryActivityQueryService.findActivityMarketCell(temporaryId));
}
/**
* 促销员[今日活动 - (出售列表中添加)出售单元]数据
* 返回保存在数据库中的数据
*/
@GetMapping("/today/reported/market_cell/{id}")
public R findActivityMarketCellByDb(@PathVariable("id") Long activityId) {
if (Objects.isNull(activityId) || (activityId <= 0)) {
return R.success();
}
return R.success(temporaryActivityQueryService.findActivityMarketCellByDb(activityId));
}
}
package com.wangxiaolu.promotion.controller.user.qince;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import com.wangxiaolu.promotion.pojo.user.vo.ClienteleStoreQueryVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.user.QinCeClienteleDataQueryService;
......@@ -10,8 +9,6 @@ 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
......
......@@ -46,5 +46,23 @@ public class QinCeDataTaskController {
return R.success();
}
/**
* 同步商品类型
*/
@GetMapping("/product/type")
public R productQueryPdTypeAllTask(){
qinCeDataTaskService.productQueryPdTypeAllTask();
return R.success();
}
/**
* 同步商品数据
*/
@GetMapping("/product")
public R productAllTask(){
qinCeDataTaskService.productAllTask();
return R.success();
}
}
package com.wangxiaolu.promotion.controller.user.qince;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceEmployeeQueryVo;
import com.wangxiaolu.promotion.pojo.user.vo.QinceOrgQueryVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.user.QinCeDepartmentQueryService;
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-06-17 13
* @describe : 勤策部门查询
*/
@RestController
@RequestMapping("/user/dept/query")
public class QinCeDepartmentQueryController {
@Autowired
QinCeDepartmentQueryService qinCeDepartmentQueryService;
/**
* 查询部门列表
* 仅限注册时使用
*/
@PostMapping("/enroll/list")
public R getDeptList(@RequestBody QinceOrgQueryVo qinceOrgQueryVo){
List<QinCeDepartmentDto> deptDto = qinCeDepartmentQueryService.getDeptList(qinceOrgQueryVo);
return R.success(deptDto);
}
}
package com.wangxiaolu.promotion.controller.user.qince;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceEmployeeQueryVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.user.QinCeEmployeeQueryService;
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-06-17 14
* @describe : 勤策人员查询
*/
@RestController
@RequestMapping("/user/employee/query")
public class QinCeEmployeeQueryController {
@Autowired
QinCeEmployeeQueryService qinCeEmployeeQueryService;
/**
* 查询人员列表
* 仅限注册时使用
*/
@PostMapping("/enroll/list")
public R getEmployeeList(@RequestBody QinceEmployeeQueryVo employeeQueryVo){
List<QinCeEmployeeDto> employees = qinCeEmployeeQueryService.getEmployeeList(employeeQueryVo);
return R.success(employees);
}
}
package com.wangxiaolu.promotion.controller.user.qince;
import com.wangxiaolu.promotion.pojo.CascadeVo;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductTypeDto;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.user.QinCeProductQueryService;
import org.springframework.beans.factory.annotation.Autowired;
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;
/**
* @author : liqiulin
* @date : 2024-06-19 17
* @describe :
*/
@RestController
@RequestMapping("/user/qince/query")
public class QinCeProductQueryController {
@Autowired
QinCeProductQueryService qinCeProductQueryService;
@PostMapping("/product/type/list")
public R findProductTypeList(){
List<QinceProductTypeDto> dtos = qinCeProductQueryService.findProductTypeList();
return R.success(dtos);
}
/**
* 级联选择
* @return
*/
@PostMapping("/product/cascade")
public R findProductCascade(){
List<CascadeVo> dtos = qinCeProductQueryService.findProductCascade();
return R.success(dtos);
}
}
......@@ -54,7 +54,7 @@ public class WeChatUserCoreController {
*/
String redisKey = RedisKeys.UserKeys.PHONE_VER_CODE.getKey() + wxTemporaryEnrollVo.getPhone();
String phoneCodeOld = redisCache.get(redisKey);
if (StringUtils.isBlank(phoneCodeOld) || !phoneCodeOld.equals(wxTemporaryEnrollVo.getPhoneCode())){
if (StringUtils.isBlank(phoneCodeOld) || !phoneCodeOld.equals(wxTemporaryEnrollVo.getPhoneCode())) {
throw new ParamException(RCode.TENCENT_SMS_PHONE_CODE_ERROR, null);
}
redisCache.removeKey(redisKey);
......@@ -62,6 +62,8 @@ public class WeChatUserCoreController {
WxTemporaryInfoDto temporaryDto = new WxTemporaryInfoDto();
BeanUtils.copyProperties(wxTemporaryEnrollVo, temporaryDto);
return R.success(weChatUserCoreService.saveWxUserInfoTemporary(temporaryDto));
// System.out.println(JSONObject.toJSONString(temporaryDto));
// return R.success();
}
}
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.common.util.DataUtils;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
......@@ -26,6 +29,8 @@ public class WeChatUserQueryController {
@Autowired
private WeChatUserQueryService weChatUserQueryService;
@Autowired
RedisCache redisCache;
/**
* 根据OpenId、Phone登录(促销员查询是否存在)
......@@ -47,13 +52,17 @@ public class WeChatUserQueryController {
* 促销员信息查询
*/
@PostMapping("/temporary/phone_openid")
public R 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 R.success(temporaryInfoDto);
public R getTemporaryInfoByOpenIdAndPhone(@RequestHeader("Authorization") String authorization, @RequestBody WxTemporaryLoginVo wxTemporaryLoginVo) {
// 在缓存中查询
JSONObject userJson = redisCache.getToJson(RedisKeys.UserKeys.TEMPORARY_TOKEN.getKey() + authorization);
return R.success(userJson);
// phontAndOpenIdVerify(wxTemporaryLoginVo);
// WxTemporaryInfoDto temporaryInfoDto = weChatUserQueryService.getTemporaryInfoByOpenIdAndPhone(wxTemporaryLoginVo.getOpenId(), wxTemporaryLoginVo.getPhone());
// if (Objects.isNull(temporaryInfoDto)) {
// throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
// }
// return R.success(temporaryInfoDto);
}
private void phontAndOpenIdVerify(WxTemporaryLoginVo wxTemporaryLoginVo) {
......
package com.wangxiaolu.promotion.domain.activity.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.PromotionStoreWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.PromotionStoreVo;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-18 13
* @describe :
*/
public interface PromotionStoreDao {
void save(PromotionStoreDto promotionStoreDto);
List<PromotionStoreDto> findList(PromotionStoreWrapper promotionStoreWrapper);
PromotionStoreDto selectOneById(Long id);
void qinceShopDetailAllTask(JSONArray responseDatas);
}
......@@ -33,11 +33,4 @@ public interface TemporaryActivityClockDao {
*/
void employeePage(String employeeQcId, PageInfo pageInfo);
/**
* 员工查询负责的促销员打卡信息(分页查询)
*/
}
package com.wangxiaolu.promotion.domain.activity.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityMarketCellDto;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-21 15
* @describe :
*/
public interface TemporaryActivityMarketCellDao {
void saveList(Long activityReportedId,JSONArray jsonArray);
List<TemporaryActivityMarketCellDto> selectList(Long activityId);
void updateById(TemporaryActivityMarketCellDto dto);
void deleteById(Long id);
}
package com.wangxiaolu.promotion.domain.activity.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.activity.dao.PromotionStoreDao;
import com.wangxiaolu.promotion.domain.activity.mapper.PromotionStoreMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.PromotionStoreDO;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.PromotionStoreWrapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeClienteleStoreDO;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeDepartmentDO;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto;
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.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-06-18 13
* @describe :
*/
@Service
@Slf4j
public class PromotionStoreDaoImpl implements PromotionStoreDao {
@Autowired
PromotionStoreMapper promotionStoreMapper;
/**
* 保存店铺
*/
@Override
public void save(PromotionStoreDto promotionStoreDto) {
// 查询是否重名
PromotionStoreWrapper psw = new PromotionStoreWrapper()
.setStoreName(promotionStoreDto.getStoreName());
int coud = findCoud(psw);
if (coud > 0 ){
throw new ParamException(RCode.PROMOTION_STORE_HAS_NAME,null);
}
PromotionStoreDO storeDo = new PromotionStoreDO();
BeanUtils.copyProperties(promotionStoreDto, storeDo);
promotionStoreMapper.insert(storeDo);
log.info("录入店铺:{}", JSONObject.toJSONString(storeDo));
}
@Override
public List<PromotionStoreDto> findList(PromotionStoreWrapper promotionStoreWrapper) {
LambdaQueryWrapper<PromotionStoreDO> qw = buildWrapper(promotionStoreWrapper);
qw.select(PromotionStoreDO::getStoreName,PromotionStoreDO::getId);
List<PromotionStoreDO> promotionStoreDOS = promotionStoreMapper.selectList(qw);
return transitionDtos(promotionStoreDOS);
}
@Override
public PromotionStoreDto selectOneById(Long id) {
PromotionStoreDO promotionStoreDO = promotionStoreMapper.selectById(id);
return transitionDto(promotionStoreDO);
}
@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());
}
}
}
private LambdaQueryWrapper<PromotionStoreDO> buildWrapper(PromotionStoreWrapper promotionStoreWrapper){
LambdaQueryWrapper<PromotionStoreDO> lqw = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(promotionStoreWrapper.getArea())){
lqw.eq(PromotionStoreDO::getArea,promotionStoreWrapper.getArea());
}
return lqw;
}
private int findCoud(PromotionStoreWrapper promotionStoreWrapper){
LambdaQueryWrapper<PromotionStoreDO> qw = buildWrapper(promotionStoreWrapper);
Integer count = promotionStoreMapper.selectCount(qw);
return count;
}
/**
* DO to DTO (单个对象)
*
* @param storeDos DO对象List
* @return DTO对象
*/
private List<PromotionStoreDto> transitionDtos(List<PromotionStoreDO> storeDos) {
if (CollectionUtils.isEmpty(storeDos)) {
return new ArrayList<>();
}
List<PromotionStoreDto> dtos = new ArrayList<>(storeDos.size() * 2);
for (PromotionStoreDO storeDo : storeDos) {
dtos.add(transitionDto(storeDo));
}
return dtos;
}
private PromotionStoreDto transitionDto(PromotionStoreDO storeDo) {
PromotionStoreDto dto = null;
if (Objects.isNull(storeDo)) {
return dto;
}
dto = new PromotionStoreDto();
BeanUtils.copyProperties(storeDo, dto);
return dto;
}
}
package com.wangxiaolu.promotion.domain.activity.dao.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityMarketCellDao;
import com.wangxiaolu.promotion.domain.activity.mapper.TemporaryActivityMarketCellMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityMarketCellDO;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityMarketCellDto;
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-06-21 15
* @describe :
*/
@Service
public class TemporaryActivityMarketCellDaoImpl implements TemporaryActivityMarketCellDao {
@Autowired
TemporaryActivityMarketCellMapper temporaryActivityMarketCellMapper;
@Override
public void saveList(Long activityReportedId, JSONArray jsonArray) {
if (CollectionUtils.isEmpty(jsonArray)) {
return;
}
List<TemporaryActivityMarketCellDO> dos = new ArrayList<>(jsonArray.size() * 2);
jsonArray.forEach(jri -> {
JSONObject jo = (JSONObject) jri;
TemporaryActivityMarketCellDO marketCellDO = JSONObject.parseObject(jo.toString(), TemporaryActivityMarketCellDO.class);
marketCellDO.setActivityReportedId(activityReportedId);
marketCellDO.setClassName(jo.getString("prdName"));
marketCellDO.setCreateDate(DateUtil.today());
dos.add(marketCellDO);
});
temporaryActivityMarketCellMapper.saveList(dos);
}
@Override
public List<TemporaryActivityMarketCellDto> selectList(Long activityId) {
LambdaQueryWrapper<TemporaryActivityMarketCellDO> qw = new LambdaQueryWrapper<>();
qw.eq(TemporaryActivityMarketCellDO::getActivityReportedId, activityId)
.eq(TemporaryActivityMarketCellDO::getIsDelete,1);
List<TemporaryActivityMarketCellDO> marketCellDOS = temporaryActivityMarketCellMapper.selectList(qw);
return transitionDtos(marketCellDOS);
}
@Override
public void updateById(TemporaryActivityMarketCellDto dto) {
TemporaryActivityMarketCellDO updateDos = new TemporaryActivityMarketCellDO();
updateDos.setId(dto.getId());
updateDos.setBox(dto.getBox());
updateDos.setBag(dto.getBag());
temporaryActivityMarketCellMapper.updateById(updateDos);
}
@Override
public void deleteById(Long id) {
TemporaryActivityMarketCellDO updateDos = new TemporaryActivityMarketCellDO();
updateDos.setId(id);
updateDos.setIsDelete(0);
temporaryActivityMarketCellMapper.updateById(updateDos);
}
/**
* DO to DTO (单个对象)
*
* @param temDos DO对象List
* @return DTO对象
*/
private List<TemporaryActivityMarketCellDto> transitionDtos(List<TemporaryActivityMarketCellDO> temDos) {
if (CollectionUtils.isEmpty(temDos)) {
return new ArrayList<>();
}
List<TemporaryActivityMarketCellDto> dtos = new ArrayList<>(temDos.size() * 2);
for (TemporaryActivityMarketCellDO temDo : temDos) {
dtos.add(transitionDto(temDo));
}
return dtos;
}
/**
* DO to DTO (单个对象)
*
* @param temDo DO对象
* @return DTO对象
*/
private TemporaryActivityMarketCellDto transitionDto(TemporaryActivityMarketCellDO temDo) {
TemporaryActivityMarketCellDto temporaryDto = null;
if (Objects.isNull(temDo)) {
return temporaryDto;
}
temporaryDto = new TemporaryActivityMarketCellDto();
BeanUtils.copyProperties(temDo, temporaryDto);
return temporaryDto;
}
}
......@@ -108,7 +108,6 @@ public class TemporaryActivityReportedDaoImpl implements TemporaryActivityReport
@Override
public void findListToEmployeePage(TemporaryActivityWrapper tw, PageInfo pageInfo) {
LambdaQueryWrapper<TemporaryActivityReportedDO> qw = buildQueryList(tw);
// qw.orderByDesc(TemporaryActivityReportedDO::getApproveStatus);
Page<TemporaryActivityReportedDO> page = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize());
Page<TemporaryActivityReportedDO> temDoPage = temporaryActivityReportedMapper.selectPage(page, qw);
pageInfo.pageCovert(temDoPage);
......
package com.wangxiaolu.promotion.domain.activity.mapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.PromotionStoreDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【promotion_store(促销店铺数据)】的数据库操作Mapper
* @createDate 2024-06-18 11:56:57
* @Entity com.wangxiaolu.promotion.domain.activity.mapper.entity.PromotionStoreDO
*/
@Repository
@Mapper
public interface PromotionStoreMapper extends BaseMapper<PromotionStoreDO> {
}
package com.wangxiaolu.promotion.domain.activity.mapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityMarketCellDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author a02200059
* @description 针对表【temporary_activity_market_cell】的数据库操作Mapper
* @createDate 2024-06-21 15:30:32
* @Entity com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityMarketCellDO
*/
@Mapper
@Repository
public interface TemporaryActivityMarketCellMapper extends BaseMapper<TemporaryActivityMarketCellDO> {
void saveList(@Param("list") List<TemporaryActivityMarketCellDO> dos);
}
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;
import lombok.experimental.Accessors;
/**
* 促销店铺数据
* @TableName promotion_store
*/
@TableName(value ="promotion_store")
@Data
@Accessors(chain = true)
public class PromotionStoreDO implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* qc_id
*/
private String qcId;
/**
* 店铺名称
*/
private String storeName;
/**
* 店铺照片
*/
private String storePhotoUrl;
/**
* 系统名称
*/
private String lineName;
/**
* 店铺经纬度
*/
private String coordinates;
/**
* 门店所属行政区域-省份名称,如:北京市、江苏省
*/
private String province;
/**
* 门店所属行政区域-城市名称,如:南京市
*/
private String city;
/**
* 门店所属行政区域-区县名称,如:鼓楼区
*/
private String area;
/**
* 门店所属行政区域-乡镇街道名称,如:宁海路街道
*/
private String street;
/**
* 详细地址
*/
private String address;
/**
* 门店提交人id
*/
private Integer temporaryId;
/**
* 门店提交人
*/
private String temporaryName;
/**
* 所属战区id
*/
private String deptQcId;
/**
* 所属战区名称
*/
private String deptQcOrgName;
/**
* 负责人-勤策ID
*/
private String chargerQcId;
/**
* 负责人姓名
*/
private String chargerName;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -36,11 +36,24 @@ public class TemporaryActivityClockDO implements Serializable {
*/
private String storeQcId;
private Long storeId;
/**
* qince_clientele_store表store_name
*/
private String storeName;
/**
* 打卡所在地-省
*/
String clockProvince;
/**
* 打卡所在地-市
*/
String clockCity;
/**
* 上班打卡地址
*/
......
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_market_cell
*/
@TableName(value ="temporary_activity_market_cell")
@Data
public class TemporaryActivityMarketCellDO implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 关联—temporary_info表id
*/
private Integer temporaryId;
private Long activityReportedId;
/**
* 商品类型名称
*/
private String className;
/**
* 商品唯一标识,来源第三方系统的唯一ID(ERP)
*/
private String prdId;
/**
* 商品名称
*/
private String prdName;
/**
* 卖出-袋
*/
private Integer bag;
/**
* 卖出-箱
*/
private Integer box;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建日期YYYY-MM-DD
*/
private String createDate;
/**
* 修改时间
*/
private Date modifyTime;
/**
* 1:使用中;0:删除;
*/
private Integer isDelete;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -37,6 +37,8 @@ public class TemporaryActivityReportedDO implements Serializable {
*/
private String storeQcId;
private Long storeId;
/**
* 关联—活动店铺名称(例:小美超市)
*/
......@@ -47,6 +49,16 @@ public class TemporaryActivityReportedDO implements Serializable {
*/
private String storeAddr;
/**
* 省份
*/
private String province;
/**
* 城市
*/
private String city;
/**
* 关联—审核人员qc_id
*/
......@@ -72,16 +84,6 @@ public class TemporaryActivityReportedDO implements Serializable {
* 退回原因
*/
private String approveReason;
private Integer sellXiangA;
private Integer sellXiangB;
private Integer sellXiangC;
private Integer sellXiangD;
private Integer sellDaiA;
private Integer sellDaiB;
private Integer sellDaiC;
private Integer sellDaiD;
/**
* 创建时间
*/
......
package com.wangxiaolu.promotion.domain.activity.wrapperQo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-06-18 15
* @describe :
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class PromotionStoreWrapper {
Long id;
/**
* 区域
* 例:顺义区
*/
private String area;
private String storeNameLike;
private String storeName;
}
package com.wangxiaolu.promotion.domain.user.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.domain.user.wrapperQo.DeptWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import java.util.List;
/**
* @author : liqiulin
......@@ -13,4 +17,6 @@ public interface QinCeDepartmentDao {
* 勤策部门数据同步
*/
void departmentSyncTask(JSONArray responseDatas);
List<QinCeDepartmentDto> selectList(DeptWrapper dw);
}
package com.wangxiaolu.promotion.domain.user.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.domain.user.wrapperQo.EmployeeWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-03-29 17
......@@ -19,4 +22,6 @@ public interface QinCeEmployeeDao {
* 根据勤策ID查询人员信息
*/
QinCeEmployeeDto selectOntByQcId(String qcId);
List<QinCeEmployeeDto> getEmployeeList(EmployeeWrapper ew);
}
package com.wangxiaolu.promotion.domain.user.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductInfoDto;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-19 17
* @describe :
*/
public interface QinceProductInfoDao {
void productSyncTask(JSONArray responseDatas);
List<QinceProductInfoDto> selectList();
}
package com.wangxiaolu.promotion.domain.user.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductTypeDto;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-19 15
* @describe :
*/
public interface QinceProductTypeDao {
void productPdTypeSyncTask(JSONArray responseDatas);
List<QinceProductTypeDto> findAll();
}
......@@ -6,10 +6,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wangxiaolu.promotion.domain.user.dao.QinCeDepartmentDao;
import com.wangxiaolu.promotion.domain.user.mapper.QinceDepartmentMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeDepartmentDO;
import com.wangxiaolu.promotion.domain.user.wrapperQo.DeptWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
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;
/**
......@@ -51,5 +58,54 @@ public class QinCeDepartmentDaoImpl implements QinCeDepartmentDao {
}
@Override
public List<QinCeDepartmentDto> selectList(DeptWrapper dw) {
LambdaQueryWrapper<QinCeDepartmentDO> qw = buildWrapper(dw);
List<QinCeDepartmentDO> qinCeDepartmentDOS = qinceDepartmentMapper.selectList(qw);
return transitionDtos(qinCeDepartmentDOS);
}
private LambdaQueryWrapper<QinCeDepartmentDO> buildWrapper(DeptWrapper dw) {
LambdaQueryWrapper<QinCeDepartmentDO> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(dw.getOrgNameLike())) {
queryWrapper.like(QinCeDepartmentDO::getOrgName, dw.getOrgNameLike());
}
// 0:删除,1:正常
queryWrapper.eq(QinCeDepartmentDO::getOrgStatus, 1);
return queryWrapper;
}
/**
* DO to DTO (单个对象)
*
* @param deptDos DO对象List
* @return DTO对象
*/
private List<QinCeDepartmentDto> transitionDtos(List<QinCeDepartmentDO> deptDos) {
if (CollectionUtils.isEmpty(deptDos)) {
return new ArrayList<>();
}
List<QinCeDepartmentDto> dtos = new ArrayList<>(deptDos.size() * 2);
for (QinCeDepartmentDO deptDto : deptDos) {
dtos.add(transitionDto(deptDto));
}
return dtos;
}
/**
* DO to DTO (单个对象)
*
* @param deptDo DO对象
* @return DTO对象
*/
private QinCeDepartmentDto transitionDto(QinCeDepartmentDO deptDo) {
QinCeDepartmentDto deptDto = null;
if (!Objects.isNull(deptDo)) {
deptDto = new QinCeDepartmentDto();
BeanUtils.copyProperties(deptDo, deptDto);
}
return deptDto;
}
}
......@@ -5,15 +5,20 @@ import com.alibaba.fastjson.JSONObject;
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.QinCeDepartmentDO;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeEmployeeDO;
import com.wangxiaolu.promotion.domain.user.mapper.entity.TemporaryInfoDO;
import com.wangxiaolu.promotion.domain.user.wrapperQo.EmployeeWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
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;
/**
......@@ -63,6 +68,39 @@ public class QinCeEmployeeDaoImpl implements QinCeEmployeeDao {
return transitionDto(qcEmpDo);
}
@Override
public List<QinCeEmployeeDto> getEmployeeList(EmployeeWrapper ew) {
LambdaQueryWrapper<QinCeEmployeeDO> qw = buildWrapper(ew);
List<QinCeEmployeeDO> qinCeEmployeeDOS = qinceEmployeeMapper.selectList(qw);
return transitionDtos(qinCeEmployeeDOS);
}
private LambdaQueryWrapper<QinCeEmployeeDO> buildWrapper(EmployeeWrapper ew){
LambdaQueryWrapper<QinCeEmployeeDO> qw = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(ew.getWaiqin365OrgId())){
qw.eq(QinCeEmployeeDO::getWaiqin365OrgId,ew.getWaiqin365OrgId());
}
qw.eq(QinCeEmployeeDO::getEmpStatus,1);
return qw;
}
/**
* DO to DTO (单个对象)
*
* @param employeeDOS DO对象List
* @return DTO对象
*/
private List<QinCeEmployeeDto> transitionDtos(List<QinCeEmployeeDO> employeeDOS) {
if (CollectionUtils.isEmpty(employeeDOS)) {
return new ArrayList<>();
}
List<QinCeEmployeeDto> dtos = new ArrayList<>(employeeDOS.size() * 2);
for (QinCeEmployeeDO employe : employeeDOS) {
dtos.add(transitionDto(employe));
}
return dtos;
}
/**
* DO to DTO (单个对象)
......
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.QinceProductInfoDao;
import com.wangxiaolu.promotion.domain.user.mapper.QinceProductInfoMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductInfoDO;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductInfoDto;
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.List;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-06-19 17
* @describe :
*/
@Slf4j
@Service
public class QinceProductInfoDaoImpl implements QinceProductInfoDao {
@Autowired
QinceProductInfoMapper qinceProductInfoMapper;
@Override
public void productSyncTask(JSONArray responseDatas) {
log.info("勤策-同步商品信息,共「{}」条数据", responseDatas.size());
LambdaQueryWrapper<QinceProductInfoDO> qw = new LambdaQueryWrapper<>();
for (Object responseData : responseDatas) {
qw.clear();
// 查询人员是否存在
QinceProductInfoDO qcDo = JSONObject.parseObject(JSONObject.toJSONString(responseData), QinceProductInfoDO.class);
qw.eq(QinceProductInfoDO::getPrdWaiqin365Id, qcDo.getPrdWaiqin365Id());
QinceProductInfoDO doExist = qinceProductInfoMapper.selectOne(qw);
// 存在则修改,不存在则添加
if (Objects.isNull(doExist)) {
qinceProductInfoMapper.insert(qcDo);
log.info("勤策-[{}]商品信息不存在,已添加,qc_id:{}", qcDo.getPrdName(), qcDo.getPrdWaiqin365Id());
} else {
qcDo.setId(doExist.getId());
qinceProductInfoMapper.updateById(qcDo);
log.info("勤策--[{}]商品信息已存在,现已修改,qc_id:{}", qcDo.getPrdName(), qcDo.getPrdWaiqin365Id());
}
}
}
@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);
List<QinceProductInfoDO> qinceProductInfoDOS = qinceProductInfoMapper.selectList(qw);
return transitionDtos(qinceProductInfoDOS);
}
/**
* DO to DTO (单个对象)
*
* @param productInfoDOS DO对象List
* @return DTO对象
*/
private List<QinceProductInfoDto> transitionDtos(List<QinceProductInfoDO> productInfoDOS) {
if (CollectionUtils.isEmpty(productInfoDOS)) {
return new ArrayList<>();
}
List<QinceProductInfoDto> dtos = new ArrayList<>(productInfoDOS.size() * 2);
for (QinceProductInfoDO productInfoDO : productInfoDOS) {
dtos.add(transitionDto(productInfoDO));
}
return dtos;
}
private QinceProductInfoDto transitionDto(QinceProductInfoDO productInfoDO) {
QinceProductInfoDto dto = null;
if (Objects.isNull(productInfoDO)) {
return dto;
}
dto = new QinceProductInfoDto();
BeanUtils.copyProperties(productInfoDO, dto);
return dto;
}
}
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.QinceProductTypeDao;
import com.wangxiaolu.promotion.domain.user.mapper.QinceProductTypeMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductTypeDO;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductTypeDto;
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.List;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-06-19 15
* @describe :
*/
@Slf4j
@Service
public class QinceProductTypeDaoImpl implements QinceProductTypeDao {
@Autowired
QinceProductTypeMapper qinceProductTypeMapper;
@Override
public void productPdTypeSyncTask(JSONArray responseDatas) {
log.info("勤策-同步商品类型数据,共「{}」条数据", responseDatas.size());
LambdaQueryWrapper<QinceProductTypeDO> qw = new LambdaQueryWrapper<>();
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);
// 存在则修改,不存在则添加
if (Objects.isNull(doExist)) {
qinceProductTypeMapper.insert(qcDo);
log.info("勤策-[{}]商品类型不存在,已添加,qc_id:{}", qcDo.getName(), qcDo.getPrdWaiqin365Id());
} else {
qcDo.setId(doExist.getId());
qinceProductTypeMapper.updateById(qcDo);
log.info("勤策--[{}]商品类型已存在,现已修改,qc_id:{}", qcDo.getName(), qcDo.getPrdWaiqin365Id());
}
}
}
@Override
public List<QinceProductTypeDto> findAll() {
LambdaQueryWrapper<QinceProductTypeDO> qw = new LambdaQueryWrapper<>();
qw.eq(QinceProductTypeDO::getStatus,1).select(QinceProductTypeDO::getPrdWaiqin365Id,QinceProductTypeDO::getName);
List<QinceProductTypeDO> qinceProductTypeDOS = qinceProductTypeMapper.selectList(qw);
return transitionDtos(qinceProductTypeDOS);
}
/**
* DO to DTO (单个对象)
*
* @param productTypeDos DO对象List
* @return DTO对象
*/
private List<QinceProductTypeDto> transitionDtos(List<QinceProductTypeDO> productTypeDos) {
if (CollectionUtils.isEmpty(productTypeDos)) {
return new ArrayList<>();
}
List<QinceProductTypeDto> dtos = new ArrayList<>(productTypeDos.size() * 2);
for (QinceProductTypeDO productTypeDo : productTypeDos) {
dtos.add(transitionDto(productTypeDo));
}
return dtos;
}
private QinceProductTypeDto transitionDto(QinceProductTypeDO productTypeDo) {
QinceProductTypeDto dto = null;
if (Objects.isNull(productTypeDo)) {
return dto;
}
dto = new QinceProductTypeDto();
BeanUtils.copyProperties(productTypeDo, dto);
return dto;
}
}
......@@ -56,8 +56,7 @@ public class TemporaryInfoDaoImpl implements TemporaryInfoDao {
@Override
public void findTemporaryInfoByEmployeeQcId(String employeeQcId, PageInfo pageInfo) {
TemporaryWrapper tw = new TemporaryWrapper()
.setChargerQcId(employeeQcId);
TemporaryWrapper tw = new TemporaryWrapper();
LambdaQueryWrapper<TemporaryInfoDO> qw = buildQueryList(tw);
List<TemporaryInfoDO> temporaryInfoDOS = temporaryInfoMapper.selectList(qw);
pageInfo.setRecords(transitionDtos(temporaryInfoDOS));
......
package com.wangxiaolu.promotion.domain.user.mapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductInfoDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【qince_product_info】的数据库操作Mapper
* @createDate 2024-06-19 16:55:53
* @Entity generator.domain.QinceProductInfoDto
*/
@Mapper
@Repository
public interface QinceProductInfoMapper extends BaseMapper<QinceProductInfoDO> {
}
package com.wangxiaolu.promotion.domain.user.mapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductTypeDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【qince_product_type】的数据库操作Mapper
* @createDate 2024-06-19 15:40:15
* @Entity com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductTypeDO
*/
@Mapper
@Repository
public interface QinceProductTypeMapper extends BaseMapper<QinceProductTypeDO> {
}
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 java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
*
* @TableName qince_product_info
*/
@TableName(value ="qince_product_info")
@Data
public class QinceProductInfoDO implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 商品唯一标识,来源第三方系统的唯一ID(ERP)
*/
@JsonProperty("prd_id")
private String prdId;
/**
* 勤策商品id
*/
@JsonProperty("prd_waiqin365_id")
private String prdWaiqin365Id;
/**
* 商品名称
*/
@JsonProperty("prd_name")
private String prdName;
/**
* 商品类型唯一ID,所属类型
*/
@JsonProperty("class_id")
private String classId;
/**
* 商品类型名称
*/
@JsonProperty("class_name")
private String className;
/**
* 商品类型全路径
*/
@JsonProperty("class_full_path")
private String classFullPath;
/**
* 单位
*/
@JsonProperty("prd_unit")
private String prdUnit;
/**
* 商品规格
*/
@JsonProperty("prd_spec")
private String prdSpec;
/**
* 商品分类,0:普通商品,1:助销物料,2:包装物,3:兑换物料
*/
@JsonProperty("classification")
private String classification;
/**
* 商品编码
*/
@JsonProperty("prd_code")
private String prdCode;
/**
* 销售状态。0:停售,1:在售
*/
@JsonProperty("prd_sale_status")
private String prdSaleStatus;
/**
* 销售状态。0:停售,1:在售
*/
@JsonProperty("sale_status")
private String saleStatus;
/**
* 删除标志。1:正常,0:删除
*/
@JsonProperty("status")
private String status;
/**
* 创建时间
*/
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.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 com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
*
* @TableName qince_product_type
*/
@TableName(value ="qince_product_type")
@Data
public class QinceProductTypeDO implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 勤策ID
*/
@JsonProperty("prd_waiqin365_id")
private String prdWaiqin365Id;
/**
* 父id - 勤策ID
*/
@JsonProperty("parent_id")
private String parentId;
/**
* 商品类型名称
*/
@JsonProperty("name")
private String name;
/**
* 删除标志。1:正常,0:删除
*/
@JsonProperty("status")
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -42,6 +42,16 @@ public class TemporaryInfoDO implements Serializable {
*/
private String openId;
/**
* 所属战区-部门
*/
String deptQcId;
/**
* 所属战区-部门
*/
String deptQcOrgName;
/**
* 此促销员的任务人-勤策id
*/
......
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 DeptWrapper {
private String orgNameLike;
/**
* 部门状态。0:删除,1:正常
*/
private Integer orgStatus;
}
package com.wangxiaolu.promotion.domain.user.wrapperQo;
import com.fasterxml.jackson.annotation.JsonProperty;
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 EmployeeWrapper {
/**
* 勤策部门唯一标识
* 对应QinCeDepartmentDO.qcId
*/
private String waiqin365OrgId;
/**
* 员工账号状态。0:销户,1:正常,2:停用
*/
@JsonProperty("emp_status")
private String empStatus;
}
package com.wangxiaolu.promotion.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-20 11
* @describe : 级联对象
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CascadeVo {
private String label;
private String value;
private List<CascadeVo> children;
public CascadeVo(String label, String value) {
this.label = label;
this.value = value;
}
}
package com.wangxiaolu.promotion.pojo.activity.temporary.employee.vo;
package com.wangxiaolu.promotion.pojo.activity.employee.vo;
import com.wangxiaolu.promotion.enums.activity.TemActApproveStatus;
import lombok.AllArgsConstructor;
......
package com.wangxiaolu.promotion.pojo.activity.temporary.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* 促销店铺数据
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class PromotionStoreDto implements Serializable {
/**
* 主键id
*/
private Long id;
/**
* 店铺名称
*/
private String storeName;
/**
* 店铺照片
*/
private String storePhotoUrl;
/**
* 系统名称
*/
private String lineName;
/**
* 店铺经纬度
*/
private String coordinates;
/**
* 门店所属行政区域-省份名称,如:北京市、江苏省
*/
private String province;
/**
* 门店所属行政区域-城市名称,如:南京市
*/
private String city;
/**
* 门店所属行政区域-区县名称,如:鼓楼区
*/
private String area;
/**
* 门店所属行政区域-乡镇街道名称,如:宁海路街道
*/
private String street;
/**
* 详细地址
*/
private String address;
/**
* 门店提交人id
*/
private Integer temporaryId;
/**
* 门店提交人
*/
private String temporaryName;
/**
* 所属战区id
*/
private String deptQcId;
/**
* 所属战区名称
*/
private String deptQcOrgName;
/**
* 负责人-勤策ID
*/
private String chargerQcId;
/**
* 负责人姓名
*/
private String chargerName;
/**
* 创建时间
*/
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.pojo.activity.temporary.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-06-21 16
* @describe :
*/
@Data
@Accessors(chain = true)
public class TemporaryActivityMarketCellDto {
/**
* 主键id
*/
private Long id;
/**
* 关联—temporary_info表id
*/
private Integer temporaryId;
private Long activityReportedId;
/**
* 商品类型名称
*/
private String className;
/**
* 商品唯一标识,来源第三方系统的唯一ID(ERP)
*/
private String prdId;
/**
* 商品名称
*/
private String prdName;
/**
* 卖出-袋
*/
private Integer bag;
/**
* 卖出-箱
*/
private Integer box;
/**
* 创建日期YYYY-MM-DD
*/
private String createDate;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
......@@ -38,7 +38,7 @@ public class TemporaryActivityReportedDto {
/**
* 关联—活动店铺id
*/
private String storeQcId;
private Long storeId;
/**
* 关联—活动店铺名称(例:小美超市)
......@@ -50,6 +50,16 @@ public class TemporaryActivityReportedDto {
*/
private String storeAddr;
/**
* 省份
*/
private String province;
/**
* 城市
*/
private String city;
/**
* 关联—审核人员qc_id
*
......@@ -102,15 +112,6 @@ public class TemporaryActivityReportedDto {
private List<String> psvPhotoUrls;
private List<String> psvChangePhotoUrls;
private Integer sellXiangA;
private Integer sellXiangB;
private Integer sellXiangC;
private Integer sellXiangD;
private Integer sellDaiA;
private Integer sellDaiB;
private Integer sellDaiC;
private Integer sellDaiD;
/**
* 创建时间
*/
......
......@@ -32,7 +32,8 @@ public class TemporaryClockDto {
String temporaryName;
// 店铺勤策id
String storeQcId;
// String storeQcId;
Long storeId;
// 店铺名称
String storeName;
......@@ -49,6 +50,12 @@ public class TemporaryClockDto {
// 上班打卡时间
Date clockInTime;
// 打卡所在地-省
String clockProvince;
// 打卡所在地-市
String clockCity;
// 午休下班打卡地点
String noonClockOutAddress;
......@@ -85,11 +92,16 @@ public class TemporaryClockDto {
// 下班打卡时间
Date clockOutTime;
public TemporaryClockDto(Integer clockType, Long id, Integer temporaryId, String temporaryName) {
// 创建日期YYYY-MM-DD
private String createDate;
public TemporaryClockDto(Integer clockType, Long id, Integer temporaryId, String temporaryName, String clockProvince, String clockCity) {
if (!ClockType.TEMPORARY_CLOCK_IN.equals(clockType)) {
this.id = id;
}
this.temporaryId = temporaryId;
this.temporaryName = temporaryName;
this.clockProvince = clockProvince;
this.clockCity = clockCity;
}
}
package com.wangxiaolu.promotion.pojo.activity.temporary.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-06-18 15
* @describe : 促销店铺VO模型
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class PromotionStoreVo {
/**
* 区域
* 例:顺义区
*/
private String area;
private String storeNameLike;
}
......@@ -27,7 +27,6 @@ public class TemporaryActivityDataVo {
* 促销员id
* temporaryInfo表id
*/
@NotNull(message = "促销员账号异常")
private Integer temporaryId;
/**
......@@ -40,8 +39,7 @@ public class TemporaryActivityDataVo {
/**
* 活动店铺Id
*/
@NotNull(message = "活动店铺异常")
private String storeQcId;
private Long storeId;
/**
* 推广试吃照片
......@@ -68,15 +66,4 @@ public class TemporaryActivityDataVo {
*/
private List<String> psvPhotoUrls;
private List<String> psvChangePhotoUrls;
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 com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.result.basedata.RCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2024-06-20 17
* @describe :今日活动 - (出售列表中添加)出售单元
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class TemporaryActivityMarketCellVo {
/**
* 促销员id
* temporaryInfo表id
*/
private Integer temporaryId;
/**
* market_cell 表id
* 影响保存逻辑:有则修改,无则新增
*/
private Long marketCellId;
/**
* 保存到redis中的 uuid
* 未保存到数据且保存到redis中的数据:根据这个id进行缓存数据的修改
*/
private String uuid;
/**
* 类型名称
*/
private String prdClassName;
/**
* 商品品类名称
*/
private String prdName;
/**
* 商品品类编码
*/
private String prdId;
/**
* 卖出数据 - 袋
*/
private int bag;
/**
* 卖出数据 - 箱
*/
private int box;
/**
* 当前数据操作类型
* 0:删除;
* 2:修改;
*/
private Integer operate;
public void saveDataVerify() {
if (StringUtils.isBlank(this.prdClassName) || StringUtils.isBlank(this.prdId)) {
throw new ParamException(RCode.PRODUCT_CLASS_NOT_ERROR, null);
}
if (this.bag + this.box <= 0) {
throw new ParamException(RCode.MARKET_NUMBER_NOT_ERROR, null);
}
}
public void updateDataVerify() {
if (Objects.isNull(this.marketCellId) && StringUtils.isBlank(this.uuid)) {
throw new ParamException(RCode.DATA_NOT_HAVE_ERROR, null);
}
if ((this.bag + this.box <= 0) && (0 != operate)) {
throw new ParamException(RCode.MARKET_NUMBER_NOT_ERROR, null);
}
}
public boolean operateIsUpdate() {
return 2 == operate;
}
public boolean operateIsDelete() {
return 0 == operate;
}
}
......@@ -31,36 +31,42 @@ public class TemporaryClockVo {
/**
* 打卡类型:1、上班卡;2、午休下班卡;3、午休上班卡;4、下班卡
*/
// @NotNull(message = "无打卡类型")
// @Range(max = 4, min = 1, message = "超出状态")
Integer clockType;
/**
* temporaryId
*/
// @NotNull(message = "找不到打卡人")
Integer temporaryId;
String temporaryName;
// 店铺勤策id
String storeQcId;
// 店铺id
// String storeQcId;
Long storeId;
// 店铺名称
String storeName;
// 上班打卡地点
// @NotBlank(message = "请选择打卡地址")
String clockAddress;
// 上班打卡经纬度
// @NotBlank(message = "请选择打卡地点")
String clockCoordinates;
// 上班打卡图片
// @NotBlank(message = "请上传图片")
String clockPhoto;
// 打卡省
String clockProvince;
// 打卡城市
String clockCity;
public void validate(){
if (Objects.isNull(clockType) || !(clockType >= 1 && clockType <= 4)){
throw new ParamException(RCode.CLOCK_DETAIL_ERROR, null);
......
package com.wangxiaolu.promotion.pojo.user.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* @author : liqiulin
* @date : 2024-03-29 15
* @describe : 勤策-组织架构
*/
@Data
public class QinCeDepartmentDto {
/**
* 勤策的部门唯一ID。如果id和org_id同时存在则优先顺序为id、org_id
*/
private String qcId;
/**
* 部门名称。同一部门下的子部门的名称不能重复
*/
private String orgName;
/**
* 勤策上级部门唯一ID
*/
private String waiqin365ParentId;
/**
* 上级部门名称
*/
@JsonProperty("parent_name")
private String parentName;
}
package com.wangxiaolu.promotion.pojo.user.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName qince_product_info
*/
@Data
public class QinceProductInfoDto implements Serializable {
/**
* 主键id
*/
private Integer id;
/**
* 商品唯一标识,来源第三方系统的唯一ID(ERP)
*/
private String prdId;
/**
* 勤策商品id
*/
private String prdWaiqin365Id;
/**
* 商品名称
*/
private String prdName;
/**
* 商品类型唯一ID,所属类型
*/
private String classId;
/**
* 商品类型名称
*/
private String className;
/**
* 商品类型全路径
*/
private String classFullPath;
/**
* 单位
*/
private String prdUnit;
/**
* 商品规格
*/
private String prdSpec;
/**
* 商品分类,0:普通商品,1:助销物料,2:包装物,3:兑换物料
*/
private String classification;
/**
* 商品编码
*/
private String prdCode;
/**
* 销售状态。0:停售,1:在售
*/
private String prdSaleStatus;
/**
* 销售状态。0:停售,1:在售
*/
private String saleStatus;
/**
* 删除标志。1:正常,0:删除
*/
private String status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.wangxiaolu.promotion.pojo.user.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName qince_product_type
*/
@Data
public class QinceProductTypeDto implements Serializable {
/**
* 主键id
*/
private Integer id;
/**
* 勤策ID
*/
private String prdWaiqin365Id;
/**
* 父id - 勤策ID
*/
private String parentId;
/**
* 商品类型名称
*/
private String name;
/**
* 删除标志。1:正常,0:删除
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -59,14 +59,15 @@ public class WxTemporaryInfoDto {
String idenReversePhotoUrl;
/**
* 详细地址
* 所属战区-部门
*/
String address;
String deptQcId;
/**
* 创建时间
* 所属战区-部门
*/
Date createTime;
String deptQcOrgName;
/**
* 此促销员的任务人-勤策id
*/
......@@ -76,4 +77,9 @@ public class WxTemporaryInfoDto {
* 此促销员的任务人姓名
*/
String chargerName;
/**
* 创建时间
*/
Date createTime;
}
package com.wangxiaolu.promotion.pojo.user.vo;
import lombok.Data;
/**
* @author : liqiulin
* @date : 2024-06-17 13
* @describe : 查询qince组织架构条件查询
*/
@Data
public class QinceEmployeeQueryVo {
/**
* 按部门查询
*/
private String waiqin365OrgId;
}
package com.wangxiaolu.promotion.pojo.user.vo;
import lombok.Data;
/**
* @author : liqiulin
* @date : 2024-06-17 13
* @describe : 查询qince组织架构条件查询
*/
@Data
public class QinceOrgQueryVo {
/**
* 部门名称模糊查询
*/
private String orgNameLike;
}
......@@ -64,9 +64,14 @@ public class WxTemporaryEnrollVo {
String idenReversePhotoUrl;
/**
* 详细地址
* 所属战区-部门
*/
String address;
String deptQcId;
/**
* 所属战区-部门
*/
String deptQcOrgName;
/**
* 手机验证码
......@@ -75,10 +80,15 @@ public class WxTemporaryEnrollVo {
/**
* 促销员的任务人-勤策id
* 促销员的任务人-勤策id
*/
String chargerQcId;
/**
* 此促销员的任务人姓名
*/
String chargerName;
public void validate() {
if (
StringUtils.isBlank(openId) ||
......@@ -88,7 +98,8 @@ public class WxTemporaryEnrollVo {
StringUtils.isBlank(phoneCode) ||
StringUtils.isBlank(idenNumber) ||
StringUtils.isBlank(openId) ||
StringUtils.isBlank(idenFrontPhotoUrl)
StringUtils.isBlank(chargerQcId) ||
StringUtils.isBlank(deptQcId)
) {
throw new ParamException(RCode.ENROLL_PARAM_ERROR, null);
}
......
package com.wangxiaolu.promotion.service.activity.employee;
import com.wangxiaolu.promotion.pojo.activity.temporary.employee.vo.ApproveVO;
import com.wangxiaolu.promotion.pojo.activity.employee.vo.ApproveVO;
/**
* @author : liqiulin
......
......@@ -6,7 +6,7 @@ import com.wangxiaolu.promotion.enums.activity.LogType;
import com.wangxiaolu.promotion.enums.activity.TemActApproveStatus;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.employee.vo.ApproveVO;
import com.wangxiaolu.promotion.pojo.activity.employee.vo.ApproveVO;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.employee.EmployeeCoreTemActivityService;
import lombok.extern.slf4j.Slf4j;
......
......@@ -28,8 +28,8 @@ public class EmployeeQueryTemActivityServiceImpl implements EmployeeQueryTemActi
public void getEmployeeApproveActivityPage(String employeeQcId, PageInfo pageInfo) {
TemporaryActivityWrapper tw = JSONObject.parseObject(JSONObject.toJSONString(pageInfo.getQueryParams()), TemporaryActivityWrapper.class);
tw = Objects.isNull(tw) ? new TemporaryActivityWrapper() : tw;
tw.setApproverId(employeeQcId)
.setNotApproveStatus(TemActApproveStatus.SUBMITTED.name());
// tw.setApproverId(employeeQcId)
tw.setNotApproveStatus(TemActApproveStatus.SUBMITTED.name());
temporaryActivityReportedDao.findListToEmployeePage(tw, pageInfo);
}
}
package com.wangxiaolu.promotion.service.activity.temporary;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto;
/**
* @author : liqiulin
* @date : 2024-06-18 13
* @describe :
*/
public interface PromotionStoreCoreService {
void saveStore(PromotionStoreDto promotionStoreDto);
}
package com.wangxiaolu.promotion.service.activity.temporary;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.PromotionStoreVo;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-18 15
* @describe :
*/
public interface PromotionStoreQueryService {
List<PromotionStoreDto> findStoreList(PromotionStoreVo promotionStoreVo);
}
......@@ -2,6 +2,7 @@ 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;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryActivityMarketCellVo;
/**
* @author : liqiulin
......@@ -38,4 +39,19 @@ public interface TemporaryActivityCoreService {
* @param clockCoordinates 打卡经纬度
*/
void clockStoreCalDistance(String storeQcId, Long id, String clockCoordinates);
/**
* 保存销售上报-出售单元 - 缓存
*/
void todayActivityMarketCellReported(TemporaryActivityMarketCellVo marketcellVo);
/**
* 删除销售上报-出售单元 - 缓存
*/
void todayActivityDeleteMarketCellReported(Integer temporaryId);
/**
* 修改/删除 单一出售单元
*/
void todayUpdateMarketCellOne(TemporaryActivityMarketCellVo marketcellVo);
}
package com.wangxiaolu.promotion.service.activity.temporary;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityMarketCellDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import java.util.List;
......@@ -23,4 +25,8 @@ public interface TemporaryActivityQueryService {
TemporaryActivityReportedDto findtemporaryIdTodayActivityData(Integer temporaryId);
TemporaryActivityReportedDto findTemporaryActivityById(Long activityId);
JSONArray findActivityMarketCell(Integer temporaryId);
List<TemporaryActivityMarketCellDto> findActivityMarketCellByDb(Long activityId);
}
package com.wangxiaolu.promotion.service.activity.temporary.impl;
import com.wangxiaolu.promotion.domain.activity.dao.PromotionStoreDao;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto;
import com.wangxiaolu.promotion.service.activity.temporary.PromotionStoreCoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author : liqiulin
* @date : 2024-06-18 13
* @describe :
*/
@Service
public class PromotionStoreCoreServiceImpl implements PromotionStoreCoreService {
@Autowired
PromotionStoreDao promotionStoreDao;
@Override
public void saveStore(PromotionStoreDto promotionStoreDto) {
promotionStoreDao.save(promotionStoreDto);
}
}
package com.wangxiaolu.promotion.service.activity.temporary.impl;
import com.wangxiaolu.promotion.domain.activity.dao.PromotionStoreDao;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.PromotionStoreWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.PromotionStoreVo;
import com.wangxiaolu.promotion.service.activity.temporary.PromotionStoreQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-18 15
* @describe :
*/
@Service
public class PromotionStoreQueryServiceImpl implements PromotionStoreQueryService {
@Autowired
PromotionStoreDao promotionStoreDao;
@Override
public List<PromotionStoreDto> findStoreList(PromotionStoreVo promotionStoreVo) {
PromotionStoreWrapper promotionStoreWrapper = new PromotionStoreWrapper();
promotionStoreWrapper.setStoreNameLike(promotionStoreVo.getStoreNameLike());
promotionStoreWrapper.setArea("全国".equals(promotionStoreVo.getArea()) ? "" : promotionStoreVo.getArea());
return promotionStoreDao.findList(promotionStoreWrapper);
}
}
package com.wangxiaolu.promotion.service.activity.temporary.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.fasterxml.uuid.Generators;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityMarketCellDao;
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.TemporaryActivityMarketCellDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityQueryService;
import lombok.extern.slf4j.Slf4j;
......@@ -24,11 +31,14 @@ import java.util.Objects;
@Slf4j
public class TemporaryActivityQueryServiceImpl implements TemporaryActivityQueryService {
@Autowired
RedisCache redisCache;
@Autowired
TemporaryActivityReportedDao temporaryActivityReportedDao;
@Autowired
TemporaryActivityPhotoDao temporaryActivityPhotoDao;
@Autowired
TemporaryActivityMarketCellDao temporaryActivityMarketCellDao;
/**
* 根据促销员id查询所有任务
......@@ -56,6 +66,21 @@ public class TemporaryActivityQueryServiceImpl implements TemporaryActivityQuery
return dto;
}
@Override
public JSONArray findActivityMarketCell(Integer temporaryId) {
/**
* 将数据保存到redis中Generators
*/
String key = RedisKeys.TemporaryKeys.TEMPORARY_ACTIVITY_MARKET_CELL.getKey() + temporaryId + "_" + DateUtil.today();;
return redisCache.getToJsonArray(key);
}
@Override
public List<TemporaryActivityMarketCellDto> findActivityMarketCellByDb(Long activityId) {
List<TemporaryActivityMarketCellDto> dtos = temporaryActivityMarketCellDao.selectList(activityId);
return dtos;
}
private void findActivityReportedPhoto(TemporaryActivityReportedDto dto) {
if (Objects.isNull(dto)) {
return;
......
......@@ -12,4 +12,8 @@ public interface QinCeDataTaskService {
void shopDetailAllTask();
void productQueryPdTypeAllTask();
void productAllTask();
}
package com.wangxiaolu.promotion.service.user;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceOrgQueryVo;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 13
* @describe :
*/
public interface QinCeDepartmentQueryService {
List<QinCeDepartmentDto> getDeptList(QinceOrgQueryVo qinceOrgQueryVo);
}
package com.wangxiaolu.promotion.service.user;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceEmployeeQueryVo;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 14
* @describe :
*/
public interface QinCeEmployeeQueryService {
List<QinCeEmployeeDto> getEmployeeList(QinceEmployeeQueryVo employeeQueryVo);
}
package com.wangxiaolu.promotion.service.user;
import com.wangxiaolu.promotion.pojo.CascadeVo;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductTypeDto;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-19 17
* @describe :
*/
public interface QinCeProductQueryService {
List<QinceProductTypeDto> findProductTypeList();
List<CascadeVo> findProductCascade();
}
......@@ -2,9 +2,8 @@ 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.domain.activity.dao.PromotionStoreDao;
import com.wangxiaolu.promotion.domain.user.dao.*;
import com.wangxiaolu.promotion.service.user.QinCeDataTaskService;
import com.wangxiaolu.promotion.utils.OkHttp;
import com.wangxiaolu.promotion.utils.QinCeUtils;
......@@ -31,6 +30,12 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
QinCeEmployeeDao qinCeEmployeeDao;
@Autowired
QinCeClienteleStoreDao qinCeClienteleShopDao;
@Autowired
QinceProductTypeDao qinceProductTypeDao;
@Autowired
QinceProductInfoDao qinceProductInfoDao;
@Autowired
PromotionStoreDao promotionStoreDao;
@Override
public void departmentSyncTask() {
......@@ -81,6 +86,28 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
}
}
@Override
public void productQueryPdTypeAllTask() {
Map<String, Object> params = qinCeUtils.productQueryPdTypeParam();
String url = qinCeUtils.builderUrl(QinCeUtils.QUERY_PRODUCT_PD_TYPE, params);
// 发起请求、接收结果
JSONObject resultJson = OkHttp.postQC(url, params);
JSONArray responseDatas = resultJson.getJSONArray("response_data");
qinceProductTypeDao.productPdTypeSyncTask(responseDatas);
}
@Override
public void productAllTask() {
Map<String, Object> params = qinCeUtils.queryProductParam();
String url = qinCeUtils.builderUrl(QinCeUtils.QUERY_PRODUCT, params);
// 发起请求、接收结果
JSONObject resultJson = OkHttp.postQC(url, params);
JSONArray responseDatas = resultJson.getJSONArray("response_data");
qinceProductInfoDao.productSyncTask(responseDatas);
}
private boolean booleanshopDetailPage(Integer pageNum) {
Map<String, Object> params = qinCeUtils.queryShopParam(pageNum);
String url = qinCeUtils.builderUrl(QinCeUtils.QUERY_SHORE, params);
......@@ -94,7 +121,8 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
}
log.info("勤策-同步终端store数据,查询到第{}页数据「{}」条", pageNum, responseDatas.size());
qinCeClienteleShopDao.shopDetailAllTask(responseDatas);
// qinCeClienteleShopDao.shopDetailAllTask(responseDatas);
promotionStoreDao.qinceShopDetailAllTask(responseDatas);
return true;
}
}
package com.wangxiaolu.promotion.service.user.impl;
import com.wangxiaolu.promotion.domain.user.dao.QinCeDepartmentDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.DeptWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceOrgQueryVo;
import com.wangxiaolu.promotion.service.user.QinCeDepartmentQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 13
* @describe :
*/
@Service
public class QinCeDepartmentQueryServiceImpl implements QinCeDepartmentQueryService {
@Autowired
QinCeDepartmentDao qinCeDepartmentDao;
@Override
public List<QinCeDepartmentDto> getDeptList(QinceOrgQueryVo qinceOrgQueryVo) {
DeptWrapper dw = new DeptWrapper()
.setOrgNameLike(qinceOrgQueryVo.getOrgNameLike());
return qinCeDepartmentDao.selectList(dw);
}
}
package com.wangxiaolu.promotion.service.user.impl;
import com.wangxiaolu.promotion.domain.user.dao.QinCeEmployeeDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.EmployeeWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceEmployeeQueryVo;
import com.wangxiaolu.promotion.service.user.QinCeEmployeeQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 14
* @describe :
*/
@Service
public class QinCeEmployeeQueryServiceImpl implements QinCeEmployeeQueryService {
@Autowired
QinCeEmployeeDao qinCeEmployeeDao;
@Override
public List<QinCeEmployeeDto> getEmployeeList(QinceEmployeeQueryVo employeeQueryVo) {
EmployeeWrapper ew = new EmployeeWrapper()
.setWaiqin365OrgId(employeeQueryVo.getWaiqin365OrgId());
return qinCeEmployeeDao.getEmployeeList(ew);
}
}
package com.wangxiaolu.promotion.service.user.impl;
import com.wangxiaolu.promotion.domain.user.dao.QinceProductInfoDao;
import com.wangxiaolu.promotion.domain.user.dao.QinceProductTypeDao;
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.service.user.QinCeProductQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author : liqiulin
* @date : 2024-06-19 17
* @describe :
*/
@Slf4j
@Service
public class QinCeProductQueryServiceImpl implements QinCeProductQueryService {
@Autowired
QinceProductTypeDao qinceProductTypeDao;
@Autowired
QinceProductInfoDao qinceProductInfoDao;
@Override
public List<QinceProductTypeDto> findProductTypeList() {
return qinceProductTypeDao.findAll();
}
@Override
public List<CascadeVo> findProductCascade() {
List<QinceProductInfoDto> qinceProductInfoDtos = qinceProductInfoDao.selectList();
Map<String, List<CascadeVo>> casadeMap = new HashMap<>();
// 组装商品
for (QinceProductInfoDto infoDto : qinceProductInfoDtos) {
String className = infoDto.getClassName();
List<CascadeVo> cascades = null;
if (casadeMap.containsKey(className)) {
cascades = casadeMap.get(className);
} else {
cascades = new ArrayList<>();
}
cascades.add(new CascadeVo(infoDto.getPrdName(), infoDto.getPrdId()));
casadeMap.put(className, cascades);
}
List<CascadeVo> cascades = new ArrayList<>();
for (Map.Entry<String, List<CascadeVo>> entry : casadeMap.entrySet()) {
cascades.add(new CascadeVo(entry.getKey(), entry.getKey(), entry.getValue()));
}
return cascades;
}
}
......@@ -35,13 +35,12 @@ public class WeChatUserCoreServiceImpl implements WeChatUserCoreService {
@Override
public boolean saveWxUserInfoTemporary(WxTemporaryInfoDto temporaryDto) {
// 根据chargerQcId查询人员详情
temporaryDto.setChargerQcId("7854192836507620251");
QinCeEmployeeDto qcEmpDto = qinCeEmployeeDao.selectOntByQcId(temporaryDto.getChargerQcId());
if (Objects.isNull(qcEmpDto)){
log.info("促销员注册,根据qc_id:{}查询负责人为空",temporaryDto.getChargerQcId());
throw new ParamException(RCode.CHARGER_ID_ERROR,null);
}
temporaryDto.setChargerName(qcEmpDto.getEmpName());
// QinCeEmployeeDto qcEmpDto = qinCeEmployeeDao.selectOntByQcId(temporaryDto.getChargerQcId());
// if (Objects.isNull(qcEmpDto)){
// log.info("促销员注册,根据qc_id:{}查询负责人为空",temporaryDto.getChargerQcId());
// 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;
......
......@@ -40,6 +40,10 @@ public class QinCeUtils {
public static final String QUERY_SHORE = "/api/store/v1/queryStore/";
// 客户位置偏差查询
public static final String CAL_DISTANCE = "/api/cmLocation/v1/calDistance/";
// 商品类型查询
public static final String QUERY_PRODUCT_PD_TYPE = "/api/product/v1/queryPdType/";
// 商品列表
public static final String QUERY_PRODUCT = "/api/product/v1/queryProduct/";
public String builderUrl(String sidepath, Map<String, Object> params) {
String msgId = UUID.randomUUID().toString();
......@@ -59,6 +63,16 @@ public class QinCeUtils {
return builder.toString();
}
/**
* 查询[部门]参数
*/
public Map<String, Object> productQueryPdTypeParam() {
Map<String, Object> params = new HashMap<>();
params.put("type_name", "");
params.put("type_id", "");
return params;
}
/**
* 查询[部门]参数
*/
......@@ -112,7 +126,7 @@ public class QinCeUtils {
params.put("page_number", pageNum);
// 记录状态。0:已删除,1:正常
// 0:已删除:客户回收站中的终端数据
params.put("status", "");
params.put("status", "1");
// 勤策的门店唯一ID
params.put("id", "");
// 来源于第三方系统的门店唯一ID,对应新增门店 (store_id)字段,只有当数据来源于新增接口时才有值,如果数据从勤策系统中直接创建则该字段值为空。 如果两个值同时存在则优先顺序为store_waiqin_id、store_id
......@@ -126,9 +140,9 @@ public class QinCeUtils {
// 门店类型编码,store_type、store_type_code如果同时存在优先取store_type_code
params.put("store_type_code", "");
// 门店类型
params.put("store_type", "");
// 门店所属销售区域,此字段需要销售区域的完整层级结构, 多层级间以“,”分隔,如:华中大区,南京分区,秦淮社区
params.put("store_district", "");
params.put("store_status", "1");
// 门店审批状态。1:待审批,2:审批打回,3:审批通过
params.put("store_approval_status", "3");
return params;
}
......@@ -163,4 +177,9 @@ public class QinCeUtils {
return digest;
}
public Map<String, Object> queryProductParam() {
Map<String, Object> params = new HashMap<>();
params.put("prd_id", "");
return params;
}
}
<?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.PromotionStoreMapper">
<resultMap id="BaseResultMap" type="com.wangxiaolu.promotion.domain.activity.mapper.entity.PromotionStoreDO">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="storeName" column="store_name" jdbcType="VARCHAR"/>
<result property="storePhotoUrl" column="store_photo_url" jdbcType="VARCHAR"/>
<result property="lineName" column="line_name" jdbcType="VARCHAR"/>
<result property="coordinates" column="coordinates" jdbcType="VARCHAR"/>
<result property="province" column="province" jdbcType="VARCHAR"/>
<result property="city" column="city" jdbcType="VARCHAR"/>
<result property="area" column="area" jdbcType="VARCHAR"/>
<result property="street" column="street" jdbcType="VARCHAR"/>
<result property="address" column="address" jdbcType="VARCHAR"/>
<result property="temporaryId" column="temporary_id" jdbcType="INTEGER"/>
<result property="temporaryName" column="temporary_name" jdbcType="VARCHAR"/>
<result property="deptQcId" column="dept_qc_id" jdbcType="VARCHAR"/>
<result property="deptQcOrgName" column="dept_qc_org_name" jdbcType="VARCHAR"/>
<result property="chargerQcId" column="charger_qc_id" jdbcType="VARCHAR"/>
<result property="chargerName" column="charger_name" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,store_name,store_photo_url,
line_name,coordinates,province,
city,area,street,
address,temporary_id,temporary_name,
dept_qc_id,dept_qc_org_name,charger_qc_id,
charger_name,create_time,modify_time
</sql>
</mapper>
<?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.user.mapper.QinceProductInfoMapper">
<resultMap id="BaseResultMap" type="com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductInfoDO">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="prdId" column="prd_id" jdbcType="VARCHAR"/>
<result property="prdWaiqin365Id" column="prd_waiqin365_id" jdbcType="VARCHAR"/>
<result property="prdName" column="prd_name" jdbcType="VARCHAR"/>
<result property="classId" column="class_id" jdbcType="VARCHAR"/>
<result property="className" column="class_name" jdbcType="VARCHAR"/>
<result property="classFullPath" column="class_full_path" jdbcType="VARCHAR"/>
<result property="prdUnit" column="prd_unit" jdbcType="VARCHAR"/>
<result property="prdSpec" column="prd_spec" jdbcType="VARCHAR"/>
<result property="classification" column="classification" jdbcType="VARCHAR"/>
<result property="prdCode" column="prd_code" jdbcType="VARCHAR"/>
<result property="prdSaleStatus" column="prd_sale_status" jdbcType="VARCHAR"/>
<result property="saleStatus" column="sale_status" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,prd_id,prd_waiqin365_id,
prd_name,class_id,class_name,
class_full_path,prd_unit,prd_spec,
classification,prd_code,prd_sale_status,
sale_status,status,create_time,
modify_time
</sql>
</mapper>
<?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.user.mapper.QinceProductTypeMapper">
<resultMap id="BaseResultMap" type="com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductTypeDO">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="prdWaiqin365Id" column="prd_waiqin365_id" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,prd_waiqin365_id,parent_id,
name,status,create_time,
modify_time
</sql>
</mapper>
......@@ -13,6 +13,9 @@
<result property="noonClockInTime" column="noon_clock_in_time" jdbcType="TIMESTAMP"/>
<result property="clockOutTime" column="clock_out_time" jdbcType="TIMESTAMP"/>
<result property="createDate" column="create_date" jdbcType="CHAR"/>
<result property="clockProvince" column="clock_province" jdbcType="VARCHAR"/>
<result property="clockCity" column="clock_city" jdbcType="VARCHAR"/>
<result property="createDate" column="create_date" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -36,12 +39,14 @@
tc.clock_in_time,
tc.noon_clock_out_time,
tc.noon_clock_in_time,
tc.clock_out_time
tc.clock_out_time,
tc.clock_province,
tc.clock_city,
tc.create_date
from temporary_info ti
inner join temporary_activity_clock tc on ti.id = tc.temporary_id
where tc.id &lt;= (select max(id)
from temporary_activity_clock)
and ti.charger_qc_id = #{employeeQcId}
order by id desc
limit #{skipNum}, #{pageSize};
</select>
......@@ -54,11 +59,13 @@
tc.clock_in_time,
tc.noon_clock_out_time,
tc.noon_clock_in_time,
tc.clock_out_time
tc.clock_out_time,
tc.clock_province,
tc.clock_city,
tc.create_date
from temporary_info ti
inner join temporary_activity_clock tc on ti.id = tc.temporary_id
where tc.id &lt; #{maxId}
and ti.charger_qc_id = #{employeeQcId}
order by id desc limit #{pageSize};
</select>
......@@ -68,7 +75,6 @@
inner join temporary_activity_clock tc on ti.id = tc.temporary_id
where tc.id &lt;= (select max(id)
from temporary_activity_clock)
and ti.charger_qc_id = #{employeeQcId}
</select>
</mapper>
<?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.TemporaryActivityMarketCellMapper">
<resultMap id="BaseResultMap" type="com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityMarketCellDO">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="temporaryId" column="temporary_id" jdbcType="INTEGER"/>
<result property="className" column="class_name" jdbcType="VARCHAR"/>
<result property="prdId" column="prd_id" jdbcType="VARCHAR"/>
<result property="prdName" column="prd_name" jdbcType="VARCHAR"/>
<result property="bag" column="bag" jdbcType="INTEGER"/>
<result property="box" column="box" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="createDate" column="create_date" jdbcType="CHAR"/>
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,temporary_id,class_name,
prd_id,prd_name,bag,
box,create_time,create_date,
modify_time
</sql>
<insert id="saveList" parameterType="java.util.List">
INSERT INTO temporary_activity_market_cell (activity_reported_id, temporary_id, class_name, prd_id, prd_name, bag, box, create_date)
VALUES
<foreach collection="list" index="index" item="item" separator="," >
(#{item.activityReportedId},#{item.temporaryId},#{item.className},#{item.prdId},#{item.prdName},#{item.bag},#{item.box},#{item.createDate})
</foreach>
</insert>
</mapper>
......@@ -33,4 +33,9 @@ class QinCeDataTaskControllerTest {
void shopDetailAllTask() {
qinCeDataTaskController.shopDetailAllTask();
}
@Test
void productAllTask() {
qinCeDataTaskController.productAllTask();
}
}
\ No newline at end of file
package com.wangxiaolu.promotion.service.activity.temporary.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论