zouxuan %!s(int64=5) %!d(string=hai) anos
pai
achega
f91c726ab5

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/FinancialExpenditureDao.java

@@ -1,12 +1,20 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.dto.FinancialExpenditureDto;
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface FinancialExpenditureDao extends BaseDAO<Long, FinancialExpenditure> {
 
     void batchInsert(@Param("financialExpenditures") List<FinancialExpenditure> financialExpenditures);
+
+    int findFinancialExpenditureCount(Map<String, Object> params);
+
+    List<FinancialExpenditureDto> queryFinancialExpenditurePage(Map<String, Object> params);
+
+    void batchDel(String ids);
 }

+ 40 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/FinancialExpenditureDto.java

@@ -0,0 +1,40 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.FinancialExpenditure;
+import io.swagger.annotations.ApiModelProperty;
+
+public class FinancialExpenditureDto extends FinancialExpenditure {
+
+    @ApiModelProperty(value = "批次号",required = false)
+    private String organName;
+
+    @ApiModelProperty(value = "批次号",required = false)
+    private String cooperationName;
+
+    @ApiModelProperty(value = "批次号",required = false)
+    private String realName;
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
+    public String getCooperationName() {
+        return cooperationName;
+    }
+
+    public void setCooperationName(String cooperationName) {
+        this.cooperationName = cooperationName;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+}

+ 95 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/FinancialExpenditureQueryInfo.java

@@ -0,0 +1,95 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+public class FinancialExpenditureQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value = "批次号",required = false)
+    private String batchNo;
+    /**  */
+    @ApiModelProperty(value = "财务流程编号",required = false)
+    private String financialProcessNo;
+    /**  */
+    @ApiModelProperty(value = "钉钉流程编号",required = false)
+    private String dingtalkProcessNo;
+    /**  */
+    @ApiModelProperty(value = "分部",required = false)
+    private Integer organId;
+    /**  */
+    @ApiModelProperty(value = "学校/合作单位",required = false)
+    private Integer cooperationOrganId;
+    /**  */
+    @ApiModelProperty(value = "申请人编号",required = false)
+    private Integer applyUserId;
+    /**  */
+    @ApiModelProperty(value = "开始时间",required = false)
+    private String startTime;
+    /**  */
+    @ApiModelProperty(value = "结束时间",required = false)
+    private String endTime;
+
+    public String getBatchNo() {
+        return batchNo;
+    }
+
+    public void setBatchNo(String batchNo) {
+        this.batchNo = batchNo;
+    }
+
+    public String getFinancialProcessNo() {
+        return financialProcessNo;
+    }
+
+    public void setFinancialProcessNo(String financialProcessNo) {
+        this.financialProcessNo = financialProcessNo;
+    }
+
+    public String getDingtalkProcessNo() {
+        return dingtalkProcessNo;
+    }
+
+    public void setDingtalkProcessNo(String dingtalkProcessNo) {
+        this.dingtalkProcessNo = dingtalkProcessNo;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public Integer getCooperationOrganId() {
+        return cooperationOrganId;
+    }
+
+    public void setCooperationOrganId(Integer cooperationOrganId) {
+        this.cooperationOrganId = cooperationOrganId;
+    }
+
+    public Integer getApplyUserId() {
+        return applyUserId;
+    }
+
+    public void setApplyUserId(Integer applyUserId) {
+        this.applyUserId = applyUserId;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+}

+ 17 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/FinancialExpenditureService.java

@@ -1,6 +1,10 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dto.FinancialExpenditureDto;
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
+import com.ym.mec.biz.dal.page.FinancialExpenditureQueryInfo;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -18,4 +22,17 @@ public interface FinancialExpenditureService extends BaseService<Long, Financial
      * @return java.lang.Object
      */
     List<FinancialExpenditure> importFinancialExpenditure(MultipartFile file) throws Exception;
+
+    PageInfo<FinancialExpenditureDto> queryFinancialExpenditurePage(FinancialExpenditureQueryInfo queryInfo);
+
+    /**
+     * @describe 批量删除
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/9/9
+     * @time 11:44
+     * @param ids:
+     * @return void
+     */
+    void batchDel(String ids);
 }

+ 34 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java

@@ -3,12 +3,17 @@ package com.ym.mec.biz.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.biz.dal.dao.FinancialExpenditureDao;
+import com.ym.mec.biz.dal.dto.FinancialExpenditureDto;
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
 import com.ym.mec.biz.dal.enums.TemplateTypeEnum;
+import com.ym.mec.biz.dal.page.FinancialExpenditureQueryInfo;
 import com.ym.mec.biz.service.FinancialExpenditureService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.excel.IniFileUtil;
 import com.ym.mec.util.excel.POIUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -23,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -115,4 +121,32 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
 		}
 		return financialExpenditures;
 	}
