【admin】新增&优化# 1、小程序新增系统配置信息 2、新增巡检单逻辑删除 3、优化配件采购-采购员采购时的销售价=配件价格*配件采购价格因子 4、新增小程序巡检单列表、接单、开始巡检
parent
cf7f1e3178
commit
603ec88e37
|
@ -95,4 +95,18 @@ public class SparePartController {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购备件信息列表
|
||||
*
|
||||
* @author hcy
|
||||
* @param pageParam 分页参数
|
||||
* @param params 搜索参数
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/purchaseList")
|
||||
public Object purchaseList(@Validated PageParam pageParam,
|
||||
@RequestParam Map<String, String> params) {
|
||||
PageResult<SparePartListVo> list = iSparePartService.purchaseList(pageParam, params);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,4 +57,11 @@ public interface ISparePartService {
|
|||
*/
|
||||
void del(List<Integer> ids);
|
||||
|
||||
/**
|
||||
* 采购备件信息列表
|
||||
* @param pageParam
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
PageResult<SparePartListVo> purchaseList(PageParam pageParam, Map<String, String> params);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.hcy.admin.service.sparePart.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.AdminThreadLocal;
|
||||
import com.hcy.admin.service.sparePart.ISparePartService;
|
||||
import com.hcy.admin.validate.common.PageParam;
|
||||
import com.hcy.admin.validate.sparePart.SparePartParam;
|
||||
|
@ -10,11 +11,13 @@ import com.hcy.admin.vo.sparePart.SparePartListVo;
|
|||
import com.hcy.admin.vo.sparePart.SparePartDetailVo;
|
||||
import com.hcy.common.constant.GlobalConstant;
|
||||
import com.hcy.common.core.PageResult;
|
||||
import com.hcy.common.dto.UserDto;
|
||||
import com.hcy.common.entity.activity.Activity;
|
||||
import com.hcy.common.entity.client.Client;
|
||||
import com.hcy.common.entity.client.ClientContacts;
|
||||
import com.hcy.common.entity.sparePart.SparePart;
|
||||
import com.hcy.common.entity.warehouse.Warehouse;
|
||||
import com.hcy.common.exception.OperateException;
|
||||
import com.hcy.common.mapper.client.ClientContactsMapper;
|
||||
import com.hcy.common.mapper.client.ClientMapper;
|
||||
import com.hcy.common.mapper.sparePart.SparePartMapper;
|
||||
import com.hcy.common.mapper.warehouse.WarehouseMapper;
|
||||
import com.hcy.common.utils.StringUtil;
|
||||
|
@ -25,6 +28,7 @@ import org.springframework.util.Assert;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -39,6 +43,12 @@ public class SparePartServiceImpl implements ISparePartService {
|
|||
@Resource
|
||||
WarehouseMapper warehouseMapper;
|
||||
|
||||
@Resource
|
||||
ClientMapper clientMapper;
|
||||
|
||||
@Resource
|
||||
ClientContactsMapper clientContactsMapper;
|
||||
|
||||
/**
|
||||
* 备件信息列表
|
||||
*
|
||||
|
@ -229,4 +239,87 @@ public class SparePartServiceImpl implements ISparePartService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购备件信息列表
|
||||
*
|
||||
* @param pageParam
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageResult<SparePartListVo> purchaseList(PageParam pageParam, Map<String, String> params) {
|
||||
Integer page = pageParam.getPageNo();
|
||||
Integer limit = pageParam.getPageSize();
|
||||
|
||||
// 取得查询页的条件
|
||||
SparePartListVo pageDto = new SparePartListVo();
|
||||
|
||||
QueryWrapper<SparePart> queryWrapper = new QueryWrapper<>();
|
||||
// 取得查询页的条件
|
||||
if (StringUtil.isNotEmpty(params.get("likeWork"))) {
|
||||
pageDto.setLikeWork(params.get("likeWork"));
|
||||
queryWrapper.like("spare_parts_code", pageDto.getLikeWork());
|
||||
queryWrapper.or();
|
||||
queryWrapper.like("spare_parts_name", pageDto.getLikeWork());
|
||||
}
|
||||
|
||||
queryWrapper.eq("is_delete", 0);
|
||||
queryWrapper.orderByDesc("id");
|
||||
|
||||
sparePartMapper.setSearch(queryWrapper, params, new String[]{
|
||||
"=:warehouseId@warehouse_id:long",
|
||||
"=:specificationsModel@specifications_model:str",
|
||||
"=:unit:str",
|
||||
"=:quantity:long",
|
||||
});
|
||||
IPage<SparePart> iPage = sparePartMapper.selectPage(new Page<>(page, limit), queryWrapper);
|
||||
|
||||
//获取当前用户id
|
||||
Integer adminId = AdminThreadLocal.getAdminId();
|
||||
ClientContacts clientId = clientContactsMapper.selectOne(
|
||||
new QueryWrapper<ClientContacts>()
|
||||
.eq("admin_id", adminId)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
Assert.notNull(clientId, "数据不存在!");
|
||||
//当前用户所属客户的配件采购价格因子
|
||||
Client model = clientMapper.selectOne(
|
||||
new QueryWrapper<Client>()
|
||||
.eq("id", clientId.getClientId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
BigDecimal purchaseDivisor = model.getPurchaseDivisor(); // 配件采购价格因子
|
||||
|
||||
List<SparePartListVo> list = new LinkedList<>();
|
||||
for(SparePart item : iPage.getRecords()) {
|
||||
SparePartListVo vo = new SparePartListVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
//采购员采购时的销售价(配件采购里的销售价)=配件价格*配件采购价格因子(当前用户所属客户的配件采购价格因子)
|
||||
vo.setUnitPrice(vo.getUnitPrice().multiply(purchaseDivisor)); // 采购员采购时的销售价
|
||||
vo.setCreateTime(TimeUtil.timestampToDate(item.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtil.timestampToDate(item.getUpdateTime()));
|
||||
Warehouse warehouse = warehouseMapper.selectOne(
|
||||
new QueryWrapper<Warehouse>()
|
||||
.eq("id", item.getWarehouseId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
if(warehouse != null){
|
||||
vo.setWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
|
||||
//出库和调拨,选配件的时候,库存数量为0的不应出现 查询要加个字段
|
||||
String s = params.get("outAllotType");
|
||||
if(s != null && s.equals("0") && item.getQuantity() == 0){
|
||||
System.out.println("出库和调拨时,库存数量为0的不应出现!!!");
|
||||
}else{
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -168,6 +168,7 @@ public class SparePartPurchaseServiceImpl implements ISparePartPurchaseService {
|
|||
sparePartAudit1.setSparePartsId(sparePart.getId()); // 备件id
|
||||
sparePartAudit1.setStockAuditId(sparePartAudit.getStockAuditId()); // 出入库审核id
|
||||
sparePartAudit1.setUnit(sparePart.getUnit()); //单位
|
||||
sparePartAudit1.setUnitPrice(sparePartAudit.getUnitPrice()); //销售价
|
||||
sparePartAudit1.setCount(sparePartAudit.getCount()); // 出库数量
|
||||
sparePartAudit1.setQuantity(sparePart.getQuantity()); //库存数量
|
||||
Warehouse warehouse = warehouseMapper.selectOne(
|
||||
|
@ -254,7 +255,7 @@ public class SparePartPurchaseServiceImpl implements ISparePartPurchaseService {
|
|||
SparePartAudit insertSparePartAudit = new SparePartAudit();
|
||||
insertSparePartAudit.setSparePartsId(sparePartAudit.getId()); //备件id
|
||||
sb.append(sparePartAudit.getId()).append(",");
|
||||
|
||||
insertSparePartAudit.setUnitPrice(sparePartAudit.getUnitPrice());
|
||||
insertSparePartAudit.setCount(sparePartAudit.getCount()); //备件出库数量
|
||||
insertSparePartAudit.setStockAuditId(model.getId()); // 出入库审核id
|
||||
insertSparePartAudit.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
|
|
|
@ -19,9 +19,6 @@ public class RoutingInspectionOrderListVo implements Serializable {
|
|||
private Long orderSource; // 订单来源 1-系统创建;4-客服创建
|
||||
private Long receiverType; // 接单类型 0-区域派单;1-距离派单
|
||||
private Long repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
|
||||
private Long provinceId; // 省id
|
||||
private Long cityId; // 市id
|
||||
private Long districtId; // 区id
|
||||
private String remark; // 备注
|
||||
private Date orderAccomplishTime; // 订单完成时间
|
||||
private Long clientId; // 客户id
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.hcy.admin.vo.SparePartAudit.SparePartAuditListVo;
|
|||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,9 +13,6 @@ public class RoutingInspectionOrderDto implements Serializable {
|
|||
private Long orderSource; // 订单来源 1-系统创建;4-客服创建
|
||||
private Long repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
|
||||
private Long receiverType; // 接单类型 0-区域派单;1-距离派单
|
||||
private Long provinceId; // 省id
|
||||
private Long cityId; // 市id
|
||||
private Long districtId; // 区id
|
||||
private String remark; // 备注
|
||||
private Date orderAccomplishTime; // 订单完成时间
|
||||
private Long clientId; // 客户id
|
||||
|
@ -33,4 +30,5 @@ public class RoutingInspectionOrderDto implements Serializable {
|
|||
private Long receiverId; // 接单人id
|
||||
private String receiverName; // 接单人名称
|
||||
private Date receiverTime; // 接单时间
|
||||
private String likeWork; // 模糊查询(工单编号/客户名称/设备编号)
|
||||
}
|
||||
|
|
|
@ -50,5 +50,6 @@ public class RoutingInspectionOrder implements Serializable {
|
|||
private Date createTime; // 创建时间
|
||||
private Date updateTime; // 更新时间
|
||||
private Integer isDelete; // 是否删除 0-未删除 1-删除
|
||||
|
||||
private Long maintenanceId; //检修单id
|
||||
private Integer InspectionResult; //巡检结果(0=正常 1=异常)
|
||||
}
|
|
@ -56,5 +56,4 @@ public class SparePartStockAudit implements Serializable {
|
|||
private Integer recipientNumber; //领用数量
|
||||
private Integer purchaseStatus; //配件领用状态(0=待审核,1=未通过,2=待管理员审核,3=待发货,4=待收货,5=已完成,6=填写中,7=收货超期)
|
||||
private String purchaseIdea; //采购意见
|
||||
|
||||
}
|
|
@ -33,7 +33,11 @@ public enum OrderStateEnum {
|
|||
|
||||
//是否删除 0-未删除 1-删除
|
||||
NOTDELETED(0,"未删除"),
|
||||
DELETE(1, "删除");
|
||||
DELETE(1, "删除"),
|
||||
|
||||
//巡检结果(0=正常 1=异常)
|
||||
NORMAL(0,"正常"),
|
||||
ABNORMAL(1, "异常");
|
||||
|
||||
private final int status;
|
||||
private final String desc;
|
||||
|
|
|
@ -21,4 +21,12 @@ public interface RoutingInspectionOrderMapper extends IBaseMapper<RoutingInspect
|
|||
* @return
|
||||
*/
|
||||
Page<RoutingInspectionOrderDto> pageList(@Param("page") Page page, @Param("form") RoutingInspectionOrderDto form);
|
||||
|
||||
/**
|
||||
* 小程序巡检单列表
|
||||
* @param page
|
||||
* @param form
|
||||
* @return
|
||||
*/
|
||||
Page<RoutingInspectionOrderDto> frontPageList(@Param("page") Page page, @Param("form") RoutingInspectionOrderDto form);
|
||||
}
|
||||
|
|
|
@ -43,4 +43,35 @@
|
|||
ORDER BY i.id DESC
|
||||
</select>
|
||||
|
||||
<select id="frontPageList" resultType="com.hcy.common.dto.RoutingInspectionOrderDto">
|
||||
SELECT
|
||||
i.*,
|
||||
c.client_name,
|
||||
e.number as deviceNumber,e.name as deviceName,e.detailed_address,
|
||||
a.nickname as creatorName,
|
||||
f.`name` as familiarFaultName,
|
||||
aa.nickname as receiverName
|
||||
FROM
|
||||
la_routing_inspection_order AS i
|
||||
LEFT JOIN la_client AS c ON i.client_id = c.id
|
||||
LEFT JOIN la_equipment AS e ON i.device_id = e.id
|
||||
LEFT JOIN la_system_auth_admin AS a ON i.creator_id = a.id
|
||||
LEFT JOIN la_common_fault AS f ON i.fault_id = f.id
|
||||
LEFT JOIN la_system_auth_admin as aa on i.receiver_id = aa.id
|
||||
WHERE
|
||||
i.is_delete = 0
|
||||
<if test="form.likeWork != null and form.likeWork != ''">
|
||||
and i.order_no like concat('%', #{form.likeWork}, '%')
|
||||
</if>
|
||||
<if test="form.likeWork != null and form.likeWork != ''">
|
||||
OR c.client_name LIKE concat('%', #{form.likeWork}, '%')
|
||||
</if>
|
||||
<if test="form.likeWork != null and form.likeWork != ''">
|
||||
OR e.number LIKE concat('%', #{form.likeWork}, '%')
|
||||
</if>
|
||||
<if test="form.inspectionOrderStatus != null">
|
||||
and i.inspection_order_status = #{form.inspectionOrderStatus}
|
||||
</if>
|
||||
ORDER BY i.id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -43,4 +43,35 @@
|
|||
ORDER BY i.id DESC
|
||||
</select>
|
||||
|
||||
<select id="frontPageList" resultType="com.hcy.common.dto.RoutingInspectionOrderDto">
|
||||
SELECT
|
||||
i.*,
|
||||
c.client_name,
|
||||
e.number as deviceNumber,e.name as deviceName,e.detailed_address,
|
||||
a.nickname as creatorName,
|
||||
f.`name` as familiarFaultName,
|
||||
aa.nickname as receiverName
|
||||
FROM
|
||||
la_routing_inspection_order AS i
|
||||
LEFT JOIN la_client AS c ON i.client_id = c.id
|
||||
LEFT JOIN la_equipment AS e ON i.device_id = e.id
|
||||
LEFT JOIN la_system_auth_admin AS a ON i.creator_id = a.id
|
||||
LEFT JOIN la_common_fault AS f ON i.fault_id = f.id
|
||||
LEFT JOIN la_system_auth_admin as aa on i.receiver_id = aa.id
|
||||
WHERE
|
||||
i.is_delete = 0
|
||||
<if test="form.likeWork != null and form.likeWork != ''">
|
||||
and i.order_no like concat('%', #{form.likeWork}, '%')
|
||||
</if>
|
||||
<if test="form.likeWork != null and form.likeWork != ''">
|
||||
OR c.client_name LIKE concat('%', #{form.likeWork}, '%')
|
||||
</if>
|
||||
<if test="form.likeWork != null and form.likeWork != ''">
|
||||
OR e.number LIKE concat('%', #{form.likeWork}, '%')
|
||||
</if>
|
||||
<if test="form.inspectionOrderStatus != null">
|
||||
and i.inspection_order_status = #{form.inspectionOrderStatus}
|
||||
</if>
|
||||
ORDER BY i.id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.hcy.front.controller.configuration;
|
||||
|
||||
|
||||
|
||||
import com.hcy.common.core.AjaxResult;
|
||||
import com.hcy.front.service.configuration.ISystemConfigurationService;
|
||||
import com.hcy.front.vo.configuration.SystemConfigurationDetailVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 系统配置管理管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/configuration")
|
||||
public class SystemConfigurationController {
|
||||
|
||||
@Resource
|
||||
ISystemConfigurationService iSystemConfigurationService;
|
||||
|
||||
/**
|
||||
* 系统配置管理详情
|
||||
*
|
||||
* @author hcy
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public Object detail() {
|
||||
SystemConfigurationDetailVo detail = iSystemConfigurationService.detail();
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.hcy.front.controller.order;
|
||||
|
||||
|
||||
import com.hcy.common.core.AjaxResult;
|
||||
import com.hcy.common.core.PageResult;
|
||||
import com.hcy.common.validator.annotation.IDMust;
|
||||
import com.hcy.front.service.order.IRoutingInspectionOrderService;
|
||||
import com.hcy.front.validate.PageParam;
|
||||
import com.hcy.front.validate.order.RoutingInspectionOrderParam;
|
||||
import com.hcy.front.vo.order.RoutingInspectionOrderDetailVo;
|
||||
import com.hcy.front.vo.order.RoutingInspectionOrderListVo;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 巡检订单管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/routingInspectionOrder")
|
||||
public class RoutingInspectionOrderController {
|
||||
|
||||
@Resource
|
||||
IRoutingInspectionOrderService iRoutingInspectionOrderService;
|
||||
|
||||
/**
|
||||
* 巡检订单列表
|
||||
*
|
||||
* @author hcy
|
||||
* @param pageParam 分页参数
|
||||
* @param params 搜索参数
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Object list(@Validated PageParam pageParam,
|
||||
@RequestParam Map<String, String> params) {
|
||||
PageResult<RoutingInspectionOrderListVo> list = iRoutingInspectionOrderService.list(pageParam, params);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
/**
|
||||
* 巡检订单详情
|
||||
*
|
||||
* @author hcy
|
||||
* @param id 主键ID
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public Object detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
RoutingInspectionOrderDetailVo detail = iRoutingInspectionOrderService.detail(id);
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单
|
||||
*
|
||||
* @author hcy
|
||||
* @param routingInspectionOrderParam 参数
|
||||
* @return Object
|
||||
*/
|
||||
@PostMapping("/orderReceiving")
|
||||
public Object orderReceiving(@RequestBody RoutingInspectionOrderParam routingInspectionOrderParam) {
|
||||
iRoutingInspectionOrderService.orderReceiving(routingInspectionOrderParam);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始巡检
|
||||
*
|
||||
* @author hcy
|
||||
* @param routingInspectionOrderParam 参数
|
||||
* @return Object
|
||||
*/
|
||||
@PostMapping("/startInspection")
|
||||
public Object startInspection(@RequestBody RoutingInspectionOrderParam routingInspectionOrderParam) {
|
||||
iRoutingInspectionOrderService.startInspection(routingInspectionOrderParam);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障检测
|
||||
*
|
||||
* @author hcy
|
||||
* @param routingInspectionOrderParam 参数
|
||||
* @return Object
|
||||
*/
|
||||
@PostMapping("/faultDetect")
|
||||
public Object faultDetect(@RequestBody RoutingInspectionOrderParam routingInspectionOrderParam) {
|
||||
iRoutingInspectionOrderService.faultDetect(routingInspectionOrderParam);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.hcy.front.service.configuration;
|
||||
|
||||
|
||||
import com.hcy.front.vo.configuration.SystemConfigurationDetailVo;
|
||||
|
||||
/**
|
||||
* 系统配置管理服务接口类
|
||||
*/
|
||||
public interface ISystemConfigurationService {
|
||||
|
||||
|
||||
/**
|
||||
* 系统配置管理详情
|
||||
*
|
||||
* @author hcy
|
||||
* @return SystemConfiguration
|
||||
*/
|
||||
SystemConfigurationDetailVo detail();
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.hcy.front.service.configuration.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import com.hcy.common.entity.configuration.SystemConfiguration;
|
||||
import com.hcy.common.mapper.configuration.SystemConfigurationMapper;
|
||||
import com.hcy.front.service.configuration.ISystemConfigurationService;
|
||||
import com.hcy.front.vo.configuration.SystemConfigurationDetailVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 系统配置管理实现类
|
||||
*/
|
||||
@Service
|
||||
public class SystemConfigurationServiceImpl implements ISystemConfigurationService {
|
||||
|
||||
@Resource
|
||||
SystemConfigurationMapper systemConfigurationMapper;
|
||||
|
||||
/**
|
||||
* 系统配置管理详情
|
||||
*
|
||||
* @author hcy
|
||||
* @return SystemConfiguration
|
||||
*/
|
||||
@Override
|
||||
public SystemConfigurationDetailVo detail() {
|
||||
SystemConfiguration model = systemConfigurationMapper.selectOne(
|
||||
new QueryWrapper<SystemConfiguration>()
|
||||
.eq("id", 1)
|
||||
.last("limit 1"));
|
||||
|
||||
SystemConfigurationDetailVo vo = new SystemConfigurationDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.hcy.front.service.order;
|
||||
|
||||
import com.hcy.common.core.PageResult;
|
||||
import com.hcy.front.validate.PageParam;
|
||||
import com.hcy.front.validate.order.RoutingInspectionOrderParam;
|
||||
import com.hcy.front.vo.order.RoutingInspectionOrderDetailVo;
|
||||
import com.hcy.front.vo.order.RoutingInspectionOrderListVo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 巡检订单服务接口类
|
||||
*/
|
||||
public interface IRoutingInspectionOrderService {
|
||||
|
||||
/**
|
||||
* 巡检订单列表
|
||||
*
|
||||
* @author hcy
|
||||
* @param pageParam 分页参数
|
||||
* @param params 搜索参数
|
||||
* @return PageResult<RoutingInspectionOrderVo>
|
||||
*/
|
||||
PageResult<RoutingInspectionOrderListVo> list(PageParam pageParam, Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 巡检订单详情
|
||||
*
|
||||
* @author hcy
|
||||
* @param id 主键ID
|
||||
* @return RoutingInspectionOrder
|
||||
*/
|
||||
RoutingInspectionOrderDetailVo detail(Integer id);
|
||||
|
||||
/**
|
||||
* 接单
|
||||
* @param routingInspectionOrderParam
|
||||
*/
|
||||
void orderReceiving(RoutingInspectionOrderParam routingInspectionOrderParam);
|
||||
|
||||
/**
|
||||
* 开始巡检
|
||||
* @param routingInspectionOrderParam
|
||||
*/
|
||||
void startInspection(RoutingInspectionOrderParam routingInspectionOrderParam);
|
||||
|
||||
/**
|
||||
* 故障检测
|
||||
* @param routingInspectionOrderParam
|
||||
*/
|
||||
void faultDetect(RoutingInspectionOrderParam routingInspectionOrderParam);
|
||||
}
|
|
@ -0,0 +1,192 @@
|
|||
package com.hcy.front.service.order.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hcy.common.core.PageResult;
|
||||
import com.hcy.common.dto.RoutingInspectionOrderDto;
|
||||
import com.hcy.common.entity.client.Client;
|
||||
import com.hcy.common.entity.client.Equipment;
|
||||
import com.hcy.common.entity.order.RoutingInspectionOrder;
|
||||
import com.hcy.common.entity.system.SystemAuthAdmin;
|
||||
import com.hcy.common.enums.order.OrderStateEnum;
|
||||
import com.hcy.common.mapper.client.ClientMapper;
|
||||
import com.hcy.common.mapper.client.EquipmentMapper;
|
||||
import com.hcy.common.mapper.order.RoutingInspectionOrderMapper;
|
||||
import com.hcy.common.mapper.system.SystemAuthAdminMapper;
|
||||
import com.hcy.front.service.order.IRoutingInspectionOrderService;
|
||||
import com.hcy.front.validate.PageParam;
|
||||
import com.hcy.front.validate.order.RoutingInspectionOrderParam;
|
||||
import com.hcy.front.vo.order.RoutingInspectionOrderDetailVo;
|
||||
import com.hcy.front.vo.order.RoutingInspectionOrderListVo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 巡检订单实现类
|
||||
*/
|
||||
@Service
|
||||
public class RoutingInspectionOrderServiceImpl implements IRoutingInspectionOrderService {
|
||||
|
||||
@Resource
|
||||
RoutingInspectionOrderMapper routingInspectionOrderMapper;
|
||||
|
||||
@Resource
|
||||
EquipmentMapper equipmentMapper;
|
||||
|
||||
@Resource
|
||||
ClientMapper clientMapper;
|
||||
|
||||
@Resource
|
||||
SystemAuthAdminMapper systemAuthAdminMapper;
|
||||
|
||||
/**
|
||||
* 巡检订单列表
|
||||
*
|
||||
* @author hcy
|
||||
* @param pageParam 分页参数
|
||||
* @param params 搜索参数
|
||||
* @return PageResult<RoutingInspectionOrderListVo>
|
||||
*/
|
||||
@Override
|
||||
public PageResult<RoutingInspectionOrderListVo> list(PageParam pageParam, Map<String, String> params) {
|
||||
|
||||
Page<RoutingInspectionOrderDto> page = new Page<>(pageParam.getPageNo(), pageParam.getPageSize());
|
||||
RoutingInspectionOrderDto inspectionOrderDto = new RoutingInspectionOrderDto();
|
||||
|
||||
inspectionOrderDto.setLikeWork(StringUtils.isEmpty(params.get("likeWork")) ? null : params.get("likeWork"));
|
||||
//默认查询待接单的巡检单
|
||||
if(StringUtils.isNotEmpty(params.get("inspectionOrderStatus"))){
|
||||
inspectionOrderDto.setInspectionOrderStatus(Long.valueOf(params.get("inspectionOrderStatus")));
|
||||
}else{
|
||||
inspectionOrderDto.setInspectionOrderStatus(Long.valueOf(OrderStateEnum.PENDINGORDER.getStatus()));
|
||||
}
|
||||
|
||||
Page<RoutingInspectionOrderDto> iPage = routingInspectionOrderMapper.frontPageList(page, inspectionOrderDto);
|
||||
|
||||
|
||||
|
||||
List<RoutingInspectionOrderListVo> list = new LinkedList<>();
|
||||
for(RoutingInspectionOrderDto item : iPage.getRecords()) {
|
||||
RoutingInspectionOrderListVo vo = new RoutingInspectionOrderListVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
vo.setCreateTime(String.valueOf(item.getCreateTime()));
|
||||
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 巡检订单详情
|
||||
*
|
||||
* @author hcy
|
||||
* @param id 主键参数
|
||||
* @return RoutingInspectionOrder
|
||||
*/
|
||||
@Override
|
||||
public RoutingInspectionOrderDetailVo detail(Integer id) {
|
||||
RoutingInspectionOrder model = routingInspectionOrderMapper.selectOne(
|
||||
new QueryWrapper<RoutingInspectionOrder>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在");
|
||||
|
||||
RoutingInspectionOrderDetailVo vo = new RoutingInspectionOrderDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
//客户名称
|
||||
Client client = clientMapper.selectOne(
|
||||
new QueryWrapper<Client>()
|
||||
.eq("id", model.getClientId())
|
||||
.last("limit 1"));
|
||||
vo.setClientName(client.getClientName());
|
||||
//设备编号、名称、地址
|
||||
Equipment equipment = equipmentMapper.selectOne(
|
||||
new QueryWrapper<Equipment>()
|
||||
.eq("id", model.getDeviceId())
|
||||
.last("limit 1"));
|
||||
vo.setDeviceNumber(equipment.getNumber());
|
||||
vo.setDeviceName(equipment.getName());
|
||||
vo.setDetailedAddress(equipment.getDetailedAddress());
|
||||
//接单人
|
||||
SystemAuthAdmin authAdmin = systemAuthAdminMapper.selectOne(
|
||||
new QueryWrapper<SystemAuthAdmin>()
|
||||
.eq("id", model.getReceiverId())
|
||||
.last("limit 1"));
|
||||
if(authAdmin != null){
|
||||
vo.setReceiverName(authAdmin.getUsername());
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单
|
||||
*
|
||||
* @param routingInspectionOrderParam
|
||||
*/
|
||||
@Override
|
||||
public void orderReceiving(RoutingInspectionOrderParam routingInspectionOrderParam) {
|
||||
RoutingInspectionOrder model = routingInspectionOrderMapper.selectOne(
|
||||
new QueryWrapper<RoutingInspectionOrder>()
|
||||
.eq("id", routingInspectionOrderParam.getId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setInspectionOrderStatus(OrderStateEnum.TOBEINSPECTED.getStatus()); //用户接单后工单状态为待巡检
|
||||
routingInspectionOrderMapper.updateById(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始巡检
|
||||
*
|
||||
* @param routingInspectionOrderParam
|
||||
*/
|
||||
@Override
|
||||
public void startInspection(RoutingInspectionOrderParam routingInspectionOrderParam) {
|
||||
RoutingInspectionOrder model = routingInspectionOrderMapper.selectOne(
|
||||
new QueryWrapper<RoutingInspectionOrder>()
|
||||
.eq("id", routingInspectionOrderParam.getId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setInspectionOrderStatus(OrderStateEnum.DURINGINSPECTION.getStatus()); //用户开始巡检后工单状态为巡检中
|
||||
routingInspectionOrderMapper.updateById(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障检测
|
||||
*
|
||||
* @param routingInspectionOrderParam
|
||||
*/
|
||||
@Override
|
||||
public void faultDetect(RoutingInspectionOrderParam routingInspectionOrderParam) {
|
||||
RoutingInspectionOrder model = routingInspectionOrderMapper.selectOne(
|
||||
new QueryWrapper<RoutingInspectionOrder>()
|
||||
.eq("id", routingInspectionOrderParam.getId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setInspectionResult(routingInspectionOrderParam.getInspectionResult()); //巡检结果(0=正常 1=异常)
|
||||
model.setInspectionOrderStatus(OrderStateEnum.COMPLETED.getStatus()); //故障检测完工单状态就为已完成
|
||||
routingInspectionOrderMapper.updateById(model);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package com.hcy.front.service.order.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class teststes {
|
||||
public static void main(String[] args) {
|
||||
int userInteger = 62; // 用户积分
|
||||
int integer = 0; // 用户使用了多少积分
|
||||
BigDecimal p = BigDecimal.valueOf(166.66); // 商品价格
|
||||
BigDecimal p2 = BigDecimal.valueOf(5.66); // 商品价格
|
||||
BigDecimal orderAmount = p2; //应付金额
|
||||
BigDecimal deductionMoney = BigDecimal.valueOf(0); //抵扣金额
|
||||
|
||||
int num = userInteger % 10; //用户剩余积分
|
||||
int monery = userInteger / 10; // 用户积分抵扣金额
|
||||
|
||||
BigDecimal subtract = p2.subtract(BigDecimal.valueOf(monery)); // 积分抵扣金额
|
||||
integer = monery * 10; // 已使用积分
|
||||
deductionMoney = BigDecimal.valueOf(monery); // 抵扣金额
|
||||
|
||||
if(subtract.intValue() <= 0){
|
||||
num = num + (Math.abs(subtract.intValue()) * 10); // 剩余积分返还用户
|
||||
orderAmount = BigDecimal.valueOf(0); // 应付金额
|
||||
}else{
|
||||
orderAmount = subtract; // 应付金额
|
||||
}
|
||||
|
||||
System.out.println("-------------------------------");
|
||||
System.out.println("用户剩余积分:" + num);
|
||||
System.out.println("用户使用了:" + integer);
|
||||
System.out.println("用户应付金额:" + orderAmount);
|
||||
System.out.println("用户抵扣金额:" + deductionMoney);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.hcy.front.validate.order;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 巡检订单参数
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class RoutingInspectionOrderParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public interface create{}
|
||||
public interface update{}
|
||||
public interface delete{}
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
private String orderNo;
|
||||
|
||||
@DecimalMin(value = "0", message = "orderSource参数值不能少于0", groups = {create.class, update.class})
|
||||
private Integer orderSource;
|
||||
|
||||
private Integer inspectionOrderStatus;
|
||||
|
||||
@DecimalMin(value = "0", message = "clientId参数值不能少于0", groups = {create.class, update.class})
|
||||
private Long clientId;
|
||||
|
||||
@DecimalMin(value = "0", message = "deviceId参数值不能少于0", groups = {create.class, update.class})
|
||||
private Long deviceId;
|
||||
|
||||
@DecimalMin(value = "0", message = "provinceId参数值不能少于0", groups = {create.class, update.class})
|
||||
private Long provinceId;
|
||||
|
||||
@DecimalMin(value = "0", message = "cityId参数值不能少于0", groups = {create.class, update.class})
|
||||
private Long cityId;
|
||||
|
||||
@DecimalMin(value = "0", message = "districtId参数值不能少于0", groups = {create.class, update.class})
|
||||
private Long districtId;
|
||||
|
||||
|
||||
@DecimalMin(value = "0", message = "receiverId参数值不能少于0", groups = {create.class, update.class})
|
||||
private Long receiverId;
|
||||
|
||||
private String receiverTime;
|
||||
|
||||
@Length(max = 250, message = "remark参数不能超出250个字符", groups = {create.class, update.class})
|
||||
private String remark;
|
||||
|
||||
@DecimalMin(value = "0", message = "creatorId参数值不能少于0", groups = {create.class, update.class})
|
||||
private Long creatorId;
|
||||
private Integer receiverType; // 接单类型 0-区域派单;1-距离派单
|
||||
private BigDecimal orderDistance; // 订单距离
|
||||
private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
|
||||
private Integer InspectionResult; //巡检结果(0=正常 1=异常)
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.hcy.front.vo.configuration;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* SystemConfigurationVo
|
||||
*/
|
||||
@Data
|
||||
public class SystemConfigurationDetailVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id; // 主键id
|
||||
private Integer repairerLocation; // 检修员位置(每隔几分钟刷新)
|
||||
/*private Integer repairerMaxMileage; // 检修员自动抢单最大公里数(公里)
|
||||
private Integer repairerAutoOrderTime; // 检修员自动抢单时间(分钟)
|
||||
private Integer repairerRemind; // 检修员系统提醒客服(0=开启,1=关闭)
|
||||
private Integer repairerCommissionRate; // 检修员提成比例*/
|
||||
private Integer maintenanceLocation; // 维修员位置(每隔几分钟刷新)
|
||||
/* private Integer maintenanceMaxMileage; // 维修员自动抢单最大公里数(公里)
|
||||
private Integer maintenanceAutoOrderTime; // 维修员自动抢单时间(分钟)
|
||||
private Integer maintenanceRemind; // 维修员系统提现客服(0=开启,1-关闭)
|
||||
private Integer maintenanceCommissionRate; // 维修员提成比例*/
|
||||
private String servicePhone; // 客服电话
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.hcy.front.vo.configuration;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* SystemConfigurationVo
|
||||
*/
|
||||
@Data
|
||||
public class SystemConfigurationListVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id; // 主键id
|
||||
private Integer repairerLocation; // 检修员位置(每隔几分钟刷新)
|
||||
private Integer repairerMaxMileage; // 检修员自动抢单最大公里数(公里)
|
||||
private Integer repairerAutoOrderTime; // 检修员自动抢单时间(分钟)
|
||||
private Integer repairerRemind; // 检修员系统提醒客服(0=开启,1=关闭)
|
||||
private Integer repairerCommissionRate; // 检修员提成比例
|
||||
private Integer maintenanceLocation; // 维修员位置(每隔几分钟刷新)
|
||||
private Integer maintenanceMaxMileage; // 维修员自动抢单最大公里数(公里)
|
||||
private Integer maintenanceAutoOrderTime; // 维修员自动抢单时间(分钟)
|
||||
private Integer maintenanceRemind; // 维修员系统提现客服(0=开启,1-关闭)
|
||||
private Integer maintenanceCommissionRate; // 维修员提成比例
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.hcy.front.vo.order;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* RoutingInspectionOrderVo
|
||||
*/
|
||||
@Data
|
||||
public class RoutingInspectionOrderDetailVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id; // 主键id
|
||||
private String orderNo; // 订单编号
|
||||
private Integer orderSource; // 订单来源 1-系统创建;4-客服创建
|
||||
private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
|
||||
private Integer inspectionOrderStatus; // 订单状态 0-待抢单;1-待接单;2-接单超时;3-巡检中;4-已完成;5-已退单;6-待巡检
|
||||
private Long clientId; // 客户id
|
||||
private Long deviceId; // 设备id
|
||||
private Long receiverId; // 接单人id
|
||||
private Date receiverTime; // 接单时间
|
||||
private String remark; // 备注
|
||||
private Integer creatorId; // 创建人id
|
||||
private Integer receiverType; // 接单类型 0-区域派单;1-距离派单
|
||||
private BigDecimal orderDistance; // 订单距离
|
||||
private String clientName; // 客户名称
|
||||
private String deviceNumber; //设备编号
|
||||
private String deviceName; //设备名称
|
||||
private String detailedAddress; // 设备详细地址
|
||||
private String receiverName; // 接单人名称
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.hcy.front.vo.order;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* RoutingInspectionOrderVo
|
||||
*/
|
||||
@Data
|
||||
public class RoutingInspectionOrderListVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id; // 主键id
|
||||
private String orderNo; // 订单编号
|
||||
private Date orderAccomplishTime; // 订单完成时间
|
||||
private Long clientId; // 客户id
|
||||
private String clientName; // 客户名称
|
||||
private Long deviceId; // 设备id
|
||||
private String deviceNumber; //设备编号
|
||||
private String deviceName; //设备名称
|
||||
private String detailedAddress; // 设备详细地址
|
||||
private String createTime; // 创建时间
|
||||
private Long inspectionOrderStatus; // 订单状态 0-待抢单;1-待接单;2-接单超时;3-巡检中;4-已完成;5-已退单;6-待巡检
|
||||
}
|
|
@ -6,7 +6,7 @@ like:
|
|||
spring:
|
||||
# 数据源配置
|
||||
datasource:
|
||||
url: jdbc:mysql://192.168.4.107:3306/homemaking?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
url: jdbc:mysql://192.168.4.107:3306/charging_pile?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
type: com.zaxxer.hikari.HikariDataSource # 数据源类型
|
||||
driver-class-name: com.mysql.jdbc.Driver # MySql的驱动
|
||||
username: root # 数据库账号
|
||||
|
|
|
@ -20,7 +20,7 @@ spring:
|
|||
static-path-pattern: /api/static/**
|
||||
# 数据源配置
|
||||
datasource:
|
||||
url: jdbc:mysql://192.168.4.107:3306/homemaking?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
url: jdbc:mysql://192.168.4.107:3306/charging_pile?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
type: com.zaxxer.hikari.HikariDataSource # 数据源类型
|
||||
driver-class-name: com.mysql.jdbc.Driver # MySql的驱动
|
||||
username: root # 数据库账号
|
||||
|
|
|
@ -6,7 +6,7 @@ like:
|
|||
spring:
|
||||
# 数据源配置
|
||||
datasource:
|
||||
url: jdbc:mysql://192.168.4.107:3306/homemaking?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
url: jdbc:mysql://192.168.4.107:3306/charging_pile?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
type: com.zaxxer.hikari.HikariDataSource # 数据源类型
|
||||
driver-class-name: com.mysql.jdbc.Driver # MySql的驱动
|
||||
username: root # 数据库账号
|
||||
|
|
|
@ -20,7 +20,7 @@ spring:
|
|||
static-path-pattern: /api/static/**
|
||||
# 数据源配置
|
||||
datasource:
|
||||
url: jdbc:mysql://192.168.4.107:3306/homemaking?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
url: jdbc:mysql://192.168.4.107:3306/charging_pile?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
type: com.zaxxer.hikari.HikariDataSource # 数据源类型
|
||||
driver-class-name: com.mysql.jdbc.Driver # MySql的驱动
|
||||
username: root # 数据库账号
|
||||
|
|
Loading…
Reference in New Issue