| | |
| | | package com.matrix.system.fenxiao.action; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.biz.dao.BizUserDao; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao; |
| | | import com.matrix.system.fenxiao.dto.AddSaleManApplyDto; |
| | | import com.matrix.system.fenxiao.dto.ExamineSaleManApplyDto; |
| | | import com.matrix.system.fenxiao.dto.ShopSalesmanAppliingDto; |
| | | import com.matrix.system.fenxiao.dto.ShopSalesmanApplyDto; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanApply; |
| | | import com.matrix.system.fenxiao.service.ShopSalesmanApplyService; |
| | | import com.matrix.system.fenxiao.vo.ShopSalesmanAppliingVo; |
| | | import com.matrix.system.fenxiao.vo.ShopSalesmanApplyVo; |
| | |
| | | |
| | | @Autowired |
| | | private ShopSalesmanApplyService shopSalesmanApplyService; |
| | | @Autowired |
| | | private ShopSalesmanApplyDao shopSalesmanApplyDao; |
| | | @Autowired |
| | | private BizUserDao bizUserDao; |
| | | |
| | | /** |
| | | * 查询分销员审核记录 |
| | |
| | | shopSalesmanApplyDto.setSort("create_time"); |
| | | shopSalesmanApplyDto.setOrder("desc"); |
| | | } |
| | | |
| | | Page<ShopSalesmanApplyVo> page = new Page(shopSalesmanApplyDto.getPageNum(), shopSalesmanApplyDto.getPageSize()); |
| | | IPage<ShopSalesmanApplyVo> rows = shopSalesmanApplyService.findShopSalesmanApplyList(page,shopSalesmanApplyDto); |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal()); |
| | |
| | | result.putInMap("salesGrade", dataList); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 改变发布状态:已发布 |
| | | * @param userId |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/addSaleManApply") |
| | | public @ResponseBody AjaxResult addSaleManApply(String userId,long gradeId) { |
| | | AjaxResult result= AjaxResult.buildSuccessInstance("设置成功"); |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | shopSalesmanApplyService.addSaleManApply(userId,gradeId); |
| | | *新增分销员 |
| | | */ |
| | | @ApiOperation(value = "新增分销员") |
| | | @PostMapping(value = "/addSaleManApply") |
| | | public @ResponseBody |
| | | AjaxResult findShopSalesmanAppliingList(@RequestBody AddSaleManApplyDto addSaleManApplyDto) { |
| | | //设置用户公司ID |
| | | QueryUtil.setQueryLimitCom(addSaleManApplyDto); |
| | | AjaxResult result= AjaxResult.buildSuccessInstance("设置成功"); |
| | | |
| | | shopSalesmanApplyService.addSaleManApply(addSaleManApplyDto.getUserId(),addSaleManApplyDto.getGradeId()); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println("===="+Long.parseLong("")); |
| | | } |
| | | } |
| | | /** |
| | | *审核分销员 |
| | | */ |
| | | @ApiOperation(value = "审核分销员") |
| | | @PostMapping(value = "/examineSaleManApply") |
| | | public @ResponseBody |
| | | AjaxResult examineSaleManApply(@RequestBody ExamineSaleManApplyDto examineSaleManApplyDto) { |
| | | //设置用户公司ID |
| | | QueryUtil.setQueryLimitCom(examineSaleManApplyDto); |
| | | String userId = examineSaleManApplyDto.getUserId(); |
| | | //待审核状态才允许提交 |
| | | QueryWrapper<ShopSalesmanApply> queryWrapperOrepool = new QueryWrapper<>(); |
| | | queryWrapperOrepool.eq("user_id", userId); |
| | | queryWrapperOrepool.eq("company_id", examineSaleManApplyDto.getCompanyId()); |
| | | ShopSalesmanApply shopSalesmanApply = shopSalesmanApplyDao.selectOne(queryWrapperOrepool); |
| | | if(ObjectUtil.isEmpty(shopSalesmanApply)) { |
| | | return AjaxResult.buildFailInstance("当前记录有误"); |
| | | } |
| | | |
| | | BizUser bizUser = bizUserDao.findByOpenId(userId); |
| | | if(ObjectUtil.isEmpty(bizUser)) { |
| | | return AjaxResult.buildFailInstance("当前记录有误"); |
| | | } |
| | | |
| | | Integer applyStatus = shopSalesmanApply.getApplyStatus(); |
| | | if(ObjectUtil.isNotEmpty(applyStatus) && ShopSalesmanApply.APPLY_STATUS_DSH == applyStatus) { |
| | | Integer applyState = examineSaleManApplyDto.getApplyState(); |
| | | shopSalesmanApplyService.examineSaleManApply(shopSalesmanApply,applyState); |
| | | return AjaxResult.buildSuccessInstance("审核成功"); |
| | | }else{ |
| | | return AjaxResult.buildFailInstance("当前记录不是待审核状态"); |
| | | } |
| | | } |
| | | |
| | | } |