| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.biz.zbom.model.IamUserRoleModel; |
| | | import com.doumee.biz.zbom.model.IamUserTypeModel; |
| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.GeneratePicUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.core.utils.tyyun.TyyZosUtil; |
| | | import com.doumee.dao.admin.request.ShopImport; |
| | | import com.doumee.dao.admin.request.UserImport; |
| | | import com.doumee.dao.business.ShopMapper; |
| | |
| | | import com.doumee.dao.business.UsersMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.dao.web.reqeust.ContentShareImgDto; |
| | | import com.doumee.dao.web.response.AccountResponse; |
| | | import com.doumee.service.business.UsersService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.io.InputStream; |
| | | import java.util.*; |
| | | import java.util.concurrent.Callable; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | |
| | | |
| | | @Override |
| | | public Users findById(Long id) { |
| | | return usersMapper.selectById(id); |
| | | MPJLambdaWrapper<Users> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.leftJoin(Shop.class,Shop::getId,Users::getDepartmentId) |
| | | .selectAs(Shop::getName,Users::getShopName) |
| | | .selectAs(Shop::getAddress,Users::getShopAddress) |
| | | .selectAs(Shop::getType,Users::getShopType) |
| | | .selectAs(Shop::getSecondType,Users::getShopSecType) |
| | | .selectAll(Users.class) |
| | | .eq(Users::getId,id); |
| | | return usersMapper.selectJoinOne(Users.class,queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String getContentShareImg(Users loginUserInfo, ContentShareImgDto param){ |
| | | if(StringUtils.isBlank(param.getImgurl())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | String url = null; |
| | | if(param.getType() == 1){ |
| | | //多图带二维码下载 |
| | | String path = systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.RESOURCE_PATH).getCode(); |
| | | String folder = systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.USERS_FILE).getCode(); |
| | | }else{ |
| | | //内容分享海报图片 |
| | | |
| | | |
| | | } |
| | | return url; |
| | | } |
| | | @Override |
| | | public String getUserCard(Users users){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.RESOURCE_PATH).getCode(); |
| | | String folder = systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.USERS_FILE).getCode(); |
| | | if(StringUtils.isNotBlank(users.getCardImg()) && !StringUtils.equals(users.getCardImg(),"-")){ |
| | | return path + folder+users.getCardImg(); |
| | | } |
| | | String defualtHeader = systemDictDataBiz.queryByCode(Constants.WEIXIN_DEFAULT_IMGS, Constants.USER_CARD_HEADER_IMG).getCode(); |
| | | String defualtPhone = systemDictDataBiz.queryByCode(Constants.WEIXIN_DEFAULT_IMGS, Constants.USER_CARD_PHONE_IMG).getCode(); |
| | | String defualtAddr = systemDictDataBiz.queryByCode(Constants.WEIXIN_DEFAULT_IMGS, Constants.USER_CARD_ADDR_IMG).getCode(); |
| | | String defualtShop = systemDictDataBiz.queryByCode(Constants.WEIXIN_DEFAULT_IMGS, Constants.USER_CARD_SHOP_IMG).getCode(); |
| | | String defualtLogo = systemDictDataBiz.queryByCode(Constants.WEIXIN_DEFAULT_IMGS, Constants.USER_CARD_LOGO_IMG).getCode(); |
| | | String imgurl =StringUtils.isNotBlank(users.getImgurl())?path+folder+users.getImgurl():defualtHeader; |
| | | String qrcode =StringUtils.isNotBlank(users.getQrcodeImg())?path+folder+users.getQrcodeImg():null; |
| | | InputStream inputStream = GeneratePicUtil.generateUserCardImg( |
| | | imgurl |
| | | ,qrcode |
| | | ,StringUtils.defaultString(users.getName(),"-") |
| | | ,"导购" |
| | | ,StringUtils.defaultString(users.getPhone(),"-") |
| | | ,StringUtils.defaultString(users.getShopAddress(),"-") |
| | | , StringUtils.defaultString(users.getShopName(),"-") |
| | | ,defualtPhone |
| | | ,defualtAddr |
| | | ,defualtShop |
| | | ,defualtLogo); |
| | | TyyZosUtil obs = new TyyZosUtil( systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.ENDPOINT).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.ACCESS_ID).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.ACCESS_KEY).getCode()); |
| | | String key = DateUtil.getNowShortDate()+"/"+UUID.randomUUID().toString() + ".jpg"; |
| | | String fileName =folder+ key; |
| | | if (obs.uploadInputstreamObject(inputStream,systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.BUCKETNAME).getCode(), fileName)) { |
| | | Users update = new Users(); |
| | | update.setId(users.getId()); |
| | | update.setCardImg(key); |
| | | usersMapper.updateById(update); |
| | | return path+fileName; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Users usersDetail(Long userId){ |