| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TAppUserResp; |
| | | import com.stylefeng.guns.modular.system.controller.util.ExcelUtil; |
| | | import com.stylefeng.guns.modular.system.enums.CouponStatusEnum; |
| | | import com.stylefeng.guns.modular.system.enums.OrderStateEnum; |
| | | import com.stylefeng.guns.modular.system.exports.TAppUserExceptionExport; |
| | | import com.stylefeng.guns.modular.system.model.TAppUser; |
| | | import com.stylefeng.guns.modular.system.model.TCoupon; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ITAppUserService; |
| | | import com.stylefeng.guns.modular.system.service.ITCouponService; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserToCouponService; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | |
| | | private ITAppUserService tAppUserService; |
| | | @Autowired |
| | | private ITCouponService tCouponService; |
| | | @Autowired |
| | | private ITOrderService tOrderService; |
| | | @Autowired |
| | | private ITUserToCouponService tUserToCouponService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | |
| | | @RequestMapping("/userDetail") |
| | | public String userDetail(Integer tAppUserId, Model model) { |
| | | tAppUserService.detail(tAppUserId,model); |
| | | |
| | | return PREFIX + "tAppUserDetail.html"; |
| | | } |
| | | |
| | |
| | | EntityWrapper<TAppUser> wrapper = tAppUserService.getUserListWrapper(createTime,nickname,phone,id,status); |
| | | // 是否异常 |
| | | wrapper.eq("is_exception",2); |
| | | return tAppUserService.selectList(wrapper); |
| | | wrapper.orderBy("createTime",false); |
| | | List<TAppUser> tAppUsers = tAppUserService.selectList(wrapper); |
| | | |
| | | return tAppUserService.getTAppUserResp(tAppUsers); |
| | | } |
| | | |
| | | |
| | |
| | | Integer status) { |
| | | EntityWrapper<TAppUser> wrapper = tAppUserService.getUserListWrapper(createTime,nickname,phone,id,status); |
| | | wrapper.ne("is_exception",2); |
| | | wrapper.orderBy("createTime",false); |
| | | return tAppUserService.selectList(wrapper); |
| | | } |
| | | |
| | |
| | | TAppUser tAppUser = tAppUserService.selectById(id); |
| | | if(1 == status){ |
| | | tAppUser.setStatus(2); |
| | | String value = redisUtil.getValue("USER_" + tAppUser.getPhone()); |
| | | redisUtil.remove(value); |
| | | redisUtil.remove("USER_" + tAppUser.getPhone()); |
| | | } |
| | | if(2 == status){ |
| | | tAppUser.setStatus(1); |
| | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | TAppUser d = list.get(i); |
| | | values[i] = new String[title.length]; |
| | | values[i][0] = d.getId().toString(); |
| | | values[i][0] = String.valueOf(d.getId()); |
| | | values[i][1] = d.getNickname(); |
| | | values[i][2] = d.getPhone(); |
| | | Integer sex = d.getSex(); |
| | | if(1 == sex){ |
| | | values[i][3] = "男"; |
| | | }else if(2 == sex){ |
| | | values[i][3] = "女"; |
| | | if(Objects.nonNull(sex)){ |
| | | if(1 == sex){ |
| | | values[i][3] = "男"; |
| | | }else if(2 == sex){ |
| | | values[i][3] = "女"; |
| | | } |
| | | }else { |
| | | values[i][3] = "未知"; |
| | | } |
| | |
| | | values[i][6] = d.getUnionid(); |
| | | values[i][7] = d.getEmergencyContact(); |
| | | values[i][8] = d.getEmergencyPhone(); |
| | | values[i][9] = d.getAccountBalance().toString(); |
| | | values[i][10] = d.getUserTagId().toString(); |
| | | values[i][9] = String.valueOf(d.getAccountBalance()); |
| | | values[i][10] = String.valueOf(Objects.nonNull(d.getUserTagId())?d.getUserTagId():""); |
| | | Integer status1 = d.getStatus(); |
| | | if(1 == status1){ |
| | | values[i][11] = "正常"; |
| | |
| | | wrapper.eq("is_exception",2); |
| | | List<TAppUser> list = tAppUserService.selectList(wrapper); |
| | | |
| | | List<TAppUserExceptionExport> exportList = new ArrayList<>(list.size()); |
| | | /*List<TAppUserExceptionExport> exportList = new ArrayList<>(list.size()); |
| | | for (TAppUser tAppUser : list) { |
| | | TAppUserExceptionExport export = new TAppUserExceptionExport(); |
| | | BeanUtils.copyProperties(tAppUser,export); |
| | |
| | | tCoupons = tCoupons.stream().filter(coupon->coupon.getCouponStatus().equals(CouponStatusEnum.NOT_USED.getCode())).collect(Collectors.toList()); |
| | | // 剩余优惠券 |
| | | export.setRemainingCoupons(tCoupons.size()); |
| | | // TODO 查询消费记录 |
| | | // 查询消费记录 |
| | | exportList.add(export); |
| | | }*/ |
| | | List<TAppUserResp> tAppUserRespList = tAppUserService.getTAppUserResp(list); |
| | | List<TAppUserExceptionExport> exportList = new ArrayList<>(list.size()); |
| | | for (TAppUserResp tAppUserResp : tAppUserRespList) { |
| | | TAppUserExceptionExport export = new TAppUserExceptionExport(); |
| | | BeanUtils.copyProperties(tAppUserResp,export); |
| | | // 优惠券总数 |
| | | export.setCouponsSum(tAppUserResp.getCouponSum()); |
| | | // 剩余优惠券 |
| | | export.setRemainingCoupons(tAppUserResp.getNotUsedCount()); |
| | | export.setConsumptionTimes(tAppUserResp.getConsumeSum()); |
| | | export.setHistoricalConsumption(tAppUserResp.getConsumePrice()); |
| | | export.setLastConsumptionTime(tAppUserResp.getLastConsumptionTime()); |
| | | exportList.add(export); |
| | | } |
| | | String[][] values = new String[list.size()][]; |
| | |
| | | values[i][1] = d.getId().toString(); |
| | | values[i][2] = d.getNickname(); |
| | | values[i][3] = d.getPhone(); |
| | | values[i][4] = d.getRemainingCoupons().toString(); |
| | | values[i][5] = d.getCouponsSum().toString(); |
| | | values[i][6] = d.getConsumptionTimes().toString(); |
| | | values[i][7] = d.getHistoricalConsumption().toString(); |
| | | values[i][4] = String.valueOf(d.getRemainingCoupons()); |
| | | values[i][5] = String.valueOf(d.getCouponsSum()); |
| | | values[i][6] = String.valueOf(Objects.nonNull(d.getConsumptionTimes())?d.getConsumptionTimes():0); |
| | | values[i][7] = String.valueOf(Objects.nonNull(d.getHistoricalConsumption())?d.getHistoricalConsumption():0); |
| | | if(Objects.nonNull(d.getLastConsumptionTime())){ |
| | | values[i][8] = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(d.getLastConsumptionTime()); |
| | | }else { |