# Conflicts:
#	dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java
This commit is contained in:
Vinjor 2024-10-23 14:33:27 +08:00
commit d5beed0206
11 changed files with 281 additions and 64 deletions

View File

@ -187,6 +187,14 @@ public class PartnerOwnController extends BaseController {
{
return success(partnerList.hotGoodsList(partnerId));
}
/**
* 热销商品列表
*/
@GetMapping("/newHotGoodsList")
public CommonResult newHotGoodsList()
{
return success(partnerList.newHotGoodsList());
}
/**

View File

@ -20,6 +20,7 @@ import java.util.Map;
@Mapper
public interface AppInspectionPartnerMapper extends BaseMapper<ShopMallPartners> {
ShopMallPartners selectById(@Param("id") Long id);
ShopMallPartners selectByIdNew();
IPage<PartnerListVo> partnerList(Page<PartnerListVo> page, @Param("vo") PartnerListQuery partnerListQuery);
PartnerListVo shopDetail(PartnerListQuery partnerListQuery);
void addSalesNum(@Param("partnerId") Long partnerId);
@ -32,6 +33,7 @@ public interface AppInspectionPartnerMapper extends BaseMapper<ShopMallPartners>
Integer allAmount(@Param("partnerId") Long partnerId);
Integer todayAmount(@Param("partnerId") Long partnerId,@Param("timeStr") String timeStr);
List<HotGoodsVo> hotGoodsList(@Param("partnerId") Long partnerId,@Param("dateStr")String dateStr);
List<HotGoodsVo> newHotGoodsList(@Param("dateStr")String dateStr);
IPage<GoodsVo> manageGoodsList(Page<GoodsVo> page,@Param("partnerId") Long partnerId, @Param("isListing")String isListing,@Param("goodsTitle") String goodsTitle);
IPage<OrderAppDetail> orderList(Page<OrderAppDetail> page,@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum,@Param("title") String title);
List<PartnerWorker> getWorkList(@Param("partnerId")Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum")String phoneNum);

View File

@ -49,6 +49,7 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
JSONObject newChartInfoRatio(String unit);
List<OrderInfo> orderInfo(Long partnerId);
List<HotGoodsVo> hotGoodsList(Long partnerId);
List<HotGoodsVo> newHotGoodsList();
void addGoods(ShopInspectionGoods goods) throws Exception;
IPage<GoodsVo> goodsList(Page<GoodsVo> page,Long partnerId, String isListing, String goodsTitle);
List<JSONObject> canUseGoods(Long partnerId);

View File

@ -983,6 +983,11 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd");
return baseMapper.hotGoodsList(partnerId,dateStr);
}
@Override
public List<HotGoodsVo> newHotGoodsList() {
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd");
return baseMapper.newHotGoodsList(dateStr);
}
@Override
@Transactional(rollbackFor = Exception.class)

View File

@ -6,6 +6,9 @@
<select id="selectById" resultType="cn.iocoder.yudao.module.shop.entity.ShopMallPartners" >
select * from shop_mall_partners where partner_id = #{id}
</select>
<select id="selectByIdNew" resultType="cn.iocoder.yudao.module.shop.entity.ShopMallPartners" >
select * from shop_mall_partners
</select>
<select id="partnerList" parameterType="cn.iocoder.yudao.module.inspection.query.PartnerListQuery" resultType="cn.iocoder.yudao.module.inspection.vo.PartnerListVo">
SELECT
smp.partner_logo,
@ -143,6 +146,20 @@ GROUP BY
goods.id
order by salesNum desc
</select>
<select id="newHotGoodsList" resultType="cn.iocoder.yudao.module.inspection.vo.HotGoodsVo">
SELECT
goods.title AS goodsName,
SUM( case when (ii.`status`='1' and ii.is_pass = '1') or (ii.`status`='0') then oi.goods_price else 0 end ) AS salesAmount,
SUM( case when (ii.`status`='1' and ii.is_pass = '1') or (ii.`status`='0') then 1 else 0 end ) AS salesNum
FROM
order_info oi
left join shop_inspection_goods goods on goods.id = oi.goods_id
left JOIN inspection_info ii on oi.id = ii.inspection_order_id
WHERE validation_time is not null and validation_time like concat(#{dateStr},'%')
GROUP BY
goods.id
order by salesNum desc
</select>
<select id="manageGoodsList" resultType="cn.iocoder.yudao.module.inspection.vo.GoodsVo">
SELECT
sig.id as goodsId,sig.title as goodsTitle,sig.image as goodsImage,sig.price,count(oi.id) as salesNum,sig.listing_status,sig.reject_reason
@ -411,7 +428,7 @@ FROM
FROM
order_info oi
INNER JOIN inspection_info ii on oi.id = ii.inspection_order_id
left join system_dict_data sdd on sdd.value = ii.customer_source and sdd.dict_type = concat('customer_source-',#{partnerId})
left join system_dict_data sdd on sdd.value = ii.customer_source
WHERE ii.create_time BETWEEN #{startTime} and #{endTime}
GROUP BY sdd.remark
having count(1)>0

View File

@ -171,6 +171,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
public void voidRepairSo(DlRepairSoReqVO repairSoReqVO) {
baseMapper.updateById(repairSoReqVO);
// 下面的代码是因为这个接口还有地方在用
// 查主表
DlRepairSo so = baseMapper.selectById(repairSoReqVO.getId());
// 查当前登录操作人的userId
@ -353,7 +354,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
titem.setId(item.getId());
sois.stream().filter(i -> i.getGoodsId().equals(item.getPartId())).findFirst().ifPresent(i -> {
titem.setItemCount(item.getItemCount() - i.getGoodsCount());
titem.setItemMoney(new BigDecimal(item.getItemCount()).multiply(item.getItemPrice()).multiply(item.getItemDiscount()));
BigDecimal itemDiscount = ObjectUtil.isNotEmpty(item.getItemDiscount()) ? item.getItemDiscount() : BigDecimal.ONE;
titem.setItemMoney(new BigDecimal(titem.getItemCount()).multiply(item.getItemPrice()).multiply(itemDiscount));
});
return titem;
}).collect(Collectors.toList());

View File

@ -247,5 +247,24 @@ public class DlRepairTicketsController {
dlRepairTicketsService.updateShow(id, show);
return CommonResult.ok();
}
/**
* 查待总检或待出厂检验的工单
* 维修服务顾问和总检用的
*
* @author 小李
* @date 11:40 2024/10/23
* @param repairTicketsReqVO 请求对象
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/pageByRole")
@Operation(summary = "查待总检或待出厂检验的工单")
public CommonResult<?> getPageByRole(DlRepairTicketsReqVO repairTicketsReqVO,
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
return success(dlRepairTicketsService.getPageByRole(repairTicketsReqVO, page));
}
}

View File

@ -135,4 +135,14 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @param show 是否可见
**/
void updateShow(String id, String show);
/**
* 查待总检或待出厂检验的工单
* 维修服务顾问和总检用的
*
* @author 小李
* @date 11:40 2024/10/23
* @param repairTicketsReqVO 请求对象
**/
IPage<DlRepairTickets> getPageByRole(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
}

View File

@ -137,12 +137,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
@Resource
@Lazy
private RepairWorkerService repairWorkerService;
@Resource
private RepairWorkerService workerService;
@Resource
@Lazy
private RepairRecordsService recordsService;
@Autowired
@Resource
private RepairRecordsService repairRecordsService;
@ -217,12 +217,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
repairOrderInfo.setOrderTime(ticketsRespVO.getCreateTime());
repairOrderInfo.setOrderStatus("0");
repairOrderInfo.setPayMoney(ticketsRespVO.getTotalPrice());
if (ObjectUtil.isNotEmpty(deptId)){
if (ObjectUtil.isNotEmpty(deptId)) {
repairOrderInfo.setDeptId(Integer.parseInt(deptId + ""));
}
// 如果选择了预约还要更新预约记录
if (ObjectUtil.isNotEmpty(ticketsRespVO.getBookingId())){
if (ObjectUtil.isNotEmpty(ticketsRespVO.getBookingId())) {
DlRepairBooking dlRepairBooking = new DlRepairBooking();
dlRepairBooking.setId(ticketsRespVO.getBookingId());
dlRepairBooking.setTicketsId(ticketsRespVO.getId());
@ -231,7 +231,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
}
repairOrderInfoService.saveOrderInfo(repairOrderInfo);
//最后记录操作日志--创建工单
repairRecordsService.saveRepairRecord(ticketsRespVO.getId(),null, RecordTypeEnum.CJGD.getCode(),"创建工单",null);
repairRecordsService.saveRepairRecord(ticketsRespVO.getId(), null, RecordTypeEnum.CJGD.getCode(), "创建工单", null);
return ticketsRespVO;
}
@ -260,7 +260,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
//查车辆
if (ObjectUtil.isNotEmpty(dlRepairTickets.getCarId())){
if (ObjectUtil.isNotEmpty(dlRepairTickets.getCarId())) {
CarMainRespVO carInfo = carMainService.queryCarById(dlRepairTickets.getCarId());
result.setCarInfo(carInfo);
}
@ -331,17 +331,17 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
/**
* 客户信息和车辆信息 新增修改
*
* @param customerAndCarVO 用户信息和车辆信息
* @author 小李
* @date 9:25 2024/10/8
* @param customerAndCarVO 用户信息和车辆信息
**/
@Override
@DSTransactional
public void updateCustomerAndCar(CustomerAndCarVO customerAndCarVO){
public void updateCustomerAndCar(CustomerAndCarVO customerAndCarVO) {
// 新增用户信息,如果不存在
if (ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo().getPhoneNumber()) && ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo().getCusName())){
if (ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo().getPhoneNumber()) && ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo().getCusName())) {
AdminUserRespDTO userByMobile = adminUserApi.getUserByMobile(customerAndCarVO.getUserInfo().getPhoneNumber());
if (ObjectUtil.isEmpty(userByMobile)){
if (ObjectUtil.isEmpty(userByMobile)) {
UserDTO userDTO = new UserDTO();
userDTO.setMobile(customerAndCarVO.getUserInfo().getPhoneNumber());
userDTO.setNickname(customerAndCarVO.getUserInfo().getCusName());
@ -352,32 +352,32 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
}
}
// 客户信息
if (ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo())){
if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())){
if (ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo())) {
if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())) {
customerService.save(customerAndCarVO.getUserInfo());
}else {
} else {
customerService.updateById(customerAndCarVO.getUserInfo());
}
}
// 新增车辆信息
if (ObjectUtil.isNotEmpty(customerAndCarVO.getCarInfo())){
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())){
if (ObjectUtil.isNotEmpty(customerAndCarVO.getCarInfo())) {
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())) {
carMainService.createCarMain(customerAndCarVO.getCarInfo());
}else {
} else {
carMainService.updateCarMain(customerAndCarVO.getCarInfo());
}
}
// 新增客户车辆信息关联
String userId = customerAndCarVO.getUserInfo().getId();
String carId = customerAndCarVO.getCarInfo().getId();
if (ObjectUtil.isNotEmpty(userId) && ObjectUtil.isNotEmpty(carId)){
if (ObjectUtil.isNotEmpty(userId) && ObjectUtil.isNotEmpty(carId)) {
// 先查询有没有记录
CustomerCar one = customerCarService.getOne(new LambdaQueryWrapper<CustomerCar>().and(item -> {
item.eq(CustomerCar::getCusId, userId)
.eq(CustomerCar::getCarId, carId);
}));
// 没有就新增
if (ObjectUtil.isEmpty(one)){
if (ObjectUtil.isEmpty(one)) {
CustomerCar customerCar = new CustomerCar();
customerCar.setCusId(userId);
customerCar.setCarId(carId);
@ -396,11 +396,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
**/
@Override
public void print(HttpServletResponse response, String id) {
Map<String,Object> params = new HashMap<>();
params.put("jobNumber","123456789");
Map<String, Object> params = new HashMap<>();
params.put("jobNumber", "123456789");
String fileName = "结算单.docx";
String tmpPath = "D:\\"+fileName;
try{
String tmpPath = "D:\\" + fileName;
try {
InputStream inputStream = XWPFTemplate.class.getResourceAsStream("/templates/gdmb.docx");
XWPFTemplate template = XWPFTemplate.compile(inputStream);
template.render(params);
@ -408,8 +408,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
template.write(fos);
fos.flush();
template.close();
WordUtil.down(response,tmpPath,fileName);
}catch (Exception e){
WordUtil.down(response, tmpPath, fileName);
} catch (Exception e) {
e.printStackTrace();
}
}
@ -417,22 +417,22 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
/**
* 分类查询工单分页
*
* @param repairTicketsReqVO 查询对象
* @author 小李
* @date 16:26 2024/10/12
* @param repairTicketsReqVO 查询对象
**/
@Override
public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page){
public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page) {
String userRoleCode = getUserRole();
if(userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())|| userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())){
//维修管理员和总检看所有数据
}else if(userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())){
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode()) || userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
//维修管理员和总检看所有数据
} else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
//服务顾问看自己的
repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
}else if(userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())){
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
//维修工进一步判断是否是班组长
boolean ifLeader = workerService.getIfLeader();
if(ifLeader){
boolean ifLeader = repairWorkerService.getIfLeader();
if (ifLeader) {
//班组长看本班组所有数据
RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
// 查自己班组的员工信息
@ -440,16 +440,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 所有的员工信息
List<Long> userIds = list.stream().map(RepairWorker::getUserId).collect(Collectors.toList());
repairTicketsReqVO.setUserIds(userIds);
}else{
} else {
//普通维修工
repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
}
}else{
} else {
return null;
}
if(RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())){
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
return baseMapper.getPageType(repairTicketsReqVO, page);
}else{
} else {
return baseMapper.getPageTypeAll(repairTicketsReqVO, page);
}
}
@ -459,9 +459,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
*
* @author 小李
* @date 9:28 2024/10/14
**/
**/
@Override
public String getUserRole(){
public String getUserRole() {
// 查看当前登录用户是什么角色
// 当前登录用户的角色信息
List<Long> byUserId = permissionApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId());
@ -472,27 +472,27 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 取出角色名称
List<String> codes = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList());
// 维修业务管理员--可以看所有数据但不能做操作
if (codes.contains(RepairRoleEnum.ADMIN.getCode())){
if (codes.contains(RepairRoleEnum.ADMIN.getCode())) {
return RepairRoleEnum.ADMIN.getCode();
}
// 总检
if (codes.contains(RepairRoleEnum.INSPECTION.getCode())){
if (codes.contains(RepairRoleEnum.INSPECTION.getCode())) {
return RepairRoleEnum.INSPECTION.getCode();
}
// 服务顾问
if (codes.contains(RepairRoleEnum.ADVISOR.getCode())){
if (codes.contains(RepairRoleEnum.ADVISOR.getCode())) {
return RepairRoleEnum.ADVISOR.getCode();
}
// 维修工或班组长
if (codes.contains(RepairRoleEnum.REPAIR_STAFF.getCode())){
if (codes.contains(RepairRoleEnum.REPAIR_STAFF.getCode())) {
return RepairRoleEnum.REPAIR_STAFF.getCode();
}
// 维修仓库管理员
if(codes.contains(RepairRoleEnum.WAREHOUSE.getCode())){
if (codes.contains(RepairRoleEnum.WAREHOUSE.getCode())) {
return RepairRoleEnum.WAREHOUSE.getCode();
}
// 维修财务
if(codes.contains(RepairRoleEnum.WXCW.getCode())){
if (codes.contains(RepairRoleEnum.WXCW.getCode())) {
return RepairRoleEnum.WXCW.getCode();
}
// 啥也不是
@ -502,12 +502,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
/**
* 接单
*
* @param id 工单ID
* @author 小李
* @date 11:48 2024/10/14
* @param id 工单ID
**/
@Override
public void updateTake(String id){
public void updateTake(String id) {
// 改变时看看是否已经被接了
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.RECEIVED.getCode())
@ -515,19 +515,19 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
item.eq(DlRepairTickets::getId, id)
.eq(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.WAITING_RECEIVING.getCode());
}));
if (update != 1){
if (update != 1) {
throw exception0(500, "工单已被其他人接单了");
}
//最后记录操作日志--接单
repairRecordsService.saveRepairRecord(id,null, RecordTypeEnum.jd.getCode(), "接单",null);
repairRecordsService.saveRepairRecord(id, null, RecordTypeEnum.jd.getCode(), "接单", null);
}
/**
* 指派员工通知施工
*
* @param reqVO 请求对象
* @author 小李
* @date 15:34 2024/10/14
* @param reqVO 请求对象
**/
@Override
public void updateRepair(DlRepairTicketsReqVO reqVO) {
@ -544,9 +544,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
if (update != 1) {
throw exception0(500, "工单已开始");
}
workerService.sentMessage(reqVO.getNowRepairId(),"您有新的工单要处理");
repairWorkerService.sentMessage(reqVO.getNowRepairId(), "您有新的工单要处理");
//最后记录操作日志--指派施工
repairRecordsService.saveRepairRecord(reqVO.getId(),null, RecordTypeEnum.ZPSG.getCode(),"指派施工",null);
repairRecordsService.saveRepairRecord(reqVO.getId(), null, RecordTypeEnum.ZPSG.getCode(), "指派施工", null);
}
/**
@ -558,18 +558,26 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
**/
@Override
@DSTransactional
public void updateStatus(DlRepairTicketsRespVO respVO){
if(StringUtils.isNotEmpty(respVO.getTicketsWorkStatus())){
public void updateStatus(DlRepairTicketsRespVO respVO) {
// 如果是开始施工但项目还在施工中就不能施工
if (respVO.getRecordType().equals("kssg")){
DlRepairTitem titem = titemService.getById(respVO.getItem().getId());
if (titem.getItemStatus().equals("02")){
throw exception0(500, "选择的项目在施工中,不能重新开始施工");
}
}
if (StringUtils.isNotEmpty(respVO.getTicketsWorkStatus())) {
// 更新工单主表
LambdaUpdateWrapper<DlRepairTickets> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(DlRepairTickets::getId, respVO.getId());
wrapper.set(DlRepairTickets::getTicketsWorkStatus, respVO.getTicketsWorkStatus());
if (ObjectUtil.isNotEmpty(respVO.getIsFinish())){
if (ObjectUtil.isNotEmpty(respVO.getIsFinish())) {
wrapper.set(DlRepairTickets::getIsFinish, respVO.getIsFinish());
}
baseMapper.update(wrapper);
}
if(null!=respVO.getItem() && StringUtils.isNotEmpty(respVO.getItem().getItemStatus())){
if (null != respVO.getItem() && StringUtils.isNotEmpty(respVO.getItem().getItemStatus())) {
// 更新工单子表
titemService.update(new LambdaUpdateWrapper<DlRepairTitem>()
.set(DlRepairTitem::getItemStatus, respVO.getItem().getItemStatus())
@ -578,23 +586,123 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
}
// 记录日志
recordsService.saveRepairRecord(respVO.getId(), respVO.getItem().getId(), respVO.getRecordType(), respVO.getRemark(), respVO.getImage());
// 通知服务顾问和维修总检
DlRepairTickets tickets = baseMapper.selectById(respVO.getId());
DlRepairTitem titem = titemService.getById(respVO.getItem().getId());
/*
消息组成对那个工单那个项目干了什么
工单的当前施工人
对那个工单工单号
那个项目操作的项目
干了什么提交的请求
干了什么有三种情况开始施工施工中的记录上传施工完成
施工完成又分四种情况阶段完成完成并移交下一班组完成并移交总检完成工单其中部分完成同开始施工施工中的记录上传一致只上传不改变
*/
// 消息生成
String message = createMessage(tickets.getNowRepairName(), tickets.getTicketNo(), titem.getItemName(), respVO.getRecordType(), respVO.getFinishType(), respVO.getNextName());
// 通知服务顾问
// 如果员工完成了订单
if (respVO.getRecordType().equals("sgwczj") && respVO.getFinishType().equals("03")) {
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的工单可以交车");
} else {
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), message);
}
// 通知总检
// 总检查角色包含总检的员工
// 取这个角色的角色信息
RoleReqDTO roleInfo = roleApi.getRoleInfo(RepairRoleEnum.INSPECTION.getCode());
// 通过角色信息查有这个角色的人
List<Long> ids = permissionApi.getUserIdByRoleId(roleInfo.getId());
if (CollectionUtil.isEmpty(ids)) return;
// 如果是移交给总检就需要通知总检并让其总检
if (respVO.getRecordType().equals("sgwczj") && respVO.getFinishType().equals("02")) {
// 工单移交给总检(理论上讲只有一个总检就算有多个这里面也只给一个)
AdminUserRespDTO user = adminUserApi.getUser(ids.get(0));
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
.set(DlRepairTickets::getNowRepairId, user.getId())
.set(DlRepairTickets::getNowRepairName, user.getNickname())
.eq(DlRepairTickets::getId, respVO.getId()));
repairWorkerService.sentMessage(user.getId(), "您有新的工单需要总检");
} else {
ids.forEach(id -> {
repairWorkerService.sentMessage(id, message);
});
}
}
private String createMessage(String who, String no, String projectName, String type, String finishType, String nextName) {
String result = who;
switch (type) {
// 开始施工
case "kssg":
return result + "开始施工工单:" + no + "" + projectName + "项目";
// 施工记录
case "sgz":
return result + "上传了工单:" + no + "" + projectName + "项目的维修记录";
// 施工完成
case "sgwczj":
if (ObjectUtil.isNotEmpty(finishType)){
result = result + "完成了工单:" + no + "" + projectName + "项目";
switch (finishType) {
// 完成并移交下一班组
case "01":
return result + "并移交工单给了" + nextName;
// 完成并移交总检
case "02":
return result + "并移交给了总检";
// 完成工单
case "03":
return who + "完成了工单";
default:
return "异常消息";
}
}else {
return result + "部分完成了工单:" + no + "" + projectName + "项目";
}
default:
return "异常消息";
}
}
/**
* 配件客户是否可见
*
* @param id 工单ID
* @param show 是否可见 1可见 0不可见
* @author 小李
* @date 21:52 2024/10/18
* @param id 工单ID
* @param show 是否可见 1可见 0不可见
**/
@Override
public void updateShow(String id, String show){
public void updateShow(String id, String show) {
DlRepairTickets dlRepairTickets = new DlRepairTickets();
dlRepairTickets.setId(id);
dlRepairTickets.setPartShow(show);
baseMapper.updateById(dlRepairTickets);
}
/**
* 查待总检或待出厂检验的工单
* 维修服务顾问和总检用的
*
* @author 小李
* @date 11:40 2024/10/23
* @param repairTicketsReqVO 请求对象
**/
@Override
public IPage<DlRepairTickets> getPageByRole(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page){
String userRoleCode = getUserRole();
// 维修服务顾问
if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())){
}else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())){
// 总检
}else {
return null;
}
// 还是用分类查询不过需要重新构造查询条件 todo
return baseMapper.getPageType(repairTicketsReqVO, page);
}
}

View File

@ -14,6 +14,9 @@ import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.mapper.DlRepairSoMapper;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
@ -80,11 +83,17 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
private RepairWaresService repairWaresService;
@Resource
private RepairWorkerService workerService;
@Autowired
@Lazy
private DlRepairSoMapper dlRepairSoMapper;
@Resource
@Lazy
private RoleApi roleApi;
@Resource
@Lazy
private PermissionApi permissionApi;
/**
* 分页查询
*
@ -103,7 +112,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
reqVO.setAdviserId(SecurityFrameworkUtils.getLoginUserId());
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
//维修工进一步判断是否是班组长
boolean ifLeader = workerService.getIfLeader();
boolean ifLeader = repairWorkerService.getIfLeader();
if (ifLeader) {
//班组长看本班组所有数据
RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
@ -173,6 +182,20 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
throw exception0(500, "配件列表为空");
}
twItemService.saveOrUpdateBatch(list);
// 通知对应的维修服务顾问和总检
// 维修服务顾问即创建工单时选的是谁
DlRepairTickets tickets = repairTicketsService.getById(respVO.getTicketId());
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的配件申请单需要审核");
// 总检查角色包含总检的员工
// 取这个角色的角色信息
RoleReqDTO roleInfo = roleApi.getRoleInfo(RepairRoleEnum.INSPECTION.getCode());
// 通过角色信息查有这个角色的人
List<Long> ids = permissionApi.getUserIdByRoleId(roleInfo.getId());
// 发通知
if (CollectionUtil.isNotEmpty(ids)){
ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要审核"));
}
}
/**
@ -236,6 +259,13 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
item.setItemStatus("08");
});
repairTitemService.saveBatch(respVO.getWares());
// 发送通过的消息给仓库
RoleReqDTO roleInfo = roleApi.getRoleInfo(RepairRoleEnum.WAREHOUSE.getCode());
List<Long> ids = permissionApi.getUserIdByRoleId(roleInfo.getId());
if (CollectionUtil.isNotEmpty(ids)){
ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理"));
}
} else if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02") && respVO.getType().equals("02")) {
// 如果通过退料也需要更新
// 更新维修工单
@ -279,6 +309,10 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
}
});
});
// 发送没有通过的消息给员工
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
repairWorkerService.sentMessage(ticketWares.getRepairId(), "您的配件申请单被驳回了");
}
}

View File

@ -48,4 +48,15 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
List<DlRepairTitemReqVO> wares;
List<DlRepairTitemReqVO> projects;
/**
* 维修工完成的类别
* 01完成并移交下一班组
* 02完成并移交总检
* 03完成工单
*/
private String finishType;
/** 如果是完成并移交下一班组,就有移交给了那一个班组 */
private String nextName;
}