|
|
@ -1,5 +1,6 @@ |
|
|
package org.jeecg.modules.apiservice.impl; |
|
|
package org.jeecg.modules.apiservice.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; |
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; |
|
|
import org.apache.commons.lang.StringUtils; |
|
|
import org.apache.commons.lang.StringUtils; |
|
|
@ -16,15 +17,23 @@ import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; |
|
|
import org.jeecg.modules.pay.MpWxPayService; |
|
|
import org.jeecg.modules.pay.MpWxPayService; |
|
|
import org.jeecg.modules.schoolIndex.entity.SchoolIndex; |
|
|
import org.jeecg.modules.schoolIndex.entity.SchoolIndex; |
|
|
import org.jeecg.modules.schoolIndex.service.ISchoolIndexService; |
|
|
import org.jeecg.modules.schoolIndex.service.ISchoolIndexService; |
|
|
|
|
|
import org.jeecg.modules.schoolOrderLog.entity.SchoolOrderLog; |
|
|
|
|
|
import org.jeecg.modules.schoolOrderLog.service.ISchoolOrderLogService; |
|
|
import org.jeecg.modules.shcoolFloor.entity.ShcoolFloor; |
|
|
import org.jeecg.modules.shcoolFloor.entity.ShcoolFloor; |
|
|
import org.jeecg.modules.shcoolFloor.service.IShcoolFloorService; |
|
|
import org.jeecg.modules.shcoolFloor.service.IShcoolFloorService; |
|
|
import org.jeecg.modules.shcoolSub.entity.ShcoolSub; |
|
|
import org.jeecg.modules.shcoolSub.entity.ShcoolSub; |
|
|
|
|
|
import org.jeecg.modules.shcoolSub.mapper.ShcoolSubMapper; |
|
|
import org.jeecg.modules.shcoolSub.service.IShcoolSubService; |
|
|
import org.jeecg.modules.shcoolSub.service.IShcoolSubService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
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; |
|
|
|
|
|
import javax.transaction.Transactional; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
import java.time.LocalTime; |
|
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
@ -47,6 +56,11 @@ public class IndexApiServiceImpl implements IndexApiService { |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private ISchoolIndexService schoolIndexService; |
|
|
private ISchoolIndexService schoolIndexService; |
|
|
|
|
|
//工单流转明细 |
|
|
|
|
|
@Resource |
|
|
|
|
|
private ISchoolOrderLogService schoolOrderLogService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private ShcoolSubMapper shcoolSubMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -89,11 +103,38 @@ public class IndexApiServiceImpl implements IndexApiService { |
|
|
@Override |
|
|
@Override |
|
|
public Result<?> addUserSchoolOrder(String token,ShcoolSub bean){ |
|
|
public Result<?> addUserSchoolOrder(String token,ShcoolSub bean){ |
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
// 获取当前日期 |
|
|
|
|
|
LocalDate today = LocalDate.now(); |
|
|
|
|
|
// 定义一个DateTimeFormatter,用于将日期格式化为YYYYMMDD |
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); |
|
|
|
|
|
// 使用formatter将today格式化为字符串 |
|
|
|
|
|
String formattedDate = today.format(formatter); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIN); |
|
|
|
|
|
LocalDateTime todayEnd = todayStart.plusDays(1).minusNanos(1); // 加上一天然后减去一秒,得到当天的23:59:59.999999999 |
|
|
|
|
|
|
|
|
|
|
|
// 使用lambdaQuery()构建查询条件(注意:lambdaQuery()并非MyBatis-Plus的标准API,这里使用LambdaQueryWrapper作为示例) |
|
|
|
|
|
LambdaQueryWrapper<ShcoolSub> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
queryWrapper.between(ShcoolSub::getCreateTime, todayStart, todayEnd); // 假设getCreateTime是获取创建时间的getter方法 |
|
|
|
|
|
|
|
|
|
|
|
// 执行查询并获取数量 |
|
|
|
|
|
// 注意:这里假设orderMapper有一个selectCount方法,它实际上可能是自定义的或使用MyBatis-Plus提供的工具方法 |
|
|
|
|
|
Long aLong = shcoolSubMapper.selectCount(queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
String orderNo = formattedDate + (aLong+1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bean.setOrderNo(orderNo); |
|
|
bean.setUserId(hanHaiMember.getId()); |
|
|
bean.setUserId(hanHaiMember.getId()); |
|
|
bean.setState("0"); |
|
|
bean.setState("0"); |
|
|
bean.setCreateTime(new Date()); |
|
|
bean.setCreateTime(new Date()); |
|
|
|
|
|
bean.setStartTime(new Date()); |
|
|
|
|
|
|
|
|
|
|
|
//接单人 |
|
|
|
|
|
String giveUser = ""; |
|
|
//查看传入的是几楼 |
|
|
//查看传入的是几楼 |
|
|
|
|
|
HanHaiMember hanHaiMember1 = new HanHaiMember(); |
|
|
if(StringUtils.isNotBlank(bean.getBuilding())){ |
|
|
if(StringUtils.isNotBlank(bean.getBuilding())){ |
|
|
ShcoolFloor shcoolFloor = shcoolFloorService.lambdaQuery() |
|
|
ShcoolFloor shcoolFloor = shcoolFloorService.lambdaQuery() |
|
|
.eq(ShcoolFloor::getName,bean.getBuilding()) |
|
|
.eq(ShcoolFloor::getName,bean.getBuilding()) |
|
|
@ -101,30 +142,77 @@ public class IndexApiServiceImpl implements IndexApiService { |
|
|
//得到维修账号 |
|
|
//得到维修账号 |
|
|
if(shcoolFloor!=null){ |
|
|
if(shcoolFloor!=null){ |
|
|
//根据维修账号查询用户信息 |
|
|
//根据维修账号查询用户信息 |
|
|
HanHaiMember hanHaiMember1 = hanHaiMemberService.lambdaQuery() |
|
|
|
|
|
|
|
|
hanHaiMember1 = hanHaiMemberService.lambdaQuery() |
|
|
.eq(HanHaiMember::getAccount,shcoolFloor.getUserAccount()) |
|
|
.eq(HanHaiMember::getAccount,shcoolFloor.getUserAccount()) |
|
|
.one(); |
|
|
.one(); |
|
|
bean.setGiveAccount(hanHaiMember1.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断是否为空 |
|
|
|
|
|
if(hanHaiMember1==null){ |
|
|
|
|
|
return Result.error("该楼栋暂无维修人员"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
giveUser = hanHaiMember1.getId(); |
|
|
|
|
|
bean.setGiveAccount(giveUser); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
shcoolSubService.save(bean); |
|
|
shcoolSubService.save(bean); |
|
|
|
|
|
|
|
|
|
|
|
//增加工单流转明细 |
|
|
|
|
|
SchoolOrderLog schoolOrderLog = new SchoolOrderLog(); |
|
|
|
|
|
schoolOrderLog.setOrderId(bean.getId()); |
|
|
|
|
|
//生成工单号逻辑:// 年月份日期 + 当天的需要到单日期 |
|
|
|
|
|
schoolOrderLog.setOrderNo(orderNo); |
|
|
|
|
|
schoolOrderLog.setGiveUser(giveUser); |
|
|
|
|
|
schoolOrderLog.setType("0"); |
|
|
|
|
|
schoolOrderLog.setCentext(hanHaiMember.getNickName()+"提交工单"+"=>分配给"+hanHaiMember1.getName()); |
|
|
|
|
|
schoolOrderLog.setUserId(hanHaiMember.getId()); |
|
|
|
|
|
schoolOrderLog.setOrderName(bean.getName()); |
|
|
|
|
|
schoolOrderLog.setCreateTime(new Date()); |
|
|
|
|
|
schoolOrderLogService.save(schoolOrderLog); |
|
|
return Result.OK("增加成功"); |
|
|
return Result.OK("增加成功"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//驳回 |
|
|
//驳回 |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
public Result<?> editSchoolOrderError(String token,ShcoolSub bean){ |
|
|
public Result<?> editSchoolOrderError(String token,ShcoolSub bean){ |
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiAccount(token); |
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiAccount(token); |
|
|
if(StringUtils.isBlank(bean.getId())){ |
|
|
if(StringUtils.isBlank(bean.getId())){ |
|
|
return Result.error("订单标识不能为空"); |
|
|
return Result.error("订单标识不能为空"); |
|
|
} |
|
|
} |
|
|
|
|
|
//驳回原因不能为空 |
|
|
|
|
|
if(StringUtils.isBlank(bean.getReturnValue())){ |
|
|
|
|
|
return Result.error("驳回原因不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//根据标识查询用户信息 |
|
|
|
|
|
ShcoolSub sub = shcoolSubService.getById(bean.getId()); |
|
|
|
|
|
|
|
|
|
|
|
//增加转单记录 |
|
|
|
|
|
//根据标识查询转单师傅信息 |
|
|
|
|
|
HanHaiMember byId = hanHaiMemberService.getById(sub.getGiveAccount()); |
|
|
|
|
|
SchoolOrderLog schoolOrderLog = new SchoolOrderLog(); |
|
|
|
|
|
|
|
|
|
|
|
schoolOrderLog.setOrderNo(sub.getOrderNo()); |
|
|
|
|
|
schoolOrderLog.setType("2"); |
|
|
|
|
|
schoolOrderLog.setGiveUser(sub.getGiveAccount()); |
|
|
|
|
|
schoolOrderLog.setOrderId(sub.getId()); |
|
|
|
|
|
schoolOrderLog.setCreateTime(new Date()); |
|
|
|
|
|
schoolOrderLog.setCentext(byId.getName()+":驳回订单"); |
|
|
|
|
|
schoolOrderLog.setUserId(sub.getUserId()); |
|
|
|
|
|
schoolOrderLogService.save(schoolOrderLog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bean.setSuccessPrice(BigDecimal.ZERO); |
|
|
|
|
|
bean.setSuccessTitle(""); |
|
|
|
|
|
bean.setSucessText(""); |
|
|
|
|
|
bean.setSuccessImage(""); |
|
|
bean.setCleckState("2"); |
|
|
bean.setCleckState("2"); |
|
|
bean.setGiveAccount("-------"); |
|
|
bean.setGiveAccount("-------"); |
|
|
shcoolSubService.updateById(bean); |
|
|
shcoolSubService.updateById(bean); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result.OK("驳回成功"); |
|
|
return Result.OK("驳回成功"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -135,8 +223,14 @@ public class IndexApiServiceImpl implements IndexApiService { |
|
|
if(StringUtils.isBlank(bean.getId())){ |
|
|
if(StringUtils.isBlank(bean.getId())){ |
|
|
return Result.error("订单标识不能为空"); |
|
|
return Result.error("订单标识不能为空"); |
|
|
} |
|
|
} |
|
|
bean.setGiveAccount("-----"); |
|
|
|
|
|
|
|
|
bean.setGiveAccount(""); |
|
|
bean.setCleckState("2"); |
|
|
bean.setCleckState("2"); |
|
|
|
|
|
|
|
|
|
|
|
//驳回原因不能为空 |
|
|
|
|
|
if(StringUtils.isBlank(bean.getReturnValue())){ |
|
|
|
|
|
return Result.error("驳回原因不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
shcoolSubService.updateById(bean); |
|
|
shcoolSubService.updateById(bean); |
|
|
return Result.OK("驳回成功"); |
|
|
return Result.OK("驳回成功"); |
|
|
} |
|
|
} |
|
|
@ -150,7 +244,28 @@ public class IndexApiServiceImpl implements IndexApiService { |
|
|
} |
|
|
} |
|
|
bean.setCleckState("1"); |
|
|
bean.setCleckState("1"); |
|
|
bean.setState("1"); |
|
|
bean.setState("1"); |
|
|
|
|
|
bean.setEndTime(new Date()); |
|
|
|
|
|
bean.setReturnValue(""); |
|
|
shcoolSubService.updateById(bean); |
|
|
shcoolSubService.updateById(bean); |
|
|
|
|
|
|
|
|
|
|
|
//根据标识查询用户信息 |
|
|
|
|
|
ShcoolSub sub = shcoolSubService.getById(bean.getId()); |
|
|
|
|
|
|
|
|
|
|
|
//增加转单记录 |
|
|
|
|
|
//根据标识查询转单师傅信息 |
|
|
|
|
|
HanHaiMember byId = hanHaiMemberService.getById(sub.getGiveAccount()); |
|
|
|
|
|
SchoolOrderLog schoolOrderLog = new SchoolOrderLog(); |
|
|
|
|
|
|
|
|
|
|
|
schoolOrderLog.setOrderNo(sub.getOrderNo()); |
|
|
|
|
|
schoolOrderLog.setType("1"); |
|
|
|
|
|
schoolOrderLog.setGiveUser(sub.getGiveAccount()); |
|
|
|
|
|
schoolOrderLog.setOrderId(sub.getId()); |
|
|
|
|
|
schoolOrderLog.setCreateTime(new Date()); |
|
|
|
|
|
schoolOrderLog.setCentext(byId.getName()+":师傅结单"); |
|
|
|
|
|
schoolOrderLog.setUserId(sub.getUserId()); |
|
|
|
|
|
schoolOrderLogService.save(schoolOrderLog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result.OK("结单成功"); |
|
|
return Result.OK("结单成功"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -163,6 +278,7 @@ public class IndexApiServiceImpl implements IndexApiService { |
|
|
} |
|
|
} |
|
|
bean.setCleckState("1"); |
|
|
bean.setCleckState("1"); |
|
|
bean.setState("1"); |
|
|
bean.setState("1"); |
|
|
|
|
|
bean.setEndTime(new Date()); |
|
|
shcoolSubService.updateById(bean); |
|
|
shcoolSubService.updateById(bean); |
|
|
return Result.OK("结单成功"); |
|
|
return Result.OK("结单成功"); |
|
|
} |
|
|
} |
|
|
|