Commit b1835d7b by 罗承锋

添加销售时段

parent 0d927e17
...@@ -151,6 +151,11 @@ public class SalesList { ...@@ -151,6 +151,11 @@ public class SalesList {
*/ */
private Double capitalBonus; private Double capitalBonus;
/**
* 销售时段(默认开学,区间内前置)
*/
private String preType;
@TableField(exist = false) @TableField(exist = false)
private String positionZW; private String positionZW;
@TableField(exist = false) @TableField(exist = false)
......
package com.winsun.bean; package com.winsun.bean;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data; import lombok.Data;
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
...@@ -152,12 +153,12 @@ public class School implements Serializable { ...@@ -152,12 +153,12 @@ public class School implements Serializable {
/** /**
* 大于50元激励 * 大于50元激励
*/ */
@TableField("greater_fifty") @TableField(value = "greater_fifty", fill = FieldFill.UPDATE)
private Double greaterFifty; private Double greaterFifty;
/** /**
* 大于100元激励 * 大于100元激励
*/ */
@TableField("greater_hundred") @TableField(value = "greater_hundred", fill = FieldFill.UPDATE)
private Double greaterHundred; private Double greaterHundred;
} }
package com.winsun.mapper; package com.winsun.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper; import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.winsun.bean.Package; import com.baomidou.mybatisplus.plugins.Page;
import com.winsun.bean.UniversityInfo; import com.winsun.bean.UniversityInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Mapper @Mapper
@Component @Component
public interface UniversityInfoMapper extends BaseMapper<UniversityInfo> { public interface UniversityInfoMapper extends BaseMapper<UniversityInfo> {
List<Map<String, Object>> getBroadBandConfigList(Page page,
@Param("productUniversity") String productUniversity, @Param("productRegion") String productRegion);
} }
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.winsun.mapper.UniversityInfoMapper">
<select id="getBroadBandConfigList" resultType="Map">
select
ui.*, pm.product_title, pm.product_region, pm.product_price, pm.product_meal, pm.product_rate, pm.product_university, pm.product_school_abbreviated, pm.product_state,DATE_FORMAT(product_create_time,'%Y-%m-%d %H:%i:%s') as create_time, GROUP_CONCAT(hs.kdsl) as kdsl, GROUP_CONCAT(hs.kdy_btn) as kdy_btn
from
university_info ui
left join product_manage pm ON ui.university_id = pm.university_id
left join
(
select
bandproduct_id,
concat(school_name, ':', case kdsl when 1 then '已显示' when 0 then '未显示' else '未设置' end) kdsl,
concat(school_name, ':', case kdy_btn when 1 then '已显示' when 0 then '未显示' else '未设置' end) kdy_btn
from hhr_school where bandproduct_id != '') hs
on pm.product_id = hs.bandproduct_id
<where>
<if test = "productUniversity != null and productUniversity != ''">
and product_university like concat('%', #{productUniversity}, '%')
</if>
<if test = "productRegion != null and productRegion != ''">
and product_region like caoncat('%', #{productRegion}, '%')
</if>
</where>
group by ui.university_id
</select>
</mapper>
\ No newline at end of file
...@@ -541,16 +541,17 @@ public class SalesListController extends BaseController{ ...@@ -541,16 +541,17 @@ public class SalesListController extends BaseController{
// 获取半年上传内的订单 // 获取半年上传内的订单
Wrapper<SalesList> wrapperOrder = new EntityWrapper<SalesList>(); Wrapper<SalesList> wrapperOrder = new EntityWrapper<SalesList>();
wrapperOrder.ge("create_time", date); wrapperOrder.ge("create_time", date);
wrapperOrder.eq("order_type", 1);
wrapperOrder.eq("del_flag", 0); wrapperOrder.eq("del_flag", 0);
wrapperOrder.eq("send_bonus", 0); wrapperOrder.eq("send_bonus", 0);
wrapperOrder.ne("status", "0");
List<Map<String, Object>> orderList = salesListMapper.selectMaps(wrapperOrder); List<Map<String, Object>> orderList = salesListMapper.selectMaps(wrapperOrder);
Map<String, Map<String,Object>> orderMaps = MapUtil.listToMap(orderList, "orderPhone"); Map<String, Map<String,Object>> orderMaps = MapUtil.listToMap(orderList, "orderPhone");
Date nowDate = new Date();
// 获取学校清单比较网点 // 获取学校清单比较网点
Wrapper<School> wrapperSchool = new EntityWrapper<School>(); Wrapper<School> wrapperSchool = new EntityWrapper<School>();
wrapperSchool.setSqlSelect(" school_name as schoolName,network_name as networkName,network_code as networkCode "); wrapperSchool.setSqlSelect(" school_name as schoolName,network_name as networkName,network_code as networkCode," +
"start_date as startDate, end_date as endDate, greater_fifty as greaterFifty, greater_hundred as greaterHundred");
List<Map<String, Object>> schoolList = schoolMapper.selectMaps(wrapperSchool); List<Map<String, Object>> schoolList = schoolMapper.selectMaps(wrapperSchool);
Map<String, Map<String,Object>> schoolMaps = MapUtil.listToMap(schoolList, "schoolName"); Map<String, Map<String,Object>> schoolMaps = MapUtil.listToMap(schoolList, "schoolName");
...@@ -564,6 +565,9 @@ public class SalesListController extends BaseController{ ...@@ -564,6 +565,9 @@ public class SalesListController extends BaseController{
double amount = Double.parseDouble((String)map.get("e")); double amount = Double.parseDouble((String)map.get("e"));
boolean isSkip = false; boolean isSkip = false;
String status = "2"; String status = "2";
// 默认false为开学激励,true为前置激励
boolean isNormalSchoolOpens = false;
if(null != orderMaps.get(orderPhone)) { if(null != orderMaps.get(orderPhone)) {
Map<String, Object> orderMap = (Map<String, Object>)orderMaps.get(orderPhone); Map<String, Object> orderMap = (Map<String, Object>)orderMaps.get(orderPhone);
...@@ -572,7 +576,7 @@ public class SalesListController extends BaseController{ ...@@ -572,7 +576,7 @@ public class SalesListController extends BaseController{
if(null == networkName) { if(null == networkName) {
isSkip = true; isSkip = true;
} }
Map<String, Object> schoolMap = (Map<String, Object>)schoolMaps.get(orderMap.get("salesSchool")); Map<String, Object> schoolMap = (Map<String, Object>)schoolMaps.get(orderMap.get("salesSchool"));
if(null != schoolMap.get("networkCode") && !"".equals(schoolMap.get("networkCode"))) { if(null != schoolMap.get("networkCode") && !"".equals(schoolMap.get("networkCode"))) {
...@@ -580,13 +584,34 @@ public class SalesListController extends BaseController{ ...@@ -580,13 +584,34 @@ public class SalesListController extends BaseController{
double bonus = 0; double bonus = 0;
double allBonus = 0; double allBonus = 0;
double nonSendBonus = 0; double nonSendBonus = 0;
double defaultGreaterFifty = 20;
double defaultGreaterHundred = 40;
// 获取数据
Date startDate = schoolMap.get("startDate") == null ? null : (Date)schoolMap.get("startDate");
Date endDate = schoolMap.get("endDate") == null ? null : (Date)schoolMap.get("endDate");
Double greaterFifty = schoolMap.get("greaterFifty") == null ? null : (Double)schoolMap.get("greaterFifty");
Double greaterHundred = schoolMap.get("greaterHundred") == null ? null : (Double)schoolMap.get("greaterHundred");
// TODO 根据网点配置的时段进行判定 if (startDate != null && endDate != null &&
startDate.getTime() <= nowDate.getTime() && endDate.getTime() >= nowDate.getTime()) {
isNormalSchoolOpens = true;
}
// 根据网点配置的时段进行判定
if (isNormalSchoolOpens) {
if (greaterFifty != null) {
defaultGreaterFifty = greaterFifty;
}
if (greaterHundred != null) {
defaultGreaterHundred = greaterHundred;
}
}
if(amount >= 50 && amount < 100) { if(amount >= 50 && amount < 100) {
bonus = 20; bonus = defaultGreaterFifty;
}else if(amount >= 100) { }else if(amount >= 100) {
bonus = 40; bonus = defaultGreaterHundred;
} }
if("广州美术学院(大学城)".equals(orderMap.get("sales_school")) && bonus >= 20){ if("广州美术学院(大学城)".equals(orderMap.get("sales_school")) && bonus >= 20){
...@@ -622,6 +647,7 @@ public class SalesListController extends BaseController{ ...@@ -622,6 +647,7 @@ public class SalesListController extends BaseController{
orderMap.put("activateTime", activateTime); orderMap.put("activateTime", activateTime);
orderMap.put("networkCode", networkCode); orderMap.put("networkCode", networkCode);
orderMap.put("networkName", networkName); orderMap.put("networkName", networkName);
orderMap.put("preType", isNormalSchoolOpens ? "前置" : "开学");
updateList.add(orderMap); updateList.add(orderMap);
} }
} }
...@@ -652,6 +678,7 @@ public class SalesListController extends BaseController{ ...@@ -652,6 +678,7 @@ public class SalesListController extends BaseController{
order.setActivateTime(sFormat.parse((String)map.get("activateTime"))); order.setActivateTime(sFormat.parse((String)map.get("activateTime")));
order.setNetworkCode((String)map.get("networkCode")); order.setNetworkCode((String)map.get("networkCode"));
order.setNetworkName((String)map.get("networkName")); order.setNetworkName((String)map.get("networkName"));
order.setPreType((String)map.get("preType"));
} }
num += salesListMapper.updateById(order); num += salesListMapper.updateById(order);
......
...@@ -9,7 +9,11 @@ import com.winsun.auth.core.annotion.Permission; ...@@ -9,7 +9,11 @@ import com.winsun.auth.core.annotion.Permission;
import com.winsun.auth.core.base.controller.BaseController; import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.common.model.ResponseData; import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.shiro.ShiroUser; import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.bean.Product;
import com.winsun.bean.School;
import com.winsun.bean.UniversityInfo; import com.winsun.bean.UniversityInfo;
import com.winsun.mapper.ProductMapper;
import com.winsun.mapper.SchoolMapper;
import com.winsun.mapper.UniversityInfoMapper; import com.winsun.mapper.UniversityInfoMapper;
import com.winsun.utils.MyBatisPlusUpdateUtils; import com.winsun.utils.MyBatisPlusUpdateUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -32,9 +36,16 @@ public class UniversityInfoController extends BaseController { ...@@ -32,9 +36,16 @@ public class UniversityInfoController extends BaseController {
private static UniversityInfoMapper universityInfoMapper; private static UniversityInfoMapper universityInfoMapper;
private static ProductMapper productMapper;
private static SchoolMapper schoolMapper;
@Autowired @Autowired
public UniversityInfoController(UniversityInfoMapper universityInfoMapper) { public UniversityInfoController(UniversityInfoMapper universityInfoMapper, ProductMapper productMapper,
SchoolMapper schoolMapper) {
UniversityInfoController.universityInfoMapper = universityInfoMapper; UniversityInfoController.universityInfoMapper = universityInfoMapper;
UniversityInfoController.productMapper = productMapper;
UniversityInfoController.schoolMapper = schoolMapper;
} }
/** /**
...@@ -132,6 +143,60 @@ public class UniversityInfoController extends BaseController { ...@@ -132,6 +143,60 @@ public class UniversityInfoController extends BaseController {
} }
/** /**
*
* @param productUniversity 学校名称
* @param productRegion 所在区域
* @param pageIndex
* @param pageSize
* @return
*/
@Permission(menuname = "查询宽带配置信息列表", value = "broadbandConfigList", method = RequestMethod.POST)
public ResponseData<Page<Map<String, Object>>> broadbandConfigList(@RequestParam(value = "productUniversity", required = false) String productUniversity,
@RequestParam(value = "productRegion", required = false) String productRegion,
@RequestParam(name = "pageNo") int pageIndex, @RequestParam(name = "pageSize") int pageSize) {
ShiroUser user = getShiroUser();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员"))) {
return ResponseData.error("无数据权限");
}
Page<Map<String, Object>> page = new Page<>(pageIndex, pageSize);
List<Map<String, Object>> broadBandConfigList = universityInfoMapper.getBroadBandConfigList(page, productUniversity, productRegion);
page.setRecords(broadBandConfigList);
return ResponseData.success(page, "查询成功!");
}
/**
* 查询宽带编辑信息
* @param universityId
* @return
*/
@Permission(menuname = "查询宽带配置信息", value="broadbandConfigData", method=RequestMethod.POST)
public ResponseData<Map<String, Object>> broadbandConfigData(@RequestParam("universityId") Integer universityId) {
Map<String, Object> result = new HashMap<>();
// 查询大学宽带配置
UniversityInfo universityInfo = universityInfoMapper.selectById(universityId);
if (universityInfo != null) {
result.put("universityInfoData", universityInfo);
// 查询产品配置
Wrapper<Product> productWrapper = new EntityWrapper<>();
productWrapper.eq("university_id", universityInfo.getUniversityId());
List<Product> products = productMapper.selectList(productWrapper);
if (products != null && products.size() != 0) {
result.put("productData", products.get(0));
// 查询学校配置
Wrapper<School> schoolWrapper = new EntityWrapper<>();
schoolWrapper.eq("bandproduct_id", products.get(0).getProductId());
List<School> schools = schoolMapper.selectList(schoolWrapper);
result.put("schoolsData", schools);
}
}else{
return ResponseData.error("未查询到当前宽带信息");
}
return ResponseData.success(result);
}
/**
* 宽带适用学校 * 宽带适用学校
* @return * @return
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment