提交 3b6d6ce0 authored 作者: douxy's avatar douxy

CP计划小程序改造,新增页面修改促销员门店

上级 fed2fa70
...@@ -81,8 +81,12 @@ public class TemporaryInfoCoreController { ...@@ -81,8 +81,12 @@ public class TemporaryInfoCoreController {
throw new ParamException(RCode.WX_OPENID_PARAM_ERROR, null); throw new ParamException(RCode.WX_OPENID_PARAM_ERROR, null);
} }
Map<String, Object> temporaryWorkStore = weChatUserQueryService.findTemporaryWorkStore(wxTemporaryEnrollVo.getOpenId(), LocalDate.now().toString()); Map<String, Object> temporaryWorkStore = weChatUserQueryService.findTemporaryWorkStore(wxTemporaryEnrollVo.getOpenId(), LocalDate.now().toString());
boolean isHqChangeFlag = false;
if (Objects.isNull(temporaryWorkStore) ) { // 先判空,再比较:只有非null且等于1时,才判定为“总部修改”
if (wxTemporaryEnrollVo.getIsHqChange() != null && wxTemporaryEnrollVo.getIsHqChange() == 1) {
isHqChangeFlag = true;
}
if (Objects.isNull(temporaryWorkStore) || isHqChangeFlag) {
WxTemporaryInfoDto temporaryDto = new WxTemporaryInfoDto(); WxTemporaryInfoDto temporaryDto = new WxTemporaryInfoDto();
BeanUtils.copyProperties(wxTemporaryEnrollVo, temporaryDto); BeanUtils.copyProperties(wxTemporaryEnrollVo, temporaryDto);
weChatUserCoreService.saveWxUserStoreInfoTemporary(temporaryDto); weChatUserCoreService.saveWxUserStoreInfoTemporary(temporaryDto);
......
...@@ -3,6 +3,7 @@ package com.wangxiaolu.promotion.controller.user.tem; ...@@ -3,6 +3,7 @@ package com.wangxiaolu.promotion.controller.user.tem;
import com.wangxiaolu.promotion.common.redis.service.RedisCache; import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.common.util.DataUtils; import com.wangxiaolu.promotion.common.util.DataUtils;
import com.wangxiaolu.promotion.exception.ParamException; import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.user.vo.LoginVo; import com.wangxiaolu.promotion.pojo.user.vo.LoginVo;
import com.wangxiaolu.promotion.pojo.user.vo.TemporaryRegisterVo; import com.wangxiaolu.promotion.pojo.user.vo.TemporaryRegisterVo;
import com.wangxiaolu.promotion.pojo.user.vo.WxTemporaryLoginVo; import com.wangxiaolu.promotion.pojo.user.vo.WxTemporaryLoginVo;
...@@ -88,6 +89,16 @@ public class TemporaryInfoQueryController { ...@@ -88,6 +89,16 @@ public class TemporaryInfoQueryController {
return R.success(weChatUserQueryService.findTemporaryWorkStore(temporaryRegisterVo.getOpenId(),temporaryRegisterVo.getDate())); return R.success(weChatUserQueryService.findTemporaryWorkStore(temporaryRegisterVo.getOpenId(),temporaryRegisterVo.getDate()));
} }
/**
* 促销员信息 - 分页查询
* @param
*/
@PostMapping("/temporary/page")
public R findTemporaryInfo(@RequestBody PageInfo pageInfo) {
weChatUserQueryService.queryPage(pageInfo);
return R.success(pageInfo);
}
private void phontAndOpenIdVerify(WxTemporaryLoginVo wxTemporaryLoginVo) { private void phontAndOpenIdVerify(WxTemporaryLoginVo wxTemporaryLoginVo) {
if (StringUtils.isBlank(wxTemporaryLoginVo.getOpenId()) || StringUtils.isBlank(wxTemporaryLoginVo.getPhone())) { if (StringUtils.isBlank(wxTemporaryLoginVo.getOpenId()) || StringUtils.isBlank(wxTemporaryLoginVo.getPhone())) {
throw new ParamException(RCode.LOGIN_PARAM_ERROR, null); throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
...@@ -95,4 +106,5 @@ public class TemporaryInfoQueryController { ...@@ -95,4 +106,5 @@ public class TemporaryInfoQueryController {
} }
} }
package com.wangxiaolu.promotion.domain.activityplanv2.dao; package com.wangxiaolu.promotion.domain.activityplanv2.dao;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo;
import com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper; import com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper;
import com.wangxiaolu.promotion.enums.plan.PlanStatus; import com.wangxiaolu.promotion.enums.plan.PlanStatus;
import com.wangxiaolu.promotion.pojo.PageInfo; import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.planv2.dto.ActivityPlanInfoDto; import com.wangxiaolu.promotion.pojo.activity.planv2.dto.ActivityPlanInfoDto;
import com.wangxiaolu.promotion.pojo.user.vo.TemporaryRegisterVo;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -47,4 +45,6 @@ public interface ActivityPlanInfoDao { ...@@ -47,4 +45,6 @@ public interface ActivityPlanInfoDao {
*/ */
List<Map<String, String>> findThisMonthStoreListByLocation(String planDay,String storeNameKeyword); List<Map<String, String>> findThisMonthStoreListByLocation(String planDay,String storeNameKeyword);
Integer selectCount(ActivityPlanInfoWrapper wrapper);
} }
...@@ -14,7 +14,6 @@ import com.wangxiaolu.promotion.exception.DataException; ...@@ -14,7 +14,6 @@ import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.exception.FlowException; import com.wangxiaolu.promotion.exception.FlowException;
import com.wangxiaolu.promotion.pojo.PageInfo; import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.planv2.dto.ActivityPlanInfoDto; import com.wangxiaolu.promotion.pojo.activity.planv2.dto.ActivityPlanInfoDto;
import com.wangxiaolu.promotion.pojo.user.vo.TemporaryRegisterVo;
import com.wangxiaolu.promotion.result.basedata.RCode; import com.wangxiaolu.promotion.result.basedata.RCode;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
...@@ -22,9 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,9 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author : liqiulin * @author : liqiulin
...@@ -139,6 +136,16 @@ public class ActivityPlanInfoDaoImpl implements ActivityPlanInfoDao { ...@@ -139,6 +136,16 @@ public class ActivityPlanInfoDaoImpl implements ActivityPlanInfoDao {
return activityPlanInfoDoList; return activityPlanInfoDoList;
} }
@Override
public Integer selectCount(ActivityPlanInfoWrapper wrapper) {
LambdaQueryWrapper<ActivityPlanInfoDo> wq = new LambdaQueryWrapper<>();
wq.eq(ActivityPlanInfoDo::getStoreCode,wrapper.getStoreCode());
wq.eq(ActivityPlanInfoDo::getEmployeeId,wrapper.getEmployeeId());
wq.ne(ActivityPlanInfoDo::getId,wrapper.getId());
wq.eq(ActivityPlanInfoDo::getDate,wrapper.getActivityDate());
return activityPlanInfoMapper.selectCount(wq);
}
private LambdaQueryWrapper<ActivityPlanInfoDo> buildWrapper(ActivityPlanInfoWrapper wrapper) { private LambdaQueryWrapper<ActivityPlanInfoDo> buildWrapper(ActivityPlanInfoWrapper wrapper) {
LambdaQueryWrapper<ActivityPlanInfoDo> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ActivityPlanInfoDo> qw = new LambdaQueryWrapper<>();
if (wrapper.rangeDate()){ if (wrapper.rangeDate()){
......
...@@ -38,4 +38,6 @@ public interface TemporaryInfoDao { ...@@ -38,4 +38,6 @@ public interface TemporaryInfoDao {
int batchInsertOrUpdate(List<WxTemporaryInfoDto> list); int batchInsertOrUpdate(List<WxTemporaryInfoDto> list);
void page(PageInfo pageInfo, TemporaryWrapper wq);
} }
...@@ -3,6 +3,7 @@ package com.wangxiaolu.promotion.domain.user.dao.impl; ...@@ -3,6 +3,7 @@ package com.wangxiaolu.promotion.domain.user.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityReportedDO; import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityReportedDO;
import com.wangxiaolu.promotion.domain.examine.mapper.entity.ActivityExamineDO;
import com.wangxiaolu.promotion.domain.user.dao.TemporaryInfoDao; import com.wangxiaolu.promotion.domain.user.dao.TemporaryInfoDao;
import com.wangxiaolu.promotion.domain.user.mapper.TemporaryInfoMapper; import com.wangxiaolu.promotion.domain.user.mapper.TemporaryInfoMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.TemporaryInfoDO; import com.wangxiaolu.promotion.domain.user.mapper.entity.TemporaryInfoDO;
...@@ -142,6 +143,15 @@ public class TemporaryInfoDaoImpl implements TemporaryInfoDao { ...@@ -142,6 +143,15 @@ public class TemporaryInfoDaoImpl implements TemporaryInfoDao {
return affectRows; return affectRows;
} }
@Override
public void page(PageInfo pageInfo, TemporaryWrapper wq) {
LambdaQueryWrapper<TemporaryInfoDO> qw = buildQueryList(wq);
Page<TemporaryInfoDO> page = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize());
Page<TemporaryInfoDO> doPage = temporaryInfoMapper.selectPage(page, qw);
pageInfo.pageCovert(doPage);
pageInfo.setRecords(doPage.getRecords());
}
private LambdaQueryWrapper<TemporaryInfoDO> buildQueryList(TemporaryWrapper tw) { private LambdaQueryWrapper<TemporaryInfoDO> buildQueryList(TemporaryWrapper tw) {
LambdaQueryWrapper<TemporaryInfoDO> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TemporaryInfoDO> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(tw.getOpenId())) { if (StringUtils.isNotBlank(tw.getOpenId())) {
...@@ -159,6 +169,9 @@ public class TemporaryInfoDaoImpl implements TemporaryInfoDao { ...@@ -159,6 +169,9 @@ public class TemporaryInfoDaoImpl implements TemporaryInfoDao {
if (StringUtils.isNotBlank(tw.getDeptQcId())) { if (StringUtils.isNotBlank(tw.getDeptQcId())) {
queryWrapper.eq(TemporaryInfoDO::getDeptQcId, tw.getDeptQcId()); queryWrapper.eq(TemporaryInfoDO::getDeptQcId, tw.getDeptQcId());
} }
if (StringUtils.isNotBlank(tw.getStoreNameLike())) {
queryWrapper.like(TemporaryInfoDO::getStoreName, tw.getStoreNameLike());
}
return queryWrapper; return queryWrapper;
} }
......
...@@ -36,4 +36,10 @@ public class TemporaryWrapper { ...@@ -36,4 +36,10 @@ public class TemporaryWrapper {
* 所属战区-部门 * 所属战区-部门
*/ */
String deptQcId; String deptQcId;
/**
* 门店名称
*/
String storeNameLike;
} }
...@@ -100,6 +100,12 @@ public class WxTemporaryEnrollVo { ...@@ -100,6 +100,12 @@ public class WxTemporaryEnrollVo {
*/ */
String storeName; String storeName;
/**
* 总部修改标记
*/
Integer isHqChange;
public void validate() { public void validate() {
if (StringUtils.isBlank(openId)) { if (StringUtils.isBlank(openId)) {
throw new ParamException(RCode.WX_OPENID_PARAM_ERROR, null); throw new ParamException(RCode.WX_OPENID_PARAM_ERROR, null);
......
...@@ -5,6 +5,9 @@ import cn.hutool.core.date.DateUtil; ...@@ -5,6 +5,9 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wangxiaolu.promotion.common.enums.StatusType;
import com.wangxiaolu.promotion.common.excel.ReadExcelUtils; import com.wangxiaolu.promotion.common.excel.ReadExcelUtils;
import com.wangxiaolu.promotion.common.redis.RedisKeys; import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache; import com.wangxiaolu.promotion.common.redis.service.RedisCache;
...@@ -12,6 +15,8 @@ import com.wangxiaolu.promotion.domain.activity.dao.ManageEmployeeInfoDao; ...@@ -12,6 +15,8 @@ import com.wangxiaolu.promotion.domain.activity.dao.ManageEmployeeInfoDao;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.ManageEmployeeWrapper; import com.wangxiaolu.promotion.domain.activity.wrapperQo.ManageEmployeeWrapper;
import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao; import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao;
import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanRecordDao; import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanRecordDao;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo;
import com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper;
import com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao; import com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper; import com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper;
import com.wangxiaolu.promotion.enums.plan.OperationType; import com.wangxiaolu.promotion.enums.plan.OperationType;
...@@ -600,6 +605,18 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -600,6 +605,18 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
if (DateUtils.parseDateBylocalDate(dto.getDate()).isBefore(LocalDate.now())) { if (DateUtils.parseDateBylocalDate(dto.getDate()).isBefore(LocalDate.now())) {
throw new FlowException(RCode.ACTIVITY_PLAN_NOT_DELETE); throw new FlowException(RCode.ACTIVITY_PLAN_NOT_DELETE);
} }
ActivityPlanInfoWrapper wrapper = new ActivityPlanInfoWrapper()
.setActivityDate(operVo.getDate())
.setEmployeeId(operVo.getEmployeeId())
.setId(operVo.getId())
.setStoreCode(operVo.getStoreCode());
Integer count = activityPlanInfoDao.selectCount(wrapper);
if (count > 0) {
// 抛出"该日期已存在其他活动计划"的异常(需确保RCode中定义了对应的枚举值)
throw new FlowException(RCode.ACTIVITY_PLAN_DATE_CONFLICT);
}
// 判断修改后 月底 >= 活动日期 > 今日 // 判断修改后 月底 >= 活动日期 > 今日
LocalDate today = LocalDate.now(); LocalDate today = LocalDate.now();
......
package com.wangxiaolu.promotion.service.wechat; package com.wangxiaolu.promotion.service.wechat;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.user.vo.LoginVo; import com.wangxiaolu.promotion.pojo.user.vo.LoginVo;
import com.wangxiaolu.promotion.pojo.user.vo.TemporaryRegisterVo; import com.wangxiaolu.promotion.pojo.user.vo.TemporaryRegisterVo;
...@@ -28,4 +29,5 @@ public interface WeChatUserQueryService { ...@@ -28,4 +29,5 @@ public interface WeChatUserQueryService {
Map<String,Object> findTemporaryWorkStore(String openId,String date); Map<String,Object> findTemporaryWorkStore(String openId,String date);
void queryPage(PageInfo pageInfo);
} }
package com.wangxiaolu.promotion.service.wechat.impl; package com.wangxiaolu.promotion.service.wechat.impl;
import cn.hutool.core.lang.UUID; import cn.hutool.core.lang.UUID;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.common.constant.TokenConstants; import com.wangxiaolu.promotion.common.constant.TokenConstants;
import com.wangxiaolu.promotion.common.redis.RedisKeys; import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache; import com.wangxiaolu.promotion.common.redis.service.RedisCache;
...@@ -8,8 +9,11 @@ import com.wangxiaolu.promotion.common.util.JwtTokenUtils; ...@@ -8,8 +9,11 @@ import com.wangxiaolu.promotion.common.util.JwtTokenUtils;
import com.wangxiaolu.promotion.common.util.JwtUtils; import com.wangxiaolu.promotion.common.util.JwtUtils;
import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao; import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo; import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo;
import com.wangxiaolu.promotion.domain.inspection.wrapper.InspectionInfoWrapper;
import com.wangxiaolu.promotion.domain.user.dao.TemporaryInfoDao; import com.wangxiaolu.promotion.domain.user.dao.TemporaryInfoDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.TemporaryWrapper;
import com.wangxiaolu.promotion.exception.DataException; import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto; import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.pojo.user.vo.LoginVo; import com.wangxiaolu.promotion.pojo.user.vo.LoginVo;
import com.wangxiaolu.promotion.pojo.user.vo.TemporaryRegisterVo; import com.wangxiaolu.promotion.pojo.user.vo.TemporaryRegisterVo;
...@@ -104,4 +108,10 @@ public class WeChatUserQueryServiceImpl implements WeChatUserQueryService { ...@@ -104,4 +108,10 @@ public class WeChatUserQueryServiceImpl implements WeChatUserQueryService {
public Map<String,Object> findTemporaryWorkStore(String openId,String date) { public Map<String,Object> findTemporaryWorkStore(String openId,String date) {
return temporaryInfoDao.selectStoreAndPlan(openId,date); return temporaryInfoDao.selectStoreAndPlan(openId,date);
} }
@Override
public void queryPage(PageInfo pageInfo) {
TemporaryWrapper wq = JSONObject.parseObject(JSONObject.toJSONString(pageInfo.getQueryParams()), TemporaryWrapper.class);
temporaryInfoDao.page(pageInfo,wq);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论