提交 2562f5d4 authored 作者: 李秋林's avatar 李秋林

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

上级 46ad7041
package com.wangxiaolu.promotion.controller.user.qince; package com.wangxiaolu.promotion.controller.user.qince;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.CascadeVo; 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.pojo.user.dto.QinceProductTypeDto;
import com.wangxiaolu.promotion.result.basedata.R; import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.user.QinCeProductQueryService; import com.wangxiaolu.promotion.service.user.QinCeProductQueryService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author : liqiulin * @author : liqiulin
* @date : 2024-06-19 17 * @date : 2024-06-19 17
* @describe : * @describe : 商品信息查询
*/ */
@RestController @RestController
@RequestMapping("/user/qince/query") @RequestMapping("/user/qince/query")
...@@ -24,18 +30,37 @@ public class QinCeProductQueryController { ...@@ -24,18 +30,37 @@ public class QinCeProductQueryController {
QinCeProductQueryService qinCeProductQueryService; QinCeProductQueryService qinCeProductQueryService;
@PostMapping("/product/type/list") @PostMapping("/product/type/list")
public R findProductTypeList(){ public R findProductTypeList() {
List<QinceProductTypeDto> dtos = qinCeProductQueryService.findProductTypeList(); List<QinceProductTypeDto> dtos = qinCeProductQueryService.findProductTypeList();
return R.success(dtos); return R.success(dtos);
} }
/** /**
* 级联选择 * 级联选择
*
* @return * @return
*/ */
@PostMapping("/product/cascade") @PostMapping("/product/cascade")
public R findProductCascade(){ public R findProductCascade() {
List<CascadeVo> dtos = qinCeProductQueryService.findProductCascade(); List<CascadeVo> dtos = qinCeProductQueryService.findProductCascade();
return R.success(dtos); return R.success(dtos);
} }
/**
* 根据69码选择商品
*/
@GetMapping("/product/info")
public R findProductInfo(QinceProductInfoDto params) {
if (StringUtils.isBlank(params.getPrdSpec())) {
throw new ParamException(RCode.BAR_CODE_IS_ERROR, null);
}
QinceProductInfoDto productInfo = qinCeProductQueryService.findProductInfo(params);
if (Objects.isNull(productInfo)) {
throw new ParamException(RCode.BAR_CODE_IS_ERROR, null);
}
return R.success(productInfo);
}
} }
...@@ -71,25 +71,54 @@ public class PromotionStoreDaoImpl implements PromotionStoreDao { ...@@ -71,25 +71,54 @@ public class PromotionStoreDaoImpl implements PromotionStoreDao {
@Override @Override
public void qinceShopDetailAllTask(JSONArray responseDatas) { public void qinceShopDetailAllTask(JSONArray responseDatas) {
// for (Object responseData : responseDatas) { LambdaQueryWrapper<PromotionStoreDO> qw = new LambdaQueryWrapper<>();
// JSONObject jo = JSONObject.parseObject(JSONObject.toJSONString(responseData));
// try { for (Object responseData : responseDatas) {
// PromotionStoreDO storeDo = new PromotionStoreDO(); qw.clear();
// storeDo.setQcId(jo.getString("id"))
// .setStoreName(jo.getString("store_name")) try {
// .setProvince(jo.getString("store_mss_province")) JSONObject jo = JSONObject.parseObject(JSONObject.toJSONString(responseData));
// .setCity(jo.getString("store_mss_city")) PromotionStoreDO storeDo = new PromotionStoreDO();
// .setArea(jo.getString("store_mss_area")) storeDo.setQcId(jo.getString("id"))
// .setStreet(jo.getString("store_mss_street")) .setStoreName(jo.getString("store_name"))
// .setAddress(jo.getString("store_addr")) .setProvince(jo.getString("store_mss_province"))
// .setTemporaryId(0) .setCity(jo.getString("store_mss_city"))
// .setTemporaryName("系统同步"); .setArea(jo.getString("store_mss_area"))
// promotionStoreMapper.insert(storeDo); .setStreet(jo.getString("store_mss_street"))
// } catch (Exception e) { .setAddress(jo.getString("store_addr"))
// log.error("勤策-同步终端store数据异常,异常数据:{}", responseData); .setTemporaryId(0)
// log.error("勤策-同步终端store数据异常\n{}", e.getMessage()); .setTemporaryName("系统同步")
// } .setStoreManager(jo.getString("store_manager"))
// } .setStoreManagerWaiqin365Id(jo.getString("store_manager_waiqin365_id"));
if (StringUtils.isBlank(storeDo.getQcId())) {
continue;
}
JSONArray dealersJR = jo.getJSONArray("dealers");
if (!CollectionUtils.isEmpty(dealersJR)) {
JSONObject dealersJ = dealersJR.getJSONObject(0);
storeDo.setDealersName(dealersJ.getString("dealer_name"))
.setWaiqin365DealersId(dealersJ.getString("waiqin365_dealer_id"));
}
// 判断qc_id是否存在;存在则修改,不存在则新增
qw.eq(PromotionStoreDO::getQcId, storeDo.getQcId());
PromotionStoreDO doExist = promotionStoreMapper.selectOne(qw);
if (Objects.isNull(doExist)) {
promotionStoreMapper.insert(storeDo);
} else {
storeDo.setId(doExist.getId());
promotionStoreMapper.updateById(storeDo);
}
} catch (Exception e) {
log.error("勤策-同步终端到促销店铺数据异常,异常数据:{}", responseData);
log.error("勤策-同步终端到促销店铺数据异常\n{}", e.getMessage());
}
}
} }
@Override @Override
......
...@@ -108,6 +108,26 @@ public class PromotionStoreDO implements Serializable { ...@@ -108,6 +108,26 @@ public class PromotionStoreDO implements Serializable {
*/ */
private String chargerName; private String chargerName;
/**
* 门店经理
*/
private String storeManager;
/**
* 门店经理勤策id
*/
private String storeManagerWaiqin365Id;
/**
* 经销商名称
*/
private String dealersName;
/**
* 经销商勤策id
*/
private String waiqin365DealersId;
/** /**
* 创建时间 * 创建时间
*/ */
......
...@@ -14,7 +14,7 @@ import java.util.List; ...@@ -14,7 +14,7 @@ import java.util.List;
public interface QinCeClienteleStoreDao { public interface QinCeClienteleStoreDao {
/** /**
* 勤策人员数据同步 * 勤策终端数据同步
*/ */
void shopDetailAllTask(JSONArray responseDatas); void shopDetailAllTask(JSONArray responseDatas);
......
...@@ -15,4 +15,5 @@ public interface QinceProductInfoDao { ...@@ -15,4 +15,5 @@ public interface QinceProductInfoDao {
List<QinceProductInfoDto> selectList(); List<QinceProductInfoDto> selectList();
QinceProductInfoDto selectOne(QinceProductInfoDto params);
} }
...@@ -45,6 +45,14 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao { ...@@ -45,6 +45,14 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
try { try {
QinCeClienteleStoreDO qinCeShopDO = JSONObject.parseObject(responseData.toString(), QinCeClienteleStoreDO.class); QinCeClienteleStoreDO qinCeShopDO = JSONObject.parseObject(responseData.toString(), QinCeClienteleStoreDO.class);
// 添加经销商
List<JSONObject> dealers = qinCeShopDO.getDealers();
if (!CollectionUtils.isEmpty(dealers)){
qinCeShopDO.setDealersName(dealers.get(0).getString("dealer_name"));
qinCeShopDO.setWaiqin365DealersId(dealers.get(0).getString("waiqin365_dealer_id"));
}
qw.eq(QinCeClienteleStoreDO::getQcId, qinCeShopDO.getQcId()); qw.eq(QinCeClienteleStoreDO::getQcId, qinCeShopDO.getQcId());
QinCeClienteleStoreDO doExist = qinCeClienteleStoreMapper.selectOne(qw); QinCeClienteleStoreDO doExist = qinCeClienteleStoreMapper.selectOne(qw);
...@@ -58,7 +66,6 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao { ...@@ -58,7 +66,6 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
log.error("勤策-同步终端store数据异常,异常数据:{}", responseData); log.error("勤策-同步终端store数据异常,异常数据:{}", responseData);
log.error("勤策-同步终端store数据异常\n{}", e.getMessage()); log.error("勤策-同步终端store数据异常\n{}", e.getMessage());
} }
} }
......
...@@ -9,6 +9,7 @@ import com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductInfoDO; ...@@ -9,6 +9,7 @@ import com.wangxiaolu.promotion.domain.user.mapper.entity.QinceProductInfoDO;
import com.wangxiaolu.promotion.pojo.user.dto.QinceProductInfoDto; import com.wangxiaolu.promotion.pojo.user.dto.QinceProductInfoDto;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -59,14 +60,30 @@ public class QinceProductInfoDaoImpl implements QinceProductInfoDao { ...@@ -59,14 +60,30 @@ public class QinceProductInfoDaoImpl implements QinceProductInfoDao {
@Override @Override
public List<QinceProductInfoDto> selectList() { public List<QinceProductInfoDto> selectList() {
LambdaQueryWrapper<QinceProductInfoDO> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<QinceProductInfoDO> qw = buildWrapper(new QinceProductInfoDto());
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); List<QinceProductInfoDO> qinceProductInfoDOS = qinceProductInfoMapper.selectList(qw);
return transitionDtos(qinceProductInfoDOS); return transitionDtos(qinceProductInfoDOS);
} }
@Override
public QinceProductInfoDto selectOne(QinceProductInfoDto params) {
LambdaQueryWrapper<QinceProductInfoDO> qw = buildWrapper(params);
QinceProductInfoDO qinceProductInfoDO = qinceProductInfoMapper.selectOne(qw);
return transitionDto(qinceProductInfoDO);
}
private LambdaQueryWrapper<QinceProductInfoDO> buildWrapper(QinceProductInfoDto params) {
LambdaQueryWrapper<QinceProductInfoDO> qw = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(params.getPrdSpec())) {
qw.eq(QinceProductInfoDO::getPrdSpec, "条码" + params.getPrdSpec());
}
qw.eq(QinceProductInfoDO::getSaleStatus, 1).eq(QinceProductInfoDO::getStatus, 1).ne(QinceProductInfoDO::getClassName, "");
qw.select(QinceProductInfoDO::getClassId, QinceProductInfoDO::getClassName, QinceProductInfoDO::getPrdId, QinceProductInfoDO::getPrdName);
return qw;
}
/** /**
* DO to DTO (单个对象) * DO to DTO (单个对象)
* *
......
...@@ -37,7 +37,7 @@ public class QinceProductTypeDaoImpl implements QinceProductTypeDao { ...@@ -37,7 +37,7 @@ public class QinceProductTypeDaoImpl implements QinceProductTypeDao {
for (Object responseData : responseDatas) { for (Object responseData : responseDatas) {
qw.clear(); qw.clear();
// 查询人员是否存在 // 查询商品是否存在
QinceProductTypeDO qcDo = JSONObject.parseObject(JSONObject.toJSONString(responseData), QinceProductTypeDO.class); QinceProductTypeDO qcDo = JSONObject.parseObject(JSONObject.toJSONString(responseData), QinceProductTypeDO.class);
qw.eq(QinceProductTypeDO::getPrdWaiqin365Id, qcDo.getPrdWaiqin365Id()); qw.eq(QinceProductTypeDO::getPrdWaiqin365Id, qcDo.getPrdWaiqin365Id());
QinceProductTypeDO doExist = qinceProductTypeMapper.selectOne(qw); QinceProductTypeDO doExist = qinceProductTypeMapper.selectOne(qw);
......
package com.wangxiaolu.promotion.domain.user.mapper.entity; package com.wangxiaolu.promotion.domain.user.mapper.entity;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
...@@ -503,6 +505,20 @@ public class QinCeClienteleStoreDO implements Serializable { ...@@ -503,6 +505,20 @@ public class QinCeClienteleStoreDO implements Serializable {
@JsonProperty("store_approval_status") @JsonProperty("store_approval_status")
private String storeApprovalStatus; private String storeApprovalStatus;
/**
* 经销商名称
*/
private String dealersName;
/**
* 经销商勤策id
*/
private String waiqin365DealersId;
@TableField(exist = false)
@JsonProperty("dealers")
private List<JSONObject> dealers;
/** /**
* 门店删除状态。0:删除,1:正常 * 门店删除状态。0:删除,1:正常
*/ */
......
package com.wangxiaolu.promotion.service.user; package com.wangxiaolu.promotion.service.user;
import com.wangxiaolu.promotion.pojo.CascadeVo; 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.pojo.user.dto.QinceProductTypeDto;
import java.util.List; import java.util.List;
...@@ -15,5 +16,6 @@ public interface QinCeProductQueryService { ...@@ -15,5 +16,6 @@ public interface QinCeProductQueryService {
List<CascadeVo> findProductCascade(); List<CascadeVo> findProductCascade();
QinceProductInfoDto findProductInfo(QinceProductInfoDto params);
} }
...@@ -83,6 +83,7 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService { ...@@ -83,6 +83,7 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
while (nextPage) { while (nextPage) {
i++; i++;
nextPage = booleanshopDetailPage(i); nextPage = booleanshopDetailPage(i);
nextPage = false;
} }
} }
...@@ -121,7 +122,7 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService { ...@@ -121,7 +122,7 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
} }
log.info("勤策-同步终端store数据,查询到第{}页数据「{}」条", pageNum, responseDatas.size()); log.info("勤策-同步终端store数据,查询到第{}页数据「{}」条", pageNum, responseDatas.size());
// qinCeClienteleShopDao.shopDetailAllTask(responseDatas); qinCeClienteleShopDao.shopDetailAllTask(responseDatas);
promotionStoreDao.qinceShopDetailAllTask(responseDatas); promotionStoreDao.qinceShopDetailAllTask(responseDatas);
return true; return true;
} }
......
...@@ -60,4 +60,9 @@ public class QinCeProductQueryServiceImpl implements QinCeProductQueryService { ...@@ -60,4 +60,9 @@ public class QinCeProductQueryServiceImpl implements QinCeProductQueryService {
return cascades; return cascades;
} }
@Override
public QinceProductInfoDto findProductInfo(QinceProductInfoDto params) {
return qinceProductInfoDao.selectOne(params);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论