于继渤 2 лет назад
Родитель
Сommit
b41d2d5035

+ 62 - 0
src/main/java/com/dk/mdm/controller/ivt/inboundReturnController.java

@@ -0,0 +1,62 @@
+package com.dk.mdm.controller.ivt;
+
+
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.common.service.BaseService;
+import com.dk.mdm.model.pojo.ivt.Inbound;
+import com.dk.mdm.model.query.ivt.InboundQuery;
+import com.dk.mdm.model.response.ivt.InboundResponse;
+import com.dk.mdm.service.ivt.InboundReturnService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+@Api(tags = "采购退货API接口")
+@RestController
+@RequestMapping("/ivt/inbound_return")
+public class inboundReturnController {
+
+    public BaseService<Inbound> getService() {
+        return inboundReturnService;
+    }
+
+    @Autowired
+    private InboundReturnService inboundReturnService;
+
+
+
+    /**
+     * @desc   : 条件查询
+     * @author : 于继渤
+     * @date   : 2024/3/8 10:58
+     */
+    @ApiOperation(
+            value = "分页、关联、条件查询",
+            notes = "分页、关联、条件查询"
+    )
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<InboundResponse>> selectByCond(@RequestBody InboundQuery inboundQuery) {
+        return inboundReturnService.selectByCond(inboundQuery);
+    }
+
+    /**
+     * @desc : 查看来源单据,总单加明细  采购退货用
+     * @author : 于继渤
+     * @date : 2024/3/6 10:36
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO<?> selectById(@PathVariable String id) {
+        return inboundReturnService.selectInboundReturnById(id);
+    }
+
+
+
+
+
+
+
+
+}

+ 21 - 0
src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.java

@@ -87,5 +87,26 @@ public interface InboundMapper extends BaseMapper<Inbound>{
     Long selectInboundCond(InboundQuery inboundQuery);
 
     int updateIntoStatus(Inbound inbound);
+
+
+    /**
+     * @desc   : 条件查询 (采购退货用)
+     * @author : 于继渤
+     * @date   : 2024/3/8 10:58
+     */
+    List<InboundResponse> selectByInboundReturnCond(InboundQuery inboundQuery);
+
+    /**
+     * @desc   : 条件查询个数 (采购退货用)
+     * @author : 于继渤
+     * @date   : 2024/3/8 10:58
+     */
+    Long countByInboundReturnCond(InboundQuery inboundQuery);
+    /**
+     * @desc : 查看来源单据,总单加明细 采购退货用
+     * @author : 于继渤
+     * @date : 2024/3/6 10:36
+     */
+    InboundResponse selectInboundReturnById(@Param("intoId") String intoId);
 }
 

+ 102 - 0
src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml

@@ -818,4 +818,106 @@
         </set>
         where into_id = #{intoId}::uuid
     </update>
+
+<!--    采购退货用-->
+    <resultMap id="BaseResultMapInboundReturnResponse" type="com.dk.mdm.model.response.ivt.InboundResponse">
+        <id column="into_id" property="intoId" typeHandler="UuidTypeHandler"/>
+        <result column="into_no" property="intoNo"/>
+        <result column="into_type" property="intoType"/>
+        <result column="from_id" property="fromId" typeHandler="UuidTypeHandler"/>
+        <result column="from_no" property="fromNo"/>
+        <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+        <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+        <result column="sup_id" property="supId" typeHandler="UuidTypeHandler"/>
+        <result column="into_status" property="intoStatus"/>
+        <result column="intoing_qty" property="intoingQty"/>
+        <result column="intoing_amt" property="intoingAmt"/>
+        <result column="into_qty" property="intoQty"/>
+        <result column="into_amt" property="intoAmt"/>
+        <result column="wh_id" property="whId" typeHandler="UuidTypeHandler"/>
+        <result column="return_qty" property="returnQty"/>
+        <result column="return_amt" property="returnAmt"/>
+        <result column="into_date" property="intoDate" typeHandler="TimestampTypeHandler"/>
+        <result column="remarks" property="remarks"/>
+        <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+        <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
+        <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
+        <result column="receivable_id" property="receivableId" typeHandler="UuidTypeHandler"/>
+        <result column="payable_id" property="payableId" typeHandler="UuidTypeHandler"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="sup_name" property="supName"/>
+        <result column="into_reason" property="intoReason" typeHandler="UuidTypeHandler"/>
+        <result column="into_reason_name" property="intoReasonName" />
+        <result column="orgName" property="orgName" />
+        <result column="staff_name" property="staffName" />
+        <result column="contact_phone" property="contactPhone" />
+        <result column="contact_name" property="contactName" />
+        <result column="channel_name" property="channelName" />
+        <result column="cus_from_name" property="cusFromName" />
+        <result column="return_address" property="returnAddress" />
+    </resultMap>
+
+    <sql id="Join_Table_Return">
+        Left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
+        Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpi.sup_id
+        Left join dkic_b.t_mst_staff tms on tms.staff_id = tpi.staff_id
+        Left join dkic_b.t_mst_staff tms1 on tms1.staff_id = tpi.make_staff
+        LEFT JOIN sys.t_data_kind tdk   ON tdk.kind_code = tpi.into_status
+        LEFT JOIN sys.t_data_kind tdktype   ON tdktype.kind_code = tpi.into_type
+        Left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpi.wh_id
+        left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = tpi.into_reason
+    </sql>
+<!--    采购退货用-->
+    <select id="selectByInboundReturnCond" resultMap="BaseResultMapInboundReturnResponse">
+        SELECT
+        <include refid="Base_Column_List_Response"/>
+        ,tmo.org_name
+        ,tmp.sup_name
+        ,tms.staff_name
+        ,tmw.wh_name
+        ,tms1.staff_name as make_staff_name
+        ,sys.f_get_name_i18n(tdktype.kind_name_i18n, 'zh_CN') AS  into_type_name
+        ,sys.f_get_name_i18n(tdk.kind_name_i18n, 'zh_CN') AS into_status_name
+        ,tmd.data_value as into_reason_name
+        ,tmp.return_address
+        ,tmp.contact_name
+        ,tmp.contact_phone
+        FROM dkic_b.t_psi_inbound tpi
+        <include refid="Join_Table_Return"/>
+        <include refid="Condition"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+    <!--采购退货用 查询表t_psi_inbound,(条件查询)个数 -->
+    <select id="countByInboundReturnCond" resultType="Long">
+        SELECT
+        count(1)
+        FROM dkic_b.t_psi_inbound tpi
+        <include refid="Join_Table_Return"/>
+        <include refid="Condition"/>
+    </select>
+    <!--    查看来源单据,总单加明细  采购退货用-->
+    <select id="selectInboundReturnById" resultMap="BaseResultMapInboundReturnResponse">
+        SELECT
+        <include refid="Base_Column_List_Response"/>
+        ,tmo.org_name
+        ,tms.staff_name as staff_name
+        ,tms1.staff_name as make_staff_name
+        ,tmp.sup_name
+        ,tmw.wh_name
+        ,tmd.data_value  as into_reason_name
+        ,tmp.return_address
+        ,tmp.contact_name
+        ,tmp.contact_phone
+        FROM dkic_b.t_psi_inbound tpi
+        Left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
+        Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpi.sup_id
+        Left join dkic_b.t_mst_staff tms on tms.staff_id = tpi.staff_id
+        Left join dkic_b.t_mst_staff tms1 on tms1.staff_id = tpi.make_staff
+        Left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpi.wh_id
+        left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = tpi.into_reason
+        WHERE tpi.into_id = #{intoId}::uuid
+    </select>
 </mapper>

