|
@@ -183,6 +183,47 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
return storeMainInfoVo;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public StoreMainInfoVo getDecorationDetail(Integer id) {
|
|
|
+ StoreInfo storeInfo = storeInfoMapper.selectById(id);
|
|
|
+ StoreMainInfoVo storeMainInfoVo = storeInfoMapper.getStoreInfo(id);
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String expirationDate = sdf.format(storeMainInfoVo.getExpirationTime());
|
|
|
+ storeMainInfoVo.setExpirationDate(expirationDate);
|
|
|
+ //审核通过给前台反显未提交
|
|
|
+ if(storeMainInfoVo.getRenewContractStatus() == 1){
|
|
|
+ storeMainInfoVo.setRenewContractStatus(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (storeMainInfoVo.getBusinessStatus() == -1) {
|
|
|
+ LocalDateTime localDateTime = storeMainInfoVo.getLogoutTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ LocalDateTime future = localDateTime.plusDays(7);
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ Duration duration = Duration.between(now, future);
|
|
|
+ long correct = duration.toMillis();
|
|
|
+ storeMainInfoVo.setCountdown(correct);
|
|
|
+ }
|
|
|
+ //存入门店地址
|
|
|
+ storeMainInfoVo.setStoreAddress(storeInfo.getStoreAddress());
|
|
|
+ //经营种类
|
|
|
+ String[] strings = storeInfo.getBusinessTypes().split(",");
|
|
|
+ storeMainInfoVo.setBusinessTypesList(Arrays.stream(strings).collect(Collectors.toList()));
|
|
|
+ //门店标签
|
|
|
+ storeMainInfoVo.setStoreLabel(storeLabelMapper.selectOne(new LambdaQueryWrapper<StoreLabel>().eq(StoreLabel::getStoreId, id)));
|
|
|
+ //营业时间
|
|
|
+ List<StoreBusinessInfo> storeBusinessInfoList = storeBusinessInfoMapper.selectList(new LambdaQueryWrapper<StoreBusinessInfo>().eq(StoreBusinessInfo::getStoreId, id));
|
|
|
+ storeMainInfoVo.setStoreBusinessInfo(storeBusinessInfoList);
|
|
|
+ storeMainInfoVo.setStoreBusinessInfo(storeBusinessInfoMapper.selectList(new LambdaQueryWrapper<StoreBusinessInfo>().eq(StoreBusinessInfo::getStoreId, id)));
|
|
|
+ //营业执照
|
|
|
+ storeMainInfoVo.setBusinessLicenseList(storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 14).eq(StoreImg::getStoreId, id)));
|
|
|
+ //合同照片
|
|
|
+ storeMainInfoVo.setContractList(storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 15).eq(StoreImg::getStoreId, id)));
|
|
|
+ //是否连锁
|
|
|
+ String isChain = (storeInfo.getIsChain() ==0) ?"否":"是";
|
|
|
+ storeMainInfoVo.setIsChainStr(isChain);
|
|
|
+ return storeMainInfoVo;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 门店信息-修改后展示
|
|
|
*
|
|
@@ -1470,27 +1511,75 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R saveOrUpdateStoreInfo(StoreInfo storeInfo) {
|
|
|
+ public R saveOrUpdateStoreInfo(StoreInfoDto storeInfodto) {
|
|
|
try {
|
|
|
boolean flag = false;
|
|
|
- if (storeInfo.getId() != null) {
|
|
|
+ if (storeInfodto.getId() != null) {
|
|
|
//效验当前店铺存在未完成的订单及正在销售的商品
|
|
|
- verificationStoreInfoStatus(storeInfo);
|
|
|
- if (storeInfo.getBusinessStatus() == 0) {
|
|
|
- StoreInfo storeInfoOne = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, storeInfo.getId()));
|
|
|
+ verificationStoreInfoStatus(storeInfodto);
|
|
|
+ if (storeInfodto.getBusinessStatus() == 0) {
|
|
|
+
|
|
|
+ StoreInfo storeInfoOne = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, storeInfodto.getId()));
|
|
|
if (storeInfoOne.getBusinessStatus() == 99) {
|
|
|
throw new RuntimeException("该店铺已经永久关闭不能更改状态为正常营业");
|
|
|
}
|
|
|
- }
|
|
|
- int num = storeInfoMapper.updateById(storeInfo);
|
|
|
- if (num > 0) {
|
|
|
- flag = true;
|
|
|
- } else {
|
|
|
- throw new RuntimeException("修改失败");
|
|
|
+
|
|
|
+ //获取经营板块id
|
|
|
+ Integer businessSection = storeInfodto.getBusinessSection();
|
|
|
+ //查询经营板块名称
|
|
|
+ StoreDictionary businessSectionName = storeDictionaryMapper.selectOne(new LambdaQueryWrapper<StoreDictionary>().eq(StoreDictionary::getDictId, businessSection).eq(StoreDictionary::getTypeName, "business_section"));
|
|
|
+ //查询经营种类
|
|
|
+ List<String> businessTypes = storeInfodto.getBusinessTypes();
|
|
|
+ List<String> businessTypeNames = new ArrayList<>();
|
|
|
+ //获取经营种类名称
|
|
|
+ for (String businessType : businessTypes) {
|
|
|
+ StoreDictionary storeDictionary =
|
|
|
+ storeDictionaryMapper
|
|
|
+ .selectOne(
|
|
|
+ new LambdaQueryWrapper<StoreDictionary>()
|
|
|
+ .eq(StoreDictionary::getDictId, businessType).eq(StoreDictionary::getParentId, businessSectionName.getId()));
|
|
|
+ businessTypeNames.add(storeDictionary.getDictDetail());
|
|
|
+ }
|
|
|
+
|
|
|
+ StoreInfo storeInfo = new StoreInfo();
|
|
|
+ BeanUtils.copyProperties(storeInfodto, storeInfo);
|
|
|
+//
|
|
|
+ //存入门店状态
|
|
|
+ storeInfo.setStoreStatus(storeInfodto.getStoreStatus());
|
|
|
+ //存入经纬度
|
|
|
+ storeInfo.setStorePosition(storeInfodto.getStorePositionLongitude() + "," + storeInfodto.getStorePositionLatitude());
|
|
|
+
|
|
|
+ //板块及类型
|
|
|
+ storeInfo.setBusinessSection(businessSection);
|
|
|
+ storeInfo.setBusinessSectionName(businessSectionName.getDictDetail());
|
|
|
+ storeInfo.setBusinessTypes(String.join(",", businessTypes));
|
|
|
+ storeInfo.setBusinessTypesName(String.join(",", businessTypeNames));
|
|
|
+ //处理一下行政区域信息
|
|
|
+ EssentialCityCode essentialCityCode1 =
|
|
|
+ essentialCityCodeMapper.selectOne(new LambdaQueryWrapper<EssentialCityCode>().eq(EssentialCityCode::getAreaCode, storeInfo.getAdministrativeRegionProvinceAdcode()));
|
|
|
+ storeInfo.setAdministrativeRegionProvinceName(essentialCityCode1.getAreaName());
|
|
|
+ EssentialCityCode essentialCityCode2 =
|
|
|
+ essentialCityCodeMapper.selectOne(new LambdaQueryWrapper<EssentialCityCode>().eq(EssentialCityCode::getAreaCode, storeInfo.getAdministrativeRegionCityAdcode()));
|
|
|
+ storeInfo.setAdministrativeRegionCityName(essentialCityCode2.getAreaName());
|
|
|
+ EssentialCityCode essentialCityCode3 =
|
|
|
+ essentialCityCodeMapper.selectOne(new LambdaQueryWrapper<EssentialCityCode>().eq(EssentialCityCode::getAreaCode, storeInfo.getAdministrativeRegionDistrictAdcode()));
|
|
|
+ storeInfo.setAdministrativeRegionDistrictName(essentialCityCode3.getAreaName());
|
|
|
+ storeInfoMapper.updateById(storeInfo);
|
|
|
+ nearMeService.inGeolocation(new Point(Double.parseDouble(storeInfodto.getStorePositionLongitude()),
|
|
|
+ Double.parseDouble(storeInfodto.getStorePositionLatitude())), storeInfo.getId().toString(), Boolean.TRUE);
|
|
|
+
|
|
|
+ int num = storeInfoMapper.updateById(storeInfoOne);
|
|
|
+ if (num > 0) {
|
|
|
+ flag = true;
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("修改失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- int num = storeInfoMapper.insert(storeInfo);
|
|
|
+ StoreInfo storeInfoOne = new StoreInfo();
|
|
|
+ BeanUtils.copyProperties(storeInfodto, storeInfoOne);
|
|
|
+ int num = storeInfoMapper.insert(storeInfoOne);
|
|
|
if (num > 0) {
|
|
|
flag = true;
|
|
|
} else {
|
|
@@ -1537,7 +1626,69 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
return storeInfoMap;
|
|
|
}
|
|
|
|
|
|
- void verificationStoreInfoStatus(StoreInfo storeInfo) {
|
|
|
+ @Override
|
|
|
+ public void deleteManualStoreInfo(int id) {
|
|
|
+ LambdaQueryWrapper<StoreInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(StoreInfo::getId, id);
|
|
|
+ StoreInfo storeInfo = storeInfoMapper.selectOne(queryWrapper);
|
|
|
+ if(storeInfo!=null && storeInfo.getBusinessStatus() == -1){
|
|
|
+ int num = storeInfoMapper.deleteById(id);
|
|
|
+ if(num<=0){
|
|
|
+ throw new RuntimeException("删除失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int uploadRenewalContract(List<StoreImg> storeImgList) {
|
|
|
+ int num = 0;
|
|
|
+ for (StoreImg renewContract : storeImgList) {
|
|
|
+ StoreImg storeImg = new StoreImg();
|
|
|
+ storeImg.setStoreId(renewContract.getStoreId());
|
|
|
+ storeImg.setImgType(22);
|
|
|
+ storeImg.setImgSort(0);
|
|
|
+ storeImg.setImgDescription("续签合同图片");
|
|
|
+ storeImg.setImgUrl(renewContract.getImgUrl());
|
|
|
+ storeImg.setCreatedUserId(renewContract.getCreatedUserId());
|
|
|
+ num = storeImgMapper.insert(storeImg);
|
|
|
+ if(num>0){
|
|
|
+ Optional<Integer> storeId = storeImgList.stream().map(StoreImg::getStoreId).findFirst();
|
|
|
+ int value = storeId.orElse(0);
|
|
|
+ StoreInfo storeInfo = new StoreInfo();
|
|
|
+ storeInfo.setRenewContractStatus(2);
|
|
|
+ storeInfo.setId(value);
|
|
|
+ storeInfoMapper.updateById(storeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getStoreContractStatus(int id) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ StoreInfo storeInfo = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId,id));
|
|
|
+ //审核通过给前台反显未提交
|
|
|
+ if(storeInfo.getRenewContractStatus() == 1){
|
|
|
+ map.put("renewContractStatus",0);
|
|
|
+ }else{
|
|
|
+ map.put("renewContractStatus",storeInfo.getRenewContractStatus());
|
|
|
+ }
|
|
|
+ //续签合同照片列表
|
|
|
+ List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 22).eq(StoreImg::getStoreId, id));
|
|
|
+ if(!CollectionUtils.isEmpty(storeImgList)){
|
|
|
+ map.put("contractImgList",storeImgList);
|
|
|
+ }else{
|
|
|
+ map.put("contractImgList","");
|
|
|
+ }
|
|
|
+ if(storeInfo.getContractReason()!=null){
|
|
|
+ map.put("contractReason",storeInfo.getContractReason());
|
|
|
+ }else{
|
|
|
+ map.put("contractReason","");
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ void verificationStoreInfoStatus(StoreInfoDto storeInfo) {
|
|
|
//营业状态 0:正常营业, 1:暂停营业, 2:筹建中, 99:永久关门
|
|
|
if (storeInfo.getBusinessStatus() == 2 || storeInfo.getBusinessStatus() == 99) {
|
|
|
//判断店铺有未完成的订单
|