no
DESKTOP-71BH0QO\L、ming
2021-04-20 93bd24daa823fd6129d6ba8925c2ca95e16bf4fe
no
5个文件已修改
190 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/ShopApi.java 154 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/PageShopStoreVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopStoreDAO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/config/SwaggerConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/ShopApi.java
@@ -82,25 +82,30 @@
        if (storeVO == null) {
            return R.fail();
        }
        R<SysUserVO> sysUserVO = userService.getSysUserVOByAccount(storeVO.getStoreAccount());
        JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(sysUserVO.getData()));
        SysUserVO entityVo = jsonObject.toJavaObject(SysUserVO.class);
        storeVO.setSysUserId(entityVo.getUserId());
        storeVO.setLoginUserId(loginUserId);
        R r1 = communityService.saveStore(storeVO);
        R<SysUserVO> sysUserVO = userService.getSysUserVOByPhone(storeVO.getPhone());
        JSONObject jsonObject = null;
        if (sysUserVO.getData() != null) {
            return R.fail("账号已存在!");
        }
        AdministratorsUserVO administratorsUserVO = new AdministratorsUserVO();
        administratorsUserVO.setAccount(storeVO.getStoreAccount());
        administratorsUserVO.setPassword(storeVO.getStorePassword());
        administratorsUserVO.setType(5);
        administratorsUserVO.setAreaId(null);
        administratorsUserVO.setStatus(1);
        administratorsUserVO.setPhone(storeVO.getPhone());
        administratorsUserVO.setRoleId(888888888l);
        administratorsUserVO.setShopStoreName(storeVO.getName());
        administratorsUserVO.setShopStorePhone(storeVO.getPhone());
        R r = userService.addUserBackstage(administratorsUserVO);
        //保存sys_user
        if (R.isOk(r1)) {
            AdministratorsUserVO administratorsUserVO = new AdministratorsUserVO();
            administratorsUserVO.setAccount(storeVO.getStoreAccount());
            administratorsUserVO.setPassword(storeVO.getStorePassword());
            administratorsUserVO.setType(5);
            administratorsUserVO.setAreaId(null);
            administratorsUserVO.setStatus(1);
            administratorsUserVO.setPhone(storeVO.getPhone());
            administratorsUserVO.setRoleId(888888888l);
            administratorsUserVO.setShopStoreName(storeVO.getName());
            administratorsUserVO.setShopStorePhone(storeVO.getPhone());
            R r = userService.addUserBackstage(administratorsUserVO);
        if (R.isOk(r)) {
            sysUserVO = userService.getSysUserVOByPhone(storeVO.getPhone());
            jsonObject = JSON.parseObject(JSON.toJSONString(sysUserVO.getData()));
            SysUserVO entityVo = jsonObject.toJavaObject(SysUserVO.class);
            storeVO.setSysUserId(entityVo.getUserId());
            storeVO.setLoginUserId(loginUserId);
            communityService.saveStore(storeVO);
        }
        return R.ok();
    }
@@ -109,15 +114,14 @@
    @PostMapping("/store/edit/{id}")
    @ApiImplicitParam(name = "id", value = "商家id")
    public R editStore(@Valid @RequestBody ShopStoreVO storeVO, @PathVariable("id") Long id) {
        R<LoginUserInfoVO> sysUserVO = userService.getSysUserVOByAccount(storeVO.getStoreAccount());
        R<LoginUserInfoVO> sysUserVO = userService.getSysUserVOByPhone(storeVO.getPhone());
        if (sysUserVO.getData() == null) {
            return R.fail("没有相关的用户!");
        }
        LoginUserInfoVO user = JSON.parseObject(JSON.toJSONString(sysUserVO.getData())).toJavaObject(LoginUserInfoVO.class);
        storeVO.setSysUserId(user.getUserId());
        R<ShopStoreVO> storeInfoVO = communityService.getStoreInfo(id);
        if( storeInfoVO.getCode()==500){
        if (storeInfoVO.getCode() == 500) {
            return R.fail(storeInfoVO.getMsg());
        }
        //维护sys_user
@@ -149,15 +153,15 @@
    @ApiOperation(value = "新增商品")
    @PostMapping("/goods/save")
    R saveShopGoods(@RequestBody AddShopGoodsVO addShopGoodsVO){
    R saveShopGoods(@RequestBody AddShopGoodsVO addShopGoodsVO) {
        return communityService.saveShopGoods(addShopGoodsVO);
    }
    @ApiOperation(value = "编辑商品")
    @PostMapping("/goods/edit/{id}")
    R editShopGoods(@PathVariable("id") Long id,@RequestBody AddShopGoodsVO addShopGoodsVO) {
        return communityService.editShopGoods(id,addShopGoodsVO);
    R editShopGoods(@PathVariable("id") Long id, @RequestBody AddShopGoodsVO addShopGoodsVO) {
        return communityService.editShopGoods(id, addShopGoodsVO);
    }
    @ApiOperation(value = "删除商品")
@@ -167,78 +171,78 @@
    }
    @ApiOperation(value = "商品上下架")
    @ApiImplicitParams({@ApiImplicitParam(name = "id",value = "商品Id"),
        @ApiImplicitParam(name = "status",value = "1.上架  2.下架 ")})
    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "商品Id"),
            @ApiImplicitParam(name = "status", value = "1.上架  2.下架 ")})
    @GetMapping("/goods/changeStatus")
    R changeStatus(@RequestParam("id") Long id,@RequestParam("status")Integer status) {
        return communityService.changeStatus(id,status);
    R changeStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status) {
        return communityService.changeStatus(id, status);
    }
    @ApiOperation(value = "订单_分页列表",response = ComShopOrderSearchVO.class)
    @ApiOperation(value = "订单_分页列表", response = ComShopOrderSearchVO.class)
    @PostMapping("/order/page")
    public R page(@RequestBody @Validated PageComShopOrderSearchDTO pageComShopOrderSearchDTO){
    public R page(@RequestBody @Validated PageComShopOrderSearchDTO pageComShopOrderSearchDTO) {
        pageComShopOrderSearchDTO.setUserId(this.getUserId());
        ClazzUtils.setIfStringIsEmpty(pageComShopOrderSearchDTO);
        return communityService.pageShopOrder(pageComShopOrderSearchDTO);
    }
    @ApiOperation(value = "订单_详细",response = ComShopOrderPageVO.class)
    @ApiOperation(value = "订单_详细", response = ComShopOrderPageVO.class)
    @GetMapping("/order/detail")
    @ShopOperLog(operType = 11)
    public R detail(@RequestParam("orderId") Long orderId){
    public R detail(@RequestParam("orderId") Long orderId) {
        return communityService.orderDetail(orderId);
    }
    @ApiOperation(value = "订单_导出表格")
    @PostMapping("/order/export")
    @ShopOperLog(operType = 12)
    public R export(@RequestBody ComShopOrderExportDTO comShopOrderExportDTO){
    public R export(@RequestBody ComShopOrderExportDTO comShopOrderExportDTO) {
        ClazzUtils.setIfStringIsEmpty(comShopOrderExportDTO);
        String url=excelUrl;
        String uuid= UUID.randomUUID().toString().replace("-","");
        String url = excelUrl;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        //String name=uuid+".xlsx";
        String ftpUrl="/mnt/data/web/excel/";
        String ftpUrl = "/mnt/data/web/excel/";
        R<ShopStoreVO> storeR = communityService.getUserStoreInfo(getUserId());
        if(!R.isOk(storeR)){
        if (!R.isOk(storeR)) {
            return R.fail("用户不是商家");
        }
        ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(storeR.getData()),ShopStoreVO.class);
        ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(storeR.getData()), ShopStoreVO.class);
        Long userId = this.getUserId();
        comShopOrderExportDTO.setUserId(userId);
        R r=communityService.shopOrderExportData(comShopOrderExportDTO);
        R r = communityService.shopOrderExportData(comShopOrderExportDTO);
        if (R.isOk(r)) {
            List<ExcelShopOrderDTO> excelShopOrderDTO = JSONArray.parseArray(JSONArray.toJSONString(r.getData()),ExcelShopOrderDTO.class);
            if(excelShopOrderDTO==null||excelShopOrderDTO.size()==0){
            List<ExcelShopOrderDTO> excelShopOrderDTO = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ExcelShopOrderDTO.class);
            if (excelShopOrderDTO == null || excelShopOrderDTO.size() == 0) {
                return R.ok("未找到数据");
            }
            try {
                SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                String name = shopStoreVO.getName() +"商城订单-" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()) + ".xlsx";
                boolean existDir = sftp.isExistDir(ftpUrl+name);
                String name = shopStoreVO.getName() + "商城订单-" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()) + ".xlsx";
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator+name;
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream=null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ExcelShopOrderDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet(shopStoreVO.getName()+"订单").build();
                        WriteSheet writeSheet = EasyExcel.writerSheet(shopStoreVO.getName() + "订单").build();
                        excelWriter.write(excelShopOrderDTO, writeSheet);
                        excelWriter.finish();
                        File file=new File(fileName);
                        inputStream=new FileInputStream(file);
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】",absolutePath,delete);
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
@@ -249,7 +253,7 @@
                        }
                    }
                }
                return R.ok(url+ URLEncoder.encode(name,"UTF-8"));
                return R.ok(url + URLEncoder.encode(name, "UTF-8"));
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
@@ -261,22 +265,22 @@
    @ApiOperation(value = "资金_统计信息")
    @GetMapping("/capital/stat")
    public R stat(){
    public R stat() {
        return communityService.getFundsStat(getUserId());
    }
    @ApiOperation(value = "资金_分页列表")
    @PostMapping("/capital/page")
    public R page(@RequestBody PageComShopFundsSearchDTO pageComShopFundsSearchDTO){
    public R page(@RequestBody PageComShopFundsSearchDTO pageComShopFundsSearchDTO) {
        pageComShopFundsSearchDTO.setUserId(getUserId());
        ClazzUtils.setIfStringIsEmpty(pageComShopFundsSearchDTO);
        return communityService.pageShopFunds(pageComShopFundsSearchDTO);
    }
    @ApiOperation(value = "资金_详情",response = CapitalDetailVO.class)
    @ApiImplicitParam(name = "orderId",value = "订单Id")
    @ApiOperation(value = "资金_详情", response = CapitalDetailVO.class)
    @ApiImplicitParam(name = "orderId", value = "订单Id")
    @GetMapping("/capital/capitalDetailByStore")
    R capitalDetailByStore(@RequestParam("orderId") Long orderId){
    R capitalDetailByStore(@RequestParam("orderId") Long orderId) {
        return communityService.capitalDetailByStore(orderId);
    }
@@ -284,52 +288,52 @@
    @ApiOperation(value = "资金_导出表格")
    @PostMapping("/capital/export")
    @ShopOperLog(operType = 12)
    public R export(@RequestBody ComShopFundsExportDTO comShopFundsExportDTO){
    public R export(@RequestBody ComShopFundsExportDTO comShopFundsExportDTO) {
        ClazzUtils.setIfStringIsEmpty(comShopFundsExportDTO);
        String url=excelUrl;
        String uuid= UUID.randomUUID().toString().replace("-","");
        String url = excelUrl;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        //String name=uuid+".xlsx";
        String ftpUrl="/mnt/data/web/excel/";
        String ftpUrl = "/mnt/data/web/excel/";
        R<ShopStoreVO> storeR = communityService.getUserStoreInfo(getUserId());
        if(!R.isOk(storeR)){
        if (!R.isOk(storeR)) {
            return R.fail("用户不是商家");
        }
        ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(storeR.getData()),ShopStoreVO.class);
        ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(storeR.getData()), ShopStoreVO.class);
        Long userId = this.getUserId();
        comShopFundsExportDTO.setUserId(userId);
        R r=communityService.shopOrderFundsExportData(comShopFundsExportDTO);
        R r = communityService.shopOrderFundsExportData(comShopFundsExportDTO);
        if (R.isOk(r)) {
            List<ExcelShopFundsDTO> excelShopFundsDTO = JSONArray.parseArray(JSONArray.toJSONString(r.getData()),ExcelShopFundsDTO.class);
            if(excelShopFundsDTO==null||excelShopFundsDTO.size()==0){
            List<ExcelShopFundsDTO> excelShopFundsDTO = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ExcelShopFundsDTO.class);
            if (excelShopFundsDTO == null || excelShopFundsDTO.size() == 0) {
                return R.ok("未找到数据");
            }
            try {
                SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                String name = shopStoreVO.getName() +"-商家资金流水-" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()) + ".xlsx";
                boolean existDir = sftp.isExistDir(ftpUrl+name);
                String name = shopStoreVO.getName() + "-商家资金流水-" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()) + ".xlsx";
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator+name;
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream=null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ExcelShopFundsDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet(shopStoreVO.getName()+"订单").build();
                        WriteSheet writeSheet = EasyExcel.writerSheet(shopStoreVO.getName() + "订单").build();
                        excelWriter.write(excelShopFundsDTO, writeSheet);
                        excelWriter.finish();
                        File file=new File(fileName);
                        inputStream=new FileInputStream(file);
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】",absolutePath,delete);
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
@@ -340,7 +344,7 @@
                        }
                    }
                }
                return R.ok(url+ URLEncoder.encode(name,"UTF-8"));
                return R.ok(url + URLEncoder.encode(name, "UTF-8"));
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/PageShopStoreVO.java
@@ -57,6 +57,9 @@
    @ApiModelProperty("店铺销量")
    private Integer sale;
    @ApiModelProperty("店铺登陆密码")
    private String storePassword;
    @ApiModelProperty("店内商品列表")
    private List<ComShopGoodsVO> goodsList;
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopStoreDAO.java
@@ -19,7 +19,7 @@
public interface ComShopStoreDAO extends BaseMapper<ComShopStoreDO> {
    @Select("<script>" +
            "select id,`name`,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>" +
            "<if test='pageComShopStoreDTO.contacts != null and pageComShopStoreDTO.contacts.trim() != &quot;&quot;'>" +
            "and c.contacts like concat('%',#{pageComShopStoreDTO.contacts},'%') \n" +
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
@@ -34,8 +34,9 @@
    /**
     * 查询店铺列表
     * @param pageComShopStoreDTO   请求参数
     * @return  店铺列表
     *
     * @param pageComShopStoreDTO 请求参数
     * @return 店铺列表
     */
    @Override
@@ -47,18 +48,19 @@
    /**
     * 查询店铺详情
     * @param comShopStoreDTO   请求参数
     * @return  店铺详情
     *
     * @param comShopStoreDTO 请求参数
     * @return 店铺详情
     */
    @Override
    public R shopStoreDetail(PageComShopStoreDTO comShopStoreDTO) {
        //查询店铺
        ComShopStoreDO storeDO = this.baseMapper.selectById(comShopStoreDTO.getStoreId());
        if (storeDO == null) {
            return R.fail(401,"店铺不存在");
            return R.fail(401, "店铺不存在");
        }
        if(storeDO.getStatus().equals(ComShopStoreDO.status.no)){
            return R.fail(402,"店铺已被禁用");
        if (storeDO.getStatus().equals(ComShopStoreDO.status.no)) {
            return R.fail(402, "店铺已被禁用");
        }
        PageShopStoreVO shopStoreVO = new PageShopStoreVO();
        BeanUtils.copyProperties(storeDO, shopStoreVO);
@@ -75,6 +77,11 @@
    public R saveStore(ShopStoreVO storeVO) {
        if (storeVO == null) {
            return R.ok("500", "数据为空!");
        }
        ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>()
                .eq(ComShopStoreDO::getStoreAccount, storeVO.getStoreAccount()));
        if (comShopStoreDO != null) {
            return R.ok("500", "商家账号存在");
        }
        ComShopStoreDO storeDO = new ComShopStoreDO();
        BeanUtils.copyProperties(storeVO, storeDO);
@@ -108,10 +115,10 @@
    public R getOneInfo(Long id) {
        ComShopStoreDO comShopStoreDO = this.baseMapper.selectById(id);
        if (comShopStoreDO == null) {
            R.fail(500,"商铺不存在");
            R.fail(500, "商铺不存在");
        }
        ShopStoreVO shopStoreVO = new ShopStoreVO();
        BeanUtils.copyProperties(comShopStoreDO,shopStoreVO);
        BeanUtils.copyProperties(comShopStoreDO, shopStoreVO);
        return R.ok(shopStoreVO);
    }
@@ -119,10 +126,10 @@
    public R getUserStoreInfo(Long userId) {
        ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>().eq(ComShopStoreDO::getDeleteStatus, 1).eq(ComShopStoreDO::getSysUserId, userId));
        if (comShopStoreDO == null) {
            R.fail(500,"商铺不存在");
            R.fail(500, "商铺不存在");
        }
        ShopStoreVO shopStoreVO = new ShopStoreVO();
        BeanUtils.copyProperties(comShopStoreDO,shopStoreVO);
        BeanUtils.copyProperties(comShopStoreDO, shopStoreVO);
        return R.ok(shopStoreVO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/config/SwaggerConfig.java
@@ -24,7 +24,7 @@
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .apis(RequestHandlerSelectors.basePackage("com.panzhihua.shop_backstage"))
                .paths(PathSelectors.any())
                .build();
    }