|
@@ -2,12 +2,22 @@ package com.caimei365.user.service.impl;
|
|
|
|
|
|
import com.caimei365.user.components.RedisService;
|
|
import com.caimei365.user.components.RedisService;
|
|
import com.caimei365.user.mapper.BaseMapper;
|
|
import com.caimei365.user.mapper.BaseMapper;
|
|
-import com.caimei365.user.mapper.RegisterMapper;
|
|
|
|
|
|
+import com.caimei365.user.mapper.ShopMapper;
|
|
|
|
+import com.caimei365.user.model.ResponseJson;
|
|
|
|
+import com.caimei365.user.model.dto.ShopUpdateDto;
|
|
|
|
+import com.caimei365.user.model.po.ShopPo;
|
|
|
|
+import com.caimei365.user.model.po.UserPo;
|
|
|
|
+import com.caimei365.user.model.vo.*;
|
|
import com.caimei365.user.service.ShopService;
|
|
import com.caimei365.user.service.ShopService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Description
|
|
* Description
|
|
@@ -24,6 +34,134 @@ public class ShopServiceImpl implements ShopService {
|
|
@Resource
|
|
@Resource
|
|
private BaseMapper baseMapper;
|
|
private BaseMapper baseMapper;
|
|
@Resource
|
|
@Resource
|
|
- private RegisterMapper registerMapper;
|
|
|
|
|
|
+ private ShopMapper shopMapper;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据用户Id查询供应商资料
|
|
|
|
+ *
|
|
|
|
+ * @param userId 用户Id
|
|
|
|
+ *
|
|
|
|
+ * @return Map(userPo,clubPo)
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<Map<String, Object>> getShopUserInfo(Integer userId) {
|
|
|
|
+ if (null == userId) {
|
|
|
|
+ return ResponseJson.error("参数异常", null);
|
|
|
|
+ }
|
|
|
|
+ // 用户信息
|
|
|
|
+ UserVo user = baseMapper.getUserByUserId(userId);
|
|
|
|
+ if (user == null) {
|
|
|
|
+ return ResponseJson.error("用户信息不存在", null);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isBlank(user.getAuditNote()) && "2".equals(user.getAuditStatus())) {
|
|
|
|
+ ArrayList<String> list = new ArrayList<>();
|
|
|
|
+ if (user.getAuditNote().contains(",")) {
|
|
|
|
+ String[] auditNoteArray = user.getAuditNote().split(",");
|
|
|
|
+ for (String note : auditNoteArray) {
|
|
|
|
+ if (!StringUtils.isBlank(note)) {
|
|
|
|
+ list.add(note);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ list.add(user.getAuditStatus());
|
|
|
|
+ }
|
|
|
|
+ user.setAuditNoteList(list);
|
|
|
|
+ }
|
|
|
|
+ // 供应商信息
|
|
|
|
+ ShopVo shop = shopMapper.getShopById(user.getClubId());
|
|
|
|
+ if (shop == null) {
|
|
|
|
+ return ResponseJson.error("供应商信息不存在", null);
|
|
|
|
+ }
|
|
|
|
+ if (null != shop.getTownId()) {
|
|
|
|
+ TownVo town = baseMapper.getTown(shop.getTownId());
|
|
|
|
+ CityVo city = baseMapper.getCity(town.getCityId());
|
|
|
|
+ ProvinceVo province = baseMapper.getProvince(city.getProvinceId());
|
|
|
|
+ shop.setProvincialAddress(province.getName() + "" + city.getName() + "" + town.getName());
|
|
|
|
+ }
|
|
|
|
+ // 荣誉证书
|
|
|
|
+ List<String> honorCertification = shopMapper.getShopCert(user.getShopId(), 1);
|
|
|
|
+ shop.setHonorCertification(honorCertification);
|
|
|
|
+ // 生产经营证书
|
|
|
|
+ List<String> operationLicence = shopMapper.getShopCert(user.getShopId(), 2);
|
|
|
|
+ if (null != operationLicence && operationLicence.size() > 0) {
|
|
|
|
+ shop.setOperationLicence(operationLicence.get(0));
|
|
|
|
+ }
|
|
|
|
+ // 产品证书
|
|
|
|
+ List<String> productCertification = shopMapper.getShopCert(user.getShopId(), 3);
|
|
|
|
+ shop.setProductCertification(productCertification);
|
|
|
|
+ // 卫生许可证
|
|
|
|
+ List<String> hygienicLicense = shopMapper.getShopCert(user.getShopId(), 5);
|
|
|
|
+ if (null != hygienicLicense && hygienicLicense.size() > 0) {
|
|
|
|
+ shop.setHygienicLicense(hygienicLicense.get(0));
|
|
|
|
+ }
|
|
|
|
+ // 税务登记证
|
|
|
|
+ List<String> taxLicense = shopMapper.getShopCert(user.getShopId(), 6);
|
|
|
|
+ if (null != taxLicense && taxLicense.size() > 0) {
|
|
|
|
+ shop.setTaxLicense(taxLicense.get(0));
|
|
|
|
+ }
|
|
|
|
+ HashMap<String, Object> map = new HashMap(2);
|
|
|
|
+ map.put("user", user);
|
|
|
|
+ map.put("shop", shop);
|
|
|
|
+ return ResponseJson.success(map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<Map<String, Object>> updateShopUserInfo(ShopUpdateDto shopUpdateDto, String operationLicence, String hygienicLicense, String taxLicense, String honorCertification, String productCertification) {
|
|
|
|
+ ShopPo shop = new ShopPo();
|
|
|
|
+ UserPo user = new UserPo();
|
|
|
|
+ if (StringUtils.isNotBlank(shopUpdateDto.getEmail())) {
|
|
|
|
+ Integer userIdByEmail = baseMapper.getUserIdByEmail(shopUpdateDto.getEmail());
|
|
|
|
+ if (null != userIdByEmail && !userIdByEmail.equals(shopUpdateDto.getUserId())) {
|
|
|
|
+ return ResponseJson.error("该邮箱已被使用");
|
|
|
|
+ }
|
|
|
|
+ shop.setContractEmail1(shopUpdateDto.getEmail());
|
|
|
|
+ shop.setContractEmail2(shopUpdateDto.getEmail());
|
|
|
|
+ }
|
|
|
|
+ user.setUserName(shopUpdateDto.getSName());
|
|
|
|
+ /*loginDao.updateUser(user);
|
|
|
|
+ supplierDao.updateShop(shop);
|
|
|
|
+ if (StringUtils.isNotBlank(shopUpdateDto.getSocialCreditCode())) {
|
|
|
|
+ supplierDao.deleteShopCert(shopUpdateDto.getShopID());
|
|
|
|
+ ShopCertVo shopCert = new ShopCertVo();
|
|
|
|
+ shopCert.setShopID(shopUpdateDto.getShopID());
|
|
|
|
+ shopCert.setShopCertTypeID(2);
|
|
|
|
+ shopCert.setImage(shopUpdateDto.getProductionLicence());
|
|
|
|
+ shopCert.setName("生产经营证书");
|
|
|
|
+ supplierDao.insertShopCert(shopCert);
|
|
|
|
+ shopCert.setShopCertTypeID(5);
|
|
|
|
+ shopCert.setImage(shopUpdateDto.getHygienicLicense());
|
|
|
|
+ shopCert.setName("卫生许可证");
|
|
|
|
+ supplierDao.insertShopCert(shopCert);
|
|
|
|
+ shopCert.setShopCertTypeID(6);
|
|
|
|
+ shopCert.setImage(shopUpdateDto.getTaxLicense());
|
|
|
|
+ shopCert.setName("税务登记证");
|
|
|
|
+ supplierDao.insertShopCert(shopCert);
|
|
|
|
+ if (StringUtils.isNotBlank(shopUpdateDto.getCertificateHonor())) {
|
|
|
|
+ String[] images = shopUpdateDto.getCertificateHonor().split(",");
|
|
|
|
+ for (String image : images) {
|
|
|
|
+ if (StringUtils.isNotBlank(image)) {
|
|
|
|
+ shopCert.setShopCertTypeID(1);
|
|
|
|
+ shopCert.setImage(image);
|
|
|
|
+ shopCert.setName("荣誉证书");
|
|
|
|
+ supplierDao.insertShopCert(shopCert);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(shopUpdateDto.getProductCertification())) {
|
|
|
|
+ String[] images = shopUpdateDto.getProductCertification().split(",");
|
|
|
|
+ for (String image : images) {
|
|
|
|
+ if (StringUtils.isNotBlank(image)) {
|
|
|
|
+ shopCert.setShopCertTypeID(3);
|
|
|
|
+ shopCert.setImage(image);
|
|
|
|
+ shopCert.setName("产品证书");
|
|
|
|
+ supplierDao.insertShopCert(shopCert);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return model.success();*/
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|