New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.rabbitmq.client.LongString; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.DriverRankVo; |
| | | import com.stylefeng.guns.modular.system.model.TRegion; |
| | | import com.stylefeng.guns.modular.system.service.ITRegionService; |
| | | import com.stylefeng.guns.modular.system.util.ExcelExportUtil; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.modular.system.model.TDriverPromotionActivity; |
| | | import com.stylefeng.guns.modular.system.service.ITDriverPromotionActivityService; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2025-07-31 11:20:54 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tDriverPromotionActivity") |
| | | public class TDriverPromotionActivityController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tDriverPromotionActivity/"; |
| | | |
| | | @Autowired |
| | | private ITDriverPromotionActivityService tDriverPromotionActivityService; |
| | | |
| | | @Autowired |
| | | private ITRegionService tRegionService; |
| | | |
| | | |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tDriverPromotionActivity.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/tDriverPromotionActivity_add") |
| | | public String tDriverPromotionActivityAdd(Model model) { |
| | | List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",provinceList); |
| | | return PREFIX + "tDriverPromotionActivity_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/tDriverPromotionActivity_update/{tDriverPromotionActivityId}") |
| | | public String tDriverPromotionActivityUpdate(@PathVariable Integer tDriverPromotionActivityId, Model model) { |
| | | TDriverPromotionActivity tDriverPromotionActivity = tDriverPromotionActivityService.selectById(tDriverPromotionActivityId); |
| | | model.addAttribute("item",tDriverPromotionActivity); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("time",simpleDateFormat.format(tDriverPromotionActivity.getStartTime())+" - "+simpleDateFormat.format(tDriverPromotionActivity.getEndTime())); |
| | | |
| | | |
| | | LogObjectHolder.me().set(tDriverPromotionActivity); |
| | | List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",provinceList); |
| | | |
| | | TRegion province = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tDriverPromotionActivity.getProvinceCode())); |
| | | //市 |
| | | List<TRegion> cityList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", province.getId())); |
| | | model.addAttribute("cityList",cityList); |
| | | |
| | | //区 |
| | | TRegion city = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tDriverPromotionActivity.getCityCode())); |
| | | List<TRegion> areaList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", city.getId())); |
| | | model.addAttribute("areaList",areaList); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | return PREFIX + "tDriverPromotionActivity_edit.html"; |
| | | } |
| | | @RequestMapping("/tDriverPromotionActivity_viewUser/{id}") |
| | | public String tDriverPromotionActivityViewUser(@PathVariable Integer id, Model model) { |
| | | |
| | | model.addAttribute("driverId",id); |
| | | return PREFIX + "tDriverPromotionActivityUser.html"; |
| | | } |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/tDriverPromotionActivity_info/{tDriverPromotionActivityId}") |
| | | public String tDriverPromotionActivityInfo(@PathVariable Integer tDriverPromotionActivityId, Model model) { |
| | | TDriverPromotionActivity tDriverPromotionActivity = tDriverPromotionActivityService.selectById(tDriverPromotionActivityId); |
| | | model.addAttribute("item",tDriverPromotionActivity); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("time",simpleDateFormat.format(tDriverPromotionActivity.getStartTime())+" - "+simpleDateFormat.format(tDriverPromotionActivity.getEndTime())); |
| | | |
| | | |
| | | LogObjectHolder.me().set(tDriverPromotionActivity); |
| | | List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",provinceList); |
| | | |
| | | TRegion province = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tDriverPromotionActivity.getProvinceCode())); |
| | | //市 |
| | | List<TRegion> cityList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", province.getId())); |
| | | model.addAttribute("cityList",cityList); |
| | | |
| | | //区 |
| | | TRegion city = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tDriverPromotionActivity.getCityCode())); |
| | | List<TRegion> areaList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", city.getId())); |
| | | model.addAttribute("areaList",areaList); |
| | | |
| | | return PREFIX + "tDriverPromotionActivity_detail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime,String name,Integer status) { |
| | | |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)) { |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | return tDriverPromotionActivityService.list(beginTime,endTime,name,status); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list1") |
| | | @ResponseBody |
| | | public Object list1(Long id,String driverName) { |
| | | |
| | | return tDriverPromotionActivityService.list1(id,driverName); |
| | | } |
| | | @RequestMapping(value = "/list2") |
| | | @ResponseBody |
| | | public Object list2(Long driverId,String name) { |
| | | |
| | | return tDriverPromotionActivityService.list2(driverId,name); |
| | | } |
| | | @GetMapping("/export1") |
| | | @ResponseBody |
| | | public void export1(Long driverId,String name, HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | ArrayList<HashMap<String, Object>> list = tDriverPromotionActivityService.list2(driverId, name); |
| | | |
| | | |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<>(); |
| | | |
| | | //第一行显示【封装】 |
| | | List<String> twoList = new ArrayList<String>(); |
| | | twoList.add("总计:"); |
| | | twoList.add(String.valueOf(list.size())+"条"); |
| | | dataList.add(twoList); |
| | | // 列【封装】 |
| | | List<String> shellList = new ArrayList<String>(); |
| | | shellList.add("序号"); |
| | | shellList.add("用户昵称"); |
| | | shellList.add("用户手机号"); |
| | | shellList.add("绑定时间"); |
| | | shellList.add("有效期至"); |
| | | shellList.add("产生收益合计"); |
| | | dataList.add(shellList); |
| | | Integer index = 0; |
| | | for (HashMap<String, Object> object : list){ |
| | | index++; |
| | | // 详细数据列【封装】 |
| | | shellList = new ArrayList<String>(); |
| | | shellList.add(index.toString()); |
| | | shellList.add(object.get("userName").toString()); |
| | | shellList.add(object.get("userPhone").toString()); |
| | | shellList.add(object.get("bindDate").toString()); |
| | | shellList.add(object.get("bindExpireDate").toString()); |
| | | shellList.add(object.get("money").toString()); |
| | | |
| | | dataList.add(shellList); |
| | | } |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet("司机推广下级用户导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "司机推广下级用户导出记录", dataList,request, response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @GetMapping("/export") |
| | | @ResponseBody |
| | | public void export(Long id,String driverName, HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | List<DriverRankVo> list = tDriverPromotionActivityService.list1(id, driverName); |
| | | |
| | | |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<>(); |
| | | |
| | | //第一行显示【封装】 |
| | | List<String> twoList = new ArrayList<String>(); |
| | | twoList.add("总计:"); |
| | | twoList.add(String.valueOf(list.size())+"条"); |
| | | dataList.add(twoList); |
| | | // 列【封装】 |
| | | List<String> shellList = new ArrayList<String>(); |
| | | shellList.add("推广排名"); |
| | | shellList.add("司机姓名"); |
| | | shellList.add("推广用户数量"); |
| | | shellList.add("推广收益合计"); |
| | | dataList.add(shellList); |
| | | Integer index = 0; |
| | | for (DriverRankVo object : list){ |
| | | index++; |
| | | // 详细数据列【封装】 |
| | | shellList = new ArrayList<String>(); |
| | | shellList.add(index.toString()); |
| | | shellList.add(object.getDriverName()); |
| | | shellList.add(object.getUserNum().toString()); |
| | | shellList.add(object.getMoney().toString()); |
| | | |
| | | |
| | | dataList.add(shellList); |
| | | } |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet("推广情况导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "推广情况导出记录", dataList,request, response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(String activityTitle,String bizTypeValue,String province,String city,String area,String time,Integer commissionRatio,Integer bindingDays,String content) throws ParseException { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | TDriverPromotionActivity tDriverPromotionActivity = new TDriverPromotionActivity(); |
| | | tDriverPromotionActivity.setActivityTitle(activityTitle); |
| | | tDriverPromotionActivity.setBizType(bizTypeValue); |
| | | tDriverPromotionActivity.setProvinceCode(province); |
| | | tDriverPromotionActivity.setCityCode(city); |
| | | tDriverPromotionActivity.setDistrictCode(area); |
| | | String s = time.split(" - ")[0] + " 00:00:00"; |
| | | String s1 = time.split(" - ")[1] + " 23:59:59"; |
| | | tDriverPromotionActivity.setStartTime(simpleDateFormat.parse(s)); |
| | | tDriverPromotionActivity.setEndTime(simpleDateFormat.parse(s1)); |
| | | tDriverPromotionActivity.setCommissionRatio(BigDecimal.valueOf(commissionRatio)); |
| | | tDriverPromotionActivity.setBindingDays(bindingDays); |
| | | tDriverPromotionActivity.setActivityDesc(ToolUtil.cleanXSS(content)); |
| | | tDriverPromotionActivity.setStatus(1); |
| | | tDriverPromotionActivity.setCreator(shiroExtUtil.getUser().getName()); |
| | | tDriverPromotionActivity.setCreateTime(new Date()); |
| | | tDriverPromotionActivityService.insert(tDriverPromotionActivity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tDriverPromotionActivityId) { |
| | | TDriverPromotionActivity tDriverPromotionActivity = tDriverPromotionActivityService.selectById(tDriverPromotionActivityId); |
| | | tDriverPromotionActivity.setRemove(1); |
| | | tDriverPromotionActivityService.updateById(tDriverPromotionActivity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | @RequestMapping(value = "/stop") |
| | | @ResponseBody |
| | | public Object stop(@RequestParam Integer id) { |
| | | TDriverPromotionActivity tDriverPromotionActivity = tDriverPromotionActivityService.selectById(id); |
| | | tDriverPromotionActivity.setState(2); |
| | | tDriverPromotionActivityService.updateById(tDriverPromotionActivity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | @RequestMapping(value = "/start") |
| | | @ResponseBody |
| | | public Object start(@RequestParam Integer id) { |
| | | TDriverPromotionActivity tDriverPromotionActivity = tDriverPromotionActivityService.selectById(id); |
| | | tDriverPromotionActivity.setState(1); |
| | | tDriverPromotionActivityService.updateById(tDriverPromotionActivity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @SneakyThrows |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(Long id,String activityTitle, String bizTypeValue, String province, String city, String area, String time, Integer commissionRatio, Integer bindingDays, String content) { |
| | | TDriverPromotionActivity tDriverPromotionActivity = tDriverPromotionActivityService.selectById(id); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | tDriverPromotionActivity.setActivityTitle(activityTitle); |
| | | tDriverPromotionActivity.setBizType(bizTypeValue); |
| | | tDriverPromotionActivity.setProvinceCode(province); |
| | | tDriverPromotionActivity.setCityCode(city); |
| | | tDriverPromotionActivity.setDistrictCode(area); |
| | | String s = time.split(" - ")[0] + " 00:00:00"; |
| | | String s1 = time.split(" - ")[1] + " 23:59:59"; |
| | | tDriverPromotionActivity.setStartTime(simpleDateFormat.parse(s)); |
| | | tDriverPromotionActivity.setEndTime(simpleDateFormat.parse(s1)); |
| | | tDriverPromotionActivity.setCommissionRatio(BigDecimal.valueOf(commissionRatio)); |
| | | tDriverPromotionActivity.setBindingDays(bindingDays); |
| | | tDriverPromotionActivity.setActivityDesc(ToolUtil.cleanXSS(content)); |
| | | tDriverPromotionActivity.setStatus(1); |
| | | tDriverPromotionActivity.setCreator(shiroExtUtil.getUser().getName()); |
| | | tDriverPromotionActivity.setCreateTime(new Date()); |
| | | tDriverPromotionActivity.setUpdateTime(new Date()); |
| | | tDriverPromotionActivityService.updateById(tDriverPromotionActivity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tDriverPromotionActivityId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tDriverPromotionActivityId") Integer tDriverPromotionActivityId) { |
| | | return tDriverPromotionActivityService.selectById(tDriverPromotionActivityId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.TDriverPromotionActivity; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 司机推广活动主表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2025-07-31 |
| | | */ |
| | | public interface TDriverPromotionActivityMapper extends BaseMapper<TDriverPromotionActivity> { |
| | | |
| | | List<Map<String,Object>> list(@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("name") String name, @Param("status") Integer status); |
| | | |
| | | } |
New file |
| | |
| | | <?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.stylefeng.guns.modular.system.dao.TDriverPromotionActivityMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TDriverPromotionActivity"> |
| | | <id column="id" property="id" /> |
| | | <result column="bizType" property="bizType" /> |
| | | <result column="activityTitle" property="activityTitle" /> |
| | | <result column="province" property="province" /> |
| | | <result column="provinceCode" property="provinceCode" /> |
| | | <result column="city" property="city" /> |
| | | <result column="cityCode" property="cityCode" /> |
| | | <result column="district" property="district" /> |
| | | <result column="districtCode" property="districtCode" /> |
| | | <result column="startTime" property="startTime" /> |
| | | <result column="endTime" property="endTime" /> |
| | | <result column="commissionRatio" property="commissionRatio" /> |
| | | <result column="bindingDays" property="bindingDays" /> |
| | | <result column="activityDesc" property="activityDesc" /> |
| | | <result column="status" property="status" /> |
| | | <result column="creator" property="creator" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, bizType, activityTitle, province, provinceCode, city, cityCode, district, districtCode, startTime, endTime, commissionRatio, bindingDays, activityDesc, creator, createTime, updateTime, |
| | | </sql> |
| | | |
| | | <select id="list" resultType="java.util.Map"> |
| | | select * from ( |
| | | select <include refid="Base_Column_List"/> |
| | | case |
| | | when now()>endTime then 4 |
| | | when startTime>now() then 3 |
| | | when now()>startTime and endTime >now() and state =1 then 1 |
| | | when now()>startTime and endTime >now() and state =2 then 2 |
| | | else 0 |
| | | end as status |
| | | from t_driver_promotion_activity |
| | | where remove=0 |
| | | <if test="beginTime != null and endTime != null"> |
| | | and createTime between #{beginTime} and #{endTime} |
| | | </if> |
| | | |
| | | <if test="name != null"> |
| | | and activityTitle like concat('%',#{name},'%') |
| | | </if> |
| | | ) t1 where 1=1 |
| | | <if test="status!= null"> |
| | | and t1.status =#{status} |
| | | </if> |
| | | order by t1.createTime desc |
| | | |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 司机推广活动主表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2025-07-31 |
| | | */ |
| | | @TableName("t_driver_promotion_activity") |
| | | @Data |
| | | public class TDriverPromotionActivity extends Model<TDriverPromotionActivity>{ |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 推广活动ID |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 关联业务:1-专车/2-出租车/3-城际/4-顺风车/5-代驾 |
| | | */ |
| | | private String bizType; |
| | | /** |
| | | * 推广活动标题 |
| | | */ |
| | | private String activityTitle; |
| | | /** |
| | | * 活动区域-省 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 省code |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 活动区域-市 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 市code |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 活动区域-区/县 |
| | | */ |
| | | private String district; |
| | | /** |
| | | * 区code |
| | | */ |
| | | private String districtCode; |
| | | /** |
| | | * 活动开始时间 |
| | | */ |
| | | private Date startTime; |
| | | /** |
| | | * 活动结束时间 |
| | | */ |
| | | private Date endTime; |
| | | /** |
| | | * 抽佣比例(如 10.00 代表 10%) |
| | | */ |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | private BigDecimal commissionRatio; |
| | | /** |
| | | * 司机乘客绑定有效期(天) |
| | | */ |
| | | private Integer bindingDays; |
| | | /** |
| | | * 推广活动说明 |
| | | */ |
| | | private String activityDesc; |
| | | /** |
| | | * 状态:1-未开始 2-进行中 3-已结束 |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 创建人 |
| | | */ |
| | | private String creator; |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | private Integer state; |
| | | /** |
| | | * |
| | | * 删除标识:0-正常 1-删除 |
| | | */ |
| | | private Integer remove; |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.DriverRankVo; |
| | | import com.stylefeng.guns.modular.system.model.TDriverPromotionActivity; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 司机推广活动主表 服务类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2025-07-31 |
| | | */ |
| | | public interface ITDriverPromotionActivityService extends IService<TDriverPromotionActivity> { |
| | | |
| | | Object list(String beginTime, String endTime, String name, Integer status); |
| | | |
| | | List<DriverRankVo> list1(Long id, String driverName); |
| | | |
| | | |
| | | ArrayList<HashMap<String, Object>> list2(Long driverId, String name); |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import cn.hutool.system.UserInfo; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.dao.TDriverPromotionActivityMapper; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 司机推广活动主表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2025-07-31 |
| | | */ |
| | | @Service |
| | | public class TDriverPromotionActivityServiceImpl extends ServiceImpl<TDriverPromotionActivityMapper, TDriverPromotionActivity> implements ITDriverPromotionActivityService { |
| | | |
| | | @Autowired |
| | | private ITDriverService driverService; |
| | | @Autowired |
| | | private ITUserService userService; |
| | | @Autowired |
| | | private ITOrderPrivateCarService orderPrivateCarService; |
| | | @Autowired |
| | | private ITOrderTaxiService orderTaxiService; |
| | | @Autowired |
| | | private ITOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Override |
| | | public Object list(String beginTime, String endTime, String name, Integer status) { |
| | | return this.baseMapper.list(beginTime, endTime, name, status); |
| | | } |
| | | |
| | | @Override |
| | | public List<DriverRankVo> list1(Long id, String driverName) { |
| | | List<DriverRankVo> hashMaps = new ArrayList<>(); |
| | | |
| | | // 获取所有的司机 |
| | | Wrapper<TDriver> flag = new EntityWrapper<TDriver>().ne("flag", 3); |
| | | if (driverName != null && !"".equals(driverName)) { |
| | | flag.like("name", driverName); |
| | | } |
| | | |
| | | List<TDriver> tDrivers = driverService.selectList(flag); |
| | | |
| | | // 获取绑定的司机的用户 |
| | | List<TUser> tUsers = userService.selectList(new EntityWrapper<TUser>().isNotNull("bindDriverId").gt("bindExpireDate", new Date())); |
| | | |
| | | // 获取所有获得司机收益的订单 |
| | | List<TOrderPrivateCar> tOrderPrivateCars = orderPrivateCarService.selectList(new EntityWrapper<TOrderPrivateCar>().eq("promotionActivityId",id).isNotNull("promotionDriverId").isNotNull("successTime")); |
| | | List<TOrderTaxi> tOrderTaxis = orderTaxiService.selectList(new EntityWrapper<TOrderTaxi>().eq("promotionActivityId",id).isNotNull("promotionDriverId").isNotNull("successTime")); |
| | | List<TOrderCrossCity> tOrderCrossCities = orderCrossCityService.selectList(new EntityWrapper<TOrderCrossCity>().eq("promotionActivityId",id).isNotNull("promotionDriverId").isNotNull("successTime")); |
| | | |
| | | |
| | | for (TDriver tDriver : tDrivers) { |
| | | DriverRankVo driverRankVo = new DriverRankVo(); |
| | | driverRankVo.setDriverId(tDriver.getId()); |
| | | driverRankVo.setDriverName(tDriver.getName()); |
| | | long count = tUsers.stream().filter(e -> tDriver.getId().equals(e.getBindDriverId())).count(); |
| | | driverRankVo.setUserNum((int) count); |
| | | |
| | | BigDecimal reduce = tOrderPrivateCars.stream().filter(e -> tDriver.getId().equals(e.getPromotionDriverId())).map(TOrderPrivateCar::getPromotionMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal reduce1 = tOrderTaxis.stream().filter(e -> tDriver.getId().equals(e.getPromotionDriverId())).map(TOrderTaxi::getPromotionMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal reduce2 = tOrderCrossCities.stream().filter(e -> tDriver.getId().equals(e.getPromotionDriverId())).map(TOrderCrossCity::getPromotionMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | driverRankVo.setMoney(reduce.add(reduce1).add(reduce2)); |
| | | hashMaps.add(driverRankVo); |
| | | } |
| | | // hashMaps.stream().sorted(Comparator.comparing(e -> Integer.valueOf(e.get("userNum").toString())).reversed()).collect(Collectors.toList()) |
| | | // hashMaps 通过userNUm 倒叙 |
| | | List<DriverRankVo> collect = hashMaps.stream().sorted(Comparator.comparing(DriverRankVo::getUserNum).reversed()).collect(Collectors.toList()); |
| | | return collect; |
| | | } |
| | | |
| | | @Override |
| | | public ArrayList<HashMap<String, Object>> list2(Long driverId, String name) { |
| | | ArrayList<HashMap<String, Object>> hashMaps = new ArrayList<>(); |
| | | |
| | | Wrapper<TUser> gt = new EntityWrapper<TUser>().eq("bindDriverId", driverId).gt("bindExpireDate", new Date()); |
| | | if (name != null && !"".equals(name)) { |
| | | gt.like("nickName", name); |
| | | } |
| | | |
| | | // 获取所有获得司机收益的订单 |
| | | List<TOrderPrivateCar> tOrderPrivateCars = orderPrivateCarService.selectList(new EntityWrapper<TOrderPrivateCar>().eq("promotionDriverId",driverId).isNotNull("successTime")); |
| | | List<TOrderTaxi> tOrderTaxis = orderTaxiService.selectList(new EntityWrapper<TOrderTaxi>().eq("promotionDriverId",driverId).isNotNull("successTime")); |
| | | List<TOrderCrossCity> tOrderCrossCities = orderCrossCityService.selectList(new EntityWrapper<TOrderCrossCity>().eq("promotionDriverId",driverId).isNotNull("successTime")); |
| | | |
| | | // 找出绑定这个司机的用户 |
| | | List<TUser> tUsers = userService.selectList(gt); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (TUser tUser : tUsers) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("userId", tUser.getId()); |
| | | map.put("userName", tUser.getNickName()); |
| | | map.put("userPhone", tUser.getPhone()); |
| | | map.put("bindDate",simpleDateFormat.format( tUser.getBindDate())); |
| | | map.put("bindExpireDate",simpleDateFormat.format( tUser.getBindExpireDate())); |
| | | BigDecimal reduce = tOrderPrivateCars.stream().filter(e -> e.getUserId().equals(tUser.getId())).map(TOrderPrivateCar::getPromotionMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal reduce1 = tOrderTaxis.stream().filter(e -> e.getUserId().equals(tUser.getId())).map(TOrderTaxi::getPromotionMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal reduce2 = tOrderCrossCities.stream().filter(e -> e.getUserId().equals(tUser.getId())).map(TOrderCrossCity::getPromotionMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map.put("money", reduce.add(reduce1).add(reduce2)); |
| | | hashMaps.add( map); |
| | | } |
| | | return hashMaps; |
| | | } |
| | | } |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#TimeCon id="insertTime" name="添加时间" isTime="false"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="name" name="活动名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#SelectCon id="status" name="状态" > |
| | | <option value="">全部</option> |
| | | <!-- <option value="1">APP下单</option>--> |
| | | <option value="1">已开启</option> |
| | | <option value="2">暂停</option> |
| | | <!-- <option value="4">司机下单</option>--> |
| | | <option value="3">未开启</option> |
| | | <!-- <option value="6">道行龙城下单</option>--> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="重置" icon="" clickFun="TDriverPromotionActivity.research()"/> |
| | | <#button name="搜索" icon="" clickFun="TDriverPromotionActivity.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="TDriverPromotionActivityTableToolbar" role="group"> |
| | | <#button name="添加" icon="fa-plus" clickFun="TDriverPromotionActivity.openAddTDriverPromotionActivity()"/> |
| | | <#button name="暂停/开启" icon="fa-edit" clickFun="TDriverPromotionActivity.startOrStop()" space="true"/> |
| | | </div> |
| | | <#table id="TDriverPromotionActivityTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tDriverPromotionActivity/tDriverPromotionActivity.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#insertTime' |
| | | ,range: true |
| | | }); |
| | | </script> |
| | | |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-4"> |
| | | <#input id="activityTitle" name="推广活动标题"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row" style="margin-left: -24px"> |
| | | <label class="col-sm-1 control-label">关联业务:</label> |
| | | <div class="col-sm-3"> |
| | | <label class="checkbox-inline"> |
| | | <input type="checkbox" name="bizType" value="1"> 专车 |
| | | </label> |
| | | <label class="checkbox-inline"> |
| | | <input type="checkbox" name="bizType" value="2"> 出租车 |
| | | </label> |
| | | <label class="checkbox-inline"> |
| | | <input type="checkbox" name="bizType" value="3"> 城际 |
| | | </label> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row" style="margin-top: 10px"> |
| | | <label class="col-sm-1 control-label">活动区域:</label> |
| | | <div class="col-sm-2"> |
| | | <select class="form-control" id="province" onchange="provinceChange(this)"> |
| | | <option value="">选择省</option> |
| | | @for(obj in provinceList){ |
| | | <option value="${obj.code}">${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <select class="form-control" id="city" onchange="cityChage(this)"> |
| | | <option value="">选择市</option> |
| | | </select> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <select class="form-control" id="area"> |
| | | <option value="">选择区</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row" style="margin-top: 10px"> |
| | | <div class="col-sm-3"> |
| | | <#input id="time" name="活动时间" isTime="false"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#input id="commissionRatio" name="抽佣比例" /> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="col-sm-3"> |
| | | <#input id="bindingDays" name="绑定有效期" /> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="col-sm-3"> |
| | | <label style="font-weight:700">推广活动说明:</label> |
| | | |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="panel-body"> |
| | | <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;"></textarea> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TDriverPromotionActivityInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tDriverPromotionActivity/tDriverPromotionActivity_info.js"></script> |
| | | <script> |
| | | function addSubmit() { |
| | | var activityTitle = $("#activityTitle").val(); |
| | | var bizTypes = []; |
| | | $('input[name="bizType"]:checked').each(function() { |
| | | bizTypes.push($(this).val()); |
| | | }); |
| | | var bizTypeValue = bizTypes.join(','); |
| | | |
| | | var province = $("#province").val(); |
| | | var city = $("#city").val(); |
| | | var area = $("#area").val(); |
| | | var time = $("#time").val(); |
| | | var commissionRatio = $("#commissionRatio").val(); |
| | | var bindingDays = $("#bindingDays").val(); |
| | | var content = editor_1.getContent(); |
| | | |
| | | |
| | | console.log(activityTitle) |
| | | console.log(bizTypeValue) |
| | | console.log(province) |
| | | console.log(city) |
| | | console.log(area) |
| | | console.log(time) |
| | | console.log(commissionRatio) |
| | | console.log(bindingDays) |
| | | console.log(content) |
| | | if(activityTitle==null||activityTitle==''){ |
| | | Feng.error("请填写活动标题"); |
| | | return; |
| | | } |
| | | if(bizTypeValue==null||bizTypeValue==''){ |
| | | Feng.error("请选择业务类型"); |
| | | return; |
| | | } |
| | | if(province==null||province==''){ |
| | | Feng.error("请选择活动区域"); |
| | | return; |
| | | } |
| | | if(city==null||city==''){ |
| | | Feng.error("请选择活动区域"); |
| | | return; |
| | | } |
| | | if(area==null||area==''){ |
| | | Feng.error("请选择活动区域"); |
| | | return; |
| | | } |
| | | if(time==null||time==''){ |
| | | Feng.error("请填写活动时间"); |
| | | return; |
| | | } |
| | | |
| | | if(commissionRatio==null||commissionRatio==''){ |
| | | Feng.error("请填写抽佣比例"); |
| | | return; |
| | | } |
| | | // 使用正则表达式验证 0-100 的整数 |
| | | var commissionRatioReg = /^(?:[1-9]|[1-9][0-9]|100|0)$/; |
| | | if (!commissionRatioReg.test(commissionRatio)) { |
| | | Feng.error("抽佣比例必须是0-100之间的整数"); |
| | | return; |
| | | } |
| | | if(bindingDays==null||bindingDays==''){ |
| | | Feng.error("请填写绑定有效期"); |
| | | return; |
| | | } |
| | | // 使用正则表达式验证大于0的整数 |
| | | var bindingDaysReg = /^[1-9]\d*$/; |
| | | if (!bindingDaysReg.test(bindingDays)) { |
| | | Feng.error("绑定有效期必须是大于0的整数"); |
| | | return; |
| | | } |
| | | if(content==null||content==''){ |
| | | Feng.error("请填写活动说明"); |
| | | return; |
| | | } |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/add", function(data){ |
| | | Feng.success("添加成功!"); |
| | | TDriverPromotionActivityInfoDlg.close(); |
| | | parent.TDriverPromotionActivity.table.refresh(); |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("activityTitle", activityTitle); |
| | | ajax.set("bizTypeValue", bizTypeValue); |
| | | ajax.set("province", province); |
| | | ajax.set("city", city); |
| | | ajax.set("area", area); |
| | | ajax.set("time", time); |
| | | ajax.set("commissionRatio", commissionRatio); |
| | | ajax.set("bindingDays", bindingDays); |
| | | ajax.set("content", content); |
| | | ajax.start(); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | var editor_1 = null; |
| | | $(function () { |
| | | //初始化编辑器 |
| | | editor_1 = UE.getEditor('editor_1'); |
| | | }); |
| | | laydate.render({ |
| | | elem: '#time' |
| | | ,range: true |
| | | }); |
| | | function provinceChange(e) { |
| | | var provinceCode=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompany/change", function(data){ |
| | | if(data!=null){ |
| | | var content='<option value="">选择市</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#city").empty().append(content); |
| | | $("#area").empty().append('<option value="">选择区</option>'); |
| | | } |
| | | }); |
| | | ajax.set("code",provinceCode); |
| | | ajax.start(); |
| | | } |
| | | |
| | | function cityChage(e) { |
| | | var cityCode=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompany/change", function(data){ |
| | | if(data!=null){ |
| | | var content='<option value="">选择区</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#area").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("code",cityCode); |
| | | ajax.start(); |
| | | } |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | <input type="hidden" id="id" value="${item.id!}"/> |
| | | <div class="row"> |
| | | <div class="col-sm-4"> |
| | | <#input id="activityTitle" name="推广活动标题" value="${item.activityTitle}"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row" style="margin-left: -24px"> |
| | | <label class="col-sm-1 control-label">关联业务:</label> |
| | | <div class="col-sm-3"> |
| | | <label class="checkbox-inline"> |
| | | <input type="checkbox" name="bizType" value="1"> 专车 |
| | | </label> |
| | | <label class="checkbox-inline"> |
| | | <input type="checkbox" name="bizType" value="2"> 出租车 |
| | | </label> |
| | | <label class="checkbox-inline"> |
| | | <input type="checkbox" name="bizType" value="3"> 城际 |
| | | </label> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row" style="margin-top: 10px"> |
| | | <label class="col-sm-1 control-label">活动区域:</label> |
| | | <div class="col-sm-2"> |
| | | <select class="form-control" id="province" onchange="provinceChange(this)"> |
| | | <option value="">选择省</option> |
| | | @for(obj in provinceList){ |
| | | <option value="${obj.code}" ${obj.code == item.provinceCode ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <select class="form-control" id="city" onchange="cityChage(this)"> |
| | | <option value="">选择市</option> |
| | | @for(obj in cityList){ |
| | | <option value="${obj.code}" ${obj.code == item.cityCode ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <select class="form-control" id="area"> |
| | | <option value="">选择区</option> |
| | | @for(obj in areaList){ |
| | | <option value="${obj.code}" ${obj.code == item.districtCode ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row" style="margin-top: 10px"> |
| | | <div class="col-sm-3"> |
| | | <#input id="time" name="活动时间" isTime="false"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#input id="commissionRatio" name="抽佣比例" /> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="col-sm-3"> |
| | | <#input id="bindingDays" name="绑定有效期" /> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="col-sm-3"> |
| | | <label style="font-weight:700">推广活动说明:</label> |
| | | |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="panel-body"> |
| | | <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;"></textarea> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TDriverPromotionActivityInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tDriverPromotionActivity/tDriverPromotionActivity_info.js"></script> |
| | | <script> |
| | | $(function() { |
| | | // 初始化编辑器 |
| | | editor_1 = UE.getEditor('editor_1'); |
| | | |
| | | // 初始化活动时间 |
| | | laydate.render({ |
| | | elem: '#time', |
| | | range: true |
| | | }); |
| | | |
| | | // 回显关联业务 |
| | | var bizTypeStr = "${item.bizType!}"; // 获取业务类型字符串 |
| | | if (bizTypeStr) { |
| | | var bizTypes = bizTypeStr.split(','); |
| | | $('input[name="bizType"]').each(function() { |
| | | if (bizTypes.indexOf($(this).val()) !== -1) { |
| | | $(this).prop('checked', true); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 回显活动时间 |
| | | $("#time").val("${time!}"); |
| | | |
| | | // 回显抽佣比例和绑定有效期 |
| | | $("#commissionRatio").val("${item.commissionRatio!}"); |
| | | $("#bindingDays").val("${item.bindingDays!}"); |
| | | |
| | | // 回显活动说明 |
| | | setTimeout(function() { |
| | | editor_1.ready(function() { |
| | | editor_1.setContent('${item.activityDesc!}'); |
| | | }); |
| | | }, 100); |
| | | }); |
| | | |
| | | function editSubmit() { |
| | | var activityTitle = $("#activityTitle").val(); |
| | | var bizTypes = []; |
| | | $('input[name="bizType"]:checked').each(function() { |
| | | bizTypes.push($(this).val()); |
| | | }); |
| | | var bizTypeValue = bizTypes.join(','); |
| | | |
| | | var province = $("#province").val(); |
| | | var city = $("#city").val(); |
| | | var area = $("#area").val(); |
| | | var time = $("#time").val(); |
| | | var id = $("#id").val(); |
| | | var commissionRatio = $("#commissionRatio").val(); |
| | | var bindingDays = $("#bindingDays").val(); |
| | | var content = editor_1.getContent(); |
| | | |
| | | |
| | | |
| | | console.log(activityTitle) |
| | | console.log(bizTypeValue) |
| | | console.log(province) |
| | | console.log(city) |
| | | console.log(area) |
| | | console.log(time) |
| | | console.log(commissionRatio) |
| | | console.log(bindingDays) |
| | | console.log(content) |
| | | if(activityTitle==null||activityTitle==''){ |
| | | Feng.error("请填写活动标题"); |
| | | return; |
| | | } |
| | | if(bizTypeValue==null||bizTypeValue==''){ |
| | | Feng.error("请选择业务类型"); |
| | | return; |
| | | } |
| | | if(province==null||province==''){ |
| | | Feng.error("请选择活动区域"); |
| | | return; |
| | | } |
| | | if(city==null||city==''){ |
| | | Feng.error("请选择活动区域"); |
| | | return; |
| | | } |
| | | if(area==null||area==''){ |
| | | Feng.error("请选择活动区域"); |
| | | return; |
| | | } |
| | | if(time==null||time==''){ |
| | | Feng.error("请填写活动时间"); |
| | | return; |
| | | } |
| | | |
| | | if(commissionRatio==null||commissionRatio==''){ |
| | | Feng.error("请填写抽佣比例"); |
| | | return; |
| | | } |
| | | // 使用正则表达式验证 0-100 的整数 |
| | | var commissionRatioReg = /^(?:[1-9]|[1-9][0-9]|100|0)$/; |
| | | if (!commissionRatioReg.test(commissionRatio)) { |
| | | Feng.error("抽佣比例必须是0-100之间的整数"); |
| | | return; |
| | | } |
| | | if(bindingDays==null||bindingDays==''){ |
| | | Feng.error("请填写绑定有效期"); |
| | | return; |
| | | } |
| | | // 使用正则表达式验证大于0的整数 |
| | | var bindingDaysReg = /^[1-9]\d*$/; |
| | | if (!bindingDaysReg.test(bindingDays)) { |
| | | Feng.error("绑定有效期必须是大于0的整数"); |
| | | return; |
| | | } |
| | | if(content==null||content==''){ |
| | | Feng.error("请填写活动说明"); |
| | | return; |
| | | } |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/update", function(data){ |
| | | Feng.success("编辑成功!"); |
| | | TDriverPromotionActivityInfoDlg.close(); |
| | | parent.TDriverPromotionActivity.table.refresh(); |
| | | },function(data){ |
| | | Feng.error("编辑失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id", id); |
| | | ajax.set("activityTitle", activityTitle); |
| | | ajax.set("bizTypeValue", bizTypeValue); |
| | | ajax.set("province", province); |
| | | ajax.set("city", city); |
| | | ajax.set("area", area); |
| | | ajax.set("time", time); |
| | | ajax.set("commissionRatio", commissionRatio); |
| | | ajax.set("bindingDays", bindingDays); |
| | | ajax.set("content", content); |
| | | ajax.start(); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | function provinceChange(e) { |
| | | var provinceCode=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompany/change", function(data){ |
| | | if(data!=null){ |
| | | var content='<option value="">选择市</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#city").empty().append(content); |
| | | $("#area").empty().append('<option value="">选择区</option>'); |
| | | } |
| | | }); |
| | | ajax.set("code",provinceCode); |
| | | ajax.start(); |
| | | } |
| | | |
| | | function cityChage(e) { |
| | | var cityCode=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompany/change", function(data){ |
| | | if(data!=null){ |
| | | var content='<option value="">选择区</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#area").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("code",cityCode); |
| | | ajax.start(); |
| | | } |
| | | </script> |
| | | @} |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var TDriverPromotionActivity = { |
| | | id: "TDriverPromotionActivityTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1 |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TDriverPromotionActivity.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '推广活动ID', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'}, |
| | | { |
| | | title: '活动区域-省', field: 'province', visible: true, align: 'center', valign: 'middle', |
| | | |
| | | formatter: function (value, row, index) { |
| | | if (row.province != null && row.city != null && row.district != null) { |
| | | return row.province + "-" + row.city + "-" + row.district; |
| | | } |
| | | if (row.province != null && row.city != null) { |
| | | return row.province + "-" + row.city; |
| | | } |
| | | if (row.province != null) { |
| | | return row.province; |
| | | } |
| | | |
| | | } |
| | | }, |
| | | {title: '活动名称', field: 'activityTitle', visible: true, align: 'center', valign: 'middle'}, |
| | | { |
| | | title: '活动时间', field: 'startTime', visible: true, align: 'center', valign: 'middle', |
| | | |
| | | formatter: function (value, row, index) { |
| | | return row.startTime + " - " + row.endTime; |
| | | } |
| | | |
| | | }, |
| | | {title: '当前状态', field: 'status', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row, index) { |
| | | return {1:"已开启",2:"暂停",3:"未开启",4:"已结束"}[value]; |
| | | } |
| | | }, |
| | | { |
| | | title: '操作', field: 'opt', visible: true, align: 'left', valign: 'middle', width: "10%", |
| | | formatter: function (value, row) { |
| | | if(row.status==1){ |
| | | var btn = []; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.stop(' + row.id + ')" style="color: #0e9aef">暂停</a> '; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.info(' + row.id + ')" style="color: #0e9aef">详情</a> '; |
| | | return btn; |
| | | } |
| | | if(row.status==2){ |
| | | var btn = []; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.start(' + row.id + ')" style="color: #0e9aef">开启</a> '; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.info(' + row.id + ')" style="color: #0e9aef">详情</a> '; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.update(' + row.id + ')" style="color: #0e9aef">编辑</a> '; |
| | | return btn; |
| | | } |
| | | if(row.status==3){ |
| | | var btn = []; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.info(' + row.id + ')" style="color: #0e9aef">详情</a> '; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.update(' + row.id + ')" style="color: #0e9aef">编辑</a> '; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.delete(' + row.id + ')" style="color: #0e9aef">删除</a> '; |
| | | return btn; |
| | | } |
| | | if(row.status==4){ |
| | | var btn = []; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.info(' + row.id + ')">详情</a> '; |
| | | btn += '<a href="javascript:void(0);" onclick="TDriverPromotionActivity.delete(' + row.id + ')">删除</a> '; |
| | | return btn; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TDriverPromotionActivity.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if (selected.length == 0) { |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | } else { |
| | | TDriverPromotionActivity.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 点击添加 |
| | | */ |
| | | TDriverPromotionActivity.openAddTDriverPromotionActivity = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tDriverPromotionActivity/tDriverPromotionActivity_add' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 打开查看详情 |
| | | */ |
| | | TDriverPromotionActivity.update = function (e) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '编辑', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tDriverPromotionActivity/tDriverPromotionActivity_update/' + e |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | TDriverPromotionActivity.info = function (e) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '编辑', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tDriverPromotionActivity/tDriverPromotionActivity_info/' + e |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | TDriverPromotionActivity.delete = function (e) { |
| | | var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/delete", function (data) { |
| | | Feng.success("删除成功!"); |
| | | TDriverPromotionActivity.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("删除失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("tDriverPromotionActivityId", e); |
| | | ajax.start(); |
| | | }; |
| | | TDriverPromotionActivity.stop = function (e) { |
| | | var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/stop", function (data) { |
| | | Feng.success("暂停成功!"); |
| | | TDriverPromotionActivity.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("暂停失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id", e); |
| | | ajax.start(); |
| | | }; |
| | | |
| | | TDriverPromotionActivity.start = function (e) { |
| | | var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/start", function (data) { |
| | | Feng.success("暂停成功!"); |
| | | TDriverPromotionActivity.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("暂停失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id", e); |
| | | ajax.start(); |
| | | }; |
| | | |
| | | |
| | | TDriverPromotionActivity.startOrStop = function () { |
| | | if (this.check()) { |
| | | if (TDriverPromotionActivity.seItem.status == 1) { |
| | | TDriverPromotionActivity.stop(TDriverPromotionActivity.seItem.id); |
| | | } else { |
| | | TDriverPromotionActivity.start(TDriverPromotionActivity.seItem.id); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | TDriverPromotionActivity.search = function () { |
| | | var queryData = {}; |
| | | queryData['insertTime'] = $("#insertTime").val(); |
| | | queryData['name'] = $("#name").val(); |
| | | queryData['status'] = $("#status").val(); |
| | | TDriverPromotionActivity.table.refresh({query: queryData}); |
| | | }; |
| | | TDriverPromotionActivity.research = function () { |
| | | $("#insertTime").val(''); |
| | | $("#name").val(''); |
| | | $("#status").val(''); |
| | | TDriverPromotionActivity.search() |
| | | }; |
| | | |
| | | |
| | | $(function () { |
| | | var defaultColunms = TDriverPromotionActivity.initColumn(); |
| | | var table = new BSTable(TDriverPromotionActivity.id, "/tDriverPromotionActivity/list", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TDriverPromotionActivity.table = table.init(); |
| | | }); |
New file |
| | |
| | | /** |
| | | * 初始化详情对话框 |
| | | */ |
| | | var TDriverPromotionActivityInfoDlg = { |
| | | tDriverPromotionActivityInfoData : {} |
| | | }; |
| | | |
| | | /** |
| | | * 清除数据 |
| | | */ |
| | | TDriverPromotionActivityInfoDlg.clearData = function() { |
| | | this.tDriverPromotionActivityInfoData = {}; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | TDriverPromotionActivityInfoDlg.set = function(key, val) { |
| | | this.tDriverPromotionActivityInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | TDriverPromotionActivityInfoDlg.get = function(key) { |
| | | return $("#" + key).val(); |
| | | } |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | TDriverPromotionActivityInfoDlg.close = function() { |
| | | parent.layer.close(window.parent.TDriverPromotionActivity.layerIndex); |
| | | } |
| | | |
| | | /** |
| | | * 收集数据 |
| | | */ |
| | | TDriverPromotionActivityInfoDlg.collectData = function() { |
| | | this |
| | | .set('id') |
| | | .set('bizType') |
| | | .set('activityTitle') |
| | | .set('province') |
| | | .set('provinceCode') |
| | | .set('city') |
| | | .set('cityCode') |
| | | .set('district') |
| | | .set('districtCode') |
| | | .set('startTime') |
| | | .set('endTime') |
| | | .set('commissionRatio') |
| | | .set('bindingDays') |
| | | .set('activityDesc') |
| | | .set('status') |
| | | .set('creator') |
| | | .set('createTime') |
| | | .set('updateTime'); |
| | | } |
| | | |
| | | /** |
| | | * 提交添加 |
| | | */ |
| | | TDriverPromotionActivityInfoDlg.addSubmit = function() { |
| | | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/add", function(data){ |
| | | Feng.success("添加成功!"); |
| | | window.parent.TDriverPromotionActivity.table.refresh(); |
| | | TDriverPromotionActivityInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set(this.tDriverPromotionActivityInfoData); |
| | | ajax.start(); |
| | | } |
| | | |
| | | /** |
| | | * 提交修改 |
| | | */ |
| | | TDriverPromotionActivityInfoDlg.editSubmit = function() { |
| | | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/update", function(data){ |
| | | Feng.success("修改成功!"); |
| | | window.parent.TDriverPromotionActivity.table.refresh(); |
| | | TDriverPromotionActivityInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set(this.tDriverPromotionActivityInfoData); |
| | | ajax.start(); |
| | | } |
| | | |
| | | $(function() { |
| | | |
| | | }); |