Merge branch 'repair'

This commit is contained in:
PQZ 2024-11-13 13:44:38 +08:00
commit 11ea2f5ed5
26 changed files with 573 additions and 350 deletions

View File

@ -1,12 +1,8 @@
package cn.iocoder.yudao.module.custom.controller.admin; package cn.iocoder.yudao.module.custom.controller.admin;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO; import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO; import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
@ -23,11 +19,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.net.ssl.HttpsURLConnection;
import javax.validation.Valid; import javax.validation.Valid;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.common.BaseConstants.*; import static cn.iocoder.yudao.common.BaseConstants.*;
@ -48,7 +40,8 @@ public class CustomerMainController {
private CustomerMainService customerMainService; private CustomerMainService customerMainService;
@Resource @Resource
private BusiLabelService busiLabelService; private BusiLabelService busiLabelService;
@Resource
private CustomerCarService customerCarService;
/** /**
* 客户管理分页列表查询 * 客户管理分页列表查询
* *
@ -85,6 +78,14 @@ public class CustomerMainController {
return success(true); return success(true);
} }
@PostMapping("/saveCustomerAndCar")
@Operation(summary = "保存客户及车辆信息")
public CommonResult<Boolean> saveCustomerAndCar(@RequestBody CustomerMainSaveReqVO saveReqVO) throws Exception {
customerCarService.saveCustomerAndCar(saveReqVO);
return success(true);
}
/** /**
* 编辑客户 * 编辑客户
* *

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.custom.service; package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.module.custom.entity.CustomerCar; import cn.iocoder.yudao.module.custom.entity.CustomerCar;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
@ -23,4 +24,15 @@ public interface CustomerCarService extends IService<CustomerCar> {
* @date 18:45 2024/8/3 * @date 18:45 2024/8/3
**/ **/
void bindCustomerCar(String mainId, String mainTable, List<CustomerCar> customerCars); void bindCustomerCar(String mainId, String mainTable, List<CustomerCar> customerCars);
/**
* 保存客户及车辆信息
* @author PQZ
* @date 15:51 2024/11/12
* @param saveReqVO CustomerMainSaveReqVO
* @return void
**/
void saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception;
} }

View File

@ -1,19 +1,32 @@
package cn.iocoder.yudao.module.custom.service.impl; package cn.iocoder.yudao.module.custom.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerCar; import cn.iocoder.yudao.module.custom.entity.CustomerCar;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper; import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper;
import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.service.CustomerCarService; import cn.iocoder.yudao.module.custom.service.CustomerCarService;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CAR; import static cn.iocoder.yudao.common.BaseConstants.*;
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER; import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS;
/** /**
* 客户车辆管理关联 * 客户车辆管理关联
@ -24,6 +37,15 @@ import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER;
@Validated @Validated
public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, CustomerCar> implements CustomerCarService { public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, CustomerCar> implements CustomerCarService {
@Resource
@Lazy
private CustomerMainService customerMainService;
@Resource
@Lazy
private CarMainService carMainService;
@Resource
@Lazy
private AdminUserApi adminUserApi;
/** /**
* 保存客户与车辆的关联关系 * 保存客户与车辆的关联关系
@ -60,4 +82,66 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
} }
} }
/**
* 保存客户及车辆信息
*
* @param saveReqVO CustomerMainSaveReqVO
* @return void
* @author PQZ
* @date 15:51 2024/11/12
**/
@Override
public void saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception {
chekData(saveReqVO);
//用户信息
AdminUserRespDTO userDTO = adminUserApi.getUserByUsername(saveReqVO.getPhoneNumber());
UserDTO user = BeanUtils.toBean(userDTO, UserDTO.class);
if (null == userDTO){
user = new UserDTO();
//如果不存在创建用户
user.setUsername(saveReqVO.getPhoneNumber());
user.setNickname(saveReqVO.getCusName());
//默认密码
user.setPassword(PASSWORD_DEFAULT);
user.setMobile(saveReqVO.getPhoneNumber());
user.setUserType(USER_TYPE_CUS);
//创建客户
Long userId = adminUserApi.createUser(user);
saveReqVO.setUserId(userId);
} else {
saveReqVO.setUserId(user.getId());
}
//客户信息
CustomerMain customerMain = BeanUtils.toBean(saveReqVO,CustomerMain.class);
customerMain.setDataFrom("02");
//车辆信息
CarMain carMain = saveReqVO.getCar();
customerMainService.save(customerMain);
carMainService.save(carMain);
//关联关系
CustomerCar customerCar = new CustomerCar();
customerCar.setCusId(customerMain.getId());
customerCar.setCarId(carMain.getId());
save(customerCar);
}
private void chekData(CustomerMainSaveReqVO saveReqVO) throws Exception {
if (StringUtils.isEmpty(saveReqVO.getPhoneNumber())){
throw new Exception("联系方式不能为空");
}
if (StringUtils.isEmpty(saveReqVO.getCusName())){
throw new Exception("客户姓名不能为空");
}
if (saveReqVO.getCar() == null){
throw new Exception("车辆信息不能为空");
}
if (StringUtils.isEmpty(saveReqVO.getCar().getLicenseNumber())){
throw new Exception("车牌号不能为空");
}
if (StringUtils.isEmpty(saveReqVO.getCar().getCarBrand())){
throw new Exception("车辆品牌不能为空");
}
}
} }

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.custom.vo; package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerItem; import cn.iocoder.yudao.module.custom.entity.CustomerItem;
import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.label.entity.BusiLabel; import cn.iocoder.yudao.module.label.entity.BusiLabel;
@ -18,9 +19,6 @@ public class CustomerMainSaveReqVO extends CustomerMain {
private List<CarMainRespVO> carList; private List<CarMainRespVO> carList;
/**标签信息*/ /**标签信息*/
List<BusiLabel> labelList; List<BusiLabel> labelList;
/**客户车辆信息*/
/** private CarMain car;
* 微信openId
*/
private String openId;
} }

View File

@ -85,12 +85,10 @@
SELECT SELECT
<include refid="baseCarMainColumn"></include>, <include refid="baseCarMainColumn"></include>,
bcb.brand_name AS brandStr, bcb.brand_name AS brandStr,
bcb.logo_img AS logoImg, bcb.logo_img AS logoImg
bcm.model_name AS modelStr
FROM FROM
`base_car_main` tbcm `base_car_main` tbcm
LEFT JOIN base_car_brand bcb ON bcb.deleted = 0 AND tbcm.car_brand = bcb.id LEFT JOIN base_car_brand bcb ON bcb.deleted = 0 AND tbcm.car_brand = bcb.id
LEFT JOIN base_car_model bcm ON bcm.deleted = 0 AND tbcm.car_model = bcm.id
WHERE WHERE
tbcm.deleted = 0 tbcm.deleted = 0
AND AND

View File

