|
|
@ -3,15 +3,19 @@ package com.yxt.anrui.buscenter.biz.busdiscountpackagehandover; |
|
|
|
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.base.api.commoncontract.CommonContract; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContractFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandover.*; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandover.app.AppBusDiscountpackageHandocerDto; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandover.app.AppBusDiscountpackageHandoverListDto; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandover.app.AppBusDiscountpackageHandoverQuery; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandover.app.AppBusDiscountpackageHandoverVo; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandoverlist.BusDiscountpackageHandoverList; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandoverlist.BusDiscountpackageHandoverListDto; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandoverlist.BusDiscountpackageHandoverListVo; |
|
|
|
import com.yxt.anrui.buscenter.api.busfile.BusFile; |
|
|
|
import com.yxt.anrui.buscenter.api.busfile.BusFileDto; |
|
|
|
import com.yxt.anrui.buscenter.biz.busdiscountpackagehandoverlist.BusDiscountpackageHandoverListService; |
|
|
|
import com.yxt.anrui.buscenter.biz.busfile.BusFileService; |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedPdfVo; |
|
|
|
import com.yxt.anrui.portal.api.sysrole.SysRoleFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysrole.SysRoleVo; |
|
|
|
import com.yxt.common.base.config.component.DocPdfComponent; |
|
|
@ -22,12 +26,14 @@ import com.yxt.common.base.utils.WordConvertUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.apache.commons.beanutils.BeanUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
@ -50,6 +56,8 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
private BusFileService busFileService; |
|
|
|
@Autowired |
|
|
|
private DocPdfComponent docPdfComponent; |
|
|
|
@Autowired |
|
|
|
private CommonContractFeign commonContractFeign; |
|
|
|
|
|
|
|
/** |
|
|
|
* 筛选条件 |
|
|
@ -95,6 +103,7 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public PagerVo<BusDiscountpackageHandoverVo> listPage(PagerQuery<BusDiscountpackageHandoverQuery> pq) { |
|
|
|
|
|
|
|
//从传入参数中取查询条件
|
|
|
|
BusDiscountpackageHandoverQuery query = pq.getParams(); |
|
|
|
//取到当前登录用户的sid
|
|
|
@ -113,6 +122,51 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
QueryWrapper<BusDiscountpackageHandover> qw = createQueryWrapper(query); |
|
|
|
IPage<BusDiscountpackageHandover> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<BusDiscountpackageHandoverVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
List<BusDiscountpackageHandoverVo> records = pagging.getRecords(); |
|
|
|
if (null != records) { |
|
|
|
for (BusDiscountpackageHandoverVo record : records) { |
|
|
|
if (null != record) { |
|
|
|
// 待准备 服务站人员 ture 销售专员 false
|
|
|
|
if (null != record.getState() && record.getState() == 1) { |
|
|
|
//判断当前登录用户角色是否为销售专员
|
|
|
|
if (null != roleVoList) { |
|
|
|
for (SysRoleVo sysRoleVo : roleVoList) { |
|
|
|
//如果当前登录用户角色包含分公司销售专员,将当前用户sid保存到查询条件中
|
|
|
|
if ("分公司销售专员".equals(sysRoleVo.getName())) { |
|
|
|
record.setShowHandover(false); |
|
|
|
break; |
|
|
|
} else { |
|
|
|
record.setShowHandover(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 待交接 服务站人员 false 销售专员 ture
|
|
|
|
if (null != record.getState() && record.getState() == 2) { |
|
|
|
//判断当前登录用户角色是否为销售专员
|
|
|
|
if (null != roleVoList) { |
|
|
|
for (SysRoleVo sysRoleVo : roleVoList) { |
|
|
|
//如果当前登录用户角色包含分公司销售专员,将当前用户sid保存到查询条件中
|
|
|
|
if ("分公司销售专员".equals(sysRoleVo.getName())) { |
|
|
|
record.setShowToDoHandover(true); |
|
|
|
break; |
|
|
|
} else { |
|
|
|
record.setShowToDoHandover(false); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getContractNo())) { |
|
|
|
CommonContract commonContract = commonContractFeign.selectByNo(record.getContractNo()).getData(); |
|
|
|
if (null != commonContract) { |
|
|
|
if (StringUtils.isNotBlank(commonContract.getBusSid())) { |
|
|
|
record.setSalesOrderSid(commonContract.getBusSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<BusDiscountpackageHandoverVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
@ -127,40 +181,40 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
String sid = entity.getSid(); |
|
|
|
dto.setSid(sid); |
|
|
|
dto.fillEntity(entity); |
|
|
|
List<BusDiscountpackageHandoverListDto> listDtos = dto.getBusDiscountpackageHandoverLists(); |
|
|
|
if (null != listDtos) { |
|
|
|
for (BusDiscountpackageHandoverListDto listDto : listDtos) { |
|
|
|
listDto.setMainSid(entity.getSid()); |
|
|
|
BusDiscountpackageHandoverList handoverList = new BusDiscountpackageHandoverList(); |
|
|
|
String listSid = handoverList.getSid(); |
|
|
|
listDto.setMainSid(sid); |
|
|
|
listDto.setSid(listSid); |
|
|
|
listDto.fillEntity(handoverList); |
|
|
|
busDiscountpackageHandoverListService.save(handoverList); |
|
|
|
entity.setVins(dto.getVinNo()); |
|
|
|
boolean save = this.save(entity); |
|
|
|
if (save) { |
|
|
|
List<BusDiscountpackageHandoverListDto> listDtos = dto.getBusDiscountpackageHandoverLists(); |
|
|
|
if (null != listDtos) { |
|
|
|
for (BusDiscountpackageHandoverListDto listDto : listDtos) { |
|
|
|
listDto.setMainSid(entity.getSid()); |
|
|
|
BusDiscountpackageHandoverList handoverList = new BusDiscountpackageHandoverList(); |
|
|
|
String listSid = handoverList.getSid(); |
|
|
|
listDto.setMainSid(sid); |
|
|
|
listDto.setSid(listSid); |
|
|
|
listDto.fillEntity(handoverList); |
|
|
|
busDiscountpackageHandoverListService.save(handoverList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return this.save(entity); |
|
|
|
return save; |
|
|
|
} |
|
|
|
|
|
|
|
public BusDiscountpackageHandoverToDoVo handover(String sid) { |
|
|
|
BusDiscountpackageHandoverToDoVo toDoVo = new BusDiscountpackageHandoverToDoVo(); |
|
|
|
/** |
|
|
|
* 交接(准备)详情编辑回显 |
|
|
|
* |
|
|
|
* @param sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public BusDiscountpackageHandoverDto handover(String sid) throws InvocationTargetException, IllegalAccessException { |
|
|
|
|
|
|
|
BusDiscountpackageHandoverDto dto = new BusDiscountpackageHandoverDto(); |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
toDoVo.setSid(sid); |
|
|
|
dto.setSid(sid); |
|
|
|
//根据待交接sid查询
|
|
|
|
BusDiscountpackageHandover ph = this.fetchBySid(sid); |
|
|
|
if (null != ph) { |
|
|
|
if (StringUtils.isNotBlank(ph.getContractNo())) { |
|
|
|
toDoVo.setContractNo(ph.getContractNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(ph.getCustomerName())) { |
|
|
|
toDoVo.setCustomerName(ph.getCustomerName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(ph.getVehModel())) { |
|
|
|
toDoVo.setVehModel(ph.getVehModel()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(ph.getVehCount())) { |
|
|
|
toDoVo.setVehCount(ph.getVehCount()); |
|
|
|
} |
|
|
|
BeanUtils.copyProperties(dto, ph); |
|
|
|
if (StringUtils.isNotBlank(ph.getVins())) { |
|
|
|
String vins = ph.getVins(); |
|
|
|
String[] split = vins.split(","); |
|
|
@ -174,12 +228,21 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
sb.append(vinNo).append(","); |
|
|
|
} |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
toDoVo.setVinNo(sb.toString()); |
|
|
|
dto.setVinNo(sb.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
//根据关联sid查询图片
|
|
|
|
List<BusFileDto> busFileDtos = busFileService.getPathByLinkSid(sid); |
|
|
|
List<BusDiscountpackageHandoverListDto> lists = this.returnHandoverListVo(sid); |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
if (null != busFileDtos) { |
|
|
|
for (BusFileDto busFileDto : busFileDtos) { |
|
|
|
busFileDto.setFilePath(urlPrefix + busFileDto.getFilePath()); |
|
|
|
} |
|
|
|
dto.setBusFiles(busFileDtos); |
|
|
|
} |
|
|
|
List<BusDiscountpackageHandoverListVo> listVos = this.returnHandoverListVo(sid); |
|
|
|
toDoVo.setBusDiscountpackageHandoverLists(listVos); |
|
|
|
return toDoVo; |
|
|
|
dto.setBusDiscountpackageHandoverLists(lists); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -191,7 +254,8 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
*/ |
|
|
|
public int toDohandover(BusDiscountpackageHandoverDto dto) throws ParseException { |
|
|
|
String sid = dto.getSid(); |
|
|
|
String userSid = dto.getUserSid(); |
|
|
|
String userSid = dto.getCreateBySid(); |
|
|
|
int i = 0; |
|
|
|
//根据当前用户sid查询用户角色
|
|
|
|
List<SysRoleVo> roleVoList = sysRoleFeign.fetchByUserSid(userSid).getData(); |
|
|
|
//判断当前登录用户角色是否为销售专员
|
|
|
@ -204,33 +268,42 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
String currentTime = simpleDateFormat.format(System.currentTimeMillis()); |
|
|
|
Date currentDate = simpleDateFormat.parse(currentTime); |
|
|
|
dto.setRecTime(currentDate); |
|
|
|
if (StringUtils.isNotBlank(dto.getState())) { |
|
|
|
i = this.updateBySid(dto.toMap(), sid); |
|
|
|
} |
|
|
|
List<BusFileDto> busFiles = dto.getBusFiles(); |
|
|
|
if (null != busFiles) { |
|
|
|
if (null != busFiles && i > 0) { |
|
|
|
this.uploadPicture(dto); |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else if ((sysRoleVo.getName()).contains("服务站长")) { |
|
|
|
dto.setState("2"); |
|
|
|
if (StringUtils.isNotBlank(dto.getState())) { |
|
|
|
i = this.updateBySid(dto.toMap(), sid); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
int i = this.updateBySid(dto.toMap(), sid); |
|
|
|
List<BusDiscountpackageHandoverListDto> listDtos = dto.getBusDiscountpackageHandoverLists(); |
|
|
|
for (BusDiscountpackageHandoverListDto listDto : listDtos) { |
|
|
|
String listDtoSid = listDto.getSid(); |
|
|
|
//判断当前登录用户角色是否为销售专员
|
|
|
|
if (null != roleVoList) { |
|
|
|
for (SysRoleVo sysRoleVo : roleVoList) { |
|
|
|
//如果当前登录用户角色包含分公司销售专员,将当前用户sid保存到查询条件中
|
|
|
|
if ("分公司销售专员".equals(sysRoleVo.getName())) { |
|
|
|
listDto.setState("3"); |
|
|
|
} else { |
|
|
|
listDto.setState("2"); |
|
|
|
if (i > 0) { |
|
|
|
List<BusDiscountpackageHandoverListDto> listDtos = dto.getBusDiscountpackageHandoverLists(); |
|
|
|
for (BusDiscountpackageHandoverListDto listDto : listDtos) { |
|
|
|
String listDtoSid = listDto.getSid(); |
|
|
|
//判断当前登录用户角色是否为销售专员
|
|
|
|
if (null != roleVoList) { |
|
|
|
for (SysRoleVo sysRoleVo : roleVoList) { |
|
|
|
//如果当前登录用户角色包含分公司销售专员,将当前用户sid保存到查询条件中
|
|
|
|
if ("分公司销售专员".equals(sysRoleVo.getName())) { |
|
|
|
listDto.setState("3"); |
|
|
|
} else if ((sysRoleVo.getName()).contains("服务站长")) { |
|
|
|
listDto.setState("2"); |
|
|
|
} |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String currentTime = simpleDateFormat.format(System.currentTimeMillis()); |
|
|
|
Date currentDate = simpleDateFormat.parse(currentTime); |
|
|
|
listDto.setModifyTime(currentDate); |
|
|
|
if (StringUtils.isNotBlank(listDto.getState())) { |
|
|
|
busDiscountpackageHandoverListService.updateStateBySid(listDto.getState(), listDto.getModifyTime(), listDtoSid); |
|
|
|
} |
|
|
|
} |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String currentTime = simpleDateFormat.format(System.currentTimeMillis()); |
|
|
|
Date currentDate = simpleDateFormat.parse(currentTime); |
|
|
|
listDto.setModifyTime(currentDate); |
|
|
|
busDiscountpackageHandoverListService.updateStateBySid(listDto.getState(), listDto.getModifyTime(), listDtoSid); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -284,20 +357,20 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
detailsVo.setRemarks(ph.getRemarks()); |
|
|
|
} |
|
|
|
} |
|
|
|
List<BusDiscountpackageHandoverListVo> listVos = this.returnHandoverListVo(sid); |
|
|
|
List<BusDiscountpackageHandoverListDto> listVos = this.returnHandoverListVo(sid); |
|
|
|
detailsVo.setBusDiscountpackageHandoverLists(listVos); |
|
|
|
return detailsVo; |
|
|
|
} |
|
|
|
|
|
|
|
//根据sid查询优惠包列表
|
|
|
|
private List<BusDiscountpackageHandoverListVo> returnHandoverListVo(String sid) { |
|
|
|
private List<BusDiscountpackageHandoverListDto> returnHandoverListVo(String sid) { |
|
|
|
//定义序号
|
|
|
|
int i = 1; |
|
|
|
List<BusDiscountpackageHandoverListVo> listVos = new ArrayList<>(); |
|
|
|
List<BusDiscountpackageHandoverListDto> listVos = new ArrayList<>(); |
|
|
|
List<BusDiscountpackageHandoverList> listByMainSid = busDiscountpackageHandoverListService.findListByMainSid(sid); |
|
|
|
if (null != listByMainSid) { |
|
|
|
for (BusDiscountpackageHandoverList handoverList : listByMainSid) { |
|
|
|
BusDiscountpackageHandoverListVo listVo = new BusDiscountpackageHandoverListVo(); |
|
|
|
BusDiscountpackageHandoverListDto listVo = new BusDiscountpackageHandoverListDto(); |
|
|
|
if (StringUtils.isNotBlank(handoverList.getSid())) { |
|
|
|
listVo.setSid(handoverList.getSid()); |
|
|
|
} |
|
|
@ -316,6 +389,13 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
if (StringUtils.isNotBlank(handoverList.getPackageExplain())) { |
|
|
|
listVo.setPackageExplain(handoverList.getPackageExplain()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(handoverList.getRemarks())) { |
|
|
|
listVo.setRemarks(handoverList.getRemarks()); |
|
|
|
} |
|
|
|
if (null != handoverList.getState()) { |
|
|
|
listVo.setState(String.valueOf(handoverList.getState())); |
|
|
|
} |
|
|
|
listVo.setMainSid(sid); |
|
|
|
listVo.setSNo(i++); |
|
|
|
listVos.add(listVo); |
|
|
|
} |
|
|
@ -338,14 +418,14 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
File file = WordConvertUtils.mulFile2One(fileList, targetPath + "优惠包交接确认单" + dateStr + seconds + ".pdf"); |
|
|
|
File file = WordConvertUtils.mulFile2One(fileList, targetPath + dateStr + seconds + "优惠包交接确认单.pdf"); |
|
|
|
if (fileList.size() <= 0) { |
|
|
|
path = null; |
|
|
|
} else { |
|
|
|
for (File fileDelete : fileList) { |
|
|
|
fileDelete.delete(); |
|
|
|
} |
|
|
|
path = filePath + "优惠包交接确认单" + dateStr + seconds + ".pdf"; |
|
|
|
path = filePath + dateStr + seconds + "优惠包交接确认单.pdf"; |
|
|
|
} |
|
|
|
return rb.success().setData(path); |
|
|
|
} |
|
|
@ -353,7 +433,7 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
public String commonCreatePdf(BusDiscountpackageHandoverDetailsVo pdfVo) { |
|
|
|
|
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
List<BusDiscountpackageHandoverListVo> handoverLists = pdfVo.getBusDiscountpackageHandoverLists(); |
|
|
|
List<BusDiscountpackageHandoverListDto> handoverLists = pdfVo.getBusDiscountpackageHandoverLists(); |
|
|
|
List<Map<String, Object>> newList = new ArrayList<>(); |
|
|
|
dataMap.put("customerName", pdfVo.getCustomerName()); |
|
|
|
dataMap.put("vehCount", pdfVo.getVehCount()); |
|
|
@ -363,7 +443,7 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
dataMap.put("vinNo", pdfVo.getVinNo()); |
|
|
|
dataMap.put("remarks", pdfVo.getRemarks()); |
|
|
|
if (null != handoverLists) { |
|
|
|
for (BusDiscountpackageHandoverListVo handoverList : handoverLists) { |
|
|
|
for (BusDiscountpackageHandoverListDto handoverList : handoverLists) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("sNo", handoverList.getSNo()); |
|
|
|
map.put("discountName", handoverList.getDiscountName()); |
|
|
@ -392,18 +472,220 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
return path; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 上传图片 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public boolean uploadPicture(BusDiscountpackageHandoverDto dto) { |
|
|
|
boolean isSuccess = false; |
|
|
|
BusDiscountpackageHandover bh = this.fetchById(dto.getSid()); |
|
|
|
String sid = dto.getSid(); |
|
|
|
BusDiscountpackageHandover bh = this.fetchById(sid); |
|
|
|
if (null != dto.getBusFiles()) { |
|
|
|
List<BusFileDto> busFiles = dto.getBusFiles(); |
|
|
|
for (BusFileDto busFile : busFiles) { |
|
|
|
BusFile bf = new BusFile(); |
|
|
|
busFile.setLinkSid(sid); |
|
|
|
String uploadPath = fileUploadComponent.getUrlPrefix(); |
|
|
|
String substring = busFile.getFilePath().substring(uploadPath.length()); |
|
|
|
busFile.setFilePath(substring); |
|
|
|
busFile.fillEntity(bf); |
|
|
|
isSuccess = busFileService.save(bf); |
|
|
|
} |
|
|
|
} |
|
|
|
return isSuccess; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*************移动端接口***************************/ |
|
|
|
|
|
|
|
private QueryWrapper<BusDiscountpackageHandover> appCreateQueryWrapper(AppBusDiscountpackageHandoverQuery query) { |
|
|
|
QueryWrapper<BusDiscountpackageHandover> qw = new QueryWrapper<>(); |
|
|
|
qw.eq("useOrgSid", query.getOrgPath()); |
|
|
|
qw.eq("isDelete", 0); |
|
|
|
if (StringUtils.isNotBlank(query.getRecUserSid())) { |
|
|
|
qw.eq("recUserSid", query.getRecUserSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getType())) { |
|
|
|
if (query.getType().equals("3")) { |
|
|
|
qw.eq("state", query.getType()); |
|
|
|
} else { |
|
|
|
qw.ne("state", 3); |
|
|
|
} |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 移动端交接分页 |
|
|
|
* |
|
|
|
* @param pq |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public PagerVo<AppBusDiscountpackageHandoverVo> getDiscountHandoverList(PagerQuery<AppBusDiscountpackageHandoverQuery> pq) { |
|
|
|
//从传入参数中取查询条件
|
|
|
|
AppBusDiscountpackageHandoverQuery query = pq.getParams(); |
|
|
|
//取到当前登录用户的sid
|
|
|
|
String userSid = query.getUserSid(); |
|
|
|
query.setRecUserSid(userSid); |
|
|
|
QueryWrapper<BusDiscountpackageHandover> qw = appCreateQueryWrapper(query); |
|
|
|
IPage<BusDiscountpackageHandover> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<AppBusDiscountpackageHandoverVo> pagging = baseMapper.selectAppPageVo(page, qw); |
|
|
|
List<AppBusDiscountpackageHandoverVo> records = pagging.getRecords(); |
|
|
|
if (null != records) { |
|
|
|
for (AppBusDiscountpackageHandoverVo record : records) { |
|
|
|
if (null != record) { |
|
|
|
if (StringUtils.isNotBlank(record.getContractId())) { |
|
|
|
String busSid = commonContractFeign.selectByNo(record.getContractId()).getData().getBusSid(); |
|
|
|
record.setSalesOrderSid(busSid); |
|
|
|
} |
|
|
|
if (null != record.getType()) { |
|
|
|
if (record.getType() == 1 || record.getType() == 2) { |
|
|
|
record.setShowHandleBtn(true); |
|
|
|
} else if (record.getType() == 3) { |
|
|
|
record.setShowDownloadBtn(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<AppBusDiscountpackageHandoverVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 移动端交接详情编辑回显 |
|
|
|
* |
|
|
|
* @param sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public AppBusDiscountpackageHandocerDto getDiscountHandoverInfo(String sid) throws InvocationTargetException, IllegalAccessException { |
|
|
|
AppBusDiscountpackageHandocerDto dto = new AppBusDiscountpackageHandocerDto(); |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
dto.setSid(sid); |
|
|
|
//根据待交接sid查询
|
|
|
|
BusDiscountpackageHandover ph = this.fetchBySid(sid); |
|
|
|
if (null != ph) { |
|
|
|
BeanUtils.copyProperties(dto, ph); |
|
|
|
if (StringUtils.isNotBlank(ph.getUseOrgSid())) { |
|
|
|
dto.setOrgPath(ph.getUseOrgSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(ph.getVehModel())) { |
|
|
|
dto.setModel(ph.getVehModel()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(ph.getVehCount())) { |
|
|
|
dto.setCarNumber(ph.getVehCount()); |
|
|
|
} |
|
|
|
if (null != ph.getState()) { |
|
|
|
dto.setType(String.valueOf(ph.getState())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(ph.getContractNo())) { |
|
|
|
dto.setContractId(ph.getContractNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(ph.getVins())) { |
|
|
|
String vins = ph.getVins(); |
|
|
|
String[] split = vins.split(","); |
|
|
|
for (String s : split) { |
|
|
|
String vinNo = ""; |
|
|
|
if (s.length() > 8) { |
|
|
|
vinNo = s.substring(s.length() - 8); |
|
|
|
} else { |
|
|
|
vinNo = s; |
|
|
|
} |
|
|
|
sb.append(vinNo).append("、"); |
|
|
|
} |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
dto.setVins(sb.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
//根据关联sid查询图片
|
|
|
|
List<BusFileDto> busFileDtos = busFileService.getPathByLinkSid(sid); |
|
|
|
List<BusDiscountpackageHandoverListDto> lists = this.returnHandoverListVo(sid); |
|
|
|
List<AppBusDiscountpackageHandoverListDto> appListDtos = new ArrayList<>(); |
|
|
|
if (null != lists) { |
|
|
|
for (BusDiscountpackageHandoverListDto bhListDto : lists) { |
|
|
|
AppBusDiscountpackageHandoverListDto appDto = new AppBusDiscountpackageHandoverListDto(); |
|
|
|
if (null != bhListDto) { |
|
|
|
BeanUtils.copyProperties(appDto, bhListDto); |
|
|
|
if (StringUtils.isNotBlank(bhListDto.getNumber())) { |
|
|
|
appDto.setDiscountNum(bhListDto.getNumber()); |
|
|
|
} |
|
|
|
if (null != bhListDto.getState()) { |
|
|
|
appDto.setType(String.valueOf(bhListDto.getState())); |
|
|
|
} |
|
|
|
appListDtos.add(appDto); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
if (null != busFileDtos) { |
|
|
|
for (BusFileDto busFileDto : busFileDtos) { |
|
|
|
busFileDto.setFilePath(urlPrefix + busFileDto.getFilePath()); |
|
|
|
} |
|
|
|
dto.setBusFiles(busFileDtos); |
|
|
|
} |
|
|
|
dto.setBusDiscountpackageHandoverLists(appListDtos); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 移动端交接操作 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public int todoPackageHandover(AppBusDiscountpackageHandocerDto dto) throws InvocationTargetException, IllegalAccessException, ParseException { |
|
|
|
String sid = dto.getSid(); |
|
|
|
int i = 0; |
|
|
|
BusDiscountpackageHandoverDto bdhDto = new BusDiscountpackageHandoverDto(); |
|
|
|
BeanUtils.copyProperties(bdhDto, dto); |
|
|
|
bdhDto.setSid(dto.getSid()); |
|
|
|
bdhDto.setState("3"); |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String currentTime = simpleDateFormat.format(System.currentTimeMillis()); |
|
|
|
Date currentDate = simpleDateFormat.parse(currentTime); |
|
|
|
bdhDto.setRecTime(currentDate); |
|
|
|
List<BusFileDto> busFiles = bdhDto.getBusFiles(); |
|
|
|
if (StringUtils.isNotBlank(bdhDto.getState())) { |
|
|
|
i = this.updateBySid(bdhDto.toMap(), sid); |
|
|
|
} |
|
|
|
if (null != busFiles && i > 0) { |
|
|
|
this.uploadPicture(bdhDto); |
|
|
|
} |
|
|
|
if (i > 0) { |
|
|
|
List<AppBusDiscountpackageHandoverListDto> listDtos = dto.getBusDiscountpackageHandoverLists(); |
|
|
|
for (AppBusDiscountpackageHandoverListDto listDto : listDtos) { |
|
|
|
String listDtoSid = listDto.getSid(); |
|
|
|
BusDiscountpackageHandoverListDto dtoList = new BusDiscountpackageHandoverListDto(); |
|
|
|
BeanUtils.copyProperties(dtoList, listDto); |
|
|
|
dtoList.setSid(listDtoSid); |
|
|
|
dtoList.setState("3"); |
|
|
|
if (StringUtils.isNotBlank(dtoList.getState())) { |
|
|
|
busDiscountpackageHandoverListService.updateBySid(dtoList.toMap(), listDtoSid); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return i; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 移动端图片上传 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public boolean appUploadPicture(AppBusDiscountpackageHandocerDto dto) { |
|
|
|
boolean isSuccess = false; |
|
|
|
String sid = dto.getSid(); |
|
|
|
if (null != dto.getBusFiles()) { |
|
|
|
List<BusFileDto> busFiles = dto.getBusFiles(); |
|
|
|
for (BusFileDto busFile : busFiles) { |
|
|
|
BusFile bf = new BusFile(); |
|
|
|
busFile.setLinkSid(dto.getSid()); |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
String[] split = busFile.getFilePath().split(urlPrefix); |
|
|
|
busFile.setFilePath(split[1]); |
|
|
|
busFile.setName(bh.getRecName()); |
|
|
|
busFile.setLinkSid(sid); |
|
|
|
String uploadPath = fileUploadComponent.getUrlPrefix(); |
|
|
|
String substring = busFile.getFilePath().substring(uploadPath.length()); |
|
|
|
busFile.setFilePath(substring); |
|
|
|
busFile.fillEntity(bf); |
|
|
|
isSuccess = busFileService.save(bf); |
|
|
|
} |
|
|
|