|
|
|
@ -15,7 +15,9 @@ import com.kiisoo.ic.employee.entity.ImportErrorDTO;
|
|
|
|
|
import com.kiisoo.ic.employee.entity.PrivilageCpUserDO;
|
|
|
|
|
import com.kiisoo.ic.employee.mapper.PrivilageCpUserDOMapper;
|
|
|
|
|
import com.kiisoo.ic.employee.service.EmployeeService;
|
|
|
|
|
import com.kiisoo.ic.generalize.entity.PrivilageOrganizational;
|
|
|
|
|
import com.kiisoo.ic.generalize.entity.PrivilageOrganizationalMember;
|
|
|
|
|
import com.kiisoo.ic.generalize.mapper.RetailCompanyMapper;
|
|
|
|
|
import com.kiisoo.ic.store.bean.PoiStoreStaffDTO;
|
|
|
|
|
import com.kiisoo.ic.store.entity.PoiStore;
|
|
|
|
|
import com.kiisoo.ic.store.entity.PrivilageCpUserStoreDO;
|
|
|
|
@ -35,10 +37,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
|
|
|
|
|
|
import static com.kiisoo.ic.employee.constant.Constants.ADD_CP_CODE_BINDED;
|
|
|
|
|
import static com.kiisoo.ic.store.constant.Constants.*;
|
|
|
|
@ -74,6 +77,9 @@ public class StoreEmployeeService {
|
|
|
|
|
private PrivilageDomainService privilageDomainService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private OpSellerCustomerRelationDOMapper opSellerCustomerRelationDOMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RetailCompanyMapper retailCompanyMapper;
|
|
|
|
|
/**
|
|
|
|
|
* 查询门店号
|
|
|
|
|
* @param storeId 门店id
|
|
|
|
@ -131,42 +137,39 @@ public class StoreEmployeeService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询门店号
|
|
|
|
|
* @param storeId 门店id
|
|
|
|
|
* @param regionId 区域id
|
|
|
|
|
* 批量下载店铺二维码
|
|
|
|
|
* @param response
|
|
|
|
|
*/
|
|
|
|
|
public void downloadStoreUserCode(Long storeId, Long regionId) {
|
|
|
|
|
public void downloadStoreUserCode(HttpServletResponse response) throws IOException {
|
|
|
|
|
Map<String,Object> result = new HashMap<>();
|
|
|
|
|
List<PoiStore> poiStores = null;
|
|
|
|
|
if (storeId != null){
|
|
|
|
|
QueryWrapper<PoiStore> storeParams = new QueryWrapper<>();
|
|
|
|
|
poiStores = poiStoreDOMapper.selectList(storeParams);
|
|
|
|
|
}else if(regionId != null){
|
|
|
|
|
poiStores = poiStoreDOMapper.selectRegionShop(regionId);
|
|
|
|
|
}else{
|
|
|
|
|
poiStores = poiStoreDOMapper.selectList(null);
|
|
|
|
|
|
|
|
|
|
List<PrivilageOrganizational> privilageOrganizationals = retailCompanyMapper.selectList(null);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(privilageOrganizationals)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] buffer = new byte[1024];
|
|
|
|
|
// 生成的ZIP文件名为Demo.zip
|
|
|
|
|
String strZipName = "store_qrCode.zip";
|
|
|
|
|
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(strZipName));
|
|
|
|
|
|
|
|
|
|
for (PrivilageOrganizational privilageOrganizational:privilageOrganizationals) {
|
|
|
|
|
if (privilageOrganizational == null || privilageOrganizational.getId() == null){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
List<StoreUserDTO> storeUserDTOS = new ArrayList<>();
|
|
|
|
|
String fileUrl = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
|
|
|
|
|
|
File file = new File(fileUrl);
|
|
|
|
|
file.mkdir();
|
|
|
|
|
File complayFile = new File(file.getPath()+"/"+privilageOrganizational.getName());
|
|
|
|
|
complayFile.mkdir();
|
|
|
|
|
List<PoiStore> poiStores = poiStoreDOMapper.selectShopByCompany(privilageOrganizational.getId());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(poiStores)){
|
|
|
|
|
for(PoiStore store : poiStores) {
|
|
|
|
|
StoreUserDTO storeUserDTO = new StoreUserDTO();
|
|
|
|
|
BeanUtils.copyProperties(store,storeUserDTO);
|
|
|
|
|
//查询店铺绑定的企业微信
|
|
|
|
|
QueryWrapper<PrivilageCpUserStoreDO> relationParams = new QueryWrapper<>();
|
|
|
|
|
relationParams.eq(DATABASE_STORE_ID_KEY,storeUserDTO.getId());
|
|
|
|
|
PrivilageCpUserStoreDO cpUserStoreDO = privilageCpUserStoreDOMapper.selectOne(relationParams);
|
|
|
|
|
if (cpUserStoreDO != null){
|
|
|
|
|
//企业微信存在则查询数据
|
|
|
|
|
PrivilageCpUserDO privilageCpUserDO = privilageCpUserDOMapper.selectById(cpUserStoreDO.getCpUserId());
|
|
|
|
|
storeUserDTO.setCpUserId(privilageCpUserDO.getCpUserId());
|
|
|
|
|
storeUserDTOS.add(storeUserDTO);
|
|
|
|
|
for (PoiStore poiStore:poiStores){
|
|
|
|
|
// poiStoreDOMapper.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtils.isNotEmpty(storeUserDTOS)){
|
|
|
|
|
storeUserDTOS.forEach(storeUser -> {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|