+ 2 - 5
src/main/java/com/dk/mdm/model/response/ivt/InboundResponse.java

@@ -392,11 +392,8 @@ public class InboundResponse  {
     @ApiModelProperty(value = "供应商退货地址")
     private String returnAddress;
 
-    @ApiModelProperty(value = "供应商退货联系人")
-    private String returnContactName;
-
-    @ApiModelProperty(value = "供应商退货联系电话")
-    private String returnContactPhone;
+    @ApiModelProperty(value = "供应商")
+    private String supName;
 
 
 

+ 63 - 0
src/main/java/com/dk/mdm/service/ivt/InboundReturnService.java

@@ -0,0 +1,63 @@
+package com.dk.mdm.service.ivt;
+
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.infrastructure.enums.ErrorCodeEnum;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.common.service.BaseService;
+import com.dk.mdm.mapper.ivt.InboundItemMapper;
+import com.dk.mdm.mapper.ivt.InboundMapper;
+import com.dk.mdm.model.pojo.ivt.Inbound;
+import com.dk.mdm.model.query.ivt.InboundItemQuery;
+import com.dk.mdm.model.query.ivt.InboundQuery;
+import com.dk.mdm.model.response.ivt.InboundItemResponse;
+import com.dk.mdm.model.response.ivt.InboundResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("inboundReturn")
+@Transactional
+public class InboundReturnService extends BaseService<Inbound> {
+
+    @Override
+    public BaseMapper<Inbound> getRepository() {
+        return inboundMapper;
+    }
+
+    @Resource
+    private InboundMapper inboundMapper;
+
+    @Autowired
+    private InboundItemMapper inboundItemMapper;
+
+
+    @Pagination
+    public ResponseResultVO<PageList<InboundResponse>> selectByCond(InboundQuery inboundQuery) {
+        return super.mergeListWithCount(inboundQuery, inboundMapper.selectByInboundReturnCond(inboundQuery), inboundMapper.countByInboundReturnCond(inboundQuery));
+    }
+
+    /**
+     * @desc : 查看来源单据,总单加明细  采购退货用
+     * @author : 于继渤
+     * @date : 2024/3/6 10:36
+     */
+    public ResponseResultVO<?> selectInboundReturnById(String intoId) {
+        //根据id查询
+        InboundResponse inboundResponse = inboundMapper.selectInboundReturnById(intoId);
+        //不存在
+        if (inboundResponse == null) {
+            return ResponseResultUtil.error(ErrorCodeEnum.INBOUND_CANNOT_BE_EMPTY.getCode(),
+                    ErrorCodeEnum.INBOUND_CANNOT_BE_EMPTY.getMessage());
+        }
+        //查询明细
+        List<InboundItemResponse> inboundItemResponselist = inboundItemMapper.selectByCond(new InboundItemQuery().setIntoId(intoId));
+        inboundResponse.setGoodsList(inboundItemResponselist);
+        return ResponseResultUtil.success(inboundResponse);
+    }
+}