zhangyuewww 2 년 전
부모
커밋
c291681076

+ 79 - 2
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/HyReleaseGoodsInfoController.java

@@ -1,9 +1,16 @@
 package com.yh.saas.plugin.yiliangyiyun.controller;
 
 
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.yh.saas.plugin.yiliangyiyun.entity.HyReleaseGoodsInfo;
+import com.yh.saas.plugin.yiliangyiyun.service.IHyReleaseGoodsInfoService;
+import com.yh.saas.plugin.yiliangyiyun.util.Log;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
-import org.springframework.web.bind.annotation.RestController;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.List;
 
 /**
  * <p>
@@ -16,6 +23,76 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/hyReleaseGoodsInfo")
 public class HyReleaseGoodsInfoController {
+    @Autowired
+    private IHyReleaseGoodsInfoService hyReleaseGoodsInfoService;
+
+
+    /**
+     * 货站货源列表
+     * @param hyReleaseGoodsInfo
+     * @return
+     */
+    @Log(title = "货站货源列表")
+    @GetMapping("/selectTask")
+    public Page<HyReleaseGoodsInfo> selectTask(HyReleaseGoodsInfo hyReleaseGoodsInfo) {
+        return hyReleaseGoodsInfoService.selectTask(hyReleaseGoodsInfo);
+    }
+
+
+    /**
+     * 发布货站货源
+     * @param
+     * @return
+     */
+    @Log(title = "发布货站货源")
+    @PostMapping("/api/addTask")
+    public String addTask(@RequestBody HyReleaseGoodsInfo hyReleaseGoodsInfo){
+        return hyReleaseGoodsInfoService.addTask(hyReleaseGoodsInfo);
+    }
+
+    /**
+     * 编辑货站货源
+     * @param hyReleaseGoodsInfo
+     * @return
+     */
+    @Log(title = "编辑货站货源")
+    @PostMapping("/api/editTask")
+    public String editTask(@RequestBody HyReleaseGoodsInfo hyReleaseGoodsInfo){
+        return hyReleaseGoodsInfoService.editTask(hyReleaseGoodsInfo);
+    }
+
+    /**
+     * 查看货站货源
+     * @param id
+     * @return
+     */
+    @Log(title = "查看货站货源")
+    @GetMapping("/seeTask")
+    public HyReleaseGoodsInfo seeTask(@RequestParam String id) {
+        return hyReleaseGoodsInfoService.seeTask(id);
+    }
+
+    /**
+     * 删除货站货源
+     * @param example
+     * @return
+     */
+    @Log(title = "删除货站货源")
+    @PostMapping("/deleteTask")
+    public void deleteTask(@RequestBody HyReleaseGoodsInfo example) {
+        hyReleaseGoodsInfoService.deleteTask(example.getId());
+    }
+
+    /**
+     * 下架
+     * @param hyReleaseGoodsInfo
+     * @return
+     */
+    @Log(title = "下架")
+    @PostMapping("/api/downShelves")
+    public void downShelves(@RequestBody HyReleaseGoodsInfo hyReleaseGoodsInfo) {
+        hyReleaseGoodsInfoService.downShelves(hyReleaseGoodsInfo.getId());
+    }
 
 }
 

+ 11 - 1
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/HyReleaseGoodsInfo.java

@@ -2,6 +2,7 @@ package com.yh.saas.plugin.yiliangyiyun.entity;
 
 import java.io.Serializable;
 
+import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
 
@@ -172,7 +173,16 @@ public class HyReleaseGoodsInfo extends BaseModel<HyReleaseGoodsInfo> {
      * 货源状态(已上架/已下架)
      */
     private String status;
-
+    /**
+     * 查询类型(1发布中2发布记录3常发货源)
+     */
+    @TableField(exist = false)
+    private String searchType;
+    /**
+     * 模糊查询
+     */
+    @TableField(exist = false)
+    private String searchKeyWord;
 
     @Override
     protected Serializable pkVal() {

+ 6 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/HyReleaseGoodsInfoMapper.java

@@ -3,6 +3,9 @@ package com.yh.saas.plugin.yiliangyiyun.mapper;
 import com.yh.saas.plugin.yiliangyiyun.entity.HyReleaseGoodsInfo;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * 记录货站发布信息 Mapper 接口
@@ -13,4 +16,7 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
  */
 public interface HyReleaseGoodsInfoMapper extends BaseMapper<HyReleaseGoodsInfo> {
 
+    Integer getCountByCondition(Map<String, Object> pageView);
+
+    List<HyReleaseGoodsInfo> getListByCondition(Map<String, Object> pageView);
 }

+ 12 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IHyReleaseGoodsInfoService.java

@@ -1,5 +1,6 @@
 package com.yh.saas.plugin.yiliangyiyun.service;
 
+import com.baomidou.mybatisplus.plugins.Page;
 import com.yh.saas.plugin.yiliangyiyun.entity.HyReleaseGoodsInfo;
 import com.baomidou.mybatisplus.service.IService;
 
@@ -13,4 +14,15 @@ import com.baomidou.mybatisplus.service.IService;
  */
 public interface IHyReleaseGoodsInfoService extends IService<HyReleaseGoodsInfo> {
 
+    Page<HyReleaseGoodsInfo> selectTask(HyReleaseGoodsInfo hyReleaseGoodsInfo);
+
+    String addTask(HyReleaseGoodsInfo hyReleaseGoodsInfo);
+
+    String editTask(HyReleaseGoodsInfo hyReleaseGoodsInfo);
+
+    HyReleaseGoodsInfo seeTask(String id);
+
+    void deleteTask(String id);
+
+    void downShelves(String id);
 }

+ 69 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/HyReleaseGoodsInfoServiceImpl.java

@@ -1,11 +1,19 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
+import com.baomidou.mybatisplus.plugins.Page;
+import com.google.common.collect.Lists;
+import com.yh.saas.common.support.util.IdGenerator;
 import com.yh.saas.plugin.yiliangyiyun.entity.HyReleaseGoodsInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.PublishTaskInfo;
 import com.yh.saas.plugin.yiliangyiyun.mapper.HyReleaseGoodsInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IHyReleaseGoodsInfoService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * 记录货站发布信息 服务实现类
@@ -17,4 +25,65 @@ import org.springframework.stereotype.Service;
 @Service
 public class HyReleaseGoodsInfoServiceImpl extends ServiceImpl<HyReleaseGoodsInfoMapper, HyReleaseGoodsInfo> implements IHyReleaseGoodsInfoService {
 
+    @Override
+    public Page<HyReleaseGoodsInfo> selectTask(HyReleaseGoodsInfo hyReleaseGoodsInfo) {
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (hyReleaseGoodsInfo.getCurrentPage() - 1)
+                * hyReleaseGoodsInfo.getPageSize());
+        //用户id
+        pageView.put("commonId", hyReleaseGoodsInfo.getCommonId());
+        pageView.put("searchType", hyReleaseGoodsInfo.getSearchType());
+        pageView.put("searchKeyWord", hyReleaseGoodsInfo.getSearchKeyWord());
+        pageView.put("pageSize", hyReleaseGoodsInfo.getPageSize());
+        pageView.put("currentPage", hyReleaseGoodsInfo.getCurrentPage());
+        // 查询总数
+        Integer dataCount = baseMapper.getCountByCondition(pageView);
+        List<HyReleaseGoodsInfo> dataList = baseMapper.getListByCondition(pageView);
+        Page<HyReleaseGoodsInfo> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(hyReleaseGoodsInfo.getCurrentPage());
+        page.setSize(hyReleaseGoodsInfo.getPageSize());
+        return page;
+    }
+
+    @Override
+    public String addTask(HyReleaseGoodsInfo hyReleaseGoodsInfo) {
+        //新增主键id
+        hyReleaseGoodsInfo.setId(IdGenerator.generateUUID());
+        hyReleaseGoodsInfo.setStatus("已上架");
+        boolean one = this.insert(hyReleaseGoodsInfo);
+        if (one) {
+            return hyReleaseGoodsInfo.getId();
+        } else {
+            return "NG";
+        }
+    }
+
+    @Override
+    public String editTask(HyReleaseGoodsInfo hyReleaseGoodsInfo) {
+        this.updateById(hyReleaseGoodsInfo);
+        return "OK";
+    }
+
+    @Override
+    public HyReleaseGoodsInfo seeTask(String id) {
+        HyReleaseGoodsInfo hyReleaseGoodsInfo=this.selectById(id);
+        return hyReleaseGoodsInfo;
+    }
+
+    @Override
+    public void deleteTask(String id) {
+        HyReleaseGoodsInfo hyReleaseGoodsInfo=this.selectById(id);
+        this.deleteById(hyReleaseGoodsInfo.getId());
+    }
+
+    @Override
+    public void downShelves(String id) {
+        HyReleaseGoodsInfo hyReleaseGoodsInfo=this.selectById(id);
+        if (hyReleaseGoodsInfo!=null) {
+            hyReleaseGoodsInfo.setStatus("已下架");
+            this.updateById(hyReleaseGoodsInfo);
+        }
+    }
 }

+ 89 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/HyReleaseGoodsInfoMapper.xml

@@ -2,4 +2,93 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.HyReleaseGoodsInfoMapper">
 
+    <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(id)
+        FROM hy_release_goods_info
+        WHERE delete_flag = '0'
+        <if test="commonId != null and commonId != ''">
+            AND common_id = #{commonId}
+        </if>
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(send_private) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(send_city) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(send_area) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(unload_private) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(unload_area) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(unload_city) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND status!='已下架'
+            </if>
+            <if test="searchType == 3">
+                AND often_flag = '1'
+            </if>
+        </if>
+    </select>
+    <select id="getListByCondition" parameterType="Map" resultType="com.yh.saas.plugin.yiliangyiyun.entity.HyReleaseGoodsInfo">
+        SELECT
+        id,
+        common_id as commonId,
+        send_private as sendPrivate,
+        send_city as sendCity,
+        send_area as sendArea,
+        send_detailed_address as sendDetailedAddress,
+        send_longitude as sendLongitude,
+        send_latitude as sendLatitude,
+        unsend_longitude as unsendLongitude,
+        unsend_latitude as unsendLatitude,
+        unload_private as unloadPrivate,
+        unload_city as unloadCity,
+        unload_area as unloadArea,
+        unload_detailed_address as unloadDetailedAddress,
+        cargo_distance as cargoDistance,
+        goods_name as goodsName,
+        package_type as packageType,
+        measuring_method as measuringMethod,
+        weight,
+        volume,
+        expected_num as expectedNum,
+        billing_method as billingMethod,
+        freight_price as freightPrice,
+        contacts,
+        contacts_phone as contactsPhone,
+        freight_station_name as freightStationName,
+        period_of_time as periodOfTime,
+        loading_date as loadingDate,
+        car_length as carLength,
+        remark,
+        station_fee as stationFee,
+        often_flag as oftenFlag,
+        car_model as carModel,
+        status,
+        create_date as createDate,
+        update_date as updateDate
+        FROM hy_release_goods_info
+        WHERE delete_flag = '0'
+        <if test="commonId != null and commonId != ''">
+            AND common_id = #{commonId}
+        </if>
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(send_private) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(send_city) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(send_area) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(unload_private) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(unload_area) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(unload_city) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND status!='已下架'
+            </if>
+            <if test="searchType == 3">
+                AND often_flag = '1'
+            </if>
+        </if>
+        ORDER BY update_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>