Commit cfdecff2 authored by qiaobin's avatar qiaobin

Merge remote-tracking branch 'origin/master'

parents 1d7775f6 744516c5
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
...@@ -24,8 +25,8 @@ public class SendServiceOrderDTO { ...@@ -24,8 +25,8 @@ public class SendServiceOrderDTO {
private Long id; private Long id;
@ApiModelProperty(value = "订单价格,维修价格不能低于1元", required = true) @ApiModelProperty(value = "订单价格,维修价格不能低于1元", required = true)
@Min(value = 0, message = "维修价格不能低于1元")
@NotNull(message = "请输入维修价格") @NotNull(message = "请输入维修价格")
@Positive(message = "价格必须为正数")
private BigDecimal price; private BigDecimal price;
} }
package com.onsiteservice.common.service; package com.onsiteservice.common.service;
import com.alibaba.fastjson.JSONObject;
import com.onsiteservice.common.redis.RedisUtils; import com.onsiteservice.common.redis.RedisUtils;
import com.onsiteservice.util.aliyun.SmsUtils; import com.onsiteservice.util.aliyun.SmsUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -9,6 +10,7 @@ import org.springframework.stereotype.Service; ...@@ -9,6 +10,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Map;
/** /**
* 业务短信服务 * 业务短信服务
...@@ -67,39 +69,39 @@ public class CommonSmsService { ...@@ -67,39 +69,39 @@ public class CommonSmsService {
return; return;
} }
try { try {
smsUtils.send(sign, changePhoneTmpCode, code, phone); smsUtils.send(sign, changePhoneTmpCode, JSONObject.toJSONString(Map.of("code", code)), phone);
} catch (Exception e) { } catch (Exception e) {
log.error("发送短信错误", e); log.error("发送短信错误", e);
} }
} }
public void payable(String phone) { public void payable(String phone, String servicePhone, String serviceName) {
if (StringUtils.isEmpty(phone)) { if (StringUtils.isEmpty(phone)) {
return; return;
} }
try { try {
smsUtils.send(sign, payableTmpCode, null, phone); smsUtils.send(sign, payableTmpCode, JSONObject.toJSONString(Map.of("phone", servicePhone, "name", serviceName)), phone);
} catch (Exception e) { } catch (Exception e) {
log.error("发送短信错误", e); log.error("发送短信错误", e);
} }
} }
public void dispatched(String phone) { public void dispatched(String phone, String servicePhone, String serviceName) {
if (StringUtils.isEmpty(phone)) { if (StringUtils.isEmpty(phone)) {
return; return;
} }
try { try {
smsUtils.send(sign, dispatchedTmpCode, null, phone); smsUtils.send(sign, dispatchedTmpCode, JSONObject.toJSONString(Map.of("phone", servicePhone, "name", serviceName)), phone);
} catch (Exception e) { } catch (Exception e) {
log.error("发送短信错误", e); log.error("发送短信错误", e);
} }
} }
public void redispatched(String phone) { public void redispatched(String phone, String servicePhone, String serviceName) {
if (StringUtils.isEmpty(phone)) { if (StringUtils.isEmpty(phone)) {
return; return;
} }
try { try {
smsUtils.send(sign, redispatchedTmpCode, null, phone); smsUtils.send(sign, redispatchedTmpCode, JSONObject.toJSONString(Map.of("phone", servicePhone, "name", serviceName)), phone);
} catch (Exception e) { } catch (Exception e) {
log.error("发送短信错误", e); log.error("发送短信错误", e);
} }
...@@ -116,23 +118,23 @@ public class CommonSmsService { ...@@ -116,23 +118,23 @@ public class CommonSmsService {
} }
} }
public void valuator(String phone) { public void valuator(String phone, String servicePhone, String serviceName) {
if (StringUtils.isEmpty(phone)) { if (StringUtils.isEmpty(phone)) {
return; return;
} }
try { try {
smsUtils.send(sign, valuatorTmpCode, null, phone); smsUtils.send(sign, valuatorTmpCode, JSONObject.toJSONString(Map.of("phone", servicePhone, "name", serviceName)), phone);
} catch (Exception e) { } catch (Exception e) {
log.error("发送短信错误", e); log.error("发送短信错误", e);
} }
} }
public void revaluator(String phone) { public void revaluator(String phone, String servicePhone, String serviceName) {
if (StringUtils.isEmpty(phone)) { if (StringUtils.isEmpty(phone)) {
return; return;
} }
try { try {
smsUtils.send(sign, revaluatorTmpCode, null, phone); smsUtils.send(sign, revaluatorTmpCode, JSONObject.toJSONString(Map.of("phone", servicePhone, "name", serviceName)), phone);
} catch (Exception e) { } catch (Exception e) {
log.error("发送短信错误", e); log.error("发送短信错误", e);
} }
......
...@@ -108,7 +108,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -108,7 +108,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
// 记录估价员指派时间 // 记录估价员指派时间
serviceValuatorAssignMapper.insertSelective(buildServiceValuatorAssign(dto, userId)); serviceValuatorAssignMapper.insertSelective(buildServiceValuatorAssign(dto, userId));
// 通知用户 // 通知用户
commonSmsService.valuator(serviceOrder.getPhone()); commonSmsService.valuator(serviceOrder.getPhone(), user.getPhone(), serviceOrder.getServiceName());
String description = String.format(ServiceOrderStatusEnum.VALUATION.getMsg(), user.getName(), valuatorUser.getUserName()); String description = String.format(ServiceOrderStatusEnum.VALUATION.getMsg(), user.getName(), valuatorUser.getUserName());
recordComponent.recordProcess(serviceOrder.getId(), ServiceOrderStatusEnum.VALUATION.getStatus(), description, recordComponent.recordProcess(serviceOrder.getId(), ServiceOrderStatusEnum.VALUATION.getStatus(), description,
...@@ -143,7 +143,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -143,7 +143,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
// 设置新的估计员世间 // 设置新的估计员世间
serviceValuatorAssignMapper.insertSelective(buildServiceValuatorAssign(dto, userId)); serviceValuatorAssignMapper.insertSelective(buildServiceValuatorAssign(dto, userId));
// 通知用户 // 通知用户
commonSmsService.revaluator(serviceOrder.getPhone()); commonSmsService.revaluator(serviceOrder.getPhone(), user.getPhone(), serviceOrder.getServiceName());
String description = String.format(ServiceOrderStatusEnum.REVALUATION.getMsg(), user.getName(), valuatorUser.getUserName()); String description = String.format(ServiceOrderStatusEnum.REVALUATION.getMsg(), user.getName(), valuatorUser.getUserName());
recordComponent.recordProcess(serviceOrder.getId(), ServiceOrderStatusEnum.REVALUATION.getStatus(), description, recordComponent.recordProcess(serviceOrder.getId(), ServiceOrderStatusEnum.REVALUATION.getStatus(), description,
sourceEnum, valuatorUser.getId(), dto.getRemark(), dto.getExpectArrivalTime()); sourceEnum, valuatorUser.getId(), dto.getRemark(), dto.getExpectArrivalTime());
...@@ -184,7 +184,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -184,7 +184,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
try { try {
// 发短信 // 发短信
log.info("sendOrder send msg to phone: {}", serviceOrder.getPhone()); log.info("sendOrder send msg to phone: {}", serviceOrder.getPhone());
commonSmsService.payable(serviceOrder.getPhone()); commonSmsService.payable(serviceOrder.getPhone(), user.getPhone(), serviceOrder.getServiceName());
} catch (Exception e) { } catch (Exception e) {
log.error("sendOrder error, ", e); log.error("sendOrder error, ", e);
} }
...@@ -226,7 +226,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -226,7 +226,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
serviceOrder.setModifyBy(userId); serviceOrder.setModifyBy(userId);
int result = serviceOrderMapper.updateByConditionSelective(serviceOrder, c); int result = serviceOrderMapper.updateByConditionSelective(serviceOrder, c);
commonSmsService.dispatched(serviceOrder.getPhone()); commonSmsService.dispatched(serviceOrder.getPhone(), user.getPhone(), serviceOrder.getServiceName());
if (result == 1) { if (result == 1) {
// 记录维修工时间 // 记录维修工时间
...@@ -263,7 +263,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -263,7 +263,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
int result = serviceWorkerAssignMapper.insertSelective(buildServiceWorkerAssign(dto, serviceOrder, userId)); int result = serviceWorkerAssignMapper.insertSelective(buildServiceWorkerAssign(dto, serviceOrder, userId));
commonSmsService.redispatched(serviceOrder.getPhone()); commonSmsService.redispatched(serviceOrder.getPhone(), user.getPhone(), serviceOrder.getServiceName());
if (result == 1) { if (result == 1) {
String description = String.format(ServiceOrderStatusEnum.REDISPATCH.getMsg(), user.getName(), serviceWorker.getName()); String description = String.format(ServiceOrderStatusEnum.REDISPATCH.getMsg(), user.getName(), serviceWorker.getName());
...@@ -293,10 +293,10 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -293,10 +293,10 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
if (!isUser && !isAdmin) { if (!isUser && !isAdmin) {
throw new ServiceException(BizCodeEnum.NO_AUTH_FINISH_ORDER); throw new ServiceException(BizCodeEnum.NO_AUTH_FINISH_ORDER);
} }
user = new WorkUser(miniUser.getId(), miniUser.getUserName(), isAdmin); user = new WorkUser(miniUser.getId(), miniUser.getUserName(), isAdmin, miniUser.getPhone());
} else { } else {
var sysUser = sysUserMapper.selectByPrimaryKey(userId); var sysUser = sysUserMapper.selectByPrimaryKey(userId);
user = new WorkUser(sysUser.getId(), sysUser.getRealName(), true); user = new WorkUser(sysUser.getId(), sysUser.getRealName(), true, sysUser.getPhone());
} }
Condition c = buildOrderStatusCondition(serviceOrder); Condition c = buildOrderStatusCondition(serviceOrder);
...@@ -343,13 +343,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -343,13 +343,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw new ServiceException(biz); throw new ServiceException(biz);
} }
return new WorkUser(user.getId(), user.getUserName(), user.getRoleType().equals(ServiceUserTypeEnum.ADMIN.getId())); return new WorkUser(user.getId(), user.getUserName(), user.getRoleType().equals(ServiceUserTypeEnum.ADMIN.getId()), user.getPhone());
} }
SysUser sysUser = sysUserMapper.selectByPrimaryKey(userId); SysUser sysUser = sysUserMapper.selectByPrimaryKey(userId);
if (Objects.isNull(sysUser)) { if (Objects.isNull(sysUser)) {
throw new ServiceException(biz); throw new ServiceException(biz);
} }
return new WorkUser(sysUser.getId(), sysUser.getRealName(), true); return new WorkUser(sysUser.getId(), sysUser.getRealName(), true, sysUser.getPhone());
} }
......
...@@ -12,4 +12,6 @@ public class WorkUser { ...@@ -12,4 +12,6 @@ public class WorkUser {
private String name; private String name;
// 是否是客服 // 是否是客服
private Boolean isAdmin; private Boolean isAdmin;
private String phone;
} }
...@@ -5,11 +5,13 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,11 +5,13 @@ import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.*; import javax.persistence.*;
import lombok.Getter;
import lombok.Setter; import lombok.*;
import lombok.ToString;
import tk.mybatis.mapper.annotation.LogicDelete; import tk.mybatis.mapper.annotation.LogicDelete;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Getter @Getter
@Setter @Setter
@ToString @ToString
......
...@@ -74,7 +74,7 @@ public class ServiceAddressController { ...@@ -74,7 +74,7 @@ public class ServiceAddressController {
@ApiOperation(value = "根据id删除服务地址") @ApiOperation(value = "根据id删除服务地址")
@DeleteMapping("delete/{id}") @DeleteMapping("delete/{id}")
public Result deleteById(@ApiParam(name = "id", value = "服务地址id") @PathVariable @Positive Long id, @CurrentUserId Long userId) { public Result deleteById(@ApiParam(name = "id", value = "服务地址id") @PathVariable @Positive Long id, @CurrentUserId Long userId) {
return serviceAddressService.delete(id, userId) == 1 ? success() : fail("删除失败"); return serviceAddressService.delete(id, userId) == 1 ? success("删除成功") : fail("删除失败");
} }
} }
...@@ -4,9 +4,7 @@ import io.swagger.annotations.ApiModel; ...@@ -4,9 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@Data @Data
@ApiModel("保存服务地址请求模型") @ApiModel("保存服务地址请求模型")
...@@ -17,6 +15,7 @@ public class SaveServiceAddressDTO { ...@@ -17,6 +15,7 @@ public class SaveServiceAddressDTO {
*/ */
@ApiModelProperty(value = "姓名", required = true) @ApiModelProperty(value = "姓名", required = true)
@NotBlank(message = "请输入联系人") @NotBlank(message = "请输入联系人")
@Size(max = 18, message = "姓名不能长于18个字符")
private String name; private String name;
/** /**
...@@ -46,6 +45,7 @@ public class SaveServiceAddressDTO { ...@@ -46,6 +45,7 @@ public class SaveServiceAddressDTO {
*/ */
@ApiModelProperty(value = "地址", required = true) @ApiModelProperty(value = "地址", required = true)
@NotBlank(message = "请输入详细地址") @NotBlank(message = "请输入详细地址")
@Size(max = 72, message = "地址不能长于72个字符")
private String address; private String address;
// @ApiModelProperty(value = "是否默认收货地址", required = true) // @ApiModelProperty(value = "是否默认收货地址", required = true)
......
...@@ -7,6 +7,7 @@ import lombok.Data; ...@@ -7,6 +7,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
@Data @Data
@ApiModel("修改服务地址请求模型") @ApiModel("修改服务地址请求模型")
...@@ -21,6 +22,7 @@ public class UpdateServiceAddressDTO { ...@@ -21,6 +22,7 @@ public class UpdateServiceAddressDTO {
*/ */
@ApiModelProperty(value = "姓名", required = true) @ApiModelProperty(value = "姓名", required = true)
@NotBlank(message = "请输入联系人") @NotBlank(message = "请输入联系人")
@Size(max = 18, message = "姓名不能长于18个字符")
private String name; private String name;
/** /**
...@@ -50,6 +52,7 @@ public class UpdateServiceAddressDTO { ...@@ -50,6 +52,7 @@ public class UpdateServiceAddressDTO {
*/ */
@ApiModelProperty(value = "地址", required = true) @ApiModelProperty(value = "地址", required = true)
@NotBlank(message = "请输入详细地址") @NotBlank(message = "请输入详细地址")
@Size(max = 72, message = "地址不能长于72个字符")
private String address; private String address;
// @ApiModelProperty(value = "是否默认收货地址", required = true) // @ApiModelProperty(value = "是否默认收货地址", required = true)
......
...@@ -5,6 +5,7 @@ import com.onsiteservice.dao.common.page.PageInfoVO; ...@@ -5,6 +5,7 @@ import com.onsiteservice.dao.common.page.PageInfoVO;
import com.onsiteservice.dao.common.page.PageParams; import com.onsiteservice.dao.common.page.PageParams;
import com.onsiteservice.miniapp.controller.category.dto.PageServiceCategoryDTO; import com.onsiteservice.miniapp.controller.category.dto.PageServiceCategoryDTO;
import com.onsiteservice.miniapp.controller.category.vo.ServiceCategoryVO; import com.onsiteservice.miniapp.controller.category.vo.ServiceCategoryVO;
import com.onsiteservice.miniapp.controller.category.vo.ServiceSubclassVO;
import com.onsiteservice.miniapp.service.category.ServiceCategoryService; import com.onsiteservice.miniapp.service.category.ServiceCategoryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -36,10 +37,16 @@ public class ServiceCategoryController { ...@@ -36,10 +37,16 @@ public class ServiceCategoryController {
private ServiceCategoryService serviceCategoryService; private ServiceCategoryService serviceCategoryService;
@ApiOperation(value = "查询服务子类(大类全部返回)") @ApiOperation(value = "服务列表")
@GetMapping("list") @GetMapping("list")
public Result<List<ServiceCategoryVO>> list(@RequestParam(required = false) String keyWord) { public Result<List<ServiceCategoryVO>> list() {
return serviceCategoryService.list(keyWord); return serviceCategoryService.list(null);
}
@ApiOperation(value = "根据key查询子类")
@GetMapping("find")
public Result<List<ServiceSubclassVO>> find(@RequestParam(required = false) String keyWord) {
return serviceCategoryService.selectByKeyWord(keyWord);
} }
......
...@@ -30,6 +30,8 @@ import javax.annotation.Resource; ...@@ -30,6 +30,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.Positive; import javax.validation.constraints.Positive;
import java.util.Map;
import static com.onsiteservice.core.result.ResultGenerator.fail; import static com.onsiteservice.core.result.ResultGenerator.fail;
import static com.onsiteservice.core.result.ResultGenerator.success; import static com.onsiteservice.core.result.ResultGenerator.success;
...@@ -68,6 +70,12 @@ public class ServiceOrderController { ...@@ -68,6 +70,12 @@ public class ServiceOrderController {
return serviceOrderBizService.getPage(dto, userId); return serviceOrderBizService.getPage(dto, userId);
} }
@ApiOperation(value = "客服获取各状态订单数量, 1待受理, 3待支付,4待派单,5服务中,6已完成 ")
@GetMapping("todo-detail")
public Result<Map<Integer, Integer>> getTodoNum(@CurrentUserId Long userId) {
return success(serviceOrderBizService.getTodoNum(userId));
}
@Dict(code = DictConstants.ORDER_STATUS, name = "orderStatus") @Dict(code = DictConstants.ORDER_STATUS, name = "orderStatus")
@ApiOperation(value = "我的订单-分页查询订单") @ApiOperation(value = "我的订单-分页查询订单")
@PostMapping("mine-page") @PostMapping("mine-page")
......
...@@ -19,4 +19,6 @@ public interface ServiceOrderBizMapper { ...@@ -19,4 +19,6 @@ public interface ServiceOrderBizMapper {
Map<String, Long> getMyOrderNum(@Param("accountNo") Long userId); Map<String, Long> getMyOrderNum(@Param("accountNo") Long userId);
Map<Integer, Integer> getTodoNum();
} }
...@@ -66,7 +66,7 @@ public class HomeCommonService { ...@@ -66,7 +66,7 @@ public class HomeCommonService {
public Result<HomeViewVO> home() { public Result<HomeViewVO> home() {
// 轮播图 // 轮播图
List<Banner> bannerList = bannerMapper.selectAll(); List<Banner> bannerList = bannerMapper.select(Banner.builder().enabled(true).build());
List<BannerVO> bannerVOList = bannerList.parallelStream() List<BannerVO> bannerVOList = bannerList.parallelStream()
.map(e -> AttrCopyUtils.copy(e, new BannerVO())).collect(Collectors.toList()); .map(e -> AttrCopyUtils.copy(e, new BannerVO())).collect(Collectors.toList());
......
...@@ -31,17 +31,6 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> { ...@@ -31,17 +31,6 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
@Resource @Resource
private ServiceSubclassMapper serviceSubclassMapper; private ServiceSubclassMapper serviceSubclassMapper;
/**
* 分页查询列表
*/
/*public Result<PageInfoVO<ServiceCategoryVO>> getPage(PageServiceCategoryDTO dto) {
PageHelper.startPage(dto.getPage(), dto.getSize());
List<ServiceCategory> serviceCategoryList = serviceCategoryBizMapper.selectServiceCategoryPage(dto);
List<ServiceCategoryVO> serviceCategoryVOList = serviceCategoryList.parallelStream()
.map(e -> AttrCopyUtils.copy(e, new ServiceCategoryVO())).collect(Collectors.toList());
return ResultGenerator.success(new PageInfoVO<>(serviceCategoryVOList));
}*/
public Result<List<ServiceCategoryVO>> list(String keyWord) { public Result<List<ServiceCategoryVO>> list(String keyWord) {
List<ServiceCategory> serviceCategoryList = serviceCategoryMapper.selectAllOrderBySequence(); List<ServiceCategory> serviceCategoryList = serviceCategoryMapper.selectAllOrderBySequence();
...@@ -62,5 +51,12 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> { ...@@ -62,5 +51,12 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
return ResultGenerator.success(serviceCategoryVOList); return ResultGenerator.success(serviceCategoryVOList);
} }
public Result<List<ServiceSubclassVO>> selectByKeyWord(String keyWord) {
List<ServiceSubclass> serviceSubclassList = serviceSubclassMapper.selectByServiceNameLike(keyWord);
List<ServiceSubclassVO> serviceSubclassVOList = serviceSubclassList.parallelStream()
.map(e1 -> AttrCopyUtils.copy(e1, new ServiceSubclassVO())).collect(Collectors.toList());
return ResultGenerator.success(serviceSubclassVOList);
}
} }
...@@ -35,18 +35,16 @@ import com.onsiteservice.miniapp.controller.order.dto.CancelServiceOrderDTO; ...@@ -35,18 +35,16 @@ import com.onsiteservice.miniapp.controller.order.dto.CancelServiceOrderDTO;
import com.onsiteservice.miniapp.controller.order.dto.PageServiceOrderDTO; import com.onsiteservice.miniapp.controller.order.dto.PageServiceOrderDTO;
import com.onsiteservice.miniapp.controller.order.dto.ReserveServiceOrderDTO; import com.onsiteservice.miniapp.controller.order.dto.ReserveServiceOrderDTO;
import com.onsiteservice.miniapp.controller.order.vo.ServiceOrderDefDetailVO; import com.onsiteservice.miniapp.controller.order.vo.ServiceOrderDefDetailVO;
import com.onsiteservice.miniapp.mapper.order.ServiceOrderBizMapper;
import com.onsiteservice.miniapp.service.weixin.pay.WechatNativePay; import com.onsiteservice.miniapp.service.weixin.pay.WechatNativePay;
import com.onsiteservice.service.order.ServiceOrderService; import com.onsiteservice.service.order.ServiceOrderService;
import com.onsiteservice.util.AttrCopyUtils; import com.onsiteservice.util.AttrCopyUtils;
import com.onsiteservice.util.DateUtils;
import com.onsiteservice.util.RandomUtils; import com.onsiteservice.util.RandomUtils;
import com.onsiteservice.util.aliyun.SmsUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.springframework.amqp.core.AmqpTemplate; import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -95,6 +93,8 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> { ...@@ -95,6 +93,8 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
private SysUserMapper sysUserMapper; private SysUserMapper sysUserMapper;
@Resource @Resource
private AmqpTemplate amqpTemplate; private AmqpTemplate amqpTemplate;
@Resource
private ServiceOrderBizMapper serviceOrderBizMapper;
public ServiceOrderVO selectById(Long id, Long userId) { public ServiceOrderVO selectById(Long id, Long userId) {
...@@ -423,4 +423,18 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> { ...@@ -423,4 +423,18 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
} }
/**
* 获取各个状态(前端状态)下的待办数量
* @param userId
* @return
*/
public Map<Integer, Integer> getTodoNum(Long userId) {
User user = userMapper.selectByPrimaryKey(userId);
if(!ServiceUserTypeEnum.ADMIN.getId().equals(user.getRoleType())) {
return Map.of(1, 0, 3, 0, 4, 0, 5, 0, 6, 0);
}
return serviceOrderBizMapper.getTodoNum();
}
} }
...@@ -132,7 +132,7 @@ public class UserService extends AbstractMapper<User> { ...@@ -132,7 +132,7 @@ public class UserService extends AbstractMapper<User> {
// 待处理数量 // 待处理数量
if (Objects.equals(user.getRoleType(), ServiceUserTypeEnum.ADMIN.getId())) { if (Objects.equals(user.getRoleType(), ServiceUserTypeEnum.ADMIN.getId())) {
Condition condition = new Condition(ServiceOrder.class); Condition condition = new Condition(ServiceOrder.class);
condition.createCriteria().andEqualTo("orderStatus", ServiceOrderStatusEnum.RESERVE.getStatus()); condition.createCriteria().andIn("orderStatus", List.of(ServiceOrderStatusEnum.RESERVE.getStatus(), ServiceOrderStatusEnum.PAY.getStatus()));
int num = serviceOrderMapper.selectCountByCondition(condition); int num = serviceOrderMapper.selectCountByCondition(condition);
vo.setTodo(num); vo.setTodo(num);
} }
......
...@@ -18,10 +18,18 @@ ...@@ -18,10 +18,18 @@
select count(if(order_status = 3, id, null)) `pay`, select count(if(order_status = 3, id, null)) `pay`,
count(if(order_status = 1 or order_status = 2, id, null)) `handle`, count(if(order_status = 1 or order_status = 2, id, null)) `handle`,
count(if(order_status = 4, id, null)) `dispatch`, count(if(order_status = 4, id, null)) `dispatch`,
count(if(order_status = 6, id, null)) `finished` count(if(order_status = 5, id, null)) `service`
from service_order from service_order
where account_no = #{accountNo} where account_no = #{accountNo}
</select> </select>
<select id="getTodoNum" resultType="java.util.Map">
select count(if(t.order_status in (1, 2), 1, null)) `1`,
count(if(t.order_status = 3, 1, null)) `3`,
count(if(t.order_status = 4, 1, null)) `4`,
count(if(t.order_status = 5, 1, null)) `5`,
count(if(t.order_status in (6, 7), 1, null)) `6`
from service_order t
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment