Commit f3a37a8e by 陶光胜

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-store into developer

parents 880e606e 8bf1db6c
......@@ -84,6 +84,16 @@ public interface StoreDictApiService {
ServiceResponse<List<StoreDictDTO>> listStoreField(Integer enterpriseId);
/**
* 查询支持列表查询的自定义字段:过滤文本类型自定义字段
* @Title: listStoreFieldOfFilterText

* @Description:

* @author guojuxing
* @param enterpriseId

* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.store.dto.StoreDictDTO>>


*/
ServiceResponse<List<StoreDictDTO>> listStoreFieldOfFilterText(Integer enterpriseId);
/**
* 保存自定义字段关联查询
* @param enterpriseId
* @param value
......
......@@ -6,6 +6,7 @@ import com.gic.bizdict.api.service.BizdictService;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.redis.data.util.RedisUtil;
import com.gic.store.constant.StoreFieldTypeEnum;
import com.gic.store.dto.StoreDictDTO;
import com.gic.store.dto.StoreFieldDTO;
import com.gic.store.entity.TabStoreDict;
......@@ -148,25 +149,12 @@ public class StoreDictApiServiceImpl implements StoreDictApiService {
@Override
public ServiceResponse<List<StoreDictDTO>> listStoreField(Integer enterpriseId) {
List<StoreDictDTO> result = new ArrayList<>();
ServiceResponse<List<StoreFieldDTO>> listStoreField = storeFieldApiService.listStoreField(enterpriseId, null);
if(listStoreField.isSuccess()){
List<StoreFieldDTO> list = listStoreField.getResult();
List<String> listSelect = this.storeDictService.listStoreField(enterpriseId);
for(StoreFieldDTO tabStoreField : list){
StoreDictDTO storeDictDTO = new StoreDictDTO();
storeDictDTO.setKey(tabStoreField.getStoreFieldName());
storeDictDTO.setValue(tabStoreField.getStoreFieldId()+"");
storeDictDTO.setOwnType(tabStoreField.getOwnType());
for(String s : listSelect){
if(tabStoreField.getStoreFieldId().intValue() == Integer.valueOf(s).intValue()){
storeDictDTO.setChecked(1);
}
}
result.add(storeDictDTO);
}
}
return ServiceResponse.success(result);
return listStoreField(enterpriseId, false);
}
@Override
public ServiceResponse<List<StoreDictDTO>> listStoreFieldOfFilterText(Integer enterpriseId) {
return listStoreField(enterpriseId, true);
}
@Override
......@@ -283,4 +271,32 @@ public class StoreDictApiServiceImpl implements StoreDictApiService {
}
return result;
}
private ServiceResponse<List<StoreDictDTO>> listStoreField(Integer enterpriseId, boolean isFilterTextField) {
List<StoreDictDTO> result = new ArrayList<>();
ServiceResponse<List<StoreFieldDTO>> listStoreField = storeFieldApiService.listStoreField(enterpriseId, null);
if(listStoreField.isSuccess()){
List<StoreFieldDTO> list = listStoreField.getResult();
List<String> listSelect = this.storeDictService.listStoreField(enterpriseId);
for(StoreFieldDTO tabStoreField : list){
if (isFilterTextField) {
//过滤文本自定义字段
if (tabStoreField.getStoreFieldType().intValue() == StoreFieldTypeEnum.TEXT.getCode()) {
continue;
}
}
StoreDictDTO storeDictDTO = new StoreDictDTO();
storeDictDTO.setKey(tabStoreField.getStoreFieldName());
storeDictDTO.setValue(tabStoreField.getStoreFieldId()+"");
storeDictDTO.setOwnType(tabStoreField.getOwnType());
for(String s : listSelect){
if(tabStoreField.getStoreFieldId().intValue() == Integer.valueOf(s).intValue()){
storeDictDTO.setChecked(1);
}
}
result.add(storeDictDTO);
}
}
return ServiceResponse.success(result);
}
}
......@@ -28,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -56,28 +57,36 @@ public class ClerkImportController {
*/
@RequestMapping("/clerk-import-template-download")
public Object download(HttpServletRequest request, HttpServletResponse response) throws Exception {
List<List<String>> list = new ArrayList<>();
String fileName = " 导购资料导入模板.xlsx";
List<String> list1 = new ArrayList<>();
Collections.addAll(list1, "序号", "导购名", "导购关联主键", "门店名", "门店关联主键", "职位", "性别", "区号", "手机号");
List<String> list2 = new ArrayList<>();
Collections.addAll(list2, "", "必填,不能超过20个字", "必填,不能超过20个字,为导购的唯一识别码", "必填,不能超过20个字", "必填,不能超过20个字", "非必填,不能超过30个字", "\"男\"或\"女\"", "区号,如不填默认为 086", "必填,不能超过20个字");
// 模拟数据
List<String> list3 = new ArrayList<>();
Collections.addAll(list3, "1", "张三", "A011", "测试门店", "A001", "店长", "女", "086", "12345678912");
Collections.addAll(list, list3);
Workbook workbook = ExcelUtils.getWorkbook("导购资料导入模板", list1, list2, list, null);
String fileName = "导购资料导入模板.xlsx";
byte[] bytesName = fileName.getBytes("UTF-8");
fileName = new String(bytesName, "ISO-8859-1");
response.setHeader("content-disposition", "attachment;fileName=" + fileName);
OutputStream out = response.getOutputStream();
workbook.write(out);
out.close();
OutputStream fo = null;
InputStream in = null;
try {
response.setContentType("text/html;charset=gbk");
response.setHeader("Content-Disposition",
"attachment; filename=" + new String(fileName.getBytes("gbk"), "ISO-8859-1"));
fo = response.getOutputStream();
// String rootPath = request.getSession().getServletContext().getRealPath("/");
// String filePath = "excel/store_tag_batch_import.xlsx";
// in = new FileInputStream(new File(rootPath + filePath));
in = this.getClass().getClassLoader().getResourceAsStream("excel/clerk_batch_import.xlsx");
byte[] b = new byte[1024];
int len = 0;
while ((len = in.read(b)) != -1) {
fo.write(b, 0, len);
}
fo.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (fo != null) {
fo.close();
}
if (in != null) {
in.close();
}
}
return RestResponse.success();
}
......
......@@ -169,7 +169,7 @@ public class StoreDictController {
systemField.add(new StoreDictVO(StoreESFieldsEnum.CREATETYPE.getDesc(), StoreESFieldsEnum.CREATETYPE.getField()));
systemField.add(new StoreDictVO(StoreESFieldsEnum.STORETYPE.getDesc(), StoreESFieldsEnum.STORETYPE.getField()));
systemField.add(new StoreDictVO(StoreESFieldsEnum.ERPSTATUS.getDesc(), StoreESFieldsEnum.ERPSTATUS.getField()));
ServiceResponse serviceResponse = this.storeDictApiService.listStoreField(enterpriseId);
ServiceResponse serviceResponse = this.storeDictApiService.listStoreFieldOfFilterText(enterpriseId);
if(serviceResponse.isSuccess()){
List<StoreDictVO> customFields = EntityUtil.changeEntityListByJSON(StoreDictVO.class, serviceResponse.getResult());
systemField.addAll(customFields);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment