|
|
@ -26,12 +26,16 @@ |
|
|
|
package com.yxt.anrui.buscenter.biz.busdeliveredapply; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapply.*; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapplydetails.BusDeliveredApplyDetailsDto; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapplydetails.BusDeliveredApplyDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeliveredusemessage.BusDeliveredUseMessage; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeliveredusemessage.BusDeliveredUseMessageVo; |
|
|
|
import com.yxt.anrui.buscenter.biz.busdeliveredapplydetails.BusDeliveredApplyDetailsService; |
|
|
|
import com.yxt.anrui.buscenter.biz.busdeliveredusemessage.BusDeliveredUseMessageService; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
@ -62,6 +66,8 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BusDeliveredApplyDetailsService busDeliveredApplyDetailsService; |
|
|
|
@Autowired |
|
|
|
private BusDeliveredUseMessageService busDeliveredUseMessageService; |
|
|
|
|
|
|
|
private QueryWrapper<BusDeliveredApply> createQueryWrapper(BusDeliveredApplyQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -91,6 +97,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
busDeliveredApplyDetailsService.saveList(dtoList, busDeliveredApply.getSid()); |
|
|
|
} |
|
|
|
save(busDeliveredApply); |
|
|
|
dtoSid = busDeliveredApply.getSid(); |
|
|
|
} else { |
|
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(dtoSid); |
|
|
|
if (busDeliveredApply == null) { |
|
|
@ -98,30 +105,13 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
//删除
|
|
|
|
busDeliveredApplyDetailsService.deleteByApplySid(dtoSid); |
|
|
|
busDeliveredUseMessageService.deleteByApplySid(dtoSid); |
|
|
|
List<BusDeliveredApplyDetailsDto> dtoList = dto.getDetailsList(); |
|
|
|
if (dtoList.size() > 0) { |
|
|
|
busDeliveredApplyDetailsService.saveList(dtoList, busDeliveredApply.getSid()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public void insertByDto(BusDeliveredApplyDto dto) { |
|
|
|
BusDeliveredApply entity = new BusDeliveredApply(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
public void updateByDto(BusDeliveredApplyDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
BusDeliveredApply entity = fetchBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
return rb.success().setData(dtoSid); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -158,9 +148,39 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
//根据出库申请单的sid查询需要出库的车辆信息
|
|
|
|
List<BusDeliveredApplyDetailsVo> voList = busDeliveredApplyDetailsService.detailsList(sid); |
|
|
|
for (int i = 0; i < voList.size(); i++) { |
|
|
|
BusDeliveredUseMessage busDeliveredUseMessage = busDeliveredUseMessageService.fetchBySid(voList.get(i).getUseMessageSid()); |
|
|
|
BusDeliveredUseMessageVo busDeliveredUseMessageVo = new BusDeliveredUseMessageVo(); |
|
|
|
BeanUtil.copyProperties(busDeliveredUseMessage, busDeliveredUseMessageVo); |
|
|
|
voList.get(i).setUseMessage(busDeliveredUseMessageVo); |
|
|
|
} |
|
|
|
vo.setListVo(voList); |
|
|
|
|
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean submit(BusDeliveredApplyDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
ResultBean resultBean = saveOrUpdateDto(dto); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
String sid = resultBean.getData().toString(); |
|
|
|
//更新出库申请的状态为待审核。
|
|
|
|
//状态:1待提交,2待审核,3已通过,4未通过
|
|
|
|
baseMapper.updateStateBySid(2, sid, DateUtil.date()); |
|
|
|
return rb.success().setMsg("提交成功"); |
|
|
|
} |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean submitBySid(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(sid); |
|
|
|
if (busDeliveredApply == null) { |
|
|
|
return rb.setMsg("该出库申请不存在"); |
|
|
|
} |
|
|
|
//状态:1待提交,2待审核,3已通过,4未通过
|
|
|
|
baseMapper.updateStateBySid(2, sid, DateUtil.date()); |
|
|
|
return rb.success().setMsg("提交成功"); |
|
|
|
} |
|
|
|
} |