| | |
| | | import com.matrix.system.fenxiao.vo.ShopSalesmanGradeVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Autowired |
| | | ShopSalesmanApplyDao salesmanApplyDao; |
| | | ShopSalesmanApplyDao shopSalesmanApplyDao; |
| | | |
| | | @Autowired |
| | | ShopSalesmanGradeDao shopSalesmanGradeDao; |
| | |
| | | * @param invitationId |
| | | * @return |
| | | */ |
| | | public ShopSalesmanApply applyToBeAnSalesman(String openId,String gradeId,String invitationId) { |
| | | public ShopSalesmanApply applyToBeAnSalesman(String openId,String gradeId,String invitationId,int applyWay) { |
| | | |
| | | BizUser loginUser=bizUserDao.findByOpenId(openId); |
| | | //校验审核状态,和是否重复发起 |
| | | QueryWrapper<ShopSalesmanApply> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("user_id",loginUser.getOpenId()); |
| | | ShopSalesmanApply checkApply = salesmanApplyDao.selectOne(queryWrapper); |
| | | ShopSalesmanApply checkApply = shopSalesmanApplyDao.selectOne(queryWrapper); |
| | | if(checkApply==null|| |
| | | checkApply.getApplyStatus()==ShopSalesmanApply.APPLY_STATUS_WTG){ |
| | | |
| | |
| | | ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectOne(queryWrapperOrepool); |
| | | shopSalesmanApply.setGradeId(shopSalesmanGrade.getId()); |
| | | } |
| | | |
| | | shopSalesmanApply.setApplyWay(applyWay); |
| | | |
| | | BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_AUDIT_METHOD, loginUser.getCompanyId()); |
| | | if(busParameterSettings!=null |
| | | &&busParameterSettings.getParamValue().equals("1")){ |
| | |
| | | }else{ |
| | | shopSalesmanApply.setApplyStatus(ShopSalesmanApply.APPLY_STATUS_DSH); |
| | | } |
| | | salesmanApplyDao.insert(shopSalesmanApply); |
| | | shopSalesmanApplyDao.insert(shopSalesmanApply); |
| | | return shopSalesmanApply; |
| | | }else{ |
| | | throw new GlobleException("不能重复申请"); |
| | |
| | | } |
| | | |
| | | public IPage<ShopSalesmanApplyVo> findShopSalesmanApplyList(Page<ShopSalesmanApplyVo> page, ShopSalesmanApplyDto shopSalesmanApplyDto) { |
| | | return salesmanApplyDao.findShopSalesmanApplyList(page,shopSalesmanApplyDto); |
| | | return shopSalesmanApplyDao.findShopSalesmanApplyList(page,shopSalesmanApplyDto); |
| | | } |
| | | |
| | | public IPage<ShopSalesmanAppliingVo> findShopSalesmanAppliingList(Page<ShopSalesmanAppliingVo> page, |
| | | ShopSalesmanAppliingDto shopSalesmanAppliingDto) { |
| | | return salesmanApplyDao.findShopSalesmanAppliingList(page,shopSalesmanAppliingDto); |
| | | return shopSalesmanApplyDao.findShopSalesmanAppliingList(page,shopSalesmanAppliingDto); |
| | | } |
| | | |
| | | public IPage<ShopSalesmanAppliingVo> selectBizUserApplyList(Page<ShopSalesmanAppliingVo> page, ShopSalesmanAppliingDto shopSalesmanAppliingDto) { |
| | | return salesmanApplyDao.selectBizUserApplyList(page,shopSalesmanAppliingDto); |
| | | return shopSalesmanApplyDao.selectBizUserApplyList(page,shopSalesmanAppliingDto); |
| | | } |
| | | |
| | | public List<ShopSalesmanGradeVo> getShopSalesmanGradeVo(Long companyId) { |
| | | return shopSalesmanGradeDao.getShopSalesmanGradeVo(companyId); |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addSaleManApply(String userId,String gradeId) { |
| | | BizUser user = bizUserDao.selectById(userId); |
| | | |
| | | applyToBeAnSalesman(user.getOpenId(),gradeId, ""); |
| | | applyToBeAnSalesman(user.getOpenId(),gradeId, "",ShopSalesmanApply.APPLY_WAY_HAND_ADD); |
| | | } |
| | | |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void examineSaleManApply(ShopSalesmanApply shopSalesmanApply, Integer applyState) { |
| | | String userId = shopSalesmanApply.getUserId(); |
| | | String parentUserId = shopSalesmanApply.getParentUserId(); |
| | | BizUser bizUser = bizUserDao.selectById(userId); |
| | | |
| | | //修改审核记录 |
| | | if(ShopSalesmanApply.APPLY_STATUS_TG == applyState) { |
| | | shopSalesmanApply.setApplyStatus(ShopSalesmanApply.APPLY_STATUS_TG); |
| | | bizUser.setIsSales(BizUser.IS_SALES); |
| | | }else { |
| | | shopSalesmanApply.setApplyStatus(ShopSalesmanApply.APPLY_STATUS_WTG); |
| | | bizUser.setIsSales(BizUser.NOT_SALES); |
| | | } |
| | | shopSalesmanApplyDao.updateById(shopSalesmanApply); |
| | | //修改USER的状态 |
| | | bizUser.setParentOpenId(parentUserId); |
| | | bizUser.setBindingParentTime(new Date()); |
| | | bizUserDao.updateByModel(bizUser); |
| | | } |
| | | |
| | | |
| | | |
| | | |