1. 巡检联调

This commit is contained in:
ant 2024-07-26 14:55:48 +08:00
parent 3f1ed12b6a
commit f3ad7c0862
11 changed files with 154 additions and 204 deletions

View File

@ -6,10 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chushang.common.mybatis.base.BaseEntity;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import com.chushang.inspection.work.dto.WrkIcbcJsReceive;
import com.chushang.inspection.work.enums.TerminalTypeOperation;
import lombok.AllArgsConstructor;

View File

@ -193,6 +193,7 @@ public class StoreTerminalVO {
/**
* 巡检状态 1 以巡检 2未巡检
*/
@DictFormat(dictType = "inspectionStatus_status")
private Integer inspectionStatus;
/**

View File

@ -8,10 +8,7 @@ import com.chushang.common.mybatis.page.CommonParam;
import com.chushang.inspection.work.enums.WorkTypeOperation;
import com.chushang.inspection.work.po.WrkIcbcJs;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.*;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotNull;
@ -20,24 +17,24 @@ import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DispatchQuery extends CommonParam {
@NotNull(message = "终端id 不能为空")
/** 终端id */
private List<Long> terminalIds;
/** 任务id */
@NotNull(message = "必须指定任务")
private Long taskId;
@NotNull(message = "分配业务员不能为空")
/** 业务员id */
private Long userId;
/** 工单类型 */
// @NotNull(message = "必须指定工单类型")
@NotNull(message = "必须指定工单类型")
@Range(min = 1, max = 50, message = "工单类型非法")
private Integer workType;
@ -57,25 +54,15 @@ public class DispatchQuery extends CommonParam {
@Range(min = 1, max = 4, message = "工单来源非法")
private Integer workSource;
/** 商户号 */
@Builder.Default
private List<String> nos = ListUtil.toList();
/** 终端号 */
@Builder.Default
private List<String> terminalNos = ListUtil.toList();
/** 是否被占用*/
private Integer occupy;
public DispatchQuery dispatchOrder(WrkIcbcJs entity, Long userId) {
this.terminalIds = ListUtil.toList(entity.getTerminalId());
this.taskId = 1701151817643495425L;
this.userId = userId;
this.workType = WorkTypeOperation.valueOfCode(entity.getOrderType());
this.remark = entity.getNoteMsg();
this.workSource = 1;
return this;
}
private List<String> terminalNos;
}

View File

@ -112,7 +112,6 @@ public class TerminalServiceImpl extends ServiceImpl<TerminalMapper, Terminal> i
for (Long terminalId : terminalIds) {
Terminal terminal = getById(terminalId);
terminal.setOccupy(i);
terminal.setVersion(0l);
baseMapper.updateById(terminal);
}
}

View File

