|
|
@ -2,9 +2,13 @@ package cn.iocoder.yudao.module.inspection.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
|
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
|
@ -17,7 +21,9 @@ import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
|
|
|
|
import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService;
|
|
|
|
import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService;
|
|
|
|
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
|
|
|
|
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
|
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
|
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
|
|
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
|
|
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
|
|
|
import cn.iocoder.yudao.util.SendSmsUtil;
|
|
|
|
import cn.iocoder.yudao.util.SendSmsUtil;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
@ -49,8 +55,7 @@ import javax.annotation.Resource;
|
|
|
|
* @date 2023-08-13
|
|
|
|
* @date 2023-08-13
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,InspectionInfo> implements IInspectionInfoService
|
|
|
|
public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper, InspectionInfo> implements IInspectionInfoService {
|
|
|
|
{
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private AdminUserService userService;
|
|
|
|
private AdminUserService userService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
@ -72,8 +77,15 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
private IDelOrderInfoService delInspectionOrderService;
|
|
|
|
private IDelOrderInfoService delInspectionOrderService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IDelInspectionInfoService delInspectionInfoService;
|
|
|
|
private IDelInspectionInfoService delInspectionInfoService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IInspectionWorkNodeService workNodeService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private InspectionStepInfoService inspectionStepInfoService;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CustomerMainService customerMainService;
|
|
|
|
private CustomerMainService customerMainService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private RoleService roleService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询【请填写功能名称】
|
|
|
|
* 查询【请填写功能名称】
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -81,8 +93,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
* @return 【请填写功能名称】
|
|
|
|
* @return 【请填写功能名称】
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public InspectionInfo selectInspectionInfoById(Long id)
|
|
|
|
public InspectionInfo selectInspectionInfoById(Long id) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return baseMapper.selectInspectionInfoById(id);
|
|
|
|
return baseMapper.selectInspectionInfoById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -93,9 +104,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
* @return 【请填写功能名称】
|
|
|
|
* @return 【请填写功能名称】
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public IPage<InspectionInfo> selectInspectionInfoList(Page<InspectionInfo> page, InspectionInfo inspectionInfo)
|
|
|
|
public IPage<InspectionInfo> selectInspectionInfoList(Page<InspectionInfo> page, InspectionInfo inspectionInfo) {
|
|
|
|
{
|
|
|
|
return baseMapper.selectInspectionInfoList(page, inspectionInfo);
|
|
|
|
return baseMapper.selectInspectionInfoList(page,inspectionInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -109,19 +119,23 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
public int insertInspectionInfo(InspectionInfo inspectionInfo) throws Exception {
|
|
|
|
public int insertInspectionInfo(InspectionInfo inspectionInfo) throws Exception {
|
|
|
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
|
ShopMallPartners partners = appInspectionPartnerService.shopInfo();
|
|
|
|
ShopMallPartners partners = appInspectionPartnerService.shopInfo();
|
|
|
|
LambdaQueryWrapper<PartnerWorker> workerQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
|
// LambdaQueryWrapper<PartnerWorker> workerQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
|
workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId());
|
|
|
|
// workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId());
|
|
|
|
PartnerWorker worker = workerService.getOne(workerQueryWrapper);
|
|
|
|
// PartnerWorker worker = workerService.getOne(workerQueryWrapper);
|
|
|
|
if (ObjectUtils.isNotEmpty(worker)){
|
|
|
|
// if (ObjectUtils.isNotEmpty(worker)){
|
|
|
|
inspectionInfo.setWorkId(worker.getId());
|
|
|
|
// inspectionInfo.setWorkId(worker.getId());
|
|
|
|
}else {
|
|
|
|
// }else {
|
|
|
|
throw new Exception("请先将接待员加入员工");
|
|
|
|
// throw new Exception("请先将接待员加入员工");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(inspectionInfo.getInspectionWorkNodes())) {
|
|
|
|
|
|
|
|
throw new RuntimeException("请选择检测项目");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
AdminUserDO workerUser =userService.getUser(worker.getUserId());
|
|
|
|
//当前登陆人 就是检测人
|
|
|
|
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户";
|
|
|
|
AdminUserDO workerUser = userService.getUser(loginUser.getId());
|
|
|
|
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"无";
|
|
|
|
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户";
|
|
|
|
|
|
|
|
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "无";
|
|
|
|
AdminUserDO user = userService.getUserByMobile(buyPhone);
|
|
|
|
AdminUserDO user = userService.getUserByMobile(buyPhone);
|
|
|
|
if (ObjectUtils.isEmpty(user)){
|
|
|
|
if (ObjectUtils.isEmpty(user)) {
|
|
|
|
//新增用户
|
|
|
|
//新增用户
|
|
|
|
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
|
|
|
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
|
|
|
userSaveReqVO.setNickname(buyName);
|
|
|
|
userSaveReqVO.setNickname(buyName);
|
|
|
@ -135,13 +149,13 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
user.setNickname(buyName);
|
|
|
|
user.setNickname(buyName);
|
|
|
|
user.setUsername(buyPhone);
|
|
|
|
user.setUsername(buyPhone);
|
|
|
|
user.setMobile(buyPhone);
|
|
|
|
user.setMobile(buyPhone);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
inspectionInfo.setUserId(user.getId());
|
|
|
|
inspectionInfo.setUserId(user.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
InspectionGoodsSku sku = skuService.getById(inspectionInfo.getSkuId());
|
|
|
|
InspectionGoodsSku sku = skuService.getById(inspectionInfo.getSkuId());
|
|
|
|
ShopInspectionGoods goods = goodsService.getById(sku.getGoodsId());
|
|
|
|
ShopInspectionGoods goods = goodsService.getById(sku.getGoodsId());
|
|
|
|
ShopMallPartners partner = appInspectionPartnerService.getById(goods.getPartnerId());
|
|
|
|
ShopMallPartners partner = appInspectionPartnerService.getById(goods.getPartnerId());
|
|
|
|
OrderInfo orderInfo =new OrderInfo();
|
|
|
|
OrderInfo orderInfo = new OrderInfo();
|
|
|
|
orderInfo.setPartnerId(partners.getPartnerId());
|
|
|
|
orderInfo.setPartnerId(partners.getPartnerId());
|
|
|
|
orderInfo.setGoodsId(Long.parseLong(goods.getId().toString()));
|
|
|
|
orderInfo.setGoodsId(Long.parseLong(goods.getId().toString()));
|
|
|
|
orderInfo.setGoodsTitle(goods.getTitle());
|
|
|
|
orderInfo.setGoodsTitle(goods.getTitle());
|
|
|
@ -158,7 +172,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
orderInfo.setIsOnline("0");
|
|
|
|
orderInfo.setIsOnline("0");
|
|
|
|
orderInfo.setPhonenumber(user.getMobile());
|
|
|
|
orderInfo.setPhonenumber(user.getMobile());
|
|
|
|
orderInfo.setPartnerName(partner.getPartnerName());
|
|
|
|
orderInfo.setPartnerName(partner.getPartnerName());
|
|
|
|
orderInfo.setOrderNo("线下订单-"+System.currentTimeMillis());
|
|
|
|
orderInfo.setOrderNo("线下订单-" + System.currentTimeMillis());
|
|
|
|
//赊账的情况
|
|
|
|
//赊账的情况
|
|
|
|
orderInfo.setOrderStatus("0");
|
|
|
|
orderInfo.setOrderStatus("0");
|
|
|
|
orderInfoService.save(orderInfo);
|
|
|
|
orderInfoService.save(orderInfo);
|
|
|
@ -169,9 +183,9 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
inspectionInfo.setStartTime(new Date());
|
|
|
|
inspectionInfo.setStartTime(new Date());
|
|
|
|
inspectionInfo.setCategoryId(goods.getGoodsCategoryId());
|
|
|
|
inspectionInfo.setCategoryId(goods.getGoodsCategoryId());
|
|
|
|
inspectionInfo.setStatus("0");
|
|
|
|
inspectionInfo.setStatus("0");
|
|
|
|
inspectionInfo.setYear(DateUtil.format(inspectionInfo.getStartTime(),"yyyy"));
|
|
|
|
inspectionInfo.setYear(DateUtil.format(inspectionInfo.getStartTime(), "yyyy"));
|
|
|
|
inspectionInfo.setMonth(DateUtil.format(inspectionInfo.getStartTime(),"yyyy-MM"));
|
|
|
|
inspectionInfo.setMonth(DateUtil.format(inspectionInfo.getStartTime(), "yyyy-MM"));
|
|
|
|
inspectionInfo.setDay(DateUtil.format(inspectionInfo.getStartTime(),"yyyy-MM-dd"));
|
|
|
|
inspectionInfo.setDay(DateUtil.format(inspectionInfo.getStartTime(), "yyyy-MM-dd"));
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
//开始检测短信发送
|
|
|
|
//开始检测短信发送
|
|
|
|
// 获取当前日期和时间
|
|
|
|
// 获取当前日期和时间
|
|
|
@ -182,18 +196,18 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
|
|
|
|
|
|
|
|
// 将当前时间转换为指定格式
|
|
|
|
// 将当前时间转换为指定格式
|
|
|
|
String formattedTime = currentTime.format(formatter);
|
|
|
|
String formattedTime = currentTime.format(formatter);
|
|
|
|
if (PhoneValidator.isValid(orderInfo.getPhonenumber())){
|
|
|
|
if (PhoneValidator.isValid(orderInfo.getPhonenumber())) {
|
|
|
|
SendSmsUtil.sendMsgCommon(new String[]{formattedTime},orderInfo.getPhonenumber(),"1400852709","机动车管家小程序","1961713");
|
|
|
|
SendSmsUtil.sendMsgCommon(new String[]{formattedTime}, orderInfo.getPhonenumber(), "1400852709", "机动车管家小程序", "1961713");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (Exception ignored){
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
log.error(ignored.getMessage());
|
|
|
|
log.error(ignored.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//增加客户信息
|
|
|
|
//增加客户信息
|
|
|
|
LambdaQueryWrapper<PartnerCustomerInfo> queryWrapper =new LambdaQueryWrapper<>();
|
|
|
|
LambdaQueryWrapper<PartnerCustomerInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
queryWrapper.eq(PartnerCustomerInfo::getPartnerId,inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId,orderInfo.getUserId());
|
|
|
|
queryWrapper.eq(PartnerCustomerInfo::getPartnerId, inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId, orderInfo.getUserId());
|
|
|
|
PartnerCustomerInfo customerInfo = customerInfoService.getOne(queryWrapper);
|
|
|
|
PartnerCustomerInfo customerInfo = customerInfoService.getOne(queryWrapper);
|
|
|
|
if (ObjectUtil.isEmpty(customerInfo)){
|
|
|
|
if (ObjectUtil.isEmpty(customerInfo)) {
|
|
|
|
customerInfo =new PartnerCustomerInfo();
|
|
|
|
customerInfo = new PartnerCustomerInfo();
|
|
|
|
customerInfo.setPartnerId(inspectionInfo.getPartnerId());
|
|
|
|
customerInfo.setPartnerId(inspectionInfo.getPartnerId());
|
|
|
|
customerInfo.setUserId(user.getId());
|
|
|
|
customerInfo.setUserId(user.getId());
|
|
|
|
customerInfo.setCustomerPhone(user.getMobile());
|
|
|
|
customerInfo.setCustomerPhone(user.getMobile());
|
|
|
@ -206,14 +220,30 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
customerMainService.saveOrUpdate(customerMain);
|
|
|
|
customerMainService.saveOrUpdate(customerMain);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
customerInfoService.insertPartnerCustomerInfo(customerInfo);
|
|
|
|
customerInfoService.insertPartnerCustomerInfo(customerInfo);
|
|
|
|
}catch (Exception ignored){
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//追加订单明细记录
|
|
|
|
//追加订单明细记录
|
|
|
|
orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(),"线下订单创建",new Date(),0L,"1"));
|
|
|
|
orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(), "线下订单创建", new Date(), 0L, "1"));
|
|
|
|
return baseMapper.insert(inspectionInfo);
|
|
|
|
//默认当前流程的顺序为1
|
|
|
|
|
|
|
|
inspectionInfo.setNowOrderNum(1);
|
|
|
|
|
|
|
|
//添加检测工单
|
|
|
|
|
|
|
|
baseMapper.insert(inspectionInfo);
|
|
|
|
|
|
|
|
//补充检测流程
|
|
|
|
|
|
|
|
List<InspectionWorkNode> inspectionWorkNodes = inspectionInfo.getInspectionWorkNodes();
|
|
|
|
|
|
|
|
//将检测工单流程补充检测工单id
|
|
|
|
|
|
|
|
inspectionWorkNodes.stream().forEach(inspectionWorkNode -> inspectionWorkNode.setInspectionInfoId(inspectionInfo.getId()));
|
|
|
|
|
|
|
|
workNodeService.saveBatch(inspectionWorkNodes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//检测步骤表插入检测开始
|
|
|
|
|
|
|
|
InspectionStepInfo stepInfo = new InspectionStepInfo();
|
|
|
|
|
|
|
|
stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(inspectionInfo.getId())));
|
|
|
|
|
|
|
|
stepInfo.setTitle("检测开始");
|
|
|
|
|
|
|
|
stepInfo.setContent("检测开始");
|
|
|
|
|
|
|
|
boolean save = inspectionStepInfoService.save(stepInfo);
|
|
|
|
|
|
|
|
return save ? 1 : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -243,19 +273,19 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
public int updateInspectionInfo(InspectionInfo inspectionInfo) throws Exception {
|
|
|
|
public int updateInspectionInfo(InspectionInfo inspectionInfo) throws Exception {
|
|
|
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
|
ShopMallPartners partners = appInspectionPartnerService.shopInfo();
|
|
|
|
ShopMallPartners partners = appInspectionPartnerService.shopInfo();
|
|
|
|
LambdaQueryWrapper<PartnerWorker> workerQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
|
LambdaQueryWrapper<PartnerWorker> workerQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId());
|
|
|
|
workerQueryWrapper.eq(PartnerWorker::getUserId, loginUser.getId()).eq(PartnerWorker::getPartnerId, partners.getPartnerId());
|
|
|
|
PartnerWorker worker = workerService.getOne(workerQueryWrapper);
|
|
|
|
PartnerWorker worker = workerService.getOne(workerQueryWrapper);
|
|
|
|
AdminUserDO workerUser =userService.getUser(worker.getUserId());
|
|
|
|
AdminUserDO workerUser = userService.getUser(worker.getUserId());
|
|
|
|
if (ObjectUtils.isNotEmpty(worker)){
|
|
|
|
if (ObjectUtils.isNotEmpty(worker)) {
|
|
|
|
inspectionInfo.setWorkId(worker.getId());
|
|
|
|
inspectionInfo.setWorkId(worker.getId());
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
throw new Exception("请先将接待员加入员工");
|
|
|
|
throw new Exception("请先将接待员加入员工");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户";
|
|
|
|
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户";
|
|
|
|
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"无";
|
|
|
|
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "无";
|
|
|
|
AdminUserDO user = userService.getUserByMobile(buyPhone);
|
|
|
|
AdminUserDO user = userService.getUserByMobile(buyPhone);
|
|
|
|
if (ObjectUtils.isEmpty(user)){
|
|
|
|
if (ObjectUtils.isEmpty(user)) {
|
|
|
|
//新增用户
|
|
|
|
//新增用户
|
|
|
|
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
|
|
|
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
|
|
|
userSaveReqVO.setNickname(buyName);
|
|
|
|
userSaveReqVO.setNickname(buyName);
|
|
|
@ -264,7 +294,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
userSaveReqVO.setPassword("123456");
|
|
|
|
userSaveReqVO.setPassword("123456");
|
|
|
|
Long uid = userService.createUser(userSaveReqVO);
|
|
|
|
Long uid = userService.createUser(userSaveReqVO);
|
|
|
|
inspectionInfo.setUserId(uid);
|
|
|
|
inspectionInfo.setUserId(uid);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
inspectionInfo.setUserId(user.getId());
|
|
|
|
inspectionInfo.setUserId(user.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
InspectionGoodsSku sku = skuService.getById(inspectionInfo.getSkuId());
|
|
|
|
InspectionGoodsSku sku = skuService.getById(inspectionInfo.getSkuId());
|
|
|
@ -284,17 +314,16 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public int deleteInspectionInfoByIds(Long id)
|
|
|
|
public int deleteInspectionInfoByIds(Long id) {
|
|
|
|
{
|
|
|
|
|
|
|
|
InspectionInfo info = this.getById(id);
|
|
|
|
InspectionInfo info = this.getById(id);
|
|
|
|
baseMapper.deleteInspectionInfoById(id);
|
|
|
|
baseMapper.deleteInspectionInfoById(id);
|
|
|
|
OrderInfo orderInfo = orderInfoService.getById(info.getInspectionOrderId());
|
|
|
|
OrderInfo orderInfo = orderInfoService.getById(info.getInspectionOrderId());
|
|
|
|
orderInfoService.removeById(info.getInspectionOrderId());
|
|
|
|
orderInfoService.removeById(info.getInspectionOrderId());
|
|
|
|
//往回收站插入
|
|
|
|
//往回收站插入
|
|
|
|
DelInspectionInfo delInspectionInfo =new DelInspectionInfo();
|
|
|
|
DelInspectionInfo delInspectionInfo = new DelInspectionInfo();
|
|
|
|
DelOrderInfo delInspectionOrder =new DelOrderInfo();
|
|
|
|
DelOrderInfo delInspectionOrder = new DelOrderInfo();
|
|
|
|
BeanUtils.copyProperties(info,delInspectionInfo);
|
|
|
|
BeanUtils.copyProperties(info, delInspectionInfo);
|
|
|
|
BeanUtils.copyProperties(orderInfo,delInspectionOrder);
|
|
|
|
BeanUtils.copyProperties(orderInfo, delInspectionOrder);
|
|
|
|
delInspectionInfoService.insertDelInspectionInfo(delInspectionInfo);
|
|
|
|
delInspectionInfoService.insertDelInspectionInfo(delInspectionInfo);
|
|
|
|
delInspectionOrderService.insertDelOrderInfo(delInspectionOrder);
|
|
|
|
delInspectionOrderService.insertDelOrderInfo(delInspectionOrder);
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
@ -307,32 +336,79 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|
|
|
* @return 结果
|
|
|
|
* @return 结果
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int deleteInspectionInfoById(Long id)
|
|
|
|
public int deleteInspectionInfoById(Long id) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return baseMapper.deleteInspectionInfoById(id);
|
|
|
|
return baseMapper.deleteInspectionInfoById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<InspectionInfo> workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime){
|
|
|
|
public List<InspectionInfo> workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
|
|
|
|
return baseMapper.workOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
|
|
|
|
return baseMapper.workOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public IPage<InspectionInfo> pageWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page<InspectionInfo> page) {
|
|
|
|
public IPage<InspectionInfo> pageWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page<InspectionInfo> page) {
|
|
|
|
return baseMapper.pageWorkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime,page);
|
|
|
|
return baseMapper.pageWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<InspectionInfo> delworkOrder(Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime){
|
|
|
|
public List<InspectionInfo> delworkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
|
|
|
|
return baseMapper.delworkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
|
|
|
|
return baseMapper.delworkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public IPage<InspectionInfo> pageDelWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page<InspectionInfo> page) {
|
|
|
|
public IPage<InspectionInfo> pageDelWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page<InspectionInfo> page) {
|
|
|
|
return baseMapper.pageDelWorkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime,page);
|
|
|
|
return baseMapper.pageDelWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
|
|
|
|
public Map<String, Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
|
|
|
|
return baseMapper.workOrderData(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
|
|
|
|
return baseMapper.workOrderData(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 根据当前登陆人获取可以选择的工单
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<InspectionInfo> geStelectInspection() {
|
|
|
|
|
|
|
|
//获取当前登录人
|
|
|
|
|
|
|
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
|
|
|
|
|
//获取当前登陆人的角色
|
|
|
|
|
|
|
|
List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
|
|
|
|
|
|
|
|
List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
//查询所有工单为进行中的
|
|
|
|
|
|
|
|
List<InspectionInfo> inspectionInfos = baseMapper.selectList(new LambdaQueryWrapper<InspectionInfo>()
|
|
|
|
|
|
|
|
.eq(InspectionInfo::getStatus, 0));
|
|
|
|
|
|
|
|
//根据工单id查询工单流程节点
|
|
|
|
|
|
|
|
List<Long> infoIds = inspectionInfos.stream().map(inspectionInfo -> inspectionInfo.getId()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(infoIds)) {
|
|
|
|
|
|
|
|
List<InspectionWorkNode> inspectionWorkNodes = workNodeService.list(new LambdaQueryWrapper<InspectionWorkNode>()
|
|
|
|
|
|
|
|
.in(InspectionWorkNode::getInspectionInfoId, infoIds)
|
|
|
|
|
|
|
|
.eq(InspectionWorkNode::getDealUserId, null));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//工单集合
|
|
|
|
|
|
|
|
List<InspectionInfo> inspectionInfoList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据工单id查询工单流程节点
|
|
|
|
|
|
|
|
Map<Long, List<InspectionWorkNode>> inspectionWorkNodeMap = inspectionWorkNodes.stream().collect(Collectors.groupingBy(InspectionWorkNode::getInspectionInfoId));
|
|
|
|
|
|
|
|
for (InspectionInfo inspectionInfo : inspectionInfos) {
|
|
|
|
|
|
|
|
List<InspectionWorkNode> inspectionWorkNodeList = inspectionWorkNodeMap.get(inspectionInfo.getId());
|
|
|
|
|
|
|
|
//遍历工单流程节点 流程为key
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(inspectionWorkNodeList)) {
|
|
|
|
|
|
|
|
Map<Integer, InspectionWorkNode> inspectionWorkMap = inspectionWorkNodeList.stream().collect(Collectors.toMap(InspectionWorkNode::getOrderNum, item -> item));
|
|
|
|
|
|
|
|
InspectionWorkNode inspectionWorkNode = inspectionWorkMap.get(inspectionInfo.getNowOrderNum());
|
|
|
|
|
|
|
|
if (inspectionWorkNode != null){
|
|
|
|
|
|
|
|
//判断当前项目 当前登录人员 是否可以处理
|
|
|
|
|
|
|
|
if (roleIds.contains(inspectionWorkNode.getRoleId())){
|
|
|
|
|
|
|
|
inspectionInfo.setWorkNodeId(inspectionWorkNode.getId());
|
|
|
|
|
|
|
|
inspectionInfoList.add(inspectionInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return inspectionInfoList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|