springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/enums/RealAssetsCategoryType.java
New file @@ -0,0 +1,24 @@ package com.panzhihua.common.enums; import lombok.Getter; /** * 建筑类型 * * @author llming */ @Getter public enum RealAssetsCategoryType { PUBLIC(2, "公共设施"), BUILD(1, "建筑类"); private final int code; private final String info; RealAssetsCategoryType(int code, String info) { this.code = code; this.info = info; } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngRealAssetsExcelListen.java
@@ -3,11 +3,13 @@ import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.fastjson.JSONObject; import com.panzhihua.common.enums.RealAssetsCategoryType; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngRealAssetsExcelVO; import com.panzhihua.common.model.vos.community.ComMngRealCompanyExcelVO; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.utlis.StringUtils; import lombok.extern.slf4j.Slf4j; import java.util.ArrayList; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ComShopGoodsDTO.java
@@ -30,4 +30,7 @@ @ApiModelProperty("配送方式(1.商家配送 2.快递物流)") private Integer deliveryType; @ApiModelProperty(hidden = true) private Long userId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/AddShopGoodsVO.java
@@ -19,7 +19,7 @@ private Long storeId; @ApiModelProperty("店铺名称") @ApiModelProperty("商品名称") private String name; @ApiModelProperty("商品现价") springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -425,6 +425,15 @@ R pageOtherBuild(@RequestBody ComMngStructOtherBuildVO comMngStructOtherBuildVO); /** * 获取志愿者详情 * * @param id 志愿者信息 * @return 增加结果 */ @GetMapping("getVolunteerById") R getVolunteerById(@RequestParam("id")Long id); /** * 增加志愿者 * * @param comMngVolunteerMngVO 志愿者信息 springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityManagerApi.java
@@ -332,7 +332,13 @@ @ApiOperation(value = "删除志愿者") @DeleteMapping("volunteer") public R deleteVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ String phone1 = comMngVolunteerMngVO.getPhone(); Object data = communityService.getVolunteerById(comMngVolunteerMngVO.getId()).getData(); if (data==null){ return R.fail("Id有误!"); } String dataStr = JSONObject.toJSONString(data); ComMngVolunteerMngAppletsVO oneVolunteerVO = JSONObject.parseObject(dataStr, ComMngVolunteerMngAppletsVO.class); String phone1 = oneVolunteerVO.getPhone(); if (ObjectUtils.isEmpty(phone1)) { return R.fail("志愿者手机号不能为空"); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -794,6 +794,16 @@ } /** * 获取志愿者详情 * @param id * @return */ @GetMapping("getVolunteerById") R getVolunteerById(@RequestParam("id")Long id){ return comMngVolunteerMngService.getVolunteerById(id); } /** * 删除志愿者 * @param comMngVolunteerMngVO 手机号 * @return 删除结果 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngStructOtherBuildDAO.java
@@ -48,6 +48,7 @@ "b.name like concat(#{comMngStructOtherBuildVO.name},'%') "+ " </if> " + " </where>" + " order by b.create_at desc" + "</script>") IPage<ComMngStructOtherBuildVO> pageOtherBuild(Page page, @Param("comMngStructOtherBuildVO") ComMngStructOtherBuildVO comMngStructOtherBuildVO); springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngVolunteerMngService.java
@@ -83,4 +83,10 @@ */ List<TodoEventsVO> selectNeedToDo(Long communityId, Long userId); /** * 获取志愿者详情 * @param id * @return */ R getVolunteerById(Long id); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngRealAssetsServiceImpl.java
@@ -4,6 +4,7 @@ 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.enums.RealAssetsCategoryType; import com.panzhihua.common.enums.RealAssetsFloorType; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.dtos.community.ExportRealAssetsExcelDTO; @@ -11,6 +12,7 @@ import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngRealAssetsExcelVO; import com.panzhihua.common.model.vos.community.ComMngRealAssetsVO; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_community.dao.ComMngRealAssetsDAO; import com.panzhihua.service_community.dao.ComMngStructBuildTypeDAO; import com.panzhihua.service_community.model.dos.ComMngRealAssetsDO; @@ -119,6 +121,12 @@ } else if (l.getFloorType().equals(RealAssetsFloorType.LOW.getInfo())) { comMngRealAssetsDO.setFloorType(RealAssetsFloorType.LOW.getCode()); } if(l.getCategory().equals(RealAssetsCategoryType.PUBLIC.getInfo())){ comMngRealAssetsDO.setCategory(RealAssetsCategoryType.PUBLIC.getCode()); } if(l.getCategory().equals(RealAssetsCategoryType.BUILD.getInfo())){ comMngRealAssetsDO.setCategory(RealAssetsCategoryType.BUILD.getCode()); } comMngRealAssetsDOS.add(comMngRealAssetsDO); }); boolean batch = this.saveBatch(comMngRealAssetsDOS); springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVolunteerMngServiceImpl.java
@@ -234,6 +234,11 @@ } @Override public R getVolunteerById(Long id) { ComMngVolunteerMngDO comMngVolunteerMngDO = comMngVolunteerMngDAO.selectById(id); ComMngVolunteerMngAppletsVO vo=new ComMngVolunteerMngAppletsVO(); BeanUtils.copyProperties(comMngVolunteerMngDO,vo); return R.ok(vo); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOperLogServiceImpl.java
@@ -1,21 +1,15 @@ package com.panzhihua.service_community.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.R; import com.panzhihua.common.model.vos.shop.PageShopStoreVO; import com.panzhihua.common.model.vos.shop.ShopOperLogVO; import com.panzhihua.service_community.dao.ComShopOperLogDAO; import com.panzhihua.service_community.dao.ComShopOrderDAO; import com.panzhihua.service_community.model.dos.ComShopOperLogDO; import com.panzhihua.service_community.model.dos.ComShopOrderDO; import com.panzhihua.service_community.model.dos.ComShopStoreDO; import com.panzhihua.service_community.service.ComShopOperLogService; import com.panzhihua.service_community.service.ComShopOrderService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/GoodsApi.java
@@ -1,5 +1,7 @@ package com.panzhihua.shop_backstage.api; import com.alibaba.fastjson.JSONObject; 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.vos.R; @@ -8,15 +10,26 @@ import com.panzhihua.common.model.vos.shop.ComShopOrderSearchVO; import com.panzhihua.common.model.vos.shop.ShopStoreVO; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.utlis.ClazzUtils; import com.panzhihua.common.utlis.SFTPUtil; import com.panzhihua.common.validated.PageGroup; import com.panzhihua.common.interfaces.ShopOperLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.List; import java.util.UUID; /** * @ClasssName GoodsApi 商品API @@ -34,17 +47,36 @@ @Resource private CommunityService communityService; // FTP 登录用户名 @Value("${ftp.username}") private String userName; // FTP 登录密码 @Value("${ftp.password}") private String password; // FTP 服务器地址IP地址 @Value("${ftp.host}") private String host; // FTP 端口 @Value("${ftp.port}") private int port; @Value("${ftp.url}") private String url; @ApiOperation(value = "商品分页搜索", response = ComShopGoodsVO.class) @PostMapping("/page") public R search(@RequestBody @Validated(PageGroup.class) ComShopGoodsDTO comShopGoodsDTO){ R<ShopStoreVO> storeInfoR = communityService.getUserStoreInfo(getUserId()); ShopStoreVO shopStoreVO = storeInfoR.getData(); if(R.isOk(storeInfoR)) { ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(storeInfoR.getData()), ShopStoreVO.class); if(shopStoreVO==null){ return R.fail("用户无关联店铺"); } comShopGoodsDTO.setStoreId(shopStoreVO.getId()); ClazzUtils.setIfStringIsEmpty(comShopGoodsDTO); return communityService.pageShopGoods(comShopGoodsDTO); }else{ return R.fail(); } } @ApiOperation(value = "添加商品") @@ -52,10 +84,18 @@ @PostMapping("/add") public R search(@RequestBody AddShopGoodsVO addShopGoodsVO){ R<ShopStoreVO> storeInofR = communityService.getUserStoreInfo(getUserId()); ShopStoreVO shopStoreVO = storeInofR.getData(); if(R.isOk(storeInofR)) { ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(storeInofR.getData()), ShopStoreVO.class); if (shopStoreVO == null) { return R.fail("用户无关联店铺"); } addShopGoodsVO.setStoreId(shopStoreVO.getId()); addShopGoodsVO.setName(shopStoreVO.getName()); //addShopGoodsVO.setName(shopStoreVO.getName()); return communityService.saveShopGoods(addShopGoodsVO); }else{ return R.fail(); } } @ApiOperation(value = "编辑商品") @@ -86,4 +126,30 @@ return communityService.deleteShopGoods(id); } @ApiOperation(value = "上传图片") @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( "avi", "flv", "mpg", "mpeg", "mpe", "m1v", "m2v", "mpv2", "mp2v", "dat", "ts", "tp", "tpr", "pva", "pss", "mp4", "m4v", "m4p", "m4b", "3gp", "3gpp", "3g2", "3gp2", "ogg", "mov", "qt", "amr", "rm", "ram", "rmvb", "rpm"); String nameStr = name.split("\\.")[1]; if (formateList.contains(nameStr)) { name = UUID.randomUUID().toString().replaceAll("-", "") + ".mp4"; } else { name = UUID.randomUUID().toString().replaceAll("-", "") + ".jpg"; } try { SFTPUtil sftp = new SFTPUtil(userName, password, host, port); sftp.login(); InputStream is = file.getInputStream(); sftp.uploadMore(FtpConstants.FTPFILEPATH_IDCARD, name, is); sftp.logout(); return R.ok(url + "/idcard/" + name); } catch (Exception e) { log.error("上传照片失败【{}】", e.getMessage()); return R.fail(); } } }