Commit 8df905ff by 陶光胜

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

parents 6582cce3 c8185337
package com.gic.store.utils.field;
/**
* @author zhiwj
* @date 2019/7/5
*/
public class FieldBase {
private Integer allowEdit;
private Integer isMust;
private Integer allowRepeat;
public void setAllowEdit(Integer allowEdit) {
this.allowEdit = allowEdit;
}
public void setIsMust(Integer isMust) {
this.isMust = isMust;
}
public void setAllowRepeat(Integer allowRepeat) {
this.allowRepeat = allowRepeat;
}
public boolean getAllowEdit() {
return allowEdit == 1;
}
public boolean getIsMust() {
return isMust == 1;
}
public boolean getAllowRepeat() {
return allowRepeat == 1;
}
}
package com.gic.store.utils.field;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhiwj
* @date 2019/7/5
*/
public class TextField extends FieldBase {
private String tipMessage;
private String textType;
private Integer maxLength;
private Integer minLength;
public String getTipMessage() {
return tipMessage;
}
public void setTipMessage(String tipMessage) {
this.tipMessage = tipMessage;
}
public List<Integer> getTextType() {
List<Integer> result = new ArrayList<>();
String[] list = textType.split(",");
for (String s : list) {
result.add(Integer.parseInt(s));
}
return result;
}
public void setTextType(String textType) {
this.textType = textType;
}
public Integer getMaxLength() {
return maxLength;
}
public void setMaxLength(Integer maxLength) {
this.maxLength = maxLength;
}
public Integer getMinLength() {
return minLength;
}
public void setMinLength(Integer minLength) {
this.minLength = minLength;
}
}
......@@ -11,8 +11,6 @@ import com.gic.store.entity.TabStoreBrand;
import com.gic.store.entity.TabStoreExtend;
import com.gic.store.entity.TabStoreGroup;
import com.gic.store.service.*;
import com.gic.store.utils.ErrorCode;
import com.task.allocation.exception.TaskAllocationException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -203,12 +201,7 @@ public class StoreImportApiServiceImpl implements StoreImportApiService {
@Override
public ServiceResponse<String> importDataToStore(Integer enterpriseId, String userId, String uuId) {
try {
return ServiceResponse.success(storeTaskService.importDataToStore(enterpriseId, userId, uuId));
} catch (TaskAllocationException e) {
logger.warn("队列错误");
}
return ServiceResponse.failure(ErrorCode.ERR_3.getCode(), "队列错误");
}
}
......@@ -30,7 +30,7 @@ import java.util.Optional;
* @author zhiwj
* @date 2019/7/4
*/
@Service
@Service("storeTaskApiService")
public class StoreTaskServiceImpl extends AbstractTaskAllocationOperation implements StoreTaskApiService {
private static final Logger logger = LogManager.getLogger(StoreTaskServiceImpl.class);
......@@ -166,7 +166,7 @@ public class StoreTaskServiceImpl extends AbstractTaskAllocationOperation implem
}
@Override
public String importDataToStore(Integer enterpriseId, String userId, String uuId) throws TaskAllocationException {
public String importDataToStore(Integer enterpriseId, String userId, String uuId) {
// TODO 队列
String message = "";
InitTaskQo initTaskQo = new InitTaskQo();
......@@ -176,8 +176,8 @@ public class StoreTaskServiceImpl extends AbstractTaskAllocationOperation implem
initTaskQo.setTaskType(Constants.STORE_BATCH_IMPORT_TASK_TYPE);// 任务类型
initTaskQo.setParams(enterpriseId.toString());// 你自己处理需要的参数
initTaskQo.setTaskSignKey(uuId);// 任务类型 唯一标识符
TaskAllocationSdkClient instance = TaskAllocationSdkClient.getInstance();// 初始化sdk
try {
TaskAllocationSdkClient instance = TaskAllocationSdkClient.getInstance();// 初始化sdk
instance.initTask(initTaskQo);// 初始化接口
logger.info("门店批量导入队列初始化成功");
} catch (Exception e) {
......
......@@ -36,4 +36,6 @@
<dubbo:service interface="com.gic.store.service.StoreStrategyApiService" ref="storeStrategyApiService" timeout="60000" />
<!--门店导入-->
<dubbo:service interface="com.gic.store.service.StoreImportApiService" ref="storeImportApiService" timeout="60000" />
<dubbo:service interface="com.gic.store.service.StoreTaskApiService" ref="storeTaskApiService" timeout="60000" />
</beans>
......@@ -57,6 +57,13 @@ public class StoreImportController {
@Autowired
private StoreFieldApiService storeFieldApiService;
/**
* 下载模板
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("/store-import-template-download")
public Object download(HttpServletRequest request, HttpServletResponse response) throws Exception {
// ClassPathResource res = new ClassPathResource("门店资料导入模板.xlsx");
......@@ -90,6 +97,14 @@ public class StoreImportController {
return RestResponse.success();
}
/**
* 批量导入
* @param request
* @param file
* @param pageQO
* @return
* @throws IOException
*/
@RequestMapping("/store-tmp-file-upload")
public RestResponse fileUpload(HttpServletRequest request, MultipartFile file, PageQO pageQO) throws IOException {
Integer enterpriseId = 1111;
......@@ -169,6 +184,11 @@ public class StoreImportController {
return RestResponse.success();
}
/**
* 错误日志查看
* @param page
* @return
*/
@RequestMapping("/store-import-load-error-data")
public Object loadErrorData(PageQO page) {
Integer enterpriseId = 1111;
......@@ -184,6 +204,13 @@ public class StoreImportController {
return RestResponse.success(result);
}
/**
* 导出错误日志
* @param request
* @param response
* @return
* @throws IOException
*/
@RequestMapping("/export-error-data")
public RestResponse exportErrorData(HttpServletRequest request, HttpServletResponse response) throws IOException {
Integer enterpriseId = 1111;
......@@ -392,6 +419,10 @@ public class StoreImportController {
storeExtendDTO.setStoreFieldId(fieldList.get(i).getStoreFieldId());
storeExtendDTO.setValue(row.get(14 + i));
storeExtendDTO.setSort(fieldList.get(i).getSort());
// 验证
if (validate) {
// String s = fieldValidate(storeExtendDTO.getValue(), fieldList.get(i).getStoreFieldDetail());
}
extendDTOList.add(storeExtendDTO);
}
bean.setCustomField(JSON.toJSONString(extendDTOList));
......
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