【admin】 新增 1、师傅管理
parent
8da030e0d1
commit
4eeae215cd
|
@ -119,10 +119,11 @@ public class OrderController {
|
||||||
@ApiOperation(value = "订单管理 - 指派订单给师傅")
|
@ApiOperation(value = "订单管理 - 指派订单给师傅")
|
||||||
@GetMapping("/dispatch")
|
@GetMapping("/dispatch")
|
||||||
public Object dispatch(@RequestParam("id") Long id,
|
public Object dispatch(@RequestParam("id") Long id,
|
||||||
|
@RequestParam("staffId") Long staffId,
|
||||||
@RequestParam(value = "timeBefore",required = false) Integer timeBefore,
|
@RequestParam(value = "timeBefore",required = false) Integer timeBefore,
|
||||||
@RequestParam(value = "deductScore",required = false) BigDecimal deductScore) {
|
@RequestParam(value = "deductScore",required = false) BigDecimal deductScore) {
|
||||||
Integer userId = AdminThreadLocal.getAdminId();
|
Integer userId = AdminThreadLocal.getAdminId();
|
||||||
iOrderService.dispatchStaff(id, userId,timeBefore,deductScore);
|
iOrderService.dispatchStaff(id, staffId, userId,timeBefore,deductScore);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.hcy.admin.controller.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.config.aop.Log;
|
||||||
|
import com.hcy.admin.service.staff.IStaffApplyForService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffApplyForParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffApplyForDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffApplyForListVo;
|
||||||
|
import com.hcy.common.core.AjaxResult;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请管理
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/StaffApplyFor")
|
||||||
|
public class StaffApplyForController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IStaffApplyForService iStaffApplyForService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Object list(@Validated PageParam pageParam,
|
||||||
|
@RequestParam Map<String, String> params) {
|
||||||
|
PageResult<StaffApplyForListVo> list = iStaffApplyForService.list(pageParam, params);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请详情
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public Object detail(@RequestParam("id") Integer id) {
|
||||||
|
StaffApplyForDetailVo detail = iStaffApplyForService.detail(id);
|
||||||
|
return AjaxResult.success(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请新增
|
||||||
|
*
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@Log(title = "师傅申请新增")
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Object add(@Validated(value = StaffApplyForParam.create.class) @RequestBody StaffApplyForParam staffApplyForParam) {
|
||||||
|
iStaffApplyForService.add(staffApplyForParam);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请编辑
|
||||||
|
*
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@Log(title = "师傅申请编辑")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
public Object edit(@Validated(value = StaffApplyForParam.update.class) @RequestBody StaffApplyForParam staffApplyForParam) {
|
||||||
|
iStaffApplyForService.edit(staffApplyForParam);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批师傅申请
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@Log(title = "审批师傅申请")
|
||||||
|
@PostMapping("/checkStaffApplyFor")
|
||||||
|
public Object checkStaffApplyFor(@RequestBody StaffApplyForParam staffApplyForParam) {
|
||||||
|
iStaffApplyForService.checkStaffApplyFor(staffApplyForParam);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package com.hcy.admin.controller.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.config.aop.Log;
|
||||||
|
import com.hcy.admin.service.staff.IStaffService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffListVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffPageParam;
|
||||||
|
import com.hcy.common.core.AjaxResult;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅管理
|
||||||
|
*/
|
||||||
|
@Api(tags = "师傅管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/staff")
|
||||||
|
public class StaffController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IStaffService iStaffService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "师傅管理 - 分页列表")
|
||||||
|
@PostMapping("/list")
|
||||||
|
public PageResult<StaffListVo> list(@RequestBody StaffPageParam params) {
|
||||||
|
return iStaffService.list(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "师傅管理 - 师傅详情")
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public StaffDetailVo detail(@RequestParam("id") Long id) {
|
||||||
|
return iStaffService.detail(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "师傅管理 - 师傅新增")
|
||||||
|
@Log(title = "师傅新增")
|
||||||
|
@PostMapping("/add")
|
||||||
|
public void add(@RequestBody StaffParam staffParam) {
|
||||||
|
iStaffService.add(staffParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "师傅管理 - 师傅编辑")
|
||||||
|
@Log(title = "师傅编辑")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
public void edit(@RequestBody StaffParam staffParam) {
|
||||||
|
iStaffService.edit(staffParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "师傅管理 - 师傅删除")
|
||||||
|
@Log(title = "师傅删除")
|
||||||
|
@GetMapping("/del")
|
||||||
|
public void del(@RequestParam("id") Long id) {
|
||||||
|
iStaffService.del(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "师傅管理 - 师傅状态变更")
|
||||||
|
@Log(title = "师傅启动/禁用")
|
||||||
|
@PostMapping("/status")
|
||||||
|
public void status(@RequestBody StaffParam staffParam) {
|
||||||
|
iStaffService.status(staffParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "师傅管理 - 师傅接单状态变更")
|
||||||
|
@PostMapping("/receiveOrderStatus")
|
||||||
|
public void receiveOrderStatus(@RequestBody StaffParam staffParam) {
|
||||||
|
iStaffService.receiveOrderStatus(staffParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "师傅管理 - 获取没体检报告的师傅")
|
||||||
|
@GetMapping("/getNotPhysicalExaminationStaff")
|
||||||
|
public Object getNotPhysicalExaminationStaff(@Validated PageParam pageParam,@RequestParam Map<String, String> params) {
|
||||||
|
PageResult<StaffListVo> staffListVoPageResult = iStaffService.getNotPhysicalExaminationStaff(pageParam,params);
|
||||||
|
return AjaxResult.success(staffListVoPageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "师傅管理 - 师傅运营状态变更")
|
||||||
|
@PostMapping("/updateStaffOperationalStatus")
|
||||||
|
public void updateStaffOperationalStatus(@RequestBody StaffParam staffParam) {
|
||||||
|
iStaffService.updateStaffOperationalStatus(staffParam);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.hcy.admin.controller.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.config.aop.Log;
|
||||||
|
import com.hcy.admin.service.staff.IStaffFeedbackService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffFeedbackParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffFeedbackListVo;
|
||||||
|
import com.hcy.common.core.AjaxResult;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述管理
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/feedback")
|
||||||
|
public class StaffFeedbackController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IStaffFeedbackService iStaffFeedbackService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Object list(@Validated PageParam pageParam,
|
||||||
|
@RequestParam Map<String, String> params) {
|
||||||
|
PageResult<StaffFeedbackListVo> list = iStaffFeedbackService.list(pageParam, params);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述删除
|
||||||
|
*
|
||||||
|
* @param staffFeedbackParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@Log(title = "师傅申述删除")
|
||||||
|
@PostMapping("/del")
|
||||||
|
public Object del(@RequestBody StaffFeedbackParam staffFeedbackParam) {
|
||||||
|
iStaffFeedbackService.del(staffFeedbackParam.getId());
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述审核
|
||||||
|
* @param staffFeedbackParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@Log(title = "师傅申述 - 审核")
|
||||||
|
@PostMapping("/checkFeedback")
|
||||||
|
public Object checkFeedback(@RequestBody StaffFeedbackParam staffFeedbackParam) {
|
||||||
|
iStaffFeedbackService.checkFeedback(staffFeedbackParam);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.hcy.admin.controller.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.service.staff.IStaffPhysicalExaminationService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffApplyForParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffPhysicalExaminationParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffPhysicalExaminationDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffPhysicalExaminationListVo;
|
||||||
|
import com.hcy.common.core.AjaxResult;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import com.hcy.common.validator.annotation.IDMust;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅体检报告申请管理
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/physical/examination")
|
||||||
|
public class StaffPhysicalExaminationController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IStaffPhysicalExaminationService iStaffPhysicalExaminationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅体检报告申请列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Object list(@Validated PageParam pageParam,
|
||||||
|
@RequestParam Map<String, String> params) {
|
||||||
|
PageResult<StaffPhysicalExaminationListVo> list = iStaffPhysicalExaminationService.list(pageParam, params);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅体检报告申请详情
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public Object detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||||
|
StaffPhysicalExaminationDetailVo detail = iStaffPhysicalExaminationService.detail(id);
|
||||||
|
return AjaxResult.success(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批体检报告
|
||||||
|
* @param staffPhysicalExaminationParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkApplyFor")
|
||||||
|
public Object checkApplyFor(@RequestBody StaffPhysicalExaminationParam staffPhysicalExaminationParam) {
|
||||||
|
iStaffPhysicalExaminationService.checkApplyFor(staffPhysicalExaminationParam);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增体检报告
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@PostMapping("/uploadPhysicalExamination")
|
||||||
|
public Object uploadPhysicalExamination(@RequestBody StaffApplyForParam staffApplyForParam) {
|
||||||
|
iStaffPhysicalExaminationService.uploadPhysicalExamination(staffApplyForParam);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.hcy.admin.controller.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.config.aop.Log;
|
||||||
|
import com.hcy.admin.service.staff.IStaffReassignmentService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffReassignmentParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffReassignmentDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffReassignmentListVo;
|
||||||
|
import com.hcy.common.core.AjaxResult;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import com.hcy.common.validator.annotation.IDMust;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派管理
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/reassignment")
|
||||||
|
public class StaffReassignmentController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IStaffReassignmentService iStaffReassignmentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Object list(@Validated PageParam pageParam,
|
||||||
|
@RequestParam Map<String, String> params) {
|
||||||
|
PageResult<StaffReassignmentListVo> list = iStaffReassignmentService.list(pageParam, params);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 师傅改派详情
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public Object detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||||
|
StaffReassignmentDetailVo detail = iStaffReassignmentService.detail(id);
|
||||||
|
return AjaxResult.success(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派新增
|
||||||
|
*
|
||||||
|
* @param staffReassignmentParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@Log(title = "师傅改派新增")
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Object add(@Validated(value = StaffReassignmentParam.create.class) @RequestBody StaffReassignmentParam staffReassignmentParam) {
|
||||||
|
iStaffReassignmentService.add(staffReassignmentParam);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派编辑
|
||||||
|
*
|
||||||
|
* @param staffReassignmentParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@Log(title = "师傅改派编辑")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
public Object edit(@Validated(value = StaffReassignmentParam.update.class) @RequestBody StaffReassignmentParam staffReassignmentParam) {
|
||||||
|
iStaffReassignmentService.edit(staffReassignmentParam);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派删除
|
||||||
|
*
|
||||||
|
* @param staffReassignmentParam 参数
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@Log(title = "师傅改派删除")
|
||||||
|
@PostMapping("/del")
|
||||||
|
public Object del(@Validated(value = StaffReassignmentParam.delete.class) @RequestBody StaffReassignmentParam staffReassignmentParam) {
|
||||||
|
iStaffReassignmentService.del(staffReassignmentParam.getId());
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -76,7 +76,7 @@ public interface IOrderService {
|
||||||
*/
|
*/
|
||||||
void cancelOrder(OrderRefundPageParam orderRefundPageParam) throws WxPayException;
|
void cancelOrder(OrderRefundPageParam orderRefundPageParam) throws WxPayException;
|
||||||
|
|
||||||
void dispatchStaff(Long id, Integer userId,Integer timeBefore, BigDecimal deductScore);
|
void dispatchStaff(Long id, Long staffId, Integer userId,Integer timeBefore, BigDecimal deductScore);
|
||||||
|
|
||||||
void verificationOrder(Long id, Integer userId);
|
void verificationOrder(Long id, Integer userId);
|
||||||
|
|
||||||
|
|
|
@ -622,7 +622,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void dispatchStaff(Long id, Integer userId,Integer timeBefore, BigDecimal deductScore) {
|
public void dispatchStaff(Long id, Long staffId, Integer userId,Integer timeBefore, BigDecimal deductScore) {
|
||||||
Order model = orderMapper.selectOne(
|
Order model = orderMapper.selectOne(
|
||||||
new QueryWrapper<Order>()
|
new QueryWrapper<Order>()
|
||||||
.eq("id", id)
|
.eq("id", id)
|
||||||
|
@ -634,15 +634,106 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||||
throw new OperateException("师傅已派单,不能更换师傅");
|
throw new OperateException("师傅已派单,不能更换师傅");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(model.getIsDispatch() == OrderDispatchEnum.IS_DISPATCH.getStatus()){
|
||||||
|
Staff staff = staffMapper.selectOne(
|
||||||
|
new QueryWrapper<Staff>()
|
||||||
|
.eq("id", staffId)
|
||||||
|
.last("limit 1"));
|
||||||
|
if(staff != null && staff.getIsOperational() == StaffStatusEnum.NOT_OPERATIONAL_STAFF.getCode()) {
|
||||||
|
if(staff.getIsReceiveOrder() == StaffStatusEnum.ORDER_NOT_AVAILABLE.getCode()){
|
||||||
|
throw new OperateException("当前师傅处于不可接单状态");
|
||||||
|
}else if(staff.getIsOrder() == StaffStatusEnum.REST.getCode()){
|
||||||
|
throw new OperateException("当前师傅处于休息状态,不可接单");
|
||||||
|
}
|
||||||
|
|
||||||
|
String msg = "";
|
||||||
|
//判断师傅当前分数是否可以接单和接单数量是否达到上限
|
||||||
|
List<Order> orderList = orderMapper.selectList(new QueryWrapper<Order>()
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.eq("staff_id",staffId)
|
||||||
|
.and(query -> query.ne("order_status", OrderStatusEnum.FINISHED.getStatus())
|
||||||
|
.ne("order_status", OrderStatusEnum.CLOSE.getStatus())));
|
||||||
|
Double score = staff.getScore();
|
||||||
|
if(score >= 4.5 && orderList.size() >= 5){
|
||||||
|
msg = "已达到当前评分接单上限";
|
||||||
|
}else if(score >= 4 && score < 4.5 && orderList.size() >= 3){
|
||||||
|
msg = "已达到当前评分接单上限";
|
||||||
|
}else if(score >= 3.5 && score <4 && orderList.size() >= 2){
|
||||||
|
msg = "已达到当前评分接单上限";
|
||||||
|
}
|
||||||
|
if(StringUtil.isNotEmpty(msg)){
|
||||||
|
throw new OperateException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断当前接单时间和已接订单是否冲突
|
||||||
|
for (Order item : orderList) {
|
||||||
|
long startTime = item.getAppointTimeStart() - 3600;
|
||||||
|
long endTime = item.getAppointTimeEnd() + 3600;
|
||||||
|
//当前订单预约的开始时间和结束时间不可在已接订单之间且只能接已接订单前后一个小时的订单
|
||||||
|
if(TimeUtil.isEffectiveDate(model.getAppointTimeStart(),startTime,endTime) ||
|
||||||
|
TimeUtil.isEffectiveDate(model.getAppointTimeEnd(),startTime,endTime)){
|
||||||
|
throw new OperateException("当前订单和已接订单上门时间冲突");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
model.setStaffMobile(staff.getMobile());
|
||||||
|
//手动指派设置订单追加分数0.05
|
||||||
|
model.setAddScore(0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前接取订单的师傅 判断是否扣除基础分数
|
||||||
|
if(model.getIsDispatch() == OrderDispatchEnum.IS_DISPATCH.getStatus()){
|
||||||
|
//没有配置默认获取当前时间和上门时间相差多少分钟
|
||||||
|
if(timeBefore == null && deductScore == null){
|
||||||
|
deductScore = new BigDecimal("0");
|
||||||
|
timeBefore = Math.toIntExact(TimeUtil.nowTimeDifferenceMinute(model.getAppointTimeStart()));
|
||||||
|
}
|
||||||
|
//要被指派的师傅不是运营师傅就扣分
|
||||||
|
if (staff != null && staff.getIsOperational() == StaffStatusEnum.NOT_OPERATIONAL_STAFF.getCode()) {
|
||||||
|
Staff beforeStaff = staffMapper.findStaffById(model.getStaffId());
|
||||||
|
//扣除申请改派师傅的分数
|
||||||
|
beforeStaff.setAddScore(BigDecimal.valueOf(beforeStaff.getAddScore()).subtract(deductScore).doubleValue());
|
||||||
|
staffMapper.updateById(beforeStaff);
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改指派记录
|
||||||
|
StaffReassignment staffReassignment = staffReassignmentMapper.selectOne(new LambdaQueryWrapper<StaffReassignment>()
|
||||||
|
.eq(StaffReassignment::getIsDelete,GlobalConstant.NOT_DELETE)
|
||||||
|
.eq(StaffReassignment::getOrderId, model.getId())
|
||||||
|
.eq(StaffReassignment::getStaffId, model.getStaffId())
|
||||||
|
.orderByDesc(StaffReassignment::getCreateTime)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
//如果没改派记录或者已改派的都是新增一条数据
|
||||||
|
if(staffReassignment == null || staffReassignment.getStatus() == StaffReassignmentEnum.ALREADY_REASSIGNMENT.getStatus()){
|
||||||
|
staffReassignment = new StaffReassignment();
|
||||||
|
}
|
||||||
|
staffReassignment.setTimeBefore(timeBefore);
|
||||||
|
staffReassignment.setDeductScore(deductScore.doubleValue());
|
||||||
|
staffReassignment.setStatus(StaffReassignmentEnum.ALREADY_REASSIGNMENT.getStatus());
|
||||||
|
//如果没有指派记录就新增一条记录
|
||||||
|
if(staffReassignment.getId() != null){
|
||||||
|
staffReassignmentMapper.updateById(staffReassignment);
|
||||||
|
}else{
|
||||||
|
staffReassignment.setSystemAuthAdminId((long)userId);
|
||||||
|
staffReassignment.setOrderId(model.getId());
|
||||||
|
staffReassignment.setStaffId(model.getStaffId());
|
||||||
|
staffReassignment.setCreateTime(TimeUtil.nowDate());
|
||||||
|
staffReassignmentMapper.insert(staffReassignment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
model.setIsDispatch(OrderDispatchEnum.IS_DISPATCH.getStatus());
|
model.setIsDispatch(OrderDispatchEnum.IS_DISPATCH.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
//model.setVerificationCode(SnUtils.getVerificationCode());
|
//model.setVerificationCode(SnUtils.getVerificationCode());
|
||||||
//model.setVerificationStatus(OrderVerificationStatusEnum.WAIT_VERIFICATION.getStatus());
|
//model.setVerificationStatus(OrderVerificationStatusEnum.WAIT_VERIFICATION.getStatus());
|
||||||
model.setUpdateTime(TimeUtil.timestamp());
|
model.setUpdateTime(TimeUtil.timestamp());
|
||||||
|
//指派新师傅
|
||||||
|
model.setStaffId(staffId);
|
||||||
orderMapper.updateById(model);
|
orderMapper.updateById(model);
|
||||||
this.saveOrderLog(id, userId.longValue(), OrderLogEnum.SHOP_DISPATCH_STAFF.getDesc(),RefundOperateEnum.TYPE_ADMIN.getType());
|
this.saveOrderLog(id, userId.longValue(), OrderLogEnum.SHOP_DISPATCH_STAFF.getDesc(),RefundOperateEnum.TYPE_ADMIN.getType());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.hcy.admin.service.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffApplyForParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffApplyForDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffApplyForListVo;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请服务接口类
|
||||||
|
*/
|
||||||
|
public interface IStaffApplyForService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffApplyForVo>
|
||||||
|
*/
|
||||||
|
PageResult<StaffApplyForListVo> list(PageParam pageParam, Map<String, String> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请详情
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return StaffApplyFor
|
||||||
|
*/
|
||||||
|
StaffApplyForDetailVo detail(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请新增
|
||||||
|
*
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
*/
|
||||||
|
void add(StaffApplyForParam staffApplyForParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请编辑
|
||||||
|
*
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
*/
|
||||||
|
void edit(StaffApplyForParam staffApplyForParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请删除
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
void del(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批师傅申请
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
*/
|
||||||
|
void checkStaffApplyFor(StaffApplyForParam staffApplyForParam);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.hcy.admin.service.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffFeedbackParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffFeedbackListVo;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述服务接口类
|
||||||
|
*/
|
||||||
|
public interface IStaffFeedbackService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffFeedbackVo>
|
||||||
|
*/
|
||||||
|
PageResult<StaffFeedbackListVo> list(PageParam pageParam, Map<String, String> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述删除
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
void del(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述审核
|
||||||
|
* @param staffFeedbackParam 参数
|
||||||
|
*/
|
||||||
|
void checkFeedback(StaffFeedbackParam staffFeedbackParam);
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.hcy.admin.service.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffApplyForParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffPhysicalExaminationParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffPhysicalExaminationDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffPhysicalExaminationListVo;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅体检报告申请服务接口类
|
||||||
|
*/
|
||||||
|
public interface IStaffPhysicalExaminationService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅体检报告申请列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffPhysicalExaminationVo>
|
||||||
|
*/
|
||||||
|
PageResult<StaffPhysicalExaminationListVo> list(PageParam pageParam, Map<String, String> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅体检报告申请详情
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return StaffPhysicalExamination
|
||||||
|
*/
|
||||||
|
StaffPhysicalExaminationDetailVo detail(Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批体检报告
|
||||||
|
* @param staffPhysicalExaminationParam 参数
|
||||||
|
*/
|
||||||
|
void checkApplyFor(StaffPhysicalExaminationParam staffPhysicalExaminationParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传体检报告
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
*/
|
||||||
|
void uploadPhysicalExamination(StaffApplyForParam staffApplyForParam);
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.hcy.admin.service.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffReassignmentParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffReassignmentDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffReassignmentListVo;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派服务接口类
|
||||||
|
*/
|
||||||
|
public interface IStaffReassignmentService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffReassignmentVo>
|
||||||
|
*/
|
||||||
|
PageResult<StaffReassignmentListVo> list(PageParam pageParam, Map<String, String> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派详情
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return StaffReassignment
|
||||||
|
*/
|
||||||
|
StaffReassignmentDetailVo detail(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派新增
|
||||||
|
*
|
||||||
|
* @param staffReassignmentParam 参数
|
||||||
|
*/
|
||||||
|
void add(StaffReassignmentParam staffReassignmentParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派编辑
|
||||||
|
*
|
||||||
|
* @param staffReassignmentParam 参数
|
||||||
|
*/
|
||||||
|
void edit(StaffReassignmentParam staffReassignmentParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派删除
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
void del(Long id);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.hcy.admin.service.staff;
|
||||||
|
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffListVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffPageParam;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import com.hcy.common.entity.staff.Staff;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅服务接口类
|
||||||
|
*/
|
||||||
|
public interface IStaffService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffVo>
|
||||||
|
*/
|
||||||
|
PageResult<StaffListVo> list(StaffPageParam params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅详情
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return Staff
|
||||||
|
*/
|
||||||
|
StaffDetailVo detail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅新增
|
||||||
|
*
|
||||||
|
* @param staffParam 参数
|
||||||
|
*/
|
||||||
|
void add(StaffParam staffParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成师傅编号
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
String generateNum();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅编辑
|
||||||
|
*
|
||||||
|
* @param staffParam 参数
|
||||||
|
*/
|
||||||
|
void edit(StaffParam staffParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅删除
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
void del(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改师傅接单状态
|
||||||
|
* @param staffParam 参数
|
||||||
|
*/
|
||||||
|
void status(StaffParam staffParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改接单状态
|
||||||
|
* @param staffParam 参数
|
||||||
|
*/
|
||||||
|
void receiveOrderStatus(StaffParam staffParam);
|
||||||
|
|
||||||
|
List<Staff> getByCityId(Long cityId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取没有体检报告的师傅
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 参数
|
||||||
|
* @return PageResult<StaffListVo>
|
||||||
|
*/
|
||||||
|
PageResult<StaffListVo> getNotPhysicalExaminationStaff(@Validated PageParam pageParam, Map<String, String> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新师傅运营状态
|
||||||
|
* @param staffParam 参数
|
||||||
|
*/
|
||||||
|
void updateStaffOperationalStatus(StaffParam staffParam);
|
||||||
|
}
|
|
@ -0,0 +1,226 @@
|
||||||
|
package com.hcy.admin.service.staff.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.hcy.admin.service.goods.IGoodsService;
|
||||||
|
import com.hcy.admin.service.region.IDevRegionService;
|
||||||
|
import com.hcy.admin.service.staff.IStaffApplyForService;
|
||||||
|
import com.hcy.admin.service.staff.IStaffService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffApplyForParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffApplyForDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffApplyForListVo;
|
||||||
|
import com.hcy.common.constant.GlobalConstant;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import com.hcy.common.entity.category.GoodsCategory;
|
||||||
|
import com.hcy.common.entity.staff.Staff;
|
||||||
|
import com.hcy.common.entity.staff.StaffApplyFor;
|
||||||
|
import com.hcy.common.enums.staff.StaffApplyForStatusEnum;
|
||||||
|
import com.hcy.common.enums.staff.StaffStatusEnum;
|
||||||
|
import com.hcy.common.exception.OperateException;
|
||||||
|
import com.hcy.common.mapper.category.GoodsCategoryMapper;
|
||||||
|
import com.hcy.common.mapper.staff.StaffApplyForMapper;
|
||||||
|
import com.hcy.common.mapper.staff.StaffMapper;
|
||||||
|
import com.hcy.common.utils.TimeUtil;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StaffApplyForServiceImpl implements IStaffApplyForService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
StaffApplyForMapper staffApplyForMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
StaffMapper staffMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IGoodsService goodsService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IDevRegionService regionService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IStaffService staffService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
GoodsCategoryMapper goodsCategoryMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffApplyForListVo>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<StaffApplyForListVo> list(PageParam pageParam, Map<String, String> params) {
|
||||||
|
Integer page = pageParam.getPageNo();
|
||||||
|
Integer limit = pageParam.getPageSize();
|
||||||
|
|
||||||
|
QueryWrapper<StaffApplyFor> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("is_delete", GlobalConstant.NOT_DELETE);
|
||||||
|
if(!params.get("name").isEmpty()){
|
||||||
|
queryWrapper.like("name",params.get("name"));
|
||||||
|
}
|
||||||
|
if(!params.get("status").isEmpty()){
|
||||||
|
queryWrapper.eq("status",params.get("status"));
|
||||||
|
}
|
||||||
|
if(!params.get("createTimeStart").isEmpty()){
|
||||||
|
queryWrapper.ge("create_time",params.get("createTimeStart"));
|
||||||
|
queryWrapper.le("create_time",params.get("createTimeEnd"));
|
||||||
|
}
|
||||||
|
queryWrapper.orderByDesc("create_time");
|
||||||
|
|
||||||
|
|
||||||
|
IPage<StaffApplyFor> iPage = staffApplyForMapper.selectPage(new Page<>(page, limit), queryWrapper);
|
||||||
|
|
||||||
|
List<StaffApplyForListVo> list = new LinkedList<>();
|
||||||
|
for(StaffApplyFor item : iPage.getRecords()) {
|
||||||
|
StaffApplyForListVo vo = new StaffApplyForListVo();
|
||||||
|
BeanUtils.copyProperties(item, vo);
|
||||||
|
list.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请详情
|
||||||
|
*
|
||||||
|
* @param id 主键参数
|
||||||
|
* @return StaffApplyFor
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public StaffApplyForDetailVo detail(Integer id) {
|
||||||
|
StaffApplyFor model = staffApplyForMapper.selectOne(new QueryWrapper<StaffApplyFor>()
|
||||||
|
.eq("id", id)
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
Assert.notNull(model, "数据不存在");
|
||||||
|
|
||||||
|
StaffApplyForDetailVo vo = new StaffApplyForDetailVo();
|
||||||
|
BeanUtils.copyProperties(model, vo);
|
||||||
|
|
||||||
|
Map<Long, String> regionMap = regionService.getRegionMap();
|
||||||
|
vo.setProvince(regionMap.get(vo.getProvinceId()));
|
||||||
|
vo.setCity(regionMap.get(vo.getCityId()));
|
||||||
|
vo.setDistrict(regionMap.get(vo.getDistrictId()));
|
||||||
|
|
||||||
|
//组装师傅服务信息
|
||||||
|
/*List<Long> resultList = (List<Long>) CollectionUtils.collect(Arrays.asList(model.getGoodsIds().split(",")), Long::valueOf);
|
||||||
|
List<GoodsDetailVo> goodsDetailVoList = goodsService.detailByIds(resultList);
|
||||||
|
vo.setGoodsDetailVos(goodsDetailVoList);*/
|
||||||
|
//组装师傅服务类目信息
|
||||||
|
List<Long> goodsCategoryIds = (List<Long>) CollectionUtils.collect(Arrays.asList(model.getGoodsCategoryIds().split(",")), Long::valueOf);
|
||||||
|
List<GoodsCategory> goodsCategoryList = goodsCategoryMapper.listByIds(goodsCategoryIds);
|
||||||
|
vo.setGoodsDetailVos(goodsCategoryList);
|
||||||
|
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请新增
|
||||||
|
*
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(StaffApplyForParam staffApplyForParam) {
|
||||||
|
StaffApplyFor model = new StaffApplyFor();
|
||||||
|
model.setUserId(staffApplyForParam.getUserId());
|
||||||
|
model.setStatus(staffApplyForParam.getStatus());
|
||||||
|
model.setRefuseReason(staffApplyForParam.getRefuseReason());
|
||||||
|
staffApplyForMapper.insert(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请编辑
|
||||||
|
*
|
||||||
|
* @param staffApplyForParam 参数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void edit(StaffApplyForParam staffApplyForParam) {
|
||||||
|
StaffApplyFor model = staffApplyForMapper.selectOne(
|
||||||
|
new QueryWrapper<StaffApplyFor>()
|
||||||
|
.eq("id", staffApplyForParam.getId())
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Assert.notNull(model, "数据不存在!");
|
||||||
|
|
||||||
|
model.setId(staffApplyForParam.getId());
|
||||||
|
model.setUserId(staffApplyForParam.getUserId());
|
||||||
|
model.setStatus(staffApplyForParam.getStatus());
|
||||||
|
model.setRefuseReason(staffApplyForParam.getRefuseReason());
|
||||||
|
staffApplyForMapper.updateById(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申请删除
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void del(Long id) {
|
||||||
|
StaffApplyFor model = staffApplyForMapper.selectOne(
|
||||||
|
new QueryWrapper<StaffApplyFor>()
|
||||||
|
.eq("id", id)
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Assert.notNull(model, "数据不存在!");
|
||||||
|
|
||||||
|
model.setIsDelete(1);
|
||||||
|
staffApplyForMapper.updateById(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void checkStaffApplyFor(StaffApplyForParam staffApplyForParam) {
|
||||||
|
if(staffApplyForParam.getStatus() != StaffApplyForStatusEnum.APPLICATION_IS_APPROVED.getCode() &&
|
||||||
|
staffApplyForParam.getStatus() != StaffApplyForStatusEnum.REFUSE.getCode()){
|
||||||
|
throw new OperateException("非法审核状态");
|
||||||
|
}
|
||||||
|
|
||||||
|
StaffApplyFor model = staffApplyForMapper.selectOne(
|
||||||
|
new QueryWrapper<StaffApplyFor>()
|
||||||
|
.eq("id", staffApplyForParam.getId())
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.last("limit 1"));
|
||||||
|
Assert.notNull(model, "数据不存在!");
|
||||||
|
|
||||||
|
//审核通过
|
||||||
|
if(staffApplyForParam.getStatus() == StaffApplyForStatusEnum.APPLICATION_IS_APPROVED.getCode()){
|
||||||
|
model.setStatus(StaffApplyForStatusEnum.APPLICATION_IS_APPROVED.getCode());
|
||||||
|
staffApplyForMapper.updateById(model);
|
||||||
|
|
||||||
|
Staff staff = new Staff();
|
||||||
|
BeanUtils.copyProperties(model,staff);
|
||||||
|
//实名认证
|
||||||
|
staff.setId(null);
|
||||||
|
staff.setIsAuthentication(StaffStatusEnum.AUTHENTICATION.getCode());
|
||||||
|
staff.setCreateTime(TimeUtil.nowDate());
|
||||||
|
staff.setSn(staffService.generateNum());
|
||||||
|
staffMapper.insert(staff);
|
||||||
|
}else{
|
||||||
|
//拒绝
|
||||||
|
model.setRefuseReason(staffApplyForParam.getRefuseReason());
|
||||||
|
model.setStatus(staffApplyForParam.getStatus());
|
||||||
|
staffApplyForMapper.updateById(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.hcy.admin.service.staff.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.hcy.admin.service.staff.IStaffFeedbackService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffFeedbackParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffFeedbackListVo;
|
||||||
|
import com.hcy.common.constant.GlobalConstant;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import com.hcy.common.dto.result.StaffFeedbackResultDto;
|
||||||
|
import com.hcy.common.dto.staff.StaffFeedbackDto;
|
||||||
|
import com.hcy.common.entity.staff.StaffFeedback;
|
||||||
|
import com.hcy.common.enums.staff.StaffFeedbackEnum;
|
||||||
|
import com.hcy.common.exception.OperateException;
|
||||||
|
import com.hcy.common.mapper.staff.StaffFeedbackMapper;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StaffFeedbackServiceImpl implements IStaffFeedbackService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
StaffFeedbackMapper staffFeedbackMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffFeedbackListVo>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<StaffFeedbackListVo> list(PageParam pageParam, Map<String, String> params) {
|
||||||
|
Integer page = pageParam.getPageNo();
|
||||||
|
Integer limit = pageParam.getPageSize();
|
||||||
|
|
||||||
|
StaffFeedbackDto staffFeedbackDto = new StaffFeedbackDto();
|
||||||
|
if(!params.get("staffInfo").isEmpty()){
|
||||||
|
staffFeedbackDto.setStaffInfo(params.get("staffInfo"));
|
||||||
|
}
|
||||||
|
if(!params.get("status").isEmpty()){
|
||||||
|
staffFeedbackDto.setStatus(params.get("status"));
|
||||||
|
}
|
||||||
|
if(!params.get("createTimeStart").isEmpty() && !params.get("createTimeEnd").isEmpty()){
|
||||||
|
staffFeedbackDto.setCreateTimeStart(params.get("createTimeStart"));
|
||||||
|
staffFeedbackDto.setCreateTimeEnd(params.get("createTimeEnd"));
|
||||||
|
}
|
||||||
|
IPage<StaffFeedbackResultDto> iPage = staffFeedbackMapper.list(new Page<>(page, limit), staffFeedbackDto);
|
||||||
|
|
||||||
|
List<StaffFeedbackListVo> list = new LinkedList<>();
|
||||||
|
for(StaffFeedbackResultDto item : iPage.getRecords()) {
|
||||||
|
StaffFeedbackListVo vo = new StaffFeedbackListVo();
|
||||||
|
BeanUtils.copyProperties(item, vo);
|
||||||
|
vo.setCreateTime(item.getCreateTime());
|
||||||
|
list.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅申述删除
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void del(Long id) {
|
||||||
|
StaffFeedback model = staffFeedbackMapper.selectOne(
|
||||||
|
new QueryWrapper<StaffFeedback>()
|
||||||
|
.eq("id", id)
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.last("limit 1"));
|
||||||
|
Assert.notNull(model, "申述不存在!");
|
||||||
|
|
||||||
|
model.setIsDelete(GlobalConstant.DELETE);
|
||||||
|
staffFeedbackMapper.updateById(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkFeedback(StaffFeedbackParam staffFeedbackParam) {
|
||||||
|
if(staffFeedbackParam.getStatus() == null || staffFeedbackParam.getStatus() ==
|
||||||
|
StaffFeedbackEnum.IN_THE_APPLICATION.getCode()){
|
||||||
|
throw new OperateException("审核状态异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
StaffFeedback staffFeedback = staffFeedbackMapper.findStaffFeedback(staffFeedbackParam.getId());
|
||||||
|
Assert.notNull(staffFeedback,"申述不存在!");
|
||||||
|
|
||||||
|
//审核失败 设置回复内容
|
||||||
|
if(staffFeedbackParam.getStatus() == StaffFeedbackEnum.REFUSE.getCode()){
|
||||||
|
staffFeedback.setReply(staffFeedbackParam.getReply());
|
||||||
|
}
|
||||||
|
staffFeedback.setStatus(staffFeedbackParam.getStatus());
|
||||||
|
|
||||||
|
staffFeedbackMapper.updateById(staffFeedback);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,166 @@
|
||||||
|
package com.hcy.admin.service.staff.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.hcy.admin.service.staff.IStaffPhysicalExaminationService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffApplyForParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffPhysicalExaminationParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffPhysicalExaminationDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffPhysicalExaminationListVo;
|
||||||
|
import com.hcy.common.constant.GlobalConstant;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import com.hcy.common.dto.staff.StaffPhysicalExaminationDto;
|
||||||
|
import com.hcy.common.entity.staff.Staff;
|
||||||
|
import com.hcy.common.entity.staff.StaffPhysicalExamination;
|
||||||
|
import com.hcy.common.enums.staff.StaffApplyForStatusEnum;
|
||||||
|
import com.hcy.common.exception.OperateException;
|
||||||
|
import com.hcy.common.mapper.staff.StaffMapper;
|
||||||
|
import com.hcy.common.mapper.staff.StaffPhysicalExaminationMapper;
|
||||||
|
import com.hcy.common.utils.StringUtil;
|
||||||
|
import com.hcy.common.utils.TimeUtil;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅体检报告申请实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StaffPhysicalExaminationServiceImpl implements IStaffPhysicalExaminationService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
StaffPhysicalExaminationMapper staffPhysicalExaminationMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
StaffMapper staffMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅体检报告申请列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffPhysicalExaminationListVo>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<StaffPhysicalExaminationListVo> list(PageParam pageParam, Map<String, String> params) {
|
||||||
|
Integer page = pageParam.getPageNo();
|
||||||
|
Integer limit = pageParam.getPageSize();
|
||||||
|
|
||||||
|
StaffPhysicalExaminationDto dto = new StaffPhysicalExaminationDto();
|
||||||
|
if(!params.get("name").isEmpty()){
|
||||||
|
dto.setName(params.get("name"));
|
||||||
|
}
|
||||||
|
if(!params.get("status").isEmpty()){
|
||||||
|
dto.setStatus(params.get("status"));
|
||||||
|
}
|
||||||
|
if(!params.get("createTimeStart").isEmpty()){
|
||||||
|
dto.setCreateTimeStart(params.get("createTimeStart"));
|
||||||
|
dto.setCreateTimeEnd(params.get("createTimeEnd"));
|
||||||
|
}
|
||||||
|
|
||||||
|
IPage<StaffPhysicalExamination> iPage = staffPhysicalExaminationMapper.list(new Page<>(page, limit), dto);
|
||||||
|
|
||||||
|
List<StaffPhysicalExaminationListVo> list = new LinkedList<>();
|
||||||
|
for(StaffPhysicalExamination item : iPage.getRecords()) {
|
||||||
|
StaffPhysicalExaminationListVo vo = new StaffPhysicalExaminationListVo();
|
||||||
|
BeanUtils.copyProperties(item, vo);
|
||||||
|
vo.setCreateTime(item.getCreateTime());
|
||||||
|
|
||||||
|
Staff staff = staffMapper.selectById(item.getStaffId());
|
||||||
|
if(staff != null){
|
||||||
|
vo.setStaffName(staff.getName());
|
||||||
|
}
|
||||||
|
list.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅体检报告申请详情
|
||||||
|
*
|
||||||
|
* @param id 主键参数
|
||||||
|
* @return StaffPhysicalExamination
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public StaffPhysicalExaminationDetailVo detail(Integer id) {
|
||||||
|
StaffPhysicalExamination model = staffPhysicalExaminationMapper.selectOne(
|
||||||
|
new QueryWrapper<StaffPhysicalExamination>()
|
||||||
|
.eq("id", id)
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Assert.notNull(model, "数据不存在");
|
||||||
|
|
||||||
|
StaffPhysicalExaminationDetailVo vo = new StaffPhysicalExaminationDetailVo();
|
||||||
|
BeanUtils.copyProperties(model, vo);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkApplyFor(StaffPhysicalExaminationParam staffPhysicalExaminationParam) {
|
||||||
|
if(staffPhysicalExaminationParam.getStatus() != StaffApplyForStatusEnum.APPLICATION_IS_APPROVED.getCode() &&
|
||||||
|
staffPhysicalExaminationParam.getStatus() != StaffApplyForStatusEnum.REFUSE.getCode()){
|
||||||
|
throw new OperateException("非法审核状态");
|
||||||
|
}
|
||||||
|
|
||||||
|
StaffPhysicalExamination model = staffPhysicalExaminationMapper.selectOne(
|
||||||
|
new QueryWrapper<StaffPhysicalExamination>()
|
||||||
|
.eq("id", staffPhysicalExaminationParam.getId())
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.last("limit 1"));
|
||||||
|
Assert.notNull(model, "数据不存在!");
|
||||||
|
|
||||||
|
//审核通过
|
||||||
|
if(staffPhysicalExaminationParam.getStatus() == StaffApplyForStatusEnum.APPLICATION_IS_APPROVED.getCode()){
|
||||||
|
model.setStatus(StaffApplyForStatusEnum.APPLICATION_IS_APPROVED.getCode());
|
||||||
|
staffPhysicalExaminationMapper.updateById(model);
|
||||||
|
|
||||||
|
Staff staff = staffMapper.selectOne(new QueryWrapper<Staff>()
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.eq("id", model.getStaffId()));
|
||||||
|
//实名认证
|
||||||
|
staff.setPhysicalExamination(model.getPhysicalExamination());
|
||||||
|
staff.setUpdateTime(TimeUtil.nowDate());
|
||||||
|
staffMapper.updateById(staff);
|
||||||
|
}else{
|
||||||
|
//拒绝
|
||||||
|
model.setRefuseReason(staffPhysicalExaminationParam.getRefuseReason());
|
||||||
|
model.setStatus(staffPhysicalExaminationParam.getStatus());
|
||||||
|
staffPhysicalExaminationMapper.updateById(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void uploadPhysicalExamination(StaffApplyForParam staffApplyForParam) {
|
||||||
|
Staff staff = staffMapper.selectOne(new QueryWrapper<Staff>()
|
||||||
|
.eq("id", staffApplyForParam.getStaffId())
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE));
|
||||||
|
Assert.notNull(staff,"未进行实名认证不可提交体检报告");
|
||||||
|
|
||||||
|
//组装体检报告
|
||||||
|
StringBuilder physicalExamination = new StringBuilder();
|
||||||
|
if(!staffApplyForParam.getFiles().getPdf().isEmpty()){
|
||||||
|
physicalExamination.append(staffApplyForParam.getFiles().getPdf().get(0));
|
||||||
|
}
|
||||||
|
for (String img : staffApplyForParam.getFiles().getReport()) {
|
||||||
|
if(StringUtil.isNotEmpty(physicalExamination.toString())){
|
||||||
|
physicalExamination.append(",").append(img);
|
||||||
|
}else{
|
||||||
|
physicalExamination.append(img);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
staff.setPhysicalExamination(physicalExamination.toString());
|
||||||
|
staffMapper.updateById(staff);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,180 @@
|
||||||
|
package com.hcy.admin.service.staff.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.hcy.admin.service.staff.IStaffReassignmentService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffReassignmentParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffReassignmentDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffReassignmentListVo;
|
||||||
|
import com.hcy.common.constant.GlobalConstant;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import com.hcy.common.dto.result.StaffReassignmentResultDto;
|
||||||
|
import com.hcy.common.dto.staff.StaffReassignmentDto;
|
||||||
|
import com.hcy.common.entity.staff.StaffReassignment;
|
||||||
|
import com.hcy.common.entity.system.SystemAuthAdmin;
|
||||||
|
import com.hcy.common.entity.user.User;
|
||||||
|
import com.hcy.common.mapper.staff.StaffReassignmentMapper;
|
||||||
|
import com.hcy.common.mapper.system.SystemAuthAdminMapper;
|
||||||
|
import com.hcy.common.mapper.user.UserMapper;
|
||||||
|
import com.hcy.common.utils.UrlUtil;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StaffReassignmentServiceImpl implements IStaffReassignmentService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
StaffReassignmentMapper staffReassignmentMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
UserMapper userMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
SystemAuthAdminMapper systemAuthAdminMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffReassignmentListVo>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<StaffReassignmentListVo> list(PageParam pageParam, Map<String, String> params) {
|
||||||
|
Integer page = pageParam.getPageNo();
|
||||||
|
Integer limit = pageParam.getPageSize();
|
||||||
|
|
||||||
|
StaffReassignmentDto dto = new StaffReassignmentDto();
|
||||||
|
dto.setOrderSn(params.get("orderSn"));
|
||||||
|
dto.setUserMobile(params.get("userMobile"));
|
||||||
|
dto.setGoodsName(params.get("goodsName"));
|
||||||
|
dto.setStaffInfo(params.get("staffInfo"));
|
||||||
|
dto.setCreateTimeStart(params.get("createTimeStart"));
|
||||||
|
dto.setCreateTimeEnd(params.get("createTimeEnd"));
|
||||||
|
if(!params.get("status").isEmpty()){
|
||||||
|
dto.setStatus(Integer.parseInt(params.get("status")));
|
||||||
|
}
|
||||||
|
|
||||||
|
IPage<StaffReassignmentResultDto> iPage = staffReassignmentMapper.list(new Page<>(page, limit), dto);
|
||||||
|
|
||||||
|
List<StaffReassignmentListVo> list = new LinkedList<>();
|
||||||
|
for(StaffReassignmentResultDto item : iPage.getRecords()) {
|
||||||
|
StaffReassignmentListVo vo = new StaffReassignmentListVo();
|
||||||
|
BeanUtils.copyProperties(item, vo);
|
||||||
|
|
||||||
|
if(item.getUserId() != null){
|
||||||
|
User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
|
||||||
|
.eq(User::getIsDelete, GlobalConstant.NOT_DELETE)
|
||||||
|
.eq(User::getId, item.getUserId()));
|
||||||
|
vo.setMobile(user.getMobile());
|
||||||
|
vo.setAvatar(UrlUtil.toAbsoluteUrl(user.getAvatar()));
|
||||||
|
vo.setNickname(user.getNickname());
|
||||||
|
vo.setUserSn(user.getSn().toString());
|
||||||
|
}else{
|
||||||
|
SystemAuthAdmin systemAuthAdmin = systemAuthAdminMapper.selectById(item.getSystemAuthAdminId());
|
||||||
|
vo.setAvatar(UrlUtil.toAbsoluteUrl(systemAuthAdmin.getAvatar()));
|
||||||
|
vo.setNickname(systemAuthAdmin.getNickname());
|
||||||
|
}
|
||||||
|
|
||||||
|
vo.setCreateTime(item.getCreateTime());
|
||||||
|
list.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派详情
|
||||||
|
*
|
||||||
|
* @param id 主键参数
|
||||||
|
* @return StaffReassignment
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public StaffReassignmentDetailVo detail(Integer id) {
|
||||||
|
StaffReassignment model = staffReassignmentMapper.selectOne(
|
||||||
|
new QueryWrapper<StaffReassignment>()
|
||||||
|
.eq("id", id)
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Assert.notNull(model, "数据不存在");
|
||||||
|
|
||||||
|
StaffReassignmentDetailVo vo = new StaffReassignmentDetailVo();
|
||||||
|
BeanUtils.copyProperties(model, vo);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派新增
|
||||||
|
*
|
||||||
|
* @param staffReassignmentParam 参数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(StaffReassignmentParam staffReassignmentParam) {
|
||||||
|
StaffReassignment model = new StaffReassignment();
|
||||||
|
model.setOrderId(staffReassignmentParam.getOrderId());
|
||||||
|
model.setUserId(staffReassignmentParam.getUserId());
|
||||||
|
model.setStaffId(staffReassignmentParam.getStaffId());
|
||||||
|
model.setTimeBefore(staffReassignmentParam.getTimeBefore());
|
||||||
|
model.setDeductScore(staffReassignmentParam.getDeductScore());
|
||||||
|
model.setStatus(staffReassignmentParam.getStatus());
|
||||||
|
staffReassignmentMapper.insert(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派编辑
|
||||||
|
*
|
||||||
|
* @param staffReassignmentParam 参数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void edit(StaffReassignmentParam staffReassignmentParam) {
|
||||||
|
StaffReassignment model = staffReassignmentMapper.selectOne(
|
||||||
|
new QueryWrapper<StaffReassignment>()
|
||||||
|
.eq("id", staffReassignmentParam.getId())
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Assert.notNull(model, "数据不存在!");
|
||||||
|
|
||||||
|
model.setId(staffReassignmentParam.getId());
|
||||||
|
model.setOrderId(staffReassignmentParam.getOrderId());
|
||||||
|
model.setUserId(staffReassignmentParam.getUserId());
|
||||||
|
model.setStaffId(staffReassignmentParam.getStaffId());
|
||||||
|
model.setTimeBefore(staffReassignmentParam.getTimeBefore());
|
||||||
|
model.setDeductScore(staffReassignmentParam.getDeductScore());
|
||||||
|
model.setStatus(staffReassignmentParam.getStatus());
|
||||||
|
staffReassignmentMapper.updateById(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅改派删除
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void del(Long id) {
|
||||||
|
StaffReassignment model = staffReassignmentMapper.selectOne(
|
||||||
|
new QueryWrapper<StaffReassignment>()
|
||||||
|
.eq("id", id)
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Assert.notNull(model, "数据不存在!");
|
||||||
|
|
||||||
|
model.setIsDelete(1);
|
||||||
|
staffReassignmentMapper.updateById(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,458 @@
|
||||||
|
package com.hcy.admin.service.staff.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.hcy.admin.service.goods.IGoodsService;
|
||||||
|
import com.hcy.admin.service.order.IOrderService;
|
||||||
|
import com.hcy.admin.service.region.IDevRegionService;
|
||||||
|
import com.hcy.admin.service.staff.IStaffService;
|
||||||
|
import com.hcy.admin.service.user.IUserService;
|
||||||
|
import com.hcy.admin.validate.common.PageParam;
|
||||||
|
import com.hcy.admin.validate.staff.StaffParam;
|
||||||
|
import com.hcy.admin.vo.staff.StaffDetailVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffListVo;
|
||||||
|
import com.hcy.admin.vo.staff.StaffPageParam;
|
||||||
|
import com.hcy.common.constant.GlobalConstant;
|
||||||
|
import com.hcy.common.core.PageResult;
|
||||||
|
import com.hcy.common.dto.result.StaffResultDto;
|
||||||
|
import com.hcy.common.dto.staff.StaffDto;
|
||||||
|
import com.hcy.common.entity.category.GoodsCategory;
|
||||||
|
import com.hcy.common.entity.comment.GoodsComment;
|
||||||
|
import com.hcy.common.entity.staff.Staff;
|
||||||
|
import com.hcy.common.entity.staff.StaffApplyFor;
|
||||||
|
import com.hcy.common.entity.staff.StaffCommission;
|
||||||
|
import com.hcy.common.entity.staff.StaffPhysicalExamination;
|
||||||
|
import com.hcy.common.enums.RecommendEnum;
|
||||||
|
import com.hcy.common.enums.StatusEnum;
|
||||||
|
import com.hcy.common.enums.staff.StaffApplyForStatusEnum;
|
||||||
|
import com.hcy.common.enums.staff.StaffCommissionStatusEnum;
|
||||||
|
import com.hcy.common.enums.staff.StaffStatusEnum;
|
||||||
|
import com.hcy.common.exception.OperateException;
|
||||||
|
import com.hcy.common.mapper.category.GoodsCategoryMapper;
|
||||||
|
import com.hcy.common.mapper.comment.GoodsCommentMapper;
|
||||||
|
import com.hcy.common.mapper.staff.StaffApplyForMapper;
|
||||||
|
import com.hcy.common.mapper.staff.StaffCommissionMapper;
|
||||||
|
import com.hcy.common.mapper.staff.StaffMapper;
|
||||||
|
import com.hcy.common.mapper.staff.StaffPhysicalExaminationMapper;
|
||||||
|
import com.hcy.common.utils.RegularExpressionUtil;
|
||||||
|
import com.hcy.common.utils.StringUtil;
|
||||||
|
import com.hcy.common.utils.TimeUtil;
|
||||||
|
import com.hcy.common.utils.UrlUtil;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements IStaffService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StaffMapper staffMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IDevRegionService regionService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IUserService userService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGoodsService goodsService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IOrderService orderService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StaffApplyForMapper staffApplyForMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StaffCommissionMapper staffCommissionMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StaffPhysicalExaminationMapper staffPhysicalExaminationMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GoodsCommentMapper goodsCommentMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
GoodsCategoryMapper goodsCategoryMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅列表
|
||||||
|
*
|
||||||
|
* @param params 搜索参数
|
||||||
|
* @return PageResult<StaffListVo>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<StaffListVo> list(StaffPageParam params) {
|
||||||
|
Page<StaffListVo> page = new Page<>(params.getPageNo(), params.getPageSize());
|
||||||
|
StaffDto pageDto = new StaffDto();
|
||||||
|
BeanUtils.copyProperties(params, pageDto);
|
||||||
|
if(pageDto.getAppointTimeStart() != null && pageDto.getAppointTimeEnd() != null){
|
||||||
|
long time = 60 * 60;
|
||||||
|
//指派师傅时查询服务时间前后一个小时是否有交叉的订单
|
||||||
|
pageDto.setAppointTimeStart(pageDto.getAppointTimeStart() - time);
|
||||||
|
pageDto.setAppointTimeEnd(pageDto.getAppointTimeEnd() + time);
|
||||||
|
}
|
||||||
|
Page<StaffResultDto> resultDtoPage = staffMapper.page(page, pageDto);
|
||||||
|
if (resultDtoPage == null || CollectionUtils.isEmpty(resultDtoPage.getRecords())) {
|
||||||
|
return PageResult.iPageHandle(0L, page.getCurrent(), page.getSize(), Lists.newArrayList());
|
||||||
|
}
|
||||||
|
List<StaffListVo> list = new LinkedList<>();
|
||||||
|
Map<Long, String> regionMap = regionService.getRegionMap();
|
||||||
|
Map<Integer, String> recommendMap = RecommendEnum.getMap();
|
||||||
|
Map<Integer, String> statusMap = StatusEnum.getMap();
|
||||||
|
for (StaffResultDto item : resultDtoPage.getRecords()) {
|
||||||
|
StaffListVo vo = new StaffListVo();
|
||||||
|
BeanUtils.copyProperties(item, vo);
|
||||||
|
vo.setStatusName(statusMap.get(vo.getStatus()));
|
||||||
|
vo.setIsRecommendName(recommendMap.get(vo.getIsRecommend()));
|
||||||
|
vo.setProvince(regionMap.get(vo.getProvinceId()));
|
||||||
|
vo.setCity(regionMap.get(vo.getCityId()));
|
||||||
|
vo.setDistrict(regionMap.get(vo.getDistrictId()));
|
||||||
|
vo.setAvatarUrl(UrlUtil.toAbsoluteUrl(item.getAvatarUri()));
|
||||||
|
vo.setPhysicalExamination(item.getPhysicalExamination());
|
||||||
|
//获取待结算金额
|
||||||
|
vo.setToBeSettledMoney(getToBeSettledMoney(item.getId()));
|
||||||
|
list.add(vo);
|
||||||
|
}
|
||||||
|
return PageResult.iPageHandle(resultDtoPage.getTotal(), resultDtoPage.getCurrent(), resultDtoPage.getSize(), list);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal getToBeSettledMoney(Long staffId){
|
||||||
|
return staffCommissionMapper.sum("commission", new QueryWrapper<StaffCommission>()
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.eq("staff_id", staffId)
|
||||||
|
.eq("status", 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅详情
|
||||||
|
*
|
||||||
|
* @param id 主键参数
|
||||||
|
* @return Staff
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public StaffDetailVo detail(Long id) {
|
||||||
|
Staff model = staffMapper.selectOne(
|
||||||
|
new QueryWrapper<Staff>()
|
||||||
|
.eq("id", id)
|
||||||
|
.last("limit 1"));
|
||||||
|
Assert.notNull(model, "数据不存在");
|
||||||
|
StaffDetailVo vo = new StaffDetailVo();
|
||||||
|
BeanUtils.copyProperties(model, vo);
|
||||||
|
Map<Long, String> regionMap = regionService.getRegionMap();
|
||||||
|
vo.setProvince(regionMap.get(vo.getProvinceId()));
|
||||||
|
vo.setCity(regionMap.get(vo.getCityId()));
|
||||||
|
vo.setDistrict(regionMap.get(vo.getDistrictId()));
|
||||||
|
vo.setStatusName(StatusEnum.getMap().get(vo.getStatus()));
|
||||||
|
vo.setIsRecommendName(RecommendEnum.getMap().get(vo.getIsRecommend()));
|
||||||
|
vo.setUserVo(userService.detail(model.getUserId().intValue()));
|
||||||
|
vo.setCreateTime(model.getCreateTime());
|
||||||
|
vo.setUpdateTime(model.getUpdateTime());
|
||||||
|
|
||||||
|
/*List<Long> goodsIds = Lists.newArrayList();
|
||||||
|
List<String> goodsIdsStr = Arrays.asList(StringUtils.split(model.getGoodsIds(), ","));
|
||||||
|
CollectionUtils.collect(goodsIdsStr, input -> Long.valueOf(input.toString()), goodsIds);
|
||||||
|
List<GoodsDetailVo> goodsDetailVoList = goodsService.detailByIds(goodsIds);
|
||||||
|
vo.setGoodsList(goodsDetailVoList);*/
|
||||||
|
//组装服务分类
|
||||||
|
List<Long> goodsCategoryIds = Lists.newArrayList();
|
||||||
|
List<String> goodsCategoryIdsStr = Arrays.asList(StringUtils.split(model.getGoodsCategoryIds(), ","));
|
||||||
|
CollectionUtils.collect(goodsCategoryIdsStr, input -> Long.valueOf(input.toString()), goodsCategoryIds);
|
||||||
|
List<GoodsCategory> goodsCategories = goodsCategoryMapper.listByIds(goodsCategoryIds);
|
||||||
|
vo.setGoodsCategoryList(goodsCategories);
|
||||||
|
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅新增
|
||||||
|
*
|
||||||
|
* @param staffParam 参数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void add(StaffParam staffParam) {
|
||||||
|
Assert.notNull(staffParam.getUserId(),"请选择绑定的用户");
|
||||||
|
|
||||||
|
//校验数据完整性
|
||||||
|
if(!RegularExpressionUtil.checkIdCard(staffParam.getIdCard())){
|
||||||
|
throw new OperateException("身份证格式错误");
|
||||||
|
}else if(!RegularExpressionUtil.checkPhone(staffParam.getMobile())){
|
||||||
|
throw new OperateException("无效手机号码");
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增师傅
|
||||||
|
Staff staff = new Staff();
|
||||||
|
BeanUtils.copyProperties(staffParam,staff);
|
||||||
|
staff.setHeadPortrait(staffParam.getFiles().getAvatar().get(0));
|
||||||
|
staff.setIdCardImg(staffParam.getFiles().getPortrait().get(0) + "," + staffParam.getFiles().getBackend().get(0));
|
||||||
|
StringBuilder physicalExamination = new StringBuilder();
|
||||||
|
if(!staffParam.getFiles().getPdf().isEmpty()){
|
||||||
|
physicalExamination.append(staffParam.getFiles().getPdf().get(0));
|
||||||
|
}
|
||||||
|
if(staffParam.getFiles().getReport() != null){
|
||||||
|
for (String img : staffParam.getFiles().getReport()) {
|
||||||
|
if(StringUtil.isNotEmpty(physicalExamination.toString())){
|
||||||
|
physicalExamination.append(",").append(img);
|
||||||
|
}else{
|
||||||
|
physicalExamination.append(img);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
staff.setIsAuthentication(StaffStatusEnum.AUTHENTICATION.getCode());
|
||||||
|
staff.setCreateTime(TimeUtil.nowDate());
|
||||||
|
staff.setSn(generateNum());
|
||||||
|
staff.setPhysicalExamination(physicalExamination.toString());
|
||||||
|
staff.setCreateTime(TimeUtil.nowDate());
|
||||||
|
staff.setStatus(StaffApplyForStatusEnum.IN_THE_APPLICATION.getCode());
|
||||||
|
if(staff.getIsOperational() != null){
|
||||||
|
staff.setIsOperational(staffParam.getIsOperational());
|
||||||
|
staff.setWorkStartTime(staffParam.getWorkStartTime());
|
||||||
|
staff.setWorkEndTime(staffParam.getWorkEndTime());
|
||||||
|
}
|
||||||
|
staffMapper.insert(staff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成师傅编号
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String generateNum() {
|
||||||
|
int count = staffMapper.selectCount(new QueryWrapper<Staff>()
|
||||||
|
.last("where DATE(create_time) = DATE(NOW())")) + 1;
|
||||||
|
String number;
|
||||||
|
if(count < 1000){
|
||||||
|
number = String.format("%03d", count);
|
||||||
|
}else{
|
||||||
|
number = Integer.toString(count);
|
||||||
|
}
|
||||||
|
return TimeUtil.timestampToDate(TimeUtil.timestamp(), "yyMMdd") + number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅编辑
|
||||||
|
*
|
||||||
|
* @param staffParam 参数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void edit(StaffParam staffParam) {
|
||||||
|
Staff model = staffMapper.selectOne(
|
||||||
|
new QueryWrapper<Staff>()
|
||||||
|
.eq("id", staffParam.getId())
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
Assert.notNull(model, "数据不存在!");
|
||||||
|
Staff staff = staffMapper.selectOne(new QueryWrapper<Staff>()
|
||||||
|
.eq("sn", staffParam.getSn())
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
Assert.isTrue(staff == null || staff.getId().longValue() == model.getId().longValue(), "师傅编号重复!");
|
||||||
|
model.setId(staffParam.getId());
|
||||||
|
model.setUserId(staffParam.getUserId());
|
||||||
|
model.setSn(staffParam.getSn());
|
||||||
|
model.setName(staffParam.getName());
|
||||||
|
model.setSex(staffParam.getSex());
|
||||||
|
model.setMobile(staffParam.getMobile());
|
||||||
|
model.setGoodsCategoryIds(staffParam.getGoodsCategoryIds());
|
||||||
|
model.setProvinceId(staffParam.getProvinceId());
|
||||||
|
model.setCityId(staffParam.getCityId());
|
||||||
|
model.setDistrictId(staffParam.getDistrictId());
|
||||||
|
model.setAddress(staffParam.getAddress());
|
||||||
|
model.setLongitude(staffParam.getLongitude());
|
||||||
|
model.setLatitude(staffParam.getLatitude());
|
||||||
|
model.setStatus(staffParam.getStatus());
|
||||||
|
model.setIsRecommend(staffParam.getIsRecommend());
|
||||||
|
model.setUpdateTime(TimeUtil.nowDate());
|
||||||
|
model.setIsReceiveOrder(staffParam.getIsReceiveOrder());
|
||||||
|
model.setIsOperational(staffParam.getIsOperational());
|
||||||
|
model.setWorkStartTime(staffParam.getWorkStartTime());
|
||||||
|
model.setWorkEndTime(staffParam.getWorkEndTime());
|
||||||
|
staffMapper.updateById(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师傅删除
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void del(Long id) {
|
||||||
|
Staff model = staffMapper.selectOne(
|
||||||
|
new QueryWrapper<Staff>()
|
||||||
|
.eq("id", id)
|
||||||
|
.last("limit 1"));
|
||||||
|
Assert.notNull(model, "师傅不存在!");
|
||||||
|
|
||||||
|
BigDecimal zero = new BigDecimal("0");
|
||||||
|
Boolean result = orderService.existOrderByStaffId(model.getId());
|
||||||
|
if (result) {
|
||||||
|
throw new OperateException("该师傅还有未完成的订单,不能删除!");
|
||||||
|
}else if(model.getCanWithdrawCommission().compareTo(zero) > 0){
|
||||||
|
throw new OperateException("该师傅可提现佣金大于0,不能删除!");
|
||||||
|
}
|
||||||
|
BigDecimal sum = staffCommissionMapper.sum("commission", new QueryWrapper<StaffCommission>()
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.eq("staff_id", model.getId())
|
||||||
|
.eq("status", StaffCommissionStatusEnum.FREEZE.getCode()));
|
||||||
|
if(sum.compareTo(zero) > 0){
|
||||||
|
throw new OperateException("该师傅待结算佣金大于0,不能删除!");
|
||||||
|
}
|
||||||
|
model.setIsDelete(GlobalConstant.DELETE);
|
||||||
|
model.setDeleteTime(TimeUtil.nowDate());
|
||||||
|
staffMapper.updateById(model);
|
||||||
|
|
||||||
|
//删除实名认证报告
|
||||||
|
List<StaffApplyFor> staffApplyForList = staffApplyForMapper.selectList(new QueryWrapper<StaffApplyFor>()
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.eq("user_id", model.getUserId()));
|
||||||
|
for (StaffApplyFor item : staffApplyForList) {
|
||||||
|
item.setIsDelete(GlobalConstant.DELETE);
|
||||||
|
staffApplyForMapper.updateById(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除体检报告
|
||||||
|
List<StaffPhysicalExamination> staffPhysicalExaminationList = staffPhysicalExaminationMapper.selectList(
|
||||||
|
new QueryWrapper<StaffPhysicalExamination>()
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.eq("staff_id", model.getId()));
|
||||||
|
for (StaffPhysicalExamination item : staffPhysicalExaminationList) {
|
||||||
|
item.setIsDelete(GlobalConstant.DELETE);
|
||||||
|
staffPhysicalExaminationMapper.updateById(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void status(StaffParam staffParam) {
|
||||||
|
Long id = staffParam.getId();
|
||||||
|
Staff staff = super.getById(id);
|
||||||
|
Assert.notNull(staff, "数据不存在!");
|
||||||
|
staff.setStatus(staffParam.getStatus());
|
||||||
|
staff.setUpdateTime(TimeUtil.nowDate());
|
||||||
|
super.updateById(staff);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receiveOrderStatus(StaffParam staffParam) {
|
||||||
|
Staff staff = super.getById(staffParam.getId());
|
||||||
|
Assert.notNull(staff, "师傅不存在!");
|
||||||
|
|
||||||
|
if(staff.getIsReceiveOrder() == StaffStatusEnum.ORDER_AVAILABLE.getCode()){
|
||||||
|
staff.setIsReceiveOrder(StaffStatusEnum.ORDER_NOT_AVAILABLE.getCode());
|
||||||
|
}else{
|
||||||
|
String resultMsg = isReceiveOrder(staff.getId());
|
||||||
|
if(StringUtils.isNotEmpty(resultMsg)){
|
||||||
|
throw new OperateException(resultMsg);
|
||||||
|
}
|
||||||
|
staff.setIsReceiveOrder(StaffStatusEnum.ORDER_AVAILABLE.getCode());
|
||||||
|
}
|
||||||
|
staff.setUpdateTime(TimeUtil.nowDate());
|
||||||
|
|
||||||
|
super.updateById(staff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断师傅是否可接单返回提示
|
||||||
|
* @param staffId 师傅id
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
private String isReceiveOrder(Long staffId){
|
||||||
|
String msg = "";
|
||||||
|
|
||||||
|
//判断是否连续两单差评
|
||||||
|
int flag = 0;
|
||||||
|
List<GoodsComment> goodsComments = goodsCommentMapper.selectList(new QueryWrapper<GoodsComment>()
|
||||||
|
.eq("is_delete", GlobalConstant.NOT_DELETE)
|
||||||
|
.eq("staff_id", staffId));
|
||||||
|
for (GoodsComment goodsComment : goodsComments) {
|
||||||
|
if(flag == 2){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(goodsComment.getCustomerServiceAppraise() != null){
|
||||||
|
if(goodsComment.getCustomerServiceAppraise() <= 2){
|
||||||
|
flag++;
|
||||||
|
}else{
|
||||||
|
flag = 0;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(goodsComment.getServiceComment() <= 2){
|
||||||
|
flag++;
|
||||||
|
}else{
|
||||||
|
flag = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(flag == 2){
|
||||||
|
msg = "连续两单差评,无法启用接单状态";
|
||||||
|
}
|
||||||
|
|
||||||
|
Staff staff = staffMapper.selectById(staffId);
|
||||||
|
if(staff.getScore() < 3.5){
|
||||||
|
msg = "评分过低,无法启用接单状态";
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Staff> getByCityId(Long cityId) {
|
||||||
|
LambdaQueryWrapper<Staff> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(Staff::getCityId, cityId);
|
||||||
|
lambdaQueryWrapper.eq(Staff::getStatus, 1);
|
||||||
|
lambdaQueryWrapper.eq(Staff::getIsDelete, 0);
|
||||||
|
lambdaQueryWrapper.orderByDesc(Staff::getCreateTime);
|
||||||
|
return super.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<StaffListVo> getNotPhysicalExaminationStaff(PageParam pageParam,Map<String, String> params) {
|
||||||
|
Integer page = pageParam.getPageNo();
|
||||||
|
Integer limit = pageParam.getPageSize();
|
||||||
|
|
||||||
|
//设置参数
|
||||||
|
String keyword = params.get("keyword");
|
||||||
|
Page<Staff> iPage = staffMapper.getNotPhysicalExaminationStaff(new Page<>(page, limit), keyword);
|
||||||
|
|
||||||
|
List<StaffListVo> staffListVos = new ArrayList<>();
|
||||||
|
for (Staff staff : iPage.getRecords()) {
|
||||||
|
StaffListVo staffListVo = new StaffListVo();
|
||||||
|
BeanUtils.copyProperties(staff,staffListVo);
|
||||||
|
staffListVos.add(staffListVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), staffListVos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateStaffOperationalStatus(StaffParam staffParam) {
|
||||||
|
Staff staff = super.getById(staffParam.getId());
|
||||||
|
Assert.notNull(staff, "师傅不存在!");
|
||||||
|
|
||||||
|
if(staff.getIsOperational() == StaffStatusEnum.NOT_OPERATIONAL_STAFF.getCode() &&
|
||||||
|
(StringUtil.isEmpty(staff.getWorkStartTime()) || StringUtil.isEmpty(staff.getWorkEndTime()))){
|
||||||
|
throw new OperateException("请先设置该运营师傅的工作时间");
|
||||||
|
}
|
||||||
|
|
||||||
|
staff.setIsOperational(staff.getIsOperational() == StaffStatusEnum.NOT_OPERATIONAL_STAFF.getCode() ?
|
||||||
|
StaffStatusEnum.OPERATIONAL_STAFF.getCode() :
|
||||||
|
StaffStatusEnum.NOT_OPERATIONAL_STAFF.getCode());
|
||||||
|
|
||||||
|
super.updateById(staff);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,12 +2,13 @@ package com.hcy.admin.validate.staff;
|
||||||
|
|
||||||
import com.hcy.common.entity.staff.StaffUploadFile;
|
import com.hcy.common.entity.staff.StaffUploadFile;
|
||||||
import com.hcy.common.validator.annotation.IDMust;
|
import com.hcy.common.validator.annotation.IDMust;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import lombok.Data;
|
import javax.validation.constraints.DecimalMin;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package com.hcy.admin.validate.staff;
|
package com.hcy.admin.validate.staff;
|
||||||
|
|
||||||
import com.hcy.common.validator.annotation.IDMust;
|
import com.hcy.common.validator.annotation.IDMust;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import lombok.Data;
|
import javax.validation.constraints.DecimalMin;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package com.hcy.admin.validate.staff;
|
package com.hcy.admin.validate.staff;
|
||||||
|
|
||||||
import com.hcy.common.validator.annotation.IDMust;
|
import com.hcy.common.validator.annotation.IDMust;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import lombok.Data;
|
import javax.validation.constraints.DecimalMin;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package com.hcy.admin.validate.staff;
|
package com.hcy.admin.validate.staff;
|
||||||
|
|
||||||
import com.hcy.common.validator.annotation.IDMust;
|
import com.hcy.common.validator.annotation.IDMust;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import lombok.Data;
|
import javax.validation.constraints.DecimalMin;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,7 @@ spring:
|
||||||
static-path-pattern: /api/static/**
|
static-path-pattern: /api/static/**
|
||||||
# 数据源配置
|
# 数据源配置
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://192.168.111.98:3306/homemaking?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
url: jdbc:mysql://192.168.111.98:3306/homemaking_no_staff?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||||
type: com.zaxxer.hikari.HikariDataSource # 数据源类型
|
type: com.zaxxer.hikari.HikariDataSource # 数据源类型
|
||||||
driver-class-name: com.mysql.jdbc.Driver # MySql的驱动
|
driver-class-name: com.mysql.jdbc.Driver # MySql的驱动
|
||||||
username: root # 数据库账号
|
username: root # 数据库账号
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class Order implements Serializable {
|
||||||
private String sn; // 订单编号
|
private String sn; // 订单编号
|
||||||
private Long userId; // 用户id
|
private Long userId; // 用户id
|
||||||
private String transactionId; // 第三方平台交易流水号
|
private String transactionId; // 第三方平台交易流水号
|
||||||
|
private Long staffId; // 师傅id
|
||||||
private String staffMobile; // 师傅联系电话
|
private String staffMobile; // 师傅联系电话
|
||||||
private Integer orderType; // 订单类型;0-普通订单;
|
private Integer orderType; // 订单类型;0-普通订单;
|
||||||
private Integer orderTerminal; // 订单来源;1-微信小程序;2-微信公众号;3-手机H5;4-PC;5-苹果app;6-安卓app;
|
private Integer orderTerminal; // 订单来源;1-微信小程序;2-微信公众号;3-手机H5;4-PC;5-苹果app;6-安卓app;
|
||||||
|
|
|
@ -85,7 +85,6 @@
|
||||||
<where>
|
<where>
|
||||||
us.is_delete = 0
|
us.is_delete = 0
|
||||||
AND s.id IS NULL
|
AND s.id IS NULL
|
||||||
AND us.type = 1
|
|
||||||
<if test="keyword != null and keyword != ''">
|
<if test="keyword != null and keyword != ''">
|
||||||
AND ((us.sn LIKE '%${keyword}%') OR (us.mobile LIKE '%${keyword}%') OR (us.nickname LIKE '%${keyword}%'))
|
AND ((us.sn LIKE '%${keyword}%') OR (us.mobile LIKE '%${keyword}%') OR (us.nickname LIKE '%${keyword}%'))
|
||||||
</if>
|
</if>
|
||||||
|
|
Loading…
Reference in New Issue