1. 调整bug

This commit is contained in:
ant 2024-07-24 18:46:54 +08:00
parent 99192f2b5c
commit 6a7663dce6
19 changed files with 135 additions and 70 deletions

View File

@ -24,4 +24,9 @@ public @interface DictFormat {
* 是否重写覆盖本身key * 是否重写覆盖本身key
*/ */
boolean rewrite() default false; boolean rewrite() default false;
/**
* 根据 label 获取value , 默认根据value 获取label
*/
boolean labelGetValue() default false;
} }

View File

@ -22,6 +22,7 @@ public class DictJsonSerializer extends JsonSerializer<Object> implements Contex
private String dictType; private String dictType;
private boolean rewrite; private boolean rewrite;
private boolean labelGetValue;
@Override @Override
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException { public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException {
@ -29,6 +30,7 @@ public class DictJsonSerializer extends JsonSerializer<Object> implements Contex
if (Objects.nonNull(anno) && StrUtil.isNotBlank(anno.dictType())) { if (Objects.nonNull(anno) && StrUtil.isNotBlank(anno.dictType())) {
this.dictType = anno.dictType(); this.dictType = anno.dictType();
this.rewrite = anno.rewrite(); this.rewrite = anno.rewrite();
this.labelGetValue = anno.labelGetValue();
return this; return this;
} }
return prov.findValueSerializer(property.getType(), property); return prov.findValueSerializer(property.getType(), property);
@ -37,15 +39,16 @@ public class DictJsonSerializer extends JsonSerializer<Object> implements Contex
public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException { public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
try { try {
if (null != value){ if (null != value){
String dictLabel = DictUtils.getDictLabel(dictType, Convert.toStr(value)); String dict = labelGetValue ? DictUtils.getDictValue(dictType, Convert.toStr(value)) :
DictUtils.getDictLabel(dictType, Convert.toStr(value));
if (rewrite) { if (rewrite) {
// 重写了 原先的 code // 重写了 原先的 code
gen.writeString(dictLabel); gen.writeString(dict);
}else { }else {
// value == code // value == code
gen.writeObject(value); gen.writeObject(value);
gen.writeFieldName(gen.getOutputContext().getCurrentName() + "Name"); gen.writeFieldName(gen.getOutputContext().getCurrentName() + "Name");
gen.writeString(dictLabel); gen.writeString(dict);
} }
}else { }else {
gen.writeObject(value); gen.writeObject(value);

View File

@ -0,0 +1,24 @@
//package com.chushang.common.excel.convert;
//
//import com.alibaba.excel.converters.Converter;
//import com.alibaba.excel.converters.WriteConverterContext;
//import com.alibaba.excel.metadata.data.WriteCellData;
//import lombok.extern.slf4j.Slf4j;
//
//@Slf4j
//public class DictConvert implements Converter<String> {
// /**
// * <h2>转换单元格数据</h2>
// *
// * @param value Java 数据
// * @param contentProperty 内容属性
// * @param globalConfiguration 全局配置
// * @return excel中的数据
// * @author 单傲
// * @date 2023/4/19 18:11
// */
// public WriteCellData<?> convertToExcelData(WriteConverterContext<String> context) throws Exception {
// return convertToExcelData(context.getValue(), context.getContentProperty(),
// context.getWriteContext().currentWriteHolder().globalConfiguration());
// }
//}

View File

@ -27,6 +27,9 @@ public class DataListener<T> extends AnalysisEventListener<T> {
dataList.add(data); dataList.add(data);
} }
/**
* 可以对每一行数据进行校验
*/
@Override @Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) { public void doAfterAllAnalysed(AnalysisContext analysisContext) {

View File

@ -72,12 +72,7 @@ public class StoreImportDTO implements Serializable {
@ExcelProperty(value = "门店名称") @ExcelProperty(value = "门店名称")
@Size(max = 128, message = "门店名称不能大于128个字符") @Size(max = 128, message = "门店名称不能大于128个字符")
private String shopName; private String shopName;
/**
* 现有其他收单产品
*/
@ExcelProperty(value = "现有其他收单产品")
@Size(max = 50, message = "现有其他收单产品不能大于50个字符")
private String products;
/** /**
* 商户提示工具 * 商户提示工具
*/ */
@ -87,15 +82,16 @@ public class StoreImportDTO implements Serializable {
/** /**
* 商户类型 * 商户类型
*/ */
@DictFormat(dictType = "store_type", rewrite = true) @DictFormat(dictType = "store_type", labelGetValue = true, rewrite = true)
@ExcelProperty(value = "商户类型") @ExcelProperty(value = "商户类型")
private String storeType; private String storeType;
/** /**
* 巡检频次 * 巡检频次
*/ */
@DictFormat(dictType = "ins_fre", rewrite = true)
@Range(min = 1, max = 5, message = "巡检频次非法") // @Range(min = 1, max = 5, message = "巡检频次非法")
@ExcelProperty(value = "巡检频次") @ExcelProperty(value = "巡检频次")
@DictFormat(dictType = "ins_fre", labelGetValue = true, rewrite = true)
private String insFre; private String insFre;
/** /**
* 终端sn号 * 终端sn号
@ -124,14 +120,14 @@ public class StoreImportDTO implements Serializable {
/** /**
* 终端来源 * 终端来源
*/ */
@DictFormat(dictType = "terminal_source", rewrite = true) @DictFormat(dictType = "terminal_source", labelGetValue = true, rewrite = true)
@Range(min = 1, max = 3, message = "终端来源非法") @Range(min = 1, max = 3, message = "终端来源非法")
@ExcelProperty(value = "终端来源") @ExcelProperty(value = "终端来源")
private String terminalSource; private String terminalSource;
/** /**
* 终端类型 * 终端类型
*/ */
@DictFormat(dictType = "terminal_type", rewrite = true) @DictFormat(dictType = "terminal_type", labelGetValue = true, rewrite = true)
@Range(min = 1, max = 9, message = "终端类型非法") @Range(min = 1, max = 9, message = "终端类型非法")
@ExcelProperty(value = "终端类型") @ExcelProperty(value = "终端类型")
private String terminalType; private String terminalType;
@ -148,10 +144,18 @@ public class StoreImportDTO implements Serializable {
@Past(message = "必须是过去的日期") @Past(message = "必须是过去的日期")
@DateTimeFormat(DatePattern.CHINESE_DATE_PATTERN) @DateTimeFormat(DatePattern.CHINESE_DATE_PATTERN)
private LocalDate registerTime; private LocalDate registerTime;
/**
* 现有其他收单产品
*/
@ExcelProperty(value = "现有其他收单产品")
@Size(max = 50, message = "现有其他收单产品不能大于50个字符")
private String products;
/** /**
* 操作员账号 * 操作员账号
*/ */
@ExcelProperty(value = "pos编号") @ExcelProperty(value = "操作员编号")
@Size(max = 50, message = "操作员编号不能大于50个字符") @Size(max = 50, message = "操作员编号不能大于50个字符")
private String adminIds; private String adminIds;
/** /**

View File

@ -3,6 +3,7 @@ package com.chushang.inspection.work.dto;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat; import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.chushang.common.dict.annotation.DictFormat;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -27,6 +28,7 @@ public class WrkInfoPhoneImportDTO {
@ExcelProperty("终端编号") @ExcelProperty("终端编号")
private String terminalNo; private String terminalNo;
@ExcelProperty("终端类型") @ExcelProperty("终端类型")
@DictFormat(dictType = "terminal_type", rewrite = true, labelGetValue = true)
private String terminalType; private String terminalType;
@ExcelProperty("建档日期") @ExcelProperty("建档日期")
@DateTimeFormat(DatePattern.CHINESE_DATE_PATTERN) @DateTimeFormat(DatePattern.CHINESE_DATE_PATTERN)
@ -35,6 +37,7 @@ public class WrkInfoPhoneImportDTO {
@DateTimeFormat(DatePattern.CHINESE_DATE_PATTERN) @DateTimeFormat(DatePattern.CHINESE_DATE_PATTERN)
private LocalDateTime disposeTime; private LocalDateTime disposeTime;
@ExcelProperty("商户类型") @ExcelProperty("商户类型")
@DictFormat(dictType = "store_type", rewrite = true, labelGetValue = true)
private String storeType; private String storeType;
@ExcelProperty("巡检结果") @ExcelProperty("巡检结果")
private String wrkResult; private String wrkResult;

View File

@ -78,4 +78,9 @@ public class WrkInfoQuery extends CommonParam {
*/ */
@Condition(name = "lower_task_id", type = Condition.ConditionType.in, tableName = "i") @Condition(name = "lower_task_id", type = Condition.ConditionType.in, tableName = "i")
private List<Long> lowerTaskIds; private List<Long> lowerTaskIds;
/**
* 根据id 下载
*/
private List<Long> ids;
} }

View File

@ -1,7 +1,11 @@
package com.chushang.inspection.work.vo; package com.chushang.inspection.work.vo;
import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.annotation.JSONField;
import com.chushang.common.dict.annotation.DictFormat;
import com.chushang.inspection.terminal.vo.FiveStoreVO; import com.chushang.inspection.terminal.vo.FiveStoreVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.io.Serial; import java.io.Serial;
@ -26,6 +30,7 @@ public class WrkInfoExportVO implements java.io.Serializable{
private String workNo; private String workNo;
@ExcelProperty(value = "创建时间", index = 2) @ExcelProperty(value = "创建时间", index = 2)
@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
private LocalDateTime createTime; private LocalDateTime createTime;
@ExcelProperty(value = "legalName", index = 3) @ExcelProperty(value = "legalName", index = 3)
@ -41,6 +46,7 @@ public class WrkInfoExportVO implements java.io.Serializable{
private String terminalNo; private String terminalNo;
@ExcelProperty(value = "终端来源", index = 7) @ExcelProperty(value = "终端来源", index = 7)
@DictFormat(dictType = "terminal_source")
private String terminalSource; private String terminalSource;
@ExcelProperty(value = "终端地址", index = 8) @ExcelProperty(value = "终端地址", index = 8)

View File

@ -1,5 +1,6 @@
package com.chushang.inspection.project.service; package com.chushang.inspection.project.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.chushang.common.mybatis.page.CommonParam; import com.chushang.common.mybatis.page.CommonParam;
import com.chushang.inspection.project.dto.TaskDTO; import com.chushang.inspection.project.dto.TaskDTO;
@ -38,4 +39,9 @@ public interface PollingTaskService extends IService<PollingTask>{
PollingTask getTopTask(Long taskId); PollingTask getTopTask(Long taskId);
default String getTaskNameById(Long taskId){
PollingTask task = getById(taskId);
return ObjectUtil.isNotEmpty(task) ? task.getName() : "";
}
} }

View File

@ -13,6 +13,7 @@ import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.chushang.common.core.constant.SecurityConstants; import com.chushang.common.core.constant.SecurityConstants;
import com.chushang.common.core.util.DateUtils;
import com.chushang.common.core.util.SpringUtils; import com.chushang.common.core.util.SpringUtils;
import com.chushang.common.core.util.StringUtils; import com.chushang.common.core.util.StringUtils;
import com.chushang.common.core.util.TreeUtils; import com.chushang.common.core.util.TreeUtils;
@ -92,26 +93,18 @@ public class PollingTaskServiceImpl extends ServiceImpl<PollingTaskMapper, Polli
@DataScope @DataScope
public List<TaskVO> findTopList(CommonParam commonParam) { public List<TaskVO> findTopList(CommonParam commonParam) {
LambdaQueryWrapper<PollingTask> searchNumSql = WrapperUtils.builder(commonParam, commonParam); LambdaQueryWrapper<PollingTask> searchNumSql = WrapperUtils.builder(commonParam, commonParam);
searchNumSql.select(PollingTask::getSearchNum) searchNumSql
.eq(PollingTask::getParentId, 0)
.eq(PollingTask::getEnabled, 1) .eq(PollingTask::getEnabled, 1)
.and(w -> w.isNull(PollingTask::getEndTime) .and(w -> w.isNull(PollingTask::getEndTime)
.or().ge(PollingTask::getEndTime, LocalDateTime.now())); .or().ge(PollingTask::getEndTime, DateUtils.format(LocalDateTime.now())));
List<PollingTask> list = list(searchNumSql); List<PollingTask> list = list(searchNumSql);
List<String> searchNums;
if (CollectionUtil.isNotEmpty(list)){ if (CollectionUtil.isNotEmpty(list)){
searchNums = list.stream().map(PollingTask::getSearchNum).toList(); return list.stream().map(this::convert).collect(Collectors.toList());
}else { }else {
return new ArrayList<>(); return new ArrayList<>();
} }
Set<String> searchNumSet = searchNums.stream().map(s -> s.split("-")[0] + '-').collect(Collectors.toSet());
LambdaQueryWrapper<PollingTask> topSql = WrapperUtils.builder(commonParam, commonParam);
topSql.in(CollectionUtil.isNotEmpty(searchNumSet), PollingTask::getSearchNum, searchNumSet);
List<PollingTask> topList = list(topSql);
if (CollectionUtil.isNotEmpty(topList)){
return topList.stream().map(this::convert).collect(Collectors.toList());
}
return new ArrayList<>();
} }
@Override @Override

View File

@ -57,7 +57,7 @@ public interface TerminalService extends IService<Terminal>{
JSONObject save(Store store, WrkIcbcJsReceive dto); JSONObject save(Store store, WrkIcbcJsReceive dto);
int updateTerminalAndStore(TerminalQuery query); long updateTerminalAndStore(TerminalQuery query);

View File

@ -13,6 +13,7 @@ import com.chushang.common.core.constant.SecurityConstants;
import com.chushang.common.core.util.StringUtils; import com.chushang.common.core.util.StringUtils;
import com.chushang.common.core.web.Result; import com.chushang.common.core.web.Result;
import com.chushang.common.dict.feign.RemoteDictDataService; import com.chushang.common.dict.feign.RemoteDictDataService;
import com.chushang.common.dict.utils.DictUtils;
import com.chushang.common.mybatis.page.CommonParam; import com.chushang.common.mybatis.page.CommonParam;
import com.chushang.common.mybatis.utils.PageResult; import com.chushang.common.mybatis.utils.PageResult;
import com.chushang.common.mybatis.utils.WrapperUtils; import com.chushang.common.mybatis.utils.WrapperUtils;
@ -52,10 +53,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @auther: zhao * @auther: zhao
@ -95,49 +93,36 @@ public class StoreImportServiceImpl extends ServiceImpl<StoreImportMapper, Store
} }
Store genStoreEntity(StoreImportDTO storeImportDTO,Map<String, String> data){ public Store genStoreEntity(StoreImportDTO storeImportDTO) {
// 通过任务名称查询任务 // 通过任务名称查询任务
List<PollingTask> list = pollingTaskService.list(new LambdaQueryWrapper<PollingTask>().eq(PollingTask::getName, storeImportDTO.getTaskName())); List<PollingTask> list = pollingTaskService.list(new LambdaQueryWrapper<PollingTask>().eq(PollingTask::getName, storeImportDTO.getTaskName()));
if (CollectionUtil.isEmpty(list)){ if (CollectionUtil.isEmpty(list)) {
throw new RuntimeException("任务名称不存在"); throw new RuntimeException("任务名称不存在");
} }
PollingTask topTask = pollingTaskService.getTopTask(list.get(0).getId()); PollingTask topTask = pollingTaskService.getTopTask(list.get(0).getId());
Store store = new Store(); Store store = new Store();
store.setAccountManager(storeImportDTO.getAccountManager()); store.setAccountManager(storeImportDTO.getAccountManager());
store.setDelState(true);
store.setAccountPhone(storeImportDTO.getAccountPhone()); store.setAccountPhone(storeImportDTO.getAccountPhone());
store.setLegalName(storeImportDTO.getLegalName()); store.setLegalName(storeImportDTO.getLegalName());
store.setSpecialNum(storeImportDTO.getSpecialNum()); store.setSpecialNum(storeImportDTO.getSpecialNum());
store.setShopName(storeImportDTO.getShopName()); store.setShopName(storeImportDTO.getShopName());
store.setProducts(storeImportDTO.getProducts()); store.setProducts(storeImportDTO.getProducts());
store.setTipTool(storeImportDTO.getTipTool()); store.setTipTool(storeImportDTO.getTipTool());
LocalDateTime registerTime = LocalDateTime.now(); LocalDate registerDate = storeImportDTO.getRegisterTime();
LocalDateTime registerTime = LocalDateTime.of(registerDate, LocalTime.MIDNIGHT);
Integer insFre = 0; store.setInsFre(null != storeImportDTO.getInsFre() ? Integer.valueOf(storeImportDTO.getInsFre()) : null);
try{
insFre = Integer.valueOf(storeImportDTO.getInsFre());
}catch (Exception e){
insFre = -1;
}
try{
LocalDate registerDate = storeImportDTO.getRegisterTime();
registerTime = LocalDateTime.of(registerDate, LocalTime.MIDNIGHT);
}catch (Exception e){
registerTime = LocalDateTime.now();
}
store.setInsFre(insFre);
store.setStoreNo(storeImportDTO.getStoreNo()); store.setStoreNo(storeImportDTO.getStoreNo());
store.setStoreName(storeImportDTO.getStoreName()); store.setStoreName(storeImportDTO.getStoreName());
store.setStoreAddress(storeImportDTO.getStoreAddress()); store.setStoreAddress(storeImportDTO.getStoreAddress());
store.setStoreContact(storeImportDTO.getStoreContact()); store.setStoreContact(storeImportDTO.getStoreContact());
store.setStorePhone(storeImportDTO.getStorePhone()); store.setStorePhone(storeImportDTO.getStorePhone());
store.setStoreType(1); store.setStoreType(null != storeImportDTO.getStoreType() ? Integer.valueOf(storeImportDTO.getStoreType()) : null);
store.setRegisterTime(registerTime); // registertime store.setRegisterTime(registerTime); // registertime
store.setTaskId(topTask.getId()); store.setTaskId(topTask.getId());
store.setDeptId(SecurityUtils.getDeptId()); store.setDeptId(SecurityUtils.getDeptId());
store.setLowerTaskId(list.get(0).getId()); store.setLowerTaskId(list.get(0).getId());
store.setStoreId(IdUtil.getSnowflake().nextId()); store.setStoreId(IdUtil.getSnowflake().nextId());
store.setDelState(false);
return store; return store;
} }
@ -145,12 +130,6 @@ public class StoreImportServiceImpl extends ServiceImpl<StoreImportMapper, Store
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int confimImport(List<StoreImportDTO> lists) { public int confimImport(List<StoreImportDTO> lists) {
int i = 0; int i = 0;
Result<Map<String, String>> storeType = remoteDictDataService.getInfo("store_type", SecurityConstants.INNER);
Map<String, String> data = new HashMap<>();
//todo 将返回的map一一对应
if(storeType.isSuccess()){
data = storeType.getData();
}
// 商户类型枚举 // 商户类型枚举
for (StoreImportDTO storeImportDTO : lists) { for (StoreImportDTO storeImportDTO : lists) {
i++; i++;
@ -158,15 +137,17 @@ public class StoreImportServiceImpl extends ServiceImpl<StoreImportMapper, Store
throw new RuntimeException("任务名称不能为空"); throw new RuntimeException("任务名称不能为空");
} }
Store store = genStoreEntity(storeImportDTO,data); Store store = genStoreEntity(storeImportDTO);
storeMapper.insert(store); storeMapper.insert(store);
Terminal terminal = new Terminal(); Terminal terminal = new Terminal();
terminal.setTerminalNo(storeImportDTO.getTerminalNo()); terminal.setTerminalNo(storeImportDTO.getTerminalNo());
terminal.setTerminalSn(storeImportDTO.getTerminalSn()); terminal.setTerminalSn(storeImportDTO.getTerminalSn());
terminal.setTerminalModel(storeImportDTO.getTerminalModel()); terminal.setTerminalModel(storeImportDTO.getTerminalModel());
terminal.setTerminalType(1);//storeImportDTO.getTerminalType()
terminal.setTerminalType(null != storeImportDTO.getTerminalType() ? Integer.valueOf(storeImportDTO.getTerminalType()) : null);//storeImportDTO.getTerminalType()
terminal.setTerminalVersion(storeImportDTO.getTerminalVersion()); terminal.setTerminalVersion(storeImportDTO.getTerminalVersion());
terminal.setTerminalSource(1);//storeImportDTO.getTerminalSource() terminal.setTerminalSource(null != storeImportDTO.getTerminalSource() ? Integer.valueOf(storeImportDTO.getTerminalSource()) : null);//storeImportDTO.getTerminalSource()
terminal.setTerminalAddress(storeImportDTO.getTerminalAddress()); terminal.setTerminalAddress(storeImportDTO.getTerminalAddress());
terminal.setOccupy(0); terminal.setOccupy(0);
terminal.setTerminalStatus(1); terminal.setTerminalStatus(1);
@ -184,5 +165,4 @@ public class StoreImportServiceImpl extends ServiceImpl<StoreImportMapper, Store
} }
} }

View File

@ -9,6 +9,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chushang.common.core.constant.SecurityConstants; import com.chushang.common.core.constant.SecurityConstants;
import com.chushang.common.core.exception.utils.AssertUtil;
import com.chushang.common.dict.utils.DictUtils; import com.chushang.common.dict.utils.DictUtils;
import com.chushang.common.mybatis.enums.Operator; import com.chushang.common.mybatis.enums.Operator;
import com.chushang.common.mybatis.page.CommonParam; import com.chushang.common.mybatis.page.CommonParam;
@ -150,12 +151,18 @@ public class TerminalServiceImpl extends ServiceImpl<TerminalMapper, Terminal> i
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateTerminalAndStore(TerminalQuery query) { public long updateTerminalAndStore(TerminalQuery query) {
/**
* 当前终端
*/
Terminal curTerminal = getById(query.getTerminalId());
AssertUtil.invalidate(ObjectUtil.isEmpty(curTerminal), "未找寻到对应的终端信息");
Terminal terminal = BeanCopyUtils.copy(query, Terminal.class); Terminal terminal = BeanCopyUtils.copy(query, Terminal.class);
updateById(terminal); updateById(terminal);
Store store = BeanCopyUtils.copy(query, Store.class); Store store = BeanCopyUtils.copy(query, Store.class);
store.setStoreId(curTerminal.getStoreId());
storeService.updateById(store); storeService.updateById(store);
return 1; return query.getTerminalId();
} }
} }

View File

@ -31,6 +31,5 @@ public interface WrkInfoMapper extends BaseMapper<WrkInfo> {
WrkInfoDetailsVO getWrkInfoDetails(@Param("wrkId") Long wrkId); WrkInfoDetailsVO getWrkInfoDetails(@Param("wrkId") Long wrkId);
@DataScope(deptAlias = "i") @DataScope(deptAlias = "i")
List<WrkInfoExportVO> exportDispatchPage(@Param("query") WrkInfoQuery query, List<WrkInfoExportVO> exportDispatchPage(@Param("query") WrkInfoQuery query);
Page<WrkInfoExportVO> page);
} }

View File

@ -148,13 +148,20 @@ public class WrkIcbcJsServiceImpl extends ServiceImpl<WrkIcbcJsMapper, WrkIcbcJs
dispatchOrder(entity, terJson, store, userId); dispatchOrder(entity, terJson, store, userId);
} }
/**
* TODO 需要创建对应的任务以及 业务员信息
* @param entity
* @param terJson
* @param store
* @param userId
*/
public void dispatchOrder(WrkIcbcJs entity, JSONObject terJson, Store store, Long userId) public void dispatchOrder(WrkIcbcJs entity, JSONObject terJson, Store store, Long userId)
{ {
Terminal terminal = terJson.getObject("terminal", Terminal.class); Terminal terminal = terJson.getObject("terminal", Terminal.class);
TerminalIns terminalIns = terJson.getObject("terminalIns", TerminalIns.class); TerminalIns terminalIns = terJson.getObject("terminalIns", TerminalIns.class);
WrkIcbcJs icbcJs = entity.getArea() != null ? entity : getById(entity.getId()); WrkIcbcJs icbcJs = entity.getArea() != null ? entity : getById(entity.getId());
AssertUtil.invalidate(icbcJs.getStatus() == 1, "只有下发状态才能派单"); AssertUtil.invalidate(icbcJs.getStatus() != 1, "只有下发状态才能派单");
DispatchDTO dispatch = new DispatchDTO().dispatch(icbcJs); DispatchDTO dispatch = new DispatchDTO().dispatch(icbcJs);
WrkInfo wrkInfo; WrkInfo wrkInfo;
if (null == userId){ if (null == userId){

View File

@ -31,7 +31,9 @@ import com.chushang.common.mybatis.utils.WrapperUtils;
import com.chushang.inspection.ins.GeneratedInsFactory; import com.chushang.inspection.ins.GeneratedInsFactory;
import com.chushang.inspection.project.dto.AuditDTO; import com.chushang.inspection.project.dto.AuditDTO;
import com.chushang.inspection.project.po.InspectionData; import com.chushang.inspection.project.po.InspectionData;
import com.chushang.inspection.project.po.PollingTask;
import com.chushang.inspection.project.service.InspectionDataService; import com.chushang.inspection.project.service.InspectionDataService;
import com.chushang.inspection.project.service.PollingTaskService;
import com.chushang.inspection.terminal.po.FiveStore; import com.chushang.inspection.terminal.po.FiveStore;
import com.chushang.inspection.terminal.po.Store; import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.po.Terminal; import com.chushang.inspection.terminal.po.Terminal;
@ -108,16 +110,16 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
RemoteUserService userFeignService; RemoteUserService userFeignService;
@Resource @Resource
GeneratedInsFactory generatedInsFactory; GeneratedInsFactory generatedInsFactory;
@Resource
PollingTaskService pollingTaskService;
@Value("${push.icbc-js.enable:false}") @Value("${push.icbc-js.enable:false}")
private boolean enable; private boolean enable;
@Override @Override
public void exportDispatchPage(HttpServletResponse response, WrkInfoQuery query) { public void exportDispatchPage(HttpServletResponse response, WrkInfoQuery query) {
CommonParam commonParam = CommonParam.buildPageRequest();
WrapperUtils.buildSql(query); WrapperUtils.buildSql(query);
Page<WrkInfoExportVO> page = new Page<>(commonParam.getPage(), commonParam.getLimit()); List<WrkInfoExportVO> records = baseMapper.exportDispatchPage(query);
List<WrkInfoExportVO> records = baseMapper.exportDispatchPage(query, page);
ExcelUtils.exportList(response, WrkInfoExportVO.class, records, "导出派单"); ExcelUtils.exportList(response, WrkInfoExportVO.class, records, "导出派单");
} }
@ -686,6 +688,9 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
wrkInfo.setWorkSource(query.getWorkSource()); wrkInfo.setWorkSource(query.getWorkSource());
wrkInfo.setTaskId(dispatch.getTaskId()); wrkInfo.setTaskId(dispatch.getTaskId());
wrkInfo.setLowerTaskId(dispatch.getLowerTaskId()); wrkInfo.setLowerTaskId(dispatch.getLowerTaskId());
wrkInfo.setTaskName(pollingTaskService.getTaskNameById(dispatch.getTaskId()));
wrkInfo.setLowerTaskName(pollingTaskService.getTaskNameById(dispatch.getLowerTaskId()));
//
wrkInfo.setVersion(0L); wrkInfo.setVersion(0L);
// 处理时间 // 处理时间
//wrkInfo.setDisposeTime(query.getEndTime()); //wrkInfo.setDisposeTime(query.getEndTime());

View File

@ -68,6 +68,7 @@
pt.id AS task_id, pt.id AS task_id,
pt.`name` AS taskName, pt.`name` AS taskName,
s.lower_task_id AS lowerTaskId, s.lower_task_id AS lowerTaskId,
lpt.`name` AS lowerTaskName,
s.dept_id AS deptId, s.dept_id AS deptId,
s.store_id AS storeId, s.store_id AS storeId,
s.store_no AS storeNo, s.store_no AS storeNo,
@ -114,6 +115,7 @@
INNER JOIN st_store s ON t.store_id = s.store_id INNER JOIN st_store s ON t.store_id = s.store_id
INNER JOIN ta_polling_task pt ON t.task_id = pt.id INNER JOIN ta_polling_task pt ON t.task_id = pt.id
INNER JOIN wrk_project p ON pt.project_id = p.project_id INNER JOIN wrk_project p ON pt.project_id = p.project_id
LEFT JOIN ta_polling_task lpt ON t.lower_task_id = lpt.id
where t.del_state = 0 where t.del_state = 0
</sql> </sql>
<select id="selectPageApp" resultType="com.chushang.inspection.project.vo.TerminalAppVO"> <select id="selectPageApp" resultType="com.chushang.inspection.project.vo.TerminalAppVO">

View File

@ -16,6 +16,17 @@
</if> </if>
ORDER BY i.create_time desc ORDER BY i.create_time desc
</select> </select>
<resultMap id="resultWrkInfoExportVO" type="com.chushang.inspection.work.vo.WrkInfoExportVO">
<id column="terminal_id" property="terminalId" />
<result column="user_name" property="userName" />
<result column="create_time" property="createTime" />
<result column="legal_name" property="legalName" />
<result column="terminal_address" property="terminalAddress" />
<result column="terminal_no" property="terminalNo" />
<result column="terminal_sn" property="terminalSn" />
<result column="terminal_source" property="terminalSource" />
<result column="work_no" property="workNo" />
</resultMap>
<select id="queryArchivePage" resultMap="wrkInfoDetailsVOResult"> <select id="queryArchivePage" resultMap="wrkInfoDetailsVOResult">
<include refid="wrkInfoDetailSql" /> <include refid="wrkInfoDetailSql" />

View File

@ -9,6 +9,7 @@
i.task_id AS task_id, i.task_id AS task_id,
i.`task_name` AS taskName, i.`task_name` AS taskName,
i.lower_task_id AS lowerTaskId, i.lower_task_id AS lowerTaskId,
lpt.`name` AS lowerTaskName,
i.dept_id AS deptId, i.dept_id AS deptId,
i.work_no AS workNo, i.work_no AS workNo,
i.wrk_id AS wrkId, i.wrk_id AS wrkId,
@ -59,6 +60,7 @@
INNER JOIN wrk_info_store_record s ON i.wrk_id = s.wrk_id INNER JOIN wrk_info_store_record s ON i.wrk_id = s.wrk_id
INNER JOIN wrk_info_terminal_record t ON i.wrk_id = t.wrk_id INNER JOIN wrk_info_terminal_record t ON i.wrk_id = t.wrk_id
LEFT JOIN wrk_info_terminal_ins_record ti ON i.wrk_id = ti.wrk_id LEFT JOIN wrk_info_terminal_ins_record ti ON i.wrk_id = ti.wrk_id
LEFT JOIN ta_polling_task lpt ON i.task_id = lpt.id
WHERE i.del_state = 0 WHERE i.del_state = 0
<if test="1 == 1"> <if test="1 == 1">
${query.sqlParam.get('sqlWhere')} ${query.sqlParam.get('sqlWhere')}