Преглед на файлове

发票添加是否下载的筛选项

徐滕 преди 1 месец
родител
ревизия
f23321cdde

+ 19 - 0
src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoice.java

@@ -170,6 +170,9 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 
 	private Integer isRedFlush;//是否红冲
 
+	private String downloadStatus;// 下载状态筛选(0:未下载,1:已下载)- 非持久化查询字段
+	private String downloadQueryUserId;// 下载状态筛选用的当前用户ID- 非持久化查询字段
+
 
 
 	public String getIsSzCloud() {
@@ -1187,6 +1190,22 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 		this.isRedFlush = isRedFlush;
 	}
 
+	public String getDownloadStatus() {
+		return downloadStatus;
+	}
+
+	public void setDownloadStatus(String downloadStatus) {
+		this.downloadStatus = downloadStatus;
+	}
+
+	public String getDownloadQueryUserId() {
+		return downloadQueryUserId;
+	}
+
+	public void setDownloadQueryUserId(String downloadQueryUserId) {
+		this.downloadQueryUserId = downloadQueryUserId;
+	}
+
 	public String getByRedInvoiceRelevancyId() {
 		return byRedInvoiceRelevancyId;
 	}

+ 10 - 0
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceTwoController.java

@@ -167,6 +167,10 @@ public class WorkInvoiceTwoController extends BaseController {
 		if(StringUtils.isBlank(workInvoice.getAccountCheckingUserId())){
 			workInvoice.setAccountCheckingUserId(null);
 		}
+		// 设置下载状态筛选用的当前用户ID
+		if(StringUtils.isNotBlank(workInvoice.getDownloadStatus())){
+			workInvoice.setDownloadQueryUserId(UserUtils.getUser().getId());
+		}
 		long l1 = System.currentTimeMillis();
 		Page<WorkInvoice> page = workInvoiceService.findPage(new Page<WorkInvoice>(request, response), workInvoice);
 
@@ -918,6 +922,12 @@ public class WorkInvoiceTwoController extends BaseController {
 	@RequestMapping(value = "export", method=RequestMethod.POST)
 	public String exportFile(WorkInvoice workInvoice, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
 		try {
+
+			// 设置下载状态筛选用的当前用户ID
+			if(StringUtils.isNotBlank(workInvoice.getDownloadStatus())){
+				workInvoice.setDownloadQueryUserId(UserUtils.getUser().getId());
+			}
+
 			String fileName = "发票一览表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
 			Page<WorkInvoice> page = workInvoiceService.findListExport(new Page<WorkInvoice>(request, response, -1), workInvoice);
 			List<WorkInvoice> workInvoiceList = page.getList();

+ 54 - 5
src/main/resources/mappings/modules/workinvoice/WorkInvoiceDao.xml

@@ -557,6 +557,9 @@
 		LEFT join sys_office so on so.id = a.office_id
 		LEFT JOIN sys_user sua ON sua.id = a.account_checking_user_id
 		left join sys_area sa on sa.id = a.area_id
+		<if test="downloadStatus != null and downloadStatus != '' and downloadQueryUserId != null and downloadQueryUserId != ''">
+			LEFT JOIN work_invoice_download_record dr ON a.id = dr.invoice_id AND dr.user_id = #{downloadQueryUserId} AND dr.del_flag = '0'
+		</if>
 		<if test="isRedFlush != null">
 			<!-- 1:只红冲数据 -->
 			<if test="isRedFlush == 1">
@@ -805,15 +808,24 @@
 			<if test="newDrawer != null and newDrawer != ''">
 				and new_drawer like
 				<if test="dbName == 'oracle'">'%'||#{newDrawer}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{newDrawer}+'%'</if>
+				<if test="dbName == 'mssql'">'%' + #{newDrawer} + '%'</if>
 				<if test="dbName == 'mysql'">concat('%',#{newDrawer},'%')</if>
 			</if>
-
+	
 			<if test="isOmsBilling != null">
 				AND a.is_oms_billing = #{isOmsBilling}
 			</if>
-
-
+	
+			<if test="downloadStatus != null and downloadStatus != ''">
+				<if test='downloadStatus == "1"'>
+					AND dr.invoice_id IS NOT NULL
+				</if>
+				<if test='downloadStatus == "0"'>
+					AND dr.invoice_id IS NULL
+				</if>
+			</if>
+	
+	
 			${sqlMap.dsf}
 		</where>
 		<choose>
@@ -825,7 +837,7 @@
 			</otherwise>
 		</choose>
 	</select>
-
+	
 	<select id="findListOnRedInvoice" resultType="WorkInvoice" >
 		SELECT
 		a.id AS "id",
@@ -1313,6 +1325,9 @@
 		LEFT join sys_office so on so.id = a.office_id
 		LEFT join sys_area sa on sa.id = a.area_id
 		left join work_invoice_receipt wir on wir.invoice_id = a.id
+		<if test="downloadStatus != null and downloadStatus != '' and downloadQueryUserId != null and downloadQueryUserId != ''">
+			LEFT JOIN work_invoice_download_record dr ON a.id = dr.invoice_id AND dr.user_id = #{downloadQueryUserId} AND dr.del_flag = '0'
+		</if>
 		<if test="isRedFlush != null">
 			<!-- 1:只红冲数据 -->
 			<if test="isRedFlush == 1">
@@ -1456,6 +1471,15 @@
 			</if>
 
 
+			<if test="downloadStatus != null and downloadStatus != ''">
+				<if test='downloadStatus == "1"'>
+					AND dr.invoice_id IS NOT NULL
+				</if>
+				<if test='downloadStatus == "0"'>
+					AND dr.invoice_id IS NULL
+				</if>
+			</if>
+
 			${sqlMap.dsf}
 		</where>
 		<choose>
@@ -1533,6 +1557,10 @@
 			left join sys_area sa on sa.id = a.area_id
 		</if>
 
+		<if test="downloadStatus != null and downloadStatus != '' and downloadQueryUserId != null and downloadQueryUserId != ''">
+			LEFT JOIN work_invoice_download_record dr ON a.id = dr.invoice_id AND dr.user_id = #{downloadQueryUserId} AND dr.del_flag = '0'
+		</if>
+
 		<!-- 红冲逻辑不变 -->
 		<if test="isRedFlush != null">
 			<if test="isRedFlush == 1">
@@ -1689,6 +1717,14 @@
 			<if test="reportNumber != null and reportNumber != ''">
 				and prds.number like concat('%',#{reportNumber},'%')
 			</if>
+			<if test="downloadStatus != null and downloadStatus != ''">
+				<if test='downloadStatus == "1"'>
+					AND dr.invoice_id IS NOT NULL
+				</if>
+				<if test='downloadStatus == "0"'>
+					AND dr.invoice_id IS NULL
+				</if>
+			</if>
 
 			${sqlMap.dsf}
 		</where>
@@ -1740,6 +1776,11 @@
 			LEFT JOIN sys_user sua ON sua.id = a.account_checking_user_id
 		</if>
 
+		<!-- 下载状态筛选 -->
+		<if test="downloadStatus != null and downloadStatus != '' and downloadQueryUserId != null and downloadQueryUserId != ''">
+			LEFT JOIN work_invoice_download_record dr ON a.id = dr.invoice_id AND dr.user_id = #{downloadQueryUserId} AND dr.del_flag = '0'
+		</if>
+
 		<!-- 红冲逻辑保持不变 -->
 		<if test="isRedFlush != null">
 			<if test="isRedFlush == 1">
@@ -1923,6 +1964,14 @@
 			<if test="isOmsBilling != null">
 				AND a.is_oms_billing = #{isOmsBilling}
 			</if>
+			<if test="downloadStatus != null and downloadStatus != ''">
+				<if test='downloadStatus == "1"'>
+					AND dr.invoice_id IS NOT NULL
+				</if>
+				<if test='downloadStatus == "0"'>
+					AND dr.invoice_id IS NULL
+				</if>
+			</if>
 			${sqlMap.dsf}
 		</where>
 

+ 11 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceTwoList.jsp

@@ -838,6 +838,17 @@
 							</div>
 						</div>
 
+						<div class="layui-item query athird">
+							<label class="layui-form-label">下载状态:</label>
+							<div class="layui-input-block with-icon">
+								<select id="downloadStatus" name="downloadStatus" class="form-control simple-select">
+									<option value=""></option>
+									<option value="0" <c:if test="${workInvoiceShow.downloadStatus=='0'}">selected</c:if>>未下载</option>
+									<option value="1" <c:if test="${workInvoiceShow.downloadStatus=='1'}">selected</c:if>>已下载</option>
+								</select>
+							</div>
+						</div>
+
 					</div>
 				</form:form>
 			</div>