提交 40984e26 authored 作者: 窦馨雨's avatar 窦馨雨

合并分支 'dxy' 到 'qa'

新增促销员修改门店信息接口 查看合并请求 !64
......@@ -13,10 +13,7 @@ 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @author : liqiulin
......@@ -68,4 +65,14 @@ public class TemporaryInfoCoreController {
return R.success(weChatUserCoreService.saveWxUserInfoTemporary(temporaryDto));
}
@PutMapping("/temporary/changeStoreInfo")
public R changeUserInfo(@RequestBody WxTemporaryEnrollVo wxTemporaryEnrollVo) {
if (wxTemporaryEnrollVo.getOpenId() == null){
throw new ParamException(RCode.WX_OPENID_PARAM_ERROR, null);
}
WxTemporaryInfoDto temporaryDto = new WxTemporaryInfoDto();
BeanUtils.copyProperties(wxTemporaryEnrollVo, temporaryDto);
return R.success(weChatUserCoreService.saveWxUserStoreInfoTemporary(temporaryDto));
}
}
......@@ -72,12 +72,20 @@ public class TemporaryInfoQueryController {
/**
* 注册时获取门店列表
* @param planMonth 计划月份
* @param
* @return 门店列表
*/
@GetMapping("/temporary/findStoreList")
public R findStoreList(@RequestParam("planMonth") String planMonth) {
return R.success(weChatUserQueryService.findStoreList(planMonth));
public R findStoreList(@RequestParam("planDay") String planDay,@RequestParam(value = "storeNameKeyword",required = false) String storeNameKeyword) {
return R.success(weChatUserQueryService.findStoreList(planDay,storeNameKeyword));
}
@PostMapping("/temporary/findTemporaryWorkStore")
public R findTemporaryInfo(@RequestBody TemporaryRegisterVo temporaryRegisterVo) {
if (StringUtils.isBlank(temporaryRegisterVo.getOpenId())) {
throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
}
return R.success(weChatUserQueryService.findTemporaryWorkStore(temporaryRegisterVo.getOpenId()));
}
private void phontAndOpenIdVerify(WxTemporaryLoginVo wxTemporaryLoginVo) {
......
......@@ -42,9 +42,9 @@ public interface ActivityPlanInfoDao {
/**
* 根据位置信息查询当前月份的促销门店
* @param planMonth 查询条件参数
* @param planDay 查询条件参数
* @return 门店信息列表
*/
List<Map<String, String>> findThisMonthStoreListByLocation(String planMonth);
List<Map<String, String>> findThisMonthStoreListByLocation(String planDay,String storeNameKeyword);
}
......@@ -129,22 +129,14 @@ public class ActivityPlanInfoDaoImpl implements ActivityPlanInfoDao {
/**
* 根据地理位置信息查询本店本月门店列表
* @param planMonth 查询条件参数
* @param planDay 查询条件参数
* @return 门店列表
*/
@Override
public List<Map<String, String>> findThisMonthStoreListByLocation(String planMonth) {
LambdaQueryWrapper<ActivityPlanInfoDo> qw = new LambdaQueryWrapper<>();
qw.likeRight(ActivityPlanInfoDo::getDate,planMonth);
List<ActivityPlanInfoDo> activityPlanInfoDoList = activityPlanInfoMapper.selectList(qw);
List<Map<String, String>> resultList = activityPlanInfoDoList.stream().map(activityPlanInfoDo -> {
Map<String, String> map = new HashMap<>();
map.put("storeCode", activityPlanInfoDo.getStoreCode());
map.put("storeName", activityPlanInfoDo.getStoreName());
return map;
}).collect(Collectors.toList());
return resultList;
public List<Map<String, String>> findThisMonthStoreListByLocation(String planDay,String storeNameKeyword) {
List<Map<String, String>> activityPlanInfoDoList = activityPlanInfoMapper.selectStoreInfoByCondition(planDay,storeNameKeyword);
return activityPlanInfoDoList;
}
private LambdaQueryWrapper<ActivityPlanInfoDo> buildWrapper(ActivityPlanInfoWrapper wrapper) {
......
......@@ -7,10 +7,12 @@ import com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper;
import com.wangxiaolu.promotion.pojo.activity.planv2.dto.ActivityPlanInfoDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author a02200059
......@@ -39,6 +41,27 @@ public interface ActivityPlanInfoMapper extends BaseMapper<ActivityPlanInfoDo> {
List<ActivityPlanInfoDo> findClockList(ActivityPlanInfoWrapper wrapper);
void updateByIds(@Param("ids") List<Long> planIds, @Param("planDto") ActivityPlanInfoDto planDto);
/**
* 查询符合条件的门店编码和名称(去重)
* @param date 日期阈值(格式:yyyy-MM-dd)
* @param storeNameKeyword 门店名称关键词
* @return 包含store_code和store_name的结果列表
*/
@Select({
"<script>",
"SELECT DISTINCT api.store_code AS storeCode, api.store_name AS storeName ",
"FROM activity_plan_info api ",
"WHERE api.`date` > #{date} ",
"<if test='storeNameKeyword != null and storeNameKeyword != \"\"'>",
"AND api.store_name LIKE CONCAT('%', #{storeNameKeyword}, '%')",
"</if>",
"</script>"
})
List<Map<String, String>> selectStoreInfoByCondition(
@Param("date") String date,
@Param("storeNameKeyword") String storeNameKeyword
);
}
......
......@@ -28,4 +28,6 @@ public interface TemporaryInfoDao {
void updateById(WxTemporaryInfoDto temporaryDto);
WxTemporaryInfoDto selectByPhone(String phone);
int saveWxUserStoreInfoTemporary(WxTemporaryInfoDto temporaryDto);
}
......@@ -94,6 +94,14 @@ public class TemporaryInfoDaoImpl implements TemporaryInfoDao {
return transitionDto(temDo);
}
@Override
public int saveWxUserStoreInfoTemporary(WxTemporaryInfoDto temporaryDto) {
TemporaryInfoDO entity = new TemporaryInfoDO();
BeanUtils.copyProperties(temporaryDto, entity);
return temporaryInfoMapper.updateById(entity);
}
private LambdaQueryWrapper<TemporaryInfoDO> buildQueryList(TemporaryWrapper tw) {
LambdaQueryWrapper<TemporaryInfoDO> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(tw.getOpenId())) {
......
......@@ -13,23 +13,8 @@ import java.util.Date;
@Data
public class TemporaryRegisterVo {
/**
* 当前月份 YYYY-MM
*/
private YearMonth month;
/**
* 省份
*/
private String province;
/**
* 城市
*/
private String city;
/**
* 区
*/
private String area;
private String openId;
private String phone;
private Long id;
}
......@@ -13,4 +13,12 @@ public interface WeChatUserCoreService {
* 保存促销员用户信息
*/
boolean saveWxUserInfoTemporary(WxTemporaryInfoDto temporaryDto);
/**
* 修改促销员的门店信息
* @param temporaryDto
* @return
*/
boolean saveWxUserStoreInfoTemporary(WxTemporaryInfoDto temporaryDto);
}
......@@ -17,7 +17,7 @@ public interface WeChatUserQueryService {
LoginVo temporaryLoginByPhone(String phone);
List<Map<String, String>> findStoreList(String planMonth);
List<Map<String, String>> findStoreList(String planDay,String storeNameKeyword);
/**
* 根据临时ID查询手机号
......@@ -25,4 +25,7 @@ public interface WeChatUserQueryService {
* @return 手机号
*/
String findUserPhoneByID(Long temporaryId);
Object findTemporaryWorkStore(String openId);
}
......@@ -38,4 +38,18 @@ public class WeChatUserCoreServiceImpl implements WeChatUserCoreService {
log.info("微信-促销员[{}]:[{}]注册成功:{}", saveId, temporaryDto.getName(), JSONObject.toJSONString(temporaryDto));
return saveId > 0;
}
/**
* 保存用户门店信息
* @param temporaryDto
* @return
*/
@Override
public boolean saveWxUserStoreInfoTemporary(WxTemporaryInfoDto temporaryDto) {
WxTemporaryInfoDto wxTemporaryInfoDto = temporaryInfoDao.selectOneByOpenId(temporaryDto.getOpenId());
wxTemporaryInfoDto.setStoreCode(temporaryDto.getStoreCode());
wxTemporaryInfoDto.setStoreName(temporaryDto.getStoreName());
int saveId = temporaryInfoDao.saveWxUserStoreInfoTemporary(wxTemporaryInfoDto);
return saveId > 0;
}
}
......@@ -91,12 +91,22 @@ public class WeChatUserQueryServiceImpl implements WeChatUserQueryService {
}
@Override
public List<Map<String, String>> findStoreList(String planMonth) {
return activityPlanInfoDao.findThisMonthStoreListByLocation(planMonth);
public List<Map<String, String>> findStoreList(String planDay,String storeNameKeyword) {
return activityPlanInfoDao.findThisMonthStoreListByLocation(planDay, storeNameKeyword);
}
@Override
public String findUserPhoneByID(Long temporaryId) {
return temporaryInfoDao.selectOneById(temporaryId).getPhone();
}
@Override
public Map<String,String> findTemporaryWorkStore(String openId) {
WxTemporaryInfoDto wxTemporaryInfoDto = temporaryInfoDao.selectOneByOpenId(openId);
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("storeCode",wxTemporaryInfoDto.getStoreCode());
resultMap.put("storeName",wxTemporaryInfoDto.getStoreName());
return resultMap;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论