张天森
2022-11-10 4c0f9a7eb32a1a449fa472a01d9284642f19cc25
Merge remote-tracking branch 'origin/huacheng_test' into huacheng_test
7个文件已修改
4个文件已添加
783 ■■■■ 已修改文件
flower_city/src/main/java/com/dg/core/controller/CommonController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/gen/entity/AutomessagePolicyDocuments.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/gen/mapper/AutomessagePolicyDocumentsMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/manual/mapper/util/MapperGenerator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/task/SendWsListener.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/resources/mapper/AutomessagePolicyDocumentsMapper.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/resources/mapper/OrganizationChartMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/resources/mapper/TransactionEventMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ShopFlowerApi.java 283 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ShopFlowerApi.java 232 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/controller/CommonController.java
@@ -151,7 +151,6 @@
            return success("工作日");
    }
    /**
     * 获取天气默认为攀枝花
     */
flower_city/src/main/java/com/dg/core/db/gen/entity/AutomessagePolicyDocuments.java
New file
@@ -0,0 +1,95 @@
package com.dg.core.db.gen.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * <p>
 * 法律法规政策文件实体类
 * </p>
 *
 * @author fengjin
 * @since 2022-11-10
 */
@TableName("automessage_policy_documents")
@Data
@ApiModel("法律法规政策文件实体类")
public class AutomessagePolicyDocuments implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @ApiModelProperty("主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 部门id
     */
    @ApiModelProperty("部门id")
    private Integer departmentId;
    /**
     * 名称
     */
    @ApiModelProperty("名称")
    private String name;
    /**
     * 跳转链接类型(1.富文本2.微信文章)
     */
    @ApiModelProperty("名称")
    private String linkType;
    /**
     * 文章链接
     */
    @ApiModelProperty("文章链接")
    private String articleLink;
    /**
     * 文章富文本
     */
    @ApiModelProperty("文章富文本")
    private String richText;
    /**
     * 类型(1.法律法规2.政策文件)
     */
    @ApiModelProperty("类型(1.法律法规2.政策文件)")
    private Integer type;
    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;
    /**
     * 创建人
     */
    @ApiModelProperty("创建人")
    private Integer createUserId;
    /**
     * 修改时间
     */
    @ApiModelProperty("修改时间")
    private LocalDateTime updateTime;
    /**
     * 修改人
     */
    @ApiModelProperty("修改人")
    private Integer  updateUserId;
}
flower_city/src/main/java/com/dg/core/db/gen/mapper/AutomessagePolicyDocumentsMapper.java
New file
@@ -0,0 +1,20 @@
package com.dg.core.db.gen.mapper;
import com.dg.core.db.gen.entity.AutomessagePolicyDocuments;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author fengjin
 * @since 2022-11-10
 */