@ -174,46 +174,28 @@ public class WrkInfoController {
@PostMapping("/dispatch")
@RequiresPermissions("wrk:info:dispatch")
@SysLog(value = "批量派单/领取", businessType = BusinessType.IMPORT)
public AjaxResult dispatch(@RequestPart(value = "file", required = false) MultipartFile file, @Validated DispatchQuery query) {
public AjaxResult dispatch(@RequestPart(value = "file", required = false) MultipartFile file,
@RequestBody @Validated DispatchQuery query) {
if (file.isEmpty()) {
wrkInfoService.dispatch(query, 0);
return AjaxResult.success();
}
try (Workbook workbook = WorkbookFactory.create(file.getInputStream())) {
Sheet sheet = workbook.getSheetAt(0);
// 商户编号行号
int merchantIdRowNum = -1;
// 终端编号行号
int terminalIdRowNum = -1;
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
for (Row row : sheet) {
if (row.getRowNum() == 0) {
for (Cell cell : row) {
if ("商户编号".equals(cell.getStringCellValue().trim())) {
merchantIdRowNum = cell.getColumnIndex();
} else if ("终端编号".equals(cell.getStringCellValue().trim())) {
if ("终端编号".equals(cell.getStringCellValue().trim())) {
terminalIdRowNum = cell.getColumnIndex();
}
}
continue;
}
if (merchantIdRowNum != -1) {
Cell cell = row.getCell(merchantIdRowNum);
switch (cell.getCellType()) {
case BLANK:
break;
case STRING:
query.getNos().add(StrUtil.trim(cell.getStringCellValue()));
break;
case NUMERIC:
Double aDouble = cell.getNumericCellValue();
query.getNos().add(nf.format(aDouble));
break;
}
}
if (terminalIdRowNum != -1) {
Cell cell = row.getCell(terminalIdRowNum);
switch (cell.getCellType()) {

View File

@ -4,11 +4,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.chushang.inspection.work.po.WrkInfoDispatch;
import java.util.ArrayList;
import java.util.List;
/**
* @auther: zhao
* @date: 2024/7/4 10:31
*/
public interface WrkInfoDispatchService extends IService<WrkInfoDispatch> {
void updateWorkOrderProgress(Long userId, int disStatus, ArrayList<Long> wrkIds, Long deptId);
void updateWorkOrderProgress(Long userId, int disStatus, List<Long> wrkIds, Long deptId);
}

View File

@ -22,7 +22,7 @@ import java.util.List;
public class WrkInfoDispatchServiceImpl extends ServiceImpl<WrkInfoDispatchMapper, WrkInfoDispatch> implements WrkInfoDispatchService {
@Override
@Transactional
public void updateWorkOrderProgress(Long userId, int disStatus, ArrayList<Long> wrkIds, Long deptId) {
public void updateWorkOrderProgress(Long userId, int disStatus, List<Long> wrkIds, Long deptId) {
// 修改 派单进度
if (disStatus == 6) {
List<WrkInfoDispatch> schedules = StreamUtils.toList(wrkIds, wrkId -> new WrkInfoDispatch(wrkId,userId, deptId, 6));

View File

@ -31,7 +31,6 @@ import com.chushang.common.mybatis.utils.WrapperUtils;
import com.chushang.inspection.ins.GeneratedInsFactory;
import com.chushang.inspection.project.dto.AuditDTO;
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.PollingTaskService;
import com.chushang.inspection.terminal.po.FiveStore;
@ -44,9 +43,7 @@ import com.chushang.inspection.terminal.service.TerminalInsService;
import com.chushang.inspection.terminal.service.TerminalService;
import com.chushang.inspection.terminal.vo.FiveStoreVO;
import com.chushang.inspection.utils.PoolUtils;
import com.chushang.inspection.utils.StreamUtils;
import com.chushang.inspection.utils.TaskConfigUtils;
import com.chushang.inspection.work.dto.DispatchDTO;
import com.chushang.inspection.work.dto.WrkInfoDTO;
import com.chushang.inspection.work.enums.WorkTypeOperation;
import com.chushang.inspection.work.po.*;
@ -57,6 +54,7 @@ import com.chushang.inspection.work.query.WrkInfoQuery;
import com.chushang.inspection.work.service.*;
import com.chushang.inspection.work.vo.*;
import com.chushang.security.utils.SecurityUtils;
import com.chushang.system.feign.RemoteDeptService;
import com.chushang.task.entity.dto.CreateTaskDTO;
import com.chushang.task.enums.ServiceEnum;
import com.chushang.task.enums.TaskTypeEnum;
@ -64,13 +62,13 @@ import com.chushang.task.feign.RemoteTaskService;
import com.chushang.security.entity.po.SysUser;
import com.chushang.system.feign.RemoteUserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chushang.inspection.work.mapper.WrkInfoMapper;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -81,37 +79,32 @@ import java.util.stream.Collectors;
* @auther: zhao
* @date: 2024/6/26 17:13
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> implements WrkInfoService {
@Resource
WrkInfoAuditService infoAuditService;
@Resource
InspectionDataService inspectionDataService;
@Resource
WrkImgService wrkImgService;
@Resource
WrkInfoStoreRecordService wrkInfoStoreRecordService;
@Resource
WrkInfoTerminalRecordService wrkInfoTerminalRecordService;
@Resource
WrkInfoTerminalInsRecordService wrkInfoTerminalInsRecordService;
@Resource
FiveStoreService fiveStoreService;
@Resource
StoreService storeService;
@Resource
TerminalService terminalService;
@Resource
TerminalInsService terminalInsService;
@Resource
RemoteTaskService remoteTaskService;
@Resource
RemoteUserService userFeignService;
@Resource
GeneratedInsFactory generatedInsFactory;
@Resource
PollingTaskService pollingTaskService;
private final WrkImgService wrkImgService;
private final WrkInfoStoreRecordService wrkInfoStoreRecordService;
private final WrkInfoTerminalRecordService wrkInfoTerminalRecordService;
private final WrkInfoTerminalInsRecordService wrkInfoTerminalInsRecordService;
private final FiveStoreService fiveStoreService;
private final StoreService storeService;
private final TerminalService terminalService;
private final TerminalInsService terminalInsService;
private final GeneratedInsFactory generatedInsFactory;
private final PollingTaskService pollingTaskService;
private final WrkInfoDispatchService dispatchService;
private final WrkInfoAuditService infoAuditService;
private final InspectionDataService inspectionDataService;
private final RemoteTaskService remoteTaskService;
private final RemoteUserService userFeignService;
private final RemoteDeptService remoteDeptService;
@Value("${push.icbc-js.enable:false}")
private boolean enable;
@ -195,18 +188,96 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
@Override
@Transactional
public List<WrkInfo> dispatch(DispatchQuery query, int i) {
query.setOccupy(i);
List<DispatchDTO> dispatch = terminalService.getStoreByTasKIdOrIds(query);
AssertUtil.invalidate(CollectionUtil.isEmpty(dispatch), "您指定派单/领取的终端不存在");
Integer method = TaskConfigUtils.dispatchMethod(query.getTaskId());
// 获取所有终端信息
List<Terminal> terminals = terminalService.list(new LambdaQueryWrapper<Terminal>()
.in(CollectionUtil.isNotEmpty(query.getTerminalIds()), Terminal::getTerminalId, query.getTerminalIds())
.or()
.in(CollectionUtil.isNotEmpty(query.getTerminalNos()), Terminal::getTerminalNo, query.getTerminalNos())
);
AssertUtil.invalidate(CollectionUtil.isEmpty(terminals), "您指定派单/领取的终端不存在");
Set<Long> terminalIds = terminals.stream().map(Terminal::getTerminalId).collect(Collectors.toSet());
// 获取所有终端附加信息
List<TerminalIns> terminalIns = terminalInsService.listByIds(terminalIds);
List<Long> storeIds = terminals.stream().map(Terminal::getStoreId).toList();
// 商户信息
List<Store> stores = storeService.listByIds(storeIds);
// 商户 map
Map<Long, Store> storeMap
= stores.stream().collect(Collectors.toMap(Store::getStoreId, s -> s, (o, n) -> n));
Set<String> nickNames = stores.stream().map(Store::getAccountManager).collect(Collectors.toSet());
Result<SysUser> userInfo = userFeignService.getInfoById(query.getUserId(), SecurityConstants.INNER);
this.saveData(dispatch, query, method);
Set<Long> deptIds = stores.stream().map(Store::getDeptId).collect(Collectors.toSet());
Map<Long, String> deptNameMap = remoteDeptService.getDeptNameByIds(deptIds, SecurityConstants.INNER);
List<WrkInfo> resultList = new ArrayList<>();
storeMap.forEach((storeId, store) -> {
List<Terminal> terList
= terminals.stream().filter(t -> t.getStoreId().equals(store.getStoreId())).toList();
List<Long> terIds = terList.stream().map(Terminal::getTerminalId).toList();
Map<Long, TerminalIns> terInsMap = terminalIns.stream().filter(t -> terIds.contains(t.getTerminalId()))
.collect(Collectors.toMap(TerminalIns::getTerminalId, t -> t, (o, n) -> n));
if (!TaskConfigUtils.isRepeat(query.getTaskId())) {
terminalService.updateOccupy(dispatch.stream().map(DispatchDTO::getTerminalId).collect(Collectors.toList()), 1);
}
return List.of();
List<WrkInfo> wrkInfos = this.saveData(store, terList, terInsMap, query, userInfo.getData(), deptNameMap.get(store.getDeptId()));
// 还需要修改 终端状态信息
if (!TaskConfigUtils.isRepeat(store.getTaskId())) {
// 修改 终端占用
terminalService.updateOccupy(terIds, 1);
}
// 新增 派单进度
dispatchService.updateWorkOrderProgress(query.getUserId(),6, wrkInfos.stream().map(WrkInfo::getWrkId).toList(), store.getDeptId());
resultList.addAll(wrkInfos);
});
return resultList;
}
/**
* 保存工单信息
*/
private List<WrkInfo> saveData(Store store, List<Terminal> terminals, Map<Long, TerminalIns> terInsMap, DispatchQuery query,SysUser userInfoData, String deptName) {
Integer method = TaskConfigUtils.dispatchMethod(store.getTaskId());
// 0 业务员领取 1 只能派给负责项目的业务员 2 只能派给商户对应的客户经理
return terminals.stream().map(t -> {
WrkInfo wrkInfo = new WrkInfo();
wrkInfo.setTaskId(store.getTaskId());
wrkInfo.setDeptId(store.getDeptId());
wrkInfo.setUserId(query.getUserId());
wrkInfo.setAccountPhone(store.getAccountPhone());
wrkInfo.setAccountManager(store.getAccountManager());
wrkInfo.setUserName(userInfoData.getNickName());
wrkInfo.setWorkNo(IdUtil.getSnowflake().nextId());
wrkInfo.setWorkType(query.getWorkType());
wrkInfo.setWorkMethod(method);
wrkInfo.setWorkSort(query.getWorkSort());
wrkInfo.setWrkStatus(1);
wrkInfo.setWorkSource(query.getWorkSource());
wrkInfo.setLowerTaskId(store.getLowerTaskId());
wrkInfo.setTaskName(pollingTaskService.getTaskNameById(store.getTaskId()));
wrkInfo.setLowerTaskName(pollingTaskService.getTaskNameById(store.getLowerTaskId()));
wrkInfo.setVersion(0L);
wrkInfo.setEndTime(query.getEndTime());
wrkInfo.setDisSchedule(6);
wrkInfo.setRegisterTime(LocalDate.now());
wrkInfo.setDeptName(deptName);
// 处理时间
save(wrkInfo);
WrkInfoTerminalRecord wrkInfoTerminalRecord = BeanUtil.copyProperties(t, WrkInfoTerminalRecord.class);
wrkInfoTerminalRecord.setWrkId(wrkInfo.getWrkId());
wrkInfoTerminalRecord.setVersion(0L);
wrkInfoTerminalRecordService.save(wrkInfoTerminalRecord);
WrkInfoStoreRecord wrkInfoStoreRecord = BeanUtil.copyProperties(store, WrkInfoStoreRecord.class);
wrkInfoStoreRecord.setWrkId(wrkInfo.getWrkId());
wrkInfoStoreRecordService.save(wrkInfoStoreRecord);
TerminalIns terminalIns = terInsMap.get(t.getTerminalId());
if (ObjectUtil.isNotEmpty(terminalIns)) {
// 终端巡检信息
WrkInfoTerminalInsRecord wrkInfoTerminalInsRecord = BeanUtil.copyProperties(terminalIns, WrkInfoTerminalInsRecord.class);
wrkInfoTerminalInsRecord.setWrkId(wrkInfo.getWrkId());
wrkInfoTerminalInsRecordService.save(wrkInfoTerminalInsRecord);
}
return wrkInfo;
}).toList();
}
@Override
@ -359,7 +430,7 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
@Override
@Transactional(rollbackFor = Exception.class)
public void withdraw(List<Long> ids) throws Exception{
public void withdraw(List<Long> ids) throws Exception {
List<Integer> status = ListUtil.toList(1, 2, 5, 6, 7);
LambdaQueryWrapper<WrkInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(WrkInfo::getWrkId, ids);
@ -377,18 +448,18 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
* 工单审核
*
* @param audit 审核所需
* 工单共计有7个状态,
* 1. 已分配
* 2. 审核中
* 3. 初审通过-待复审
* 4. 复审通过
* 5. 初审驳回
* 6. 复审驳回
* 7. 初审通过
* 8. 默认审核通过
* todo 当任务为只需要初审时, 点击初审通过, 则其状态由2 变为 7
* todo 当任务需要复审时, 点击初审通过, 其状态由2 变为3
* 当任务不需要审核时, 点击提交, 工单状态, 由1 变为8
* 工单共计有7个状态,
* 1. 已分配
* 2. 审核中
* 3. 初审通过-待复审
* 4. 复审通过
* 5. 初审驳回
* 6. 复审驳回
* 7. 初审通过
* 8. 默认审核通过
* todo 当任务为只需要初审时, 点击初审通过, 则其状态由2 变为 7
* todo 当任务需要复审时, 点击初审通过, 其状态由2 变为3
* 当任务不需要审核时, 点击提交, 工单状态, 由1 变为8
*/
@Override
public void audit(AuditDTO audit) {
@ -408,21 +479,19 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
// 不为
AssertUtil.invalidate(2 != curStatus && 3 != curStatus, "当前工单状态不属于待审核状态");
// 说明在审核中
if (2 == curStatus)
{
if (2 == curStatus) {
// 只需要初审
if (2 == reviewMethod) {
// 通过或者驳回
auditInfo.setWrkStatus(1 == auditStatus ? 7 : 5);
}
// 需要复审
else if (3 == reviewMethod){
else if (3 == reviewMethod) {
auditInfo.setWrkStatus(1 == auditStatus ? 3 : 5);
}
}
// 不为待审核中时, 即为 3, 待复审 && 需要复审
else if (3 == reviewMethod)
{
else if (3 == reviewMethod) {
// 获取上一个审核
List<WrkInfoAudit> list = infoAuditService.list(new LambdaQueryWrapper<WrkInfoAudit>()
.eq(WrkInfoAudit::getWrkId, audit.getWrkId())
@ -445,7 +514,7 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
/**
* 新增一条审核记录
*/
private void saveAndUpdateAudit(AuditDTO audit, int wrkStatus){
private void saveAndUpdateAudit(AuditDTO audit, int wrkStatus) {
// 新增一条审核工单记录
WrkInfoAudit infoAudit = new WrkInfoAudit();
infoAudit.setIsRecord(1);
@ -474,7 +543,7 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
// 修改 工单的审核状态
updateById(auditWrkInfo);
// 解除 终端占用, 因为审核通过了
if (4 == wrkStatus || 7 == wrkStatus){
if (4 == wrkStatus || 7 == wrkStatus) {
// 工单, 商户, 终端信息
WrkInfoDetailsVO infoDetail = baseMapper.getWrkInfoDetails(auditWrkInfo.getWrkId());
// 工单
@ -530,11 +599,11 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
terminalInsService.saveOrUpdate(terminalIns);
// 还需要 更改 记录表对应的数据.
if (enable){
if (enable) {
// 江苏工行的数据推送
PoolUtils.SENTINEL.getInstance().execute(()->{
PoolUtils.SENTINEL.getInstance().execute(() -> {
// 只有江苏工行的才进行推送
if (wrkInfo.getTaskId().equals(1701151817643495425L) && WorkTypeOperation.workTypes().contains(wrkInfo.getWorkType())){
if (wrkInfo.getTaskId().equals(1701151817643495425L) && WorkTypeOperation.workTypes().contains(wrkInfo.getWorkType())) {
SpringUtils.getBean(WrkIcbcJsService.class).push(infoDetail);
}
});
@ -546,8 +615,7 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
@Override
@Transactional
public Long dispatch(WrkInfo wrkInfo, Store store, Terminal terminal, TerminalIns terminalIns)
{
public Long dispatch(WrkInfo wrkInfo, Store store, Terminal terminal, TerminalIns terminalIns) {
// 工单信息
save(wrkInfo);
//终端信息
@ -570,8 +638,7 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
/**
* 计算经纬度 偏差
*/
private Long distance(String origins, String destination)
{
private Long distance(String origins, String destination) {
HashMap<String, Object> map = new HashMap<>() {{
put("origins", origins);
put("destination", destination);
@ -602,8 +669,7 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
Integer storeStatus,
Integer workType,
Integer serviceResult,
Terminal record, Store store)
{
Terminal record, Store store) {
// 2023年4月19号修改 市场部
//撤机 两种情况下归属撤机
@ -672,86 +738,4 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
// 此处 去调用 生成 word 文档
return Result.ok(generatedInsFactory.generated(wrkMap));
}
private WrkInfo makeWrkInfoEntity(DispatchDTO dispatch, DispatchQuery query, Long userId, String userName, Integer workMethod) {
WrkInfo wrkInfo = new WrkInfo();
wrkInfo.setTaskId(query.getTaskId());
wrkInfo.setDeptId(SecurityUtils.getDeptId());
wrkInfo.setUserId(userId);
wrkInfo.setAccountPhone(dispatch.getAccountPhone());
wrkInfo.setUserName(userName);
wrkInfo.setWorkNo(IdUtil.getSnowflake().nextId());
wrkInfo.setWorkType(query.getWorkType());
wrkInfo.setWorkMethod(workMethod);
wrkInfo.setWorkSort(query.getWorkSort());
wrkInfo.setWrkStatus(1);
wrkInfo.setWorkSource(query.getWorkSource());
wrkInfo.setTaskId(dispatch.getTaskId());
wrkInfo.setLowerTaskId(dispatch.getLowerTaskId());
wrkInfo.setTaskName(pollingTaskService.getTaskNameById(dispatch.getTaskId()));
wrkInfo.setLowerTaskName(pollingTaskService.getTaskNameById(dispatch.getLowerTaskId()));
//
wrkInfo.setVersion(0L);
// 处理时间
//wrkInfo.setDisposeTime(query.getEndTime());
// 业务员名字和客户经理?
// wrkInfo.setAccountManager(dispatch.getAccountManager());
return wrkInfo;
}
private void saveData(List<DispatchDTO> dispatch, DispatchQuery query, Integer method) {
// 0 业务员领取 1 只能派给负责项目的业务员 2 只能派给商户对应的客户经理
if (method.equals(0)) {
Set<String> nickNames = StreamUtils.toSet(dispatch, DispatchDTO::getAccountManager);
Result<Map<String, Long>> result = userFeignService.getIdByNicknames(nickNames, SecurityConstants.INNER);
if (result.isSuccess()) {
// Map<String, Long> userIds = result.getData();
for (DispatchDTO dispatchDTO : dispatch) {
// Long userId = userIds.get(dispatchDTO.getAccountManager());
// Assert.notNull(userId, "【{}】未设置商户", dispatchDTO.getAccountManager());
// 组装wrkinfo实体
WrkInfo wrkInfo = makeWrkInfoEntity(dispatchDTO, query, query.getUserId(), dispatchDTO.getAccountManager(), 0);
save(wrkInfo);
//组装wrkterminal 实体
WrkInfoTerminalRecord wrkInfoTerminalRecord = BeanUtil.copyProperties(dispatchDTO, WrkInfoTerminalRecord.class);
wrkInfoTerminalRecord.setWrkId(wrkInfo.getWrkId());
wrkInfoTerminalRecord.setVersion(0L);
wrkInfoTerminalRecordService.save(wrkInfoTerminalRecord);
WrkInfoStoreRecord wrkInfoStoreRecord = BeanUtil.copyProperties(dispatchDTO, WrkInfoStoreRecord.class);
wrkInfoStoreRecord.setWrkId(wrkInfo.getWrkId());
wrkInfoStoreRecord.setDeptId(SecurityUtils.getDeptId());
wrkInfoStoreRecord.setStoreId(dispatchDTO.getStoreId());
wrkInfoStoreRecord.setVersion(0L);
wrkInfoStoreRecordService.save(wrkInfoStoreRecord);
}
}
} else if (method.equals(1) || method.equals(2)) {
Assert.notNull(query.getUserId(), "需要指定业务员");
Result<SysUser> result = userFeignService.getInfoById(query.getUserId(), SecurityConstants.INNER);
if (result.isSuccess()) {
String nickName = result.getData().getNickName();
for (DispatchDTO dispatchDTO : dispatch) {
Assert.notNull(nickName, "【{}】未设置商户", dispatchDTO.getAccountManager());
WrkInfo wrkInfo = makeWrkInfoEntity(dispatchDTO, query, query.getUserId(), dispatchDTO.getAccountManager(), method);
// 工单信息
save(wrkInfo);
//终端信息
WrkInfoTerminalRecord wrkInfoTerminalRecord = BeanUtil.copyProperties(dispatchDTO, WrkInfoTerminalRecord.class);
wrkInfoTerminalRecord.setWrkId(wrkInfo.getWrkId());
wrkInfoTerminalRecordService.save(wrkInfoTerminalRecord);
// 终端巡检信息
WrkInfoTerminalInsRecord wrkInfoTerminalInsRecord = BeanUtil.copyProperties(dispatchDTO, WrkInfoTerminalInsRecord.class);
wrkInfoTerminalInsRecord.setWrkId(wrkInfo.getWrkId());
wrkInfoTerminalInsRecordService.save(wrkInfoTerminalInsRecord);
// 商户信息
WrkInfoStoreRecord wrkInfoStoreRecord = BeanUtil.copyProperties(dispatchDTO, WrkInfoStoreRecord.class);
wrkInfoStoreRecord.setWrkId(wrkInfo.getWrkId());
wrkInfoStoreRecord.setDeptId(SecurityUtils.getDeptId());
wrkInfoStoreRecord.setStoreId(dispatchDTO.getStoreId());
wrkInfoStoreRecordService.save(wrkInfoStoreRecord);
}
}
}
//
}
}

View File

@ -112,7 +112,7 @@
ti.geographic_address AS geographicAddress,
ti.geographic_location AS geographicLocation,
ti.work_location AS workLocation,
ti.work_adderss AS workAddress
ti.work_address AS workAddress
FROM st_terminal t
LEFT JOIN st_terminal_ins ti ON t.terminal_id = ti.terminal_id
INNER JOIN st_store s ON t.store_id = s.store_id

View File

@ -149,7 +149,7 @@
<id column="terminal_id" property="terminalId" />
<result column="deviation" property="deviation" />
<result column="geographic_location" property="geographicLocation" />
<result column="work_adderss" property="workAddress" />
<result column="work_address" property="workAddress" />
<result column="work_location" property="workLocation" />
<result column="geographic_address" property="locationAddress" />
<result column="pre_code_encoding" property="preCodeEncoding" />
@ -221,7 +221,7 @@
itir.`geographic_location`,
itir.`geographic_address`,
itir.`work_location`,
itir.`work_adderss`,
itir.`work_address`,
itir.`deviation`,
itir.`pre_code_encoding`,
itir.`service_result`,

View File

@ -53,7 +53,7 @@
ti.geographic_address AS geographicAddress,
ti.geographic_location AS geographicLocation,
ti.work_location AS workLocation,
ti.work_adderss AS workAddress
ti.work_address AS workAddress
FROM wrk_info i
LEFT JOIN ta_polling_task pt ON i.task_id = pt.id
LEFT JOIN wrk_project p ON pt.project_id = p.project_id