| | |
| | | } |
| | | |
| | | // 修改状态 |
| | | export function updateDisableById (data) { |
| | | return request.post('/business/baseGoods/updateDisableById', data) |
| | | export function updateStatusById (data) { |
| | | return request.post('/business/baseGoods/updateStatusById', data) |
| | | } |
| | | export function updateStatusById (data) { |
| | | return request.post('/business/baseGoods/updateStatusById', data) |
| | | } |
| | | |
| | | // 列表 - 商品选择 |
| | |
| | | export function category (data) { |
| | | return request.post('/business/category/list', data) |
| | | } |
| | | // 类别列表查询 |
| | | export function baseCategory (data) { |
| | | return request.post('/business/baseCategory/findList', data) |
| | | } |
| | | |
| | | // 导入模板 |
| | | export function importExcel (data) { |
| | |
| | | <el-table-column prop="username" label="登录账号" min-width="100px" align="center"></el-table-column> |
| | | <el-table-column prop="realname" label="姓名" min-width="100px" align="center"></el-table-column> |
| | | <el-table-column prop="mobile" label="手机号" min-width="100px" align="center"></el-table-column> |
| | | <el-table-column prop="roleName" label="角色" min-width="100px" align="center"></el-table-column> |
| | | <el-table-column prop="roleName" label="角色" min-width="100px" align="center"> |
| | | <template slot-scope="{row}"> |
| | | <ul> |
| | | <li v-for="role in row.roles" :key="role.id">{{role.name}}</li> |
| | | </ul> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="status" label="状态" min-width="100px" align="center"> |
| | | <template slot-scope="{row}"> |
| | | <!-- 0启用 1禁用 --> |
| | |
| | | import Pagination from '@/components/common/Pagination' |
| | | import OperaGoodsWindow from '@/components/business/OperaGoodsWindow' |
| | | import selectProduct from '@/components/business/selectProduct' |
| | | import { brand, category, importExcel } from '@/api/system/common.js' |
| | | import { updateDisableById, queryById, exportDoc, batchUpdateDisableById } from '@/api/business/goods.js' |
| | | import { brand, baseCategory, importExcel } from '@/api/system/common.js' |
| | | import { updateStatusById, queryById, exportDoc, batchUpdateDisableById } from '@/api/business/goods.js' |
| | | export default { |
| | | name: 'Goods', |
| | | extends: BaseTable, |
| | |
| | | return nums; |
| | | }, |
| | | getbrand() { |
| | | brand({}) |
| | | brand({type:1}) |
| | | .then(res => { |
| | | this.brandList = res |
| | | }) |
| | | }, |
| | | getcategory() { |
| | | category({}) |
| | | baseCategory({}) |
| | | .then(res => { |
| | | this.categoryList = res |
| | | }) |
| | |
| | | <el-table-column prop="birthday" label="生日" sortable="custom" sort-by="BIRTHDAY" min-width="100px"></el-table-column> |
| | | <el-table-column prop="roles" label="角色" min-width="160px" class-name="table-column-strings"> |
| | | <template slot-scope="{row}"> |
| | | <ul> |
| | | <li v-for="role in row.roles" :key="role.id">{{role.name}}</li> |
| | | </ul> |
| | | </template> |
| | | <ul> |
| | | <li v-for="role in row.roles" :key="role.id">{{role.name}}</li> |
| | | </ul> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createUser" label="创建人" min-width="100px"> |
| | | <template slot-scope="{row}">{{row.createUserInfo == null ? '' : row.createUserInfo.username}}</template> |
| | |
| | | /** |
| | | * 主键上下架 |
| | | * |
| | | * @param idList 实体对象 |
| | | */ |
| | | @ApiOperation("根据ID查询") |
| | | @PostMapping("/{status}") |
| | | @PostMapping("/updateStatus") |
| | | @RequiresPermissions("business:basegoods:query") |
| | | public ApiResponse updateStatusByIds(@RequestBody List<Integer> idList, @PathVariable Integer status){ |
| | | baseGoodsService.updateStatusByIds(idList,status); |
| | | public ApiResponse updateStatusByIds(@RequestBody BaseGoods param ){ |
| | | baseGoodsService.updateStatusByIds(param); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 主键上下架 |
| | | * |
| | | * @param id 实体对象 |
| | | */ |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/updateStatusById") |
| | | @RequiresPermissions("business:basegoods:query") |
| | | public ApiResponse updateStatusById(@RequestParam Integer id,@RequestParam Integer status){ |
| | | baseGoodsService.updateStatusById(id,status); |
| | | return ApiResponse.success(null); |
| | | } |
| | | // /** |
| | | // * 主键上下架 |
| | | // * |
| | | // * @param id 实体对象 |
| | | // */ |
| | | // @ApiOperation("上架 、下架") |
| | | // @GetMapping("/updateStatusById") |
| | | // @RequiresPermissions("business:basegoods:update") |
| | | // public ApiResponse updateStatusById(@RequestParam Integer id,@RequestParam Integer status){ |
| | | // baseGoodsService.updateStatusById(id,status); |
| | | // return ApiResponse.success(null); |
| | | // } |
| | | |
| | | /** |
| | | * 主键查询 |
| | |
| | | * @throws FileNotFoundException |
| | | */ |
| | | |
| | | public void uploadFile(String bucketName, String key, File file, String mime) |
| | | public boolean uploadFile(String bucketName, String key, File file, String mime) |
| | | throws OSSException, ClientException, FileNotFoundException { |
| | | // 判断是否存在,不存在创建 |
| | | isExistBucket(bucketName); |
| | |
| | | |
| | | InputStream input = new FileInputStream(file); |
| | | client.putObject(bucketName, key, input, objectMeta); |
| | | return true; |
| | | |
| | | } |
| | | |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 素材库-商品信息表 |
| | |
| | | @ApiModelProperty(value = "全路径地址") |
| | | @TableField(exist = false) |
| | | private String fullImgUrl; |
| | | @ApiModelProperty(value = "编码集合") |
| | | @TableField(exist = false) |
| | | private List<Integer> idList; |
| | | |
| | | |
| | | } |
| | |
| | | package com.doumee.dao.business.model.dto; |
| | | |
| | | |
| | | import com.doumee.dao.system.model.SystemRole; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author T14 |
| | |
| | | @ApiModelProperty(value = "类型 0平台用户 1企业用户") |
| | | private Integer roleType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "角色") |
| | | private List<SystemRole> roles; |
| | | |
| | | } |
| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.BaseData; |
| | | import com.doumee.dao.business.model.dto.OssModel; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | String create(BaseData baseData); |
| | | |
| | | String getOssImgurl(OssModel ossModel, String folder, String img); |
| | | String getOssImgurl(OssModel ossModel, String folder, File f); |
| | | OssModel initOssModel(); |
| | | |
| | | /** |
| | | * 主键删除 |
| | | * |
| | |
| | | * |
| | | * @param idList 实体对象 |
| | | */ |
| | | void updateStatusByIds(List<Integer> idList,Integer status); |
| | | void updateStatusByIds(BaseGoods param); |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public List<BaseCategory> findList(BaseCategory baseCategory) { |
| | | baseCategory.setIsdeleted(Constants.ZERO); |
| | | QueryWrapper<BaseCategory> wrapper = new QueryWrapper<>(baseCategory); |
| | | List<BaseCategory> list = baseCategoryMapper.selectList(wrapper); |
| | | list.forEach(i->{ |
| | | i.setImgfullurl( |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode() + |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.CATEGORY_IMG).getCode() + i.getImgurl() |
| | | ); |
| | | if(StringUtils.isNotBlank(i.getImgurl())){ |
| | | i.setImgfullurl( |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode() + |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.CATEGORY_IMG).getCode() + i.getImgurl() |
| | | ); |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.io.File; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.Method; |
| | | import java.math.BigDecimal; |
| | |
| | | return 0; |
| | | } |
| | | |
| | | private OssModel initOssModel() { |
| | | @Override |
| | | public OssModel initOssModel() { |
| | | OssModel model = new OssModel(); |
| | | model.setUrl(systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode()); |
| | | model.setEndpoint(systemDictDataBiz.queryByCode(Constants.OSS, Constants.ENDPOINT).getCode()); |
| | |
| | | return model; |
| | | } |
| | | |
| | | private String getOssImgurl(OssModel ossModel, String folder,String img) { |
| | | @Override |
| | | public String getOssImgurl(OssModel ossModel, String folder,String img) { |
| | | if(StringUtils.isBlank(img)){ |
| | | return null; |
| | | } |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public String getOssImgurl(OssModel ossModel, String folder, File f) { |
| | | if(f == null || !f.isFile()){ |
| | | return null; |
| | | } |
| | | try { |
| | | String img = f.getPath(); |
| | | String nowDate = DateUtil.getNowShortDate();// 当前时间(年月日) |
| | | String nfix = img.lastIndexOf(".")>0?img.substring(img.lastIndexOf(".")):null; |
| | | nfix = StringUtils.defaultString(nfix,".jpg"); |
| | | String fileName = UUID.randomUUID() + nfix; |
| | | String tempFileName = nowDate + "/" + fileName; |
| | | String key =folder+ tempFileName;// 文件名 |
| | | |
| | | ALiYunUtil obs = new ALiYunUtil(ossModel.getEndpoint(), ossModel.getAccessId(), ossModel.getAccessKey()); |
| | | if (obs.uploadFile(ossModel.getBucket(), key,f,null)) { |
| | | return tempFileName; |
| | | } |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | @Override |
| | | public void updateStatusByIds(List<Integer> idList, Integer status) { |
| | | if (CollectionUtils.isEmpty(idList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"商品状态不能为空"); |
| | | public void updateStatusByIds(BaseGoods param) { |
| | | if (CollectionUtils.isEmpty(param.getIdList()) |
| | | || param.getStatus() == null |
| | | || !(Constants.equalsInteger(param.getStatus(), Constants.ONE)||Constants.equalsInteger(param.getStatus() ,Constants.ZERO))){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | idList.forEach(s->updateStatusById(s,status)); |
| | | |
| | | param.getIdList().forEach(s->updateStatusById(s,param.getStatus())); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | @Override |
| | | public void updateStatusById(Integer id, Integer status) { |
| | | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if (Objects.isNull(status)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"商品状态不能为空"); |
| | | } |
| | | if (Constants.equalsInteger(status,Constants.ZERO)){ |
| | | //如果启用 |
| | | BaseGoods baseGoods = new BaseGoods(); |
| | | baseGoods.setId(id); |
| | | baseGoods.setEditDate(new Date()); |
| | | baseGoods.setEditor(user.getId()); |
| | | baseGoods.setStatus(status); |
| | | baseGoodsMapper.updateById(baseGoods); |
| | | }else if (Constants.equalsInteger(status,Constants.ONE)){ |
| | | //如果禁用 |
| | | BaseGoods baseGoods = new BaseGoods(); |
| | | baseGoods.setId(id); |
| | | baseGoods.setEditDate(new Date()); |
| | | baseGoods.setEditor(user.getId()); |
| | | baseGoods.setStatus(status); |
| | | baseGoodsMapper.updateById(baseGoods); |
| | | |
| | |
| | | goodsUpdate.lambda() |
| | | .eq(Goods::getType,Constants.ONE) |
| | | .eq(Goods::getGoodsId,id) |
| | | .set(Goods::getStatus,Constants.ONE); |
| | | .set(Goods::getStatus,Constants.ONE) |
| | | .set(Goods::getEditor,user.getId()) |
| | | .set(Goods::getEditDate,new Date()); |
| | | goodsMapper.update(null,goodsUpdate); |
| | | } |
| | | } |
| | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | QueryWrapper<Brand> wrapper = new QueryWrapper<>(brand); |
| | | wrapper.lambda().eq(Brand::getIsdeleted,Constants.ZERO); |
| | | wrapper.lambda().eq(Brand::getStatus,Constants.ZERO); |
| | | // wrapper.lambda().eq(Brand::getStatus,Constants.ZERO); |
| | | wrapper.lambda().orderByAsc(Brand::getSortnum); |
| | | // 类型 0企业 1平台 |
| | | if (Objects.isNull(user.getCompanyId())) { |
| | | if (Constants.equalsInteger(user.getType(), Constants.UserType.SYSTEM.getKey())) { |
| | | wrapper.lambda().eq(Brand::getType,Constants.ONE); |
| | | }else { |
| | | wrapper.lambda().eq(Brand::getType,brand.getCompanyId()) |
| | | .or().eq(Brand::getType,Constants.ZERO); |
| | | wrapper.lambda().and(wapper ->{wapper.eq(Brand::getType,brand.getCompanyId()) |
| | | .or().eq(Brand::getType,Constants.ZERO);} ); |
| | | } |
| | | List<Brand> list = brandMapper.selectList(wrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.BRAND_IMG).getCode(); |
| | | for (Brand b:list) { |
| | | b.setImgfullurl(prefixUrl+b.getImgurl()); |
| | | if(StringUtils.isNotBlank(b.getImgurl())){ |
| | | b.setImgfullurl(prefixUrl+b.getImgurl()); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.biz.system.SystemDictBiz; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | |
| | | import com.doumee.dao.business.join.CompanyJoinMapper; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.business.model.dto.CompanyCreatOrUpdateRequest; |
| | | import com.doumee.dao.system.SystemDictMapper; |
| | | import com.doumee.dao.system.SystemUserMapper; |
| | | import com.doumee.dao.system.SystemUserRoleMapper; |
| | | import com.doumee.dao.system.model.SystemDict; |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.dao.system.model.SystemUserRole; |
| | | import com.doumee.service.business.CompanyService; |
| | | import com.doumee.service.system.SystemDictService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.RandomStringUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | insert.setStatus(Constants.ZERO); |
| | | companyMapper.insert(insert); |
| | | //创建企业用户 |
| | | SystemUser companyUser = createCompanyUser(company.getManagerUserName(), insert.getId()); |
| | | SystemUser companyUser = createCompanyUser(company, insert.getId()); |
| | | Company update = new Company(); |
| | | update.setId(insert.getId()); |
| | | update.setManagerId(companyUser.getId()); |
| | |
| | | return company.getId(); |
| | | } |
| | | |
| | | private SystemUser createCompanyUser(String managerUserName,Integer companyId){ |
| | | private SystemUser createCompanyUser(CompanyCreatOrUpdateRequest company, Integer companyId){ |
| | | |
| | | QueryWrapper<SystemUser> query = new QueryWrapper<>(); |
| | | query.lambda() |
| | | .eq(SystemUser::getType,Constants.ONE) |
| | | .eq(SystemUser::getDeleted,Boolean.FALSE) |
| | | .eq(SystemUser::getUsername,managerUserName); |
| | | .eq(SystemUser::getUsername,company.getManagerUserName()); |
| | | Integer integer = systemUserMapper.selectCount(query); |
| | | if (integer > Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"账号已存在请重新输入账号"); |
| | |
| | | SystemDictData dictDataPassword = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.DEFAULT_PASSWORD); |
| | | String salt = RandomStringUtils.randomAlphabetic(6); |
| | | SystemUser user = new SystemUser(); |
| | | user.setUsername(managerUserName); |
| | | user.setUsername(company.getManagerUserName()); |
| | | user.setPassword(Utils.Secure.encryptPassword(dictDataPassword.getCode(), salt)); |
| | | user.setSalt(salt); |
| | | user.setCompanyId(companyId); |
| | | user.setMobile(company.getLinkephone()); |
| | | user.setRealname(company.getLinkname()); |
| | | user.setType(Constants.ONE); |
| | | user.setCreateTime(new Date()); |
| | | user.setUpdateTime(new Date()); |
| | |
| | | .like(StringUtils.isNotBlank(pageWrap.getModel().getManagerUserName()),SystemUser::getUsername,pageWrap.getModel().getManagerUserName()) |
| | | .eq(Objects.nonNull(pageWrap.getModel().getStatus()),Company::getStatus,pageWrap.getModel().getStatus()) |
| | | .between((Objects.nonNull(pageWrap.getModel().getOepnValidDateStart()) && Objects.nonNull(pageWrap.getModel().getOepnValidDateEnd())), |
| | | Company::getOepnValidDate,pageWrap.getModel().getOepnValidDateStart(),pageWrap.getModel().getOepnValidDateEnd()); |
| | | Company::getOepnValidDate,pageWrap.getModel().getOepnValidDateStart(),pageWrap.getModel().getOepnValidDateEnd()) |
| | | .orderByDesc(Company::getCreateTime); |
| | | return PageData.from(companyJoinMapper.selectJoinPage(page,Company.class,queryWrapper)); |
| | | } |
| | | |
| | |
| | | import com.doumee.dao.system.model.SystemRole; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.dao.system.model.SystemUserRole; |
| | | import com.doumee.dao.system.vo.SystemUserListVO; |
| | | import com.doumee.service.business.CompanyUserService; |
| | | import com.doumee.service.system.SystemRoleService; |
| | | import com.github.yulichang.base.mapper.MPJJoinMapper; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | @Autowired |
| | | private SystemUserJoinMapper systemUserJoinMapper; |
| | | |
| | | @Autowired |
| | | private SystemRoleService systemRoleService; |
| | | |
| | | |
| | | @Override |
| | | public PageData<CompanyUserDTO> findPage(PageWrap<CompanyUserQueryDTO> pageWrap) { |
| | |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | mpjJoinMapper.selectAll(SystemUser.class) |
| | | .selectAs(Company::getName,CompanyUserDTO::getCompanyName) |
| | | .selectAs(SystemRole::getId,CompanyUserDTO::getRoleId) |
| | | .selectAs(SystemRole::getCode,CompanyUserDTO::getRoleCode) |
| | | .selectAs(SystemRole::getName,CompanyUserDTO::getRoleName) |
| | | .selectAs(SystemRole::getType,CompanyUserDTO::getRoleType) |
| | | .leftJoin(SystemUserRole.class,SystemUserRole::getUserId,SystemUser::getId) |
| | | .leftJoin(SystemRole.class,SystemRole::getId,SystemUserRole::getRoleId) |
| | | // .selectAs(SystemRole::getId,CompanyUserDTO::getRoleId) |
| | | // .selectAs(SystemRole::getCode,CompanyUserDTO::getRoleCode) |
| | | // .selectAs(SystemRole::getName,CompanyUserDTO::getRoleName) |
| | | // .selectAs(SystemRole::getType,CompanyUserDTO::getRoleType) |
| | | // .leftJoin(SystemUserRole.class,SystemUserRole::getUserId,SystemUser::getId) |
| | | // .leftJoin(SystemRole.class,SystemRole::getId,SystemUserRole::getRoleId) |
| | | .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) |
| | | .eq(SystemUser::getType, pageWrap.getModel().getType()) |
| | | .eq(Objects.nonNull(pageWrap.getModel().getStatus()),SystemUser::getStatus,pageWrap.getModel().getStatus()) |
| | | .like(StringUtils.isNotBlank(pageWrap.getModel().getCompanyName()),Company::getName,pageWrap.getModel().getCompanyName()) |
| | | .like(StringUtils.isNotBlank(pageWrap.getModel().getKeyWords()),SystemUser::getUsername,pageWrap.getModel().getKeyWords()) |
| | | .or() |
| | | .like(StringUtils.isNotBlank(pageWrap.getModel().getKeyWords()),SystemUser::getRealname,pageWrap.getModel().getKeyWords()); |
| | | .and(StringUtils.isNotBlank(pageWrap.getModel().getKeyWords()),wapper ->{wapper.like(SystemUser::getUsername,pageWrap.getModel().getKeyWords()) |
| | | .or().like(SystemUser::getRealname,pageWrap.getModel().getKeyWords());}) |
| | | .orderByDesc(SystemUser::getCreateTime); |
| | | |
| | | IPage<CompanyUserDTO> companyUserDTOIPage = systemUserJoinMapper.selectJoinPage(page, CompanyUserDTO.class, mpjJoinMapper); |
| | | if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.ONE) && companyUserDTOIPage.getRecords()!=null){ |
| | | for (CompanyUserDTO user : companyUserDTOIPage.getRecords()) { |
| | | // 查询用户角色列表 |
| | | user.setRoles(systemRoleService.findByUserId(user.getId())); |
| | | } |
| | | } |
| | | |
| | | return PageData.from(companyUserDTOIPage); |
| | | } |
| | | |
| | |
| | | MPJLambdaWrapper<SystemUser> mpjJoinMapper = new MPJLambdaWrapper<>(); |
| | | mpjJoinMapper.selectAll(SystemUser.class) |
| | | .selectAs(Company::getName,CompanyUserDTO::getCompanyName) |
| | | .selectAs(SystemRole::getId,CompanyUserDTO::getRoleId) |
| | | .selectAs(SystemRole::getCode,CompanyUserDTO::getRoleCode) |
| | | .selectAs(SystemRole::getName,CompanyUserDTO::getRoleName) |
| | | .selectAs(SystemRole::getType,CompanyUserDTO::getRoleType) |
| | | .leftJoin(SystemUserRole.class,SystemUserRole::getUserId,SystemUser::getId) |
| | | .leftJoin(SystemRole.class,SystemRole::getId,SystemUserRole::getRoleId) |
| | | // .selectAs(SystemRole::getId,CompanyUserDTO::getRoleId) |
| | | // .selectAs(SystemRole::getCode,CompanyUserDTO::getRoleCode) |
| | | // .selectAs(SystemRole::getName,CompanyUserDTO::getRoleName) |
| | | // .selectAs(SystemRole::getType,CompanyUserDTO::getRoleType) |
| | | // .leftJoin(SystemUserRole.class,SystemUserRole::getUserId,SystemUser::getId) |
| | | // .leftJoin(SystemRole.class,SystemRole::getId,SystemUserRole::getRoleId) |
| | | .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) |
| | | .eq(SystemUser::getType, Constants.ONE) |
| | | .eq(SystemUser::getId,companyUserDTO.getId()); |
| | | |
| | | CompanyUserDTO companyUserDTOIPage = systemUserJoinMapper.selectJoinOne(CompanyUserDTO.class, mpjJoinMapper); |
| | | if(companyUserDTOIPage!=null && Constants.equalsInteger(companyUserDTOIPage.getType(),Constants.ONE) ){ |
| | | // 查询用户角色列表 |
| | | companyUserDTOIPage.setRoles(systemRoleService.findByUserId(companyUserDTOIPage.getId())); |
| | | } |
| | | return companyUserDTOIPage; |
| | | } |
| | | |
| | |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.join.GoodsJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.model.dto.BatchDisableDTO; |
| | | import com.doumee.dao.business.model.dto.GoodCreatePlatRequest; |
| | | import com.doumee.dao.business.model.dto.GoodsRequest; |
| | | import com.doumee.dao.business.model.dto.PlatGoodsParam; |
| | | import com.doumee.dao.business.model.dto.*; |
| | | import com.doumee.service.business.BaseDataService; |
| | | import com.doumee.service.business.GoodsService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | |
| | | @Autowired |
| | | private GoodsMapper goodsMapper; |
| | | @Autowired |
| | | @Lazy |
| | | private BaseDataService baseDataService; |
| | | @Autowired |
| | | private BaseGoodsMapper baseGoodsMapper; |
| | | @Autowired |
| | |
| | | Goods g = new Goods(); |
| | | g.setIsdeleted(Constants.ZERO); |
| | | g.setRemark(m.getId()); |
| | | g.setCompanyId(user.getCompanyId()); |
| | | //品类数据 |
| | | g = goodsMapper.selectOne(new QueryWrapper<>(g).last(" limit 1")); |
| | | if(g != null){ |
| | |
| | | Category cate = new Category(); |
| | | cate.setIsdeleted(Constants.ZERO); |
| | | cate.setName(m.getCategory()); |
| | | cate.setCompanyId(user.getCompanyId()); |
| | | //品类数据 |
| | | cate = categoryMapper.selectOne(new QueryWrapper<>(cate).last(" limit 1")); |
| | | if(cate == null){ |
| | |
| | | brand.setIsdeleted(Constants.ZERO); |
| | | brand.setName(m.getBrand()); |
| | | //品类数据 |
| | | brand = brandMapper.selectOne(new QueryWrapper<>(brand).last(" limit 1")); |
| | | QueryWrapper<Brand> qwrapper = new QueryWrapper<>(brand); |
| | | qwrapper.lambda().and(wapper-> wapper.eq(Brand::getCompanyId ,user.getCompanyId()).or().eq(Brand::getType,Constants.ONE)); |
| | | brand = brandMapper.selectOne(qwrapper.last(" limit 1")); |
| | | if(brand == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第【"+(num)+"】行商品品牌无效,请检查输入!"); |
| | | } |
| | |
| | | newModel.setBrandId(brand.getId()); |
| | | newModel.setIsdeleted(Constants.ZERO); |
| | | newModel.setCreator(user.getId()); |
| | | newModel.setCompanyId(user.getCompanyId()); |
| | | newModel.setCreateDate(new Date()); |
| | | newModel.setName(m.getName()); |
| | | newModel.setStatus(Constants.ZERO); |
| | |
| | | newModel.setPinyin(PinYinUtil.getFullSpell(m.getName())); |
| | | newModel.setShortPinyin(PinYinUtil.getFirstSpell(m.getName())); |
| | | |
| | | CateAttr ca = new CateAttr(); |
| | | ca.setCategoryId(cate.getId()); |
| | | ca.setIsdeleted(Constants.ZERO); |
| | | //查询全部属性1和属性2规格值 |
| | | List<CateAttr> allAttr = cateAttrMapper.selectList(new QueryWrapper<>(ca)); |
| | | //属性1集合 |
| | | // String[] attrs = StringUtils.defaultString(m.getAttrFirstNames(),"").split("\n"); |
| | | //属性2集合 |
| | | // String[] attrs2 = StringUtils.defaultString(m.getAttrSecodNames(),"").split("\n"); |
| | | //产品参数集合 |
| | | String[] params = StringUtils.defaultString(m.getParamStr(),"").split("\n"); |
| | | // if(attrs.length > 0){ |
| | | // String attrids="" ,attrNames=""; |
| | | // for(String s : attrs){ |
| | | // if(StringUtils.isBlank(s)){ |
| | | // continue; |
| | | // } |
| | | // //查询属性规格对象 |
| | | // CateAttr ta = getCateAttrByName(s,Constants.ZERO,allAttr); |
| | | // if(ta == null){ |
| | | // throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第【"+(num)+"】行属性1中【"+s+"】无效,请检查输入!"); |
| | | // } |
| | | // if(StringUtils.isNotBlank(attrids)){ |
| | | // attrids += ","; |
| | | // attrNames += ","; |
| | | // } |
| | | // attrids+= ta.getId(); |
| | | // attrNames+= ta.getName(); |
| | | // } |
| | | // newModel.setAttrFirstIds(attrids); |
| | | // newModel.setAttrFirstNames(attrNames); |
| | | // } |
| | | // if(attrs2.length > 0){ |
| | | // String attrids="" ,attrNames=""; |
| | | // for(String s : attrs2){ |
| | | // if(StringUtils.isBlank(s)){ |
| | | // continue; |
| | | // } |
| | | // //查询属性规格对象 |
| | | // CateAttr ta = getCateAttrByName(s,Constants.ONE,allAttr); |
| | | // if(ta == null){ |
| | | // throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第【"+(num)+"】行属性1中【"+s+"】无效,请检查输入!"); |
| | | // } |
| | | // if(StringUtils.isNotBlank(attrids)){ |
| | | // attrids += ","; |
| | | // attrNames += ","; |
| | | // } |
| | | // attrids+= ta.getId(); |
| | | // attrNames+= ta.getName(); |
| | | // } |
| | | // newModel.setAttrSecodIds(attrids); |
| | | // newModel.setAttrSecodNames(attrNames); |
| | | // |
| | | // } |
| | | List<String> mulFiles = null; |
| | | String proDir =systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROJECTS).getCode(); |
| | | |
| | | String tf = proDir.substring(0,proDir.length()-1); |
| | | String path = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.GOODS_IMG_DIR).getCode() |
| | | + proDir; |
| | | if(StringUtils.isNotBlank(path)){ |
| | | OssModel ossModel = baseDataService.initOssModel(); |
| | | File dir =new File(path+File.separator+newModel.getRemark()+File.separator); |
| | | if(dir!=null && dir.isDirectory()){ |
| | | File[] files = dir.listFiles(); |
| | |
| | | for(File f:files){ |
| | | if(StringUtils.isBlank(newModel.getImgurl()) && isImgFile(f)){ |
| | | //取第一张图片作为列表图 |
| | | String imgdir =f.getPath().substring(f.getPath().indexOf(tf)+tf.length()+1); |
| | | newModel.setImgurl(imgdir.replace(File.separator,"/")); |
| | | // newModel.setImgurl(f.getPath().replace(path.replace(File.separator,"/"),"")); |
| | | newModel.setImgurl(baseDataService.getOssImgurl(ossModel,ossModel.getGoodsFolder(),f)); |
| | | } |
| | | // else{ |
| | | // if(mulFiles==null){ |
| | | // mulFiles = new ArrayList<>(); |
| | | // } |
| | | // mulFiles.add(f.getPath().replace(path.replace("/",File.separator),"")); |
| | | // } |
| | | if((mulFiles ==null || mulFiles.size() == 0) && f.isDirectory()){ |
| | | //如果是文件夹 |
| | | File[] fs = f.listFiles(); |
| | |
| | | if(mulFiles==null){ |
| | | mulFiles = new ArrayList<>(); |
| | | } |
| | | |
| | | String imgdir =mf.getPath().substring(mf.getPath().indexOf(tf)+tf.length()+1); |
| | | mulFiles.add(imgdir.replace(File.separator,"/")); |
| | | // newModel.setImgurl(imgdir); |
| | | //// mulFiles.add(mf.getName()); |
| | | // mulFiles.add(mf.getPath().replace(path.replace(File.separator,"/"),"")); |
| | | mulFiles.add(baseDataService.getOssImgurl(ossModel,ossModel.getGoodsFolder(),f)); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private boolean isImgFile(File f) { |
| | | if(f!=null && f.isFile() ){ |
| | | String name = f.getName(); |