public interface AutomessagePolicyDocumentsMapper extends BaseMapper<AutomessagePolicyDocuments> {
   List<AutomessagePolicyDocuments> selectConfigList();
}
flower_city/src/main/java/com/dg/core/db/manual/mapper/util/MapperGenerator.java
@@ -34,7 +34,7 @@
                })
                .strategyConfig(builder -> {
//                    builder.addInclude("");
                    builder.addInclude("automessage_sys_user_record") // 设置需要生成的表名
                    builder.addInclude("automessage_policy_documents") // 设置需要生成的表名
                            .addTablePrefix("t_", "c_"); // 设置过滤表前缀
                })
                .templateConfig(builder -> {
flower_city/src/main/java/com/dg/core/task/SendWsListener.java
@@ -1,21 +1,24 @@
package com.dg.core.task;
import com.dg.core.service.IGuideRepairOrderService;
import com.dg.core.util.TestDate;
import org.springframework.data.redis.core.RedisTemplate;
import javax.annotation.Resource;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.*;
@WebListener
public class SendWsListener implements ServletContextListener {
    @Resource
    private IGuideRepairOrderService iGuideRepairOrderService;
    @Resource
    RedisTemplate<String, Object> redisTemplate;
    @Override
    public void contextDestroyed(ServletContextEvent arg0) {
        System.out.println("定时发送Xml信息监听--已关闭!");
@@ -57,6 +60,9 @@
                iGuideRepairOrderService.pushOvertimeGuideRepairOrder();
                //定时更新未评价的单据评价状态
                iGuideRepairOrderService.updateEvaluate();
                TestDate td = new TestDate();
                Map weather = td.getWeather("510400");
                redisTemplate.opsForValue().set("weather",weather);
                // TODO 写你的逻辑
            }
        }, defaultdate, 1 * 60 * 1000);// 定时每15分钟
flower_city/src/main/resources/mapper/AutomessagePolicyDocumentsMapper.xml
New file
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dg.core.db.gen.mapper.AutomessagePolicyDocumentsMapper">
    <resultMap type="com.dg.core.db.gen.entity.AutomessagePolicyDocuments" id="AutomessagePolicyDocumentsResult">
        <id     property="id"      column="id"      />
        <id     property="departmentId"      column="department_id"      />
        <id     property="name"      column="name"      />
        <id     property="linkType"      column="link_type"      />
        <id     property="articleLink"      column="article_link"      />
        <id     property="richText"      column="rich_text"      />
        <id     property="type"      column="type"      />
        <id     property="createTime"      column="create_time"      />
        <id     property="createUserId"      column="create_user_id"      />
        <id     property="updateTime"      column="update_time"      />
        <id     property="updateUserId"      column="update_user_id"      />
    </resultMap>
    <sql id="selectAutomessagePolicyDocumentsResult">
        SELECT
            id,
            (select organization_name from  automessage_organization_chart where id=a.department_id )departmentName,
            department_id,
            name,
            link_type,
            type,
            article_link,
            rich_text,
            create_time,
            update_time,
            (select user_name from automessage_sys_user where user_id=a.update_user_id)updateUserName,
            update_user_id,
            (select user_name from automessage_sys_user where user_id=a.create_user_id)createUserName,
            create_user_id
        FROM
            automessage_policy_documents a
    </sql>
    <select id="selectConfigList" resultMap="AutomessagePolicyDocumentsResult">
        <include refid="selectAutomessagePolicyDocumentsResult" />
        <where>
            <if test="name!=null and name!=''">
                and name  like concat('%', #{name}, '%')
            </if>
            <if test="type!=null">
                and type = #{type}
            </if>
        </where>
    </select>
</mapper>
flower_city/src/main/resources/mapper/OrganizationChartMapper.xml
@@ -165,7 +165,7 @@
            <if test="updateUserId != null">update_user_id=#{updateUserId},</if>
            <if test="areaList != null and areaList != '' ">area_list=#{areaList},</if>
            <if test="contactNumber != null and contactNumber != '' ">contact_number=#{contactNumber},</if>
            <if test="departmentalApplication != null and departmentalApplication != '' ">departmental_application=#{departmentalApplication},</if>
            <if test="departmentalApplication != null  ">departmental_application=#{departmentalApplication},</if>
            <if test="updateUserId != null and updateUserId != '' ">update_user_id=#{updateUserId},</if>
            <if test="resume != null and resume != '' ">resume=#{resume},</if>
            update_time=sysdate()
flower_city/src/main/resources/mapper/TransactionEventMapper.xml
@@ -388,7 +388,9 @@
    </select>
    <select id="sumTransactionNum"  resultMap="TransactionEventEntityResult">
        select sum(transaction_num)sumTransactionNum,count(*) counttransaction   FROM automessage_transaction_event
        select sum(TransactionNum)sumTransactionNum,  count(*) counttransaction from (
        SELECT (select count(id) from automessage_guide_repair_order where state in (3,4) and  a.id=matter_id) TransactionNum
        from automessage_transaction_event a)k
    </select>
    <select id="queryByClassifyIdList"  resultMap="TransactionEventEntityResult">
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -24,6 +24,7 @@
import com.panzhihua.common.model.dtos.neighbor.*;
import com.panzhihua.common.model.dtos.property.PagePropertyWorkerDTO;
import com.panzhihua.common.model.dtos.property.PropertyWorkerDTO;
import com.panzhihua.common.model.dtos.shop.*;
import com.panzhihua.common.model.vos.civil.ComActSocialWorkerVO;
import com.panzhihua.common.model.vos.community.acid.ComActAcidCheckRecordVO;
import com.panzhihua.common.model.vos.community.acid.ComActAcidMemberVO;
@@ -33,6 +34,7 @@
import com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordVO;
import com.panzhihua.common.model.vos.community.raffle.ComActRaffleVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveDangerAreaVO;
import com.panzhihua.common.model.vos.shop.AddShopFlowerGoodsVO;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.scheduling.annotation.Async;
@@ -203,27 +205,6 @@
import com.panzhihua.common.model.dtos.neighbor.DeleteNeighborCircleAppDTO;
import com.panzhihua.common.model.dtos.neighbor.DetailNeighborAllCommentByAdminDTO;
import com.panzhihua.common.model.dtos.neighbor.DetailNeighborCommentReplyByAdminDTO;
import com.panzhihua.common.model.dtos.shop.ComShopAddressDTO;
import com.panzhihua.common.model.dtos.shop.ComShopCartDTO;
import com.panzhihua.common.model.dtos.shop.ComShopEditNubCartDTO;
import com.panzhihua.common.model.dtos.shop.ComShopFundsExportDTO;
import com.panzhihua.common.model.dtos.shop.ComShopGoodsDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderCreateDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderDeliverDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderExportDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderPreviewDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderQueryDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderShipDTO;
import com.panzhihua.common.model.dtos.shop.ComShopSysConfDTO;
import com.panzhihua.common.model.dtos.shop.OrderPayDTO;
import com.panzhihua.common.model.dtos.shop.PageComOrderListDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopAddressDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopFundsSearchDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopGoodsDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopOrderSearchDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopStoreDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopSysConfDTO;
import com.panzhihua.common.model.dtos.shop.WxPayNotifyOrderDTO;
import com.panzhihua.common.model.dtos.user.PageInputUserDTO;
import com.panzhihua.common.model.dtos.vaccines.VaccinesByAdminDTO;
import com.panzhihua.common.model.dtos.vaccines.VaccinesEnrollByAdminDTO;
@@ -2952,6 +2933,63 @@
    R changeStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status);
    /**
     * 商品列表-分页查询
     *
     * @param pageComShopGoodsDTO
     *            添加数据
     */
    @PostMapping("/shopFlower/pageGoods")
    R pageFlowerGoodsList(@RequestBody PageComShopFlowerGoodsDTO pageComShopGoodsDTO);
    /**
     * 商品列表-分页查询
     *
     * @param comShopFlowerGoodsDTO
     *            添加数据
     */
    @PostMapping("/shopFlower/pageShopFlowerGoodsByApp")
    R pageShopFlowerGoodsByApp(@RequestBody  ComShopFlowerGoodsDTO comShopFlowerGoodsDTO);
    /**
     * 新增商品
     *
     * @param addShopGoodsVO
     * @return
     */
    @PostMapping("/shopFlower/saveShopGoods")
    R saveFlowerShopGoods(@RequestBody AddShopFlowerGoodsVO addShopGoodsVO);
    /**
     * 编辑商品
     *
     * @param id
     * @param addShopGoodsVO
     * @return
     */
    @PostMapping("/shopFlower/editShopGoods/{id}")
    R editFlowerShopGoods(@PathVariable("id") Long id, @RequestBody AddShopFlowerGoodsVO addShopGoodsVO);
    /**
     * 删除商品
     *
     * @param id
     * @return
     */
    @PostMapping("/shopFlower/deleteShopGoods")
    R deleteFlowerShopGoods(@RequestBody Long[] id);
    /**
     * 修改商品状态
     *
     * @param id
     * @return
     */
    @GetMapping("/shopFlower/changeShopGoodsStatus")
    R changeFlowerStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status);
    /**
     * 结果
     *
     * @param shopOperlog
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ShopFlowerApi.java
New file
@@ -0,0 +1,283 @@
package com.panzhihua.community_backstage.api;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopFlowerGoodsDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.AddShopFlowerGoodsVO;
import com.panzhihua.common.model.vos.shop.PageShopGoodsVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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 javax.annotation.Resource;
/**
 * @auther yh
 * @describe 商城管理
 */
@Slf4j
@Api(tags = {"商城管理模块"})
@RestController("/shopFlower")
public class ShopFlowerApi extends BaseController {
    @Value("${excel.userurl}")
    private String excelUrl;
    // 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;
    @Resource
    private CommunityService communityService;
    @Resource
    private UserService userService;
    @ApiOperation(value = "编辑便民服务商家")
    @PutMapping("/merchant/put")
    public R putMerchant(@RequestBody @Validated(PutGroup.class) ConvenientMerchantDTO convenientMerchantDTO) {
        convenientMerchantDTO.setUpdatedBy(this.getUserId());
        convenientMerchantDTO.setCreatedBy(this.getUserId());
        return communityService.putMerchant(convenientMerchantDTO);
    }
    @ApiOperation(value = "分页查询商品", response = PageShopGoodsVO.class)
    @PostMapping("/goods/page")
    public R pageGoodsList(@RequestBody PageComShopFlowerGoodsDTO pageComShopGoodsDTO) {
        return communityService.pageFlowerGoodsList(pageComShopGoodsDTO);
    }
    @ApiOperation(value = "新增商品")
    @PostMapping("/goods/save")
    public R saveShopGoods(@RequestBody @Validated(AddGroup.class) AddShopFlowerGoodsVO addShopGoodsVO) {
        return communityService.saveFlowerShopGoods(addShopGoodsVO);
    }
    @ApiOperation(value = "编辑商品")
    @PostMapping("/goods/edit/{id}")
    public R editShopGoods(@PathVariable("id") Long id,
                           @RequestBody @Validated(AddGroup.class) AddShopFlowerGoodsVO addShopGoodsVO) {
        return communityService.editFlowerShopGoods(id, addShopGoodsVO);
    }
    @ApiOperation(value = "删除商品")
    @PostMapping("/goods/delete")
    public R deleteShopGoods(@RequestBody Long[] id) {
        return communityService.deleteFlowerShopGoods(id);
    }
    @ApiOperation(value = "商品上下架")
    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "商品Id"),
            @ApiImplicitParam(name = "status", value = "1.上架  2.下架 ")})
    @GetMapping("/goods/changeStatus")
    public R changeStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status) {
        return communityService.changeFlowerStatus(id, status);
    }
    /*@ApiOperation(value = "订单_分页列表", response = ComShopOrderSearchVO.class)
    @PostMapping("/order/page")
    public R page(@RequestBody @Validated PageComShopOrderSearchDTO pageComShopOrderSearchDTO) {
        // pageComShopOrderSearchDTO.setUserId(this.getUserId());
        ClazzUtils.setIfStringIsEmpty(pageComShopOrderSearchDTO);
        return communityService.pageShopOrder(pageComShopOrderSearchDTO);
    }
    @ApiOperation(value = "订单_详细", response = ComShopOrderPageVO.class)
    @GetMapping("/order/detail")
    @ShopOperLog(operType = 11)
    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) {
        ClazzUtils.setIfStringIsEmpty(comShopOrderExportDTO);
        String url = excelUrl;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        // String name=uuid+".xlsx";
        String ftpUrl = "/mnt/data/web/excel/";
        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) {
                return R.ok("未找到数据");
            }
            try {
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                String name = "商城订单-" + 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;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ExcelShopOrderDTO.class)
                            .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                            .registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("订单").build();
                        excelWriter.write(excelShopOrderDTO, writeSheet);
                        excelWriter.finish();
                        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);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        if (excelWriter != null) {
                            excelWriter.finish();
                        }
                    }
                }
                return R.ok(url + URLEncoder.encode(name, "UTF-8"));
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
        }
        return R.fail("导出数据失败");
    }
    @ApiOperation(value = "资金_统计信息")
    @GetMapping("/capital/stat")
    public R stat() {
        Long userId = 0L;
        return communityService.getFundsStat(userId);
    }
    @ApiOperation(value = "资金_分页列表")
    @PostMapping("/capital/page")
    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")
    @GetMapping("/capital/capitalDetailByStore")
    R capitalDetailByStore(@RequestParam("orderId") Long orderId) {
        return communityService.capitalDetailByStore(orderId);
    }
    @ApiOperation(value = "资金_导出表格")
    @PostMapping("/capital/export")
    @ShopOperLog(operType = 12)
    public R export(@RequestBody ComShopFundsExportDTO comShopFundsExportDTO) {
        ClazzUtils.setIfStringIsEmpty(comShopFundsExportDTO);
        String url = excelUrl;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        // String name=uuid+".xlsx";
        String ftpUrl = "/mnt/data/web/excel/";
        Long userId = this.getUserId();
        comShopFundsExportDTO.setUserId(userId);
        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) {
                return R.ok("未找到数据");
            }
            try {
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                String name = "商家资金流水-" + 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;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ExcelShopFundsDTO.class)
                            .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                            .registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("订单").build();
                        excelWriter.write(excelShopFundsDTO, writeSheet);
                        excelWriter.finish();
                        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);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        if (excelWriter != null) {
                            excelWriter.finish();
                        }
                    }
                }
                return R.ok(url + URLEncoder.encode(name, "UTF-8"));
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
        }
        return R.fail("导出数据失败");
    }
    @ApiOperation(value = "商家配置修改")
    @PutMapping("/shop/conf")
    public R editConf(@RequestBody ComShopSysConfDTO comShopSysConfDTO) {
        return communityService.editShopSysConf(comShopSysConfDTO);
    }
    @ApiOperation(value = "商家配置查询", response = ComShopHiddenConfVO.class)
    @GetMapping("/shop/conf")
    public R getConf() {
        PageComShopSysConfDTO pageComShopSysConfDTO = new PageComShopSysConfDTO();
        R r = communityService.pageShopSysConf(pageComShopSysConfDTO);
        if (R.isOk(r) && r.getData() != null) {
            ComShopSysConfVO comShopSysConfVO =
                JSONObject.parseObject(JSONObject.toJSONString(r.getData()), ComShopSysConfVO.class);
            if (comShopSysConfVO != null) {
                ComShopHiddenConfVO comShopHiddenConfVO = new ComShopHiddenConfVO();
                comShopHiddenConfVO.setId(comShopSysConfVO.getId());
                comShopHiddenConfVO.setHidden(comShopSysConfVO.getVal());
                return R.ok(comShopHiddenConfVO);
            }
        }
        return r;
    }*/
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ShopFlowerApi.java
@@ -1,53 +1,17 @@
package com.panzhihua.service_community.api;
import java.util.List;
import com.panzhihua.common.model.dtos.shop.ComShopFlowerGoodsDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopFlowerGoodsDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.AddShopFlowerGoodsVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.service_community.service.ComShopFlowerGoodsService;
import com.panzhihua.service_community.service.ConvenientMerchantService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.service_community.service.*;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.panzhihua.common.model.dtos.PageDTO;
import com.panzhihua.common.model.dtos.shop.ComShopAddressDTO;
import com.panzhihua.common.model.dtos.shop.ComShopCartDTO;
import com.panzhihua.common.model.dtos.shop.ComShopEditNubCartDTO;
import com.panzhihua.common.model.dtos.shop.ComShopFundsExportDTO;
import com.panzhihua.common.model.dtos.shop.ComShopGoodsDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderCreateDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderDeliverDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderExportDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderPreviewDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderQueryDTO;
import com.panzhihua.common.model.dtos.shop.ComShopOrderShipDTO;
import com.panzhihua.common.model.dtos.shop.ComShopSysConfDTO;
import com.panzhihua.common.model.dtos.shop.OrderPayDTO;
import com.panzhihua.common.model.dtos.shop.PageComOrderListDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopAddressDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopFundsSearchDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopGoodsDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopOrderSearchDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopStoreDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopSysConfDTO;
import com.panzhihua.common.model.dtos.shop.WxPayNotifyOrderDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.AddShopGoodsVO;
import com.panzhihua.common.model.vos.shop.ComShopSysConfVO;
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.model.dos.ComShopSysConfDO;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@@ -70,8 +34,77 @@
    @Resource
    private UserService userService;
    /**
     * 商品列表-分页查询
     *
     * @param pageComShopGoodsDTO 查询参数
     * @return PageShopStoreVO
     */
    @PostMapping("pageGoods")
    public R pageFlowerGoodsList(@RequestBody PageComShopFlowerGoodsDTO pageComShopGoodsDTO) {
        return comShopFlowerGoodsService.pageFlowerGoodsList(pageComShopGoodsDTO);
    }
    /**
     * 商品列表-APP分页查询
     *
     * @param comShopFlowerGoodsDTO 查询参数
     * @return PageShopStoreVO
     */
    @PostMapping("pageShopFlowerGoodsByApp")
    public R pageShopFlowerGoodsByApp(@RequestBody ComShopFlowerGoodsDTO comShopFlowerGoodsDTO) {
        return comShopFlowerGoodsService.pageShopFlowerGoodsByApp(comShopFlowerGoodsDTO);
    }
    /**
     * 新增商品
     *
     * @param addShopGoodsVO
     * @return
     */
    @PostMapping("saveShopGoods")
    public R saveFlowerShopGoods(@RequestBody AddShopFlowerGoodsVO addShopGoodsVO) {
        return comShopFlowerGoodsService.saveShopFlowerGoods(addShopGoodsVO);
    }
    /**
     * 编辑商品
     *
     * @param addShopGoodsVO
     * @param id             商铺Id
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    @PostMapping("editShopGoods/{id}")
    public R editFlowerShopGoods(@PathVariable("id") Long id, @RequestBody AddShopFlowerGoodsVO addShopGoodsVO) {
        return comShopFlowerGoodsService.editFlowerShopGoods(id, addShopGoodsVO);
    }
    /**
     * 删除商品
     *
     * @param id
     * @return
     */
    @PostMapping("deleteShopGoods")
    public R deleteFlowerShopGoods(@RequestBody Long[] id) {
        return comShopFlowerGoodsService.deleteShopFlowerGoods(id);
    }
    /**
     * 修改商品状态
     *
     * @param id
     * @return
     */
    @GetMapping("changeShopGoodsStatus")
    public R changeFlowerStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status) {
        return comShopFlowerGoodsService.changeStatus(id, status);
    }
    /*
    *//**
     *//**
     * 分页查询 商家订单
     *
     * @param pageComShopOrderSearchDTO
@@ -130,54 +163,6 @@
    @PostMapping("shopCartList")
    public R shopCartList(@RequestParam("userId") Long userId) {
        return comShopCartService.shopCartList(userId);
    }
    *//**
     * 查询用户购物车数量
     *
     * @param userId
     *            用户id
     * @return 用户购物车商品数量
     *//*
    @PostMapping("shopCartUserTotal")
    public R shopCartUserTotal(@RequestParam("userId") Long userId) {
        return comShopCartService.shopCartUserTotal(userId);
    }
    *//**
     * 购物车添加
     *
     * @param comShopCartDTO
     *            请求参数
     * @return 添加结果
     *//*
    @PostMapping("shopAddCart")
    public R shopAddCart(@RequestBody ComShopCartDTO comShopCartDTO) {
        return comShopCartService.shopAddCart(comShopCartDTO);
    }
    *//**
     * 购物车内商品数量添加
     *
     * @param shopEditNubCartDTO
     *            请求参数
     * @return 修改结果
     *//*
    @PostMapping("shopEditNubCart")
    public R shopEditNubCart(@RequestBody ComShopEditNubCartDTO shopEditNubCartDTO) {
        return comShopCartService.shopEditNubCart(shopEditNubCartDTO);
    }
    *//**
     * 删除购物车记录
     *
     * @param Ids
     *            购物车id集合
     * @return 删除结果
     *//*
    @PostMapping("shopDelCart")
    public R shopDelCart(@RequestBody List<Long> Ids) {
        return comShopCartService.shopDelCart(Ids);
    }
    *//**
@@ -324,64 +309,7 @@
        return comShopOrderService.orderStatistics(userId);
    }
    *//**
     * 商品列表-分页查询
     *
     * @param pageComShopGoodsDTO
     *            查询参数
     * @return PageShopStoreVO
     *//*
    @PostMapping("pageGoods")
    public R pageShopStore(@RequestBody PageComShopGoodsDTO pageComShopGoodsDTO) {
        return comShopFlowerGoodsService.pageGoodsList(pageComShopGoodsDTO);
    }
    *//**
     * 新增商品
     *
     * @param addShopGoodsVO
     * @return
     *//*
    @PostMapping("saveShopGoods")
    public R saveStore(@RequestBody AddShopGoodsVO addShopGoodsVO) {
        return comShopFlowerGoodsService.saveShopGoods(addShopGoodsVO);
    }
    *//**
     * 编辑商品
     *
     * @param addShopGoodsVO
     * @param id
     *            商铺Id
     * @return
     *//*
    @Transactional(rollbackFor = Exception.class)
    @PostMapping("editShopGoods/{id}")
    public R editShopGoods(@PathVariable("id") Long id, @RequestBody AddShopGoodsVO addShopGoodsVO) {
        return comShopFlowerGoodsService.editShopGoods(id, addShopGoodsVO);
    }
    *//**
     * 删除商品
     *
     * @param id
     * @return
     *//*
    @PostMapping("deleteShopGoods")
    public R deleteShopGoods(@RequestBody Long[] id) {
        return comShopFlowerGoodsService.deleteShopGoods(id);
    }
    *//**
     * 修改商品状态
     *
     * @param id
     * @return
     *//*
    @GetMapping("changeShopGoodsStatus")
    public R changeStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status) {
        return comShopFlowerGoodsService.changeStatus(id, status);
    }
    *//**
     * 商家资金的订单详情