From 6777f62a955b3b1b41247955c20badc7d7a61473 Mon Sep 17 00:00:00 2001 From: xinyb <574600396@qq.com> Date: 星期四, 19 九月 2024 13:56:50 +0800 Subject: [PATCH] 优化10窗体3类型窗体回车赋值问题 --- src/com/yc/crm/mail/service/MailImpl.java | 91 +++------------------------------------------ 1 files changed, 6 insertions(+), 85 deletions(-) diff --git a/src/com/yc/crm/mail/service/MailImpl.java b/src/com/yc/crm/mail/service/MailImpl.java index 544ef79..9ba4a6c 100644 --- a/src/com/yc/crm/mail/service/MailImpl.java +++ b/src/com/yc/crm/mail/service/MailImpl.java @@ -3,7 +3,6 @@ import com.yc.action.grid.GridUtils; import com.yc.crm.mail.entity.*; import com.yc.entity.AttachmentConfig; -import com.yc.entity.attachment.AttachmentEntity; import com.yc.sdk.shopping.service.imagedata.ShoppingImageDataIfc; import com.yc.sdk.weixincp.util.UploadFiles; import com.yc.service.BaseService; @@ -14,11 +13,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -210,7 +205,7 @@ } @Override - public List<t482101HList> getReceivingMailList(String email, Integer mailType, boolean isNoRead, String userCode) { + public List<t482101HList> getReceivingMailList(String email, Integer mailType, boolean isNoRead, String userCode, Integer page, Integer limit) { String sql = "set nocount on\n"; try { sql += "select companyId,companyName,mailType,DocCode,senderName,sender,receiver,subject,plain_text," + @@ -229,6 +224,8 @@ if (isNoRead) {//0琛ㄧず鏈锛�1琛ㄧず宸茶 sql += " and isnull(read_flag,0) = 0"; } + sql += " order by docCode asc \n"; + sql += " OFFSET (" + page + " - 1) * " + limit + " ROWS FETCH NEXT " + limit + " ROWS ONLY"; return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(t482101HList.class)); } catch (Exception e) { throw e; @@ -236,7 +233,7 @@ } @Override - public List<t482101HList> getHandleMailList(String email, String userCode) { + public List<t482101HList> getHandleMailList(String email, String userCode, Integer page, Integer limit) { String sql = "set nocount on\n"; try { sql += "select companyId,companyName,mailType,DocCode,senderName,sender,receiver,subject,plain_text," + @@ -245,6 +242,8 @@ "handle_time from t482101H "; sql += " where isnull(handle_time,'') <> '' and isnull(handle_time,'') < getdate()"; sql += " and userCode=" + GridUtils.prossSqlParm(userCode) + " and receiver like '%" + email + "%'"; + sql += " order by docCode asc \n"; + sql += " OFFSET (" + page + " - 1) * " + limit + " ROWS FETCH NEXT " + limit + " ROWS ONLY"; return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(t482101HList.class)); } catch (Exception e) { throw e; @@ -276,84 +275,6 @@ "update_time=getdate() \n"; sql += " where docCode=" + GridUtils.prossSqlParm(mail.getDocCode()); sql += " select @@ROWCOUNT"; - return jdbcTemplate.queryForObject(sql, Integer.class); - } catch (Exception e) { - throw e; - } - } - - @Override - public void saveAttachment(List<MailFileEntity> mailFile) { - try { - - } catch (Exception e) { - throw e; - } - } - - - @Override - public List<AttachmentEntity> getAttachmentEntityList(String unIdSeq) { - String unId = null; - if (StringUtils.isBlank(unIdSeq)) { - return null; - } - String[] array = unIdSeq.split(";"); - unId = array[0];//鍦ㄦ湁鍊兼椂鍊欑涓�涓繀瀹氭槸unId - ArrayList<String> fieldId = new ArrayList<>(Arrays.asList(array)); - fieldId.remove(0);//鍘绘帀绗竴涓厓绱狅紙UNID锛� - String sql = " set nocount on \n" - + " declare @unid varchar(50) = " + GridUtils.prossSqlParm(unId) + - ",@fieldid varchar(1000) = " + GridUtils.prossSqlParm(StringUtils.join(fieldId, ",")) + " \n"; - - sql += " select UNID,seq,DocCode,RowId,FieldId,FormId, \n" - + " PhysicalPath,PhysicalFile,OriginalFileName,FileSize,FileType, \n" - + " AuthorCode,AuthorName,SmallPicPath,UploadTime,OriginalPicture \n" - + " from _sys_Attachment \n" - + " where unid = @unid "; - if (fieldId.size() > 0) { - if (isNumeric(fieldId.get(0))) { - sql += " and seq in(select list from GetInStr(@fieldid)) \n"; - } else { - sql += " and fieldid in(select list from GetInStr(@fieldid)) \n"; - } - } - List<Map<String, Object>> list = this.jdbcTemplate.queryForList(sql); - List<AttachmentEntity> attachmentList = new ArrayList<AttachmentEntity>(); - for (int i = 0; list != null && i < list.size(); i++) { - AttachmentEntity attachment = new AttachmentEntity(); - attachment.setUnid(unId); - attachment.setPhysicalFile(list.get(i).get("PhysicalFile") == null ? null : (String) list.get(i).get("PhysicalFile")); - attachment.setOriginalFileName(list.get(i).get("OriginalFileName") == null ? null : (String) list.get(i).get("OriginalFileName")); - attachment.setOriginalPicture(list.get(i).get("OriginalPicture") == null ? null : (byte[]) list.get(i).get("OriginalPicture")); //闄勪欢澶勭悊 - attachmentList.add(attachment); - } - return attachmentList; - } - - /** - * 鍒ゆ柇鏄惁涓烘暟瀛� - * - * @param str - * @return - */ - private static boolean isNumeric(String str) { - Pattern pattern = Pattern.compile("\\d+"); - Matcher matcher = pattern.matcher(str); - return matcher.matches(); - } - - @Transactional(rollbackFor = Exception.class) - @Override - public Integer deleteAttachment(List<String> unId) { - try { - if (unId == null || unId.size() == 0) { - return 0; - } - String sql = " set nocount on \n" - + " declare @unid varchar(4000) = '" + StringUtils.join(unId, ",") + "' \n"; - sql += "delete _sys_Attachment where unid in (select list from GetInStr(@unid)) \n"; - sql += "select @@ROWCOUNT"; return jdbcTemplate.queryForObject(sql, Integer.class); } catch (Exception e) { throw e; -- Gitblit v1.8.0