|
|
@@ -11,6 +11,7 @@ import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.utils.ParseUtils;
|
|
|
+import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.crm.service.ICrmCustomerService;
|
|
|
@@ -19,6 +20,7 @@ import com.fs.erp.dto.ErpOrderQueryResponse;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
import com.fs.framework.security.LoginUser;
|
|
|
import com.fs.framework.security.SecurityUtils;
|
|
|
+import com.fs.framework.service.TokenService;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.domain.*;
|
|
|
import com.fs.his.dto.ExpressInfoDTO;
|
|
|
@@ -44,6 +46,7 @@ import com.fs.hisStore.dto.StoreOrderProductDTO;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
@@ -82,6 +85,12 @@ public class FsStoreOrderController extends BaseController
|
|
|
@Autowired
|
|
|
private IFsStoreOrderItemScrmService orderItemScrmService;
|
|
|
|
|
|
+ @Value("${cloud_host.company_name}")
|
|
|
+ private String signProjectName;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询直播/点播订单列表(fs_store_order_scrm 中 order_type=2 直播订单,order_type=3 点播订单)
|
|
|
* 如果前端传了 orderType,则按指定类型查询;如果没传(null),则查询所有直播和点播订单(orderType IN (2,3))
|
|
|
@@ -89,7 +98,7 @@ public class FsStoreOrderController extends BaseController
|
|
|
*/
|
|
|
@PostMapping("/healthLiveList")
|
|
|
public FsStoreOrderListAndStatisticsVo healthLiveList(@RequestBody com.fs.hisStore.param.FsStoreOrderParam param) {
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
param.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
// 如果前端传了 orderType,使用前端传的值;如果没传(null),设置 orderType = -1(特殊值,SQL 中会转换为查询 orderType IN (2,3))
|
|
|
if (param.getOrderType() == null) {
|
|
|
@@ -115,6 +124,7 @@ public class FsStoreOrderController extends BaseController
|
|
|
Map<String, java.math.BigDecimal> statistics = fsStoreOrderScrmService.selectFsStoreOrderStatistics(param);
|
|
|
String productInfoStr = fsStoreOrderScrmService.selectFsStoreOrderProductStatistics(param);
|
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
+ param.setIsCompanyOrder(null);
|
|
|
List<com.fs.hisStore.vo.FsStoreOrderVO> list = fsStoreOrderScrmService.selectFsStoreOrderListVO(param);
|
|
|
if (list != null) {
|
|
|
for (com.fs.hisStore.vo.FsStoreOrderVO vo : list) {
|
|
|
@@ -301,25 +311,95 @@ public class FsStoreOrderController extends BaseController
|
|
|
if (fsStoreOrderScrmService.isEntityNull(param)) {
|
|
|
return AjaxResult.error("请筛选数据导出");
|
|
|
}
|
|
|
+ if(!StringUtils.isEmpty(param.getPayTimeRange())){
|
|
|
+ param.setPayTimeList(param.getPayTimeRange().split("--"));
|
|
|
+ }
|
|
|
+ if(!StringUtils.isEmpty(param.getDeliverySendTimeRange())){
|
|
|
+ param.setDeliverySendTimeList(param.getDeliverySendTimeRange().split("--"));
|
|
|
+ }
|
|
|
+ if(!StringUtils.isEmpty(param.getDeliveryImportTimeRange())){
|
|
|
+ param.setDeliveryImportTimeList(param.getDeliveryImportTimeRange().split("--"));
|
|
|
+ }
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ if("北京卓美".equals(signProjectName)){
|
|
|
+ if(!"00".equals(loginUser.getUser().getUserType())){//非管理员看见自己数据
|
|
|
+ param.setCompanyUserId(loginUser.getUser().getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
List<FsStoreOrderItemExportVO> list = orderItemScrmService.selectFsStoreOrderItemListExportVO(param);
|
|
|
+ if ("北京卓美".equals(signProjectName)) {
|
|
|
+ List<com.fs.hisStore.vo.FsStoreOrderItemExportZMVO> zmvoList = list.stream()
|
|
|
+ .map(vo -> {
|
|
|
+ com.fs.hisStore.vo.FsStoreOrderItemExportZMVO zmvo = new com.fs.hisStore.vo.FsStoreOrderItemExportZMVO();
|
|
|
+ try {
|
|
|
+ BeanUtil.copyProperties(vo, zmvo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return zmvo;
|
|
|
+ })
|
|
|
+ .collect(java.util.stream.Collectors.toList());
|
|
|
+ if (zmvoList != null) {
|
|
|
+ for (com.fs.hisStore.vo.FsStoreOrderItemExportZMVO vo : zmvoList) {
|
|
|
+ if("2".equals(vo.getOrderType())){
|
|
|
+ vo.setOrderTypeStr("直播订单" );
|
|
|
+ }else if ("3".equals(vo.getOrderType())){
|
|
|
+ vo.setOrderTypeStr("点播订单" );
|
|
|
+ }else{
|
|
|
+ vo.setOrderTypeStr("商城订单" );
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(vo.getJsonInfo())){
|
|
|
+ try {
|
|
|
+ StoreOrderProductDTO orderProductDTO = com.alibaba.fastjson.JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
+ BeanUtil.copyProperties(orderProductDTO, vo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (vo.getUserPhone() != null) {
|
|
|
+ String phone = vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2");
|
|
|
+ vo.setUserPhone(phone);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(vo.getJsonInfo())) {
|
|
|
+ try {
|
|
|
+ StoreOrderProductDTO orderProductDTO = com.alibaba.fastjson.JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
+ BeanUtil.copyProperties(orderProductDTO, vo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*")) && !java.util.Objects.isNull(vo.getCost())) {
|
|
|
+ vo.setFPrice(vo.getCost().multiply(java.math.BigDecimal.valueOf(vo.getNum())));
|
|
|
+ } else {
|
|
|
+ vo.setPayPostage(java.math.BigDecimal.ZERO);
|
|
|
+ vo.setPayDelivery(java.math.BigDecimal.ZERO);
|
|
|
+ vo.setCost(java.math.BigDecimal.ZERO);
|
|
|
+ vo.setFPrice(java.math.BigDecimal.ZERO);
|
|
|
+ vo.setBarCode("");
|
|
|
+ vo.setCateName("");
|
|
|
+ vo.setBankTransactionId("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ExcelUtil<com.fs.hisStore.vo.FsStoreOrderItemExportZMVO> util = new ExcelUtil<>(com.fs.hisStore.vo.FsStoreOrderItemExportZMVO.class);
|
|
|
+ return util.exportExcel(zmvoList, "订单明细数据");
|
|
|
+ }
|
|
|
+ //对手机号脱敏
|
|
|
if (list != null) {
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
for (FsStoreOrderItemExportVO vo : list) {
|
|
|
if (vo.getUserPhone() != null) {
|
|
|
- vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2"));
|
|
|
+ String phone = vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2");
|
|
|
+ vo.setUserPhone(phone);
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(vo.getJsonInfo())) {
|
|
|
+ if (!StringUtils.isEmpty(vo.getJsonInfo())) {
|
|
|
try {
|
|
|
- StoreOrderProductDTO dto = com.alibaba.fastjson.JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
- BeanUtil.copyProperties(dto, vo);
|
|
|
+ StoreOrderProductDTO orderProductDTO = com.alibaba.fastjson.JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
+ BeanUtil.copyProperties(orderProductDTO, vo);
|
|
|
} catch (Exception e) {
|
|
|
- // ignore
|
|
|
}
|
|
|
}
|
|
|
- if (vo.getUserAddress() != null) {
|
|
|
- vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
|
|
|
- }
|
|
|
- if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*")) && vo.getCost() != null) {
|
|
|
+ //
|
|
|
+ if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && !java.util.Objects.isNull(vo.getCost())) {
|
|
|
vo.setFPrice(vo.getCost().multiply(java.math.BigDecimal.valueOf(vo.getTotalNum())));
|
|
|
} else {
|
|
|
vo.setPayPostage(java.math.BigDecimal.ZERO);
|
|
|
@@ -329,17 +409,6 @@ public class FsStoreOrderController extends BaseController
|
|
|
vo.setCateName("");
|
|
|
vo.setBankTransactionId("");
|
|
|
}
|
|
|
- // 设置订单类型中文显示
|
|
|
- if (vo.getOrderType() != null) {
|
|
|
- String orderTypeStr = vo.getOrderType().toString();
|
|
|
- if ("2".equals(orderTypeStr)) {
|
|
|
- vo.setOrderType("直播订单");
|
|
|
- } else if ("3".equals(orderTypeStr)) {
|
|
|
- vo.setOrderType("点播订单");
|
|
|
- } else {
|
|
|
- vo.setOrderType("商城订单");
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
ExcelUtil<FsStoreOrderItemExportVO> util = new ExcelUtil<>(FsStoreOrderItemExportVO.class);
|
|
|
@@ -357,19 +426,80 @@ public class FsStoreOrderController extends BaseController
|
|
|
if (fsStoreOrderScrmService.isEntityNull(param)) {
|
|
|
return AjaxResult.error("请筛选数据导出");
|
|
|
}
|
|
|
+ if(!StringUtils.isEmpty(param.getPayTimeRange())){
|
|
|
+ param.setPayTimeList(param.getPayTimeRange().split("--"));
|
|
|
+ }
|
|
|
+ if(!StringUtils.isEmpty(param.getDeliverySendTimeRange())){
|
|
|
+ param.setDeliverySendTimeList(param.getDeliverySendTimeRange().split("--"));
|
|
|
+ }
|
|
|
+ if(!StringUtils.isEmpty(param.getDeliveryImportTimeRange())){
|
|
|
+ param.setDeliveryImportTimeList(param.getDeliveryImportTimeRange().split("--"));
|
|
|
+ }
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ if("北京卓美".equals(signProjectName)){
|
|
|
+ if(!"00".equals(loginUser.getUser().getUserType())){//非管理员看见自己数据
|
|
|
+ param.setCompanyUserId(loginUser.getUser().getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
List<FsStoreOrderItemExportVO> list = orderItemScrmService.selectFsStoreOrderItemListExportVO(param);
|
|
|
+ // 北京卓美项目特殊处理
|
|
|
+ if("北京卓美".equals(signProjectName)){
|
|
|
+ List<com.fs.hisStore.vo.FsStoreOrderItemExportZMVO> zmvoList = list.stream()
|
|
|
+ .map(vo -> {
|
|
|
+ com.fs.hisStore.vo.FsStoreOrderItemExportZMVO zmvo = new com.fs.hisStore.vo.FsStoreOrderItemExportZMVO();
|
|
|
+ try {
|
|
|
+ BeanUtil.copyProperties( vo,zmvo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 处理异常
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return zmvo;
|
|
|
+ })
|
|
|
+ .collect(java.util.stream.Collectors.toList());
|
|
|
+ //对手机号脱敏
|
|
|
+ if (zmvoList != null) {
|
|
|
+ for (com.fs.hisStore.vo.FsStoreOrderItemExportZMVO vo : zmvoList) {
|
|
|
+ if ("2".equals(vo.getOrderType())) {
|
|
|
+ vo.setOrderTypeStr("直播订单");
|
|
|
+ }else if ("3".equals(vo.getOrderType())){
|
|
|
+ vo.setOrderTypeStr("点播订单" );
|
|
|
+ }else {
|
|
|
+ vo.setOrderTypeStr("商城订单");
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(vo.getJsonInfo())) {
|
|
|
+ try {
|
|
|
+ StoreOrderProductDTO orderProductDTO = com.alibaba.fastjson.JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
+ BeanUtil.copyProperties(orderProductDTO, vo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && vo.getCost() != null) {
|
|
|
+ vo.setFPrice(vo.getCost().multiply(java.math.BigDecimal.valueOf(vo.getNum())));
|
|
|
+ } else {
|
|
|
+ vo.setPayPostage(java.math.BigDecimal.ZERO);
|
|
|
+ vo.setPayDelivery(java.math.BigDecimal.ZERO);
|
|
|
+ vo.setCost(java.math.BigDecimal.ZERO);
|
|
|
+ vo.setFPrice(java.math.BigDecimal.ZERO);
|
|
|
+ vo.setBarCode("");
|
|
|
+ vo.setCateName("");
|
|
|
+ vo.setBankTransactionId("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ExcelUtil<com.fs.hisStore.vo.FsStoreOrderItemExportZMVO> util = new ExcelUtil<>(com.fs.hisStore.vo.FsStoreOrderItemExportZMVO.class);
|
|
|
+ return util.exportExcel(zmvoList, "订单明细数据");
|
|
|
+ }
|
|
|
+ //对手机号脱敏
|
|
|
if (list != null) {
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
for (FsStoreOrderItemExportVO vo : list) {
|
|
|
- if (StringUtils.isNotEmpty(vo.getJsonInfo())) {
|
|
|
+ if (!StringUtils.isEmpty(vo.getJsonInfo())) {
|
|
|
try {
|
|
|
- StoreOrderProductDTO dto = com.alibaba.fastjson.JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
- BeanUtil.copyProperties(dto, vo);
|
|
|
+ StoreOrderProductDTO orderProductDTO = com.alibaba.fastjson.JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
+ BeanUtil.copyProperties(orderProductDTO, vo);
|
|
|
} catch (Exception e) {
|
|
|
- // ignore
|
|
|
}
|
|
|
}
|
|
|
- if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*")) && vo.getCost() != null) {
|
|
|
+ if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && vo.getCost() != null) {
|
|
|
vo.setFPrice(vo.getCost().multiply(java.math.BigDecimal.valueOf(vo.getTotalNum())));
|
|
|
} else {
|
|
|
vo.setPayPostage(java.math.BigDecimal.ZERO);
|
|
|
@@ -379,17 +509,6 @@ public class FsStoreOrderController extends BaseController
|
|
|
vo.setCateName("");
|
|
|
vo.setBankTransactionId("");
|
|
|
}
|
|
|
- // 设置订单类型中文显示
|
|
|
- if (vo.getOrderType() != null) {
|
|
|
- String orderTypeStr = vo.getOrderType().toString();
|
|
|
- if ("2".equals(orderTypeStr)) {
|
|
|
- vo.setOrderType("直播订单");
|
|
|
- } else if ("3".equals(orderTypeStr)) {
|
|
|
- vo.setOrderType("点播订单");
|
|
|
- } else {
|
|
|
- vo.setOrderType("商城订单");
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
ExcelUtil<FsStoreOrderItemExportVO> util = new ExcelUtil<>(FsStoreOrderItemExportVO.class);
|