Merge remote-tracking branch 'origin/master'
# Conflicts:
# springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopGoodsServiceImpl.java
| | |
| | | |
| | | @ApiModelProperty(value = "店铺名称") |
| | | private String storeName; |
| | | @ApiModelProperty(value = "店铺Id") |
| | | private Long storeId; |
| | | |
| | | @ApiModelProperty(value = "商品状态(1.出售中 2.已下架 3.回收站)", example = "1") |
| | | private Integer status; |
| | |
| | | package com.panzhihua.common.model.vos.shop; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiModelProperty("商品店铺信息") |
| | | private PageShopStoreVO shopStoreVO; |
| | | |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("创建时间") |
| | | private Date createAt; |
| | | } |
| | |
| | | @ApiModelProperty("用户ID") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("用户名") |
| | | private String userName; |
| | | |
| | | } |
| | |
| | | import com.alibaba.excel.enums.CellExtraTypeEnum; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.constants.FtpConstants; |
| | |
| | | if (data==null){ |
| | | return R.fail("Id有误!"); |
| | | } |
| | | String dataStr = JSONObject.toJSONString(data); |
| | | ComMngVolunteerMngAppletsVO oneVolunteerVO = JSONObject.parseObject(dataStr, ComMngVolunteerMngAppletsVO.class); |
| | | ComMngVolunteerMngAppletsVO oneVolunteerVO = JSON.parseObject(JSON.toJSONString(data), ComMngVolunteerMngAppletsVO.class); |
| | | String phone1 = oneVolunteerVO.getPhone(); |
| | | if (ObjectUtils.isEmpty(phone1)) { |
| | | return R.fail("志愿者手机号不能为空"); |
| | |
| | | "<if test='pageComShopGoodsDTO.name != null and pageComShopGoodsDTO.name.trim() != ""'>" + |
| | | "and c.name like concat('%',#{pageComShopGoodsDTO.name},'%') \n" + |
| | | " </if> " + |
| | | "<if test='pageComShopGoodsDTO.storeId != null'>" + |
| | | "and css.id=#{pageComShopGoodsDTO.storeId} \n" + |
| | | " </if> " + |
| | | |
| | | "<if test='pageComShopGoodsDTO.status != null'>" + |
| | | "and c.status like concat('%',#{pageComShopGoodsDTO.status},'%') \n" + |
| | | " </if> " + |
| | | " order by c.create_at desc" + |
| | | " </where>" + |
| | | "</script>") |
| | | IPage<PageShopGoodsVO> pageShopGoods(Page page, @Param("pageComShopGoodsDTO") PageComShopGoodsDTO pageComShopGoodsDTO); |
| | |
| | | */ |
| | | @Select("<script> " + |
| | | "select id,`name`,store_id,goods_pic,images,`status`,sale,original_price,price,unit" + |
| | | ",`order`,stock,details,delivery_type from com_shop_goods as csg " + |
| | | " where 1=1 and csg.delete_status = 1 and csg.status = 1" + |
| | | ",`order`,stock,details,delivery_type, create_at " + |
| | | " from com_shop_goods as csg " + |
| | | " where 1=1 and csg.delete_status = 1 " + |
| | | "<if test='comShopGoodsDTO.name != null and comShopGoodsDTO.name !=""'>" + |
| | | " AND csg.`name` like concat('%',#{comShopGoodsDTO.name},'%') " + |
| | | " </if> " + |
| | | "<if test='comShopGoodsDTO.status != null '>" + |
| | | " AND csg.`status` = #{comShopGoodsDTO.status}" + |
| | | " </if> " + |
| | | "<if test='comShopGoodsDTO.storeId != null '>" + |
| | | " AND csg.store_id = #{comShopGoodsDTO.storeId} " + |
| | | " </if> " + |
| | |
| | | public interface ComShopStoreDAO extends BaseMapper<ComShopStoreDO> { |
| | | |
| | | @Select("<script>" + |
| | | "select id,`name`,store_password,contacts,store_account,classify_id,logo,phone,delivery_type,remark,`status`,sale,sale_volume,store_detail,create_at from com_shop_store c" + |
| | | "select id,`name`,store_password,contacts,store_account,classify_id,logo,phone,delivery_type,remark,`status`," + |
| | | "sale,sale_volume,store_detail,create_at from com_shop_store c" + |
| | | " <where>" + |
| | | "c.delete_status=1" + |
| | | "<if test='pageComShopStoreDTO.contacts != null and pageComShopStoreDTO.contacts.trim() != ""'>" + |
| | | "and c.contacts like concat('%',#{pageComShopStoreDTO.contacts},'%') \n" + |
| | | " </if> " + |
| | |
| | | "and c.status =#{pageComShopStoreDTO.status} \n" + |
| | | " </if> " + |
| | | " </where>" + |
| | | " order by c.create_at desc"+ |
| | | " order by c.create_at desc" + |
| | | "</script>") |
| | | IPage<PageShopStoreVO> pageShopStore(Page page, @Param("pageComShopStoreDTO") PageComShopStoreDTO pageComShopStoreDTO); |
| | | |
| | |
| | | comShopStoreVOIPage.getRecords().forEach(vo -> { |
| | | List<ComShopGoodsAttrDO> goodsAttrDOs = goodsAttrDOS.stream().filter(goodsAttr -> goodsAttr.getGoodsId().equals(vo.getId())).collect(Collectors.toList()); |
| | | ArrayList<AddShopGoodsAttrVO> goodsAttrVOList = Lists.newArrayList(); |
| | | for (ComShopGoodsAttrDO oneGoodsAttrDO :goodsAttrDOs) { |
| | | for (ComShopGoodsAttrDO oneGoodsAttrDO : goodsAttrDOs) { |
| | | AddShopGoodsAttrVO goodsAttrVO = new AddShopGoodsAttrVO(); |
| | | goodsAttrVO.setGoodsAttrId(oneGoodsAttrDO.getId()); |
| | | goodsAttrVO.setGoodsAttr(oneGoodsAttrDO.getGoodsAttr()); |
| | |
| | | |
| | | @Override |
| | | public R deleteShopGoods(Long[] id) { |
| | | ComShopGoodsDO storeDO = new ComShopGoodsDO(); |
| | | storeDO.setDeleteStatus(2); |
| | | LambdaQueryWrapper<ComShopGoodsDO> query = new LambdaQueryWrapper<ComShopGoodsDO>().eq(ComShopGoodsDO::getId, id); |
| | | int update = this.baseMapper.update(storeDO, query); |
| | | return update > 0 ? R.ok() : R.fail(); |
| | | LambdaQueryWrapper<ComShopGoodsDO> query = new LambdaQueryWrapper<ComShopGoodsDO>().in(ComShopGoodsDO::getId, id); |
| | | List<ComShopGoodsDO> comShopGoodsDOS = this.baseMapper.selectList(query); |
| | | for (ComShopGoodsDO one : comShopGoodsDOS) { |
| | | one.setDeleteStatus(2); |
| | | this.baseMapper.updateById(one); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R changeStatus(Long id, Integer status) { |
| | | ComShopGoodsDO shopGoodsDO = this.baseMapper.selectById(id); |
| | | if(shopGoodsDO==null){ |
| | | if (shopGoodsDO == null) { |
| | | return R.fail("id有误!"); |
| | | } |
| | | shopGoodsDO.setStatus(status); |
| | | this.baseMapper.updateById(shopGoodsDO); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询商品列表 |
| | | * @param comShopGoodsDTO 请求参数 |
| | | * @return 商品列表 |
| | | * |
| | | * @param comShopGoodsDTO 请求参数 |
| | | * @return 商品列表 |
| | | */ |
| | | @Override |
| | | public R pageShopGoods(ComShopGoodsDTO comShopGoodsDTO){ |
| | |
| | | |
| | | /** |
| | | * 根据商品id查询商品信息 |
| | | * @param goodsId 商品id |
| | | * @return 商品信息 |
| | | * |
| | | * @param goodsId 商品id |
| | | * @return 商品信息 |
| | | */ |
| | | @Override |
| | | public R shopGoodsDetail(Long goodsId){ |
| | | public R shopGoodsDetail(Long goodsId) { |
| | | |
| | | //根据id查询商品信息 |
| | | ComShopGoodsDO goodsDO = this.baseMapper.selectById(goodsId); |
| | | if(goodsDO == null || goodsDO.getDeleteStatus().equals(ComShopGoodsDO.deleteStatus.yes)){ |
| | | return R.fail(403,"商品不存在"); |
| | | if (goodsDO == null || goodsDO.getDeleteStatus().equals(ComShopGoodsDO.deleteStatus.yes)) { |
| | | return R.fail(403, "商品不存在"); |
| | | } |
| | | if(!goodsDO.getStatus().equals(ComShopGoodsDO.status.sell)){ |
| | | return R.fail(405,"商品已下架"); |
| | | if (!goodsDO.getStatus().equals(ComShopGoodsDO.status.sell)) { |
| | | return R.fail(405, "商品已下架"); |
| | | } |
| | | |
| | | //根据商品id查询商品规格信息 |
| | | List<ComShopGoodsAttrVO> goodsAttrList = new ArrayList<>(); |
| | | List<ComShopGoodsAttrDO> goodsAttrDOS = shopGoodsAttrDAO.selectList(new QueryWrapper<ComShopGoodsAttrDO>().eq("goods_id",goodsId)); |
| | | goodsAttrDOS.forEach(attrDO->{ |
| | | List<ComShopGoodsAttrDO> goodsAttrDOS = shopGoodsAttrDAO.selectList(new QueryWrapper<ComShopGoodsAttrDO>().eq("goods_id", goodsId)); |
| | | goodsAttrDOS.forEach(attrDO -> { |
| | | ComShopGoodsAttrVO goodsAttrVO = new ComShopGoodsAttrVO(); |
| | | BeanUtils.copyProperties(attrDO,goodsAttrVO); |
| | | BeanUtils.copyProperties(attrDO, goodsAttrVO); |
| | | goodsAttrList.add(goodsAttrVO); |
| | | }); |
| | | |
| | | //查询商品店铺信息 |
| | | ComShopStoreDO shopStoreDO = shopStoreDAO.selectById(goodsDO.getStoreId()); |
| | | PageShopStoreVO shopStoreVO = new PageShopStoreVO(); |
| | | BeanUtils.copyProperties(shopStoreDO,shopStoreVO); |
| | | BeanUtils.copyProperties(shopStoreDO, shopStoreVO); |
| | | |
| | | //设置值 |
| | | ComShopGoodsVO shopGoods = new ComShopGoodsVO(); |
| | | BeanUtils.copyProperties(goodsDO,shopGoods); |
| | | BeanUtils.copyProperties(goodsDO, shopGoods); |
| | | shopGoods.setGoodsAttrList(goodsAttrList); |
| | | shopGoods.setShopStoreVO(shopStoreVO); |
| | | return R.ok(shopGoods); |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.PageDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.shop.ShopOperLogVO; |
| | | import com.panzhihua.common.model.vos.shop.ShopStoreVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.service_community.dao.ComShopOperLogDAO; |
| | | import com.panzhihua.service_community.model.dos.ComShopOperLogDO; |
| | | import com.panzhihua.service_community.service.ComShopOperLogService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @auther cedoo |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class ComShopOperLogServiceImpl extends ServiceImpl<ComShopOperLogDAO, ComShopOperLogDO> implements ComShopOperLogService { |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @Override |
| | | public R saveLog(ShopOperLogVO shopOperLogVO) { |
| | |
| | | public R pageShopOperLog(PageDTO pageDTO) { |
| | | Page page = new Page<>(pageDTO.getPageNum(), pageDTO.getPageSize()); |
| | | IPage<ComShopOperLogDO> comShopOperLogDOIPage = |
| | | this.baseMapper.selectPage(page, new LambdaQueryWrapper<ComShopOperLogDO>().eq(ComShopOperLogDO::getUserId, pageDTO.getUserId())); |
| | | this.baseMapper.selectPage(page, new LambdaQueryWrapper<ComShopOperLogDO>().orderByDesc(ComShopOperLogDO::getOperTime).eq(ComShopOperLogDO::getUserId, pageDTO.getUserId())) |
| | | ; |
| | | |
| | | IPage<ShopOperLogVO> comShopOperLogVOIPage = |
| | | comShopOperLogDOIPage.convert(comShopOperLogDO -> { |
| | |
| | | default: break; |
| | | } |
| | | shopOperLogVO.setBusinessName(businessTypeName); |
| | | |
| | | R<LoginUserInfoVO> usrInfo = userService.getUserInfoByUserId(comShopOperLogDO.getUserId()+""); |
| | | if(R.isOk(usrInfo)) { |
| | | LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(JSONObject.toJSONString(usrInfo.getData()), LoginUserInfoVO.class); |
| | | shopOperLogVO.setUserName(loginUserInfoVO.getName()); |
| | | } |
| | | return shopOperLogVO; |
| | | }); |
| | | return R.ok(comShopOperLogVOIPage); |
| | |
| | | @Override |
| | | public R deleteStore(Long[] id) { |
| | | LambdaQueryWrapper<ComShopStoreDO> query = new LambdaQueryWrapper<ComShopStoreDO>().in(ComShopStoreDO::getId, id); |
| | | ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(query); |
| | | comShopStoreDO.setDeleteStatus(2); |
| | | int update = this.baseMapper.updateById(comShopStoreDO); |
| | | return update > 0 ? R.ok() : R.fail(); |
| | | List<ComShopStoreDO> comShopStoreDO = this.baseMapper.selectList(query); |
| | | for (ComShopStoreDO shopStoreDO:comShopStoreDO) { |
| | | shopStoreDO.setDeleteStatus(2); |
| | | int update = this.baseMapper.updateById(shopStoreDO); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.panzhihua.common.constants.FtpConstants; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.shop.ComShopGoodsDTO; |
| | | import com.panzhihua.common.model.dtos.shop.PageComShopGoodsDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.shop.AddShopGoodsVO; |
| | | import com.panzhihua.common.model.vos.shop.ComShopGoodsVO; |
| | |
| | | |
| | | @ApiOperation(value = "商品分页搜索", response = ComShopGoodsVO.class) |
| | | @PostMapping("/page") |
| | | public R search(@RequestBody @Validated(PageGroup.class) ComShopGoodsDTO comShopGoodsDTO){ |
| | | public R search(@RequestBody @Validated(PageGroup.class) PageComShopGoodsDTO comShopGoodsDTO){ |
| | | R<ShopStoreVO> storeInfoR = communityService.getUserStoreInfo(getUserId()); |
| | | if(R.isOk(storeInfoR)) { |
| | | ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(storeInfoR.getData()), ShopStoreVO.class); |
| | |
| | | } |
| | | comShopGoodsDTO.setStoreId(shopStoreVO.getId()); |
| | | ClazzUtils.setIfStringIsEmpty(comShopGoodsDTO); |
| | | return communityService.pageShopGoods(comShopGoodsDTO); |
| | | return communityService.pageGoodsList(comShopGoodsDTO); |
| | | }else{ |
| | | return R.fail(); |
| | | } |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "上传图片") |
| | | @PostMapping(value = "uploadimage", consumes = "multipart/*", headers = "content-type=multipart/form-date") |
| | | @PostMapping(value = "/uploadimage", consumes = "multipart/*", headers = "content-type=multipart/form-date") |
| | | public R uploadImage(@RequestParam MultipartFile file, HttpServletRequest request) { |
| | | String name = file.getOriginalFilename(); |
| | | List<String> formateList = Arrays.asList( |