|
@ -5,10 +5,7 @@ import cn.hutool.core.date.DateUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.yxt.anrui.base.api.busvehicleapply.BusVehicleApply; |
|
|
import com.yxt.anrui.base.api.busvehicleapply.*; |
|
|
import com.yxt.anrui.base.api.busvehicleapply.BusVehicleApplyDto; |
|
|
|
|
|
import com.yxt.anrui.base.api.busvehicleapply.BusVehicleApplyQuery; |
|
|
|
|
|
import com.yxt.anrui.base.api.busvehicleapply.BusVehicleApplyVo; |
|
|
|
|
|
import com.yxt.anrui.base.api.busvehicleapply.flow.GetNodeQuery; |
|
|
import com.yxt.anrui.base.api.busvehicleapply.flow.GetNodeQuery; |
|
|
import com.yxt.anrui.base.api.busvehicleapply.flow.GetNodeVo; |
|
|
import com.yxt.anrui.base.api.busvehicleapply.flow.GetNodeVo; |
|
|
import com.yxt.anrui.base.api.busvehicleapply.flow.SubmitBusVehicleApplyDto; |
|
|
import com.yxt.anrui.base.api.busvehicleapply.flow.SubmitBusVehicleApplyDto; |
|
@ -33,6 +30,7 @@ import com.yxt.common.core.vo.PagerVo; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
@ -67,49 +65,38 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
@Autowired |
|
|
@Autowired |
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
|
|
|
|
|
private QueryWrapper<BusVehicleApply> createQueryWrapper(BusVehicleApplyQuery query) { |
|
|
/** |
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
* 分页列表 |
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
* |
|
|
QueryWrapper<BusVehicleApply> qw = new QueryWrapper<>(); |
|
|
* @param pq 查询条件 |
|
|
String applicationDateStart = query.getApplicationDateStart(); |
|
|
* @return |
|
|
String applicationDateEnd = query.getApplicationDateEnd(); |
|
|
*/ |
|
|
|
|
|
|
|
|
qw.apply(StringUtils.isNotEmpty(applicationDateStart), "date_format (bva.applicationDate,'%Y-%m-%d') >= date_format('" + applicationDateStart + "','%Y-%m-%d')"). |
|
|
|
|
|
apply(StringUtils.isNotEmpty(applicationDateEnd), "date_format (bva.applicationDate,'%Y-%m-%d') <= date_format('" + applicationDateEnd + "','%Y-%m-%d')" |
|
|
|
|
|
); |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getModelName())) { |
|
|
|
|
|
qw.like("bvad.vehicleName", query.getModelName()); |
|
|
|
|
|
} |
|
|
|
|
|
return qw; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PagerVo<BusVehicleApplyVo> listPageVo(PagerQuery<BusVehicleApplyQuery> pq) { |
|
|
public PagerVo<BusVehicleApplyVo> listPageVo(PagerQuery<BusVehicleApplyQuery> pq) { |
|
|
BusVehicleApplyQuery query = pq.getParams(); |
|
|
BusVehicleApplyQuery query = pq.getParams(); |
|
|
QueryWrapper<BusVehicleApply> qw = createQueryWrapper(query); |
|
|
QueryWrapper<BusVehicleApply> qw = new QueryWrapper<>(); |
|
|
|
|
|
BusVehicleApplyQuery params = pq.getParams(); |
|
|
|
|
|
if (params != null) { |
|
|
|
|
|
String applicationDateStart = query.getApplicationDateStart(); |
|
|
|
|
|
String applicationDateEnd = query.getApplicationDateEnd(); |
|
|
|
|
|
qw.apply(StringUtils.isNotBlank(applicationDateStart), "date_format (bva.applicationDate,'%Y-%m-%d') >= date_format('" + applicationDateStart + "','%Y-%m-%d')"). |
|
|
|
|
|
apply(StringUtils.isNotBlank(applicationDateEnd), "date_format (bva.applicationDate,'%Y-%m-%d') <= date_format('" + applicationDateEnd + "','%Y-%m-%d')" |
|
|
|
|
|
); |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getModelName())) { |
|
|
|
|
|
qw.like("bvad.vehicleName", query.getModelName()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
IPage<BusVehicleApply> page = PagerUtil.queryToPage(pq); |
|
|
IPage<BusVehicleApply> page = PagerUtil.queryToPage(pq); |
|
|
IPage<BusVehicleApplyVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
IPage<BusVehicleApplyVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
PagerVo<BusVehicleApplyVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
PagerVo<BusVehicleApplyVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
List<BusVehicleApplyVo> records = p.getRecords(); |
|
|
|
|
|
for (BusVehicleApplyVo record : records) { |
|
|
|
|
|
String createBySid = record.getCreateBySid(); |
|
|
|
|
|
ResultBean<SysUserVo> sysUserVoResultBean = sysUserFeign.fetchBySid(createBySid); |
|
|
|
|
|
String name = sysUserVoResultBean.getData().getName(); |
|
|
|
|
|
record.setCreateByName(name); |
|
|
|
|
|
if (StringUtils.isBlank(record.getNodeState())) { |
|
|
|
|
|
record.setNodeState("待提交"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return p; |
|
|
return p; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
public BusVehicleApplyVo fetchByIdVo(String id) { |
|
|
* 批量删除 |
|
|
BusVehicleApply entity = this.fetchById(id); |
|
|
* |
|
|
BusVehicleApplyVo vo = new BusVehicleApplyVo(); |
|
|
* @param sids 排产申请sid数组 |
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
*/ |
|
|
return vo; |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void delAllBySids(String[] sids) { |
|
|
public void delAllBySids(String[] sids) { |
|
|
this.delBySids(sids); |
|
|
this.delBySids(sids); |
|
|
for (String sid : sids) { |
|
|
for (String sid : sids) { |
|
@ -117,13 +104,19 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public BusVehicleApplyVo fetchAllBySid(String sid) { |
|
|
/** |
|
|
BusVehicleApplyVo busVehicleApplyVo = new BusVehicleApplyVo(); |
|
|
* 编辑初始化、详情 |
|
|
|
|
|
* |
|
|
|
|
|
* @param sid 排产申请sid |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public BusVehicleApplyDetailsVo fetchAllBySid(String sid) { |
|
|
|
|
|
BusVehicleApplyDetailsVo busVehicleApplyDetailsVo = new BusVehicleApplyDetailsVo(); |
|
|
BusVehicleApply busVehicleApply = this.fetchBySid(sid); |
|
|
BusVehicleApply busVehicleApply = this.fetchBySid(sid); |
|
|
BeanUtil.copyProperties(busVehicleApply, busVehicleApplyVo); |
|
|
BeanUtil.copyProperties(busVehicleApply, busVehicleApplyDetailsVo); |
|
|
List<BusVehicleApplyDetailVo> busVehicleApplyDetailVos = busVehicleApplyDetailService.fetchByApplySid(sid); |
|
|
List<BusVehicleApplyDetailVo> busVehicleApplyDetailVos = busVehicleApplyDetailService.fetchByApplySid(sid); |
|
|
busVehicleApplyVo.setBusVehicleApplyDetailVoList(busVehicleApplyDetailVos); |
|
|
busVehicleApplyDetailsVo.setBusVehicleApplyDetailVoList(busVehicleApplyDetailVos); |
|
|
return busVehicleApplyVo; |
|
|
return busVehicleApplyDetailsVo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -270,7 +263,7 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
ResultBean<List<GetNodeVo>> rb = ResultBean.fireFail(); |
|
|
ResultBean<List<GetNodeVo>> rb = ResultBean.fireFail(); |
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
BeanUtil.copyProperties(query, bv); |
|
|
BeanUtil.copyProperties(query, bv); |
|
|
bv.setModelId(ProcDefEnum.BASEOUTSOURCINGAPPLICATION.getProDefId()); |
|
|
bv.setModelId(ProcDefEnum.VEHICLEAPPLY.getProDefId()); |
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
List<GetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), GetNodeVo.class)).collect(Collectors.toList()); |
|
|
List<GetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), GetNodeVo.class)).collect(Collectors.toList()); |
|
|