@ -26,8 +26,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.BaseConstants.REPAIR_RECORD_TYPE_RECORD;
/** /**
* 维修记录 Service 实现类 * 维修记录 Service 实现类
* *
@ -106,10 +104,8 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
} else { } else {
item.setRoleName(getRoleName(userRoleMap.get(item.getDealUserId()))); item.setRoleName(getRoleName(userRoleMap.get(item.getDealUserId())));
} }
List<RepairRecordsItem> itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen());
item.setItemList(itemList);
//相对路径按照分隔 //相对路径按照分隔
item.setImages(itemList.stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(","))); item.setImages(item.getItemList().stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(",")));
}); });
return list; return list;
} }

View File

@ -242,11 +242,9 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
sois.stream().filter(i -> i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(repairSoiByTwItem -> { sois.stream().filter(i -> i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(repairSoiByTwItem -> {
if (so.getSoType().equals("02")){ if (so.getSoType().equals("02")){
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoiByTwItem.getGoodsCount()); dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoiByTwItem.getGoodsCount());
dlTwItem.setWaresCouldCount(item.getWaresCouldCount() + repairSoiByTwItem.getGoodsCount());
dlTwItem.setWaresStatus("02"); dlTwItem.setWaresStatus("02");
}else { }else {
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount()); dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount());
dlTwItem.setWaresCouldCount(item.getWaresCouldCount() - repairSoiByTwItem.getGoodsCount());
} }
}); });
newTwItems.add(dlTwItem); newTwItems.add(dlTwItem);
@ -258,9 +256,11 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
sois.stream().filter(i -> i.getGoodsId().equals(wares.getId())).findFirst().ifPresent(repairSoiByWares -> { sois.stream().filter(i -> i.getGoodsId().equals(wares.getId())).findFirst().ifPresent(repairSoiByWares -> {
if (so.getSoType().equals("02")){ if (so.getSoType().equals("02")){
wares.setStock(item.getStock().add(BigDecimal.valueOf(repairSoiByWares.getGoodsCount()))); wares.setStock(item.getStock().add(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
}else {
wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
} }
// 采购改了入库逻辑不能在这里扣库存
// else {
// wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
// }
}); });
newWares.add(wares); newWares.add(wares);
}); });

View File

@ -3,8 +3,12 @@ package cn.iocoder.yudao.module.tickets.controller.admin;
import cn.iocoder.yudao.common.RecordTypeEnum; import cn.iocoder.yudao.common.RecordTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
import cn.iocoder.yudao.module.tickets.vo.AddProjVO; import cn.iocoder.yudao.module.tickets.vo.AddProjVO;
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO;
@ -15,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -36,6 +41,8 @@ public class DlRepairTitemController {
@Resource @Resource
private DlRepairTitemService dlRepairTitemService; private DlRepairTitemService dlRepairTitemService;
@Resource @Resource
private DlRepairTicketsService dlRepairTicketsService;
@Resource
private RepairRecordsService repairRecordsService; private RepairRecordsService repairRecordsService;
/** /**
@ -84,13 +91,25 @@ public class DlRepairTitemController {
* 更新工单子表维修项目配件的单价数量折扣单项总价等 * 更新工单子表维修项目配件的单价数量折扣单项总价等
* @author vinjor-M * @author vinjor-M
* @date 16:10 2024/10/31 * @date 16:10 2024/10/31
* @param itemList 工单子表列表 * @param addProjVO 工单子表列表
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?> * @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/ **/
@PutMapping("/updateRepairItem") @PutMapping("/updateRepairItem")
@Operation(summary = "修改维修工单子表的维修人员和销售人员信息") @Operation(summary = "修改维修工单子表的维修人员和销售人员信息")
public CommonResult<?> updateRepairItem(@RequestBody List<DlRepairTitem> itemList){ public CommonResult<?> updateRepairItem(@RequestBody AddProjVO addProjVO){
dlRepairTitemService.updateRepairItem(itemList); //删除项目
if(null!=addProjVO.getDelProjIdList() && !addProjVO.getDelProjIdList().isEmpty()){
dlRepairTitemService.removeBatchByIds(addProjVO.getDelProjIdList());
//更新主表的id
DlRepairTickets repairTickets = new DlRepairTickets();
repairTickets.setId(addProjVO.getTicketId());
repairTickets.setUpdateTime(LocalDateTime.now());
dlRepairTicketsService.updateById(repairTickets);
}
if(!addProjVO.getItemList().isEmpty()){
//更新项目
dlRepairTitemService.updateRepairItem(addProjVO.getItemList());
}
return ok(); return ok();
} }
@ -129,7 +148,22 @@ public class DlRepairTitemController {
@PostMapping("/addNewProj") @PostMapping("/addNewProj")
@Operation(summary = "添加维修项目") @Operation(summary = "添加维修项目")
public CommonResult<?> addNewProj(@RequestBody AddProjVO addProjVO){ public CommonResult<?> addNewProj(@RequestBody AddProjVO addProjVO){
//获取当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
addProjVO.getItemList().forEach(item->{
if(null==item.getSaleId()){
//默认销售人员是当前用户
item.setSaleId(loginUser.getId());
item.setSaleName(loginUser.getInfo().get("nickname"));
}
});
dlRepairTitemService.saveBatch(addProjVO.getItemList()); dlRepairTitemService.saveBatch(addProjVO.getItemList());
//更新主表的更新时间
DlRepairTickets repairTickets = new DlRepairTickets();
repairTickets.setId(addProjVO.getItemList().get(0).getTicketId());
repairTickets.setUpdateTime(LocalDateTime.now());
dlRepairTicketsService.updateById(repairTickets);
List<String> projNameList = addProjVO.getItemList().stream().map(DlRepairTitem::getItemName).collect(Collectors.toList()); List<String> projNameList = addProjVO.getItemList().stream().map(DlRepairTitem::getItemName).collect(Collectors.toList());
//最后记录操作日志--创建工单 //最后记录操作日志--创建工单
String remark = "添加维修项目"+String.join(", ",projNameList )+""; String remark = "添加维修项目"+String.join(", ",projNameList )+"";
@ -163,7 +197,7 @@ public class DlRepairTitemController {
@GetMapping("/getProjList") @GetMapping("/getProjList")
@Operation(summary = "查某工单维修项目进度") @Operation(summary = "查某工单维修项目进度")
public CommonResult<?> getProjList(@RequestParam("ticketId") String ticketId){ public CommonResult<?> getProjList(@RequestParam("ticketId") String ticketId){
return success(dlRepairTitemService.getProjList(ticketId)); return success(dlRepairTitemService.getProjList(ticketId,null));
} }
} }

View File

@ -41,22 +41,5 @@ public class DlTwItemController {
public CommonResult<?> listTwItem(DlTwItemReqVO reqVO){ public CommonResult<?> listTwItem(DlTwItemReqVO reqVO){
return success(dlTwItemService.listTwItem(reqVO)); return success(dlTwItemService.listTwItem(reqVO));
} }
/**
* 配件客户是否可见
*
* @author 小李
* @date 17:55 2024/10/15
* @param reqVO 请求对象
**/
@GetMapping("/isShow")
@Operation(summary = "配件客户是否可见")
public CommonResult<?> updateIsShow(DlTwItemReqVO reqVO){
DlTwItem dlTwItem = new DlTwItem();
dlTwItem.setIsShow(reqVO.getIsShow());
dlTwItem.setId(reqVO.getId());
dlTwItemService.updateById(dlTwItem);
return CommonResult.ok();
}
} }

View File

@ -37,7 +37,7 @@ public class ApiRepairTitemController {
@Operation(summary = "查某工单维修项目进度") @Operation(summary = "查某工单维修项目进度")
@TenantIgnore @TenantIgnore
public CommonResult<?> getProjList(@RequestParam("ticketId") String ticketId){ public CommonResult<?> getProjList(@RequestParam("ticketId") String ticketId){
return success(dlRepairTitemService.getProjList(ticketId)); return success(dlRepairTitemService.getProjList(ticketId,"1"));
} }
} }

