From 84f9b0e8fefd3b492e9083e281c6c1366203a968 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期二, 07 三月 2023 18:03:49 +0800 Subject: [PATCH] 分公司管理 --- management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeAreaAdd.html | 45 ++ management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java | 159 +++++- management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js | 185 ++++++++ management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeDetail.html | 24 management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js | 84 +++ management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeAreaUpdate.html | 57 ++ management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver_info.js | 14 management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java | 205 +++++++++ management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_edit.html | 84 +++ management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_add.html | 82 +++ management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/TBranchOfficeResp.java | 75 +++ management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TBranchOffice.java | 58 ++ management/guns-admin/src/main/webapp/WEB-INF/view/system/tYouTui/tYouTui_add.html | 140 +++-- management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITBranchOfficeService.java | 28 + 14 files changed, 1,096 insertions(+), 144 deletions(-) diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java index d806fe0..55f20e3 100644 --- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java +++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java @@ -3,11 +3,15 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.stylefeng.guns.core.base.controller.BaseController; +import com.stylefeng.guns.core.base.tips.SuccessTip; import com.stylefeng.guns.core.shiro.ShiroKit; -import com.stylefeng.guns.modular.system.model.TAppUser; -import com.stylefeng.guns.modular.system.model.TSystemConfig; -import com.stylefeng.guns.modular.system.model.User; +import com.stylefeng.guns.modular.system.controller.resp.TBranchOfficeResp; +import com.stylefeng.guns.modular.system.controller.resp.TDriverResp; +import com.stylefeng.guns.modular.system.model.*; +import com.stylefeng.guns.modular.system.service.ITRegionService; import com.stylefeng.guns.modular.system.service.ITSystemConfigService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; @@ -17,10 +21,11 @@ import org.springframework.beans.factory.annotation.Autowired; import com.stylefeng.guns.core.log.LogObjectHolder; import org.springframework.web.bind.annotation.RequestParam; -import com.stylefeng.guns.modular.system.model.TBranchOffice; import com.stylefeng.guns.modular.system.service.ITBranchOfficeService; +import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** * 控制器 @@ -38,6 +43,9 @@ private ITBranchOfficeService tBranchOfficeService; @Autowired private ITSystemConfigService tSystemConfigService; + + @Autowired + private ITRegionService tRegionService; /** * 跳转到首页 @@ -60,8 +68,32 @@ */ @RequestMapping("/tBranchOffice_update/{tBranchOfficeId}") public String tBranchOfficeUpdate(@PathVariable Integer tBranchOfficeId, Model model) { + TBranchOffice tBranchOffice = tBranchOfficeService.selectById(tBranchOfficeId); - model.addAttribute("item",tBranchOffice); + TBranchOfficeResp tBranchOfficeResp = new TBranchOfficeResp(); + BeanUtils.copyProperties(tBranchOffice,tBranchOfficeResp); + + // 查询区域 + TRegion city = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tBranchOffice.getCityCode()) + .last("LIMIT 1")); + TRegion district = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tBranchOffice.getDistrictCode()) + .last("LIMIT 1")); + + if(StringUtils.hasLength(tBranchOffice.getDistrictName())){ + tBranchOfficeResp.setArea(tBranchOffice.getProvinceName()+"/"+tBranchOffice.getCityName()+"/"+tBranchOffice.getDistrictName()); + }else { + tBranchOfficeResp.setArea(tBranchOffice.getProvinceName()+"/"+tBranchOffice.getCityName()); + } + + if(Objects.nonNull(city)){ + if(Objects.nonNull(district)){ + tBranchOfficeResp.setAreaId(city.getParentId()+"/"+city.getId()+"/"+district.getId()); + }else { + tBranchOfficeResp.setAreaId(city.getParentId()+"/"+city.getId()); + } + } + + model.addAttribute("item",tBranchOfficeResp); LogObjectHolder.me().set(tBranchOffice); return PREFIX + "tBranchOffice_edit.html"; } @@ -80,44 +112,73 @@ } /** + * 跳转区域页面新增 + */ + @RequestMapping("/areaPageAdd") + public String areaPageAdd(Model model) { + List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); + model.addAttribute("provinceList",tRegions); + return PREFIX + "tBranchOfficeAreaAdd.html"; + } + + /** + * 跳转区域页面编辑 + */ + @RequestMapping("/areaPageUpdate") + public String areaPageUpdate(String area,String areaId,Model model) { + List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); + model.addAttribute("provinceList",tRegions); + List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList()); + // 查询市 + List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", provinceIds)); + model.addAttribute("cityList",tRegions1); + + // 查询区 + List<Integer> cityIds = tRegions1.stream().map(TRegion::getId).collect(Collectors.toList()); + List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", cityIds)); + model.addAttribute("districtList",tRegions2); + + if(StringUtils.hasLength(area) && StringUtils.hasLength(areaId)){ + String[] split = area.split("/"); + model.addAttribute("provinceName",split[0]); + model.addAttribute("cityName",split[1]); + if(split.length>2){ + model.addAttribute("districtName",split[2]); + }else { + model.addAttribute("districtName",""); + } + + String[] split1 = areaId.split("/"); + model.addAttribute("provinceId",split1[0]); + model.addAttribute("cityId",split1[1]); + if(split1.length>2) { + model.addAttribute("districtId", split1[2]); + }else { + model.addAttribute("districtId", ""); + } + } + return PREFIX + "tBranchOfficeAreaUpdate.html"; + } + + /** * 获取列表 */ @RequestMapping(value = "/list") @ResponseBody public Object list(String branchOfficeName,String principal,String principalPhone,Integer operatingBusiness ,Integer status) { - EntityWrapper<TBranchOffice> wrapper = new EntityWrapper<>(); - // 分公司名称 - if(StringUtils.hasLength(branchOfficeName)){ - wrapper.like("branchOfficeName",branchOfficeName); - } - // 负责人 - if(StringUtils.hasLength(principal)){ - wrapper.like("principal",principal); - } - // 负责人电话 - if(StringUtils.hasLength(principalPhone)){ - wrapper.like("principalPhone",principalPhone); - } - // 经营业务 - if(Objects.nonNull(operatingBusiness)){ - wrapper.eq("operatingBusiness",operatingBusiness); - } - // 状态 - if(Objects.nonNull(status)){ - wrapper.eq("status",status); - } - // 判断代理商 分公司 - Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); - Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); - if(2 == roleType){ - // 分公司 - wrapper.eq("id",objectId); - } - if(3 == roleType){ - // 代理商 - wrapper.eq("agentId",objectId); - } - return tBranchOfficeService.selectList(wrapper); + List<TBranchOfficeResp> tBranchOfficeRespList = tBranchOfficeService.getPageList(branchOfficeName,principal,principalPhone,operatingBusiness,status); + // 分公司查询优惠券,订单,司机等信息 + tBranchOfficeService.queryOtherInfo(tBranchOfficeRespList); + return tBranchOfficeRespList; + } + + @ApiOperation(value = "市区查询",notes="市区查询") + @RequestMapping(value = "/areaCity") + @ResponseBody + public Object areaCity(Integer parentId,Model model) { + List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", parentId)); + model.addAttribute("list",tRegions); + return tRegions; } /** @@ -159,6 +220,17 @@ @RequestMapping(value = "/add") @ResponseBody public Object add(TBranchOffice tBranchOffice) { + int count = tBranchOfficeService.selectCount(new EntityWrapper<TBranchOffice>().eq("branchOfficeName", tBranchOffice.getBranchOfficeName())); + if(count>0){ + return new SuccessTip(500,"该分公司名称已存在!"); + } + + Object o = tBranchOfficeService.addOrUpdate(tBranchOffice); + if(Objects.nonNull(o)){ + return o; + } + tBranchOffice.setStatus(1); + tBranchOfficeService.insert(tBranchOffice); return SUCCESS_TIP; } @@ -179,6 +251,17 @@ @RequestMapping(value = "/update") @ResponseBody public Object update(TBranchOffice tBranchOffice) { + TBranchOffice office = tBranchOfficeService.selectOne(new EntityWrapper<TBranchOffice>().eq("branchOfficeName", tBranchOffice.getBranchOfficeName()) + .last("LIMIT 1")); + if(Objects.nonNull(office) && !tBranchOffice.getId().equals(office.getId())){ + return new SuccessTip(500,"该分公司名称已存在!"); + } +// Object ocr = ocr("E:\\071bf986db0b00355c0ed190bbd3b16.png"); +// System.err.println(ocr); + Object o = tBranchOfficeService.addOrUpdate(tBranchOffice); + if(Objects.nonNull(o)){ + return o; + } tBranchOfficeService.updateById(tBranchOffice); return SUCCESS_TIP; } diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/TBranchOfficeResp.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/TBranchOfficeResp.java new file mode 100644 index 0000000..7bca4ae --- /dev/null +++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/TBranchOfficeResp.java @@ -0,0 +1,75 @@ +package com.stylefeng.guns.modular.system.controller.resp; + +import com.stylefeng.guns.modular.system.model.TBranchOffice; +import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; + +public class TBranchOfficeResp extends TBranchOffice { + + @ApiModelProperty(value = "订单数量") + private Integer orderCount; + + @ApiModelProperty(value = "有效订单") + private Integer effectiveOrderCount; + + @ApiModelProperty(value = "已发放优惠券") + private Integer totalCount; + + @ApiModelProperty(value = "已使用优惠券") + private Integer usedCount; + + @ApiModelProperty(value = "累计优惠券金额") + private BigDecimal orderPriceCount; + + @ApiModelProperty(value = "司机数量") + private Integer driverCount; + + public Integer getDriverCount() { + return driverCount; + } + + public void setDriverCount(Integer driverCount) { + this.driverCount = driverCount; + } + + public Integer getOrderCount() { + return orderCount; + } + + public void setOrderCount(Integer orderCount) { + this.orderCount = orderCount; + } + + public Integer getEffectiveOrderCount() { + return effectiveOrderCount; + } + + public void setEffectiveOrderCount(Integer effectiveOrderCount) { + this.effectiveOrderCount = effectiveOrderCount; + } + + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public Integer getUsedCount() { + return usedCount; + } + + public void setUsedCount(Integer usedCount) { + this.usedCount = usedCount; + } + + public BigDecimal getOrderPriceCount() { + return orderPriceCount; + } + + public void setOrderPriceCount(BigDecimal orderPriceCount) { + this.orderPriceCount = orderPriceCount; + } +} diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TBranchOffice.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TBranchOffice.java index 0655fc1..fca2f76 100644 --- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TBranchOffice.java +++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TBranchOffice.java @@ -1,10 +1,13 @@ package com.stylefeng.guns.modular.system.model; +import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.enums.IdType; import java.util.Date; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.activerecord.Model; import com.baomidou.mybatisplus.annotations.TableName; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** @@ -82,6 +85,61 @@ */ private Integer operatingBusiness; + /** + * 开户银行 + */ + @TableField(value = "bankDeposit") + @ApiModelProperty(value = "开户银行") + private String bankDeposit; + + /** + * 银行账户 + */ + @TableField(value = "bankAccount") + @ApiModelProperty(value = "银行账户") + private String bankAccount; + + + @TableField(exist = false) + @ApiModelProperty(value = "区域") + private String area; + + @TableField(exist = false) + @ApiModelProperty(value = "区域id") + private String areaId; + + public String getBankDeposit() { + return bankDeposit; + } + + public void setBankDeposit(String bankDeposit) { + this.bankDeposit = bankDeposit; + } + + public String getBankAccount() { + return bankAccount; + } + + public void setBankAccount(String bankAccount) { + this.bankAccount = bankAccount; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getAreaId() { + return areaId; + } + + public void setAreaId(String areaId) { + this.areaId = areaId; + } + public String getBranchOfficeName() { return branchOfficeName; } diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITBranchOfficeService.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITBranchOfficeService.java index 147f11c..ff45da3 100644 --- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITBranchOfficeService.java +++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITBranchOfficeService.java @@ -1,8 +1,11 @@ package com.stylefeng.guns.modular.system.service; +import com.stylefeng.guns.modular.system.controller.resp.TBranchOfficeResp; import com.stylefeng.guns.modular.system.model.TBranchOffice; import com.baomidou.mybatisplus.service.IService; import org.springframework.ui.Model; + +import java.util.List; /** * <p> @@ -20,4 +23,29 @@ * @param model */ void tBranchOfficeDetail(Integer tBranchOfficeId, Model model); + + /** + * 分公司获取列表 + * @param branchOfficeName + * @param principal + * @param principalPhone + * @param operatingBusiness + * @param status + * @return + */ + List<TBranchOfficeResp> getPageList(String branchOfficeName, String principal, String principalPhone, Integer operatingBusiness, Integer status); + + /** + * 分公司查询优惠券,订单,司机等信息 + * @param tBranchOfficeRespList + */ + void queryOtherInfo(List<TBranchOfficeResp> tBranchOfficeRespList); + + /** + * 匹配代理商信息 + * @param tBranchOffice + * @return + */ + Object addOrUpdate(TBranchOffice tBranchOffice); + } diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java index e873d51..4d5b211 100644 --- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java +++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java @@ -1,16 +1,30 @@ package com.stylefeng.guns.modular.system.service.impl; -import com.stylefeng.guns.modular.system.dao.TCouponMapper; -import com.stylefeng.guns.modular.system.dao.TOrderMapper; -import com.stylefeng.guns.modular.system.dao.TSystemConfigMapper; -import com.stylefeng.guns.modular.system.model.TBranchOffice; -import com.stylefeng.guns.modular.system.dao.TBranchOfficeMapper; -import com.stylefeng.guns.modular.system.model.TSystemConfig; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.stylefeng.guns.core.base.tips.SuccessTip; +import com.stylefeng.guns.core.shiro.ShiroKit; +import com.stylefeng.guns.modular.system.controller.resp.TBranchOfficeResp; +import com.stylefeng.guns.modular.system.dao.*; +import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.ITBranchOfficeService; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.stylefeng.guns.modular.system.service.ITRegionService; +import org.apache.poi.hdf.extractor.TC; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.ui.Model; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * <p> @@ -28,17 +42,194 @@ @Autowired private TCouponMapper tCouponMapper; + @Autowired + private TUserToCouponMapper tUserToCouponMapper; @Autowired private TOrderMapper tOrderMapper; + @Autowired + private TDriverMapper tDriverMapper; + @Autowired + private ITRegionService tRegionService; + @Autowired + private TAgentMapper tAgentMapper; @Override public void tBranchOfficeDetail(Integer tBranchOfficeId, Model model) { // 分公司信息 TBranchOffice tBranchOffice = tBranchOfficeMapper.selectById(tBranchOfficeId); model.addAttribute("principal",tBranchOffice.getPrincipal()); - model.addAttribute("createTime",tBranchOffice.getCreateTime()); + model.addAttribute("createTime",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tBranchOffice.getCreateTime())); model.addAttribute("email",tBranchOffice.getEmail()); model.addAttribute("area",tBranchOffice.getProvinceName()+tBranchOffice.getCityName()+tBranchOffice.getDistrictName()); + + // 统计时间 + model.addAttribute("startToEndTime",new SimpleDateFormat("yyyy.MM.dd").format(tBranchOffice.getCreateTime())+"-"+ + new SimpleDateFormat("yyyy.MM.dd").format(new Date())); + + // 订单数据 + List<TOrder> orders = tOrderMapper.selectList(new EntityWrapper<TOrder>().eq("branchOfficeId", tBranchOfficeId)); + model.addAttribute("orderCount",orders.size());// 订单数量 + List<TOrder> effectiveOrder = orders.stream().filter(order -> order.getPayMoney().compareTo(new BigDecimal("15")) > 0).collect(Collectors.toList()); + model.addAttribute("effectiveOrderCount",effectiveOrder.size());// 有效订单 + + // 优惠券数据,,,通过订单找到该区域的下单人,找出优惠券信息 + List<Integer> userIds = orders.stream().map(TOrder::getUserId).collect(Collectors.toList()); + List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>().in("userId", userIds)); + // 优惠券有效数量 + int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum(); + // 过期数量 + int expireCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getExpireCount).sum(); + // 总数量 + int totalCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum(); + // 已使用优惠券;总数量减去有效数量 + model.addAttribute("usedCount",totalCount-validCount-expireCount); + + // 已发放优惠券 + model.addAttribute("totalCount",totalCount); + + BigDecimal orderPriceCount = new BigDecimal("0"); + + // 累计优惠券金额 + for (TUserToCoupon tUserToCoupon : tUserToCoupons) { + TCoupon tCoupon = tCouponMapper.selectById(tUserToCoupon.getCouponId()); + BigDecimal price = tCoupon.getCouponPreferentialAmount().multiply(new BigDecimal(tUserToCoupon.getCouponTotal())); + orderPriceCount = orderPriceCount.add(price); + } + model.addAttribute("orderPriceCount",orderPriceCount); + // 司机数量 + Integer driverCount = tDriverMapper.selectCount(new EntityWrapper<TDriver>().eq("branchOfficeId", tBranchOfficeId)); + model.addAttribute("driverCount",driverCount); + } + + @Override + public List<TBranchOfficeResp> getPageList(String branchOfficeName, String principal, String principalPhone, Integer operatingBusiness, Integer status) { + EntityWrapper<TBranchOffice> wrapper = new EntityWrapper<>(); + // 分公司名称 + if(StringUtils.hasLength(branchOfficeName)){ + wrapper.like("branchOfficeName",branchOfficeName); + } + // 负责人 + if(StringUtils.hasLength(principal)){ + wrapper.like("principal",principal); + } + // 负责人电话 + if(StringUtils.hasLength(principalPhone)){ + wrapper.like("principalPhone",principalPhone); + } + // 经营业务 + if(Objects.nonNull(operatingBusiness)){ + wrapper.eq("operatingBusiness",operatingBusiness); + } + // 状态 + if(Objects.nonNull(status)){ + wrapper.eq("status",status); + } + // 判断代理商 分公司 + Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); + Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); + if(2 == roleType){ + // 分公司 + wrapper.eq("id",objectId); + } + if(3 == roleType){ + // 代理商 + wrapper.eq("agentId",objectId); + } + List<TBranchOffice> tBranchOffices = tBranchOfficeMapper.selectList(wrapper); + List<TBranchOfficeResp> tBranchOfficeRespList = new ArrayList<>(tBranchOffices.size()); + for (TBranchOffice tBranchOffice : tBranchOffices) { + TBranchOfficeResp tBranchOfficeResp = new TBranchOfficeResp(); + BeanUtils.copyProperties(tBranchOffice,tBranchOfficeResp); + tBranchOfficeRespList.add(tBranchOfficeResp); + } + return tBranchOfficeRespList; + } + + @Override + public void queryOtherInfo(List<TBranchOfficeResp> tBranchOfficeRespList) { + List<TOrder> orders = tOrderMapper.selectList(new EntityWrapper<TOrder>()); + + for (TBranchOfficeResp tBranchOfficeResp : tBranchOfficeRespList) { + + List<TOrder> orderList = orders.stream().filter(t -> t.getBranchOfficeId().equals(tBranchOfficeResp.getId())).collect(Collectors.toList()); + + if(!CollectionUtils.isEmpty(orderList)){ + + // 订单数据 + tBranchOfficeResp.setOrderCount(orderList.size());// 订单数量 + List<TOrder> effectiveOrder = orderList.stream().filter(order -> order.getPayMoney().compareTo(new BigDecimal("15")) > 0).collect(Collectors.toList()); + tBranchOfficeResp.setEffectiveOrderCount(effectiveOrder.size());// 有效订单 + + // 优惠券数据,,,通过订单找到该区域的下单人,找出优惠券信息 + List<Integer> userIds = orderList.stream().map(TOrder::getUserId).collect(Collectors.toList()); + List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>().in("userId", userIds)); + // 优惠券有效数量 + int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum(); + // 过期数量 + int expireCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getExpireCount).sum(); + // 总数量 + int totalCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum(); + // 已使用优惠券;总数量减去有效数量 + tBranchOfficeResp.setUsedCount(totalCount-validCount-expireCount); + + // 已发放优惠券 + tBranchOfficeResp.setTotalCount(totalCount); + + BigDecimal orderPriceCount = new BigDecimal("0"); + + // 累计优惠券金额 + for (TUserToCoupon tUserToCoupon : tUserToCoupons) { + TCoupon tCoupon = tCouponMapper.selectById(tUserToCoupon.getCouponId()); + BigDecimal price = tCoupon.getCouponPreferentialAmount().multiply(new BigDecimal(tUserToCoupon.getCouponTotal())); + orderPriceCount = orderPriceCount.add(price); + } + tBranchOfficeResp.setOrderPriceCount(orderPriceCount); + } + // 司机数量 + Integer driverCount = tDriverMapper.selectCount(new EntityWrapper<TDriver>().eq("branchOfficeId", tBranchOfficeResp.getId())); + tBranchOfficeResp.setDriverCount(driverCount); + } + + } + + @Override + public Object addOrUpdate(TBranchOffice tBranchOffice) { + // 对省市区做处理 + String[] split = tBranchOffice.getAreaId().split("/"); + // 查询省市 + // 黑龙江省/大兴安岭地区 + // 702/852 + TRegion province = tRegionService.selectById(split[0]); + tBranchOffice.setProvinceName(province.getName()); + tBranchOffice.setProvinceCode(province.getCode()); + + TRegion city = tRegionService.selectById(split[1]); + if(Objects.isNull(city)){ + city = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("name",split[1])); + } + tBranchOffice.setCityName(city.getName()); + tBranchOffice.setCityCode(city.getCode()); + + if(split.length>2){ + TRegion area = tRegionService.selectById(split[2]); + if(Objects.isNull(area)){ + area = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("name",split[2])); + } + tBranchOffice.setDistrictName(area.getName()); + tBranchOffice.setDistrictCode(area.getCode()); + } + + // 通过省市查询代理商 + List<TAgent> tAgent = tAgentMapper.selectList(new EntityWrapper<TAgent>().eq("provinceCode", province.getCode()) + .eq("cityCode", city.getCode()) + .eq("status", 1) + .last("LIMIT 1")); + if(!CollectionUtils.isEmpty(tAgent)){ + tBranchOffice.setAgentId(tAgent.get(0).getId()); + }else { + return new SuccessTip(500, "该区域代理商被冻结或不存在"); + } + return null; } } diff --git a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeAreaAdd.html b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeAreaAdd.html new file mode 100644 index 0000000..49ff49c --- /dev/null +++ b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeAreaAdd.html @@ -0,0 +1,45 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12" style="height: 100px;"> + + <div class="col-sm-4 control-label"> + <label class="col-sm-1" style="width: 20px;">省:</label> + <select class="input-group col-sm-2 " onclick="TBranchOffice.areaCity()" id="province" style="width: 200px;height: 33px" name="province"> + <option value="">请选择</option> + @for(i in provinceList){ + <option id="${i.id}" value="${i.name}"}>${i.name}</option> + @} + </select> + </div> + <div class="col-sm-4 control-label"> + <label class="col-sm-1" style="width: 20px;">市:</label> + <select class="input-group col-sm-2" onclick="TBranchOffice.areaDistrict()" id="city" style="width: 200px;height: 33px" name="city"> + <option value="">请选择</option> + </select> + </div> + <div class="col-sm-4 control-label"> + <label class="col-sm-1" style="width: 20px;">区:</label> + <select class="input-group col-sm-2" id="district" style="width: 200px;height: 33px" name="district"> + <option value="">请选择</option> + </select> + </div> + </div> + <div class="hidden-xs" id="TAppUserTableToolbar" role="group" style="text-align:center"> + <#button name="取消" icon="fa-plus" clickFun="TBranchOfficeInfoDlg.close()" /> + <#button name="确定" icon="fa-plus" clickFun="TBranchOffice.submitArea()"/> + </div> + + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/tBranchOffice/tBranchOffice.js"></script> +<script src="${ctxPath}/static/modular/system/tBranchOffice/tBranchOffice_info.js"></script> +<script type="text/javascript"> +</script> +@} diff --git a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeAreaUpdate.html b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeAreaUpdate.html new file mode 100644 index 0000000..a51553e --- /dev/null +++ b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeAreaUpdate.html @@ -0,0 +1,57 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12" style="height: 100px;"> + <!--<input hidden id="provinceName" value="${provinceName}"> + <input hidden id="cityName" value="${cityName}"> + <input hidden id="districtName" value="${districtName}"> + <input hidden id="provinceId" value="${provinceId}"> + <input hidden id="cityId" value="${cityId}"> + <input hidden id="districtId" value="${districtId}">--> + + <div class="col-sm-4 control-label"> + <label class="col-sm-1" style="width: 20px;">省:</label> + <select class="input-group col-sm-2 " onclick="TBranchOffice.areaCity()" id="province" style="width: 200px;height: 33px" name="province"> + <option value="">请选择省</option> + @for(i in provinceList){ + <option id="${i.id}" value="${i.name}"${i.name == provinceName ? 'selected=selected' : ''}>${i.name}</option> + @} + </select> + </div> + <div class="col-sm-4 control-label"> + <label class="col-sm-1" style="width: 20px;">市:</label> + <select class="input-group col-sm-2" onclick="TBranchOffice.areaDistrict()" id="city" style="width: 200px;height: 33px" name="city"> + <option>请选择市</option> + @for(city in cityList){ + <option id="${city.id}" value="${city.name}"${city.name == cityName ? 'selected=selected' : ''}>${city.name}</option> + @} + </select> + </div> + <div class="col-sm-4 control-label"> + <label class="col-sm-1" style="width: 20px;">区:</label> + <select class="input-group col-sm-2" id="district" style="width: 200px;height: 33px" name="district"> + <option>请选择区</option> + @for(district in districtList){ + <option id="${district.id}" value="${district.name}"${district.name == districtName ? 'selected=selected' : ''}>${district.name}</option> + @} + </select> + </div> + </div> + <div class="hidden-xs" id="TAppUserTableToolbar" role="group" style="text-align:center"> + <#button name="取消" icon="fa-plus" clickFun="TBranchOfficeInfoDlg.close()" /> + <#button name="确定" icon="fa-plus" clickFun="TBranchOffice.submitArea()"/> + </div> + + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/static/modular/system/tBranchOffice/tBranchOffice.js"></script> +<script src="${ctxPath}/static/modular/system/tBranchOffice/tBranchOffice_info.js"></script> +<script type="text/javascript"> +</script> +@} diff --git a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeDetail.html b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeDetail.html index ddd0c31..9997698 100644 --- a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeDetail.html +++ b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOfficeDetail.html @@ -30,11 +30,11 @@ <div class="initialLevel col-sm-12 control-label form-group" > <div class="initialLevel col-sm-3 control-label form-group" > <label class="control-label" >邮箱:</label> - <label>${principal}</label> + <label>${email}</label> </div> - <div class="initialLevel col-sm-2 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > <label class="control-label">抽成规则:</label> - <label>抽成,每笔订单满</label> + <label>每笔订单满</label> <label>${num2}</label> <label>元/单,抽取</label> <label>${num3}</label> @@ -45,7 +45,7 @@ <div class="initialLevel col-sm-12 control-label form-group" > <div class="initialLevel col-sm-2 control-label form-group" > <label class="control-label">代理区域:</label> - <label>${principal}</label> + <label>${area}</label> </div> </div> @@ -60,39 +60,39 @@ <div class="initialLevel col-sm-12 control-label form-group" > <div class="initialLevel col-sm-3 control-label form-group" > <label class="control-label" >统计时间:</label> - <span>${principal}</span> + <span>${startToEndTime}</span> </div> </div> <div class="initialLevel col-sm-12 control-label form-group" > <div class="initialLevel col-sm-3 control-label form-group" > <label class="control-label" >累计订单量:</label> - <label>${principal}</label>单 + <label>${orderCount}</label>单 </div> <div class="initialLevel col-sm-2 control-label form-group" > - <label class="control-label">累计优惠券金额:</label> - <label>${principal}</label>元 + <label class="control-label">已使用优惠券:</label> + <label>${usedCount}</label> </div> </div> <div class="initialLevel col-sm-12 control-label form-group" > <div class="initialLevel col-sm-3 control-label form-group" > <label class="control-label" >有效订单:</label> - <label>${principal}</label>单 + <label>${effectiveOrderCount}</label>单 </div> <div class="initialLevel col-sm-2 control-label form-group" > <label class="control-label">累计优惠券金额:</label> - <label>${principal}</label>元 + <label>${orderPriceCount}</label>元 </div> </div> <div class="initialLevel col-sm-12 control-label form-group" > <div class="initialLevel col-sm-3 control-label form-group" > <label class="control-label" >已发放优惠券:</label> - <label>${principal}</label>张 + <label>${totalCount}</label>张 </div> <div class="initialLevel col-sm-2 control-label form-group" > <label class="control-label">司机数量:</label> - <label>${principal}</label>人 + <label>${driverCount}</label>人 </div> </div> diff --git a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_add.html b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_add.html index c0a72b0..76755e1 100644 --- a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_add.html +++ b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_add.html @@ -1,5 +1,82 @@ @layout("/common/_container.html"){ -<div class="ibox float-e-margins"> +<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" id="branchOfficeInfoForm"> + <div class="row row-lg"> + <div class="col-sm-12"> + <input hidden id="areaId"> + + <div class="col-sm-12" style="cursor: pointer;text-align: right;"> + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >分公司名称:</label> + <input id="branchOfficeName" name="branchOfficeName" type="text" style="height: 30px" required="required"> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >负责人姓名:</label> + <input id="principal" name="principal" type="text" style="height: 30px" required="required"> + </div> + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >联系电话:</label> + <input id="principalPhone" name="principalPhone" type="number" style="height: 30px" required="required"> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <label class="control-label" >邮箱:</label> + <input id="email" type="email" style="height: 30px"> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >代理区域:</label> + <input id="area" onclick="TBranchOffice.areaAdd()" name="area" placeholder="请选择" style="height: 30px" readonly required> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <label class="control-label" >开户银行:</label> + <input id="bankDeposit" type="text" style="height: 30px"> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <label class="control-label" >银行账户:</label> + <input id="bankAccount" type="text" style="height: 30px"> + </div> + </div> + + </div> + + </div> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10" style="text-align: center"> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TBranchOfficeInfoDlg.close()"/> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TBranchOfficeInfoDlg.addSubmit()"/> + </div> + </div> + </div> + </div> + </div> +</div> +<!--<div class="ibox float-e-margins"> <div class="ibox-content"> <div class="form-horizontal"> @@ -33,6 +110,7 @@ </div> </div> -</div> +</div>--> <script src="${ctxPath}/static/modular/system/tBranchOffice/tBranchOffice_info.js"></script> +<script src="${ctxPath}/static/modular/system/tBranchOffice/tBranchOffice.js"></script> @} diff --git a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_edit.html b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_edit.html index 37e8aa5..8b42aa4 100644 --- a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_edit.html +++ b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tBranchOffice/tBranchOffice_edit.html @@ -1,5 +1,84 @@ @layout("/common/_container.html"){ -<div class="ibox float-e-margins"> +<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" id="branchOfficeInfoForm"> + <div class="row row-lg"> + <div class="col-sm-12"> + <input hidden id="id" value="${item.id}"/> + <input hidden id="areaId" value="${item.areaId}"> + + <div class="col-sm-12" style="cursor: pointer;text-align: right;"> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >分公司名称:</label> + <input id="branchOfficeName" value="${item.branchOfficeName}" name="branchOfficeName" type="text" style="height: 30px" required="required"> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >负责人姓名:</label> + <input id="principal" value="${item.principal}" name="principal" type="text" style="height: 30px" required="required"> + </div> + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >联系电话:</label> + <input id="principalPhone" value="${item.principalPhone}" name="principalPhone" type="number" style="height: 30px" required="required"> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <label class="control-label" >邮箱:</label> + <input id="email" value="${item.email}" type="email" style="height: 30px"> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >代理区域:</label> + <input id="area" value="${item.area}" onclick="TBranchOffice.areaUpdate()" name="area" placeholder="请选择" style="height: 30px" readonly required> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <label class="control-label" >开户银行:</label> + <input id="bankDeposit" value="${item.bankDeposit}" type="text" style="height: 30px"> + </div> + </div> + + <div class="initialLevel col-sm-12 control-label form-group" > + <div class="initialLevel col-sm-3 control-label form-group" > + <label class="control-label" >银行账户:</label> + <input id="bankAccount" value="${item.bankAccount}" type="text" style="height: 30px"> + </div> + </div> + + </div> + + </div> + </div> + + <div class="row btn-group-m-t"> + <div class="col-sm-10" style="text-align: center"> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TBranchOfficeInfoDlg.close()"/> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TBranchOfficeInfoDlg.editSubmit()"/> + </div> + </div> + </div> + </div> + </div> +</div> +<!--<div class="ibox float-e-margins"> <div class="ibox-content"> <div class="form-horizontal"> @@ -33,6 +112,7 @@ </div> </div> -</div> +</div>--> <script src="${ctxPath}/static/modular/system/tBranchOffice/tBranchOffice_info.js"></script> +<script src="${ctxPath}/static/modular/system/tBranchOffice/tBranchOffice.js"></script> @} diff --git a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tYouTui/tYouTui_add.html b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tYouTui/tYouTui_add.html index 38cfa99..77fd724 100644 --- a/management/guns-admin/src/main/webapp/WEB-INF/view/system/tYouTui/tYouTui_add.html +++ b/management/guns-admin/src/main/webapp/WEB-INF/view/system/tYouTui/tYouTui_add.html @@ -1,74 +1,90 @@ @layout("/common/_container.html"){ -<div class="ibox float-e-margins"> - <div class="ibox-content"> - <div class="form-horizontal" id="youTuiInfoForm"> +<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" id="youTuiInfoForm"> + <div class="row row-lg"> + <div class="col-sm-12"> + <input hidden id="areaId" value="areaId"> + <div class="col-sm-12" style="cursor: pointer;text-align: right;"> - <div class="row"> - <div class="initialLevel col-sm-12 control-label form-group"> - <input hidden id="areaId" value="areaId"> - <div class="initialLevel col-sm-12 control-label form-group"> - <div class="initialLevel col-sm-6" > - <span style="color:red">*</span> - <label class="control-label" >优推名称:</label> - <input id="name" name="name" type="text" placeholder="最多20个字" maxlength="20" style="height: 30px" required> - </div> - </div> - <div class="initialLevel col-sm-12"> - <div class="initialLevel col-sm-6" style="width: 55%"> - <span style="color:red">*</span> - <label class="control-label" >优推类型:</label> - <input id="number" name="number" type="number" placeholder="请输入0以上的数字" min="0" style="height: 30px" required> - <select id="type" name="type" style="height: 30px" required> - <option value="">请选择类型</option> - <option value="1">次数</option> - <option value="2">小时</option> - </select> - </div> - </div> + <div class="initialLevel col-sm-12 control-label form-group"> + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >优推名称:</label> + <input id="name" name="name" type="text" placeholder="最多20个字" maxlength="20" style="height: 30px" required> + </div> + </div> - <div class="initialLevel col-sm-12"> - <div class="initialLevel col-sm-6" style="width: 51%" > - <span style="color:red">*</span> - <label class="control-label" >兑换条件:</label> - <input id="integral" name="integral" type="number" max="9999" placeholder="最多4位数" style="height: 30px" required> - <label>积分</label> - </div> - </div> + <div class="initialLevel col-sm-12 control-label form-group"> + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >优推类型:</label> + <input id="number" name="number" type="number" placeholder="请输入0以上的数字" min="0" style="height: 30px" required> + </div> + <div class="initialLevel col-sm-3 control-label form-group" style="text-align: left" > + <select id="type" name="type" style="height: 30px" required> + <option value="">请选择类型</option> + <option value="1">次数</option> + <option value="2">小时</option> + </select> + </div> + </div> - <div class="initialLevel col-sm-12"> - <div class="initialLevel col-sm-6" > - <span style="color:red">*</span> - <label class="control-label" >优推距离:</label> - <input id="distance" name="distance" type="number" placeholder="最多2000米" max="2000" style="height: 30px" required> - <label>米</label> - </div> - </div> + <div class="initialLevel col-sm-12 control-label form-group"> + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >兑换条件:</label> + <input id="integral" name="integral" type="number" max="9999" placeholder="最多4位数" style="height: 30px" required> + </div> + <div class="initialLevel col-sm-3 control-label form-group" style="text-align: left" > + <label>积分</label> + </div> + </div> - <div class="initialLevel col-sm-12"> - <div class="initialLevel col-sm-6"> - <span style="color:red">*</span> - <label class="control-label" >有效期:</label> - <input id="effectiveTime" name="effectiveTime" maxlength="4" placeholder="最多4位数" type="number" style="height: 30px" required> - <label>天</label> - </div> - </div> + <div class="initialLevel col-sm-12 control-label form-group"> + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >优推距离:</label> + <input id="distance" name="distance" type="number" placeholder="最多2000米" max="2000" style="height: 30px" required> + </div> + <div class="initialLevel col-sm-3 control-label form-group" style="text-align: left" > + <label>米</label> + </div> + </div> - <div class="initialLevel col-sm-12 control-label form-group"> - <div class="initialLevel col-sm-6" > - <span style="color:red">*</span> - <label class="control-label" >服务内容:</label> - <textarea id="serviceContent" name="serviceContent" placeholder="请输入" style="height: 80px" required></textarea> - </div> - </div> + <div class="initialLevel col-sm-12 control-label form-group"> + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >有效期:</label> + <input id="effectiveTime" name="effectiveTime" maxlength="4" placeholder="最多4位数" type="number" style="height: 30px" required> + </div> + <div class="initialLevel col-sm-3 control-label form-group" style="text-align: left" > + <label>天</label> + </div> + </div> + <div class="initialLevel col-sm-12 control-label form-group"> + <div class="initialLevel col-sm-3 control-label form-group" > + <span style="color:red">*</span> + <label class="control-label" >服务内容:</label> + <textarea id="serviceContent" name="serviceContent" placeholder="请输入" style="height: 80px" required></textarea> + </div> + </div> + + </div> + + </div> </div> - </div> - - <div class="row btn-group-m-t"> - <div class="col-sm-10" style="text-align: center"> - <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TYouTuiInfoDlg.addSubmit()"/> - <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TYouTuiInfoDlg.close()"/> + <div class="row btn-group-m-t"> + <div class="col-sm-10" style="text-align: center"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TYouTuiInfoDlg.addSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TYouTuiInfoDlg.close()"/> + </div> </div> </div> </div> diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js b/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js index b6d9f0a..df2ae54 100644 --- a/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js +++ b/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js @@ -28,11 +28,11 @@ {title: '代理区域区编号', field: 'districtCode', visible: false, align: 'center', valign: 'middle'}, {title: '代理区域区名称', field: 'districtName', visible: false, align: 'center', valign: 'middle'}, - {title: '订单数量', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'}, - {title: '有效订单', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'}, - {title: '已发放优惠券', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'}, - {title: '已使用优惠券', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'}, - {title: '累计优惠券金额', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'}, + {title: '订单数量', field: 'orderCount', visible: true, align: 'center', valign: 'middle'}, + {title: '有效订单', field: 'effectiveOrderCount', visible: true, align: 'center', valign: 'middle'}, + {title: '已发放优惠券', field: 'totalCount', visible: true, align: 'center', valign: 'middle'}, + {title: '已使用优惠券', field: 'usedCount', visible: true, align: 'center', valign: 'middle'}, + {title: '累计优惠券金额', field: 'orderPriceCount', visible: true, align: 'center', valign: 'middle'}, {title: '经营业务', field: 'operatingBusiness', visible: true, align: 'center', valign: 'middle', formatter: function (value, row) { @@ -84,7 +84,7 @@ var index = layer.open({ type: 2, title: '添加', - area: ['800px', '420px'], //宽高 + area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/tBranchOffice/tBranchOffice_add' @@ -100,7 +100,7 @@ var index = layer.open({ type: 2, title: '详情', - area: ['800px', '420px'], //宽高 + area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/tBranchOffice/tBranchOffice_update/' + TBranchOffice.seItem.id @@ -186,6 +186,177 @@ }; /** + * 打开区域选择页面新增 + */ +TBranchOffice.areaAdd = function () { + var index = layer.open({ + type: 2, + title: '区域选择', + area: ['1000px', '270px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/tBranchOffice/areaPageAdd' + }); + this.layerIndex = index; +} + +/** + * 打开区域选择页面编辑 + */ +TBranchOffice.areaUpdate = function () { + + var area = $("#area").val(); + var areaId = $("#areaId").val(); + + var index = layer.open({ + type: 2, + title: '区域选择', + area: ['1000px', '270px'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/tBranchOffice/areaPageUpdate?area='+area+'&areaId='+areaId + }); + this.layerIndex = index; +} + +/** + * 查询市 + */ +TBranchOffice.areaCity = function () { + + //监听第一个下拉菜单的变动操作 + $("#province").change(function(){ + //当第一级下拉列表没选择值时,将二级下拉列表和三级同时设置为空 + if(this.value==""){ + $("#city").empty();//二级联动设为空设为空 + $("#city").append('<option value="">请选择</option>'); + //region + $("#district").empty();//三级联动设为空设为空 + $("#district").append('<option value="">请选择</option>'); + + } + if(this.value!=""){//第一级下拉菜单选择了值 + $("#city").empty();//先行置空,防止上次选择留下的元素影响效果 + $("#city").append('<option value="">请选择</option>')//设置初始选项 + $("#district").empty();//三级联动设为空设为空 + $("#district").append('<option value="">请选择</option>'); + var province = document.getElementById('province'); + var index= province.selectedIndex ; + var id = province.options[index].id; + var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/areaCity?parentId="+id, function (data) { + for(var i=0,n=data.length;i<n;i++){//遍历 + $("#city").append('<option value="'+data[i].id+'">'+data[i].name+'</option>');//创造元素 + } + }, function (data) { + Feng.error("查询失败!" + data.responseJSON.message + "!"); + }); + ajax.start(); + } + }); + + /*var province = document.getElementById('province'); + var index= province.selectedIndex ; + var id = province.options[index].id; + var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/areaCity?parentId="+id, function (data) { + /!*var opts=document.getElementById('city').options; + opts.length=0;// 这一句是清空原有列表项 + for(var i=0,n=data.length;i<n;i++){ + var data1=data[i]; + var opt=new Option(data1.name,data1.id,true,true); + opts.add(opt); + }*!/ + }, function (data) { + Feng.error("查询失败!" + data.responseJSON.message + "!"); + }); + ajax.start();*/ +} + +/** + * 查询区 + */ +TBranchOffice.areaDistrict = function () { + //监听第二个下拉菜单的变动操作 + $("#city").change(function(){ + if(this.value==""){//第二级菜单为空,则将第三级菜单也置为空 + $("#district").empty(); + $("#district").append('<option value="">请选择</option>'); + } + if(this.value!=""){//第二级菜单不为空,则将第三级菜单动态生成 + $("#district").empty(); + $("#district").append('<option value="">请选择</option>'); + + var city = document.getElementById('city'); + var cityIndex= city.selectedIndex ; + var id = city.options[cityIndex].value; + var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/areaCity?parentId="+id, function (data) { + for(var i=0,n=data.length;i<n;i++){//对区数据进行遍历,动态生成 + $("#district").append('<option value="'+data[i].id+'">'+data[i].name+'</option>'); + } + }, function (data) { + Feng.error("查询失败!" + data.responseJSON.message + "!"); + }); + ajax.start(); + } + }) + + /*var city = document.getElementById('city'); + var cityIndex= city.selectedIndex ; + var id = city.options[cityIndex].value; + var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/areaCity?parentId="+id, function (data) { + var opts=document.getElementById('district').options; + opts.length=0;// 这一句是清空原有列表项 + for(var i=0,n=data.length;i<n;i++){ + var data1=data[i]; + var opt=new Option(data1.name,data1.id,true,true); + opts.add(opt); + } + }, function (data) { + Feng.error("查询失败!" + data.responseJSON.message + "!"); + }); + ajax.start();*/ +} + +/** + * 选择省市 + */ +TBranchOffice.submitArea = function () { + var province = document.getElementById('province'); + var provinceIndex= province.selectedIndex ; + var provinceName = province.options[provinceIndex].value; + var provinceId = province.options[provinceIndex].id; + + if(provinceName == null || provinceName == ''){ + Feng.error("请选择省份!") + return; + } + + var city = document.getElementById('city'); + var cityIndex= city.selectedIndex ; + var cityId = city.options[cityIndex].value; + var cityName = city.options[cityIndex].innerText; + + if(cityName == null || cityName == '' || cityName =='请选择'){ + Feng.error("请选择市区!") + return; + } + + var district = document.getElementById('district'); + var districtIndex= district.selectedIndex ; + var districtId = district.options[districtIndex].value; + var districtName = district.options[districtIndex].innerText; + + if(districtName == '' || districtName == null || districtName == '请选择'){ + parent.$("#area").val(provinceName+'/'+cityName) + parent.$("#areaId").val(provinceId+'/'+cityId) + }else { + parent.$("#area").val(provinceName+'/'+cityName+'/'+districtName) + parent.$("#areaId").val(provinceId+'/'+cityId+'/'+districtId) + } + console.log() + TBranchOfficeInfoDlg.close(); +} + +/** * 查询列表 */ TBranchOffice.search = function () { diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js b/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js index 41f2086..99665da 100644 --- a/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js +++ b/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js @@ -2,7 +2,53 @@ * 初始化详情对话框 */ var TBranchOfficeInfoDlg = { - tBranchOfficeInfoData : {} + tBranchOfficeInfoData : {}, + validateFields: { + branchOfficeName: { + validators: { + notEmpty: { + message: '分公司名称不能为空' + } + } + }, + name: { + validators: { + notEmpty: { + message: '负责人姓名不能为空' + } + } + }, + phone: { + validators: { + notEmpty: { + message: '联系电话不能为空' + } + } + }, + area: { + validators: { + notEmpty: { + message: '请选择服务区域' + } + } + }, + emergencyPhone: { + validators: { + notEmpty: { + message: '代理商抽成不能为空' + } + } + }, + } +}; + +/** + * 验证数据是否为空 + */ +TBranchOfficeInfoDlg.validate = function () { + $('#branchOfficeInfoForm').data("bootstrapValidator").resetForm(); + $('#branchOfficeInfoForm').bootstrapValidator('validate'); + return $("#branchOfficeInfoForm").data('bootstrapValidator').isValid(); }; /** @@ -58,6 +104,10 @@ .set('districtName') .set('branchOfficeName') .set('operatingBusiness') + .set('bankDeposit') + .set('bankAccount') + .set('area') + .set('areaId') .set('status') .set('createTime'); } @@ -70,11 +120,20 @@ this.clearData(); this.collectData(); + if(!this.validate()){ + return ; + } + //提交信息 var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/add", function(data){ - Feng.success("添加成功!"); - window.parent.TBranchOffice.table.refresh(); - TBranchOfficeInfoDlg.close(); + if(data.code == 500){ + Feng.error("添加失败!" + data.message + "!"); + return false; + }else { + Feng.success("添加成功!"); + window.parent.TBranchOffice.table.refresh(); + TBranchOfficeInfoDlg.close(); + } },function(data){ Feng.error("添加失败!" + data.responseJSON.message + "!"); }); @@ -90,11 +149,20 @@ this.clearData(); this.collectData(); + if(!this.validate()){ + return ; + } + //提交信息 var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/update", function(data){ - Feng.success("修改成功!"); - window.parent.TBranchOffice.table.refresh(); - TBranchOfficeInfoDlg.close(); + if(data.code == 500){ + Feng.error("修改失败!" + data.message + "!"); + return false; + }else { + Feng.success("修改成功!"); + window.parent.TBranchOffice.table.refresh(); + TBranchOfficeInfoDlg.close(); + } },function(data){ Feng.error("修改失败!" + data.responseJSON.message + "!"); }); @@ -103,5 +171,5 @@ } $(function() { - + Feng.initValidator("branchOfficeInfoForm", TBranchOfficeInfoDlg.validateFields); }); diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver_info.js b/management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver_info.js index 625223d..6df0474 100644 --- a/management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver_info.js +++ b/management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver_info.js @@ -171,10 +171,11 @@ if(data.code == 500){ Feng.error("添加失败!" + data.message + "!"); return false; + }else { + Feng.success("添加成功!"); + window.parent.TDriver.table.refresh(); + TDriverInfoDlg.close(); } - Feng.success("添加成功!"); - window.parent.TDriver.table.refresh(); - TDriverInfoDlg.close(); },function(data){ Feng.error("添加失败!" + data.responseJSON.message + "!"); }); @@ -217,10 +218,11 @@ if(data.code == 500){ Feng.error("修改失败!" + data.message + "!"); return false; + }else { + Feng.success("修改成功!"); + window.parent.TDriver.table.refresh(); + TDriverInfoDlg.close(); } - Feng.success("修改成功!"); - window.parent.TDriver.table.refresh(); - TDriverInfoDlg.close(); },function(data){ Feng.error("修改失败!" + data.responseJSON.message + "!"); }); -- Gitblit v1.7.1