9 changed files with 402 additions and 47 deletions
@ -0,0 +1,61 @@
|
||||
/* |
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* Neither the name of the dreamlu.net developer nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* Author: Chill 庄骞 (smallchill@163.com) |
||||
*/ |
||||
package com.logpm.distribution.dto; |
||||
|
||||
import com.logpm.distribution.entity.DistributionReservationEntity; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 预约列表 数据传输对象实体类 |
||||
* |
||||
* @author TJJ |
||||
* @since 2023-06-12 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class DistributionReservationDTO extends DistributionReservationEntity { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 备货区编号 |
||||
*/ |
||||
@ApiModelProperty(value = "备货区编号") |
||||
private String goddsAreaId; |
||||
|
||||
/** |
||||
* 备货时间 |
||||
*/ |
||||
@ApiModelProperty(value = "备货时间") |
||||
private Date stockupDate; |
||||
|
||||
/** |
||||
* 增值服务 |
||||
*/ |
||||
@ApiModelProperty(value = "增值服务") |
||||
private List<?> addvalueInfo; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,57 @@
|
||||
/* |
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* Neither the name of the dreamlu.net developer nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* Author: Chill 庄骞 (smallchill@163.com) |
||||
*/ |
||||
package com.logpm.distribution.mapper; |
||||
|
||||
import com.logpm.distribution.entity.DistributionReservationEntity; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.distribution.excel.DistributionReservationExcel; |
||||
import com.logpm.distribution.vo.DistributionReservationVO; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 预约列表 Mapper 接口 |
||||
* |
||||
* @author TJJ |
||||
* @since 2023-06-12 |
||||
*/ |
||||
public interface DistributionReservationMapper extends BaseMapper<DistributionReservationEntity> { |
||||
|
||||
/** |
||||
* 自定义分页 |
||||
* |
||||
* @param page |
||||
* @param distrbutionReservation |
||||
* @return |
||||
*/ |
||||
List<DistributionReservationVO> selectDistrbutionReservationPage(IPage page, DistributionReservationVO distrbutionReservation); |
||||
|
||||
|
||||
/** |
||||
* 获取导出数据 |
||||
* |
||||
* @param queryWrapper |
||||
* @return |
||||
*/ |
||||
List<DistributionReservationExcel> exportDistrbutionReservation(@Param("ew") Wrapper<DistributionReservationEntity> queryWrapper); |
||||
|
||||
Integer addReservations(@Param("list")List<Long> toLongList); |
||||
|
||||
DistributionReservationVO getReservationDetail(String reservationId); |
||||
} |
@ -0,0 +1,184 @@
|
||||
/* |
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* Neither the name of the dreamlu.net developer nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* Author: Chill 庄骞 (smallchill@163.com) |
||||
*/ |
||||
package com.logpm.distribution.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
||||
import com.logpm.distribution.dto.DistributionReservationDTO; |
||||
import com.logpm.distribution.entity.DistributionReservationEntity; |
||||
import com.logpm.distribution.entity.DistributionStockupEntity; |
||||
import com.logpm.distribution.entity.ReservationStockupEntity; |
||||
import com.logpm.distribution.excel.DistributionReservationExcel; |
||||
import com.logpm.distribution.mapper.DistributionReservationMapper; |
||||
import com.logpm.distribution.mapper.DistributionStockupMapper; |
||||
import com.logpm.distribution.mapper.ReservationStockupMapper; |
||||
import com.logpm.distribution.service.IDistributionReservationService; |
||||
import com.logpm.distribution.service.IDistributionStockupService; |
||||
import com.logpm.distribution.vo.DistributionReservationVO; |
||||
import lombok.AllArgsConstructor; |
||||
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; |
||||
import org.springblade.common.utils.CommonUtil; |
||||
import org.springblade.core.secure.BladeUser; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
||||
|
||||
import java.text.DateFormat; |
||||
import java.text.ParseException; |
||||
import java.text.SimpleDateFormat; |
||||
import java.time.LocalDate; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 预约列表 服务实现类 |
||||
* |
||||
* @author TJJ |
||||
* @since 2023-06-12 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class DistributionReservationServiceImpl extends BaseServiceImpl<DistributionReservationMapper, DistributionReservationEntity> implements IDistributionReservationService { |
||||
|
||||
private DistributionReservationMapper distributionReservationMapper; |
||||
|
||||
private IDistributionStockupService distributionStockupService; |
||||
|
||||
private ReservationStockupMapper reservationStockupMapper; |
||||
|
||||
@Override |
||||
public IPage<DistributionReservationVO> selectDistrbutionReservationPage(IPage<DistributionReservationVO> page, DistributionReservationVO distrbutionReservation) { |
||||
return page.setRecords(baseMapper.selectDistrbutionReservationPage(page, distrbutionReservation)); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public List<DistributionReservationExcel> exportDistrbutionReservation(Wrapper<DistributionReservationEntity> queryWrapper) { |
||||
List<DistributionReservationExcel> distrbutionReservationList = baseMapper.exportDistrbutionReservation(queryWrapper); |
||||
//distrbutionReservationList.forEach(distrbutionReservation -> {
|
||||
// distrbutionReservation.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistrbutionReservation.getType()));
|
||||
//});
|
||||
return distrbutionReservationList; |
||||
} |
||||
|
||||
@Override |
||||
public R<?> addReservations(String ids) { |
||||
//对参数进行校验
|
||||
List<Long> longs = Func.toLongList(ids); |
||||
|
||||
if (Func.isEmpty(longs)){ |
||||
log.error("参数异常:+{"+longs+"}"); |
||||
R.fail("服务器异常,请重新添加!!"); |
||||
} |
||||
//这里就对预约信息列表进行批量的确认状态修改
|
||||
boolean result = SqlHelper.retBool(distributionReservationMapper.addReservations(longs)); |
||||
if (result){ |
||||
return R.status(result); |
||||
}else { |
||||
log.error("sql执行错误+{"+result+"}"); |
||||
return null; |
||||
|
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public DistributionReservationVO getReservationDetail(String reservationId) { |
||||
DistributionReservationVO distributionReservationVO = distributionReservationMapper.getReservationDetail(reservationId); |
||||
return distributionReservationVO; |
||||
} |
||||
|
||||
@Override |
||||
@Transactional |
||||
public boolean insertReservation(DistributionReservationDTO distributionReservationDTO) { |
||||
if (Func.isEmpty(distributionReservationDTO)){ |
||||
log.error("参数错误+{"+ distributionReservationDTO +"}"); |
||||
return false; |
||||
} |
||||
DistributionReservationEntity distributionReservationEntity = new DistributionReservationEntity(); |
||||
BeanUtils.copyProperties(distributionReservationDTO, distributionReservationEntity); |
||||
//这里还需要对DTO中的服务内容进行保存
|
||||
|
||||
return false; |
||||
} |
||||
|
||||
|
||||
@Transactional |
||||
@Override |
||||
public R<?> stockUpTask(Map<String,Object> stockUpInfo) { |
||||
if (Func.isEmpty(stockUpInfo)){ |
||||
log.error("参数异常:+{"+stockUpInfo+"}"); |
||||
return R.fail("服务器正忙!!!"); |
||||
} |
||||
boolean result = false; |
||||
try { |
||||
//获取前端携带批量转备货的id
|
||||
String ids = (String) stockUpInfo.get("ids"); |
||||
//完成对备货表数据的保存
|
||||
String stockUpDate = (String) stockUpInfo.get("stockupDate"); |
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); |
||||
Date date = format.parse(stockUpDate); |
||||
String goddsAreaId = (String) stockUpInfo.get("goodsAreaId"); |
||||
DistributionStockupEntity stockupEntity = new DistributionStockupEntity(); |
||||
stockupEntity.setGoodsAreaId(goddsAreaId); |
||||
//设置备货任务指派状态---未指派
|
||||
stockupEntity.setAssignStatus("1"); |
||||
//设置备货任务状态---待备货
|
||||
stockupEntity.setStockupStatus("2"); |
||||
//设置备货任务备货时间
|
||||
stockupEntity.setStockupDate(date); |
||||
//保存备货任务数据获取备货数据ID
|
||||
result = distributionStockupService.save(stockupEntity); |
||||
Long id = stockupEntity.getId(); |
||||
List<Long> reservationIds = Func.toLongList(ids); |
||||
for (Long reservationId : reservationIds) { |
||||
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(reservationId); |
||||
if (Func.isEmpty(reservationEntity) || !reservationEntity.getReservationStatus().equals("2")){ |
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||
log.error("reservationEntity参数异常:+{"+reservationEntity+"}"); |
||||
return R.fail("服务器正忙!!!"); |
||||
} |
||||
//修改预约备货状态
|
||||
reservationEntity.setStockupStatus("2"); |
||||
result = SqlHelper.retBool(distributionReservationMapper.updateById(reservationEntity)); |
||||
//构建中间表信息
|
||||
ReservationStockupEntity reservationStockupEntity = new ReservationStockupEntity(); |
||||
reservationStockupEntity.setStockupId(id.toString()); |
||||
reservationStockupEntity.setReservationId(reservationEntity.getId().toString()); |
||||
result = SqlHelper.retBool(reservationStockupMapper.insert(reservationStockupEntity)); |
||||
if (!result){ |
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||
log.error("sql执行异常:+{"+result+"}"); |
||||
return R.fail("请稍后再试"); |
||||
} |
||||
} |
||||
} catch (ParseException e) { |
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||
log.error("执行异常:+{"+e.getMessage()+"}"); |
||||
return R.fail("请稍后再试"); |
||||
} |
||||
|
||||
//批量备货,循环多条预约信息数据
|
||||
return R.status(result); |
||||
} |
||||
} |
Loading…
Reference in new issue