View File

@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
/** /**
* 工单配件申请/退回表 * 工单配件申请/退回表
* *
@ -17,34 +19,31 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class DlTicketWares extends TenantBaseDO { public class DlTicketWares extends TenantBaseDO {
/**
* 主键标识 /** 主键标识 */
*/
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
private String id; private String id;
/** /** 单据号(自动生成) */
* 单据号(自动生成)
*/
private String no; private String no;
/** /** 工单ID(dl_repair_tickets表的ID) */
* 工单ID(dl_repair_tickets表的ID)
*/
private String ticketId; private String ticketId;
/** /** 用户IDdl_customer_main的userId */
* 类型(01:领料02:退料ticket_wares_type) private Long userId;
*/
private String type;
/** /** 用户名称base_customer_main的cusName */
* 状态(01:待审核02已通过03:全部完成04:部分完成05:已驳回ticket_wares_status) private String userName;
*/
private String status;
/** 备注 */ /** 用户电话base_customer_main的phoneNumber */
private String remark; private String userMobile;
/** 车辆IDbase_car_main的ID */
private String carId;
/** 客户车辆的车牌号dl_repair_tickets中的carNo */
private String licenseNumber;
/** 发起人ID(dl_repair_worker的user_id) */ /** 发起人ID(dl_repair_worker的user_id) */
private Long repairId; private Long repairId;
@ -52,12 +51,18 @@ public class DlTicketWares extends TenantBaseDO {
/** 发起人name(dl_repair_worker的user_name) */ /** 发起人name(dl_repair_worker的user_name) */
private String repairName; private String repairName;
/** 申请人岗位dl_repair_worker的workType */
private String repairWork;
/** 维修顾问ID(system_users的ID) */ /** 维修顾问ID(system_users的ID) */
private Long adviserId; private Long adviserId;
/** 维修顾问namesystem_user的nickname */ /** 维修顾问namesystem_user的nickname */
private String adviserName; private String adviserName;
/** 客户车辆的车牌号dl_repair_tickets中的carNo */ /** 状态01待审批、02已审批ticket_wares_status */
private String licenseNumber; private String status;
/** 备注 */
private String remark;
} }

View File

@ -21,49 +21,35 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class DlTwItem extends TenantBaseDO { public class DlTwItem extends TenantBaseDO {
/**
* 主键标识 /** 主键标识 */
*/
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
private String id; private String id;
/** /** 主表ID(dl_ticket_wares表的ID) */
* 主表ID(dl_ticket_wares表的ID)
*/
private String twId; private String twId;
/** /** 配件ID */
* 配件ID
*/
private String waresId; private String waresId;
/** /** 配件名称 */
* 配件名称
*/
private String waresName; private String waresName;
/** /** 配件数量 */
* 配件数量
*/
private Integer waresCount; private Integer waresCount;
/** /** 已领取数量 */
* 配件状态(01:已领料02:未领料03已退料,04可确认领料可确认退料 tw_item_status) private Integer waresAlreadyCount;
*/
/** 配件状态:使用字典yes_no1通过0没通过 */
private String waresStatus; private String waresStatus;
/** 审核人IDsystem_users的ID */
private Long handleId;
/** 审核人姓名system_users的nickname */
private String handleName;
/** 备注 */ /** 备注 */
private String remark; private String remark;
/** 客户是否可见(字典yes_no);已存在于系统中(是:1,否:0) */
private String isShow;
/** 可领取数量 */
private Integer waresCouldCount;
/** 已领料数量 */
private Integer waresAlreadyCount;
/** 已退数量 */
private Integer waresBackCount;
} }

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 针对表dl_repair_titem(维修工单子表)的数据库操作Mapper * 针对表dl_repair_titem(维修工单子表)的数据库操作Mapper
* *
@ -31,6 +33,15 @@ public interface DlRepairTitemMapper extends BaseMapper<DlRepairTitem> {
* @param dlRepairTitem * @param dlRepairTitem
*/ */
void updateRepairAndSale(DlRepairTitem dlRepairTitem); void updateRepairAndSale(DlRepairTitem dlRepairTitem);
/**
* 查某工单维修项目进度
* @author vinjor-M
* @date 15:33 2024/11/12
* @param ticketId 工单id
* @return java.util.List<cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO>
**/
List<DlRepairTitemRespVO> selectProjList(@Param("ticketId")String ticketId,@Param("isOpen")String isOpen);
} }

View File

@ -82,5 +82,5 @@ public interface DlRepairTitemService extends IService<DlRepairTitem> {
* @param ticketId 工单ID * @param ticketId 工单ID
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlRepairTitem> * @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlRepairTitem>
**/ **/
List<DlRepairTitem> getProjList(String ticketId); List<DlRepairTitemRespVO> getProjList(String ticketId,String isOpen);
} }

