功能需求优化
This commit is contained in:
parent
21f8103961
commit
f2b250e0b1
|
|
@ -78,4 +78,9 @@ public class MaterialConstants {
|
|||
|
||||
public static final String DICT_TYPE_ORDER_STATUS = "order_status";
|
||||
|
||||
/**
|
||||
* 存储redis中的订单取件码前缀
|
||||
*/
|
||||
public static final String DICT_TYPE_ORDER_PICKUP_CODE = "order_code_";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,20 @@ public class ComprehensiveController extends BaseController {
|
|||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 在租装备信息查询
|
||||
* @param devInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "综合查询-在租装备信息查询")
|
||||
@GetMapping("/getLeaseDevList")
|
||||
public AjaxResult getLeaseDevList(DevInfoVo devInfo) {
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<DevInfoVo> list = devInfoService.getLeaseDevList(devInfo);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "综合查询-设备租赁明细")
|
||||
@GetMapping("/rentDetails")
|
||||
public AjaxResult getRentDetails(DevInfoVo devInfo) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -278,4 +279,9 @@ public class DevInfo extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "累计租赁天数")
|
||||
private Integer totalLeaseDay;
|
||||
|
||||
@ApiModelProperty(value = "下次检测日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date nextCheckDate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,5 +221,12 @@ public interface DevInfoMapper {
|
|||
List<DevInfo> getLeaseCountByTypeName();
|
||||
|
||||
List<DevInfo> getDeviceShareRanking();
|
||||
|
||||
/**
|
||||
* 在租装备信息查询
|
||||
* @param devInfo
|
||||
* @return
|
||||
*/
|
||||
List<DevInfoVo> getLeaseDevList(DevInfoVo devInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,4 +107,11 @@ public interface DevInfoService {
|
|||
List<DevInfoVo> getTagDevList(DevInfoVo devInfoVo);
|
||||
|
||||
List<DevInfoVo> getDevList(DevInfoVo devInfo);
|
||||
|
||||
/**
|
||||
* 在租装备信息查询
|
||||
* @param devInfo
|
||||
* @return
|
||||
*/
|
||||
List<DevInfoVo> getLeaseDevList(DevInfoVo devInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -634,7 +634,18 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
@Override
|
||||
public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo) {
|
||||
devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
|
||||
return devInfoMapper.selectDevInfoLists(devInfo);
|
||||
List<DevInfoVo> list = devInfoMapper.selectDevInfoLists(devInfo);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
for (DevInfoVo infoVo : list) {
|
||||
if (infoVo.getMaId() != null) {
|
||||
MaDevQc qc = maDevQcMapper.getQcListByOne(infoVo.getMaId());
|
||||
if (qc != null) {
|
||||
infoVo.setNextCheckDate(qc.getNextCheckTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -808,6 +819,16 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
return devList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在租装备信息查询
|
||||
* @param devInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DevInfoVo> getLeaseDevList(DevInfoVo devInfo) {
|
||||
return devInfoMapper.getLeaseDevList(devInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOutType(String devInfo) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
|
|
|||
|
|
@ -113,6 +113,18 @@ public class OrderController extends BaseController {
|
|||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个订单取件码
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取单个订单取件码")
|
||||
@GetMapping("/getOrderCode")
|
||||
public AjaxResult getOrderCode(OrderDetailDto dto) {
|
||||
int code = orderService.getOrderCode(dto);
|
||||
return success(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单状态流转修改
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ public class OrderDetailDto {
|
|||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "6位数取件码")
|
||||
private String pickupCode;
|
||||
|
||||
@ApiModelProperty(value = "前端是否选中(此字段仅供前端使用,默认0)")
|
||||
private Integer isCheck = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,4 +39,10 @@ public interface OrderService {
|
|||
|
||||
OrderData getCompanysCost();
|
||||
|
||||
/**
|
||||
* 获取单个订单取件码
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int getOrderCode(OrderDetailDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
|||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.SpringUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.redis.service.RedisService;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
|
|
@ -38,6 +39,7 @@ import java.math.BigDecimal;
|
|||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
|
|
@ -66,6 +68,9 @@ public class OrderServiceImpl implements OrderService {
|
|||
@Resource
|
||||
private RemoteConfig remoteConfig;
|
||||
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
|
|
@ -260,6 +265,26 @@ public class OrderServiceImpl implements OrderService {
|
|||
|
||||
public Integer updateOrderStatus(OrderDetailDto orderInfoDto) {
|
||||
List<OrderDetailDto> dtos = orderMapper.getOrderDetailsByOrderId(orderInfoDto.getOrderId());
|
||||
// 针对于接单操作,生成6位数取件码,合并出库和收货操作
|
||||
if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_RECEIVE.getStatus().toString())) {
|
||||
// 生成6位数取件码
|
||||
String code = generateSixDigitNumber();
|
||||
// 存储redis中
|
||||
redisService.setCacheObject(MaterialConstants.DICT_TYPE_ORDER_PICKUP_CODE + orderInfoDto.getOrderId(), code);
|
||||
}
|
||||
// 针对于收货操作,校验6位数取件码是否正确
|
||||
if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_AWAITING_RECEIPT.getStatus().toString())) {
|
||||
if (StringUtils.isBlank(orderInfoDto.getPickupCode())){
|
||||
throw new ServiceException("取件码不能为空");
|
||||
}
|
||||
// 查看存储redis中的取件码,和前端传的取件码做对比
|
||||
String captcha = redisService.getCacheObject(MaterialConstants.DICT_TYPE_ORDER_PICKUP_CODE + orderInfoDto.getOrderId()).toString();
|
||||
if (!captcha.equals(orderInfoDto.getPickupCode())) {
|
||||
throw new ServiceException("取件码错误,请检查后重新输入");
|
||||
}
|
||||
// 删除redis中的取件码
|
||||
redisService.deleteObject(MaterialConstants.DICT_TYPE_ORDER_PICKUP_CODE + orderInfoDto.getOrderId());
|
||||
}
|
||||
// 退租
|
||||
if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_UNDER_LEASE.getStatus().toString())) {
|
||||
if (dtos.size() > 0 && CollectionUtil.isNotEmpty(dtos)) {
|
||||
|
|
@ -348,6 +373,15 @@ public class OrderServiceImpl implements OrderService {
|
|||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成六位随机数取件码
|
||||
* @return
|
||||
*/
|
||||
public static String generateSixDigitNumber() {
|
||||
// 生成一个六位数的随机数,范围是 100000 到 999999
|
||||
return String.valueOf(ThreadLocalRandom.current().nextInt(100000, 1000000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer inputCostRelief(OrderInfoDto orderInfoDto) {
|
||||
int result = 0;
|
||||
|
|
@ -481,4 +515,21 @@ public class OrderServiceImpl implements OrderService {
|
|||
public OrderData getCompanysCost() {
|
||||
return orderMapper.getCompanysCost();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个订单取件码
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getOrderCode(OrderDetailDto dto) {
|
||||
if (dto == null || dto.getOrderId() == null) {
|
||||
throw new RuntimeException("参数不能为空");
|
||||
}
|
||||
Object cacheObject = redisService.getCacheObject(MaterialConstants.DICT_TYPE_ORDER_PICKUP_CODE + dto.getOrderId());
|
||||
if (cacheObject == null) {
|
||||
throw new RuntimeException("未查询到取件码");
|
||||
}
|
||||
return Integer.parseInt(cacheObject.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1024,4 +1024,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
group by mdi.own_co
|
||||
order by device_count desc
|
||||
</select>
|
||||
|
||||
<select id="getLeaseDevList" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||
SELECT
|
||||
d.ma_id AS maId,
|
||||
d.CODE AS code,
|
||||
d.identify_code AS identifyCode,
|
||||
d.device_name AS deviceName,
|
||||
d.device_weight AS deviceWeight,
|
||||
d.device_count AS deviceCount,
|
||||
d.type_id AS typeId,
|
||||
mt4.type_name AS typeName,
|
||||
mt4.unit_name AS unitName,
|
||||
d.ma_status AS maStatus,
|
||||
d.brand AS brand,
|
||||
d.model_name AS modelName,
|
||||
d.production_date AS productionDate,
|
||||
d.working_hours AS workingHours,
|
||||
d.serial_number AS serialNumber,
|
||||
mt4.lease_price AS dayLeasePrice,
|
||||
d.person AS person,
|
||||
d.person_phone AS personPhone,
|
||||
d.create_time AS createTime,
|
||||
d.update_time AS updateTime,
|
||||
d.own_co AS companyId,
|
||||
sd.dept_name AS companyName,
|
||||
c.operate_address AS operateAddress,
|
||||
mt3.type_id AS thirdId,
|
||||
mt3.type_name AS thirdName,
|
||||
mt2.type_id AS secondId,
|
||||
mt2.type_name AS secondName,
|
||||
mt1.type_id AS firstId,
|
||||
mt1.type_name AS firstName
|
||||
FROM
|
||||
ma_dev_info d
|
||||
LEFT JOIN sys_dept sd ON d.own_co = sd.dept_id
|
||||
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = d.type_id
|
||||
AND mt4.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id
|
||||
AND mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id
|
||||
AND mt1.del_flag = '0'
|
||||
WHERE
|
||||
d.is_active = '1' and d.ma_status = '3'
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
d.device_name like concat('%',#{keyWord},'%') or
|
||||
mt1.type_name like concat('%',#{keyWord},'%') or
|
||||
mt2.type_name like concat('%',#{keyWord},'%') or
|
||||
mt3.type_name like concat('%',#{keyWord},'%') or
|
||||
mt4.type_name like concat('%',#{keyWord},'%') or
|
||||
d.person like concat('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
ORDER BY
|
||||
d.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue