1. 派单进度

This commit is contained in:
ant 2024-07-19 17:48:47 +08:00
parent 4f43975e73
commit e467e83519
7 changed files with 46 additions and 49 deletions

View File

@ -13,14 +13,12 @@ import lombok.*;
*/
@Data
@EqualsAndHashCode(callSuper=true)
@AllArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "wrk_info_dispatch")
@Builder
public class WrkInfoDispatch extends BaseEntity {
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
@TableField("wrk_id")
@TableId(value = "wrk_id", type = IdType.INPUT)
private Long wrkId;
@TableField("user_id")
private Long userId;
@ -31,4 +29,5 @@ public class WrkInfoDispatch extends BaseEntity {
*/
@TableField("dis_status")
private Integer disStatus;
}

View File

@ -3,9 +3,12 @@ package com.chushang.inspection.work.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chushang.inspection.work.po.WrkInfoDispatch;
import java.util.ArrayList;
/**
* @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);
}

View File

@ -1,8 +0,0 @@
package com.chushang.inspection.work.service;
import java.util.Collection;
public interface WrkScheduleService {
void updateWorkOrderProgress(int status, Collection<Long> list);
}

View File

@ -24,7 +24,7 @@ import com.chushang.inspection.work.dto.WrkIcbcJsReceive;
import com.chushang.inspection.work.enums.BankBranchesEnum;
import com.chushang.inspection.work.enums.WorkTypeOperation;
import com.chushang.inspection.work.po.WrkInfo;
import com.chushang.inspection.work.service.WrkScheduleService;
import com.chushang.inspection.work.service.WrkInfoDispatchService;
import com.chushang.inspection.work.service.WrkIcbcJsService;
import com.chushang.inspection.work.service.WrkInfoService;
import com.chushang.inspection.work.vo.BankDispatchDTO;
@ -60,7 +60,7 @@ public class WrkIcbcJsServiceImpl extends ServiceImpl<WrkIcbcJsMapper, WrkIcbcJs
@Resource
WrkInfoService wrkInfoService;
@Resource
WrkScheduleService scheduleService;
WrkInfoDispatchService dispatchService;
@Override
@ -122,7 +122,8 @@ public class WrkIcbcJsServiceImpl extends ServiceImpl<WrkIcbcJsMapper, WrkIcbcJs
AssertUtil.invalidate(task == null && StrUtil.isEmpty(task.getContact()), "未指定业务员");
Result<Map<String, Long>> result = remoteUserService.getIdByNicknames(Set.of(), SecurityConstants.INNER);
AssertUtil.invalidate(!result.isSuccess(), "获取业务员信息失败");
wrkInfo = dispatchWrkInfo(dispatch, result.getData().get(task.getContact()), task.getContact(), WorkTypeOperation.valueOfCode(icbcJs.getOrderType()));
userId = result.getData().get(task.getContact());
wrkInfo = dispatchWrkInfo(dispatch, userId, task.getContact(), WorkTypeOperation.valueOfCode(icbcJs.getOrderType()));
} else {
Result<SysUser> result = remoteUserService.getInfoById(userId, SecurityConstants.INNER);
AssertUtil.invalidate(!result.isSuccess(), "获取业务员信息失败");
@ -135,7 +136,7 @@ public class WrkIcbcJsServiceImpl extends ServiceImpl<WrkIcbcJsMapper, WrkIcbcJs
terminalService.updateOccupy(ListUtil.toList(terminal.getTerminalId()), 1);
}
// 修改派单进度
scheduleService.updateWorkOrderProgress(6, ListUtil.toList(wrkId));
dispatchService.updateWorkOrderProgress(userId,6, ListUtil.toList(wrkId), wrkInfo.getDeptId());
WrkIcbcJs wrkIcbcJs = new WrkIcbcJs();
wrkIcbcJs.setId(entity.getId());
wrkIcbcJs.setWrkId(wrkId);
@ -144,14 +145,6 @@ public class WrkIcbcJsServiceImpl extends ServiceImpl<WrkIcbcJsMapper, WrkIcbcJs
updateById(wrkIcbcJs);
}
private void dispatchWrkTerminal(DispatchDTO dispatch) {
}
private void dispatchWrkStore(DispatchDTO dispatch) {
}
private WrkInfo dispatchWrkInfo(DispatchDTO dispatch, Long userId, String userName, Integer workType) {
WrkInfo wrkInfo = BeanUtil.copyProperties(dispatch, WrkInfo.class);
wrkInfo.setUserId(userId);

View File

@ -1,11 +1,17 @@
package com.chushang.inspection.work.service.impl;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chushang.inspection.utils.StreamUtils;
import com.chushang.inspection.work.mapper.WrkInfoDispatchMapper;
import com.chushang.inspection.work.po.WrkInfoDispatch;
import com.chushang.inspection.work.service.WrkInfoDispatchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* @auther: zhao
@ -14,4 +20,21 @@ import org.springframework.stereotype.Service;
@Slf4j
@Service
public class WrkInfoDispatchServiceImpl extends ServiceImpl<WrkInfoDispatchMapper, WrkInfoDispatch> implements WrkInfoDispatchService {
@Override
@Transactional
public void updateWorkOrderProgress(Long userId, int disStatus, ArrayList<Long> wrkIds, Long deptId) {
// 修改 派单进度
if (disStatus == 6) {
List<WrkInfoDispatch> schedules = StreamUtils.toList(wrkIds, wrkId -> new WrkInfoDispatch(wrkId,userId, deptId, 6));
saveBatch(schedules);
} else {
// 修改派单 进度
updateBatchById(StreamUtils.toList(wrkIds, wrkId-> {
WrkInfoDispatch wrkInfoDispatch = new WrkInfoDispatch();
wrkInfoDispatch.setWrkId(wrkId);
wrkInfoDispatch.setDisStatus(disStatus);
return wrkInfoDispatch;
}));
}
}
}

View File

@ -1,15 +0,0 @@
package com.chushang.inspection.work.service.impl;
import com.chushang.inspection.work.service.WrkScheduleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Collection;
@Slf4j
@Service
public class WrkScheduleServiceImpl implements WrkScheduleService {
public void updateWorkOrderProgress(int status, Collection<Long> list){
}
}

View File

@ -1,14 +1,26 @@
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.resource.ResourceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chushang.InspectionApplication;
import com.chushang.common.core.util.FileUtils;
import com.chushang.inspection.ins.GeneratedIns;
import com.chushang.inspection.ins.TemplateService;
import com.chushang.inspection.work.po.WrkInfo;
import com.chushang.inspection.work.service.WrkInfoService;
import com.deepoove.poi.XWPFTemplate;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.io.File;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@ -20,21 +32,11 @@ import java.util.Map;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = InspectionApplication.class)
public class GenInsTest {
@Resource
WrkInfoService wrkInfoService;
@Resource
TemplateService templateService;
@Test
public void genTest(){
// generatedIns.generated();
Map<String, Object> data = new HashMap<>();
data.put("1", "1");
data.put("2", "2");
}
}