Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
iBiz商业中心
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz商业套件
iBiz商业中心
提交
8b03425a
提交
8b03425a
编写于
10月 23, 2020
作者:
misaka
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
a9958486
变更
5
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
184 行增加
和
1 行删除
+184
-1
Ir_sequenceExService.java
...central/core/extensions/service/Ir_sequenceExService.java
+1
-0
Mail_followersExService.java
...tral/core/extensions/service/Mail_followersExService.java
+53
-1
Mail_messageExService.java
...entral/core/extensions/service/Mail_messageExService.java
+4
-0
Mail_tracking_valueExService.java
...core/extensions/service/Mail_tracking_valueExService.java
+119
-0
Purchase_requisitionExService.java
...ore/extensions/service/Purchase_requisitionExService.java
+7
-0
未找到文件。
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/extensions/service/Ir_sequenceExService.java
浏览文件 @
8b03425a
...
@@ -103,6 +103,7 @@ public class Ir_sequenceExService extends Ir_sequenceServiceImpl {
...
@@ -103,6 +103,7 @@ public class Ir_sequenceExService extends Ir_sequenceServiceImpl {
}
else
{
}
else
{
if
(
true
)
if
(
true
)
throw
new
RuntimeException
(
"暂未实现"
);
throw
new
RuntimeException
(
"暂未实现"
);
Timestamp
seq_date
=
et
.
get
(
"sequence_date"
)
==
null
?
null
:
(
Timestamp
)
et
.
get
(
"sequence_date"
);
// 带有时间范围
// 带有时间范围
Ir_sequence_date_rangeSearchContext
ctx
=
new
Ir_sequence_date_rangeSearchContext
();
Ir_sequence_date_rangeSearchContext
ctx
=
new
Ir_sequence_date_rangeSearchContext
();
ctx
.
setN_sequence_id_eq
(
et
.
getId
());
ctx
.
setN_sequence_id_eq
(
et
.
getId
());
...
...
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/extensions/service/Mail_followersExService.java
浏览文件 @
8b03425a
package
cn
.
ibizlab
.
businesscentral
.
core
.
extensions
.
service
;
package
cn
.
ibizlab
.
businesscentral
.
core
.
extensions
.
service
;
import
cn.ibizlab.businesscentral.core.odoo_base.domain.Res_users
;
import
cn.ibizlab.businesscentral.core.odoo_base.service.IRes_usersService
;
import
cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_followers
;
import
cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_followers
;
import
cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_followers_mail_message_subtype_rel
;
import
cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_message_subtype
;
import
cn.ibizlab.businesscentral.core.odoo_mail.filter.Mail_message_subtypeSearchContext
;
import
cn.ibizlab.businesscentral.core.odoo_mail.service.IMail_followers_mail_message_subtype_relService
;
import
cn.ibizlab.businesscentral.core.odoo_mail.service.IMail_message_subtypeService
;
import
cn.ibizlab.businesscentral.core.odoo_mail.service.impl.Mail_followersServiceImpl
;
import
cn.ibizlab.businesscentral.core.odoo_mail.service.impl.Mail_followersServiceImpl
;
import
cn.ibizlab.businesscentral.util.domain.EntityMP
;
import
cn.ibizlab.businesscentral.util.security.AuthenticationUser
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Slf4j
@Slf4j
@Primary
@Primary
@Service
(
"Mail_followersExService"
)
@Service
(
"Mail_followersExService"
)
public
class
Mail_followersExService
extends
Mail_followersServiceImpl
{
public
class
Mail_followersExService
extends
Mail_followersServiceImpl
{
@Autowired
IMail_followers_mail_message_subtype_relService
mail_followers_mail_message_subtype_relService
;
@Autowired
IRes_usersService
res_usersService
;
@Autowired
IMail_message_subtypeService
mail_message_subtypeService
;
@Override
protected
Class
currentModelClass
()
{
return
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
ReflectionKit
.
getSuperClassGenericType
(
this
.
getClass
().
getSuperclass
(),
1
);
}
@Override
@Override
public
boolean
create
(
Mail_followers
et
)
{
public
boolean
create
(
Mail_followers
et
)
{
Mail_followers
exists
=
new
Mail_followers
();
Mail_followers
exists
=
new
Mail_followers
();
...
@@ -26,10 +52,36 @@ public class Mail_followersExService extends Mail_followersServiceImpl {
...
@@ -26,10 +52,36 @@ public class Mail_followersExService extends Mail_followersServiceImpl {
return
super
.
create
(
et
);
return
super
.
create
(
et
);
}
}
public
<
T
>
void
add_default_followers
(
T
et
)
{
public
<
T
extends
EntityMP
>
void
add_default_followers
(
T
et
)
{
if
(
et
.
get
(
"id"
)
==
null
)
{
return
;
}
if
(
et
.
get
(
"mail_create_nosubscribe"
)
!=
null
)
{
return
;
}
AuthenticationUser
user
=
AuthenticationUser
.
getAuthenticationUser
();
Res_users
res_users
=
res_usersService
.
get
(
Long
.
parseLong
(
user
.
getUserid
()));
Mail_followers
follower
=
new
Mail_followers
();
follower
.
setResModel
(
et
.
getIrModel
());
follower
.
setResId
(
Integer
.
parseInt
(
et
.
get
(
"id"
).
toString
()));
follower
.
setPartnerId
(
res_users
.
getPartnerId
());
this
.
create
(
follower
);
//关注消息类型
Mail_message_subtypeSearchContext
ctx
=
new
Mail_message_subtypeSearchContext
();
ctx
.
set
(
"res_model"
,
et
.
getIrModel
());
List
<
Mail_message_subtype
>
message_subtypes
=
mail_message_subtypeService
.
searchDefaultEx
(
ctx
).
getContent
();
for
(
Mail_message_subtype
message_subtype
:
message_subtypes
)
{
Mail_followers_mail_message_subtype_rel
rel
=
new
Mail_followers_mail_message_subtype_rel
();
rel
.
setMailFollowersId
(
follower
.
getId
());
rel
.
setMailMessageSubtypeId
(
message_subtype
.
getId
());
mail_followers_mail_message_subtype_relService
.
create
(
rel
);
}
}
}
public
<
T
>
void
add_followers
(
T
et
)
{
public
<
T
>
void
add_followers
(
T
et
)
{
}
}
...
...
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/extensions/service/Mail_messageExService.java
浏览文件 @
8b03425a
...
@@ -10,5 +10,9 @@ import org.springframework.stereotype.Service;
...
@@ -10,5 +10,9 @@ import org.springframework.stereotype.Service;
@Service
(
"Mail_messageExService"
)
@Service
(
"Mail_messageExService"
)
public
class
Mail_messageExService
extends
Mail_messageServiceImpl
{
public
class
Mail_messageExService
extends
Mail_messageServiceImpl
{
@Override
protected
Class
currentModelClass
()
{
return
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
ReflectionKit
.
getSuperClassGenericType
(
this
.
getClass
().
getSuperclass
(),
1
);
}
}
}
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/extensions/service/Mail_tracking_valueExService.java
浏览文件 @
8b03425a
package
cn
.
ibizlab
.
businesscentral
.
core
.
extensions
.
service
;
package
cn
.
ibizlab
.
businesscentral
.
core
.
extensions
.
service
;
import
cn.ibizlab.businesscentral.core.odoo_ir.domain.Ir_model_fields
;
import
cn.ibizlab.businesscentral.core.odoo_ir.filter.Ir_model_fieldsSearchContext
;
import
cn.ibizlab.businesscentral.core.odoo_ir.service.IIr_model_fieldsService
;
import
cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_message
;
import
cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_message_subtype
;
import
cn.ibizlab.businesscentral.core.odoo_mail.service.impl.Mail_tracking_valueServiceImpl
;
import
cn.ibizlab.businesscentral.core.odoo_mail.service.impl.Mail_tracking_valueServiceImpl
;
import
cn.ibizlab.businesscentral.core.util.helper.EBSServiceImpl
;
import
cn.ibizlab.businesscentral.util.domain.EntityMP
;
import
cn.ibizlab.businesscentral.util.helper.CaseFormatMethod
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_tracking_value
;
import
cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_tracking_value
;
import
org.apache.commons.lang3.StringUtils
;
import
org.javers.core.JaversBuilder
;
import
org.javers.core.diff.Change
;
import
org.javers.core.diff.Diff
;
import
org.javers.core.diff.changetype.ValueChange
;
import
org.javers.core.metamodel.clazz.EntityDefinitionBuilder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.context.annotation.Primary
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* 实体[邮件跟踪值] 自定义服务对象
* 实体[邮件跟踪值] 自定义服务对象
...
@@ -16,6 +33,9 @@ import java.util.*;
...
@@ -16,6 +33,9 @@ import java.util.*;
@Service
(
"Mail_tracking_valueExService"
)
@Service
(
"Mail_tracking_valueExService"
)
public
class
Mail_tracking_valueExService
extends
Mail_tracking_valueServiceImpl
{
public
class
Mail_tracking_valueExService
extends
Mail_tracking_valueServiceImpl
{
@Autowired
IIr_model_fieldsService
ir_model_fieldsService
;
@Override
@Override
protected
Class
currentModelClass
()
{
protected
Class
currentModelClass
()
{
return
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
ReflectionKit
.
getSuperClassGenericType
(
this
.
getClass
().
getSuperclass
(),
1
);
return
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
ReflectionKit
.
getSuperClassGenericType
(
this
.
getClass
().
getSuperclass
(),
1
);
...
@@ -23,6 +43,7 @@ public class Mail_tracking_valueExService extends Mail_tracking_valueServiceImpl
...
@@ -23,6 +43,7 @@ public class Mail_tracking_valueExService extends Mail_tracking_valueServiceImpl
/**
/**
* 自定义行为[A]用户扩展
* 自定义行为[A]用户扩展
*
* @param et
* @param et
* @return
* @return
*/
*/
...
@@ -31,5 +52,103 @@ public class Mail_tracking_valueExService extends Mail_tracking_valueServiceImpl
...
@@ -31,5 +52,103 @@ public class Mail_tracking_valueExService extends Mail_tracking_valueServiceImpl
public
Mail_tracking_value
a
(
Mail_tracking_value
et
)
{
public
Mail_tracking_value
a
(
Mail_tracking_value
et
)
{
return
super
.
a
(
et
);
return
super
.
a
(
et
);
}
}
@Transactional
public
<
T
extends
EntityMP
>
void
add_default_create_message
(
EBSServiceImpl
service
,
T
et
)
{
Mail_message
message
=
new
Mail_message
();
message
.
setModel
(
et
.
getIrModel
());
message
.
setResId
((
Integer
)
et
.
get
(
"id"
));
message
.
setBody
(
et
.
getIrModel
()
+
" create"
);
message
.
setSubtypeId
(
2
l
);
message
.
setMessageType
(
"notification"
);
// SpringContextHolder.getBean(IMail_messageService.class).create(null);
}
@Transactional
public
<
T
extends
EntityMP
>
List
<
Mail_tracking_value
>
message_track
(
EBSServiceImpl
service
,
T
_old
,
T
_new
)
{
List
<
Mail_tracking_value
>
tracking_values
=
new
ArrayList
<>();
List
<
Ir_model_fields
>
fields
=
this
.
getIr_fields
(
_old
);
if
(
fields
.
size
()
==
0
)
return
tracking_values
;
List
<
String
>
strCodeFields
=
fields
.
stream
().
map
(
u
->
CaseFormatMethod
.
exec
(
u
.
getName
(),
"l_u2lC"
)).
collect
(
Collectors
.
toList
());
strCodeFields
.
add
(
"id"
);
JaversBuilder
javersBuilder
=
JaversBuilder
.
javers
();
EntityDefinitionBuilder
entityDefinitionBuilder
=
EntityDefinitionBuilder
.
entityDefinition
(
_old
.
getClass
());
entityDefinitionBuilder
.
withIdPropertyName
(
"id"
);
entityDefinitionBuilder
.
withIncludedProperties
(
strCodeFields
);
javersBuilder
.
registerType
(
entityDefinitionBuilder
.
build
());
Diff
diff
=
javersBuilder
.
build
().
compare
(
_old
,
_new
);
if
(!
diff
.
hasChanges
())
return
tracking_values
;
Mail_message_subtype
message_subtype
=
service
.
getMessageSubType
(
_new
,
diff
);
Mail_message
message
=
new
Mail_message
();
message
.
setModel
(
_old
.
getIrModel
());
message
.
setResId
((
Integer
)
_old
.
get
(
"id"
));
message
.
setBody
(
""
);
message
.
setSubtypeId
(
message_subtype
.
getId
());
message
.
setMessageType
(
"notification"
);
for
(
Change
change
:
diff
.
getChanges
())
{
if
(
change
instanceof
ValueChange
)
{
ValueChange
vchange
=
(
ValueChange
)
change
;
String
str_ir_model_fields
=
CaseFormatMethod
.
exec
(
vchange
.
getPropertyName
(),
"lC2l_u"
);
Ir_model_fields
ir_model_fields
=
fields
.
stream
().
filter
(
s
->
{
return
s
.
getName
().
equals
(
str_ir_model_fields
);
}).
findAny
().
get
();
Mail_tracking_value
tracking_value
=
new
Mail_tracking_value
();
tracking_value
.
setMailMessageId
(
0
l
);
tracking_value
.
setField
(
ir_model_fields
.
getName
());
tracking_value
.
setFieldDesc
(
ir_model_fields
.
getFieldDescription
());
tracking_value
.
setFieldType
(
ir_model_fields
.
getTtype
());
tracking_value
.
setTrackSequence
(
ir_model_fields
.
getTracking
());
setTrackingValue
(
tracking_value
,
ir_model_fields
,
vchange
);
tracking_values
.
add
(
tracking_value
);
}
}
return
tracking_values
;
}
private
void
setTrackingValue
(
Mail_tracking_value
mail_tracking_value
,
Ir_model_fields
ir_model_fields
,
ValueChange
vchange
)
{
if
(
StringUtils
.
compare
(
ir_model_fields
.
getTtype
(),
"date"
)
==
0
||
StringUtils
.
compare
(
ir_model_fields
.
getTtype
(),
"datetime"
)
==
0
)
{
mail_tracking_value
.
set
(
"oldValueDatetime"
,
vchange
.
getLeft
());
mail_tracking_value
.
set
(
"newValueDatetime"
,
vchange
.
getRight
());
}
else
if
(
StringUtils
.
compare
(
ir_model_fields
.
getTtype
(),
"integer"
)
==
0
||
StringUtils
.
compare
(
ir_model_fields
.
getTtype
(),
"many2one"
)
==
0
)
{
mail_tracking_value
.
set
(
"oldValueInteger"
,
vchange
.
getLeft
());
mail_tracking_value
.
set
(
"newValueInteger"
,
vchange
.
getRight
());
}
else
if
(
StringUtils
.
compare
(
ir_model_fields
.
getTtype
(),
"float"
)
==
0
)
{
mail_tracking_value
.
set
(
"oldValueFloat"
,
vchange
.
getLeft
());
mail_tracking_value
.
set
(
"newValueFloat"
,
vchange
.
getRight
());
}
else
if
(
StringUtils
.
compare
(
ir_model_fields
.
getTtype
(),
"monetary"
)
==
0
)
{
mail_tracking_value
.
set
(
"oldValueMonetary"
,
vchange
.
getLeft
());
mail_tracking_value
.
set
(
"newValueMonetary"
,
vchange
.
getRight
());
}
else
if
(
StringUtils
.
compare
(
ir_model_fields
.
getTtype
(),
"selection"
)
==
0
)
{
mail_tracking_value
.
set
(
"oldValueChar"
,
vchange
.
getLeft
());
mail_tracking_value
.
set
(
"newValueChar"
,
vchange
.
getRight
());
}
else
if
(
StringUtils
.
compare
(
ir_model_fields
.
getTtype
(),
"text"
)
==
0
)
{
mail_tracking_value
.
set
(
"oldValueText"
,
vchange
.
getLeft
());
mail_tracking_value
.
set
(
"newValueText"
,
vchange
.
getRight
());
}
else
{
mail_tracking_value
.
set
(
"oldValueChar"
,
vchange
.
getLeft
());
mail_tracking_value
.
set
(
"newValueChar"
,
vchange
.
getRight
());
}
}
private
Map
<
String
,
List
<
Ir_model_fields
>>
ir_model_fieldsMap
=
new
HashMap
<>();
private
<
T
extends
EntityMP
>
List
<
Ir_model_fields
>
getIr_fields
(
T
et
)
{
if
(
ir_model_fieldsMap
.
containsKey
(
et
.
getIrModel
()))
return
ir_model_fieldsMap
.
get
(
et
.
getIrModel
());
Ir_model_fieldsSearchContext
ctx
=
new
Ir_model_fieldsSearchContext
();
ctx
.
setN_model_eq
(
et
.
getIrModel
());
List
<
Ir_model_fields
>
fields
=
ir_model_fieldsService
.
searchTrackingFields
(
ctx
).
getContent
();
ir_model_fieldsMap
.
put
(
et
.
getIrModel
(),
fields
);
return
fields
;
}
}
}
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/extensions/service/Purchase_requisitionExService.java
浏览文件 @
8b03425a
...
@@ -176,7 +176,14 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
...
@@ -176,7 +176,14 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
et
.
setOrderCount
(
purchaseOrderService
.
count
(
new
QueryWrapper
<
Purchase_order
>().
setEntity
(
order
)));
et
.
setOrderCount
(
purchaseOrderService
.
count
(
new
QueryWrapper
<
Purchase_order
>().
setEntity
(
order
)));
}
}
// Mail_followersExService.add_default_followers(et);
return
super
.
masterTabCount
(
et
);
return
super
.
masterTabCount
(
et
);
}
}
@Autowired
Mail_followersExService
Mail_followersExService
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录