Merge branch 'master' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
		| @@ -3,8 +3,10 @@ package com.stdiet.web.controller.custom; | ||||
| import com.stdiet.common.annotation.Log; | ||||
| import com.stdiet.common.core.controller.BaseController; | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.common.core.domain.entity.SysUser; | ||||
| import com.stdiet.common.core.page.TableDataInfo; | ||||
| import com.stdiet.common.enums.BusinessType; | ||||
| import com.stdiet.common.utils.SecurityUtils; | ||||
| import com.stdiet.common.utils.StringUtils; | ||||
| import com.stdiet.common.utils.poi.ExcelUtil; | ||||
| import com.stdiet.common.utils.sign.AesUtils; | ||||
| @@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
| @@ -44,7 +47,16 @@ public class SysCustomerController extends BaseController { | ||||
|     @GetMapping("/list") | ||||
|     public TableDataInfo list(SysCustomer sysCustomer) { | ||||
|         startPage(); | ||||
|         List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer); | ||||
|         List<SysCustomer> list = new ArrayList<>(); | ||||
|         if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) { | ||||
|             String remark = SecurityUtils.getLoginUser().getUser().getRemark(); | ||||
|             if (StringUtils.isEmpty(remark)) { | ||||
|                 return getDataTable(list); | ||||
|             } else if (remark.contains("|") && sysCustomer.getChannelId() == null) { | ||||
|                 sysCustomer.setChannels(remark.split("\\|")); | ||||
|             } | ||||
|         } | ||||
|         list = sysCustomerService.selectSysCustomerList(sysCustomer); | ||||
|         if (list != null && list.size() > 0) { | ||||
|             for (SysCustomer sysCus : list) { | ||||
|                 if (StringUtils.isNotEmpty(sysCus.getPhone())) { | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.stdiet.common.annotation.Log; | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.common.core.domain.entity.SysUser; | ||||
| import com.stdiet.common.enums.BusinessType; | ||||
| import com.stdiet.common.utils.DateUtils; | ||||
| import com.stdiet.common.utils.SecurityUtils; | ||||
| import com.stdiet.common.utils.StringUtils; | ||||
| import com.stdiet.common.utils.poi.ExcelUtil; | ||||
| import com.stdiet.custom.controller.OrderBaseController; | ||||
| @@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import java.math.BigDecimal; | ||||
| import java.net.URLDecoder; | ||||
| import java.time.temporal.ChronoUnit; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
| @@ -50,37 +50,42 @@ public class SysOrderController extends OrderBaseController { | ||||
|     public OrderTableDataInfo list(SysOrder sysOrder) { | ||||
|         startPage(); | ||||
|         dealOrderType(sysOrder); | ||||
|         List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder); | ||||
|         List<SysOrder> list = new ArrayList<>(); | ||||
|         if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) { | ||||
|             String remark = SecurityUtils.getLoginUser().getUser().getRemark(); | ||||
|             if (StringUtils.isEmpty(remark)) { | ||||
|                 return getOrderDataTable(list, new BigDecimal(0)); | ||||
|             } else if (remark.contains("|") && StringUtils.isEmpty(sysOrder.getAccount())) { | ||||
|                 sysOrder.setAccRange(remark.split("\\|")); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         list = sysOrderService.selectSysOrderList(sysOrder); | ||||
|         List<SysUser> userList = userService.selectAllUser(); | ||||
|         BigDecimal totalAmount = sysOrderService.selectAllOrderAmount(sysOrder); | ||||
|         if (totalAmount == null) { | ||||
|             totalAmount = new BigDecimal(0); | ||||
|         } | ||||
|         for (SysOrder order : list) { | ||||
|             initUserNickNameAndOrderType(userList,order); | ||||
|             initUserNickNameAndOrderType(userList, order); | ||||
|             if (StringUtils.isNotEmpty(order.getPhone())) { | ||||
|                 order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone())); | ||||
|             } | ||||
|             /*//根据服务时长、赠送天数计算服务天数 | ||||
|             int month = order.getServeTimeId() != null ? order.getServeTimeId().intValue() / 30 : 0; | ||||
|             if (order.getStartTime() != null && order.getServerEndTime() != null && order.getServeTimeId() != null && month > 0) { | ||||
|                 long serverDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(order.getStartTime()), DateUtils.dateToLocalDate(order.getStartTime()).plusMonths(month).plusDays(order.getGiveServeDay() == null ? 0 : order.getGiveServeDay())) + 1; | ||||
|                 order.setServerDay(Integer.parseInt(serverDay + "")); | ||||
|             }*/ | ||||
|         } | ||||
|         return getOrderDataTable(list, totalAmount); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 处理订单类型 | ||||
|      * | ||||
|      * @param sysOrder | ||||
|      */ | ||||
|     private void dealOrderType(SysOrder sysOrder) { | ||||
|         if(StringUtils.isNotEmpty(sysOrder.getOrderType())){ | ||||
|         if (StringUtils.isNotEmpty(sysOrder.getOrderType())) { | ||||
|             try { | ||||
|                 JSONArray array = JSONArray.parseArray(URLDecoder.decode(sysOrder.getOrderType(),"UTF-8")); | ||||
|                 JSONArray array = JSONArray.parseArray(URLDecoder.decode(sysOrder.getOrderType(), "UTF-8")); | ||||
|                 sysOrder.setSearchOrderTypeArray(array.size() > 0 ? array : null); | ||||
|             }catch (Exception e){ | ||||
|             } catch (Exception e) { | ||||
|                 e.printStackTrace(); | ||||
|             } | ||||
|         } | ||||
| @@ -96,7 +101,7 @@ public class SysOrderController extends OrderBaseController { | ||||
|         List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder); | ||||
|         List<SysUser> userList = userService.selectAllUser(); | ||||
|         for (SysOrder order : list) { | ||||
|             initUserNickNameAndOrderType(userList,order); | ||||
|             initUserNickNameAndOrderType(userList, order); | ||||
|             if (StringUtils.isNotEmpty(order.getPhone())) { | ||||
|                 order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone())); | ||||
|             } | ||||
| @@ -123,12 +128,12 @@ public class SysOrderController extends OrderBaseController { | ||||
|         SysOrder order = sysOrderService.selectSysOrderById(orderId); | ||||
|         if (order != null) { | ||||
|             List<SysUser> userList = userService.selectAllUser(); | ||||
|             initUserNickNameAndOrderType(userList,order); | ||||
|             initUserNickNameAndOrderType(userList, order); | ||||
|         } | ||||
|         return AjaxResult.success(order); | ||||
|     } | ||||
|  | ||||
|     private void initUserNickNameAndOrderType(List<SysUser> userList, SysOrder order){ | ||||
|     private void initUserNickNameAndOrderType(List<SysUser> userList, SysOrder order) { | ||||
|         for (SysUser user : userList) { | ||||
|             if (user.getUserId().equals(order.getPreSaleId())) { | ||||
|                 order.setPreSale(user.getNickName()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user