+
+	@Override
+	public PageInfo<FinancialExpenditureDto> queryFinancialExpenditurePage(FinancialExpenditureQueryInfo queryInfo){
+		PageInfo<FinancialExpenditureDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<FinancialExpenditureDto> dataList = null;
+		int count = financialExpenditureDao.findFinancialExpenditureCount(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = financialExpenditureDao.queryFinancialExpenditurePage(params);
+		}
+		if (count == 0) {
+			dataList = new ArrayList<>();
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
+
+	@Override
+	public void batchDel(String ids) {
+		if(StringUtils.isEmpty(ids)){
+			throw new BizException("参数校验失败");
+		}
+		financialExpenditureDao.batchDel(ids);
+	}
 }

+ 63 - 5
mec-biz/src/main/resources/config/mybatis/FinancialExpenditureMapper.xml

@@ -94,19 +94,77 @@
     </update>
 
     <!-- 根据主键删除一条记录 -->
-    <delete id="delete">
+    <update id="delete">
 		UPDATE charge_type SET del_flag_ = 1 WHERE id_ = #{id}
-	</delete>
+	</update>
+    <update id="batchDel">
+        UPDATE charge_type SET del_flag_ = 1 WHERE FIND_IN_SET(id_,#{ids})
+    </update>
+
+    <sql id="queryPageSql">
+        <where>
+            fe.del_flag_ = 0
+            <if test="batchNo != null and batchNo != ''">
+                AND fe.batch_no_ = #{batchNo}
+            </if>
+            <if test="financialProcessNo != null and financialProcessNo != ''">
+                AND fe.financial_process_no_ = #{financialProcessNo}
+            </if>
+            <if test="dingtalkProcessNo != null and dingtalkProcessNo != ''">
+                AND fe.dingtalk_process_no_ = #{dingtalkProcessNo}
+            </if>
+            <if test="organId != null">
+                AND fe.organ_id_ = #{organId}
+            </if>
+            <if test="cooperationOrganId != null">
+                AND fe.cooperation_organ_id_ = #{cooperationOrganId}
+            </if>
+            <if test="applyUserId != null">
+                AND fe.apply_user_id_ = #{applyUserId}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                AND DATE_FORMAT(fe.payment_time_,'%Y%m%d') &gt;= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND DATE_FORMAT(fe.payment_time_,'%Y%m%d') &lt;= #{endTime}
+            </if>
+        </where>
+    </sql>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="FinancialExpenditure" parameterType="map">
-        SELECT * FROM financial_expenditure
-        WHERE del_flag_ = 0
+        SELECT fe.*,o.name_ organ_name_,co.name_ cooperation_name_,su.real_name_
+        FROM financial_expenditure fe
+        LEFT JOIN organization o ON o.id_ = fe.organ_id_
+        LEFT JOIN sys_user su ON su.id_ = fe.apply_user_id_
+        LEFT JOIN cooperation_organ co ON co.id_ = fe.cooperation_organ_id_
+        <include refid="queryPageSql"/>
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM financial_expenditure WHERE del_flag_ = 0
+		SELECT COUNT(DISTINCT fe.id_) FROM financial_expenditure fe
+        <include refid="queryPageSql"/>
 	</select>
+
+    <resultMap type="com.ym.mec.biz.dal.dto.FinancialExpenditureDto" id="FinancialExpenditureDto" extends="FinancialExpenditure">
+        <result column="organ_name_" property="organName"/>
+        <result column="cooperation_name_" property="cooperationName"/>
+        <result column="real_name_" property="realName"/>
+    </resultMap>
+
+    <select id="findFinancialExpenditureCount" resultType="java.lang.Integer">
+        SELECT COUNT(DISTINCT fe.id_) FROM financial_expenditure fe
+        <include refid="queryPageSql"/>
+    </select>
+    <select id="queryFinancialExpenditurePage" resultMap="FinancialExpenditureDto">
+        SELECT fe.*,o.name_ organ_name_,co.name_ cooperation_name_,su.real_name_
+        FROM financial_expenditure fe
+        LEFT JOIN organization o ON o.id_ = fe.organ_id_
+        LEFT JOIN sys_user su ON su.id_ = fe.apply_user_id_
+        LEFT JOIN cooperation_organ co ON co.id_ = fe.cooperation_organ_id_
+        <include refid="queryPageSql"/>
+        <include refid="global.limit"/>
+    </select>
 </mapper>

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -59,12 +59,12 @@
     <insert id="batchInsert">
         INSERT INTO goods
         (goods_category_id_,name_,brand_,specification_,image_,market_price_,
-        discount_price_,group_purchase_price_,desc_,update_time_,create_time_,type_,agree_cost_price_)
+        discount_price_,group_purchase_price_,desc_,update_time_,create_time_,type_,agree_cost_price_,sn_)
         VALUES
         <foreach collection="goodsList" separator="," item="goods">
             (#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
             #{goods.discountPrice},#{goods.groupPurchasePrice},#{goods.desc},now(),now(),
-            #{goods.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{goods.agreeCostPrice})
+            #{goods.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{goods.agreeCostPrice},#{goods.sn})
         </foreach>
     </insert>
     <!-- 根据主键查询一条记录 -->

+ 7 - 6
mec-web/src/main/java/com/ym/mec/web/controller/FinancialExpenditureController.java

@@ -1,6 +1,7 @@
 package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
+import com.ym.mec.biz.dal.page.FinancialExpenditureQueryInfo;
 import com.ym.mec.biz.service.FinancialExpenditureService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.page.QueryInfo;
@@ -28,18 +29,18 @@ public class FinancialExpenditureController extends BaseController {
     }
 
     @ApiOperation(value = "删除财务支出")
-    @PostMapping("/del/{id}")
-    @PreAuthorize("@pcs.hasPermissions('financialExpenditure/del')")
-    public Object del(@ApiParam(value = "财务支出编号", required = true) @PathVariable("id") Long id) {
-        financialExpenditureService.delete(id);
+    @PostMapping("/batchDel")
+    @PreAuthorize("@pcs.hasPermissions('financialExpenditure/batchDel')")
+    public Object batchDel(String ids) {
+        financialExpenditureService.batchDel(ids);
         return succeed();
     }
 
     @ApiOperation(value = "分页查询财务支出列表")
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('financialExpenditure/queryPage')")
-    public Object queryPage(QueryInfo queryInfo) {
-        return succeed(financialExpenditureService.queryPage(queryInfo));
+    public Object queryPage(FinancialExpenditureQueryInfo queryInfo) {
+        return succeed(financialExpenditureService.queryFinancialExpenditurePage(queryInfo));
     }
 
 }