| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | |
| | | import com.stylefeng.guns.modular.system.controller.util.HttpUtils; |
| | | import com.stylefeng.guns.modular.system.controller.util.TokenUtils; |
| | | import com.stylefeng.guns.modular.system.controller.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.dao.AccountChangeDetailMapper; |
| | | import com.stylefeng.guns.modular.system.enums.UserTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TDriverWork; |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import com.stylefeng.guns.modular.system.model.TRegion; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private ITRechargeRecordService tRechargeRecordService; |
| | | |
| | | @Autowired |
| | | private ITSystemConfigService systemConfigService; |
| | | |
| | | @Resource |
| | | private AccountChangeDetailMapper accountChangeDetailMapper; |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | |
| | | @RequestMapping(value = "/commission/list") |
| | | @ResponseBody |
| | | public Object commissionList(String name,String phone,Integer status) { |
| | | EntityWrapper<TDriver> wrapper = tDriverService.getCommissionPageList(name,phone,status); |
| | | Wrapper<TDriver> wrapper = tDriverService.getCommissionPageList(name,phone,status); |
| | | List<TDriver> tDrivers = tDriverService.selectList(wrapper); |
| | | List<TDriverCommissionResp> commissionResp = tDriverService.getTDriverCommissionResp(tDrivers); |
| | | for (TDriverCommissionResp tDriverCommissionResp : commissionResp) { |
| | |
| | | tDriver.setApprovalUserId(shiroUser.getId()); |
| | | tDriver.setApprovalTime(new Date()); |
| | | tDriverService.updateById(tDriver); |
| | | |
| | | //增加积分奖励 |
| | | if(approvalStatus == 2 && null != tDriver.getInviterId()){ |
| | | TSystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 4)); |
| | | Integer num7 = JSON.parseObject(systemConfig.getContent()).getInteger("num7"); |
| | | TDriver tDriver1 = tDriverService.selectById(tDriver.getInviterId()); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(tDriver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(10); |
| | | accountChangeDetail.setOldData(tDriver1.getIntegral().doubleValue()); |
| | | tDriver1.setIntegral(tDriver1.getIntegral() + num7); |
| | | accountChangeDetail.setNewData(tDriver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("推荐奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetailMapper.insert(accountChangeDetail); |
| | | tDriverService.updateById(tDriver1); |
| | | } |
| | | |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | public Object rechargeBalance(Integer id, String money) { |
| | | TDriver tDriver = tDriverService.selectById(id); |
| | | tDriver.setBackgroundBalance(new BigDecimal(money).add(tDriver.getBackgroundBalance())); |
| | | tDriverService.updateById(tDriver); |
| | | |
| | | // 添加充值记录 |
| | | TRechargeRecord tRechargeRecord = new TRechargeRecord(); |
| | |
| | | Integer id1 = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | tRechargeRecord.setAgentId(id1); |
| | | tRechargeRecordService.insert(tRechargeRecord); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserId(id); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setChangeType(10); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setExplain("平台充值"); |
| | | accountChangeDetail.setOldData(tDriver.getBalance().add(tDriver.getBackgroundBalance()).add(tDriver.getCouponBalance()).add(tDriver.getCommission()).doubleValue()); |
| | | tDriver.setBackgroundBalance(new BigDecimal(money).add(tDriver.getBackgroundBalance())); |
| | | tDriverService.updateById(tDriver); |
| | | accountChangeDetail.setNewData(tDriver.getBalance().add(tDriver.getBackgroundBalance()).add(tDriver.getCouponBalance()).add(tDriver.getCommission()).doubleValue()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetailMapper.insert(accountChangeDetail); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | String fileName = "CommissionInfo"+time1+".xls"; |
| | | String[] title = new String[] {"姓名","手机号","所属代理商","推广人数","关联人数", |
| | | "累计获得佣金","可提现佣金","已提现金额","状态"}; |
| | | EntityWrapper<TDriver> wrapper = tDriverService.getCommissionPageList(name,phone,status); |
| | | Wrapper<TDriver> wrapper = tDriverService.getCommissionPageList(name,phone,status); |
| | | // wrapper.ne("isException",2); |
| | | // 是否异常 |
| | | List<TDriver> list = tDriverService.selectList(wrapper); |