|
|
@ -8,14 +8,14 @@ import com.yxt.anrui.base.api.commoncontract.CommonContractFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFile; |
|
|
|
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFileEnum; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandover.*; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandover.app.AppBusDiscountpackageHandoverDto; |
|
|
|
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.busdiscountpackagehandover.app.*; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandoverlist.BusDiscountpackageHandoverList; |
|
|
|
import com.yxt.anrui.buscenter.api.busdiscountpackagehandoverlist.BusDiscountpackageHandoverListDto; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderdiscount.app.AppBusSalesOrderDiscountListVo; |
|
|
|
import com.yxt.anrui.buscenter.biz.buscenterfile.BuscenterFileService; |
|
|
|
import com.yxt.anrui.buscenter.biz.busdiscountpackagehandoverlist.BusDiscountpackageHandoverListService; |
|
|
|
import com.yxt.anrui.buscenter.biz.bussalesorder.BusSalesOrderService; |
|
|
|
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingVo; |
|
|
|
import com.yxt.anrui.portal.api.sysrole.SysRoleFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysrole.SysRoleVo; |
|
|
@ -45,6 +45,7 @@ import java.math.BigDecimal; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author Administrator |
|
|
@ -72,6 +73,9 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Autowired |
|
|
|
private SysStaffinfoFeign sysStaffinfoFeign; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderService busSalesOrderService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 筛选条件 |
|
|
@ -172,7 +176,7 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
//=======================
|
|
|
|
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); |
|
|
|
privilegeQuery.setOrgPath(query.getOrgSidPath()); |
|
|
|
privilegeQuery.setMenuSid(query.getMenuSid()); |
|
|
|
//privilegeQuery.setMenuSid(query.getMenuSid());
|
|
|
|
privilegeQuery.setMenuUrl(query.getMenuUrl()); |
|
|
|
privilegeQuery.setUserSid(query.getUserSid()); |
|
|
|
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery); |
|
|
@ -597,11 +601,14 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getType())) { |
|
|
|
if (query.getType().equals("2")) { |
|
|
|
qw.eq("state", 3); |
|
|
|
qw.eq("transferStateKey", "004"); |
|
|
|
} else if (query.getType().equals("1")) { |
|
|
|
qw.ne("state", 3); |
|
|
|
qw.eq("transferStateKey", "003"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(query.getType())) { |
|
|
|
qw.ne("transferStateKey", "002"); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getName())) { |
|
|
|
qw.and(wrapper -> wrapper.like("contractNo", query.getName()).or().like("customerName", query.getName())); |
|
|
|
} |
|
|
@ -633,12 +640,12 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (("待交接".equals(record.getNodeState()))) { |
|
|
|
if (("移交中".equals(record.getNodeState()))) { |
|
|
|
record.setShowHandleBtn(true); |
|
|
|
} else { |
|
|
|
record.setShowHandleBtn(false); |
|
|
|
} |
|
|
|
if (("已交接".equals(record.getNodeState()))) { |
|
|
|
if (("已移交".equals(record.getNodeState()))) { |
|
|
|
//查询有没有上传的图片
|
|
|
|
List<BuscenterFile> buscenterFiles = buscenterFileService.selectByLinkSid(record.getSid(), BuscenterFileEnum.DISCOUNTPACKAGE_HANDOVER.getAttachType()); |
|
|
|
if (buscenterFiles.size() > 0) { |
|
|
@ -646,25 +653,26 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
} else { |
|
|
|
record.setShowUploadBtn(true); |
|
|
|
} |
|
|
|
} else { |
|
|
|
record.setShowUploadBtn(false); |
|
|
|
} |
|
|
|
record.setShowUploadBtn(false); |
|
|
|
} |
|
|
|
List<BusDiscountpackageHandoverList> listByMainSid = busDiscountpackageHandoverListService.findListByMainSid(record.getSid()); |
|
|
|
if (listByMainSid.size() > 0) { |
|
|
|
BigDecimal price = new BigDecimal(0); |
|
|
|
int discountNum = 0; |
|
|
|
for (BusDiscountpackageHandoverList handoverList : listByMainSid) { |
|
|
|
if (null != handoverList) { |
|
|
|
//优惠包数量
|
|
|
|
String number = handoverList.getNumber(); |
|
|
|
discountNum = discountNum + Integer.valueOf(number); |
|
|
|
BigDecimal totalPrice = handoverList.getTotalPrice(); |
|
|
|
price = price.add(totalPrice); |
|
|
|
} |
|
|
|
} |
|
|
|
record.setDiscountNum(String.valueOf(discountNum)); |
|
|
|
record.setPrice(String.valueOf(price)); |
|
|
|
} |
|
|
|
// List<BusDiscountpackageHandoverList> listByMainSid = busDiscountpackageHandoverListService.findListByMainSid(record.getSid());
|
|
|
|
// if (listByMainSid.size() > 0) {
|
|
|
|
// BigDecimal price = new BigDecimal(0);
|
|
|
|
// int discountNum = 0;
|
|
|
|
// for (BusDiscountpackageHandoverList handoverList : listByMainSid) {
|
|
|
|
// if (null != handoverList) {
|
|
|
|
// //优惠包数量
|
|
|
|
// String number = handoverList.getNumber();
|
|
|
|
// discountNum = discountNum + Integer.valueOf(number);
|
|
|
|
// BigDecimal totalPrice = handoverList.getTotalPrice();
|
|
|
|
// price = price.add(totalPrice);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// record.setDiscountNum(String.valueOf(discountNum));
|
|
|
|
// record.setPrice(String.valueOf(price));
|
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<AppBusDiscountpackageHandoverVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
@ -802,4 +810,94 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 移动端详情 |
|
|
|
* |
|
|
|
* @param sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<AppBusDiscountpackageHandoversDetailVo> getDiscountPackageHandoverDetail(String sid) { |
|
|
|
ResultBean<AppBusDiscountpackageHandoversDetailVo> rb = ResultBean.fireFail(); |
|
|
|
AppBusDiscountpackageHandoversDetailVo vo = baseMapper.getDiscountPackageHandoverDetail(sid); |
|
|
|
List<AppBusDiscountpackageHandoversListVo> listVos = new ArrayList<>(); |
|
|
|
List<String> filePath = new ArrayList<>(); |
|
|
|
if (null != vo) { |
|
|
|
List<BusDiscountpackageHandoverList> listByMainSid = busDiscountpackageHandoverListService.findListByMainSid(sid); |
|
|
|
listByMainSid.removeAll(Collections.singleton(null)); |
|
|
|
if (!listByMainSid.isEmpty()) { |
|
|
|
for (BusDiscountpackageHandoverList handoverList : listByMainSid) { |
|
|
|
AppBusDiscountpackageHandoversListVo handoversListVo = new AppBusDiscountpackageHandoversListVo(); |
|
|
|
handoversListVo.setDiscountSid(sid); |
|
|
|
handoversListVo.setExplain(handoverList.getPackageExplain()); |
|
|
|
handoversListVo.setNumber(handoverList.getNumber()); |
|
|
|
handoversListVo.setTotalPrice(String.valueOf(handoverList.getTotalPrice())); |
|
|
|
handoversListVo.setPrice(String.valueOf(handoverList.getPrice())); |
|
|
|
handoversListVo.setDiscountName(handoverList.getDiscountName()); |
|
|
|
listVos.add(handoversListVo); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setDiscountPackageList(listVos); |
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(sid, BuscenterFileEnum.DISCOUNTPACKAGE_HANDOVER.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> handoverImages = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
vo.setBusFiles(handoverImages); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(vo.getContractId())) { |
|
|
|
CommonContract contract = commonContractFeign.selectByNo(vo.getContractId()).getData(); |
|
|
|
if (null != contract) { |
|
|
|
if (StringUtils.isNotBlank(contract.getBusSid())) { |
|
|
|
vo.setSaleOrderSid(contract.getBusSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(contract.getModelSid())) { |
|
|
|
vo.setModelSid(contract.getModelSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(contract.getConfigSid())) { |
|
|
|
vo.setConfigSid(contract.getConfigSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(vo.getSaleOrderSid())) { |
|
|
|
BusSalesOrderDetailsVo orderDetailsVo = busSalesOrderService.fetchDetailsVoBySid(vo.getSaleOrderSid()).getData(); |
|
|
|
if (null != orderDetailsVo) { |
|
|
|
String orgSidPath = orderDetailsVo.getOrgSidPath(); |
|
|
|
vo.setModelOrgPath(orgSidPath); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean confirmPackageHandover(AppBusDiscountpackageHandoverDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
BusDiscountpackageHandover entity = fetchBySid(dto.getSid()); |
|
|
|
if (StringUtils.isNotBlank(dto.getRemarks())) { |
|
|
|
entity.setRemarks(dto.getRemarks()); |
|
|
|
} |
|
|
|
entity.setRecTime(new Date()); |
|
|
|
entity.setTransferStateValue("已移交"); |
|
|
|
entity.setTransferStateKey("004"); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<String>> saveConfirmPackageHandoverImg(AppUploadPicture uploadPicture) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
buscenterFileService.delByLinkSidOrType(uploadPicture.getSid(), BuscenterFileEnum.DISCOUNTPACKAGE_HANDOVER.getAttachType()); |
|
|
|
List<String> imgs = uploadPicture.getImgs(); |
|
|
|
if (!imgs.isEmpty()) { |
|
|
|
buscenterFileService.saveAll(uploadPicture.getSid(), imgs, BuscenterFileEnum.DISCOUNTPACKAGE_HANDOVER.getAttachType()); |
|
|
|
} |
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(uploadPicture.getSid(), BuscenterFileEnum.DISCOUNTPACKAGE_HANDOVER.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
List<String> handoverImages = new ArrayList<>(); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
handoverImages = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
} |
|
|
|
return rb.success().setData(handoverImages); |
|
|
|
} |
|
|
|
} |
|
|
|