系统问题解决
This commit is contained in:
		
							parent
							
								
									3d62104bc7
								
							
						
					
					
						commit
						c5cc430b1e
					
				| 
						 | 
				
			
			@ -26,7 +26,7 @@ public interface DevInfoMapper {
 | 
			
		|||
     */
 | 
			
		||||
    DevInfoVo selectDevInfoByMaId(Long maId);
 | 
			
		||||
 | 
			
		||||
    Integer getMaStatusByMaId(Long maId);
 | 
			
		||||
    DevInfo getMaStatusByMaId(Long maId);
 | 
			
		||||
 | 
			
		||||
    int getHotSearchCountByMaId(Long maId);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -536,11 +536,13 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
			
		|||
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(maIds)) {
 | 
			
		||||
            for (Long maId : maIds) {
 | 
			
		||||
                Integer oldStatus = devInfoMapper.getMaStatusByMaId(maId);
 | 
			
		||||
                DevInfo dto = devInfoMapper.getMaStatusByMaId(maId);
 | 
			
		||||
                Integer newStatus = devInfo.getMaStatus();
 | 
			
		||||
 | 
			
		||||
                if (dto.getDeviceCount() == 0 && newStatus.equals(LISTING.getCode())){
 | 
			
		||||
                    return AjaxResult.warn("设备ID:" + maId + "库存为0,无法上架");
 | 
			
		||||
                }
 | 
			
		||||
                // 根据旧状态和新状态进行状态转换检查
 | 
			
		||||
                switch (oldStatus) {
 | 
			
		||||
                switch (dto.getMaStatus()) {
 | 
			
		||||
                    case 0:
 | 
			
		||||
                        if (newStatus.equals(TO_BE_LISTED.getCode()) || newStatus.equals(ON_HIRE.getCode())) {continue;}
 | 
			
		||||
                        return AjaxResult.warn("设备ID:" + maId + "是草稿状态,只能进行保存操作:" + newStatus);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@ import com.bonus.material.order.mapper.OrderMapper;
 | 
			
		|||
import com.bonus.material.order.service.OrderService;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
| 
						 | 
				
			
			@ -77,6 +78,24 @@ public class OrderController extends BaseController {
 | 
			
		|||
    @PostMapping("/updateOrderStatus")
 | 
			
		||||
    public AjaxResult updateOrderStatus(@RequestBody OrderDetailDto orderInfoDto) {
 | 
			
		||||
        String userName = SecurityUtils.getLoginUser().getUsername();
 | 
			
		||||
        if (orderInfoDto.getOrderId() == null || StringUtils.isBlank(orderInfoDto.getOrderStatus())) {
 | 
			
		||||
            return error("参数错误");
 | 
			
		||||
        }
 | 
			
		||||
        if (orderInfoDto.getOrderStatus().equals("5")) {
 | 
			
		||||
            List<OrderDetailDto> dtos = orderMapper.getOrderDetailsByOrderId(orderInfoDto.getOrderId());
 | 
			
		||||
            if (dtos.size() > 0) {
 | 
			
		||||
                for (OrderDetailDto dto : dtos) {
 | 
			
		||||
                    if ("0".equals(dto.getManageType())) {
 | 
			
		||||
                        // 编码设备已退租的重新上架
 | 
			
		||||
                        dto.setMaStatus("2");
 | 
			
		||||
                        orderMapper.updateDeviceStatus(dto);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        // 数量设备已退租的增加库存
 | 
			
		||||
                        orderMapper.updateAddDevCount(dto);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        Integer i = orderMapper.updateOrderStatus(orderInfoDto.getOrderId(), orderInfoDto.getOrderStatus(), userName);
 | 
			
		||||
        if (i > 0) {
 | 
			
		||||
            return success();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,9 @@ public interface OrderMapper {
 | 
			
		|||
    Integer updateOrderStatus(@Param("orderId") Integer orderId, @Param("orderStatus") String orderStatus,@Param("userName") String userName);
 | 
			
		||||
 | 
			
		||||
    Integer updateDevCount(OrderDetailDto orderDetailDto);
 | 
			
		||||
    Integer updateAddDevCount(OrderDetailDto orderDetailDto);
 | 
			
		||||
 | 
			
		||||
    List<OrderDetailDto> selectOrderDetailsByOderId(String orderId);
 | 
			
		||||
 | 
			
		||||
    List<OrderDetailDto> getOrderDetailsByOrderId(Integer orderId);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -619,8 +619,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        </trim>
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
    <select id="getMaStatusByMaId" resultType="java.lang.Integer">
 | 
			
		||||
        select ma_status from ma_dev_info where ma_id = #{maId}
 | 
			
		||||
    <select id="getMaStatusByMaId" resultType="com.bonus.material.device.domain.DevInfo">
 | 
			
		||||
        select ma_status,device_count from ma_dev_info where ma_id = #{maId}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="selectCompany" resultType="java.lang.Integer">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,11 +53,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            ,rent_over_user = #{userName}
 | 
			
		||||
            ,rent_over_time = now()
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="orderStatus == 7">
 | 
			
		||||
            ,rent_over_user = #{userName}
 | 
			
		||||
            ,rent_over_time = now()
 | 
			
		||||
        </if>
 | 
			
		||||
        where order_id = #{orderId}
 | 
			
		||||
    </update>
 | 
			
		||||
    <update id="updateDevCount">
 | 
			
		||||
        update ma_dev_info set device_count = device_count - #{num} where ma_id = #{maId} and is_active = 1
 | 
			
		||||
    </update>
 | 
			
		||||
    <update id="updateAddDevCount">
 | 
			
		||||
        update ma_dev_info set device_count = device_count + #{num} where ma_id = #{maId} and is_active = 1
 | 
			
		||||
    </update>
 | 
			
		||||
    <select id="getdeviceCount" resultType="com.bonus.material.device.domain.DevInfo">
 | 
			
		||||
        select device_count,device_name from ma_dev_info where ma_id = #{maId} and is_active = 1
 | 
			
		||||
    </select>
 | 
			
		||||
| 
						 | 
				
			
			@ -233,4 +240,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            moi.order_id = #{orderId} and bfi.task_type = 17
 | 
			
		||||
        GROUP BY hh.ma_id
 | 
			
		||||
    </select>
 | 
			
		||||
    <select id="getOrderDetailsByOrderId" resultType="com.bonus.material.order.domain.OrderDetailDto">
 | 
			
		||||
        SELECT
 | 
			
		||||
            hh.id,
 | 
			
		||||
            hh.ma_id,
 | 
			
		||||
            hh.num,
 | 
			
		||||
            mt.manage_type
 | 
			
		||||
        FROM
 | 
			
		||||
            ma_order_details hh
 | 
			
		||||
                LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
 | 
			
		||||
                LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
 | 
			
		||||
        WHERE
 | 
			
		||||
            mt.del_flag = 0 and hh.order_id = #{orderId}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
		Loading…
	
		Reference in New Issue