View File

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.*; import cn.iocoder.yudao.common.*;
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairRecordsService;
@ -248,9 +249,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 新增主表 // 新增主表
baseMapper.insert(ticketsRespVO); baseMapper.insert(ticketsRespVO);
//获取当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// 新增子表 // 新增子表
itemList.forEach(item -> { itemList.forEach(item -> {
item.setTicketId(ticketsRespVO.getId()); item.setTicketId(ticketsRespVO.getId());
if(null==item.getSaleId()){
//默认销售人员是当前用户
item.setSaleId(loginUser.getId());
item.setSaleName(loginUser.getInfo().get("nickname"));
}
if ("01".equals(item.getItemType())) { if ("01".equals(item.getItemType())) {
//维修项目,初始状态待派工 //维修项目,初始状态待派工
item.setItemStatus(TicketsItemStatusEnum.WAITING_WORK.getCode()); item.setItemStatus(TicketsItemStatusEnum.WAITING_WORK.getCode());
@ -343,7 +351,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
} }
//查用户信息 //查用户信息
CustomerMain customerInfo = customerService.getCustomerById(dlRepairTickets.getUserId()); CustomerMain customerInfo = customerService.getById(dlRepairTickets.getUserId());
result.setCustomerInfo(customerInfo); result.setCustomerInfo(customerInfo);
// 查工单子表 // 查工单子表
List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id)); List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));
@ -849,8 +857,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId())); repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
} }
} else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) { } else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
//服务顾问 //服务顾问暂时看所有的工单
repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId())); // repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) { } else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
//维修工进一步判断是否是班组长 //维修工进一步判断是否是班组长
boolean ifLeader = repairWorkerService.getIfLeader(); boolean ifLeader = repairWorkerService.getIfLeader();
@ -1245,20 +1253,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
**/ **/
@Override @Override
public boolean syncTicketWaresToTicket(String id) { public boolean syncTicketWaresToTicket(String id) {
// 先查满足条件的申请表 // 先查满足条件的申请表---配件申请表现在只有待审批和已审批并且其子表的数据也可能同时有两种情况
ArrayList<String> status = new ArrayList<>(); // ArrayList<String> status = new ArrayList<>();
status.add("01"); // 待审核 // status.add("01"); // 待审核
status.add("05"); // 已驳回 // status.add("05"); // 已驳回
// 查工单所有已通过的配件申请单 // 查工单所有已通过的配件申请单----这里直接查全部
List<DlTicketWares> list = ticketWaresService.list(new LambdaQueryWrapper<DlTicketWares>().and(item -> { List<DlTicketWares> list = ticketWaresService.list(new LambdaQueryWrapper<DlTicketWares>().and(item -> {
item.eq(DlTicketWares::getTicketId, id) item.eq(DlTicketWares::getTicketId, id);
.notIn(DlTicketWares::getStatus, status); // .notIn(DlTicketWares::getStatus, status);
})); }));
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
// 查配件申请表的所有已领取数量小于申请数量的子表信息 // 查配件申请表的所有已领取数量小于申请数量的子表信息----这里需要加上一个条件得是审核通过的才行
List<String> ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList()); List<String> ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList());
List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> { List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
item.in(DlTwItem::getTwId, ids) item.in(DlTwItem::getTwId, ids)
.eq(DlTwItem::getWaresStatus, "1")
.apply("wares_already_count < wares_count"); .apply("wares_already_count < wares_count");
})); }));
if (CollectionUtil.isNotEmpty(twItems)) { if (CollectionUtil.isNotEmpty(twItems)) {

View File

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -31,6 +32,8 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
@Resource @Resource
private DlRepairTicketsService repairTicketsService; private DlRepairTicketsService repairTicketsService;
@Autowired
private DlRepairTitemMapper dlRepairTitemMapper;
/** /**
* 维修工单子表 分页 * 维修工单子表 分页
@ -152,12 +155,8 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
* @date 10:58 2024/11/5 * @date 10:58 2024/11/5
**/ **/
@Override @Override
public List<DlRepairTitem> getProjList(String ticketId) { public List<DlRepairTitemRespVO> getProjList(String ticketId,String isOpen) {
LambdaQueryWrapper<DlRepairTitem> queryWrapper = new LambdaQueryWrapper<DlRepairTitem>() return dlRepairTitemMapper.selectProjList(ticketId,isOpen);
.eq(DlRepairTitem::getTicketId,ticketId)
.eq(DlRepairTitem::getItemType,"01")
.orderByDesc(DlRepairTitem::getItemStatus);
return this.list(queryWrapper);
} }
} }

View File

@ -1,16 +1,17 @@
package cn.iocoder.yudao.module.tickets.service.impl; package cn.iocoder.yudao.module.tickets.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.RecordTypeEnum; import cn.iocoder.yudao.common.RecordTypeEnum;
import cn.iocoder.yudao.common.RepairRoleEnum; import cn.iocoder.yudao.common.RepairRoleEnum;
import cn.iocoder.yudao.common.SoStatusEnum; import cn.iocoder.yudao.common.SoStatusEnum;
import cn.iocoder.yudao.common.TicketsItemStatusEnum;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.service.RepairWorkerService; import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.project.entity.RepairWares; import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.service.RepairWaresService; import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi; import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
@ -43,7 +44,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
@ -99,6 +99,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Resource @Resource
private RepairRecordsService repairRecordsService; private RepairRecordsService repairRecordsService;
@Resource
private CustomerMainService customerMainService;
/** /**
* 分页查询 * 分页查询
* *
@ -113,8 +116,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode()) || userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) { if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode()) || userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
//维修管理员和总检看所有数据 //维修管理员和总检看所有数据
} else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) { } else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
//服务顾问 //服务顾问--暂时看所有的配件申请单
reqVO.setAdviserId(SecurityFrameworkUtils.getLoginUserId()); // reqVO.setAdviserId(SecurityFrameworkUtils.getLoginUserId());
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) { } else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
//维修工进一步判断是否是班组长 //维修工进一步判断是否是班组长
boolean ifLeader = repairWorkerService.getIfLeader(); boolean ifLeader = repairWorkerService.getIfLeader();
@ -132,7 +135,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
} }
} else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) { } else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
// 维修仓库管理员 // 维修仓库管理员
reqVO.setStatus(null);
reqVO.setUserRole(5); reqVO.setUserRole(5);
} else { } else {
return null; return null;
@ -175,14 +177,41 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Override @Override
@DSTransactional @DSTransactional
public void updateTicketWares(DlTicketWaresRespVO respVO) { public void updateTicketWares(DlTicketWaresRespVO respVO) {
// 新增修改主表 // 新增修改主表
// 查询操作人的工人信息 DlTicketWares ticketWares = BeanUtil.toBean(respVO, DlTicketWares.class);
RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId())); /*
respVO.setRepairId(one.getUserId()); 设置信息
respVO.setRepairName(one.getUserName()); */
baseMapper.insertOrUpdate(respVO); // 用户信息
DlRepairTickets tickets = repairTicketsService.getById(ticketWares.getTicketId());
CustomerMain customerMain = customerMainService.getById(tickets.getUserId());
ticketWares.setUserId(customerMain.getUserId());
ticketWares.setUserName(customerMain.getCusName());
ticketWares.setUserMobile(customerMain.getPhoneNumber());
// 车辆信息
ticketWares.setCarId(tickets.getCarId());
ticketWares.setLicenseNumber(tickets.getCarNo());
// 发起人信息
RepairWorker worker = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
ticketWares.setRepairId(worker.getUserId());
ticketWares.setRepairName(worker.getUserName());
ticketWares.setRepairWork(worker.getWorkType());
// 服务顾问信息
ticketWares.setAdviserId(Long.valueOf(tickets.getAdviserId()));
ticketWares.setAdviserName(tickets.getAdviserName());
baseMapper.insertOrUpdate(ticketWares);
// 新增修改子表 // 新增修改子表
List<DlTwItem> list = respVO.getItems().stream().map(item -> item.setTwId(respVO.getId())).collect(Collectors.toList()); List<DlTwItem> list = respVO.getItems().stream()
.map(item -> {
DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class);
twItem.setTwId(ticketWares.getId());
twItem.setWaresStatus("");
twItem.setWaresAlreadyCount(0);
return twItem;
}).collect(Collectors.toList());
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
throw exception0(500, "配件列表为空"); throw exception0(500, "配件列表为空");
} }
@ -190,7 +219,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 通知对应的维修服务顾问和总检 // 通知对应的维修服务顾问和总检
// 维修服务顾问即创建工单时选的是谁 // 维修服务顾问即创建工单时选的是谁
DlRepairTickets tickets = repairTicketsService.getById(respVO.getTicketId());
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的配件申请单需要审核"); repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的配件申请单需要审核");
// 总检查角色包含总检的员工 // 总检查角色包含总检的员工
// 取这个角色的角色信息 // 取这个角色的角色信息
@ -229,117 +257,87 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Override @Override
@DSTransactional @DSTransactional
public void auditTicketWares(DlTicketWaresRespVO respVO) { public void auditTicketWares(DlTicketWaresRespVO respVO) {
// 设置单据状态 // 取出前端传的单据状态这里是前端传的只有两个01通过02驳回
//配件申请单id
String mainId = respVO.getId();
//单据类型现在只有配件申请单 01
String type = respVO.getType();
//单据状态 02 通过 05驳回
String status = respVO.getStatus(); String status = respVO.getStatus();
//配件信息 // 取出前端操作的配件申请表的子项id
List<DlRepairTitem> repairItemList = respVO.getWares(); List<String> twItemIds = respVO.getItems().stream().map(DlTwItem::getId).collect(Collectors.toList());
DlTicketWares updateObj = this.getById(mainId); // 查所有的子项
String ticketMainId = updateObj.getTicketId(); List<DlTwItem> twItems = twItemService.listByIds(twItemIds);
updateObj.setStatus(status); // 取所有的配件信息
this.updateById(updateObj); List<String> wareIds = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
// 如果是通过并且是领料就还需要把配件信息加入到工单中 List<RepairWares> repairWares = repairWaresService.listByIds(wareIds);
if (ObjectUtil.isNotEmpty(status) && status.equals("02") && type.equals("01")) { // 更新配件申请表子表
// 更新维修工单 List<DlTwItem> newTwitems = twItemIds.stream().map(item -> {
if(null!=respVO.getRepairWaresList()){ DlTwItem twItem = new DlTwItem();
repairItemList= new ArrayList<>(); twItem.setId(item);
//走的是更新配件库价格 twItem.setWaresStatus(status.equals("01") ? "1" : "0");
Map<String,BigDecimal> updateMap = respVO.getRepairWaresList().stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getPrice)); twItem.setHandleId(SecurityFrameworkUtils.getLoginUserId());
//更新配件库的价格 twItem.setHandleName(SecurityFrameworkUtils.getLoginUserNickname());
List<RepairWares> updateWaresList = new ArrayList<>(); return twItem;
//去库里面查需要的配件
LambdaQueryWrapper<DlTwItem> queryWrapper = new LambdaQueryWrapper<DlTwItem>()
.eq(DlTwItem::getTwId, mainId);
List<DlTwItem> applyList = twItemService.list(queryWrapper);
if (!applyList.isEmpty()) {
//查配件库
List<RepairWares> waresList = repairWaresService.listByIds(applyList.stream().map(DlTwItem::getWaresId).collect(Collectors.toList()));
Map<String, RepairWares> waresMap = waresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity()));
//组装工单子表数据
for (DlTwItem item : applyList) {
DlRepairTitem repairTitem = new DlRepairTitem();
repairTitem.setTicketId(ticketMainId);
repairTitem.setItemCount(item.getWaresCount());
repairTitem.setItemName(item.getWaresName());
repairTitem.setItemUnit(waresMap.get(item.getWaresId()).getUnit());
//取前端传过来的销售价格
repairTitem.setItemPrice(updateMap.get(item.getId()));
//默认不打折为1
repairTitem.setItemDiscount(new BigDecimal(1));
repairTitem.setItemMoney(new BigDecimal(repairTitem.getItemCount()).multiply(repairTitem.getItemPrice()));
//类型是配件
repairTitem.setItemType("02");
repairTitem.setPartId(item.getWaresId());
repairTitem.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode());
repairItemList.add(repairTitem);
//组装配件库更新价格
RepairWares update = new RepairWares();
update.setId(item.getWaresId());
update.setPrice(updateMap.get(item.getId()));
updateWaresList.add(update);
}
}
if(!updateWaresList.isEmpty()){
repairWaresService.updateBatchById(updateWaresList);
}
}
// 更新维修工单子表----需要合并相同的配件故修改
// 先查维修工单的子表中的配件相关的信息
List<DlRepairTitem> oldTitem = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> i.eq(DlRepairTitem::getTicketId, ticketMainId).eq(DlRepairTitem::getItemType, "02")));
// 过滤出新申请的配件里面有没有已经存在于工单子表的
List<String> waresIds = oldTitem.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList());
List<DlRepairTitem> already = repairItemList.stream().filter(item -> waresIds.contains(item.getPartId())).collect(Collectors.toList());
// 更新已经存在的配件
if (CollectionUtil.isNotEmpty(already)) {
List<DlRepairTitem> updateItems = new ArrayList<>();
already.forEach(item -> {
DlRepairTitem titem = oldTitem.stream().filter(i -> i.getPartId().equals(item.getPartId())).findFirst().orElse(null);
if (titem != null) {
DlRepairTitem newItem = new DlRepairTitem();
newItem.setId(titem.getId());
newItem.setItemCount(titem.getItemCount() + item.getItemCount());
// 如果设置了折扣就用没有就是1
BigDecimal itemDiscount = titem.getItemDiscount() == null ? new BigDecimal(1) : titem.getItemDiscount();
// titem取价格newItem取数量
newItem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(newItem.getItemCount())).multiply(itemDiscount));
updateItems.add(newItem);
}
});
if (CollectionUtil.isNotEmpty(updateItems)) {
repairTitemService.updateBatchById(updateItems);
}
}
// 新增维修工单中没有的配件
List<DlRepairTitem> newItems = repairItemList.stream().filter(item -> !waresIds.contains(item.getPartId())).collect(Collectors.toList());
newItems.forEach(item -> {
// 主表id
item.setTicketId(ticketMainId);
// 类型为配件
item.setItemType("02");
// 状态为未领料
item.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode());
});
repairTitemService.saveBatch(newItems);
// 重新计算工单
boolean flag = repairTicketsService.computeTicket(ticketMainId);
if (!flag) {
throw exception0(500, "系统异常");
}
// 更新仓库
if (CollectionUtil.isNotEmpty(repairItemList)){
List<RepairWares> updateWares = repairItemList.stream().map(item -> {
RepairWares wares = new RepairWares();
wares.setId(item.getPartId());
wares.setPrice(item.getItemPrice());
return wares;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
repairWaresService.updateBatchById(updateWares); twItemService.updateBatchById(newTwitems);
// 更新配件申请主表
List<DlTwItem> allTwitems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().in(DlTwItem::getTwId, respVO.getId()));
List<DlTwItem> passTwitems = allTwitems.stream().filter(item -> item.getWaresStatus().equals("1") || item.getWaresStatus().equals("0")).collect(Collectors.toList());
boolean isStatus = CollectionUtil.isNotEmpty(passTwitems) && passTwitems.size() == allTwitems.size();
if (isStatus) {
baseMapper.update(new LambdaUpdateWrapper<DlTicketWares>().set(DlTicketWares::getStatus, "02").eq(DlTicketWares::getId, respVO.getId()));
}
// 更新维修工单子表
if (status.equals("01")) {
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
List<DlRepairTitem> titems = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> {
i.in(DlRepairTitem::getTicketId, ticketWares.getTicketId())
.eq(DlRepairTitem::getItemType, "02");
}));
// 要修改的
List<DlRepairTitem> updateTitems = titems.stream().filter(item -> wareIds.contains(item.getPartId())).collect(Collectors.toList());
// 修改
if (CollectionUtil.isNotEmpty(updateTitems)) {
List<DlRepairTitem> newTitems = updateTitems.stream().map(item -> {
DlRepairTitem titem = new DlRepairTitem();
titem.setId(item.getId());
DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).findFirst().orElse(null);
if (twItem != null) {
titem.setItemCount(item.getItemCount() + twItem.getWaresCount());
titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(item.getItemDiscount()));
}
return titem;
}).collect(Collectors.toList());
repairTitemService.updateBatchById(newTitems);
}
// 要新增的
if (updateTitems.size() < wareIds.size()) {
List<String> titemIds = updateTitems.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList());
List<RepairWares> newWares = repairWares.stream().filter(item -> !titemIds.contains(item.getId())).collect(Collectors.toList());
// 新增
List<DlRepairTitem> newTitems = newWares.stream().map(item -> {
DlRepairTitem titem = new DlRepairTitem();
titem.setTicketId(ticketWares.getTicketId());
titem.setItemType("02");
titem.setItemName(item.getName());
DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null);
titem.setItemCount(twItem != null ? twItem.getWaresCount() : 0);
titem.setItemUnit(item.getUnit());
titem.setItemPrice(item.getPrice() != null ? item.getPrice() : BigDecimal.ZERO);
titem.setItemDiscount(BigDecimal.ONE);
titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount()));
titem.setRepairIds(String.valueOf(ticketWares.getRepairId()));
titem.setRepairNames(ticketWares.getRepairName());
titem.setSaleId(ticketWares.getAdviserId());
titem.setSaleName(ticketWares.getAdviserName());
titem.setPartId(item.getId());
titem.setItemStatus("04");
titem.setRemark(twItem != null ? twItem.getRemark() : null);
return titem;
}).collect(Collectors.toList());
repairTitemService.saveBatch(newTitems);
}
// 更新维修工单主表
boolean flag = repairTicketsService.computeTicket(ticketWares.getTicketId());
if (!flag) {
throw exception0(500, "重新计算工单错误");
} }
// 发送通过的消息给仓库 // 发送通过的消息给仓库
@ -349,12 +347,10 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理")); ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理"));
} }
} }
// 如果是驳回通知维修工 // 通知维修工
if (status.equals("05")) {
// 发送没有通过的消息给员工
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId()); DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
repairWorkerService.sentMessage(ticketWares.getRepairId(), "的配件申请单被驳回了"); repairWorkerService.sentMessage(ticketWares.getRepairId(), "您有新的配件申请单" + (status.equals("01") ? "审批通过了" : "被驳回了"));
}
//插入记录 //插入记录
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, RecordTypeEnum.SPPJSQD.getCode(), "审批配件申请单", null); repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, RecordTypeEnum.SPPJSQD.getCode(), "审批配件申请单", null);
} }
@ -443,12 +439,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
Integer waresAlreadyCount = item.getWaresAlreadyCount() == null ? 0 : item.getWaresAlreadyCount(); Integer waresAlreadyCount = item.getWaresAlreadyCount() == null ? 0 : item.getWaresAlreadyCount();
// 取本来的已领取数量+本次要领取的数量 // 取本来的已领取数量+本次要领取的数量
dlTwItem.setWaresAlreadyCount(repairSoi.getGoodsCount() + waresAlreadyCount); dlTwItem.setWaresAlreadyCount(repairSoi.getGoodsCount() + waresAlreadyCount);
// 可领取数量就是申请数量-已领料数量 // 如果已领取数量等于申请数量那这个配件就是领料完了为01已领料反之不变----这里不变了
// item是操作的申请配件的数量dlTwItem取最新的已领取数量 // dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "01" : item.getWaresStatus());
dlTwItem.setWaresCouldCount(item.getWaresCount() - dlTwItem.getWaresAlreadyCount());
// dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
// 如果已领取数量等于申请数量那这个配件就是领料完了为01已领料反之不变
dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "01" : item.getWaresStatus());
}); });
return dlTwItem; return dlTwItem;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -475,12 +467,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
.ifPresent(repairSoi -> { .ifPresent(repairSoi -> {
// 取本来的已领取数量-本次要退料的数量 // 取本来的已领取数量-本次要退料的数量
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoi.getGoodsCount()); dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoi.getGoodsCount());
// 可领取数量就是上次的可领取+退料数量
// item是操作的可领取数量repairSoi是取本次退料的数量
dlTwItem.setWaresCouldCount(item.getWaresCouldCount() + repairSoi.getGoodsCount());
// dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus()); // dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
// 如果可领料数量等于申请数量那这个配件就是退料完了为03已退料反之不变 // 如果可领料数量等于申请数量那这个配件就是退料完了为03已退料反之不变---这里也不变了
dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresCouldCount()) ? "03" : "02"); // dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "1" : "0");
}); });
return dlTwItem; return dlTwItem;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -537,21 +526,21 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Override @Override
@DSTransactional @DSTransactional
public void repairPassTicketWares(DlTicketWaresRespVO respVO) { public void repairPassTicketWares(DlTicketWaresRespVO respVO) {
// 更新领料申请子表 // // 更新领料申请子表
twItemService.updateBatchById(respVO.getItems()); // twItemService.updateBatchById(respVO.getItems());
// 更新领料申请表 // // 更新领料申请表
// 判断是全部完成完成部分完成 // // 判断是全部完成完成部分完成
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, respVO.getId())); // List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, respVO.getId()));
List<DlTwItem> list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList()); // List<DlTwItem> list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList());
respVO.setStatus(list1.size() == list.size() ? "03" : "04"); // respVO.setStatus(list1.size() == list.size() ? "03" : "04");
baseMapper.updateById(respVO); // baseMapper.updateById(respVO);
// 操作库存 // // 操作库存
list.forEach(item -> { // list.forEach(item -> {
repairWaresService.update(new LambdaUpdateWrapper<RepairWares>() // repairWaresService.update(new LambdaUpdateWrapper<RepairWares>()
.setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount()) // .setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount())
.eq(RepairWares::getId, item.getWaresId()) // .eq(RepairWares::getId, item.getWaresId())
); // );
}); // });
} }
/** /**
@ -601,8 +590,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
public Map<String, Integer> getWorkerTodo() { public Map<String, Integer> getWorkerTodo() {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
LambdaQueryWrapper<DlTicketWares> queryWrapper = new LambdaQueryWrapper<DlTicketWares>() LambdaQueryWrapper<DlTicketWares> queryWrapper = new LambdaQueryWrapper<DlTicketWares>()
.eq(DlTicketWares::getRepairId, loginUser.getId()) .eq(DlTicketWares::getRepairId, loginUser.getId());
.eq(DlTicketWares::getType, "01");
List<DlTicketWares> list = this.list(queryWrapper); List<DlTicketWares> list = this.list(queryWrapper);
Map<String, Integer> rtnMap = new HashMap<>(); Map<String, Integer> rtnMap = new HashMap<>();
//所有提交的 //所有提交的

View File

@ -16,6 +16,10 @@ public class AddProjVO {
private List<DlRepairTitem> itemList; private List<DlRepairTitem> itemList;
/** 签字图片相对路径 */ /** 签字图片相对路径 */
private String image; private String image;
/** 要删除的项目id */
private List<String> delProjIdList;
/** 备注内容 */ /** 备注内容 */
private String remark; private String remark;
/** 工单id */
private String ticketId;
} }

View File

@ -1,9 +1,11 @@
package cn.iocoder.yudao.module.tickets.vo; package cn.iocoder.yudao.module.tickets.vo;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 维修工单子表 响应VO * 维修工单子表 响应VO
@ -24,4 +26,9 @@ public class DlRepairTitemRespVO extends DlRepairTitem {
private String corpId; private String corpId;
private String ticketNo; private String ticketNo;
/**
* 维修项目的维修过程图片
**/
private List<RepairRecordsItem> recordsItemList;
} }

View File

@ -23,7 +23,7 @@ public class DlTicketWaresReqVO extends DlTicketWares {
/** 角色 */ /** 角色 */
private Integer userRole; private Integer userRole;
/** 查看可以退料的数据时为tru */ /** 查看可以退料的数据时为true */
private Boolean isBack; private Boolean isBack;
/** 查看待审核的数据时为true */ /** 查看待审核的数据时为true */

View File

@ -8,14 +8,43 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/ 文档可见https://www.iocoder.cn/MyBatis/x-plugins/
--> -->
<resultMap id="baseResultMap" type="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO">
<select id="queryRepairRecords" resultType="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO"> <id column="id" property="id"/>
<result column="ticket_id" property="ticketId"/>
<result column="repair_item_id" property="repairItemId"/>
<result column="type" property="type"/>
<result column="remark" property="remark"/>
<result column="deal_user_name" property="dealUserName"/>
<result column="deal_user_id" property="dealUserId"/>
<result column="creator" property="creator"/>
<result column="create_time" property="createTime"/>
<collection property="itemList" ofType="cn.iocoder.yudao.module.base.entity.RepairRecordsItem" columnPrefix="item_">
<id column="id" property="id"/>
<result column="record_id" property="recordId"/>
<result column="ticket_id" property="ticketId"/>
<result column="repair_item_id" property="repairItemId"/>
<result column="remark" property="remark"/>
<result column="image" property="image"/>
<result column="is_open" property="isOpen"/>
<result column="create_time" property="createTime"/>
</collection>
</resultMap>
<select id="queryRepairRecords" resultMap="baseResultMap">
SELECT main.*, SELECT main.*,
drt.item_name AS projectName drt.item_name AS projectName,
drri.id AS item_id,
drri.record_id AS item_record_id,
drri.ticket_id AS item_ticket_id,
drri.repair_item_id AS item_repair_item_id,
drri.remark AS item_remark,
drri.image AS item_image,
drri.is_open AS item_is_open,
drri.create_time AS item_create_time
FROM dl_repair_records main FROM dl_repair_records main
LEFT JOIN dl_repair_titem drt ON main.repair_item_id = drt.id AND drt.deleted = 0 LEFT JOIN dl_repair_titem drt ON main.repair_item_id = drt.id AND drt.deleted = 0
LEFT JOIN dl_repair_records_item drri ON main.id = drri.record_id
<where> <where>
main.deleted = '0' main.deleted = '0' AND drri.deleted = '0'
<if test="entity.ticketId != null and entity.ticketId != ''"> <if test="entity.ticketId != null and entity.ticketId != ''">
AND main.ticket_id = #{entity.ticketId} AND main.ticket_id = #{entity.ticketId}
</if> </if>
@ -28,8 +57,11 @@
<if test="entity.type != null and entity.type != ''"> <if test="entity.type != null and entity.type != ''">
AND main.type = #{entity.type} AND main.type = #{entity.type}
</if> </if>
<if test="entity.isOpen != null and entity.isOpen != ''">
AND drri.is_open = #{entity.type}
</if>
</where> </where>
order by main.create_time desc order by main.create_time desc,drri.create_time
</select> </select>
<select id="selectNowRepairByTicketId" resultType="java.util.Map"> <select id="selectNowRepairByTicketId" resultType="java.util.Map">
SELECT SELECT

View File

@ -274,7 +274,7 @@
</otherwise> </otherwise>
</choose> </choose>
GROUP BY drt.id GROUP BY drt.id
order by drt.create_time desc order by drt.update_time desc
</select> </select>
<select id="selectItemList" resultType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem"> <select id="selectItemList" resultType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
@ -336,6 +336,6 @@
) )
</if> </if>
GROUP BY drt.id GROUP BY drt.id
order by drt.create_time desc order by drt.update_time desc
</select> </select>
</mapper> </mapper>

View File

@ -3,6 +3,32 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlRepairTitemMapper"> <mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlRepairTitemMapper">
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result column="ticket_id" property="ticketId"/>
<result column="item_name" property="itemName"/>
<result column="item_count" property="itemCount"/>
<result column="item_unit" property="itemUnit"/>
<result column="item_price" property="itemPrice"/>
<result column="item_discount" property="itemDiscount"/>
<result column="item_money" property="itemMoney"/>
<result column="project_id" property="projectId"/>
<result column="item_status" property="itemStatus"/>
<result column="remark" property="remark"/>
<result column="update_time" property="updateTime"/>
<result column="create_time" property="createTime"/>
<collection property="recordsItemList" ofType="cn.iocoder.yudao.module.base.entity.RepairRecordsItem"
columnPrefix="item_">
<id column="id" property="id"/>
<result column="record_id" property="recordId"/>
<result column="ticket_id" property="ticketId"/>
<result column="repair_item_id" property="repairItemId"/>
<result column="remark" property="remark"/>
<result column="image" property="image"/>
<result column="is_open" property="isOpen"/>
<result column="create_time" property="createTime"/>
</collection>
</resultMap>
<update id="updateRepairAndSale" parameterType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem"> <update id="updateRepairAndSale" parameterType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
UPDATE dl_repair_titem UPDATE dl_repair_titem
<set> <set>
@ -56,4 +82,31 @@
FROM dl_repair_titem drti FROM dl_repair_titem drti
LEFT JOIN dl_repair_tickets drt ON drti.ticket_id = drt.id LEFT JOIN dl_repair_tickets drt ON drti.ticket_id = drt.id
</select> </select>
<select id="selectProjList" resultMap="BaseResultMap">
SELECT
drt.* ,
drri.id AS item_id,
drri.record_id AS item_record_id,
drri.ticket_id AS item_ticket_id,
drri.repair_item_id AS item_repair_item_id,
drri.remark AS item_remark,
drri.image AS item_image,
drri.is_open AS item_is_open,
drri.create_time AS item_create_time
FROM
dl_repair_titem drt
LEFT JOIN dl_repair_records_item drri ON drt.id = drri.repair_item_id
AND drri.deleted = '0'
WHERE
drt.deleted = 0
AND drt.item_type = '01'
AND drt.ticket_id = #{ticketId}
<if test="isOpen!=null and isOpen!=''">
AND drri.is_open = #{isOpen}
</if>
ORDER BY
drt.item_status DESC,
drt.update_time,
drri.create_time
</select>
</mapper> </mapper>

View File

@ -5,30 +5,42 @@
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlTicketWaresMapper"> <mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlTicketWaresMapper">
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTicketWares"> <resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTicketWares">
<id property="id" column="id" jdbcType="VARCHAR"/> <result property="id" column="id" jdbcType="VARCHAR"/>
<result property="no" column="no" jdbcType="VARCHAR"/> <result property="no" column="no" jdbcType="VARCHAR"/>
<result property="ticketId" column="ticket_id" jdbcType="VARCHAR"/> <result property="ticketId" column="ticket_id" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/> <result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="userMobile" column="user_mobile" jdbcType="VARCHAR"/>
<result property="carId" column="car_id" jdbcType="VARCHAR"/>
<result property="licenseNumber" column="license_number" jdbcType="VARCHAR"/>
<result property="repairId" column="repair_id" jdbcType="INTEGER"/>
<result property="repairName" column="repair_name" jdbcType="VARCHAR"/>
<result property="repairWork" column="repair_work" jdbcType="VARCHAR"/>
<result property="adviserId" column="adviser_id" jdbcType="INTEGER"/>
<result property="adviserName" column="adviser_name" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/> <result property="status" column="status" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/> <result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="repairId" column="repair_id" />
<result property="repairName" column="repair_name" />
<result property="adviserId" column="adviser_id" />
<result property="adviserName" column="adviser_name" />
<result property="licenseNumber" column="license_number" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
</resultMap> </resultMap>
<sql id="Base_SQL"> <sql id="Base_SQL">
select select
dtw.id as id,no,ticket_id, dtw.id,
type,status,dtw.remark as remark, dtw.no,
dtw.repair_id as repair_id, dtw.ticket_id,
dtw.repair_name as repair_name, dtw.user_id,
dtw.adviser_id as adviser_id, dtw.user_name,
dtw.adviser_name as adviser_name, dtw.user_mobile,
dtw.license_number as license_number, dtw.car_id,
dtw.create_time as create_time dtw.license_number,
dtw.repair_id,
dtw.repair_name,
dtw.repair_work,
dtw.adviser_id,
dtw.adviser_name,
dtw.status,
dtw.remark,
dtw.create_time
from dl_ticket_wares dtw from dl_ticket_wares dtw
left join dl_repair_tickets drt left join dl_repair_tickets drt
on dtw.ticket_id = drt.id on dtw.ticket_id = drt.id
@ -46,8 +58,14 @@
dtw.license_number like concat('%', #{map.query}, '%') dtw.license_number like concat('%', #{map.query}, '%')
) )
</if> </if>
<if test="map.type != null and map.type != ''"> <if test="map.licenseNumber != null and map.licenseNumber != ''">
and (dtw.type = #{map.type}) and dtw.license_number like concat('%', #{map.licenseNumber}, '%')
</if>
<if test="map.userMobile != null and map.userMobile != ''">
and dtw.user_mobile like concat('%', #{map.userMobile}, '%')
</if>
<if test="map.repairName != null and map.repairName != ''">
and dtw.repair_name like concat('%', #{map.repairName}, '%')
</if> </if>
<if test="map.status != null and map.status != ''"> <if test="map.status != null and map.status != ''">
and (dtw.status = #{map.status}) and (dtw.status = #{map.status})
@ -61,16 +79,14 @@
) )
</if> </if>
<if test="map.userRole != null"> <if test="map.userRole != null">
and ( and exists (
select 1 from dl_tw_item dti where dti.tw_id = dtw.id and dti.deleted = '0'
<choose> <choose>
<when test="map.userRole == 5 and map.isToBeReviewed"> <when test="map.userRole == 5 and map.isBack == false">
dtw.status = '01' and (dti.wares_count > dti.wares_already_count and dti.wares_status = '1')
</when> </when>
<when test="map.userRole == 5 and map.isBack == null"> <when test="map.userRole == 5 and map.isBack == true">
dtw.status not in ('01', '05', '03') and (dti.wares_already_count > 0 and dti.wares_status = '1')
</when>
<when test="map.userRole == 5 and map.isBack">
dtw.status in ('03', '04')
</when> </when>
</choose> </choose>
) )

View File

@ -5,24 +5,30 @@
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper"> <mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper">
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTwItem"> <resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTwItem">
<id property="id" column="id" jdbcType="VARCHAR"/> <result property="id" column="id" jdbcType="VARCHAR"/>
<result property="twId" column="tw_id" jdbcType="VARCHAR"/> <result property="twId" column="tw_id" jdbcType="VARCHAR"/>
<result property="waresId" column="wares_id" jdbcType="VARCHAR"/> <result property="waresId" column="wares_id" jdbcType="VARCHAR"/>
<result property="waresName" column="wares_name" jdbcType="VARCHAR"/> <result property="waresName" column="wares_name" jdbcType="VARCHAR"/>
<result property="waresCount" column="wares_count" jdbcType="INTEGER"/> <result property="waresCount" column="wares_count" jdbcType="INTEGER"/>
<result property="waresAlreadyCount" column="wares_already_count" jdbcType="INTEGER"/>
<result property="waresStatus" column="wares_status" jdbcType="VARCHAR"/> <result property="waresStatus" column="wares_status" jdbcType="VARCHAR"/>
<result property="handleId" column="handle_id" jdbcType="INTEGER"/>
<result property="handleName" column="handle_name" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/> <result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="isShow" column="is_show" />
<result property="waresCouldCount" column="wares_could_count" />
<result property="waresAlreadyCount" column="wares_already_count" />
<result property="waresBackCount" column="wares_back_count" />
</resultMap> </resultMap>
<sql id="Base_SQL"> <sql id="Base_SQL">
select select
id,tw_id,wares_id, id,
wares_name,wares_count,wares_status,remark, tw_id,
is_show,wares_could_count, wares_already_count, wares_back_count wares_id,
wares_name,
wares_count,
wares_already_count,
wares_status,
handle_id,
handle_name,
remark
from dl_tw_item dti from dl_tw_item dti
where dti.deleted = '0' where dti.deleted = '0'
</sql> </sql>

View File

@ -47,6 +47,7 @@ spring:
datasource: datasource:
master: master:
url: jdbc:mysql://122.51.230.86:3306/lanan_platform_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 url: jdbc:mysql://122.51.230.86:3306/lanan_platform_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://122.51.230.86:3306/lanan_platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例